[gimp] Fix dropping an item into an empty group item immediately above it



commit 4e9f198831b6f030df9206832cd2dec409b2cecd
Author: Michael Natterer <mitch gimp org>
Date:   Fri Aug 7 09:46:16 2009 +0200

    Fix dropping an item into an empty group item immediately above it

 app/widgets/gimpcontainertreeview-dnd.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/app/widgets/gimpcontainertreeview-dnd.c b/app/widgets/gimpcontainertreeview-dnd.c
index b2f75b2..a6bd65b 100644
--- a/app/widgets/gimpcontainertreeview-dnd.c
+++ b/app/widgets/gimpcontainertreeview-dnd.c
@@ -503,15 +503,29 @@ gimp_container_tree_view_real_drop_possible (GimpContainerTreeView   *tree_view,
 
   if (dest_viewable)
     {
-      GimpViewable *parent = gimp_viewable_get_parent (dest_viewable);
+      GimpViewable *parent;
+
+      /*  dropping on the lower part of a group item drops into that group  */
+      if (drop_pos == GTK_TREE_VIEW_DROP_AFTER &&
+          gimp_viewable_get_children (dest_viewable))
+        {
+          parent = dest_viewable;
+        }
+      else
+        {
+          parent = gimp_viewable_get_parent (dest_viewable);
+        }
 
       if (parent)
         dest_container = gimp_viewable_get_children (parent);
       else if (gimp_container_have (container, GIMP_OBJECT (dest_viewable)))
         dest_container = container;
 
-      dest_index = gimp_container_get_child_index (dest_container,
-                                                   GIMP_OBJECT (dest_viewable));
+      if (parent == dest_viewable)
+        dest_index = 0;
+      else
+        dest_index = gimp_container_get_child_index (dest_container,
+                                                     GIMP_OBJECT (dest_viewable));
     }
 
   if (src_viewable && g_type_is_a (G_TYPE_FROM_INSTANCE (src_viewable),



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