[gimp/metadata-browser] Bug 666561 - Clicking on the expand icon next to a group expands the wrong group



commit 17b2c8bc39c194ca5bc22ab45e2c1023c4fcda3a
Author: Michael Natterer <mitch gimp org>
Date:   Thu Feb 9 20:38:46 2012 +0100

    Bug 666561 - Clicking on the expand icon next to a group expands the wrong group
    
    gimp_item_tree_view_row_expanded(): only select the active item if its
    immediate parent was expanded, not if *any* group was expanded.

 app/widgets/gimpitemtreeview.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c
index 3c30dfb..7400e0e 100644
--- a/app/widgets/gimpitemtreeview.c
+++ b/app/widgets/gimpitemtreeview.c
@@ -1562,14 +1562,28 @@ gimp_item_tree_view_row_expanded (GtkTreeView      *tree_view,
   if (! item_view->priv->inserting_item)
     {
       GimpItemTreeViewClass *item_view_class;
+      GimpViewRenderer      *renderer;
+      GimpItem              *expanded_item;
       GimpItem              *active_item;
 
+      gtk_tree_model_get (GIMP_CONTAINER_TREE_VIEW (item_view)->model, iter,
+                          GIMP_CONTAINER_TREE_STORE_COLUMN_RENDERER, &renderer,
+                          -1);
+      expanded_item = GIMP_ITEM (renderer->viewable);
+      g_object_unref (renderer);
+
       item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (item_view);
 
       active_item = item_view_class->get_active_item (item_view->priv->image);
 
-      if (active_item)
-        gimp_container_view_select_item (GIMP_CONTAINER_VIEW (item_view),
-                                         GIMP_VIEWABLE (active_item));
+      /*  select the active item only if it was made visible by expanding
+       *  its immediate parent. See bug #666561.
+       */
+      if (active_item &&
+          gimp_item_get_parent (active_item) == expanded_item)
+        {
+          gimp_container_view_select_item (GIMP_CONTAINER_VIEW (item_view),
+                                           GIMP_VIEWABLE (active_item));
+        }
     }
 }



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