From f89f8476599522aa7fbb61e4c0605d639a1be45e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Apr 2011 10:57:39 -0500 Subject: Only activate items that have submenus --- libdbusmenu-gtk/parser.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libdbusmenu-gtk') diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index 4972856..f21e548 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -290,6 +290,20 @@ parse_menu_structure_helper (GtkWidget * widget, RecurseContext * recurse) GList *iter; for (iter = children; iter != NULL; iter = iter->next) { + /* Make sure that we have a menu item before we start calling + functions that depend on it. This should almost always be + the case. */ + if (!GTK_IS_MENU_ITEM(iter->data)) { + continue; + } + + /* If the item is not opening a submenu we don't want to activate + it as that'd cause an action. Like opening a preferences dialog + to the user. That's not a good idea. */ + if (gtk_menu_item_get_submenu(GTK_WIDGET(iter->data)) == NULL) { + continue; + } + gtk_menu_shell_activate_item (GTK_MENU_SHELL (widget), iter->data, TRUE); -- cgit v1.2.3