[gimp] app: add gimp_container_tree_store_columns_init()



commit 89f7500b79dad91a18bf29eaed66a64d557f6ce1
Author: Michael Natterer <mitch gimp org>
Date:   Mon May 17 21:34:11 2010 +0200

    app: add gimp_container_tree_store_columns_init()
    
    which initializes the type array with the default columns.

 app/widgets/gimpcontainertreestore.c |   29 +++++++++++++++++++++++++++++
 app/widgets/gimpcontainertreestore.h |    2 ++
 app/widgets/gimpcontainertreeview.c  |   22 ++--------------------
 3 files changed, 33 insertions(+), 20 deletions(-)
---
diff --git a/app/widgets/gimpcontainertreestore.c b/app/widgets/gimpcontainertreestore.c
index dfd54f4..667e7f4 100644
--- a/app/widgets/gimpcontainertreestore.c
+++ b/app/widgets/gimpcontainertreestore.c
@@ -405,6 +405,35 @@ gimp_container_tree_store_set_view_size (GimpContainerTreeStore *store)
 
 /*  private functions  */
 
+void
+gimp_container_tree_store_columns_init (GType *types,
+                                        gint  *n_types)
+{
+  g_return_if_fail (types != NULL);
+  g_return_if_fail (n_types != NULL);
+  g_return_if_fail (*n_types == 0);
+
+  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_RENDERER ==
+            gimp_container_tree_store_columns_add (types, n_types,
+                                                   GIMP_TYPE_VIEW_RENDERER));
+
+  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_NAME ==
+            gimp_container_tree_store_columns_add (types, n_types,
+                                                   G_TYPE_STRING));
+
+  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_NAME_ATTRIBUTES ==
+            gimp_container_tree_store_columns_add (types, n_types,
+                                                   PANGO_TYPE_ATTR_LIST));
+
+  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_NAME_SENSITIVE ==
+            gimp_container_tree_store_columns_add (types, n_types,
+                                                   G_TYPE_BOOLEAN));
+
+  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_USER_DATA ==
+            gimp_container_tree_store_columns_add (types, n_types,
+                                                   G_TYPE_POINTER));
+}
+
 gint
 gimp_container_tree_store_columns_add (GType *types,
                                        gint  *n_types,
diff --git a/app/widgets/gimpcontainertreestore.h b/app/widgets/gimpcontainertreestore.h
index 34a605b..c3c931c 100644
--- a/app/widgets/gimpcontainertreestore.h
+++ b/app/widgets/gimpcontainertreestore.h
@@ -56,6 +56,8 @@ struct _GimpContainerTreeStoreClass
 
 GType          gimp_container_tree_store_get_type      (void) G_GNUC_CONST;
 
+void           gimp_container_tree_store_columns_init  (GType                  *types,
+                                                        gint                   *n_types);
 gint           gimp_container_tree_store_columns_add   (GType                  *types,
                                                         gint                   *n_types,
                                                         GType                   type);
diff --git a/app/widgets/gimpcontainertreeview.c b/app/widgets/gimpcontainertreeview.c
index ab0c209..6f9fcb8 100644
--- a/app/widgets/gimpcontainertreeview.c
+++ b/app/widgets/gimpcontainertreeview.c
@@ -172,26 +172,8 @@ gimp_container_tree_view_init (GimpContainerTreeView *tree_view)
                                                  GIMP_TYPE_CONTAINER_TREE_VIEW,
                                                  GimpContainerTreeViewPriv);
 
-  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_RENDERER ==
-            gimp_container_tree_store_columns_add (tree_view->model_columns,
-                                                   &tree_view->n_model_columns,
-                                                   GIMP_TYPE_VIEW_RENDERER));
-  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_NAME ==
-            gimp_container_tree_store_columns_add (tree_view->model_columns,
-                                                   &tree_view->n_model_columns,
-                                                   G_TYPE_STRING));
-  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_NAME_ATTRIBUTES ==
-            gimp_container_tree_store_columns_add (tree_view->model_columns,
-                                                   &tree_view->n_model_columns,
-                                                   PANGO_TYPE_ATTR_LIST));
-  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_NAME_SENSITIVE ==
-            gimp_container_tree_store_columns_add (tree_view->model_columns,
-                                                   &tree_view->n_model_columns,
-                                                   G_TYPE_BOOLEAN));
-  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_USER_DATA ==
-            gimp_container_tree_store_columns_add (tree_view->model_columns,
-                                                   &tree_view->n_model_columns,
-                                                   G_TYPE_POINTER));
+  gimp_container_tree_store_columns_init (tree_view->model_columns,
+                                          &tree_view->n_model_columns);
 
   gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (box->scrolled_win),
                                        GTK_SHADOW_IN);



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