[gtk+/wip/baedert/children: 7/22] widget: Implement show_all



commit 37b653e230c15b97c2da240fcd12f0c4c82ffdcf
Author: Timm Bäder <mail baedert org>
Date:   Fri Nov 18 09:47:38 2016 +0100

    widget: Implement show_all
    
    Do what gtk_container_forall did: show_all all children, then the widget
    itself.

 gtk/gtkcontainer.c |   14 --------------
 gtk/gtkwidget.c    |   18 +++++++++++++++++-
 2 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 767cc5a..66983bc 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -322,7 +322,6 @@ static gboolean gtk_container_focus_move           (GtkContainer      *container
                                                     GtkDirectionType   direction);
 static void     gtk_container_children_callback    (GtkWidget         *widget,
                                                     gpointer           client_data);
-static void     gtk_container_show_all             (GtkWidget         *widget);
 static gint     gtk_container_draw                 (GtkWidget         *widget,
                                                     cairo_t           *cr);
 static void     gtk_container_snapshot             (GtkWidget         *widget,
@@ -463,7 +462,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->snapshot = gtk_container_snapshot;
   widget_class->draw = gtk_container_draw;
   widget_class->map = gtk_container_map;
@@ -2991,18 +2989,6 @@ gtk_container_get_focus_hadjustment (GtkContainer *container)
   return hadjustment;
 }
 
-
-static void
-gtk_container_show_all (GtkWidget *widget)
-{
-  g_return_if_fail (GTK_IS_CONTAINER (widget));
-
-  gtk_container_foreach (GTK_CONTAINER (widget),
-                         (GtkCallback) gtk_widget_show_all,
-                         NULL);
-  gtk_widget_show (widget);
-}
-
 typedef struct {
   GtkWidget *child;
   int window_depth;
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index a305dfa..3827232 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -957,6 +957,22 @@ gtk_widget_real_snapshot (GtkWidget   *widget,
 }
 
 static void
+gtk_widget_real_show_all (GtkWidget *widget)
+{
+  GtkWidget *p;
+
+  for (p = gtk_widget_get_first_child (widget);
+       p != NULL;
+       p = gtk_widget_get_next_sibling (p))
+    {
+      if (!GTK_IS_POPOVER (p))
+        gtk_widget_show_all (p);
+    }
+
+  gtk_widget_show (widget);
+}
+
+static void
 gtk_widget_class_init (GtkWidgetClass *klass)
 {
   static GObjectNotifyContext cpn_context = { 0, NULL, NULL };
@@ -1004,7 +1020,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
   klass->activate_signal = 0;
   klass->dispatch_child_properties_changed = gtk_widget_dispatch_child_properties_changed;
   klass->show = gtk_widget_real_show;
-  klass->show_all = gtk_widget_show;
+  klass->show_all = gtk_widget_real_show_all;
   klass->hide = gtk_widget_real_hide;
   klass->map = gtk_widget_real_map;
   klass->unmap = gtk_widget_real_unmap;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]