Mercurial > pidgin
comparison src/gtkconv.c @ 11224:409d6a11da51
[gaim-migrate @ 13360]
Restrict the conversation scrollback. Current default is 4000 lines. This also fixes the IM images not actually being cleared by gtk_imhtml_clear().
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 10 Aug 2005 21:13:44 +0000 |
parents | e552095ec599 |
children | 8b3d1b2c2c43 |
comparison
equal
deleted
inserted
replaced
11223:d424c3bbac8d | 11224:409d6a11da51 |
---|---|
4962 { | 4962 { |
4963 GaimGtkConversation *gtkconv; | 4963 GaimGtkConversation *gtkconv; |
4964 GaimConvWindow *win; | 4964 GaimConvWindow *win; |
4965 GaimConnection *gc; | 4965 GaimConnection *gc; |
4966 int gtk_font_options = 0; | 4966 int gtk_font_options = 0; |
4967 int max_scrollback_lines = gaim_prefs_get_int( | |
4968 "/gaim/gtk/conversations/scrollback_lines"); | |
4969 int line_count; | |
4967 char buf2[BUF_LONG]; | 4970 char buf2[BUF_LONG]; |
4968 char mdate[64]; | 4971 char mdate[64]; |
4969 char color[10]; | 4972 char color[10]; |
4970 char *str; | 4973 char *str; |
4971 char *with_font_tag; | 4974 char *with_font_tag; |
4975 gtkconv = GAIM_GTK_CONVERSATION(conv); | 4978 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4976 gtkconv->active_conv = conv; | 4979 gtkconv->active_conv = conv; |
4977 gc = gaim_conversation_get_gc(conv); | 4980 gc = gaim_conversation_get_gc(conv); |
4978 | 4981 |
4979 win = gaim_conversation_get_window(conv); | 4982 win = gaim_conversation_get_window(conv); |
4983 | |
4984 line_count = gtk_text_buffer_get_line_count( | |
4985 gtk_text_view_get_buffer(GTK_TEXT_VIEW( | |
4986 gtkconv->imhtml))); | |
4987 printf("writing to conv - max_scrollback_lines = %d our lines = %d\n", max_scrollback_lines, line_count); | |
4988 /* If we're sitting at more than 100 lines more than the | |
4989 max scrollback, trim down to max scrollback */ | |
4990 if (max_scrollback_lines > 0 | |
4991 && line_count > (max_scrollback_lines + 100)) { | |
4992 GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( | |
4993 GTK_TEXT_VIEW(gtkconv->imhtml)); | |
4994 GtkTextIter start, end; | |
4995 | |
4996 gtk_text_buffer_get_start_iter(text_buffer, &start); | |
4997 gtk_text_buffer_get_iter_at_line(text_buffer, &end, | |
4998 (line_count - max_scrollback_lines)); | |
4999 gtk_imhtml_delete(GTK_IMHTML(gtkconv->imhtml), &start, &end); | |
5000 } | |
4980 | 5001 |
4981 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) | 5002 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) |
4982 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); | 5003 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); |
4983 | 5004 |
4984 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ | 5005 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
6220 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); | 6241 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
6221 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); | 6242 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
6222 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); | 6243 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
6223 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); | 6244 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); |
6224 gaim_prefs_add_bool("/gaim/gtk/conversations/warn_on_unread_close", TRUE); | 6245 gaim_prefs_add_bool("/gaim/gtk/conversations/warn_on_unread_close", TRUE); |
6246 gaim_prefs_add_int("/gaim/gtk/conversations/scrollback_lines", 4000); | |
6225 | 6247 |
6226 /* Conversations -> Chat */ | 6248 /* Conversations -> Chat */ |
6227 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); | 6249 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
6228 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); | 6250 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
6229 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); | 6251 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |