diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-06-15 19:42:47 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-06-15 19:49:49 -0400 |
commit | 002699402dd045e71bd108463a3f8cc7442ec538 (patch) | |
tree | c283669fc749bd7b45c592bf42f8e8431184d5d6 /gtk/gtkmenubutton.c | |
parent | f99375f91ed3e785d2e2bb0bb398f84202f71fed (diff) | |
download | gtk+-002699402dd045e71bd108463a3f8cc7442ec538.tar.gz |
GtkMenuButton: Make programmatic toggling work again
This was broken in 0796d7b6ff9393746d.
https://bugzilla.gnome.org/show_bug.cgi?id=751018
Diffstat (limited to 'gtk/gtkmenubutton.c')
-rw-r--r-- | gtk/gtkmenubutton.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c index 80f1c55d6a..17c822b384 100644 --- a/gtk/gtkmenubutton.c +++ b/gtk/gtkmenubutton.c @@ -426,26 +426,36 @@ gtk_menu_button_clicked (GtkButton *button) { GtkMenuButton *menu_button = GTK_MENU_BUTTON (button); GtkMenuButtonPrivate *priv = menu_button->priv; - gboolean active = TRUE; + gboolean active; - if (priv->menu && !gtk_widget_get_visible (priv->menu)) + if (priv->menu) { - GdkEvent *event; + active = !gtk_widget_get_visible (priv->menu); + if (active) + { + GdkEvent *event; - event = gtk_get_current_event (); + event = gtk_get_current_event (); - popup_menu (menu_button, event); + popup_menu (menu_button, event); - if (!event || - event->type == GDK_KEY_PRESS || - event->type == GDK_KEY_RELEASE) - gtk_menu_shell_select_first (GTK_MENU_SHELL (priv->menu), FALSE); + if (!event || + event->type == GDK_KEY_PRESS || + event->type == GDK_KEY_RELEASE) + gtk_menu_shell_select_first (GTK_MENU_SHELL (priv->menu), FALSE); - if (event) - gdk_event_free (event); + if (event) + gdk_event_free (event); + } + } + else if (priv->popover) + { + active = !gtk_widget_get_visible (priv->popover); + if (active) + gtk_widget_show (priv->popover); + else + gtk_widget_hide (priv->popover); } - else if (priv->popover && !gtk_widget_get_visible (priv->popover)) - gtk_widget_show (priv->popover); else active = FALSE; |