mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-20 15:18:20 +00:00
-
This commit is contained in:
parent
e1e3eb7b04
commit
1e96d2c49c
@ -45,6 +45,10 @@ interface = None
|
|||||||
if not "org.deluge_torrent.Deluge" in dbus_objects:
|
if not "org.deluge_torrent.Deluge" in dbus_objects:
|
||||||
print "no existing Deluge session"
|
print "no existing Deluge session"
|
||||||
import deluge, deluge.delugegtk
|
import deluge, deluge.delugegtk
|
||||||
|
import gettext
|
||||||
|
gettext.install(gettext_name)
|
||||||
|
print _('message')
|
||||||
|
|
||||||
interface = deluge.delugegtk.DelugeGTK()
|
interface = deluge.delugegtk.DelugeGTK()
|
||||||
for arg in args:
|
for arg in args:
|
||||||
apath = os.path.abspath(arg)
|
apath = os.path.abspath(arg)
|
||||||
|
@ -30,8 +30,6 @@ import dbus, dbus.service
|
|||||||
if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
|
if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
|
||||||
import dbus.glib
|
import dbus.glib
|
||||||
|
|
||||||
_ = gettext.gettext
|
|
||||||
|
|
||||||
class DelugeGTK(dbus.service.Object):
|
class DelugeGTK(dbus.service.Object):
|
||||||
## external_add_torrent should only be called from outside the class
|
## external_add_torrent should only be called from outside the class
|
||||||
@dbus.service.method('org.deluge_torrent.DelugeInterface')
|
@dbus.service.method('org.deluge_torrent.DelugeInterface')
|
||||||
@ -77,8 +75,9 @@ class DelugeGTK(dbus.service.Object):
|
|||||||
self.window = self.wtree.get_widget("main_window")
|
self.window = self.wtree.get_widget("main_window")
|
||||||
self.window.hide()
|
self.window.hide()
|
||||||
self.toolbar = self.wtree.get_widget("tb_middle")
|
self.toolbar = self.wtree.get_widget("tb_middle")
|
||||||
if(self.window):
|
self.window.drag_dest_set(gtk.DEST_DEFAULT_ALL,[('text/uri-list', 0, 80)], gtk.gdk.ACTION_COPY)
|
||||||
self.window.connect("destroy", self.close_clicked)
|
self.window.connect("destroy", self.close_clicked)
|
||||||
|
self.window.connect("drag_data_received", self.on_drag_data)
|
||||||
self.window.set_title('%s %s'%(dcommon.PROGRAM_NAME, dcommon.PROGRAM_VERSION))
|
self.window.set_title('%s %s'%(dcommon.PROGRAM_NAME, dcommon.PROGRAM_VERSION))
|
||||||
self.window.set_icon_from_file(dcommon.get_pixmap("deluge32.png"))
|
self.window.set_icon_from_file(dcommon.get_pixmap("deluge32.png"))
|
||||||
|
|
||||||
@ -596,6 +595,20 @@ class DelugeGTK(dbus.service.Object):
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def on_drag_data(self, widget, drag_context, x, y, selection_data, info, timestamp):
|
||||||
|
uri_split = selection_data.data.strip().split()
|
||||||
|
for uri in uri_split:
|
||||||
|
path = urllib.url2pathname(uri).strip('\r\n\x00')
|
||||||
|
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'):
|
||||||
|
self.interactive_add_torrent(path)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def interactive_add_torrent(self, torrent):
|
def interactive_add_torrent(self, torrent):
|
||||||
if self.pref.get('use_default_dir', bool):
|
if self.pref.get('use_default_dir', bool):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user