we can now drop in the middle of a metacontact. Fixes #4804
This commit is contained in:
parent
ae30140df3
commit
52c788795a
1 changed files with 17 additions and 9 deletions
|
@ -4035,7 +4035,7 @@ class RosterWindow:
|
||||||
path_dest, position = drop_info
|
path_dest, position = drop_info
|
||||||
|
|
||||||
if position == gtk.TREE_VIEW_DROP_BEFORE and len(path_dest) == 2 \
|
if position == gtk.TREE_VIEW_DROP_BEFORE and len(path_dest) == 2 \
|
||||||
and path_dest[1] == 0: # dropped before the first group
|
and path_dest[1] == 0: # dropped before the first group
|
||||||
return
|
return
|
||||||
if position == gtk.TREE_VIEW_DROP_BEFORE and len(path_dest) == 2:
|
if position == gtk.TREE_VIEW_DROP_BEFORE and len(path_dest) == 2:
|
||||||
# dropped before a group: we drop it in the previous group every time
|
# dropped before a group: we drop it in the previous group every time
|
||||||
|
@ -4175,19 +4175,29 @@ class RosterWindow:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Is the contact we drag a meta contact?
|
# Is the contact we drag a meta contact?
|
||||||
accounts = (self.regroup and gajim.contacts.get_accounts()) or account_source
|
accounts = (self.regroup and gajim.contacts.get_accounts()) or \
|
||||||
is_big_brother = gajim.contacts.is_big_brother(account_source, jid_source, accounts)
|
account_source
|
||||||
|
is_big_brother = gajim.contacts.is_big_brother(account_source, jid_source,
|
||||||
|
accounts)
|
||||||
|
|
||||||
# Contact drop on group row or between two contacts
|
drop_in_middle_of_meta = False
|
||||||
if type_dest == 'group' or position == gtk.TREE_VIEW_DROP_BEFORE or \
|
if type_dest == 'contact':
|
||||||
position == gtk.TREE_VIEW_DROP_AFTER:
|
if position == gtk.TREE_VIEW_DROP_BEFORE and len(path_dest) == 4:
|
||||||
|
drop_in_middle_of_meta = True
|
||||||
|
if position == gtk.TREE_VIEW_DROP_AFTER and (len(path_dest) == 4 or \
|
||||||
|
self.modelfilter.iter_has_child(iter_dest)):
|
||||||
|
drop_in_middle_of_meta = True
|
||||||
|
# Contact drop on group row or between two contacts that are
|
||||||
|
# not metacontacts
|
||||||
|
if (type_dest == 'group' or position in (gtk.TREE_VIEW_DROP_BEFORE,
|
||||||
|
gtk.TREE_VIEW_DROP_AFTER)) and not drop_in_middle_of_meta:
|
||||||
self.on_drop_in_group(None, account_source, c_source, grp_dest,
|
self.on_drop_in_group(None, account_source, c_source, grp_dest,
|
||||||
is_big_brother, context, etime, grp_source)
|
is_big_brother, context, etime, grp_source)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Contact drop on another contact, make meta contacts
|
# Contact drop on another contact, make meta contacts
|
||||||
if position == gtk.TREE_VIEW_DROP_INTO_OR_AFTER or \
|
if position == gtk.TREE_VIEW_DROP_INTO_OR_AFTER or \
|
||||||
position == gtk.TREE_VIEW_DROP_INTO_OR_BEFORE:
|
position == gtk.TREE_VIEW_DROP_INTO_OR_BEFORE or drop_in_middle_of_meta:
|
||||||
c_dest = gajim.contacts.get_contact_with_highest_priority(account_dest,
|
c_dest = gajim.contacts.get_contact_with_highest_priority(account_dest,
|
||||||
jid_dest)
|
jid_dest)
|
||||||
if not c_dest:
|
if not c_dest:
|
||||||
|
@ -4211,8 +4221,6 @@ class RosterWindow:
|
||||||
menu.connect('selection-done', gtkgui_helpers.destroy_widget)
|
menu.connect('selection-done', gtkgui_helpers.destroy_widget)
|
||||||
menu.show_all()
|
menu.show_all()
|
||||||
menu.popup(None, None, None, 1, etime)
|
menu.popup(None, None, None, 1, etime)
|
||||||
# self.on_drop_in_contact(treeview, account_source, c_source,
|
|
||||||
# account_dest, c_dest, is_big_brother, context, etime)
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
### Everything about images and icons....
|
### Everything about images and icons....
|
||||||
|
|
Loading…
Add table
Reference in a new issue