[gtk+] GtkMenuButton: Override add
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkMenuButton: Override add
- Date: Sat, 1 Sep 2012 03:02:57 +0000 (UTC)
commit 9e4b550c98bdfba26c27a24c1e7b3731fc0f5cb6
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Aug 24 23:32:41 2012 -0400
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
gtk/gtkmenubutton.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
index c847482..e240fdd 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;
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]