Skip to content

Commit

Permalink
fixed keyword tree redrawing
Browse files Browse the repository at this point in the history
  • Loading branch information
nadvornik committed Mar 17, 2009
1 parent a142c98 commit 48a18d5
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/bar_keywords.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ struct _PaneKeywordsData
gboolean expand_checked;
gboolean collapse_unchecked;
gboolean hide_unchecked;


gint idle_id;
FileData *fd;
gchar *key;
};
Expand Down Expand Up @@ -416,14 +417,25 @@ static void bar_pane_keywords_notify_cb(FileData *fd, NotifyType type, gpointer
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;

file_data_unregister_notify_func(bar_pane_keywords_notify_cb, pkd);
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);
}


Expand Down Expand Up @@ -1182,7 +1194,7 @@ static void bar_pane_keywords_destroy(GtkWidget *widget, gpointer data)
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);
Expand Down Expand Up @@ -1214,6 +1226,8 @@ GtkWidget *bar_pane_keywords_new(const gchar *title, const gchar *key, gboolean
pkd->key = g_strdup(key);

pkd->expand_checked = TRUE;

pkd->idle_id = -1;

hbox = gtk_hbox_new(FALSE, PREF_PAD_GAP);

Expand Down

0 comments on commit 48a18d5

Please sign in to comment.