[gimp/wip/Jehan/layers-dockable-refresh: 74/80] app: reording private functions' declarations and definitions.




commit f83861cebf71826ab22e8e283aed54ffd690b233
Author: Jehan <jehan girinstud io>
Date:   Wed Nov 3 15:30:47 2021 +0100

    app: reording private functions' declarations and definitions.
    
    Keep them all together and in the same order, instead of mixing public
    and private functions.

 app/widgets/gimpcontainerview.c | 321 ++++++++++++++++++++--------------------
 1 file changed, 163 insertions(+), 158 deletions(-)
---
diff --git a/app/widgets/gimpcontainerview.c b/app/widgets/gimpcontainerview.c
index faf11ae4dd..058910ddb0 100644
--- a/app/widgets/gimpcontainerview.c
+++ b/app/widgets/gimpcontainerview.c
@@ -92,6 +92,10 @@ static void   gimp_container_view_real_set_selection_mode (GimpContainerView *vi
 static void   gimp_container_view_clear_items      (GimpContainerView  *view);
 static void   gimp_container_view_real_clear_items (GimpContainerView  *view);
 
+static gint  gimp_container_view_real_get_selected (GimpContainerView  *view,
+                                                    GList             **list,
+                                                    GList             **paths);
+
 static void   gimp_container_view_add_container    (GimpContainerView  *view,
                                                     GimpContainer      *container);
 static void   gimp_container_view_add_foreach      (GimpViewable       *viewable,
@@ -143,9 +147,6 @@ static void  gimp_container_view_button_viewable_dropped (GtkWidget    *widget,
                                                           gint          y,
                                                           GimpViewable *viewable,
                                                           gpointer      data);
-static gint  gimp_container_view_real_get_selected (GimpContainerView    *view,
-                                                    GList               **list,
-                                                    GList               **paths);
 
 static gboolean gimp_container_view_are_selected_items (GimpContainerView    *view,
                                                         GList                *items);
@@ -283,46 +284,6 @@ gimp_container_view_private_finalize (GimpContainerViewPrivate *private)
   g_slice_free (GimpContainerViewPrivate, private);
 }
 
-static GimpContainerViewPrivate *
-gimp_container_view_get_private (GimpContainerView *view)
-{
-  GimpContainerViewPrivate *private;
-
-  static GQuark private_key = 0;
-
-  g_return_val_if_fail (GIMP_IS_CONTAINER_VIEW (view), NULL);
-
-  if (! private_key)
-    private_key = g_quark_from_static_string ("gimp-container-view-private");
-
-  private = g_object_get_qdata ((GObject *) view, private_key);
-
-  if (! private)
-    {
-      GimpContainerViewInterface *view_iface;
-
-      view_iface = GIMP_CONTAINER_VIEW_GET_IFACE (view);
-
-      private = g_slice_new0 (GimpContainerViewPrivate);
-
-      private->view_border_width = 1;
-
-      private->item_hash = g_hash_table_new_full (g_direct_hash,
-                                                  g_direct_equal,
-                                                  NULL,
-                                                  view_iface->insert_data_free);
-
-      g_object_set_qdata_full ((GObject *) view, private_key, private,
-                               (GDestroyNotify) gimp_container_view_private_finalize);
-
-      g_signal_connect (view, "destroy",
-                        G_CALLBACK (gimp_container_view_private_dispose),
-                        private);
-    }
-
-  return private;
-}
-
 /**
  * gimp_container_view_install_properties:
  * @klass: the class structure for a type deriving from #GObject
@@ -391,53 +352,6 @@ gimp_container_view_set_container (GimpContainerView *view,
     }
 }
 
-static void
-gimp_container_view_real_set_container (GimpContainerView *view,
-                                        GimpContainer     *container)
-{
-  GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
-
-  if (private->container)
-    {
-      if (private->context)
-        gimp_container_view_disconnect_context (view);
-
-      gimp_container_view_select_items (view, NULL);
-
-      /* freeze/thaw is only supported for the toplevel container */
-      g_signal_handlers_disconnect_by_func (private->container,
-                                            gimp_container_view_freeze,
-                                            view);
-      g_signal_handlers_disconnect_by_func (private->container,
-                                            gimp_container_view_thaw,
-                                            view);
-
-      if (! gimp_container_frozen (private->container))
-        gimp_container_view_remove_container (view, private->container);
-    }
-
-  private->container = container;
-
-  if (private->container)
-    {
-      if (! gimp_container_frozen (private->container))
-        gimp_container_view_add_container (view, private->container);
-
-      /* freeze/thaw is only supported for the toplevel container */
-      g_signal_connect_object (private->container, "freeze",
-                               G_CALLBACK (gimp_container_view_freeze),
-                               view,
-                               G_CONNECT_SWAPPED);
-      g_signal_connect_object (private->container, "thaw",
-                               G_CALLBACK (gimp_container_view_thaw),
-                               view,
-                               G_CONNECT_SWAPPED);
-
-      if (private->context)
-        gimp_container_view_connect_context (view);
-    }
-}
-
 GimpContext *
 gimp_container_view_get_context (GimpContainerView *view)
 {
@@ -469,27 +383,6 @@ gimp_container_view_set_context (GimpContainerView *view,
     }
 }
 
