[GTKUI] Convert the appindicator option into a radio button

This commit is contained in:
Calum Lind 2013-05-15 15:10:08 +01:00
parent 849101950f
commit 5c82c144cf
2 changed files with 88 additions and 55 deletions

View File

@ -431,7 +431,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="padding">3</property>
<property name="position">0</property>
</packing>
</child>
@ -763,7 +763,7 @@ and daemon (does not apply in Standalone mode).</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="padding">3</property>
<property name="position">1</property>
</packing>
</child>
@ -839,7 +839,7 @@ and daemon (does not apply in Standalone mode).</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="padding">3</property>
<property name="position">2</property>
</packing>
</child>
@ -878,7 +878,56 @@ and daemon (does not apply in Standalone mode).</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment15">
<object class="GtkAlignment" id="alignment_tray_type">
<property name="can_focus">False</property>
<child>
<object class="GtkHBox" id="hbox_tray_type">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkRadioButton" id="radio_appind">
<property name="label" translatable="yes">App Indicator</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">radio_systray</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radio_systray">
<property name="label" translatable="yes">Systray</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment_min_on_close">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">10</property>
@ -898,11 +947,11 @@ and daemon (does not apply in Standalone mode).</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment16">
<object class="GtkAlignment" id="alignment_start_in_tray">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">10</property>
@ -919,30 +968,6 @@ and daemon (does not apply in Standalone mode).</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment32">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">10</property>
<child>
<object class="GtkCheckButton" id="chk_enable_appindicator">
<property name="label" translatable="yes">Enable Application Indicator</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
@ -950,7 +975,7 @@ and daemon (does not apply in Standalone mode).</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment17">
<object class="GtkAlignment" id="alignment_lock_tray">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="bottom_padding">3</property>
@ -976,12 +1001,12 @@ and daemon (does not apply in Standalone mode).</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment10">
<object class="GtkAlignment" id="alignment_tray_password">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">20</property>
<child>
<object class="GtkHBox" id="hbox9">
<object class="GtkHBox" id="hbox_tray_password">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
@ -1046,7 +1071,7 @@ and daemon (does not apply in Standalone mode).</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="padding">3</property>
<property name="position">3</property>
</packing>
</child>
@ -1699,18 +1724,6 @@ used sparingly.</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="label22">
<property name="visible">True</property>
@ -1743,6 +1756,18 @@ used sparingly.</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
@ -1982,12 +2007,6 @@ used sparingly.</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="label12">
<property name="visible">True</property>
@ -2020,6 +2039,12 @@ used sparingly.</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>

View File

@ -188,6 +188,14 @@ class Preferences(component.Component):
"on_checkbutton_language_toggled": self._on_checkbutton_language_toggled,
})
if not deluge.common.osx_check() and not deluge.common.windows_check():
try:
import appindicator
except ImportError:
pass
else:
self.builder.get_object("alignment_tray_type").set_visible(True)
from deluge.ui.gtkui.gtkui import DEFAULT_PREFS
self.COLOR_DEFAULTS = {}
for key in ("missing", "waiting", "downloading", "completed"):
@ -489,7 +497,7 @@ class Preferences(component.Component):
self.gtkui_config["close_to_tray"])
self.builder.get_object("chk_start_in_tray").set_active(
self.gtkui_config["start_in_tray"])
self.builder.get_object("chk_enable_appindicator").set_active(
self.builder.get_object("radio_appind").set_active(
self.gtkui_config["enable_appindicator"])
self.builder.get_object("chk_lock_tray").set_active(
self.gtkui_config["lock_tray"])
@ -654,7 +662,7 @@ class Preferences(component.Component):
new_gtkui_config["start_in_tray"] = \
self.builder.get_object("chk_start_in_tray").get_active()
new_gtkui_config["enable_appindicator"] = \
self.builder.get_object("chk_enable_appindicator").get_active()
self.builder.get_object("radio_appind").get_active()
new_gtkui_config["lock_tray"] = \
self.builder.get_object("chk_lock_tray").get_active()
passhex = sha(self.builder.get_object("txt_tray_password").get_text()).hexdigest()
@ -863,7 +871,7 @@ class Preferences(component.Component):
"spin_outgoing_port_max": False},
"chk_use_tray": {"chk_min_on_close": True,
"chk_start_in_tray": True,
"chk_enable_appindicator": True,
"alignment_tray_type": True,
"chk_lock_tray": True},
"chk_lock_tray": {"txt_tray_password": True,
"password_label": True},