[gimp] app: Add flags for multiple selection support



commit 13b172b675f55a4d2193471b2238053fd4c0a956
Author: Aurimas Juška <aurimas juska gmail com>
Date:   Mon Aug 17 23:29:43 2009 +0300

    app: Add flags for multiple selection support
    
    Multiple item selection is disabled by default and
    currently enabled only for data views.

 app/dialogs/quit-dialog.c           |    2 +-
 app/widgets/gimpbufferview.c        |    2 +-
 app/widgets/gimpcontainereditor.c   |    4 +++-
 app/widgets/gimpcontainereditor.h   |    1 +
 app/widgets/gimpcontainerpopup.c    |    1 +
 app/widgets/gimpcontainertreeview.c |   18 ++++++++++++++----
 app/widgets/gimpcontainertreeview.h |    3 ++-
 app/widgets/gimpcontainerview.c     |   21 +++++++++++++++++++++
 app/widgets/gimpcontainerview.h     |    1 +
 app/widgets/gimpcontrollerlist.c    |    2 +-
 app/widgets/gimpdatafactoryview.c   |    2 +-
 app/widgets/gimpdeviceeditor.c      |    2 +-
 app/widgets/gimpdocumentview.c      |    2 +-
 app/widgets/gimpfontview.c          |    2 +-
 app/widgets/gimpimageview.c         |    2 +-
 app/widgets/gimpsettingseditor.c    |    2 +-
 app/widgets/gimptemplateview.c      |    2 +-
 app/widgets/gimpundoeditor.c        |    2 +-
 18 files changed, 54 insertions(+), 17 deletions(-)
---
diff --git a/app/dialogs/quit-dialog.c b/app/dialogs/quit-dialog.c
index 802db10..3a0ad2c 100644
--- a/app/dialogs/quit-dialog.c
+++ b/app/dialogs/quit-dialog.c
@@ -143,7 +143,7 @@ quit_close_all_dialog_new (Gimp     *gimp,
   view_size = gimp->config->layer_preview_size;
   rows      = CLAMP (gimp_container_get_n_children (images), 3, 6);
 
-  view = gimp_container_tree_view_new (images, context, view_size, 1);
+  view = gimp_container_tree_view_new (images, context, view_size, 1, FALSE);
   gimp_container_box_set_size_request (GIMP_CONTAINER_BOX (view),
                                        -1,
                                        rows * (view_size + 2));
diff --git a/app/widgets/gimpbufferview.c b/app/widgets/gimpbufferview.c
index f244f45..4549f20 100644
--- a/app/widgets/gimpbufferview.c
+++ b/app/widgets/gimpbufferview.c
@@ -132,7 +132,7 @@ gimp_buffer_view_new (GimpViewType     view_type,
   if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (buffer_view),
                                          view_type,
                                          container, context,
-                                         view_size, view_border_width,
+                                         view_size, view_border_width, FALSE,
                                          menu_factory, "<Buffers>",
                                          "/buffers-popup"))
     {
diff --git a/app/widgets/gimpcontainereditor.c b/app/widgets/gimpcontainereditor.c
index d0f54cd..b35cf71 100644
--- a/app/widgets/gimpcontainereditor.c
+++ b/app/widgets/gimpcontainereditor.c
@@ -112,6 +112,7 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
                                  GimpContext         *context,
                                  gint                 view_size,
                                  gint                 view_border_width,
+                                 gboolean             multiple_selection,
                                  GimpMenuFactory     *menu_factory,
                                  const gchar         *menu_identifier,
                                  const gchar         *ui_identifier)
@@ -142,7 +143,8 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
         GIMP_CONTAINER_VIEW (gimp_container_tree_view_new (container,
                                                            context,
                                                            view_size,
-                                                           view_border_width));
+                                                           view_border_width,
+                                                           multiple_selection));
       break;
 
     default:
diff --git a/app/widgets/gimpcontainereditor.h b/app/widgets/gimpcontainereditor.h
index c543874..04d96b6 100644
--- a/app/widgets/gimpcontainereditor.h
+++ b/app/widgets/gimpcontainereditor.h
@@ -63,6 +63,7 @@ gboolean  gimp_container_editor_construct (GimpContainerEditor *editor,
                                            GimpContext         *context,
                                            gint                 view_size,
                                            gint                 view_border_width,
+                                           gboolean             multiple_selection,
                                            GimpMenuFactory     *menu_factory,
                                            const gchar         *menu_identifier,
                                            const gchar         *ui_path);
