aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-04-15 14:24:37 -0500
committerTed Gould <ted@gould.cx>2011-04-15 14:24:37 -0500
commit172d807186f6ca422105018d55d25710040bc8f4 (patch)
treec6c0b0d1097ea06a2548869bc32e9fbe4efaa716 /libdbusmenu-gtk
parent3221bcddba19b5282485cf432da89c0173725274 (diff)
parent3121fee23fd19cd773fe40f3e3f6dfd53581e3b7 (diff)
downloadlibdbusmenu-172d807186f6ca422105018d55d25710040bc8f4.tar.gz
libdbusmenu-172d807186f6ca422105018d55d25710040bc8f4.tar.bz2
libdbusmenu-172d807186f6ca422105018d55d25710040bc8f4.zip
Only activate items if they have submenus
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/parser.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c
index 71474ae..2342b37 100644
--- a/libdbusmenu-gtk/parser.c
+++ b/libdbusmenu-gtk/parser.c
@@ -307,6 +307,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_MENU_ITEM(iter->data)) == NULL) {
+ continue;
+ }
+
gtk_menu_shell_activate_item (GTK_MENU_SHELL (widget),
iter->data,
TRUE);