Author: andar
Revision: 5981
Log:
Attempt to register as the default magnet uri handler in GNOME on
startup
Diff:
Modified: branches/1.2_RC/ChangeLog
===================================================================
--- branches/1.2_RC/ChangeLog 2009-11-29 00:52:00 UTC (rev 5980)
+++ branches/1.2_RC/ChangeLog 2009-11-29 01:40:30 UTC (rev 5981)
@@ -1,7 +1,10 @@
-=== Deluge 1.2.0_rc5 (in development) ===
+=== Deluge 1.2.0_rc5 (In Development) ===
==== Web ====
* Swap order of buttons in Remove window (Closes #1083)
+==== GtkUI ====
+ * Attempt to register as the default magnet uri handler in GNOME on
startup
+
=== Deluge 1.2.0_rc4 (24 November 2009) ===
==== Core ====
* Fix deleting old .fastresume files with fresh configs
Modified: branches/1.2_RC/deluge/ui/gtkui/gtkui.py
===================================================================
--- branches/1.2_RC/deluge/ui/gtkui/gtkui.py 2009-11-29 00:52:00 UTC (rev
5980)
+++ branches/1.2_RC/deluge/ui/gtkui/gtkui.py 2009-11-29 01:40:30 UTC (rev
5981)
@@ -180,6 +180,22 @@
return 1
SetConsoleCtrlHandler(win_handler)
+ # Attempt to register a magnet URI handler with gconf
+ try:
+ import gconf
+ except ImportError:
+ log.debug("gconf not available, so will not attempt to register
magnet uri handler")
+ else:
+ key = "/desktop/gnome/url-handlers/magnet/command"
+ gconf_client = gconf.client_get_default()
+ if not gconf_client.get(key):
+ if gconf_client.set_string(key, "/usr/bin/deluge '%s'"):
+
gconf_client.set_bool("/desktop/gnome/url-handlers/magnet/needs_terminal",
False)
+
gconf_client.set_bool("/desktop/gnome/url-handlers/magnet/enabled", True)
+ log.info("Deluge registered as default magnet uri
handler!")
+ else:
+ log.error("Unable to register Deluge as default magnet uri
handler.")
+
# Make sure gtkui.conf has at least the defaults set
self.config = deluge.configmanager.ConfigManager("gtkui.conf",
DEFAULT_PREFS)
Modified: trunk/deluge/ui/gtkui/gtkui.py
===================================================================
--- trunk/deluge/ui/gtkui/gtkui.py 2009-11-29 00:52:00 UTC (rev 5980)
+++ trunk/deluge/ui/gtkui/gtkui.py 2009-11-29 01:40:30 UTC (rev 5981)
@@ -180,6 +180,22 @@
return 1
SetConsoleCtrlHandler(win_handler)
+ # Attempt to register a magnet URI handler with gconf
+ try:
+ import gconf
+ except ImportError:
+ log.debug("gconf not available, so will not attempt to register
magnet uri handler")
+ else:
+ key = "/desktop/gnome/url-handlers/magnet/command"
+ gconf_client = gconf.client_get_default()
+ if not gconf_client.get(key):
+ if gconf_client.set_string(key, "/usr/bin/deluge '%s'"):
+
gconf_client.set_bool("/desktop/gnome/url-handlers/magnet/needs_terminal",
False)
+
gconf_client.set_bool("/desktop/gnome/url-handlers/magnet/enabled", True)
+ log.info("Deluge registered as default magnet uri
handler!")
+ else:
+ log.error("Unable to register Deluge as default magnet uri
handler.")
+
# Make sure gtkui.conf has at least the defaults set
self.config = deluge.configmanager.ConfigManager("gtkui.conf",
DEFAULT_PREFS)
--
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en.