aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-04-05 11:00:32 -0500
committerTed Gould <ted@gould.cx>2011-04-05 11:00:32 -0500
commitb9264d159d19e434e60b0db13fb972198d5595b1 (patch)
tree943f6b11ebcaeabc61e86d11cd3c78d51a2436e7
parent88dba8f88e6b93e52c32d0841f4c29235605cd43 (diff)
downloadlibdbusmenu-b9264d159d19e434e60b0db13fb972198d5595b1.tar.gz
libdbusmenu-b9264d159d19e434e60b0db13fb972198d5595b1.tar.bz2
libdbusmenu-b9264d159d19e434e60b0db13fb972198d5595b1.zip
Then menu should get created when processing the property, so let's warn and exit here if it's not available
-rw-r--r--libdbusmenu-gtk/client.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c
index 77b7510..a7ba46d 100644
--- a/libdbusmenu-gtk/client.c
+++ b/libdbusmenu-gtk/client.c
@@ -776,17 +776,12 @@ new_child (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint position, Dbus
if (g_strcmp0(dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_TYPE), DBUSMENU_CLIENT_TYPES_SEPARATOR) == 0) { return; }
gpointer ann_menu = g_object_get_data(G_OBJECT(mi), data_menu);
- GtkMenu * menu = GTK_MENU(ann_menu);
- if (menu == NULL) {
- /* Oh, we don't have a submenu, build one! */
- menu = GTK_MENU(gtk_menu_new());
- g_object_set_data(G_OBJECT(mi), data_menu, menu);
-
- GtkMenuItem * parent = dbusmenu_gtkclient_menuitem_get(gtkclient, mi);
- gtk_menu_item_set_submenu(parent, GTK_WIDGET(menu));
+ if (ann_menu == NULL) {
+ g_warning("Children but no menu, someone's been naughty with their '" DBUSMENU_MENUITEM_PROP_CHILD_DISPLAY "' property.");
+ return;
+ }
- g_signal_connect(menu, "notify::visible", G_CALLBACK(submenu_notify_visible_cb), mi);
- }
+ GtkMenu * menu = GTK_MENU(ann_menu);
GtkMenuItem * childmi = dbusmenu_gtkclient_menuitem_get(gtkclient, child);
gtk_menu_shell_insert(GTK_MENU_SHELL(menu), GTK_WIDGET(childmi), position);