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,6 +107,7 @@ class CustomNotifications(object):
|
||||||
client.register_event_handler(eventtype, wrapper)
|
client.register_event_handler(eventtype, wrapper)
|
||||||
|
|
||||||
def _deregister_custom_provider(self, kind, eventtype):
|
def _deregister_custom_provider(self, kind, eventtype):
|
||||||
|
try:
|
||||||
wrapper, handler = self.custom_notifications[kind][eventtype]
|
wrapper, handler = self.custom_notifications[kind][eventtype]
|
||||||
try:
|
try:
|
||||||
component.get("EventManager").deregister_event_handler(
|
component.get("EventManager").deregister_event_handler(
|
||||||
|
@ -116,6 +117,8 @@ class CustomNotifications(object):
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
client.deregister_event_handler(eventtype, wrapper)
|
client.deregister_event_handler(eventtype, wrapper)
|
||||||
self.custom_notifications[kind].pop(eventtype)
|
self.custom_notifications[kind].pop(eventtype)
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
def _handled_eventtype(self, eventtype, handler):
|
def _handled_eventtype(self, eventtype, handler):
|
||||||
if eventtype not in known_events:
|
if eventtype not in known_events:
|
||||||
|
|
|
@ -454,7 +454,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label10">
|
<widget class="GtkLabel" id="settings_page_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">Settings</property>
|
<property name="label" translatable="yes">Settings</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -507,7 +507,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label11">
|
<widget class="GtkLabel" id="subscriptions_page_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">Subscriptions</property>
|
<property name="label" translatable="yes">Subscriptions</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -518,7 +518,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox6">
|
<widget class="GtkVBox" id="sounds_page">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
|
@ -588,7 +588,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label13">
|
<widget class="GtkLabel" id="sounds_page_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">Sound Customization</property>
|
<property name="label" translatable="yes">Sound Customization</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -295,9 +295,17 @@ class GtkUI(GtkPluginBase, GtkUiNotifications):
|
||||||
self.glade.get_widget("popup_enabled").set_property('sensitive',
|
self.glade.get_widget("popup_enabled").set_property('sensitive',
|
||||||
False)
|
False)
|
||||||
if not SOUND_AVAILABLE:
|
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',
|
self.glade.get_widget("sound_enabled").set_property('sensitive',
|
||||||
False)
|
False)
|
||||||
self.glade.get_widget('sound_path').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")
|
self.systray = component.get("SystemTray")
|
||||||
if not hasattr(self.systray, 'tray'):
|
if not hasattr(self.systray, 'tray'):
|
||||||
|
@ -654,23 +662,29 @@ class GtkUI(GtkPluginBase, GtkUiNotifications):
|
||||||
log.debug("dialog should have been shown")
|
log.debug("dialog should have been shown")
|
||||||
|
|
||||||
def on_enabled_toggled(self, widget):
|
def on_enabled_toggled(self, widget):
|
||||||
if widget.get_active():
|
for widget_name in ('smtp_host', 'smtp_port', 'smtp_user', 'smtp_pass',
|
||||||
for widget in ('smtp_host', 'smtp_port', 'smtp_user', 'smtp_pass',
|
|
||||||
'smtp_pass', 'smtp_tls', 'smtp_from',
|
'smtp_pass', 'smtp_tls', 'smtp_from',
|
||||||
'smtp_recipients'):
|
'smtp_recipients'):
|
||||||
self.glade.get_widget(widget).set_property('sensitive', True)
|
self.glade.get_widget(widget_name).set_property('sensitive',
|
||||||
else:
|
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', False)
|
|
||||||
|
|
||||||
|
|
||||||
def on_sound_enabled_toggled(self, widget):
|
def on_sound_enabled_toggled(self, widget):
|
||||||
if widget.get_active():
|
if widget.get_active():
|
||||||
self.glade.get_widget('sound_path').set_property('sensitive', True)
|
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:
|
else:
|
||||||
self.glade.get_widget('sound_path').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)
|
||||||
|
|
||||||
|
# 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):
|
def _on_email_col_toggled(self, cell, path):
|
||||||
self.subscriptions_model[path][SUB_NOT_EMAIL] = \
|
self.subscriptions_model[path][SUB_NOT_EMAIL] = \
|
||||||
|
|
Loading…
Reference in New Issue