Add button to Other preferences to associate magnet links with Deluge

This commit is contained in:
Andrew Resch 2009-11-30 03:50:28 +00:00
parent f9c61bbc11
commit 57c96477c1
5 changed files with 142 additions and 26 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

View File

@ -228,3 +228,35 @@ def get_deluge_icon():
return icon_theme.load_icon("deluge", 64, 0) return icon_theme.load_icon("deluge", 64, 0)
except: except:
return get_logo(64) return get_logo(64)
def associate_magnet_links(overwrite=False):
"""
Associates magnet links to Deluge.
:param overwrite: if this is True, the current setting will be overwritten
:type overwrite: bool
:returns: True if association was set
:rtype: bool
"""
if not deluge.common.windows_check():
# gconf method is only available in a GNOME environment
try:
import gconf
except ImportError:
log.debug("gconf not available, so will not attempt to register magnet uri handler")
return False
else:
key = "/desktop/gnome/url-handlers/magnet/command"
gconf_client = gconf.client_get_default()
if (gconf_client.get(key) and overwrite) or not gconf_client.get(key):
# We are either going to overwrite the key, or do it if it hasn't been set yet
if gconf_client.set_string(key, "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!")
return True
else:
log.error("Unable to register Deluge as default magnet uri handler.")
return False
return False

View File