-static void
-gimp_container_view_real_set_context (GimpContainerView *view,
-                                      GimpContext       *context)
-{
-  GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
-
-  if (private->context &&
-      private->container)
-    {
-      gimp_container_view_disconnect_context (view);
-    }
-
-  g_set_object (&private->context, context);
-
-  if (private->context &&
-      private->container)
-    {
-      gimp_container_view_connect_context (view);
-    }
-}
-
 GtkSelectionMode
 gimp_container_view_get_selection_mode (GimpContainerView *view)
 {
@@ -509,15 +402,6 @@ gimp_container_view_set_selection_mode (GimpContainerView *view,
   GIMP_CONTAINER_VIEW_GET_IFACE (view)->set_selection_mode (view, mode);
 }
 
-static void
-gimp_container_view_real_set_selection_mode (GimpContainerView *view,
-                                             GtkSelectionMode   mode)
-{
-  GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
-
-  private->selection_mode = mode;
-}
-
 gint
 gimp_container_view_get_view_size (GimpContainerView *view,
                                    gint              *view_border_width)
@@ -919,44 +803,6 @@ gimp_container_view_is_item_selected (GimpContainerView *view,
   return found;
 }
 
-static gint
-gimp_container_view_real_get_selected (GimpContainerView    *view,
-                                       GList               **items,
-                                       GList               **items_data)
-{
-  GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
-  GType                     children_type;
-  GimpObject               *object;
-
-  if (items)
-    *items = NULL;
-
-  /* In base interface, @items_data just stays NULL. We don't have a
-   * concept for it. Classes implementing this interface may want to
-   * store and pass data for their items, but they will have to
-   * implement themselves which data, and pass through with this
-   * parameter.
-   */
-  if (items_data)
-    *items_data = NULL;
-
-  if (! private->container || ! private->context)
-    return 0;
-
-  children_type = gimp_container_get_children_type (private->container);
-  object = gimp_context_get_by_type (private->context,
-                                     children_type);
-
-  /* Base interface provides the API for multi-selection but only
-   * implements single selection. Classes must implement their own
-   * multi-selection.
-   */
-  if (items && object)
-    *items = g_list_append (*items, object);
-
-  return object ? 1 : 0;
-}
-
 void
 gimp_container_view_item_activated (GimpContainerView *view,
                                     GimpViewable      *viewable)
@@ -1061,6 +907,127 @@ gimp_container_view_get_property (GObject    *object,
     }
 }
 
