comparison 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
comparison
equal deleted inserted replaced
1454:fbd02e4d709e 1455:2545780d4779
107 GtkTreePath *click_tpath; 107 GtkTreePath *click_tpath;
108 108
109 gboolean expand_checked; 109 gboolean expand_checked;
110 gboolean collapse_unchecked; 110 gboolean collapse_unchecked;
111 gboolean hide_unchecked; 111 gboolean hide_unchecked;
112 112
113 gint idle_id;
113 FileData *fd; 114 FileData *fd;
114 gchar *key; 115 gchar *key;
115 }; 116 };
116 117
117 typedef struct _ConfDialogData ConfDialogData; 118 typedef struct _ConfDialogData ConfDialogData;
414 { 415 {
415 PaneKeywordsData *pkd = data; 416 PaneKeywordsData *pkd = data;
416 if ((type & (NOTIFY_REREAD | NOTIFY_CHANGE | NOTIFY_METADATA)) && fd == pkd->fd) bar_pane_keywords_update(pkd); 417 if ((type & (NOTIFY_REREAD | NOTIFY_CHANGE | NOTIFY_METADATA)) && fd == pkd->fd) bar_pane_keywords_update(pkd);
417 } 418 }
418 419
419 static void bar_pane_keywords_changed(GtkTextBuffer *buffer, gpointer data) 420 static gboolean bar_pane_keywords_changed_idle_cb(gpointer data)
420 { 421 {
421 PaneKeywordsData *pkd = data; 422 PaneKeywordsData *pkd = data;
422 423
423 file_data_unregister_notify_func(bar_pane_keywords_notify_cb, pkd); 424 file_data_unregister_notify_func(bar_pane_keywords_notify_cb, pkd);
424 bar_pane_keywords_write(pkd); 425 bar_pane_keywords_write(pkd);
425 bar_keyword_tree_sync(pkd); 426 bar_keyword_tree_sync(pkd);
426 file_data_register_notify_func(bar_pane_keywords_notify_cb, pkd, NOTIFY_PRIORITY_LOW); 427 file_data_register_notify_func(bar_pane_keywords_notify_cb, pkd, NOTIFY_PRIORITY_LOW);
428 pkd->idle_id = -1;
429 return FALSE;
430 }
431
432 static void bar_pane_keywords_changed(GtkTextBuffer *buffer, gpointer data)
433 {
434 PaneKeywordsData *pkd = data;
435
436 if (pkd->idle_id != -1) return;
437 /* higher prio than redraw */
438 pkd->idle_id = g_idle_add_full(G_PRIORITY_HIGH_IDLE, bar_pane_keywords_changed_idle_cb, pkd, NULL);
427 } 439 }
428 440
429 441
430 /* 442 /*
431 *------------------------------------------------------------------- 443 *-------------------------------------------------------------------
1180 static void bar_pane_keywords_destroy(GtkWidget *widget, gpointer data) 1192 static void bar_pane_keywords_destroy(GtkWidget *widget, gpointer data)
1181 { 1193 {
1182 PaneKeywordsData *pkd = data; 1194 PaneKeywordsData *pkd = data;
1183 1195
1184 if (pkd->click_tpath) gtk_tree_path_free(pkd->click_tpath); 1196 if (pkd->click_tpath) gtk_tree_path_free(pkd->click_tpath);
1185 1197 if (pkd->idle_id != -1) g_source_remove(pkd->idle_id);
1186 file_data_unregister_notify_func(bar_pane_keywords_notify_cb, pkd); 1198 file_data_unregister_notify_func(bar_pane_keywords_notify_cb, pkd);
1187 1199
1188 file_data_unref(pkd->fd); 1200 file_data_unref(pkd->fd);
1189 g_free(pkd->key); 1201 g_free(pkd->key);
1190 1202
1212 pkd->pane.expanded = expanded; 1224 pkd->pane.expanded = expanded;
1213 1225
1214 pkd->key = g_strdup(key); 1226 pkd->key = g_strdup(key);
1215 1227
1216 pkd->expand_checked = TRUE; 1228 pkd->expand_checked = TRUE;
1229
1230 pkd->idle_id = -1;
1217 1231
1218 hbox = gtk_hbox_new(FALSE, PREF_PAD_GAP); 1232 hbox = gtk_hbox_new(FALSE, PREF_PAD_GAP);
1219 1233
1220 pkd->widget = hbox; 1234 pkd->widget = hbox;
1221 g_object_set_data(G_OBJECT(pkd->widget), "pane_data", pkd); 1235 g_object_set_data(G_OBJECT(pkd->widget), "pane_data", pkd);