GTK3: convert get_dest_row_at_pos function

svn: r20338
This commit is contained in:
Benny Malengier 2012-09-06 09:02:36 +00:00
parent 6ff34a87ee
commit aab1e24b32
2 changed files with 8 additions and 6 deletions

View File

@ -272,11 +272,12 @@ class EmbeddedList(ButtonTab):
if row is None: if row is None:
return len(self.get_data()) return len(self.get_data())
else: else:
path = row[0].get_indices()
if row[1] in (Gtk.TreeViewDropPosition.BEFORE, if row[1] in (Gtk.TreeViewDropPosition.BEFORE,
Gtk.TreeViewDropPosition.INTO_OR_BEFORE): Gtk.TreeViewDropPosition.INTO_OR_BEFORE):
return row[0][0] return path[0]
else: else:
return row[0][0]+1 return path[0]+1
def _handle_drag(self, row, obj): def _handle_drag(self, row, obj):
self.get_data().insert(row, obj) self.get_data().insert(row, obj)

View File

@ -214,8 +214,9 @@ class GroupEmbeddedList(EmbeddedList):
else: else:
return [self._WORKGROUP, len(self.get_data()[self._WORKGROUP])] return [self._WORKGROUP, len(self.get_data()[self._WORKGROUP])]
else: else:
wgroup = dest[0][0] path = dest[0].get_indices()
if len(dest[0]) == 1: wgroup = path[0]
if len(path) == 1:
# On a heading # On a heading
if dest[1] == Gtk.TreeViewDropPosition.BEFORE: if dest[1] == Gtk.TreeViewDropPosition.BEFORE:
if wgroup != 0: if wgroup != 0:
@ -229,9 +230,9 @@ class GroupEmbeddedList(EmbeddedList):
else: else:
if dest[1] in (Gtk.TreeViewDropPosition.BEFORE, if dest[1] in (Gtk.TreeViewDropPosition.BEFORE,
Gtk.TreeViewDropPosition.INTO_OR_BEFORE): Gtk.TreeViewDropPosition.INTO_OR_BEFORE):
return (wgroup, dest[0][1]) return (wgroup, path[1])
else: else:
return (wgroup, dest[0][1]+1) return (wgroup, path[1]+1)
def _handle_drag(self, row, obj): def _handle_drag(self, row, obj):
""" """