diff options
author | Ted Gould <ted@gould.cx> | 2011-11-29 14:46:54 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-11-29 14:46:54 -0600 |
commit | 4bf5b9c65e19612cc68a252ca011cf127e1515f4 (patch) | |
tree | e8861c540845ecab14ae7afb63eb23bbeba059db | |
parent | da6a2dfa870a1925ebb98fb10286bcde62d2db11 (diff) | |
parent | 1b83b3b0758d29d94a1e404f551939ea1885ad76 (diff) | |
download | libdbusmenu-4bf5b9c65e19612cc68a252ca011cf127e1515f4.tar.gz libdbusmenu-4bf5b9c65e19612cc68a252ca011cf127e1515f4.tar.bz2 libdbusmenu-4bf5b9c65e19612cc68a252ca011cf127e1515f4.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); } } } |