[gtk+/wip/baedert/gtkimageview] shortcuts: Don't forall() widgets that aren't children



commit 058847f4b2f11e829e18be68d75e79331757d1e4
Author: Benjamin Otte <otte redhat com>
Date:   Fri Jan 22 20:39:14 2016 +0100

    shortcuts: Don't forall() widgets that aren't children

 gtk/gtkshortcutssection.c |   13 +++++++------
 gtk/gtkshortcutswindow.c  |   41 +++++++++++++++++++----------------------
 2 files changed, 26 insertions(+), 28 deletions(-)
---
diff --git a/gtk/gtkshortcutssection.c b/gtk/gtkshortcutssection.c
index 3295ebb..e21d5ce 100644
--- a/gtk/gtkshortcutssection.c
+++ b/gtk/gtkshortcutssection.c
@@ -163,14 +163,15 @@ gtk_shortcuts_section_forall (GtkContainer *container,
 
   if (include_internal)
     {
-      callback (GTK_WIDGET (self->stack), callback_data);
-      callback (GTK_WIDGET (self->footer), callback_data);
+      GTK_CONTAINER_CLASS (gtk_shortcuts_section_parent_class)->forall (container, include_internal, 
callback, callback_data);
     }
-
-  for (l = self->groups; l; l = l->next)
+  else
     {
-      GtkWidget *group = l->data;
-      callback (group, callback_data);
+      for (l = self->groups; l; l = l->next)
+        {
+          GtkWidget *group = l->data;
+          callback (group, callback_data);
+        }
     }
 }
 
diff --git a/gtk/gtkshortcutswindow.c b/gtk/gtkshortcutswindow.c
index 09e6a07..6edb4ee 100644
--- a/gtk/gtkshortcutswindow.c
+++ b/gtk/gtkshortcutswindow.c
@@ -371,32 +371,29 @@ gtk_shortcuts_window_forall (GtkContainer *container,
 
   if (include_internal)
     {
-      if (priv->header_bar)
-        callback (GTK_WIDGET (priv->header_bar), callback_data);
-      if (priv->main_box)
-        callback (GTK_WIDGET (priv->main_box), callback_data);
-      if (priv->popover)
-        callback (GTK_WIDGET (priv->popover), callback_data);
+      GTK_CONTAINER_CLASS (gtk_shortcuts_window_parent_class)->forall (container, include_internal, 
callback, callback_data);
     }
-
-  if (priv->stack)
+  else
     {
-      GList *children, *l;
-      GtkWidget *search;
-      GtkWidget *empty;
-
-      search = gtk_stack_get_child_by_name (GTK_STACK (priv->stack), "internal-search");
-      empty = gtk_stack_get_child_by_name (GTK_STACK (priv->stack), "no-search-results");
-      children = gtk_container_get_children (GTK_CONTAINER (priv->stack));
-      for (l = children; l; l = l->next)
+      if (priv->stack)
         {
-          GtkWidget *child = l->data;
-
-          if (include_internal ||
-              (child != search && child != empty))
-            callback (child, callback_data);
+          GList *children, *l;
+          GtkWidget *search;
+          GtkWidget *empty;
+
+          search = gtk_stack_get_child_by_name (GTK_STACK (priv->stack), "internal-search");
+          empty = gtk_stack_get_child_by_name (GTK_STACK (priv->stack), "no-search-results");
+          children = gtk_container_get_children (GTK_CONTAINER (priv->stack));
+          for (l = children; l; l = l->next)
+            {
+              GtkWidget *child = l->data;
+
+              if (include_internal ||
+                  (child != search && child != empty))
+                callback (child, callback_data);
+            }
+          g_list_free (children);
         }
-      g_list_free (children);
     }
 }
 


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