diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/data/config.glade b/deluge/plugins/Notifications/deluge/plugins/notifications/data/config.ui similarity index 69% rename from deluge/plugins/Notifications/deluge/plugins/notifications/data/config.glade rename to deluge/plugins/Notifications/deluge/plugins/notifications/data/config.ui index 9fe8d69f2..bbeeeda3a 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/data/config.glade +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/data/config.ui @@ -1,185 +1,230 @@ - - + + - + + 1 + 65535 + 25 + 1 + 10 + + + False - + True + False - + True + False queue - + True + False - + True + False - + True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 10 10 <b><i><big>Notifications</big></i></b> True - + False + True 0 - + True - + False + False + True 1 - + + True + True 0 - + True + False 0 2 2 2 - + True True - + True + False - + True + False 0 none - + True + False 12 - + True + False - + Tray icon blinks enabled True True False True - + + True + True 0 - + Popups enabled True True False True - + + True + True 1 - + True + False - + Sound enabled True True False True - - + + False + True 0 - + True + False False - - + + + True + True 2 1 - + + True + True 2 - + - + - - + + True + False 5 <b>UI Notifications</b> True - - - label_item - + - + + True + True 0 - + True + False 0 none - + True + False 12 - + True + False 7 4 2 2 - + + + + True + False Hostname: right - + 1 2 - + True True - + False + False + True + True + 1 2 @@ -188,11 +233,12 @@ - + True + False Port: right - + 2 3 @@ -201,15 +247,19 @@ - + True True 5 5 - 25 1 65535 1 10 0 + False + False + True + True + adjustment1 1 True - + 3 4 @@ -218,21 +268,26 @@ - + True + False Username: right - + 2 3 - + True True - + False + False + True + True + 1 4 @@ -241,21 +296,26 @@ - + True + False Password: - + 3 4 - + True True False - + False + False + True + True + 1 4 @@ -264,52 +324,58 @@ - + True + False 0 none - + True + False 12 - + True + False 2 - + True True automatic automatic in - + True True False horizontal - + - + + True + True 0 - + True + False 5 start - + gtk-add True True True True - - + + False False @@ -317,43 +383,42 @@ - + gtk-delete True False True True True - - + + False False 1 - + False + True 3 1 - + - + - - + + True + False <b>Recipients</b> True - - - label_item - + - + 4 6 @@ -361,18 +426,19 @@ - + True True False True - + True + False Server requires TLS/SSL - + - + 1 4 @@ -382,21 +448,26 @@ - + True + False From: right - + 4 5 - + True True - + False + False + True + True + 1 4 @@ -405,141 +476,147 @@ - + Enabled True True False True - - + + 4 - - - - + - + - - + + True + False 5 <b>Email Notifications</b> True - - - label_item - + - + + True + True 1 - + - - + + True + False Settings - + False - tab - + True + False - + True True automatic automatic - + True True horizontal - + - + + True + True 1 - + True + False This configuration does not mean that you'll actually receive notifications for all these events. fill True - + False + True 2 2 - + 1 - - + + True + False Subscriptions - + 1 False - tab - + True + False - + True True automatic automatic - + True True - + - + + True + True 0 - + True + False 10 end - + gtk-revert-to-saved True False True True True - - + + False False @@ -547,59 +624,64 @@ - + gtk-edit True False True True True - - + + False False 1 - + False + True 5 1 - + 2 - - + + True + False Sound Customization - + 2 False - tab - + - + + True + True 1 - + - + + True + True 0 - + - - + + diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py b/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py index 4426328ea..916b20a2a 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py @@ -18,7 +18,6 @@ import logging from os.path import basename import gtk -import gtk.glade from twisted.internet import defer import deluge.common @@ -238,9 +237,10 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): self.config = deluge.configmanager.ConfigManager( 'notifications-gtk.conf', DEFAULT_PREFS ) - self.glade = gtk.glade.XML(get_resource('config.glade')) - self.glade.get_widget('smtp_port').set_value(25) - self.prefs = self.glade.get_widget('prefs_box') + self.builder = gtk.Builder() + self.builder.add_from_file(get_resource('config.ui')) + self.builder.get_object('smtp_port').set_value(25) + self.prefs = self.builder.get_object('prefs_box') self.prefs.show_all() self.build_recipients_model_populate_treeview() @@ -251,7 +251,7 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): self.popuplate_what_needs_handled_events ) - self.glade.signal_autoconnect({ + self.builder.connect_signals({ 'on_add_button_clicked': (self.on_add_button_clicked, self.recipients_treeview), 'on_delete_button_clicked': (self.on_delete_button_clicked, @@ -276,24 +276,24 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): self.on_show_prefs) if not POPUP_AVAILABLE: - self.glade.get_widget('popup_enabled').set_property('sensitive', - False) + self.builder.get_object('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', + # self.builder.get_object(widget_name).set_property('sensitive', False) + self.builder.get_object('sound_enabled').set_property('sensitive', + False) + self.builder.get_object('sound_path').set_property('sensitive', False) + self.builder.get_object('sounds_page').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.builder.get_object('sounds_page_label').set_property('sensitive', + False) self.systray = component.get('SystemTray') if not hasattr(self.systray, 'tray'): # Tray is not beeing used - self.glade.get_widget('blink_enabled').set_property('sensitive', - False) + self.builder.get_object('blink_enabled').set_property('sensitive', + False) GtkUiNotifications.enable(self) @@ -307,7 +307,7 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): def build_recipients_model_populate_treeview(self): # SMTP Recipients treeview/model - self.recipients_treeview = self.glade.get_widget('smtp_recipients') + self.recipients_treeview = self.builder.get_object('smtp_recipients') treeview_selection = self.recipients_treeview.get_selection() treeview_selection.connect( 'changed', self.on_recipients_treeview_selection_changed @@ -326,7 +326,7 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): def build_sounds_model_populate_treeview(self): # Sound customisation treeview/model - self.sounds_treeview = self.glade.get_widget('sounds_treeview') + self.sounds_treeview = self.builder.get_object('sounds_treeview') sounds_selection = self.sounds_treeview.get_selection() sounds_selection.connect( 'changed', self.on_sounds_treeview_selection_changed @@ -362,7 +362,7 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): def build_notifications_model_populate_treeview(self): # Notification Subscriptions treeview/model - self.subscriptions_treeview = self.glade.get_widget('subscriptions_treeview') + self.subscriptions_treeview = self.builder.get_object('subscriptions_treeview') subscriptions_selection = self.subscriptions_treeview.get_selection() subscriptions_selection.connect( 'changed', self.on_subscriptions_treeview_selection_changed @@ -469,7 +469,7 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): current_sound_subscriptions.append(event) old_sound_file = self.config['sound_path'] - new_sound_file = self.glade.get_widget('sound_path').get_filename() + new_sound_file = self.builder.get_object('sound_path').get_filename() log.debug('Old Default sound file: %s New one: %s', old_sound_file, new_sound_file) custom_sounds = {} @@ -480,9 +480,9 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): custom_sounds[event_name] = filepath self.config.config.update({ - 'popup_enabled': self.glade.get_widget('popup_enabled').get_active(), - 'blink_enabled': self.glade.get_widget('blink_enabled').get_active(), - 'sound_enabled': self.glade.get_widget('sound_enabled').get_active(), + 'popup_enabled': self.builder.get_object('popup_enabled').get_active(), + 'blink_enabled': self.builder.get_object('blink_enabled').get_active(), + 'sound_enabled': self.builder.get_object('sound_enabled').get_active(), 'sound_path': new_sound_file, 'subscriptions': { 'popup': current_popup_subscriptions, @@ -494,13 +494,13 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): self.config.save() core_config = { - 'smtp_enabled': self.glade.get_widget('smtp_enabled').get_active(), - 'smtp_host': self.glade.get_widget('smtp_host').get_text(), - 'smtp_port': self.glade.get_widget('smtp_port').get_value(), - 'smtp_user': self.glade.get_widget('smtp_user').get_text(), - 'smtp_pass': self.glade.get_widget('smtp_pass').get_text(), - 'smtp_from': self.glade.get_widget('smtp_from').get_text(), - 'smtp_tls': self.glade.get_widget('smtp_tls').get_active(), + 'smtp_enabled': self.builder.get_object('smtp_enabled').get_active(), + 'smtp_host': self.builder.get_object('smtp_host').get_text(), + 'smtp_port': self.builder.get_object('smtp_port').get_value(), + 'smtp_user': self.builder.get_object('smtp_user').get_text(), + 'smtp_pass': self.builder.get_object('smtp_pass').get_text(), + 'smtp_from': self.builder.get_object('smtp_from').get_text(), + 'smtp_tls': self.builder.get_object('smtp_tls').get_active(), 'smtp_recipients': [dest[0] for dest in self.recipients_model if dest[0] != 'USER@HOST'], 'subscriptions': {'email': current_email_subscriptions} @@ -514,37 +514,37 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): def cb_get_config(self, core_config): 'callback for on show_prefs' - self.glade.get_widget('smtp_host').set_text(core_config['smtp_host']) - self.glade.get_widget('smtp_port').set_value(core_config['smtp_port']) - self.glade.get_widget('smtp_user').set_text(core_config['smtp_user']) - self.glade.get_widget('smtp_pass').set_text(core_config['smtp_pass']) - self.glade.get_widget('smtp_from').set_text(core_config['smtp_from']) - self.glade.get_widget('smtp_tls').set_active(core_config['smtp_tls']) + self.builder.get_object('smtp_host').set_text(core_config['smtp_host']) + self.builder.get_object('smtp_port').set_value(core_config['smtp_port']) + self.builder.get_object('smtp_user').set_text(core_config['smtp_user']) + self.builder.get_object('smtp_pass').set_text(core_config['smtp_pass']) + self.builder.get_object('smtp_from').set_text(core_config['smtp_from']) + self.builder.get_object('smtp_tls').set_active(core_config['smtp_tls']) self.recipients_model.clear() for recipient in core_config['smtp_recipients']: self.recipients_model.set(self.recipients_model.append(), RECIPIENT_FIELD, recipient, RECIPIENT_EDIT, False) - self.glade.get_widget('smtp_enabled').set_active( + self.builder.get_object('smtp_enabled').set_active( core_config['smtp_enabled'] ) - self.glade.get_widget('sound_enabled').set_active( + self.builder.get_object('sound_enabled').set_active( self.config['sound_enabled'] ) - self.glade.get_widget('popup_enabled').set_active( + self.builder.get_object('popup_enabled').set_active( self.config['popup_enabled'] ) - self.glade.get_widget('blink_enabled').set_active( + self.builder.get_object('blink_enabled').set_active( self.config['blink_enabled'] ) if self.config['sound_path']: sound_path = self.config['sound_path'] else: sound_path = deluge.common.get_default_download_dir() - self.glade.get_widget('sound_path').set_filename(sound_path) + self.builder.get_object('sound_path').set_filename(sound_path) # Force toggle - self.on_enabled_toggled(self.glade.get_widget('smtp_enabled')) - self.on_sound_enabled_toggled(self.glade.get_widget('sound_enabled')) + self.on_enabled_toggled(self.builder.get_object('smtp_enabled')) + self.on_sound_enabled_toggled(self.builder.get_object('sound_enabled')) client.notifications.get_handled_events().addCallback( self.popuplate_what_needs_handled_events, @@ -575,34 +575,34 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): def on_recipients_treeview_selection_changed(self, selection): model, selected_connection_iter = selection.get_selected() if selected_connection_iter: - self.glade.get_widget('delete_button').set_property('sensitive', - True) + self.builder.get_object('delete_button').set_property('sensitive', + True) else: - self.glade.get_widget('delete_button').set_property('sensitive', - False) + self.builder.get_object('delete_button').set_property('sensitive', + False) def on_subscriptions_treeview_selection_changed(self, selection): model, selected_connection_iter = selection.get_selected() if selected_connection_iter: - self.glade.get_widget('delete_button').set_property('sensitive', - True) + self.builder.get_object('delete_button').set_property('sensitive', + True) else: - self.glade.get_widget('delete_button').set_property('sensitive', - False) + self.builder.get_object('delete_button').set_property('sensitive', + False) def on_sounds_treeview_selection_changed(self, selection): model, selected_iter = selection.get_selected() if selected_iter: - self.glade.get_widget('sounds_edit_button').set_property('sensitive', True) + self.builder.get_object('sounds_edit_button').set_property('sensitive', True) path = model.get(selected_iter, SND_PATH)[0] log.debug('Sound selection changed: %s', path) if path != self.config['sound_path']: - self.glade.get_widget('sounds_revert_button').set_property('sensitive', True) + self.builder.get_object('sounds_revert_button').set_property('sensitive', True) else: - self.glade.get_widget('sounds_revert_button').set_property('sensitive', False) + self.builder.get_object('sounds_revert_button').set_property('sensitive', False) else: - self.glade.get_widget('sounds_edit_button').set_property('sensitive', False) - self.glade.get_widget('sounds_revert_button').set_property('sensitive', False) + self.builder.get_object('sounds_edit_button').set_property('sensitive', False) + self.builder.get_object('sounds_revert_button').set_property('sensitive', False) def on_sounds_revert_button_clicked(self, widget): log.debug('on_sounds_revert_button_clicked') @@ -646,25 +646,25 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): 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()) + self.builder.get_object(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) + self.builder.get_object('sound_path').set_property('sensitive', True) + self.builder.get_object('sounds_page').set_property('sensitive', + True) + self.builder.get_object('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) + self.builder.get_object('sound_path').set_property('sensitive', False) + self.builder.get_object('sounds_page').set_property('sensitive', + False) + self.builder.get_object('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', +# self.builder.get_object(widget_name).set_property('sensitive', # widget.get_active()) def _on_email_col_toggled(self, cell, path):