+
+/*  Private functions  */
+
+
+static GimpContainerViewPrivate *
+gimp_container_view_get_private (GimpContainerView *view)
+{
+  GimpContainerViewPrivate *private;
+
+  static GQuark private_key = 0;
+
+  g_return_val_if_fail (GIMP_IS_CONTAINER_VIEW (view), NULL);
+
+  if (! private_key)
+    private_key = g_quark_from_static_string ("gimp-container-view-private");
+
+  private = g_object_get_qdata ((GObject *) view, private_key);
+
+  if (! private)
+    {
+      GimpContainerViewInterface *view_iface;
+
+      view_iface = GIMP_CONTAINER_VIEW_GET_IFACE (view);
+
+      private = g_slice_new0 (GimpContainerViewPrivate);
+
+      private->view_border_width = 1;
+
+      private->item_hash = g_hash_table_new_full (g_direct_hash,
+                                                  g_direct_equal,
+                                                  NULL,
+                                                  view_iface->insert_data_free);
+
+      g_object_set_qdata_full ((GObject *) view, private_key, private,
+                               (GDestroyNotify) gimp_container_view_private_finalize);
+
+      g_signal_connect (view, "destroy",
+                        G_CALLBACK (gimp_container_view_private_dispose),
+                        private);
+    }
+
+  return private;
+}
+
+static void
+gimp_container_view_real_set_container (GimpContainerView *view,
+                                        GimpContainer     *container)
+{
+  GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
+
+  if (private->container)
+    {
+      if (private->context)
+        gimp_container_view_disconnect_context (view);
+
+      gimp_container_view_select_items (view, NULL);
+
+      /* freeze/thaw is only supported for the toplevel container */
+      g_signal_handlers_disconnect_by_func (private->container,
+                                            gimp_container_view_freeze,
+                                            view);
+      g_signal_handlers_disconnect_by_func (private->container,
+                                            gimp_container_view_thaw,
+                                            view);
+
+      if (! gimp_container_frozen (private->container))
+        gimp_container_view_remove_container (view, private->container);
+    }
+
+  private->container = container;
+
+  if (private->container)
+    {
+      if (! gimp_container_frozen (private->container))
+        gimp_container_view_add_container (view, private->container);
+
+      /* freeze/thaw is only supported for the toplevel container */
+      g_signal_connect_object (private->container, "freeze",
+                               G_CALLBACK (gimp_container_view_freeze),
+                               view,
+                               G_CONNECT_SWAPPED);
+      g_signal_connect_object (private->container, "thaw",
+                               G_CALLBACK (gimp_container_view_thaw),
+                               view,
+                               G_CONNECT_SWAPPED);
+
+      if (private->context)
+        gimp_container_view_connect_context (view);
+    }
+}
+
+static void
+gimp_container_view_real_set_context (GimpContainerView *view,
+                                      GimpContext       *context)
+{
+  GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
+
+  if (private->context &&
+      private->container)
+    {
+      gimp_container_view_disconnect_context (view);
+    }
+
+  g_set_object (&private->context, context);
+
+  if (private->context &&
+      private->container)
+    {
+      gimp_container_view_connect_context (view);
+    }
+}
+
+static void
+gimp_container_view_real_set_selection_mode (GimpContainerView *view,
+                                             GtkSelectionMode   mode)
+{
+  GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
+
+  private->selection_mode = mode;
+}
+
 static void
 gimp_container_view_clear_items (GimpContainerView *view)
 {
@@ -1075,6 +1042,44 @@ gimp_container_view_real_clear_items (GimpContainerView *view)
   g_hash_table_remove_all (private->item_hash);
 }
 
+static gint
+gimp_container_view_real_get_selected (GimpContainerView  *view,
+                                       GList             **items,
+                                       GList             **items_data)
+{
+  GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
+  GType                     children_type;
+  GimpObject               *object;
+
+  if (items)
+    *items = NULL;
+
+  /* In base interface, @items_data just stays NULL. We don't have a
+   * concept for it. Classes implementing this interface may want to
+   * store and pass data for their items, but they will have to
+   * implement themselves which data, and pass through with this
+   * parameter.
+   */
+  if (items_data)
+    *items_data = NULL;
+
+  if (! private->container || ! private->context)
+    return 0;
+
+  children_type = gimp_container_get_children_type (private->container);
+  object = gimp_context_get_by_type (private->context,
+                                     children_type);
+
+  /* Base interface provides the API for multi-selection but only
+   * implements single selection. Classes must implement their own
+   * multi-selection.
+   */
+  if (items && object)
+    *items = g_list_append (*items, object);
+
+  return object ? 1 : 0;
+}
+
 static void
 gimp_container_view_add_container (GimpContainerView *view,
                                    GimpContainer     *container)


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