[alacarte] MainWindow: Fix drag/drop handlers



commit 6dc0fa695cbf16bc6d4f7daadec4b2f1c4f7c66b
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue May 1 16:57:20 2012 -0400

    MainWindow: Fix drag/drop handlers

 Alacarte/MainWindow.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/Alacarte/MainWindow.py b/Alacarte/MainWindow.py
index 3f157fa..1ae39c9 100644
--- a/Alacarte/MainWindow.py
+++ b/Alacarte/MainWindow.py
@@ -396,11 +396,9 @@ class MainWindow:
     def on_menu_tree_drag_data_received(self, treeview, context, x, y, selection, info, etime):
         menus = treeview.get_model()
         drop_info = treeview.get_dest_row_at_pos(x, y)
+        types = (Gtk.TreeViewDropPosition.BEFORE, Gtk.TreeViewDropPosition.INTO_OR_BEFORE)
         if drop_info:
             path, position = drop_info
-            types_before = (Gtk.TreeViewDropPosition.INTO_OR_BEFORE, Gtk.TreeViewDropPosition.INTO_OR_AFTER)
-            types_into = (Gtk.TreeViewDropPosition.INTO_OR_BEFORE, Gtk.TreeViewDropPosition.INTO_OR_AFTER)
-            types_after = (Gtk.TreeViewDropPosition.AFTER, Gtk.TreeViewDropPosition.INTO_OR_AFTER)
             if position not in types:
                 context.finish(False, False, etime)
                 return False
@@ -496,7 +494,9 @@ class MainWindow:
 
     def on_item_tree_drag_data_received(self, treeview, context, x, y, selection, info, etime):
         items = treeview.get_model()
-        types = (Gtk.TreeViewDropPosition.BEFORE, Gtk.TreeViewDropPosition.INTO_OR_BEFORE)
+        types_into = (Gtk.TreeViewDropPosition.INTO_OR_BEFORE, Gtk.TreeViewDropPosition.INTO_OR_AFTER)
+        types_before = (Gtk.TreeViewDropPosition.BEFORE, Gtk.TreeViewDropPosition.INTO_OR_BEFORE)
+        types_after = (Gtk.TreeViewDropPosition.AFTER, Gtk.TreeViewDropPosition.INTO_OR_AFTER)
         if selection.target == 'ALACARTE_ITEM_ROW':
             drop_info = treeview.get_dest_row_at_pos(x, y)
             before = None
@@ -541,7 +541,7 @@ class MainWindow:
             after = None
             if drop_info:
                 path, position = drop_info
-                if position in types:
+                if position in types_before:
                     before = items[path][3]
                 else:
                     after = items[path][3]



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