comparison plugins/timestamp.c @ 10400:6a043ae92db6

[gaim-migrate @ 11631] I'm about to go home for the holidays, so I figured I'd commit this before I left so someone else could pick up on it while I'm gone. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sun, 19 Dec 2004 20:32:32 +0000
parents de92a8da82c3
children ce098e226486
comparison
equal deleted inserted replaced
10399:aab0c9508318 10400:6a043ae92db6
55 55
56 /* is_conversation_active is true if an im has been displayed since the last timestamp */ 56 /* is_conversation_active is true if an im has been displayed since the last timestamp */
57 is_conversation_active = GPOINTER_TO_INT(gaim_conversation_get_data(c, "timestamp-conv-active")); 57 is_conversation_active = GPOINTER_TO_INT(gaim_conversation_get_data(c, "timestamp-conv-active"));
58 58
59 if (is_conversation_active){ 59 if (is_conversation_active){
60 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(conv->imhtml)); 60 int y, height;
61 GdkRectangle rect;
62 gboolean scroll = TRUE;
63 GtkWidget *imhtml = conv->imhtml;
64 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml));
61 gtk_text_buffer_get_end_iter(buffer, &iter); 65 gtk_text_buffer_get_end_iter(buffer, &iter);
62 gaim_conversation_set_data(c, "timestamp-conv-active", GINT_TO_POINTER(FALSE)); 66 gaim_conversation_set_data(c, "timestamp-conv-active", GINT_TO_POINTER(FALSE));
63 strftime(mdate, sizeof(mdate), "\n%H:%M", localtime(&tim)); 67 strftime(mdate, sizeof(mdate), "\n%H:%M", localtime(&tim));
68 gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(imhtml), &rect);
69 gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(imhtml), &iter, &y, &height);
70 if(((y + height) - (rect.y + rect.height)) > height
71 && gtk_text_buffer_get_char_count(buffer)){
72 scroll = FALSE;
73 }
64 gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, mdate, strlen(mdate), "TIMESTAMP", NULL); 74 gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, mdate, strlen(mdate), "TIMESTAMP", NULL);
75 if (scroll)
76 gtk_imhtml_scroll_to_end(imhtml);
65 } 77 }
66 else 78 else
67 gaim_conversation_set_data(c, "timestamp-enabled", GINT_TO_POINTER(FALSE)); 79 gaim_conversation_set_data(c, "timestamp-enabled", GINT_TO_POINTER(FALSE));
68 80
69 return TRUE; 81 return TRUE;