This commit is contained in:
Marcos Pinto 2007-06-11 22:21:02 +00:00
parent 3461c96a1f
commit 86c092da7d
1 changed files with 11 additions and 10 deletions

View File

@ -817,16 +817,17 @@ class DelugeGTK:
return None return None
def on_drag_data(self, widget, drag_context, x, y, selection_data, info, timestamp): def on_drag_data(self, widget, drag_context, x, y, selection_data, info, timestamp):
uri_split = [ urllib.url2pathname(temp).replace("\0", "").strip() for temp in selection_data.data.split('\n') ] uri_split = selection_data.data.strip().split()
for uri in uri_split:
if info == 1: path = urllib.url2pathname(uri).strip('\r\n\x00')
for path in uri_split: if path.startswith('file:\\\\\\'):
path = path[8:]
elif path.startswith('file://'):
path = path[7:]
elif path.startswith('file:'):
path = path[5:]
if path.endswith('.torrent'): if path.endswith('.torrent'):
path.replace("file://", "")
self.interactive_add_torrent(path) self.interactive_add_torrent(path)
elif info == 2:
if uri_split[0].startswith('http://'):
self.get_torrent_from_url(uri_split[0])
def interactive_add_torrent(self, torrent, append=True): def interactive_add_torrent(self, torrent, append=True):
if self.config.get('use_default_dir', bool, default=False): if self.config.get('use_default_dir', bool, default=False):