@ -17,6 +17,7 @@
<widget class="GtkVBox" id="dialog-vbox1"> <widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property> <property name="spacing">2</property>
<child> <child>
<widget class="GtkHPaned" id="hpaned1"> <widget class="GtkHPaned" id="hpaned1">
@ -65,6 +66,7 @@
<widget class="GtkVBox" id="vbox1"> <widget class="GtkVBox" id="vbox1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkLabel" id="label21"> <widget class="GtkLabel" id="label21">
<property name="visible">True</property> <property name="visible">True</property>
@ -498,6 +500,7 @@
<widget class="GtkVBox" id="vbox2"> <widget class="GtkVBox" id="vbox2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkLabel" id="label22"> <widget class="GtkLabel" id="label22">
<property name="visible">True</property> <property name="visible">True</property>
@ -537,6 +540,7 @@
<child> <child>
<widget class="GtkVBox" id="vbox3"> <widget class="GtkVBox" id="vbox3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkHBox" id="hbox2"> <widget class="GtkHBox" id="hbox2">
<property name="visible">True</property> <property name="visible">True</property>
@ -734,6 +738,7 @@
<child> <child>
<widget class="GtkVBox" id="vbox25"> <widget class="GtkVBox" id="vbox25">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child> <child>
<widget class="GtkCheckButton" id="chk_random_outgoing_ports"> <widget class="GtkCheckButton" id="chk_random_outgoing_ports">
@ -905,6 +910,7 @@
<child> <child>
<widget class="GtkVBox" id="vbox4"> <widget class="GtkVBox" id="vbox4">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkHBox" id="hbox4"> <widget class="GtkHBox" id="hbox4">
<property name="visible">True</property> <property name="visible">True</property>
@ -1104,6 +1110,7 @@
<widget class="GtkVBox" id="vbox10"> <widget class="GtkVBox" id="vbox10">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkLabel" id="label7"> <widget class="GtkLabel" id="label7">
<property name="visible">True</property> <property name="visible">True</property>
@ -1135,6 +1142,7 @@
<widget class="GtkVBox" id="vbox12"> <widget class="GtkVBox" id="vbox12">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkComboBox" id="combo_encin"> <widget class="GtkComboBox" id="combo_encin">
<property name="visible">True</property> <property name="visible">True</property>
@ -1168,6 +1176,7 @@ Either</property>
<widget class="GtkVBox" id="vbox15"> <widget class="GtkVBox" id="vbox15">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkHBox" id="hbox15"> <widget class="GtkHBox" id="hbox15">
<property name="visible">True</property> <property name="visible">True</property>
@ -1281,6 +1290,7 @@ Disabled</property>
<widget class="GtkVBox" id="vbox7"> <widget class="GtkVBox" id="vbox7">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkLabel" id="label23"> <widget class="GtkLabel" id="label23">
<property name="visible">True</property> <property name="visible">True</property>
@ -1320,6 +1330,7 @@ Disabled</property>
<child> <child>
<widget class="GtkVBox" id="vbox21"> <widget class="GtkVBox" id="vbox21">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child> <child>
<widget class="GtkTable" id="table1"> <widget class="GtkTable" id="table1">
@ -1778,6 +1789,7 @@ Disabled</property>
<widget class="GtkVBox" id="vbox8"> <widget class="GtkVBox" id="vbox8">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkLabel" id="label25"> <widget class="GtkLabel" id="label25">
<property name="visible">True</property> <property name="visible">True</property>
@ -1863,6 +1875,7 @@ Disabled</property>
<widget class="GtkVBox" id="vbox27"> <widget class="GtkVBox" id="vbox27">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkCheckButton" id="chk_show_rate_in_title"> <widget class="GtkCheckButton" id="chk_show_rate_in_title">
<property name="label" translatable="yes">Show session speed in titlebar</property> <property name="label" translatable="yes">Show session speed in titlebar</property>
@ -1913,6 +1926,7 @@ Disabled</property>
<widget class="GtkVBox" id="vbox5"> <widget class="GtkVBox" id="vbox5">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkCheckButton" id="chk_show_dialog"> <widget class="GtkCheckButton" id="chk_show_dialog">
<property name="label" translatable="yes">Always show</property> <property name="label" translatable="yes">Always show</property>
@ -1982,6 +1996,7 @@ Disabled</property>
<child> <child>
<widget class="GtkVBox" id="vbox17"> <widget class="GtkVBox" id="vbox17">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkCheckButton" id="chk_use_tray"> <widget class="GtkCheckButton" id="chk_use_tray">
<property name="label" translatable="yes">Enable system tray icon</property> <property name="label" translatable="yes">Enable system tray icon</property>
@ -2160,6 +2175,7 @@ Disabled</property>
<widget class="GtkVBox" id="vbox16"> <widget class="GtkVBox" id="vbox16">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkLabel" id="label40"> <widget class="GtkLabel" id="label40">
<property name="visible">True</property> <property name="visible">True</property>
@ -2201,6 +2217,7 @@ Disabled</property>
<widget class="GtkVBox" id="vbox18"> <widget class="GtkVBox" id="vbox18">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkAlignment" id="alignment36"> <widget class="GtkAlignment" id="alignment36">
<property name="visible">True</property> <property name="visible">True</property>
@ -2262,6 +2279,7 @@ Disabled</property>
<widget class="GtkVBox" id="vbox19"> <widget class="GtkVBox" id="vbox19">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkLabel" id="label44"> <widget class="GtkLabel" id="label44">
<property name="visible">True</property> <property name="visible">True</property>
@ -2337,6 +2355,7 @@ Disabled</property>
<widget class="GtkVBox" id="vbox29"> <widget class="GtkVBox" id="vbox29">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkAlignment" id="alignment50"> <widget class="GtkAlignment" id="alignment50">
<property name="visible">True</property> <property name="visible">True</property>
@ -2399,6 +2418,60 @@ Disabled</property>
<property name="position">4</property> <property name="position">4</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkAlignment" id="alignment31">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox4">
<property name="visible">True</property>
<property name="layout_style">start</property>
<child>
<widget class="GtkButton" id="button_associate_magnet">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_button_associate_magnet_clicked"/>
<child>
<widget class="GtkHBox" id="hbox16">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image_magnet">
<property name="visible">True</property>
<property name="stock">gtk-missing-image</property>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label60">
<property name="visible">True</property>
<property name="label" translatable="yes">Associate Magnet links with Deluge</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">5</property>
</packing>
</child>
</widget> </widget>
</child> </child>
</widget> </widget>
@ -2436,6 +2509,7 @@ Disabled</property>
<widget class="GtkVBox" id="vbox13"> <widget class="GtkVBox" id="vbox13">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkLabel" id="label34"> <widget class="GtkLabel" id="label34">
<property name="visible">True</property> <property name="visible">True</property>
@ -2477,6 +2551,7 @@ Disabled</property>
<widget class="GtkVBox" id="vbox14"> <widget class="GtkVBox" id="vbox14">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkHBox" id="hbox12"> <widget class="GtkHBox" id="hbox12">
<property name="visible">True</property> <property name="visible">True</property>
@ -2661,6 +2736,7 @@ Disabled</property>
<widget class="GtkVBox" id="vbox9"> <widget class="GtkVBox" id="vbox9">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkLabel" id="label46"> <widget class="GtkLabel" id="label46">
<property name="visible">True</property> <property name="visible">True</property>
@ -2690,6 +2766,7 @@ Disabled</property>
<widget class="GtkVBox" id="queue_prefs_box2"> <widget class="GtkVBox" id="queue_prefs_box2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child> <child>
<widget class="GtkFrame" id="frame10"> <widget class="GtkFrame" id="frame10">
@ -2707,6 +2784,7 @@ Disabled</property>
<widget class="GtkVBox" id="vbox6"> <widget class="GtkVBox" id="vbox6">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkCheckButton" id="chk_queue_new_top"> <widget class="GtkCheckButton" id="chk_queue_new_top">
<property name="label" translatable="yes">Queue new torrents to top</property> <property name="label" translatable="yes">Queue new torrents to top</property>
@ -2757,6 +2835,7 @@ Disabled</property>
<child> <child>
<widget class="GtkVBox" id="vbox20"> <widget class="GtkVBox" id="vbox20">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child> <child>
<widget class="GtkTable" id="table3"> <widget class="GtkTable" id="table3">
@ -2908,6 +2987,7 @@ Disabled</property>
<widget class="GtkVBox" id="vbox11"> <widget class="GtkVBox" id="vbox11">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property> <property name="spacing">2</property>
<child> <child>
<widget class="GtkTable" id="table2"> <widget class="GtkTable" id="table2">
@ -3133,6 +3213,7 @@ Disabled</property>
<widget class="GtkVBox" id="vbox22"> <widget class="GtkVBox" id="vbox22">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkLabel" id="label83"> <widget class="GtkLabel" id="label83">
<property name="visible">True</property> <property name="visible">True</property>
@ -3160,6 +3241,7 @@ Disabled</property>
<child> <child>
<widget class="GtkVBox" id="vbox26"> <widget class="GtkVBox" id="vbox26">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child> <child>
<widget class="GtkFrame" id="frame23"> <widget class="GtkFrame" id="frame23">
@ -3936,6 +4018,7 @@ HTTP W/ Auth</property>
<child> <child>
<widget class="GtkVBox" id="vbox30"> <widget class="GtkVBox" id="vbox30">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkLabel" id="label111"> <widget class="GtkLabel" id="label111">
<property name="visible">True</property> <property name="visible">True</property>
@ -3967,6 +4050,7 @@ HTTP W/ Auth</property>
<child> <child>
<widget class="GtkVBox" id="vbox31"> <widget class="GtkVBox" id="vbox31">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkFrame" id="frame32"> <widget class="GtkFrame" id="frame32">
<property name="visible">True</property> <property name="visible">True</property>
@ -4076,6 +4160,7 @@ HTTP W/ Auth</property>
<child> <child>
<widget class="GtkVBox" id="vbox32"> <widget class="GtkVBox" id="vbox32">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkFrame" id="frame34"> <widget class="GtkFrame" id="frame34">
<property name="visible">True</property> <property name="visible">True</property>
@ -4467,15 +4552,6 @@ HTTP W/ Auth</property>
<property name="type">tab</property> <property name="type">tab</property>
</packing> </packing>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
<packing>
<property name="type">tab</property>
</packing>
</child>
<child> <child>
<widget class="GtkScrolledWindow" id="scrolledwindow5"> <widget class="GtkScrolledWindow" id="scrolledwindow5">
<property name="visible">True</property> <property name="visible">True</property>
@ -4493,6 +4569,7 @@ HTTP W/ Auth</property>
<widget class="GtkVBox" id="vbox28"> <widget class="GtkVBox" id="vbox28">
<property name="visible">True</property> <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkLabel" id="label51"> <widget class="GtkLabel" id="label51">
<property name="visible">True</property> <property name="visible">True</property>
@ -4523,6 +4600,7 @@ HTTP W/ Auth</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child> <child>
<widget class="GtkScrolledWindow" id="scrolledwindow12"> <widget class="GtkScrolledWindow" id="scrolledwindow12">
<property name="visible">True</property> <property name="visible">True</property>
@ -4881,7 +4959,7 @@ HTTP W/ Auth</property>
</child> </child>
</widget> </widget>
<packing> <packing>
<property name="position">10</property> <property name="position">9</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -4890,6 +4968,15 @@ HTTP W/ Auth</property>
<property name="type">tab</property> <property name="type">tab</property>
</packing> </packing>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
<packing>
<property name="type">tab</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="resize">True</property> <property name="resize">True</property>

