dnd now should work for all(?) file managers
This commit is contained in:
parent
86443c4934
commit
47e9aa46db
|
@ -51,8 +51,8 @@ class TabbedChatWindow(chat.Chat):
|
||||||
self.possible_paused_timeout_id = {}
|
self.possible_paused_timeout_id = {}
|
||||||
# keep check for possible inactive timeouts per jid
|
# keep check for possible inactive timeouts per jid
|
||||||
self.possible_inactive_timeout_id = {}
|
self.possible_inactive_timeout_id = {}
|
||||||
self.TARGET_TYPE_TEXT = 80
|
self.TARGET_TYPE_URI_LIST = 80
|
||||||
self.dnd_list = [ ( 'text/plain', 0, self.TARGET_TYPE_TEXT ) ]
|
self.dnd_list = [ ( 'text/uri-list', 0, self.TARGET_TYPE_URI_LIST ) ]
|
||||||
self.new_user(user)
|
self.new_user(user)
|
||||||
self.show_title()
|
self.show_title()
|
||||||
|
|
||||||
|
@ -104,9 +104,10 @@ class TabbedChatWindow(chat.Chat):
|
||||||
|
|
||||||
def on_drag_data_received(self, widget, context, x, y, selection, target_type,
|
def on_drag_data_received(self, widget, context, x, y, selection, target_type,
|
||||||
timestamp, contact):
|
timestamp, contact):
|
||||||
if target_type == self.TARGET_TYPE_TEXT:
|
if target_type == self.TARGET_TYPE_URI_LIST:
|
||||||
path = selection.data.strip() # get path to file
|
uri = selection.data.strip()
|
||||||
if path.startswith('file://'):
|
path = urllib.url2pathname(uri) # escape special chars
|
||||||
|
if path.startswith('file://'): # get the path to file
|
||||||
path = path[7:] # 7 is len('file://')
|
path = path[7:] # 7 is len('file://')
|
||||||
if os.path.isfile(path): # is it file?
|
if os.path.isfile(path): # is it file?
|
||||||
self.plugin.windows['file_transfers'].send_file(self.account,
|
self.plugin.windows['file_transfers'].send_file(self.account,
|
||||||
|
|
Loading…
Reference in New Issue