| 47 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)); |
47 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)); |
| 48 GtkTextIter iter; |
48 GtkTextIter iter; |
| 49 const char *mdate; |
49 const char *mdate; |
| 50 int y, height; |
50 int y, height; |
| 51 GdkRectangle rect; |
51 GdkRectangle rect; |
| 52 |
52 |
| 53 /* display timestamp */ |
53 /* display timestamp */ |
| 54 mdate = purple_utf8_strftime(then == 0 ? "%H:%M" : "\n%H:%M", |
54 mdate = purple_utf8_strftime(then == 0 ? "%H:%M" : "\n%H:%M", |
| 55 localtime(&now)); |
55 localtime(&now)); |
| 56 gtk_text_buffer_get_end_iter(buffer, &iter); |
56 gtk_text_buffer_get_end_iter(buffer, &iter); |
| |
57 |
| |
58 if (gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer), "TIMESTAMP") == NULL) |
| |
59 gtk_text_buffer_create_tag(buffer, "TIMESTAMP", |
| |
60 "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, |
| |
61 "weight", PANGO_WEIGHT_BOLD, NULL); |
| |
62 |
| 57 gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, mdate, |
63 gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, mdate, |
| 58 strlen(mdate), "TIMESTAMP", NULL); |
64 strlen(mdate), "TIMESTAMP", NULL); |
| 59 |
65 |
| 60 /* scroll view if necessary */ |
66 /* scroll view if necessary */ |
| 61 gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(imhtml), &rect); |
67 gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(imhtml), &rect); |
| 93 } |
99 } |
| 94 |
100 |
| 95 static void |
101 static void |
| 96 timestamp_new_convo(PurpleConversation *conv) |
102 timestamp_new_convo(PurpleConversation *conv) |
| 97 { |
103 { |
| 98 PidginConversation *gtk_conv = PIDGIN_CONVERSATION(conv); |
|
| 99 GtkTextBuffer *buffer; |
|
| 100 |
|
| 101 if (!g_list_find(purple_get_conversations(), conv)) |
104 if (!g_list_find(purple_get_conversations(), conv)) |
| 102 return; |
105 return; |
| 103 |
|
| 104 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtk_conv->imhtml)); |
|
| 105 gtk_text_buffer_create_tag(buffer, "TIMESTAMP", |
|
| 106 "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, |
|
| 107 "weight", PANGO_WEIGHT_BOLD, NULL); |
|
| 108 |
106 |
| 109 purple_conversation_set_data(conv, "timestamp-last", GINT_TO_POINTER(0)); |
107 purple_conversation_set_data(conv, "timestamp-last", GINT_TO_POINTER(0)); |
| 110 } |
108 } |
| 111 |
109 |
| 112 static void |
110 static void |