View File

@ -81,6 +81,7 @@ from deluge.ui.tracker_icons import TrackerIcons
from queuedtorrents import QueuedTorrents from queuedtorrents import QueuedTorrents
from addtorrentdialog import AddTorrentDialog from addtorrentdialog import AddTorrentDialog
import dialogs import dialogs
import common
import deluge.configmanager import deluge.configmanager
import deluge.common import deluge.common
@ -180,21 +181,9 @@ class GtkUI(object):
return 1 return 1
SetConsoleCtrlHandler(win_handler) SetConsoleCtrlHandler(win_handler)
# Attempt to register a magnet URI handler with gconf # Attempt to register a magnet URI handler with gconf, but do not overwrite
try: # if already set by another program.
import gconf common.associate_magnet_links(False)
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, "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 # Make sure gtkui.conf has at least the defaults set
self.config = deluge.configmanager.ConfigManager("gtkui.conf", DEFAULT_PREFS) self.config = deluge.configmanager.ConfigManager("gtkui.conf", DEFAULT_PREFS)

View File

@ -60,6 +60,10 @@ class Preferences(component.Component):
self.treeview = self.glade.get_widget("treeview") self.treeview = self.glade.get_widget("treeview")
self.notebook = self.glade.get_widget("notebook") self.notebook = self.glade.get_widget("notebook")
self.gtkui_config = ConfigManager("gtkui.conf") self.gtkui_config = ConfigManager("gtkui.conf")
self.glade.get_widget("image_magnet").set_from_file(
deluge.common.get_pixmap("magnet.png"))
# Setup the liststore for the categories (tab pages) # Setup the liststore for the categories (tab pages)
self.liststore = gtk.ListStore(int, str) self.liststore = gtk.ListStore(int, str)
self.treeview.set_model(self.liststore) self.treeview.set_model(self.liststore)
@ -105,7 +109,8 @@ class Preferences(component.Component):
"on_button_rescan_plugins_clicked": self._on_button_rescan_plugins_clicked, "on_button_rescan_plugins_clicked": self._on_button_rescan_plugins_clicked,
"on_button_find_plugins_clicked": self._on_button_find_plugins_clicked, "on_button_find_plugins_clicked": self._on_button_find_plugins_clicked,
"on_button_cache_refresh_clicked": self._on_button_cache_refresh_clicked, "on_button_cache_refresh_clicked": self._on_button_cache_refresh_clicked,
"on_combo_proxy_type_changed": self._on_combo_proxy_type_changed "on_combo_proxy_type_changed": self._on_combo_proxy_type_changed,
"on_button_associate_magnet_clicked": self._on_button_associate_magnet_clicked
}) })
# These get updated by requests done to the core # These get updated by requests done to the core
@ -927,3 +932,6 @@ class Preferences(component.Component):
w = self.glade.get_widget(p + s + "_" + name) w = self.glade.get_widget(p + s + "_" + name)
if w: if w:
w.show() w.show()
def _on_button_associate_magnet_clicked(self, widget):
common.associate_magnet_links(True)