diff options
author | Ted Gould <ted@gould.cx> | 2011-03-16 14:02:13 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-03-16 14:02:13 -0500 |
commit | 548bab4bd45f2d371fab88c89453de2f897f1b34 (patch) | |
tree | 2159a0b5651d06568460fb681a3885d0b4cbe523 /libdbusmenu-gtk/client.c | |
parent | c1af4ce858d65282a0d5da6e6cf4e51454170eed (diff) | |
parent | 3c9af9576901318917a4c20ab668742255bbe429 (diff) | |
download | libdbusmenu-548bab4bd45f2d371fab88c89453de2f897f1b34.tar.gz libdbusmenu-548bab4bd45f2d371fab88c89453de2f897f1b34.tar.bz2 libdbusmenu-548bab4bd45f2d371fab88c89453de2f897f1b34.zip |
New upstream release.
∘ Remove child items when they're removed by GTK
∘ Adding opened and closed events for menu visibility
∘ Handle empty image types
∘ Remove critical warning on parser menuitem check (LP: #733918)
∘ Fix dependencies in pkgconfig files (LP: #733263)
∘ Handle NULL labels (LP: #733688)
∘ Fix memory leaks from variants (LP: #722972)
Diffstat (limited to 'libdbusmenu-gtk/client.c')
-rw-r--r-- | libdbusmenu-gtk/client.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 510e74e..497808b 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -458,7 +458,7 @@ menu_pressed_cb (GtkMenuItem * gmi, DbusmenuMenuitem * mi) { if (gtk_menu_item_get_submenu(gmi) == NULL) { GVariant * variant = g_variant_new("i", 0); - dbusmenu_menuitem_handle_event(mi, "clicked", variant, gtk_get_current_event_time()); + dbusmenu_menuitem_handle_event(mi, DBUSMENU_MENUITEM_EVENT_ACTIVATED, variant, gtk_get_current_event_time()); } else { /* TODO: We need to stop the display of the submenu until this callback returns. */ @@ -467,6 +467,15 @@ menu_pressed_cb (GtkMenuItem * gmi, DbusmenuMenuitem * mi) return TRUE; } +static void +submenu_notify_visible_cb (GtkWidget * menu, GParamSpec * pspec, DbusmenuMenuitem * mi) +{ + if (gtk_widget_get_visible (menu)) + dbusmenu_menuitem_handle_event(mi, DBUSMENU_MENUITEM_EVENT_OPENED, NULL, gtk_get_current_event_time()); + else + dbusmenu_menuitem_handle_event(mi, DBUSMENU_MENUITEM_EVENT_CLOSED, NULL, gtk_get_current_event_time()); +} + /* Process the visible property */ static void process_visible (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * value) @@ -740,11 +749,12 @@ new_child (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint position, Dbus GtkMenuItem * parent = dbusmenu_gtkclient_menuitem_get(gtkclient, mi); gtk_menu_item_set_submenu(parent, GTK_WIDGET(menu)); + + g_signal_connect(menu, "notify::visible", G_CALLBACK(submenu_notify_visible_cb), mi); } GtkMenuItem * childmi = dbusmenu_gtkclient_menuitem_get(gtkclient, child); gtk_menu_shell_insert(GTK_MENU_SHELL(menu), GTK_WIDGET(childmi), position); - gtk_widget_show(GTK_WIDGET(menu)); return; } |