im.pidgin.pidgin: 94224c6b7f9215a59d27023874ccec8a0b803093
sadrul at pidgin.im
sadrul at pidgin.im
Tue Dec 18 16:30:55 EST 2007
-----------------------------------------------------------------
Revision: 94224c6b7f9215a59d27023874ccec8a0b803093
Ancestor: 3ab4916656603d681043b6a5bcb4426128ac5843
Author: sadrul at pidgin.im
Date: 2007-12-18T21:24:28
Branch: im.pidgin.pidgin
Modified files:
pidgin/gtkconv.c
ChangeLog:
Typing notification in the conversation history.
-------------- next part --------------
============================================================
--- pidgin/gtkconv.c 7e4c353b5323b950a70c987bbf522c63f39aee2d
+++ pidgin/gtkconv.c 8dc8cd625638073bf8d2da024843defb97ad3517
@@ -153,6 +153,7 @@ static void update_typing_icon(PidginCon
static void conv_set_unseen(PurpleConversation *gtkconv, PidginUnseenState state);
static void gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state);
static void update_typing_icon(PidginConversation *gtkconv);
+static void update_typing_message(PidginConversation *gtkconv, const char *message);
static const char *item_factory_translate_func (const char *path, gpointer func_data);
gboolean pidgin_conv_has_focus(PurpleConversation *conv);
static void pidgin_conv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data);
@@ -3377,6 +3378,33 @@ static void
}
static void
+update_typing_message(PidginConversation *gtkconv, const char *message)
+{
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml));
+ GtkTextMark *stmark, *enmark;
+
+ stmark = gtk_text_buffer_get_mark(buffer, "typing-notification-start");
+ enmark = gtk_text_buffer_get_mark(buffer, "typing-notification-end");
+ if (stmark && enmark) {
+ GtkTextIter start, end;
+ gtk_text_buffer_get_iter_at_mark(buffer, &start, stmark);
+ gtk_text_buffer_get_iter_at_mark(buffer, &end, enmark);
+ gtk_text_buffer_delete_mark(buffer, stmark);
+ gtk_text_buffer_delete_mark(buffer, enmark);
+ gtk_text_buffer_delete(buffer, &start, &end);
+ }
+
+ if (message) {
+ GtkTextIter iter;
+ gtk_text_buffer_get_end_iter(buffer, &iter);
+ gtk_text_buffer_create_mark(buffer, "typing-notification-start", &iter, TRUE);
+ gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, message, -1, "TYPING-NOTIFICATION", NULL);
+ gtk_text_buffer_get_end_iter(buffer, &iter);
+ gtk_text_buffer_create_mark(buffer, "typing-notification-end", &iter, TRUE);
+ }
+}
+
+static void
update_typing_icon(PidginConversation *gtkconv)
{
PidginWindow *gtkwin;
@@ -3384,6 +3412,7 @@ update_typing_icon(PidginConversation *g
PurpleConversation *conv = gtkconv->active_conv;
char *stock_id;
const char *tooltip;
+ char *message = NULL;
gtkwin = gtkconv->win;
@@ -3402,6 +3431,7 @@ update_typing_icon(PidginConversation *g
g_source_remove(gtkconv->u.im->typing_timer);
gtkconv->u.im->typing_timer = 0;
}
+ update_typing_message(gtkconv, NULL);
return;
}
@@ -3411,9 +3441,11 @@ update_typing_icon(PidginConversation *g
}
stock_id = PIDGIN_STOCK_ANIMATION_TYPING1;
tooltip = _("User is typing...");
+ message = g_strdup_printf(_("\n%s is typing..."), purple_conversation_get_name(conv));
} else {
stock_id = PIDGIN_STOCK_ANIMATION_TYPING5;
tooltip = _("User has typed something and stopped");
+ message = g_strdup_printf(_("\n%s has typed something and stopped"), purple_conversation_get_name(conv));
if (gtkconv->u.im->typing_timer != 0) {
g_source_remove(gtkconv->u.im->typing_timer);
gtkconv->u.im->typing_timer = 0;
@@ -3436,6 +3468,8 @@ update_typing_icon(PidginConversation *g
}
gtk_widget_show(gtkwin->menu.typing_icon);
+ update_typing_message(gtkconv, message);
+ g_free(message);
}
static gboolean
@@ -5031,6 +5065,11 @@ private_gtkconv_new(PurpleConversation *
g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received",
G_CALLBACK(conv_dnd_recv), gtkconv);
+ gtk_text_buffer_create_tag(GTK_IMHTML(gtkconv->imhtml)->text_buffer, "TYPING-NOTIFICATION",
+ "foreground", "#888888",
+ "justification", GTK_JUSTIFY_LEFT, /* XXX: RTL'ify */
+ "weight", PANGO_WEIGHT_BOLD, NULL);
+
/* Setup the container for the tab. */
gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
g_object_set_data(G_OBJECT(tab_cont), "PidginConversation", gtkconv);
More information about the Commits
mailing list