diff options
author | Daniel Boles <dboles@src.gnome.org> | 2017-01-21 15:50:54 +0000 |
---|---|---|
committer | Daniel Boles <dboles@src.gnome.org> | 2017-01-21 15:50:54 +0000 |
commit | a5211adb225172195d6778d652b58632c38afcbf (patch) | |
tree | e0524b8fd3204a6e96d7ff76e3c986964371845a /gtk/gtkmenushell.c | |
parent | 06269bf3679360705607298e73ff7a6975f3aec3 (diff) | |
download | gtk+-a5211adb225172195d6778d652b58632c38afcbf.tar.gz |
menushell: Make select_first() do that, not last…
It was looping over all items, not breaking out when it found the first
selectable one, and then selecting the _last_ selectable one (if any)
found. So, it did exactly the opposite of its name. This made me quite
baffled when opening a submenu with right-arrow put me at its last item.
Originally, the loop set to_select and broke if the current item was
selectable and not tear-off, meaning that it would correctly select the
first suitable item. However, when tear-off functionality was removed
in commit 4ed9452e9028bb90589474783cebac57ab66e2c9, so was the break.
Diffstat (limited to 'gtk/gtkmenushell.c')
-rw-r--r-- | gtk/gtkmenushell.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c index b8b3e6bd2d..d2e8685631 100644 --- a/gtk/gtkmenushell.c +++ b/gtk/gtkmenushell.c @@ -1416,7 +1416,6 @@ gtk_menu_shell_select_first (GtkMenuShell *menu_shell, gboolean search_sensitive) { GtkMenuShellPrivate *priv = menu_shell->priv; - GtkWidget *to_select = NULL; GList *tmp_list; tmp_list = priv->children; @@ -1427,14 +1426,12 @@ gtk_menu_shell_select_first (GtkMenuShell *menu_shell, if ((!search_sensitive && gtk_widget_get_visible (child)) || _gtk_menu_item_is_selectable (child)) { - to_select = child; + gtk_menu_shell_select_item (menu_shell, child); + return; } tmp_list = tmp_list->next; } - - if (to_select) - gtk_menu_shell_select_item (menu_shell, to_select); } void |