diff src/bar_keywords.c @ 1455:2545780d4779

fixed keyword tree redrawing
author nadvornik
date Tue, 17 Mar 2009 18:30:53 +0000
parents ba0cd2792260
children b24391991f7f
line wrap: on
line diff
--- a/src/bar_keywords.c	Tue Mar 17 00:05:13 2009 +0000
+++ b/src/bar_keywords.c	Tue Mar 17 18:30:53 2009 +0000
@@ -109,7 +109,8 @@
 	gboolean expand_checked;
 	gboolean collapse_unchecked;
 	gboolean hide_unchecked;
-	
+
+	gint idle_id;	
 	FileData *fd;
 	gchar *key;
 };
@@ -416,7 +417,7 @@
 	if ((type & (NOTIFY_REREAD | NOTIFY_CHANGE | NOTIFY_METADATA)) && fd == pkd->fd) bar_pane_keywords_update(pkd);
 }
 
-static void bar_pane_keywords_changed(GtkTextBuffer *buffer, gpointer data)
+static gboolean bar_pane_keywords_changed_idle_cb(gpointer data)
 {
 	PaneKeywordsData *pkd = data;
 
@@ -424,6 +425,17 @@
 	bar_pane_keywords_write(pkd);
 	bar_keyword_tree_sync(pkd);
 	file_data_register_notify_func(bar_pane_keywords_notify_cb, pkd, NOTIFY_PRIORITY_LOW);
+	pkd->idle_id = -1;
+	return FALSE;
+}
+
+static void bar_pane_keywords_changed(GtkTextBuffer *buffer, gpointer data)
+{
+	PaneKeywordsData *pkd = data;
+
+	if (pkd->idle_id != -1) return;
+	/* higher prio than redraw */
+	pkd->idle_id = g_idle_add_full(G_PRIORITY_HIGH_IDLE, bar_pane_keywords_changed_idle_cb, pkd, NULL);
 }
 
 
@@ -1182,7 +1194,7 @@
 	PaneKeywordsData *pkd = data;
 
         if (pkd->click_tpath) gtk_tree_path_free(pkd->click_tpath);
-
+	if (pkd->idle_id != -1) g_source_remove(pkd->idle_id);
 	file_data_unregister_notify_func(bar_pane_keywords_notify_cb, pkd);
 
 	file_data_unref(pkd->fd);
@@ -1214,6 +1226,8 @@
 	pkd->key = g_strdup(key);
 	
 	pkd->expand_checked = TRUE;
+	
+	pkd->idle_id = -1;
 
 	hbox = gtk_hbox_new(FALSE, PREF_PAD_GAP);