im.pidgin.pidgin: c7f6969f2405aa75f2e945cb239e6bf9ff0d6372

sadrul at pidgin.im sadrul at pidgin.im
Mon Nov 12 11:45:58 EST 2007


-----------------------------------------------------------------
Revision: c7f6969f2405aa75f2e945cb239e6bf9ff0d6372
Ancestor: f15685093f43b483d8ab8b683cb32ecddbb23727
Author: sadrul at pidgin.im
Date: 2007-11-12T16:15:53
Branch: im.pidgin.pidgin

Modified files:
        finch/libgnt/gnttextview.c

ChangeLog: 

Clear the tags when the textview is cleared.

-------------- next part --------------
============================================================
--- finch/libgnt/gnttextview.c	caf71aeb5075808f16bfb297661b30ae11ca3450
+++ finch/libgnt/gnttextview.c	976aef5d7d298ff8fb4508867852dc98886af78d
@@ -61,6 +61,8 @@ static gboolean double_click;
 static gchar *select_end;
 static gboolean double_click;
 
+static void reset_text_view(GntTextView *view);
+
 static void
 gnt_text_view_draw(GntWidget *widget)
 {
@@ -370,7 +372,7 @@ gnt_text_view_reflow(GntTextView *view)
 
 	string = view->string;
 	view->string = NULL;
-	gnt_text_view_clear(view);
+	reset_text_view(view);
 
 	view->string = g_string_set_size(view->string, string->len);
 	view->string->len = 0;
@@ -654,7 +656,7 @@ chtype gnt_text_format_flag_to_chtype(Gn
 	return fl;
 }
 
-void gnt_text_view_clear(GntTextView *view)
+static void reset_text_view(GntTextView *view)
 {
 	GntTextLine *line;
 
@@ -667,7 +669,15 @@ void gnt_text_view_clear(GntTextView *vi
 	if (view->string)
 		g_string_free(view->string, TRUE);
 	view->string = g_string_new(NULL);
+}
 
+void gnt_text_view_clear(GntTextView *view)
+{
+	reset_text_view(view);
+
+	g_list_foreach(view->tags, free_tag, NULL);
+	view->tags = NULL;
+
 	if (GNT_WIDGET(view)->window)
 		gnt_widget_draw(GNT_WIDGET(view));
 }
@@ -833,7 +843,7 @@ editor_end_cb(int status, gpointer data)
 	if (status == 0) {
 		char *text = NULL;
 		if (g_file_get_contents(pageditor.file, &text, NULL, NULL)) {
-			gnt_text_view_clear(pageditor.tv);
+			reset_text_view(pageditor.tv);
 			gnt_text_view_append_text_with_flags(pageditor.tv, text, GNT_TEXT_FLAG_NORMAL);
 			gnt_text_view_scroll(GNT_TEXT_VIEW(pageditor.tv), 0);
 			g_free(text);


More information about the Commits mailing list