From d1a9d764a80d7e59d69933bdef38f8c8db32a3f2 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 19 Oct 2010 19:31:38 +0200 Subject: [PATCH] Remove gtk_widget_hide_all() it's useless and a trap for programmers https://bugzilla.gnome.org/show_bug.cgi?id=438318 --- gtk/gtkcombobox.c | 2 +- gtk/gtkcontainer.c | 14 ------------- gtk/gtkfilechooserbutton.c | 8 -------- gtk/gtkmenu.c | 10 --------- gtk/gtkmenuitem.c | 19 ----------------- gtk/gtksocket.c | 4 +--- gtk/gtktoolbar.c | 30 --------------------------- gtk/gtkwidget.c | 42 ++++++++------------------------------ gtk/gtkwidget.h | 10 ++++----- 9 files changed, 15 insertions(+), 124 deletions(-) diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index ea98ef15e9..09e58999b0 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -2343,7 +2343,7 @@ gtk_combo_box_popdown (GtkComboBox *combo_box) return; gtk_device_grab_remove (priv->popup_window, priv->grab_pointer); - gtk_widget_hide_all (priv->popup_window); + gtk_widget_hide (priv->popup_window); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button), FALSE); diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 4ed9071908..2a2555ffdb 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -316,7 +316,6 @@ static gboolean gtk_container_focus_move (GtkContainer *container static void gtk_container_children_callback (GtkWidget *widget, gpointer client_data); static void gtk_container_show_all (GtkWidget *widget); -static void gtk_container_hide_all (GtkWidget *widget); static gint gtk_container_draw (GtkWidget *widget, cairo_t *cr); static void gtk_container_map (GtkWidget *widget); @@ -448,7 +447,6 @@ gtk_container_class_init (GtkContainerClass *class) widget_class->destroy = gtk_container_destroy; widget_class->compute_expand = gtk_container_compute_expand; widget_class->show_all = gtk_container_show_all; - widget_class->hide_all = gtk_container_hide_all; widget_class->draw = gtk_container_draw; widget_class->map = gtk_container_map; widget_class->unmap = gtk_container_unmap; @@ -3031,18 +3029,6 @@ gtk_container_show_all (GtkWidget *widget) gtk_widget_show (widget); } -static void -gtk_container_hide_all (GtkWidget *widget) -{ - g_return_if_fail (GTK_IS_CONTAINER (widget)); - - gtk_widget_hide (widget); - gtk_container_foreach (GTK_CONTAINER (widget), - (GtkCallback) gtk_widget_hide_all, - NULL); -} - - static void gtk_container_draw_child (GtkWidget *child, gpointer client_data) diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index f2af98a5ed..b954f398ee 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -217,7 +217,6 @@ static void gtk_file_chooser_button_drag_data_received (GtkWidget *wi guint type, guint drag_time); static void gtk_file_chooser_button_show_all (GtkWidget *widget); -static void gtk_file_chooser_button_hide_all (GtkWidget *widget); static void gtk_file_chooser_button_show (GtkWidget *widget); static void gtk_file_chooser_button_hide (GtkWidget *widget); static void gtk_file_chooser_button_map (GtkWidget *widget); @@ -328,7 +327,6 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class) widget_class->destroy = gtk_file_chooser_button_destroy; widget_class->drag_data_received = gtk_file_chooser_button_drag_data_received; widget_class->show_all = gtk_file_chooser_button_show_all; - widget_class->hide_all = gtk_file_chooser_button_hide_all; widget_class->show = gtk_file_chooser_button_show; widget_class->hide = gtk_file_chooser_button_hide; widget_class->map = gtk_file_chooser_button_map; @@ -1100,12 +1098,6 @@ gtk_file_chooser_button_show_all (GtkWidget *widget) gtk_widget_show (widget); } -static void -gtk_file_chooser_button_hide_all (GtkWidget *widget) -{ - gtk_widget_hide (widget); -} - static void gtk_file_chooser_button_show (GtkWidget *widget) { diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 068f2a338c..0199614b34 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -241,7 +241,6 @@ static void gtk_menu_set_submenu_navigation_region (GtkMenu *menu, static void gtk_menu_deactivate (GtkMenuShell *menu_shell); static void gtk_menu_show_all (GtkWidget *widget); -static void gtk_menu_hide_all (GtkWidget *widget); static void gtk_menu_position (GtkMenu *menu); static void gtk_menu_reparent (GtkMenu *menu, GtkWidget *new_parent, @@ -479,7 +478,6 @@ gtk_menu_class_init (GtkMenuClass *class) widget_class->button_release_event = gtk_menu_button_release; widget_class->motion_notify_event = gtk_menu_motion_notify; widget_class->show_all = gtk_menu_show_all; - widget_class->hide_all = gtk_menu_hide_all; widget_class->enter_notify_event = gtk_menu_enter_notify; widget_class->leave_notify_event = gtk_menu_leave_notify; widget_class->style_set = gtk_menu_style_set; @@ -5136,14 +5134,6 @@ gtk_menu_show_all (GtkWidget *widget) gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_show_all, NULL); } - -static void -gtk_menu_hide_all (GtkWidget *widget) -{ - /* Hide children, but not self. */ - gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_hide_all, NULL); -} - /** * gtk_menu_set_screen: * @menu: a #GtkMenu. diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index 0deeda46e4..d0dd5e9032 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -114,7 +114,6 @@ static void gtk_menu_item_position_menu (GtkMenu *menu, gboolean *push_in, gpointer user_data); static void gtk_menu_item_show_all (GtkWidget *widget); -static void gtk_menu_item_hide_all (GtkWidget *widget); static void gtk_menu_item_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, @@ -194,7 +193,6 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass) widget_class->enter_notify_event = gtk_menu_item_enter; widget_class->leave_notify_event = gtk_menu_item_leave; widget_class->show_all = gtk_menu_item_show_all; - widget_class->hide_all = gtk_menu_item_hide_all; widget_class->mnemonic_activate = gtk_menu_item_mnemonic_activate; widget_class->parent_set = gtk_menu_item_parent_set; widget_class->can_activate_accel = gtk_menu_item_can_activate_accel; @@ -2187,23 +2185,6 @@ gtk_menu_item_show_all (GtkWidget *widget) gtk_widget_show (widget); } -static void -gtk_menu_item_hide_all (GtkWidget *widget) -{ - GtkMenuItem *menu_item; - - g_return_if_fail (GTK_IS_MENU_ITEM (widget)); - - gtk_widget_hide (widget); - - menu_item = GTK_MENU_ITEM (widget); - - /* hide children including submenu */ - gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_hide_all, NULL); - if (menu_item->submenu) - gtk_widget_hide_all (menu_item->submenu); -} - static gboolean gtk_menu_item_can_activate_accel (GtkWidget *widget, guint signal_id) diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c index 7389a7e0dc..a9b5b7457d 100644 --- a/gtk/gtksocket.c +++ b/gtk/gtksocket.c @@ -204,11 +204,9 @@ gtk_socket_class_init (GtkSocketClass *class) widget_class->key_release_event = gtk_socket_key_event; widget_class->focus = gtk_socket_focus; - /* We don't want to show_all/hide_all the in-process - * plug, if any. + /* We don't want to show_all the in-process plug, if any. */ widget_class->show_all = gtk_widget_show; - widget_class->hide_all = gtk_widget_hide; container_class->remove = gtk_socket_remove; container_class->forall = gtk_socket_forall; diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 7281544cce..87b180f999 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -212,7 +212,6 @@ static void gtk_toolbar_get_child_property (GtkContainer *contain GParamSpec *pspec); static void gtk_toolbar_finalize (GObject *object); 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, @@ -296,7 +295,6 @@ static GtkWidget * toolbar_content_retrieve_menu_item (ToolbarContent static gboolean toolbar_content_has_proxy_menu_item (ToolbarContent *content); static gboolean toolbar_content_is_separator (ToolbarContent *content); static void toolbar_content_show_all (ToolbarContent *content); -static void toolbar_content_hide_all (ToolbarContent *content); static void toolbar_content_set_expand (ToolbarContent *content, gboolean expand); @@ -384,7 +382,6 @@ gtk_toolbar_class_init (GtkToolbarClass *klass) widget_class->unmap = gtk_toolbar_unmap; widget_class->popup_menu = gtk_toolbar_popup_menu; widget_class->show_all = gtk_toolbar_show_all; - widget_class->hide_all = gtk_toolbar_hide_all; container_class->add = gtk_toolbar_add; container_class->remove = gtk_toolbar_remove; @@ -2442,23 +2439,6 @@ gtk_toolbar_show_all (GtkWidget *widget) gtk_widget_show (widget); } -static void -gtk_toolbar_hide_all (GtkWidget *widget) -{ - GtkToolbar *toolbar = GTK_TOOLBAR (widget); - GtkToolbarPrivate *priv = toolbar->priv; - GList *list; - - for (list = priv->content; list != NULL; list = list->next) - { - ToolbarContent *content = list->data; - - toolbar_content_hide_all (content); - } - - gtk_widget_hide (widget); -} - static void gtk_toolbar_add (GtkContainer *container, GtkWidget *widget) @@ -3567,16 +3547,6 @@ toolbar_content_show_all (ToolbarContent *content) gtk_widget_show_all (widget); } -static void -toolbar_content_hide_all (ToolbarContent *content) -{ - GtkWidget *widget; - - widget = toolbar_content_get_widget (content); - if (widget) - gtk_widget_hide_all (widget); -} - /* * Getters */ diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index ca53772936..38fab006bb 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -746,7 +746,6 @@ gtk_widget_class_init (GtkWidgetClass *klass) klass->show = gtk_widget_real_show; klass->show_all = gtk_widget_show; klass->hide = gtk_widget_real_hide; - klass->hide_all = gtk_widget_hide; klass->map = gtk_widget_real_map; klass->unmap = gtk_widget_real_unmap; klass->realize = gtk_widget_real_realize; @@ -3972,28 +3971,6 @@ gtk_widget_show_all (GtkWidget *widget) class->show_all (widget); } -/** - * gtk_widget_hide_all: - * @widget: a #GtkWidget - * - * Recursively hides a widget and any child widgets. - **/ -void -gtk_widget_hide_all (GtkWidget *widget) -{ - GtkWidgetClass *class; - - g_return_if_fail (GTK_IS_WIDGET (widget)); - - if (gtk_widget_get_no_show_all (widget)) - return; - - class = GTK_WIDGET_GET_CLASS (widget); - - if (class->hide_all) - class->hide_all (widget); -} - /** * gtk_widget_map: * @widget: a #GtkWidget @@ -12503,11 +12480,11 @@ gtk_widget_remove_mnemonic_label (GtkWidget *widget, /** * gtk_widget_get_no_show_all: * @widget: a #GtkWidget - * - * Returns the current value of the GtkWidget:no-show-all property, - * which determines whether calls to gtk_widget_show_all() and - * gtk_widget_hide_all() will affect this widget. - * + * + * Returns the current value of the GtkWidget:no-show-all property, + * which determines whether calls to gtk_widget_show_all() + * will affect this widget. + * * Return value: the current value of the "no-show-all" property. * * Since: 2.4 @@ -12516,7 +12493,7 @@ gboolean gtk_widget_get_no_show_all (GtkWidget *widget) { g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); - + return widget->priv->no_show_all; } @@ -12524,10 +12501,9 @@ gtk_widget_get_no_show_all (GtkWidget *widget) * gtk_widget_set_no_show_all: * @widget: a #GtkWidget * @no_show_all: the new value for the "no-show-all" property - * - * Sets the #GtkWidget:no-show-all property, which determines whether - * calls to gtk_widget_show_all() and gtk_widget_hide_all() will affect - * this widget. + * + * Sets the #GtkWidget:no-show-all property, which determines whether + * calls to gtk_widget_show_all() will affect this widget. * * This is mostly for use in constructing widget hierarchies with externally * controlled visibility, see #GtkUIManager. diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index e576ae6b1c..0d8859111d 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -183,7 +183,6 @@ struct _GtkWidgetClass void (* show) (GtkWidget *widget); void (* show_all) (GtkWidget *widget); void (* hide) (GtkWidget *widget); - void (* hide_all) (GtkWidget *widget); void (* map) (GtkWidget *widget); void (* unmap) (GtkWidget *widget); void (* realize) (GtkWidget *widget); @@ -416,13 +415,12 @@ void gtk_widget_destroy (GtkWidget *widget); void gtk_widget_destroyed (GtkWidget *widget, GtkWidget **widget_pointer); void gtk_widget_unparent (GtkWidget *widget); -void gtk_widget_show (GtkWidget *widget); +void gtk_widget_show (GtkWidget *widget); +void gtk_widget_hide (GtkWidget *widget); void gtk_widget_show_now (GtkWidget *widget); -void gtk_widget_hide (GtkWidget *widget); -void gtk_widget_show_all (GtkWidget *widget); -void gtk_widget_hide_all (GtkWidget *widget); +void gtk_widget_show_all (GtkWidget *widget); void gtk_widget_set_no_show_all (GtkWidget *widget, - gboolean no_show_all); + gboolean no_show_all); gboolean gtk_widget_get_no_show_all (GtkWidget *widget); void gtk_widget_map (GtkWidget *widget); void gtk_widget_unmap (GtkWidget *widget);