diff --git a/app/widgets/gimpcontainerpopup.c b/app/widgets/gimpcontainerpopup.c
index a07d05c..e5923f1 100644
--- a/app/widgets/gimpcontainerpopup.c
+++ b/app/widgets/gimpcontainerpopup.c
@@ -524,6 +524,7 @@ gimp_container_popup_create_view (GimpContainerPopup *popup)
                                    popup->context,
                                    popup->view_size,
                                    popup->view_border_width,
+                                   FALSE,
                                    NULL, NULL, NULL);
 
   gimp_container_view_set_reorderable (GIMP_CONTAINER_VIEW (popup->editor->view),
diff --git a/app/widgets/gimpcontainertreeview.c b/app/widgets/gimpcontainertreeview.c
index 6e56b51..368e486 100644
--- a/app/widgets/gimpcontainertreeview.c
+++ b/app/widgets/gimpcontainertreeview.c
@@ -190,6 +190,7 @@ gimp_container_tree_view_constructor (GType                  type,
   GimpContainerBox      *box;
   GtkTreeStore          *tree;
   GObject               *object;
+  gboolean               multiple_selection;
 
   object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
 
@@ -255,8 +256,14 @@ gimp_container_tree_view_constructor (GType                  type,
 
   tree_view->priv->selection = gtk_tree_view_get_selection (tree_view->view);
 
-  gtk_tree_selection_set_mode (tree_view->priv->selection,
-                               GTK_SELECTION_MULTIPLE);
+  g_object_get (tree_view,
+                "multiple-selection", &multiple_selection,
+                NULL);
+  if (multiple_selection)
+    {
+      gtk_tree_selection_set_mode (tree_view->priv->selection,
+                                   GTK_SELECTION_MULTIPLE);
+    }
 
   g_signal_connect (tree_view->priv->selection, "changed",
                     G_CALLBACK (gimp_container_tree_view_selection_changed),
@@ -383,7 +390,8 @@ GtkWidget *
 gimp_container_tree_view_new (GimpContainer *container,
                               GimpContext   *context,
                               gint           view_size,
-                              gint           view_border_width)
+                              gint           view_border_width,
+                              gboolean       multiple_selection)
 {
   GimpContainerTreeView *tree_view;
   GimpContainerView     *view;
@@ -397,7 +405,9 @@ gimp_container_tree_view_new (GimpContainer *container,
                         view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH,
                         NULL);
 
-  tree_view = g_object_new (GIMP_TYPE_CONTAINER_TREE_VIEW, NULL);
+  tree_view = g_object_new (GIMP_TYPE_CONTAINER_TREE_VIEW,
+                            "multiple-selection", multiple_selection,
+                            NULL);
 
   view = GIMP_CONTAINER_VIEW (tree_view);
 
diff --git a/app/widgets/gimpcontainertreeview.h b/app/widgets/gimpcontainertreeview.h
index 5b367dd..6c22e0b 100644
--- a/app/widgets/gimpcontainertreeview.h
+++ b/app/widgets/gimpcontainertreeview.h
@@ -111,7 +111,8 @@ GType       gimp_container_tree_view_get_type (void) G_GNUC_CONST;
 GtkWidget * gimp_container_tree_view_new      (GimpContainer *container,
                                                GimpContext   *context,
                                                gint           view_size,
-                                               gint           view_border_width);
+                                               gint           view_border_width,
+                                               gboolean       multiple_selection);
 
 void        gimp_container_tree_view_set_main_column_title
                                               (GimpContainerTreeView *tree_view,
diff --git a/app/widgets/gimpcontainerview.c b/app/widgets/gimpcontainerview.c
index 0de7ccf..a9cd0dd 100644
--- a/app/widgets/gimpcontainerview.c
+++ b/app/widgets/gimpcontainerview.c
@@ -65,6 +65,7 @@ struct _GimpContainerViewPrivate
   gint             view_size;
   gint             view_border_width;
   gboolean         reorderable;
+  gboolean         multiple_selection;
 
   /*  initialized by subclass  */
   GtkWidget       *dnd_widget;
@@ -232,6 +233,13 @@ gimp_container_view_iface_base_init (GimpContainerViewInterface *view_iface)
                                                             GIMP_PARAM_READWRITE));
 
   g_object_interface_install_property (view_iface,
+                                       g_param_spec_boolean ("multiple-selection",
+                                                            NULL, NULL,
+                                                            FALSE,
+                                                            GIMP_PARAM_READWRITE |
+                                                            G_PARAM_CONSTRUCT));
+
+  g_object_interface_install_property (view_iface,
                                        g_param_spec_boolean ("reorderable",
                                                              NULL, NULL,
                                                              FALSE,
@@ -339,6 +347,9 @@ gimp_container_view_install_properties (GObjectClass *klass)
                                     GIMP_CONTAINER_VIEW_PROP_CONTEXT,
                                     "context");
   g_object_class_override_property (klass,
+                                    GIMP_CONTAINER_VIEW_PROP_MULTIPLE_SELECTION,
+                                    "multiple-selection");
+  g_object_class_override_property (klass,
                                     GIMP_CONTAINER_VIEW_PROP_REORDERABLE,
                                     "reorderable");
   g_object_class_override_property (klass,
@@ -839,6 +850,11 @@ gimp_container_view_set_property (GObject      *object,
     case GIMP_CONTAINER_VIEW_PROP_CONTEXT:
       gimp_container_view_set_context (view, g_value_get_object (value));
       break;
+    case GIMP_CONTAINER_VIEW_PROP_MULTIPLE_SELECTION:
+      {
+        GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
+        private->multiple_selection = g_value_get_boolean (value);
+      }
     case GIMP_CONTAINER_VIEW_PROP_REORDERABLE:
       gimp_container_view_set_reorderable (view, g_value_get_boolean (value));
       break;
@@ -879,6 +895,11 @@ gimp_container_view_get_property (GObject    *object,
     case GIMP_CONTAINER_VIEW_PROP_CONTEXT:
       g_value_set_object (value, gimp_container_view_get_context (view));
       break;
+    case GIMP_CONTAINER_VIEW_PROP_MULTIPLE_SELECTION:
+      {
+        GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
+        g_value_set_boolean (value, private->multiple_selection);
+      }
     case GIMP_CONTAINER_VIEW_PROP_REORDERABLE:
       g_value_set_boolean (value, gimp_container_view_get_reorderable (view));
       break;
diff --git a/app/widgets/gimpcontainerview.h b/app/widgets/gimpcontainerview.h
index 41b63a8..a2e30d5 100644
--- a/app/widgets/gimpcontainerview.h
+++ b/app/widgets/gimpcontainerview.h
@@ -27,6 +27,7 @@ typedef enum
   GIMP_CONTAINER_VIEW_PROP_0,
   GIMP_CONTAINER_VIEW_PROP_CONTAINER,
   GIMP_CONTAINER_VIEW_PROP_CONTEXT,
+  GIMP_CONTAINER_VIEW_PROP_MULTIPLE_SELECTION,
   GIMP_CONTAINER_VIEW_PROP_REORDERABLE,
   GIMP_CONTAINER_VIEW_PROP_VIEW_SIZE,
   GIMP_CONTAINER_VIEW_PROP_VIEW_BORDER_WIDTH,
diff --git a/app/widgets/gimpcontrollerlist.c b/app/widgets/gimpcontrollerlist.c
index bc40a10..d59809b 100644
--- a/app/widgets/gimpcontrollerlist.c
+++ b/app/widgets/gimpcontrollerlist.c
@@ -268,7 +268,7 @@ gimp_controller_list_init (GimpControllerList *list)
   gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (GTK_WIDGET (list)),
                                      icon_size, &icon_width, &icon_height);
 
-  list->dest = gimp_container_tree_view_new (NULL, NULL, icon_height, 0);
+  list->dest = gimp_container_tree_view_new (NULL, NULL, icon_height, 0, FALSE);
   gimp_container_tree_view_set_main_column_title (GIMP_CONTAINER_TREE_VIEW (list->dest),
                                                   _("Active Controllers"));
   gtk_tree_view_set_headers_visible (GIMP_CONTAINER_TREE_VIEW (list->dest)->view,
diff --git a/app/widgets/gimpdatafactoryview.c b/app/widgets/gimpdatafactoryview.c
index 531f16c..4be8230 100644
--- a/app/widgets/gimpdatafactoryview.c
+++ b/app/widgets/gimpdatafactoryview.c
@@ -230,7 +230,7 @@ gimp_data_factory_view_construct (GimpDataFactoryView *factory_view,
   if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (factory_view),
                                          view_type,
                                          factory_view->priv->tag_filtered_container, context,
-                                         view_size, view_border_width,
+                                         view_size, view_border_width, TRUE,
                                          menu_factory, menu_identifier,
                                          ui_identifier))
     {
diff --git a/app/widgets/gimpdeviceeditor.c b/app/widgets/gimpdeviceeditor.c
index 32af3f9..8ab70d7 100644
--- a/app/widgets/gimpdeviceeditor.c
+++ b/app/widgets/gimpdeviceeditor.c
@@ -139,7 +139,7 @@ gimp_device_editor_init (GimpDeviceEditor *editor)
                                      GTK_ICON_SIZE_BUTTON,
                                      &icon_width, &icon_height);
 
-  private->treeview = gimp_container_tree_view_new (NULL, NULL, icon_height, 0);
+  private->treeview = gimp_container_tree_view_new (NULL, NULL, icon_height, 0, FALSE);
   gtk_widget_set_size_request (private->treeview, 200, -1);
   gtk_box_pack_start (GTK_BOX (editor), private->treeview, FALSE, FALSE, 0);
   gtk_widget_show (private->treeview);
diff --git a/app/widgets/gimpdocumentview.c b/app/widgets/gimpdocumentview.c
index ebece8d..0db6df0 100644
--- a/app/widgets/gimpdocumentview.c
+++ b/app/widgets/gimpdocumentview.c
@@ -85,7 +85,7 @@ gimp_document_view_new (GimpViewType     view_type,
   if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (document_view),
                                          view_type,
                                          container, context,
-                                         view_size, view_border_width,
+                                         view_size, view_border_width, FALSE,
                                          menu_factory, "<Documents>",
                                          "/documents-popup"))
     {
diff --git a/app/widgets/gimpfontview.c b/app/widgets/gimpfontview.c
index 0b74ee5..7c296f3 100644
--- a/app/widgets/gimpfontview.c
+++ b/app/widgets/gimpfontview.c
@@ -77,7 +77,7 @@ gimp_font_view_new (GimpViewType     view_type,
   if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (font_view),
                                          view_type,
                                          container,context,
-                                         view_size, view_border_width,
+                                         view_size, view_border_width, FALSE,
                                          menu_factory, "<Fonts>",
                                          "/fonts-popup"))
     {
diff --git a/app/widgets/gimpimageview.c b/app/widgets/gimpimageview.c
index c07d902..4b0baf0 100644
--- a/app/widgets/gimpimageview.c
+++ b/app/widgets/gimpimageview.c
@@ -81,7 +81,7 @@ gimp_image_view_new (GimpViewType     view_type,
   if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (image_view),
                                          view_type,
                                          container, context,
-                                         view_size, view_border_width,
+                                         view_size, view_border_width, FALSE,
                                          menu_factory, "<Images>",
                                          "/images-popup"))
     {
diff --git a/app/widgets/gimpsettingseditor.c b/app/widgets/gimpsettingseditor.c
index 79ea54b..e48c041 100644
--- a/app/widgets/gimpsettingseditor.c
+++ b/app/widgets/gimpsettingseditor.c
@@ -148,7 +148,7 @@ gimp_settings_editor_constructor (GType                  type,
 
   editor->view = gimp_container_tree_view_new (editor->container,
                                                gimp_get_user_context (editor->gimp),
-                                               16, 0);
+                                               16, 0, FALSE);
   gtk_widget_set_size_request (editor->view, 200, 200);
   gtk_container_add (GTK_CONTAINER (editor), editor->view);
   gtk_widget_show (editor->view);
diff --git a/app/widgets/gimptemplateview.c b/app/widgets/gimptemplateview.c
index a789b2d..621a512 100644
--- a/app/widgets/gimptemplateview.c
+++ b/app/widgets/gimptemplateview.c
@@ -95,7 +95,7 @@ gimp_template_view_new (GimpViewType     view_type,
   if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (template_view),
                                          view_type,
                                          container, context,
-                                         view_size, view_border_width,
+                                         view_size, view_border_width, FALSE,
                                          menu_factory, "<Templates>",
                                          "/templates-popup"))
     {
diff --git a/app/widgets/gimpundoeditor.c b/app/widgets/gimpundoeditor.c
index 10bd21a..e1a287f 100644
--- a/app/widgets/gimpundoeditor.c
+++ b/app/widgets/gimpundoeditor.c
@@ -139,7 +139,7 @@ gimp_undo_editor_constructor (GType                  type,
 
   undo_editor->view = gimp_container_tree_view_new (NULL, NULL,
                                                     undo_editor->view_size,
-                                                    1);
+                                                    1, FALSE);
 
   gtk_container_add (GTK_CONTAINER (undo_editor), undo_editor->view);
   gtk_widget_show (undo_editor->view);



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