diff --git a/deluge/ui/gtkui/glade/preferences_dialog.glade b/deluge/ui/gtkui/glade/preferences_dialog.glade
index d4cdc61..76c71ce 100644
a
|
b
|
Disabled</property>
|
2069 | 2069 | </packing> |
2070 | 2070 | </child> |
2071 | 2071 | <child> |
| 2072 | <widget class="GtkAlignment" id="alignment32"> |
| 2073 | <property name="visible">True</property> |
| 2074 | <property name="left_padding">10</property> |
| 2075 | <child> |
| 2076 | <widget class="GtkCheckButton" id="chk_enable_appindicator"> |
| 2077 | <property name="label" translatable="yes">Enable Application Indicator</property> |
| 2078 | <property name="visible">True</property> |
| 2079 | <property name="sensitive">False</property> |
| 2080 | <property name="can_focus">False</property> |
| 2081 | <property name="receives_default">False</property> |
| 2082 | <property name="use_underline">True</property> |
| 2083 | <property name="draw_indicator">True</property> |
| 2084 | </widget> |
| 2085 | </child> |
| 2086 | </widget> |
| 2087 | <packing> |
| 2088 | <property name="position">3</property> |
| 2089 | </packing> |
| 2090 | </child> |
| 2091 | <child> |
2072 | 2092 | <widget class="GtkAlignment" id="alignment17"> |
2073 | 2093 | <property name="visible">True</property> |
2074 | 2094 | <property name="bottom_padding">3</property> |
… |
… |
Disabled</property>
|
2088 | 2108 | </widget> |
2089 | 2109 | <packing> |
2090 | 2110 | <property name="expand">False</property> |
2091 | | <property name="position">3</property> |
| 2111 | <property name="position">4</property> |
2092 | 2112 | </packing> |
2093 | 2113 | </child> |
2094 | 2114 | <child> |
… |
… |
Disabled</property>
|
2131 | 2151 | </child> |
2132 | 2152 | </widget> |
2133 | 2153 | <packing> |
2134 | | <property name="position">4</property> |
| 2154 | <property name="position">5</property> |
2135 | 2155 | </packing> |
2136 | 2156 | </child> |
2137 | 2157 | </widget> |
diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py
index 1609a28..1efbda3 100644
a
|
b
|
def start():
|
116 | 116 | "enable_system_tray": True, |
117 | 117 | "close_to_tray": True, |
118 | 118 | "start_in_tray": False, |
| 119 | "enable_appindicator": False, |
119 | 120 | "lock_tray": False, |
120 | 121 | "tray_password": "", |
121 | 122 | "check_new_releases": True, |
diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py
index edc253e..a13937a 100644
a
|
b
|
def _show(self):
|
471 | 471 | self.gtkui_config["close_to_tray"]) |
472 | 472 | self.glade.get_widget("chk_start_in_tray").set_active( |
473 | 473 | self.gtkui_config["start_in_tray"]) |
| 474 | self.glade.get_widget("chk_enable_appindicator").set_active( |
| 475 | self.gtkui_config["enable_appindicator"]) |
474 | 476 | self.glade.get_widget("chk_lock_tray").set_active( |
475 | 477 | self.gtkui_config["lock_tray"]) |
476 | 478 | self.glade.get_widget("chk_classic_mode").set_active( |
… |
… |
def set_config(self, hide=False):
|
637 | 639 | self.glade.get_widget("chk_min_on_close").get_active() |
638 | 640 | new_gtkui_config["start_in_tray"] = \ |
639 | 641 | self.glade.get_widget("chk_start_in_tray").get_active() |
| 642 | new_gtkui_config["enable_appindicator"] = \ |
| 643 | self.glade.get_widget("chk_enable_appindicator").get_active() |
640 | 644 | new_gtkui_config["lock_tray"] = \ |
641 | 645 | self.glade.get_widget("chk_lock_tray").get_active() |
642 | 646 | passhex = sha_hash(\ |
… |
… |
def on_toggle(self, widget):
|
782 | 786 | "spin_outgoing_port_max": False}, |
783 | 787 | "chk_use_tray": {"chk_min_on_close": True, |
784 | 788 | "chk_start_in_tray": True, |
| 789 | "chk_enable_appindicator": True, |
785 | 790 | "chk_lock_tray": True}, |
786 | 791 | "chk_lock_tray": {"txt_tray_password": True, |
787 | 792 | "password_label": True}, |
diff --git a/deluge/ui/gtkui/systemtray.py b/deluge/ui/gtkui/systemtray.py
index c4bce49..b465c54 100644
a
|
b
|
def __init__(self):
|
70 | 70 | ] |
71 | 71 | self.config.register_set_function("enable_system_tray", |
72 | 72 | self.on_enable_system_tray_set) |
| 73 | # bit of a hack to prevent function from doing something on startup |
| 74 | self.__enabled_set_once = False |
| 75 | self.config.register_set_function("enable_appindicator", |
| 76 | self.on_enable_appindicator_set) |
73 | 77 | |
74 | 78 | self.max_download_speed = -1.0 |
75 | 79 | self.download_rate = 0.0 |
… |
… |
def enable(self):
|
103 | 107 | |
104 | 108 | self.tray_menu = self.tray_glade.get_widget("tray_menu") |
105 | 109 | |
106 | | if appindicator: |
| 110 | if appindicator and self.config["enable_appindicator"]: |
107 | 111 | log.debug("Enabling the Application Indicator..") |
108 | 112 | self.indicator = appindicator.Indicator ( |
109 | 113 | "deluge", "deluge", appindicator.CATEGORY_APPLICATION_STATUS) |
… |
… |
def __start(self):
|
162 | 166 | |
163 | 167 | # These do not work with appindicator currently and can crash Deluge. |
164 | 168 | # Related to Launchpad bug #608219 |
165 | | if appindicator: |
| 169 | if appindicator and self.config["enable_appindicator"]: |
166 | 170 | self.hide_widget_list.remove("menuitem_download_limit") |
167 | 171 | self.hide_widget_list.remove("menuitem_upload_limit") |
168 | 172 | self.hide_widget_list.remove("separatormenuitem3") |
… |
… |
def stop(self):
|
200 | 204 | |
201 | 205 | def shutdown(self): |
202 | 206 | if self.config["enable_system_tray"]: |
203 | | if appindicator: |
| 207 | if appindicator and self.config["enable_appindicator"]: |
204 | 208 | self.indicator.set_status(appindicator.STATUS_PASSIVE) |
205 | 209 | else: |
206 | 210 | self.tray.set_visible(False) |
… |
… |
def update(self):
|
236 | 240 | return |
237 | 241 | |
238 | 242 | # Tool tip text not available for appindicator |
239 | | if appindicator: |
| 243 | if appindicator and self.config["enable_appindicator"]: |
240 | 244 | return |
241 | 245 | |
242 | 246 | # Set the tool tip text |
… |
… |
def build_tray_bwsetsubmenu(self):
|
285 | 289 | submenu_bwupset.show_all() |
286 | 290 | |
287 | 291 | # Re-set the menu to partly work around Launchpad bug #608219 |
288 | | if appindicator: |
| 292 | if appindicator and self.config["enable_appindicator"]: |
289 | 293 | self.indicator.set_menu(self.tray_menu) |
290 | 294 | |
291 | | def disable(self): |
| 295 | def disable(self,invert_app_ind_conf=False): |
292 | 296 | """Disables the system tray icon or appindicator.""" |
293 | 297 | try: |
294 | | if appindicator: |
| 298 | if invert_app_ind_conf: |
| 299 | app_ind_conf = not self.config["enable_appindicator"] |
| 300 | else: |
| 301 | app_ind_conf = self.config["enable_appindicator"] |
| 302 | if appindicator and app_ind_conf: |
295 | 303 | if hasattr(self, "_sig_win_hide"): |
296 | 304 | self.window.window.disconnect(self._sig_win_hide) |
297 | 305 | self.window.window.disconnect(self._sig_win_show) |
… |
… |
def on_enable_system_tray_set(self, key, value):
|
323 | 331 | else: |
324 | 332 | self.disable() |
325 | 333 | |
| 334 | def on_enable_appindicator_set(self, key, value): |
| 335 | """Called whenever the 'enable_appindicator' config key is modified""" |
| 336 | if self.__enabled_set_once: |
| 337 | self.disable(True) |
| 338 | self.enable() |
| 339 | self.__enabled_set_once = True |
| 340 | |
326 | 341 | def on_tray_clicked(self, icon): |
327 | 342 | """Called when the tray icon is left clicked.""" |
328 | 343 | self.blink(False) |