DnD of contact on a MUC window to invite
This commit is contained in:
parent
6033b20051
commit
07a3393b72
|
@ -138,7 +138,8 @@ class ChatControlBase(MessageControl):
|
||||||
self.handlers[id] = widget
|
self.handlers[id] = widget
|
||||||
# Init DND
|
# Init DND
|
||||||
self.TARGET_TYPE_URI_LIST = 80
|
self.TARGET_TYPE_URI_LIST = 80
|
||||||
self.dnd_list = [ ( 'text/uri-list', 0, self.TARGET_TYPE_URI_LIST ) ]
|
self.dnd_list = [ ( 'text/uri-list', 0, self.TARGET_TYPE_URI_LIST ),
|
||||||
|
('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_APP, 0)]
|
||||||
id = self.widget.connect('drag_data_received',
|
id = self.widget.connect('drag_data_received',
|
||||||
self._on_drag_data_received)
|
self._on_drag_data_received)
|
||||||
self.handlers[id] = self.widget
|
self.handlers[id] = self.widget
|
||||||
|
|
|
@ -1654,9 +1654,19 @@ class GroupchatControl(ChatControlBase):
|
||||||
_('You can manage your bookmarks via Actions menu in your roster.'))
|
_('You can manage your bookmarks via Actions menu in your roster.'))
|
||||||
|
|
||||||
def _on_drag_data_received(self, widget, context, x, y, selection,
|
def _on_drag_data_received(self, widget, context, x, y, selection,
|
||||||
target_type, timestamp):
|
target_type, timestamp):
|
||||||
# TODO: Invite to groupchat on dnd of a contact
|
# Invite contact to groupchat
|
||||||
pass
|
treeview = gajim.interface.roster.tree
|
||||||
|
model = treeview.get_model()
|
||||||
|
data = selection.data
|
||||||
|
path = treeview.get_selection().get_selected_rows()[1][0]
|
||||||
|
iter = model.get_iter(path)
|
||||||
|
type = model[iter][2]
|
||||||
|
account = model[iter][4].decode('utf-8')
|
||||||
|
if type != 'contact': # source is not a contact
|
||||||
|
return
|
||||||
|
contact_jid = data.decode('utf-8')
|
||||||
|
gajim.connections[self.account].send_invite(self.room_jid, contact_jid)
|
||||||
|
|
||||||
def handle_message_textview_mykey_press(self, widget, event_keyval,
|
def handle_message_textview_mykey_press(self, widget, event_keyval,
|
||||||
event_keymod):
|
event_keymod):
|
||||||
|
|
|
@ -5190,7 +5190,8 @@ class RosterWindow:
|
||||||
|
|
||||||
#signals
|
#signals
|
||||||
self.TARGET_TYPE_URI_LIST = 80
|
self.TARGET_TYPE_URI_LIST = 80
|
||||||
TARGETS = [('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_WIDGET, 0)]
|
TARGETS = [('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_APP | gtk.TARGET_SAME_WIDGET,
|
||||||
|
0)]
|
||||||
TARGETS2 = [('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_WIDGET, 0),
|
TARGETS2 = [('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_WIDGET, 0),
|
||||||
('text/uri-list', 0, self.TARGET_TYPE_URI_LIST)]
|
('text/uri-list', 0, self.TARGET_TYPE_URI_LIST)]
|
||||||
self.tree.enable_model_drag_source(gtk.gdk.BUTTON1_MASK, TARGETS,
|
self.tree.enable_model_drag_source(gtk.gdk.BUTTON1_MASK, TARGETS,
|
||||||
|
|
Loading…
Reference in New Issue