|
|
25dd04 |
From 7d5fe40f2e11d21153fe86ce69deec7fa7c348ae Mon Sep 17 00:00:00 2001
|
|
|
25dd04 |
From: Matthias Clasen <mclasen@redhat.com>
|
|
|
25dd04 |
Date: Thu, 9 Oct 2014 15:30:52 -0400
|
|
|
25dd04 |
Subject: [PATCH] GtkMenuButton: Submit to action
|
|
|
25dd04 |
|
|
|
25dd04 |
As an actionable (inherited from GtkButton), a GtkMenuButton
|
|
|
25dd04 |
should not set its own sensitivity when it has an action-name
|
|
|
25dd04 |
set, but just follow the enabled state of the associated
|
|
|
25dd04 |
action.
|
|
|
25dd04 |
|
|
|
25dd04 |
https://bugzilla.gnome.org/show_bug.cgi?id=738083
|
|
|
25dd04 |
---
|
|
|
25dd04 |
gtk/gtkmenubutton.c | 21 ++++++++++++++++-----
|
|
|
25dd04 |
1 file changed, 16 insertions(+), 5 deletions(-)
|
|
|
25dd04 |
|
|
|
25dd04 |
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
|
|
|
25dd04 |
index 4ff2c18..dd4cdf2 100644
|
|
|
25dd04 |
--- a/gtk/gtkmenubutton.c
|
|
|
25dd04 |
+++ b/gtk/gtkmenubutton.c
|
|
|
25dd04 |
@@ -108,6 +108,7 @@
|
|
|
25dd04 |
|
|
|
25dd04 |
#include "gtkmenubutton.h"
|
|
|
25dd04 |
#include "gtkmenubuttonprivate.h"
|
|
|
25dd04 |
+#include "gtkbuttonprivate.h"
|
|
|
25dd04 |
#include "gtktypebuiltins.h"
|
|
|
25dd04 |
#include "gtkwindow.h"
|
|
|
25dd04 |
#include "gtkmain.h"
|
|
|
25dd04 |
@@ -695,6 +696,18 @@ menu_detacher (GtkWidget *widget,
|
|
|
25dd04 |
priv->menu = NULL;
|
|
|
25dd04 |
}
|
|
|
25dd04 |
|
|
|
25dd04 |
+static void
|
|
|
25dd04 |
+update_sensitivity (GtkMenuButton *menu_button)
|
|
|
25dd04 |
+{
|
|
|
25dd04 |
+ GtkMenuButtonPrivate *priv = menu_button->priv;
|
|
|
25dd04 |
+
|
|
|
25dd04 |
+ if (GTK_BUTTON (menu_button)->priv->action_helper)
|
|
|
25dd04 |
+ return;
|
|
|
25dd04 |
+
|
|
|
25dd04 |
+ gtk_widget_set_sensitive (GTK_WIDGET (menu_button),
|
|
|
25dd04 |
+ priv->menu != NULL || priv->popover != NULL);
|
|
|
25dd04 |
+}
|
|
|
25dd04 |
+
|
|
|
25dd04 |
/* This function is used in GtkMenuToolButton, the call back will
|
|
|
25dd04 |
* be called when GtkMenuToolButton would have emitted the “show-menu”
|
|
|
25dd04 |
* signal.
|
|
|
25dd04 |
@@ -742,7 +755,7 @@ _gtk_menu_button_set_popup_with_func (GtkMenuButton *menu_button
|
|
|
25dd04 |
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (menu_button)), "menu-button");
|
|
|
25dd04 |
}
|
|
|
25dd04 |
|
|
|
25dd04 |
- gtk_widget_set_sensitive (GTK_WIDGET (menu_button), priv->menu != NULL);
|
|
|
25dd04 |
+ update_sensitivity (menu_button);
|
|
|
25dd04 |
|
|
|
25dd04 |
g_object_notify (G_OBJECT (menu_button), "popup");
|
|
|
25dd04 |
g_object_notify (G_OBJECT (menu_button), "menu-model");
|
|
|
25dd04 |
@@ -777,8 +790,7 @@ gtk_menu_button_set_popup (GtkMenuButton *menu_button,
|
|
|
25dd04 |
if (menu && priv->popover)
|
|
|
25dd04 |
gtk_menu_button_set_popover (menu_button, NULL);
|
|
|
25dd04 |
|
|
|
25dd04 |
- gtk_widget_set_sensitive (GTK_WIDGET (menu_button),
|
|
|
25dd04 |
- priv->menu != NULL || priv->popover != NULL);
|
|
|
25dd04 |
+ update_sensitivity (menu_button);
|
|
|
25dd04 |
|
|
|
25dd04 |
g_object_thaw_notify (G_OBJECT (menu_button));
|
|
|
25dd04 |
}
|
|
|
25dd04 |
@@ -1173,8 +1185,7 @@ gtk_menu_button_set_popover (GtkMenuButton *menu_button,
|
|
|
25dd04 |
if (popover && priv->menu)
|
|
|
25dd04 |
gtk_menu_button_set_popup (menu_button, NULL);
|
|
|
25dd04 |
|
|
|
25dd04 |
- gtk_widget_set_sensitive (GTK_WIDGET (menu_button),
|
|
|
25dd04 |
- priv->menu != NULL || priv->popover != NULL);
|
|
|
25dd04 |
+ update_sensitivity (menu_button);
|
|
|
25dd04 |
|
|
|
25dd04 |
g_object_notify (G_OBJECT (menu_button), "popover");
|
|
|
25dd04 |
g_object_notify (G_OBJECT (menu_button), "menu-model");
|
|
|
25dd04 |
--
|
|
|
25dd04 |
2.1.0
|
|
|
25dd04 |
|