diff options
author | Ted Gould <ted@gould.cx> | 2011-04-15 10:57:39 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-04-15 10:57:39 -0500 |
commit | f89f8476599522aa7fbb61e4c0605d639a1be45e (patch) | |
tree | 51a6171d17a2213672ea594ac1f1dadd7fc441eb /libdbusmenu-gtk | |
parent | dfc41992ce8acc7d8b85b4e196f88afb38016174 (diff) | |
download | libdbusmenu-f89f8476599522aa7fbb61e4c0605d639a1be45e.tar.gz libdbusmenu-f89f8476599522aa7fbb61e4c0605d639a1be45e.tar.bz2 libdbusmenu-f89f8476599522aa7fbb61e4c0605d639a1be45e.zip |
Only activate items that have submenus
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r-- | libdbusmenu-gtk/parser.c | 14 |
1 files changed, 14 insertions, 0 deletions
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); |