[gimp] Add new vfunc GimpContainerView::insert_item_after()



commit ebe72148dd8761a3862e45d58dc82d4e77337c6b
Author: Michael Natterer <mitch gimp org>
Date:   Wed Sep 16 19:53:13 2009 +0200

    Add new vfunc GimpContainerView::insert_item_after()
    
    The new function is called after the item is inserted. This is a much
    smaller change than turning all vfuncs into signals just to be able
    connect_after to one of them.

 app/widgets/gimpcontainerview.c |   37 ++++++++++++++---------
 app/widgets/gimpcontainerview.h |   61 ++++++++++++++++++++------------------
 2 files changed, 54 insertions(+), 44 deletions(-)
---
diff --git a/app/widgets/gimpcontainerview.c b/app/widgets/gimpcontainerview.c
index c4b1603..4e087f4 100644
--- a/app/widgets/gimpcontainerview.c
+++ b/app/widgets/gimpcontainerview.c
@@ -197,21 +197,22 @@ gimp_container_view_iface_base_init (GimpContainerViewInterface *view_iface)
                   GIMP_TYPE_OBJECT,
                   G_TYPE_POINTER);
 
-  view_iface->select_item   = NULL;
-  view_iface->activate_item = NULL;
-  view_iface->context_item  = NULL;
-
-  view_iface->set_container = gimp_container_view_real_set_container;
-  view_iface->set_context   = gimp_container_view_real_set_context;
-  view_iface->insert_item   = NULL;
-  view_iface->remove_item   = NULL;
-  view_iface->reorder_item  = NULL;
-  view_iface->rename_item   = NULL;
-  view_iface->clear_items   = gimp_container_view_real_clear_items;
-  view_iface->set_view_size = NULL;
-
-  view_iface->insert_data_free = NULL;
-  view_iface->model_is_tree    = FALSE;
+  view_iface->select_item       = NULL;
+  view_iface->activate_item     = NULL;
+  view_iface->context_item      = NULL;
+
+  view_iface->set_container     = gimp_container_view_real_set_container;
+  view_iface->set_context       = gimp_container_view_real_set_context;
+  view_iface->insert_item       = NULL;
+  view_iface->insert_item_after = NULL;
+  view_iface->remove_item       = NULL;
+  view_iface->reorder_item      = NULL;
+  view_iface->rename_item       = NULL;
+  view_iface->clear_items       = gimp_container_view_real_clear_items;
+  view_iface->set_view_size     = NULL;
+
+  view_iface->insert_data_free  = NULL;
+  view_iface->model_is_tree     = FALSE;
 
   g_object_interface_install_property (view_iface,
                                        g_param_spec_object ("container",
@@ -904,6 +905,9 @@ gimp_container_view_add_foreach (GimpViewable      *viewable,
 
   g_hash_table_insert (private->item_hash, viewable, insert_data);
 
+  if (view_iface->insert_item_after)
+    view_iface->insert_item_after (view, viewable, insert_data);
+
   children = gimp_viewable_get_children (viewable);
 
   if (children)
@@ -939,6 +943,9 @@ gimp_container_view_add (GimpContainerView *view,
 
   g_hash_table_insert (private->item_hash, viewable, insert_data);
 
+  if (view_iface->insert_item_after)
+    view_iface->insert_item_after (view, viewable, insert_data);
+
   children = gimp_viewable_get_children (viewable);
 
   if (children)
diff --git a/app/widgets/gimpcontainerview.h b/app/widgets/gimpcontainerview.h
index 45673b8..1157f09 100644
--- a/app/widgets/gimpcontainerview.h
+++ b/app/widgets/gimpcontainerview.h
@@ -47,37 +47,40 @@ struct _GimpContainerViewInterface
   GTypeInterface base_iface;
 
   /*  signals  */
-  gboolean (* select_item)   (GimpContainerView *view,
-                              GimpViewable      *object,
-                              gpointer           insert_data);
-  void     (* activate_item) (GimpContainerView *view,
-                              GimpViewable      *object,
-                              gpointer           insert_data);
-  void     (* context_item)  (GimpContainerView *view,
-                              GimpViewable      *object,
-                              gpointer           insert_data);
+  gboolean (* select_item)       (GimpContainerView *view,
+                                  GimpViewable      *object,
+                                  gpointer           insert_data);
+  void     (* activate_item)     (GimpContainerView *view,
+                                  GimpViewable      *object,
+                                  gpointer           insert_data);
+  void     (* context_item)      (GimpContainerView *view,
+                                  GimpViewable      *object,
+                                  gpointer           insert_data);
 
   /*  virtual functions  */
-  void     (* set_container) (GimpContainerView *view,
-                              GimpContainer     *container);
-  void     (* set_context)   (GimpContainerView *view,
-                              GimpContext       *context);
-  gpointer (* insert_item)   (GimpContainerView *view,
-                              GimpViewable      *object,
-                              gpointer           parent_insert_data,
-                              gint               index);
-  void     (* remove_item)   (GimpContainerView *view,
-                              GimpViewable      *object,
-                              gpointer           insert_data);
-  void     (* reorder_item)  (GimpContainerView *view,
-                              GimpViewable      *object,
-                              gint               new_index,
-                              gpointer           insert_data);
-  void     (* rename_item)   (GimpContainerView *view,
-                              GimpViewable      *object,
-                              gpointer           insert_data);
-  void     (* clear_items)   (GimpContainerView *view);
-  void     (* set_view_size) (GimpContainerView *view);
+  void     (* set_container)     (GimpContainerView *view,
+                                  GimpContainer     *container);
+  void     (* set_context)       (GimpContainerView *view,
+                                  GimpContext       *context);
+  gpointer (* insert_item)       (GimpContainerView *view,
+                                  GimpViewable      *object,
+                                  gpointer           parent_insert_data,
+                                  gint               index);
+  void     (* insert_item_after) (GimpContainerView *view,
+                                  GimpViewable      *object,
+                                  gpointer           insert_data);
+  void     (* remove_item)       (GimpContainerView *view,
+                                  GimpViewable      *object,
+                                  gpointer           insert_data);
+  void     (* reorder_item)      (GimpContainerView *view,
+                                  GimpViewable      *object,
+                                  gint               new_index,
+                                  gpointer           insert_data);
+  void     (* rename_item)       (GimpContainerView *view,
+                                  GimpViewable      *object,
+                                  gpointer           insert_data);
+  void     (* clear_items)       (GimpContainerView *view);
+  void     (* set_view_size)     (GimpContainerView *view);
 
   /*  the destroy notifier for private->hash_table's values  */
   GDestroyNotify  insert_data_free;



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