From 06116092cf5335fa57e95c9032b7777ececcef82 Mon Sep 17 00:00:00 2001 From: Daniel Elstner Date: Thu, 23 Jan 2003 19:48:39 +0000 Subject: [PATCH] Override hide_all in addition to show_all in order to keep them symmetric. 2003-01-23 Daniel Elstner * gtk/gtktoolbar.c (gtk_toolbar_hide_all): Override hide_all in addition to show_all in order to keep them symmetric. (#102201) --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gtk/gtktoolbar.c | 22 ++++++++++++++++++++++ 6 files changed, 47 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8420548afd..24047ad35f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-01-23 Daniel Elstner + + * gtk/gtktoolbar.c (gtk_toolbar_hide_all): Override hide_all + in addition to show_all in order to keep them symmetric. (#102201) + Wed Jan 22 14:18:46 2003 Manish Singh * gdk/x11/gdkevents-x11.c (translate_key_event): add a "return" at diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 8420548afd..24047ad35f 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2003-01-23 Daniel Elstner + + * gtk/gtktoolbar.c (gtk_toolbar_hide_all): Override hide_all + in addition to show_all in order to keep them symmetric. (#102201) + Wed Jan 22 14:18:46 2003 Manish Singh * gdk/x11/gdkevents-x11.c (translate_key_event): add a "return" at diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 8420548afd..24047ad35f 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +2003-01-23 Daniel Elstner + + * gtk/gtktoolbar.c (gtk_toolbar_hide_all): Override hide_all + in addition to show_all in order to keep them symmetric. (#102201) + Wed Jan 22 14:18:46 2003 Manish Singh * gdk/x11/gdkevents-x11.c (translate_key_event): add a "return" at diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 8420548afd..24047ad35f 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2003-01-23 Daniel Elstner + + * gtk/gtktoolbar.c (gtk_toolbar_hide_all): Override hide_all + in addition to show_all in order to keep them symmetric. (#102201) + Wed Jan 22 14:18:46 2003 Manish Singh * gdk/x11/gdkevents-x11.c (translate_key_event): add a "return" at diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 8420548afd..24047ad35f 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2003-01-23 Daniel Elstner + + * gtk/gtktoolbar.c (gtk_toolbar_hide_all): Override hide_all + in addition to show_all in order to keep them symmetric. (#102201) + Wed Jan 22 14:18:46 2003 Manish Singh * gdk/x11/gdkevents-x11.c (translate_key_event): add a "return" at diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 03b13775c5..3f57aa4edc 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -97,6 +97,7 @@ static gboolean gtk_toolbar_focus (GtkWidget *widget, static void gtk_toolbar_screen_changed (GtkWidget *widget, GdkScreen *previous_screen); static void gtk_toolbar_show_all (GtkWidget *widget); +static void gtk_toolbar_hide_all (GtkWidget *widget); static void gtk_toolbar_add (GtkContainer *container, GtkWidget *widget); static void gtk_toolbar_remove (GtkContainer *container, @@ -194,6 +195,7 @@ gtk_toolbar_class_init (GtkToolbarClass *class) widget_class->size_allocate = gtk_toolbar_size_allocate; widget_class->style_set = gtk_toolbar_style_set; widget_class->show_all = gtk_toolbar_show_all; + widget_class->hide_all = gtk_toolbar_hide_all; widget_class->focus = gtk_toolbar_focus; widget_class->screen_changed = gtk_toolbar_screen_changed; @@ -848,6 +850,26 @@ gtk_toolbar_show_all (GtkWidget *widget) gtk_widget_show (widget); } +static void +child_hide_all (GtkWidget *widget) +{ + /* Don't hide our own children, since that would also hide + * widgets that won't be shown again by gtk_toolbar_show_all(). + */ + if (!g_object_get_data (G_OBJECT (widget), + "gtk-toolbar-is-child")) + gtk_widget_hide_all (widget); +} + +static void +gtk_toolbar_hide_all (GtkWidget *widget) +{ + gtk_container_foreach (GTK_CONTAINER (widget), + (GtkCallback) child_hide_all, + NULL); + gtk_widget_hide (widget); +} + static void gtk_toolbar_add (GtkContainer *container, GtkWidget *widget)