aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog4
-rw-r--r--libdbusmenu-gtk/parser.c38
2 files changed, 41 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 533b3df..4d1d688 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,8 +4,10 @@ libdbusmenu (0.4.1-0ubuntu2~ppa1) UNRELEASED; urgency=low
* Fix GIR scan to not include duplicate namespaces (LP: #750575)
* Keep refs to the client and makes sure to disconnect all
handlers. (LP: #749609)
+ * Add GTK side handlers for the open/close events to ensure GTK
+ apps can use those events still (LP: #750588)
- -- Ted Gould <ted@ubuntu.com> Tue, 05 Apr 2011 16:18:25 -0500
+ -- Ted Gould <ted@ubuntu.com> Tue, 05 Apr 2011 16:20:11 -0500
libdbusmenu (0.4.1-0ubuntu1) natty; urgency=low
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c
index e68c286..c627854 100644
--- a/libdbusmenu-gtk/parser.c
+++ b/libdbusmenu-gtk/parser.c
@@ -79,6 +79,11 @@ static void item_activated (DbusmenuMenuitem * item,
gpointer user_data);
static gboolean item_about_to_show (DbusmenuMenuitem * item,
gpointer user_data);
+static gboolean item_handle_event (DbusmenuMenuitem * item,
+ const gchar * name,
+ GVariant * variant,
+ guint timestamp,
+ GtkWidget * widget);
static void widget_notify_cb (GtkWidget * widget,
GParamSpec * pspec,
gpointer data);
@@ -580,6 +585,11 @@ construct_dbusmenu_for_widget (GtkWidget * widget)
DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW,
G_CALLBACK (item_about_to_show),
widget);
+
+ g_signal_connect (G_OBJECT (mi),
+ DBUSMENU_MENUITEM_SIGNAL_EVENT,
+ G_CALLBACK (item_handle_event),
+ widget);
}
dbusmenu_menuitem_property_set_bool (mi,
@@ -924,6 +934,34 @@ item_about_to_show (DbusmenuMenuitem *item, gpointer user_data)
return TRUE;
}
+static gboolean
+item_handle_event (DbusmenuMenuitem *item, const gchar *name,
+ GVariant *variant, guint timestamp, GtkWidget *widget)
+{
+ if (g_strcmp0 (name, DBUSMENU_MENUITEM_EVENT_OPENED) == 0)
+ {
+ GtkWidget *submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
+ if (submenu != NULL)
+ {
+ // Show the submenu so the app can notice and futz with the menus as
+ // desired (empathy and geany do this)
+ gtk_widget_show (submenu);
+ }
+ }
+ else if (g_strcmp0 (name, DBUSMENU_MENUITEM_EVENT_CLOSED) == 0)
+ {
+ GtkWidget *submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
+ if (submenu != NULL)
+ {
+ // Hide the submenu so the app can notice and futz with the menus as
+ // desired (empathy and geany do this)
+ gtk_widget_hide (submenu);
+ }
+ }
+
+ return FALSE; // just pass through on everything
+}
+
static void
widget_notify_cb (GtkWidget *widget,
GParamSpec *pspec,