[gimp] app: Fix crash when GimpContainerTreeView is used to activate items



commit 8fb846160af35a9fca2ea85a0a2754d879875326
Author: Aurimas Juška <aurimas juska gmail com>
Date:   Tue Mar 9 01:13:29 2010 +0200

    app: Fix crash when GimpContainerTreeView is used to activate items
    
    Use old code path when multiselection is not needed. Rely on parent
    class to handle multiselection when it is.

 app/widgets/gimpcontainertreeview.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/app/widgets/gimpcontainertreeview.c b/app/widgets/gimpcontainertreeview.c
index 368e486..bc5b73a 100644
--- a/app/widgets/gimpcontainertreeview.c
+++ b/app/widgets/gimpcontainertreeview.c
@@ -1041,6 +1041,10 @@ gimp_container_tree_view_button_press (GtkWidget             *widget,
       GdkRectangle              column_area;
       GtkTreeIter               iter;
       gboolean                  handled = TRUE;
+      gboolean                  multisel_mode;
+
+      multisel_mode = (gtk_tree_selection_get_mode (tree_view->priv->selection)
+                       == GTK_SELECTION_MULTIPLE);
 
       gtk_tree_model_get_iter (tree_view->model, &iter, path);
 
@@ -1115,7 +1119,18 @@ gimp_container_tree_view_button_press (GtkWidget             *widget,
             {
               /*  don't select item if a toggle was clicked */
               if (! toggled_cell)
-                  handled = FALSE;
+                {
+                  if (multisel_mode)
+                    {
+                      /* let parent do the work */
+                      handled = FALSE;
+                    }
+                  else
+                    {
+                      handled = gimp_container_view_item_selected (container_view,
+                                                                   renderer->viewable);
+                    }
+                }
 
               /*  a callback invoked by selecting the item may have
                *  destroyed us, so check if the container is still there
@@ -1228,7 +1243,7 @@ gimp_container_tree_view_button_press (GtkWidget             *widget,
       gtk_tree_path_free (path);
       g_object_unref (renderer);
 
-      return handled;
+      return multisel_mode ? handled : TRUE;
     }
   else
     {



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