summaryrefslogtreecommitdiff
path: root/gtk/gtkmenubutton.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2012-08-24 23:32:41 -0400
committerMatthias Clasen <mclasen@redhat.com>2012-08-31 22:58:25 -0400
commit9e4b550c98bdfba26c27a24c1e7b3731fc0f5cb6 (patch)
tree8ebd0a50ff6e1cde892cb4e4dd55fb96cbf73b77 /gtk/gtkmenubutton.c
parent6e6487b461adf2628f49fc257a7a30a2346e5a25 (diff)
downloadgtk+-9e4b550c98bdfba26c27a24c1e7b3731fc0f5cb6.tar.gz
GtkMenuButton: Override add
By removing an existing child in add, if it is our own arrow, we can make things work better in GtkBuilder. https://bugzilla.gnome.org/show_bug.cgi?id=682291
Diffstat (limited to 'gtk/gtkmenubutton.c')
-rw-r--r--gtk/gtkmenubutton.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
index c84748269b..e240fdd7bd 100644
--- a/gtk/gtkmenubutton.c
+++ b/gtk/gtkmenubutton.c
@@ -440,10 +440,26 @@ gtk_menu_button_button_press_event (GtkWidget *widget,
}
static void
+gtk_menu_button_add (GtkContainer *container,
+ GtkWidget *child)
+{
+ GtkMenuButton *button = GTK_MENU_BUTTON (container);
+
+ if (button->priv->arrow_widget)
+ {
+ gtk_container_remove (container, button->priv->arrow_widget);
+ button->priv->arrow_widget = NULL;
+ }
+
+ GTK_CONTAINER_CLASS (gtk_menu_button_parent_class)->add (container, child);
+}
+
+static void
gtk_menu_button_class_init (GtkMenuButtonClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
GtkToggleButtonClass *toggle_button_class = GTK_TOGGLE_BUTTON_CLASS (klass);
g_type_class_add_private (klass, sizeof (GtkMenuButtonPrivate));
@@ -456,6 +472,8 @@ gtk_menu_button_class_init (GtkMenuButtonClass *klass)
widget_class->state_flags_changed = gtk_menu_button_state_flags_changed;
widget_class->button_press_event = gtk_menu_button_button_press_event;
+ container_class->add = gtk_menu_button_add;
+
toggle_button_class->toggled = gtk_menu_button_toggled;
/**