diff options
author | Ted Gould <ted@gould.cx> | 2011-11-29 14:48:23 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-11-29 14:48:23 -0600 |
commit | 4d7faacc2be7d9480211057a35c5b93c2dd27e68 (patch) | |
tree | 9377d72c0a5a305a13c2f0cc2c68f8145966980c | |
parent | f879a2937723f1b28669843d484c57d351047b51 (diff) | |
parent | 1b83b3b0758d29d94a1e404f551939ea1885ad76 (diff) | |
download | libdbusmenu-4d7faacc2be7d9480211057a35c5b93c2dd27e68.tar.gz libdbusmenu-4d7faacc2be7d9480211057a35c5b93c2dd27e68.tar.bz2 libdbusmenu-4d7faacc2be7d9480211057a35c5b93c2dd27e68.zip |
Cancelling the idle if the menu item is removed
-rw-r--r-- | libdbusmenu-gtk/client.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 38b6a75..533764a 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -505,7 +505,6 @@ menu_item_stop_activating(DbusmenuMenuitem * mi) guint id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(parent), data_idle_close_id)); if (id > 0) { - g_source_remove(id); g_object_set_data(G_OBJECT(parent), data_idle_close_id, GINT_TO_POINTER(0)); should_close = TRUE; @@ -575,6 +574,14 @@ close_in_idle (DbusmenuMenuitem * mi) } static void +cancel_idle_close_id (gpointer data) +{ + guint id = GPOINTER_TO_INT(data); + if (id > 0) + g_source_remove(id); +} + +static void submenu_notify_visible_cb (GtkWidget * menu, GParamSpec * pspec, DbusmenuMenuitem * mi) { if (gtk_widget_get_visible (menu)) { @@ -591,8 +598,8 @@ submenu_notify_visible_cb (GtkWidget * menu, GParamSpec * pspec, DbusmenuMenuite data_idle_close_id)); if (id == 0) { id = g_idle_add((GSourceFunc)close_in_idle, mi); - g_object_set_data(G_OBJECT(mi), data_idle_close_id, - GINT_TO_POINTER(id)); + g_object_set_data_full(G_OBJECT(mi), data_idle_close_id, + GINT_TO_POINTER(id), cancel_idle_close_id); } } } |