Don't throw errors when de-registering notifications.
If sound notifications is not possible or disabled, also disable the sound customization notebook page.
This commit is contained in:
parent
7812f7b4e4
commit
1cb42252b8
|
@ -107,15 +107,18 @@ class CustomNotifications(object):
|
|||
client.register_event_handler(eventtype, wrapper)
|
||||
|
||||
def _deregister_custom_provider(self, kind, eventtype):
|
||||
wrapper, handler = self.custom_notifications[kind][eventtype]
|
||||
try:
|
||||
component.get("EventManager").deregister_event_handler(
|
||||
eventtype, wrapper
|
||||
)
|
||||
wrapper, handler = self.custom_notifications[kind][eventtype]
|
||||
try:
|
||||
component.get("EventManager").deregister_event_handler(
|
||||
eventtype, wrapper
|
||||
)
|
||||
except KeyError:
|
||||
from deluge.ui.client import client
|
||||
client.deregister_event_handler(eventtype, wrapper)
|
||||
self.custom_notifications[kind].pop(eventtype)
|
||||
except KeyError:
|
||||
from deluge.ui.client import client
|
||||
client.deregister_event_handler(eventtype, wrapper)
|
||||
self.custom_notifications[kind].pop(eventtype)
|
||||
pass
|
||||
|
||||
def _handled_eventtype(self, eventtype, handler):
|
||||
if eventtype not in known_events:
|
||||
|
|
|
@ -454,7 +454,7 @@
|
|||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label10">
|
||||
<widget class="GtkLabel" id="settings_page_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Settings</property>
|
||||
</widget>
|
||||
|
@ -507,7 +507,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label11">
|
||||
<widget class="GtkLabel" id="subscriptions_page_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Subscriptions</property>
|
||||
</widget>
|
||||
|
@ -518,7 +518,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox6">
|
||||
<widget class="GtkVBox" id="sounds_page">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
|
@ -588,7 +588,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label13">
|
||||
<widget class="GtkLabel" id="sounds_page_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Sound Customization</property>
|
||||
</widget>
|
||||
|
|
|
@ -295,9 +295,17 @@ class GtkUI(GtkPluginBase, GtkUiNotifications):
|
|||
self.glade.get_widget("popup_enabled").set_property('sensitive',
|
||||
False)
|
||||
if not SOUND_AVAILABLE:
|
||||
# for widget_name in ('sound_enabled', 'sound_path', 'sounds_page',
|
||||
# 'sounds_page_label'):
|
||||
# self.glade.get_widget(widget_name).set_property('sensitive',
|
||||
# False)
|
||||
self.glade.get_widget("sound_enabled").set_property('sensitive',
|
||||
False)
|
||||
self.glade.get_widget('sound_path').set_property('sensitive', False)
|
||||
self.glade.get_widget('sounds_page').set_property('sensitive',
|
||||
False)
|
||||
self.glade.get_widget('sounds_page_label').set_property('sensitive',
|
||||
False)
|
||||
|
||||
self.systray = component.get("SystemTray")
|
||||
if not hasattr(self.systray, 'tray'):
|
||||
|
@ -654,23 +662,29 @@ class GtkUI(GtkPluginBase, GtkUiNotifications):
|
|||
log.debug("dialog should have been shown")
|
||||
|
||||
def on_enabled_toggled(self, widget):
|
||||
if widget.get_active():
|
||||
for widget in ('smtp_host', 'smtp_port', 'smtp_user', 'smtp_pass',
|
||||
'smtp_pass', 'smtp_tls', 'smtp_from',
|
||||
'smtp_recipients'):
|
||||
self.glade.get_widget(widget).set_property('sensitive', True)
|
||||
else:
|
||||
for widget in ('smtp_host', 'smtp_port', 'smtp_user', 'smtp_pass',
|
||||
'smtp_pass', 'smtp_tls', 'smtp_from',
|
||||
'smtp_recipients'):
|
||||
self.glade.get_widget(widget).set_property('sensitive', False)
|
||||
|
||||
for widget_name in ('smtp_host', 'smtp_port', 'smtp_user', 'smtp_pass',
|
||||
'smtp_pass', 'smtp_tls', 'smtp_from',
|
||||
'smtp_recipients'):
|
||||
self.glade.get_widget(widget_name).set_property('sensitive',
|
||||
widget.get_active())
|
||||
|
||||
def on_sound_enabled_toggled(self, widget):
|
||||
if widget.get_active():
|
||||
self.glade.get_widget('sound_path').set_property('sensitive', True)
|
||||
self.glade.get_widget('sounds_page').set_property('sensitive',
|
||||
True)
|
||||
self.glade.get_widget('sounds_page_label').set_property('sensitive',
|
||||
True)
|
||||
else:
|
||||
self.glade.get_widget('sound_path').set_property('sensitive', False)
|
||||
self.glade.get_widget('sounds_page').set_property('sensitive',
|
||||
False)
|
||||
self.glade.get_widget('sounds_page_label').set_property('sensitive',
|
||||
False)
|
||||
|
||||
# for widget_name in ('sounds_path', 'sounds_page', 'sounds_page_label'):
|
||||
# self.glade.get_widget(widget_name).set_property('sensitive',
|
||||
# widget.get_active())
|
||||
|
||||
def _on_email_col_toggled(self, cell, path):
|
||||
self.subscriptions_model[path][SUB_NOT_EMAIL] = \
|
||||
|
|
Loading…
Reference in New Issue