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:\\\\\\'):
if path.endswith('.torrent'): path = path[8:]
path.replace("file://", "") elif path.startswith('file://'):
self.interactive_add_torrent(path) path = path[7:]
elif info == 2: elif path.startswith('file:'):
if uri_split[0].startswith('http://'): path = path[5:]
self.get_torrent_from_url(uri_split[0]) if path.endswith('.torrent'):
self.interactive_add_torrent(path)
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):