[gtk+] container: Split out a function



commit 97dc45f8a503819ad833b6ea35fdafc58fc02bae
Author: Benjamin Otte <otte redhat com>
Date:   Mon Apr 9 21:04:47 2012 +0200

    container: Split out a function

 gtk/gtkcontainer.c        |   75 +++++++++++++++++++++++++--------------------
 gtk/gtkcontainerprivate.h |    3 ++
 2 files changed, 45 insertions(+), 33 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 75c7d53..962afde 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -1666,6 +1666,47 @@ gtk_container_idle_sizer (gpointer data)
   return FALSE;
 }
 
+void
+_gtk_container_queue_resize_handler (GtkContainer *container)
+{
+  GtkWidget *widget;
+
+  g_return_if_fail (GTK_IS_RESIZE_CONTAINER (container));
+
+  widget = GTK_WIDGET (container);
+
+  if (gtk_widget_get_visible (widget) &&
+      (gtk_widget_is_toplevel (widget) ||
+       gtk_widget_get_realized (widget)))
+    {
+      switch (container->priv->resize_mode)
+        {
+        case GTK_RESIZE_QUEUE:
+          if (!_gtk_widget_get_resize_pending (widget))
+            {
+              _gtk_widget_set_resize_pending (widget, TRUE);
+              if (container_resize_queue == NULL)
+                gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE,
+                                           gtk_container_idle_sizer,
+                                           NULL, NULL);
+              container_resize_queue = g_slist_prepend (container_resize_queue, container);
+            }
+          break;
+
+        case GTK_RESIZE_IMMEDIATE:
+          _gtk_style_context_validate (gtk_widget_get_style_context (widget),
+                                       g_get_monotonic_time (),
+                                       0);
+          gtk_container_check_resize (container);
+
+        case GTK_RESIZE_PARENT:
+        default:
+          g_assert_not_reached ();
+          break;
+        }
+    }
+}
+
 static void
 _gtk_container_queue_resize_internal (GtkContainer *container,
                                       gboolean      invalidate_only)
@@ -1690,39 +1731,7 @@ _gtk_container_queue_resize_internal (GtkContainer *container,
   while (widget);
 
   if (widget && !invalidate_only)
-    {
-      container = GTK_CONTAINER (widget);
-
-      if (gtk_widget_get_visible (widget) &&
-          (gtk_widget_is_toplevel (widget) ||
-           gtk_widget_get_realized (widget)))
-        {
-          switch (container->priv->resize_mode)
-            {
-            case GTK_RESIZE_QUEUE:
-              if (!_gtk_widget_get_resize_pending (widget))
-                {
-                  _gtk_widget_set_resize_pending (widget, TRUE);
-                  if (container_resize_queue == NULL)
-                    gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE,
-                                               gtk_container_idle_sizer,
-                                               NULL, NULL);
-                  container_resize_queue = g_slist_prepend (container_resize_queue, container);
-                }
-              break;
-
-            case GTK_RESIZE_IMMEDIATE:
-              _gtk_style_context_validate (gtk_widget_get_style_context (widget),
-                                           g_get_monotonic_time (),
-                                           0);
-              break;
-
-            case GTK_RESIZE_PARENT:
-              g_assert_not_reached ();
-              break;
-            }
-        }
-    }
+    _gtk_container_queue_resize_handler (GTK_CONTAINER (widget));
 }
 
 /**
diff --git a/gtk/gtkcontainerprivate.h b/gtk/gtkcontainerprivate.h
index f96ae0b..81b485d 100644
--- a/gtk/gtkcontainerprivate.h
+++ b/gtk/gtkcontainerprivate.h
@@ -20,6 +20,8 @@
 #ifndef __GTK_CONTAINER_PRIVATE_H__
 #define __GTK_CONTAINER_PRIVATE_H__
 
+#include "gtkcontainer.h"
+
 G_BEGIN_DECLS
 
 
@@ -29,6 +31,7 @@ void     _gtk_container_resize_invalidate      (GtkContainer *container);
 void     _gtk_container_clear_resize_widgets   (GtkContainer *container);
 gchar*   _gtk_container_child_composite_name   (GtkContainer *container,
                                                 GtkWidget    *child);
+void     _gtk_container_queue_resize_handler   (GtkContainer *container);
 void     _gtk_container_dequeue_resize_handler (GtkContainer *container);
 GList *  _gtk_container_focus_sort             (GtkContainer     *container,
                                                 GList            *children,



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