Mercurial > pidgin
changeset 21677:bd36fdd36e92
Fix crashing in the Timestamp plugin. Fixes #4087.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 28 Nov 2007 02:14:29 +0000 |
parents | 8afd3495c488 |
children | a312781708e8 |
files | pidgin/plugins/timestamp.c |
diffstat | 1 files changed, 7 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/plugins/timestamp.c Wed Nov 28 01:34:48 2007 +0000 +++ b/pidgin/plugins/timestamp.c Wed Nov 28 02:14:29 2007 +0000 @@ -49,11 +49,17 @@ const char *mdate; int y, height; GdkRectangle rect; - + /* display timestamp */ mdate = purple_utf8_strftime(then == 0 ? "%H:%M" : "\n%H:%M", localtime(&now)); gtk_text_buffer_get_end_iter(buffer, &iter); + + if (gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer), "TIMESTAMP") == NULL) + gtk_text_buffer_create_tag(buffer, "TIMESTAMP", + "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, + "weight", PANGO_WEIGHT_BOLD, NULL); + gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, mdate, strlen(mdate), "TIMESTAMP", NULL); @@ -95,17 +101,9 @@ static void timestamp_new_convo(PurpleConversation *conv) { - PidginConversation *gtk_conv = PIDGIN_CONVERSATION(conv); - GtkTextBuffer *buffer; - if (!g_list_find(purple_get_conversations(), conv)) return; - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtk_conv->imhtml)); - gtk_text_buffer_create_tag(buffer, "TIMESTAMP", - "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, - "weight", PANGO_WEIGHT_BOLD, NULL); - purple_conversation_set_data(conv, "timestamp-last", GINT_TO_POINTER(0)); }