Merge lp:~mterry/libdbusmenu/opened-closed into lp:libdbusmenu/0.5

Proposed by Michael Terry
Status: Merged
Merged at revision: 274
Proposed branch: lp:~mterry/libdbusmenu/opened-closed
Merge into: lp:libdbusmenu/0.5
Diff against target: 33 lines (+11/-1)
1 file modified
libdbusmenu-gtk/client.c (+11/-1)
To merge this branch: bzr merge lp:~mterry/libdbusmenu/opened-closed
Reviewer Review Type Date Requested Status
DBus Menu Team Pending
Review via email: mp+53616@code.launchpad.net

Description of the change

This adds 'opened' and 'closed' events.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdbusmenu-gtk/client.c'
2--- libdbusmenu-gtk/client.c 2011-03-10 16:27:52 +0000
3+++ libdbusmenu-gtk/client.c 2011-03-16 12:41:58 +0000
4@@ -467,6 +467,15 @@
5 return TRUE;
6 }
7
8+static void
9+submenu_notify_visible_cb (GtkWidget * menu, GParamSpec * pspec, DbusmenuMenuitem * mi)
10+{
11+ if (gtk_widget_get_visible (menu))
12+ dbusmenu_menuitem_handle_event(mi, "opened", NULL, gtk_get_current_event_time());
13+ else
14+ dbusmenu_menuitem_handle_event(mi, "closed", NULL, gtk_get_current_event_time());
15+}
16+
17 /* Process the visible property */
18 static void
19 process_visible (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * value)
20@@ -740,11 +749,12 @@
21
22 GtkMenuItem * parent = dbusmenu_gtkclient_menuitem_get(gtkclient, mi);
23 gtk_menu_item_set_submenu(parent, GTK_WIDGET(menu));
24+
25+ g_signal_connect(menu, "notify::visible", G_CALLBACK(submenu_notify_visible_cb), mi);
26 }
27
28 GtkMenuItem * childmi = dbusmenu_gtkclient_menuitem_get(gtkclient, child);
29 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), GTK_WIDGET(childmi), position);
30- gtk_widget_show(GTK_WIDGET(menu));
31
32 return;
33 }

Subscribers

People subscribed via source and target branches