[gimp] Add a per-class flags that indicates that a container view's model is a tree



commit ad806713ae1787b12eee12f44ac32d42efa1e318
Author: Michael Natterer <mitch gimp org>
Date:   Mon Aug 3 23:42:55 2009 +0200

    Add a per-class flags that indicates that a container view's model is a tree
    
    * app/widgets/gimpcontainerview.h: add "gboolean model_is_tree"
      to GimpContainerViewInterface.
    
    * app/widgets/gimpcontainerview.c: default to FALSE and enable the
      commented-out optimization in remove_container() for list-only
      container views.

 app/widgets/gimpcontainerview.c |   11 ++++++++---
 app/widgets/gimpcontainerview.h |    1 +
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/app/widgets/gimpcontainerview.c b/app/widgets/gimpcontainerview.c
index c571a60..23e767e 100644
--- a/app/widgets/gimpcontainerview.c
+++ b/app/widgets/gimpcontainerview.c
@@ -210,6 +210,7 @@ gimp_container_view_iface_base_init (GimpContainerViewInterface *view_iface)
   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",
@@ -958,8 +959,12 @@ static void
 gimp_container_view_remove_container (GimpContainerView *view,
                                       GimpContainer     *container)
 {
-  GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
-  GQuark                    name_changed_handler_id;
+  GimpContainerViewInterface *view_iface;
+  GimpContainerViewPrivate   *private;
+  GQuark                      name_changed_handler_id;
+
+  view_iface = GIMP_CONTAINER_VIEW_GET_INTERFACE (view);
+  private    = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
 
   name_changed_handler_id =
     GPOINTER_TO_UINT (g_hash_table_lookup (private->name_changed_handler_hash,
@@ -979,7 +984,7 @@ gimp_container_view_remove_container (GimpContainerView *view,
                                         gimp_container_view_reorder,
                                         view);
 
-  if (FALSE /* private->model_is_list */ && container == private->container)
+  if (! view_iface->model_is_tree && container == private->container)
     {
       gimp_container_view_clear_items (view);
     }
diff --git a/app/widgets/gimpcontainerview.h b/app/widgets/gimpcontainerview.h
index 167d34f..45673b8 100644
--- a/app/widgets/gimpcontainerview.h
+++ b/app/widgets/gimpcontainerview.h
@@ -81,6 +81,7 @@ struct _GimpContainerViewInterface
 
   /*  the destroy notifier for private->hash_table's values  */
   GDestroyNotify  insert_data_free;
+  gboolean        model_is_tree;
 };
 
 



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