From a106d402b86c08dcefd2f594242917d5d198745e Mon Sep 17 00:00:00 2001 From: Jean-Marie Traissard Date: Tue, 9 May 2006 00:05:15 +0000 Subject: [PATCH] #1005 : Advanced Notifications Control : First part : Preferences GUI. --- .../glade/advanced_notifications_window.glade | 1271 +++++++++++++++++ data/glade/preferences_window.glade | 275 ++-- src/config.py | 3 + src/dialogs.py | 124 ++ 4 files changed, 1494 insertions(+), 179 deletions(-) create mode 100644 data/glade/advanced_notifications_window.glade diff --git a/data/glade/advanced_notifications_window.glade b/data/glade/advanced_notifications_window.glade new file mode 100644 index 000000000..f526dbcf7 --- /dev/null +++ b/data/glade/advanced_notifications_window.glade @@ -0,0 +1,1271 @@ + + + + + + + 6 + Advanced Notifications Control + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + Advanced Notifications Control + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + + + + 12 + True + False + 12 + + + + True + False + 0 + + + + True + Hi SVN users ! This window does nothing for the moment. Discussions about this take place in ticket #1005. + False + False + GTK_JUSTIFY_LEFT + True + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + 0 + False + False + + + + + + True + <b>Conditions</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + True + True + 0 + + + + True + False + 0 + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + + + + + 0 + False + False + + + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 328 + 0 + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_DEFAULT_STYLE + 0 + + + + True + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-go-up + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Up + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + + True + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-go-down + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Down + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + 0 + True + False + + + + + + + 0 + False + False + + + + + + + + True + List of special notifications settings + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 0 + True + True + + + + + + True + False + 0 + + + + True + False + 0 + + + + True + When + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + First Message Received +Next Message Received +Contact Connected +Contact Disconnected +Group Chat Message Highlight +Group Chat Message Received + + + 0 + False + False + + + + + 0 + True + True + + + + + + True + False + 0 + + + + True + for + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + contact +group +everybody + + + + 0 + True + True + + + + + + True + True + True + True + 0 + + True + * + False + + + 0 + True + True + + + + + 0 + True + True + + + + + + True + False + 0 + + + + True + when I'm + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + False + 0 + + + + True + True + All Status + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + True + True + Some special(s) status... + True + GTK_RELIEF_NORMAL + True + False + False + True + all_status_rb + + + 0 + False + False + + + + + + True + True + Online / Free For Chat + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + Away + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + Not Available + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + Busy + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + Invisible + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + True + <b>Actions</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + 0 + 0.5 + GTK_SHADOW_NONE + + + + True + False + 0 + + + + True + True + _Inform me with a popup window + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + True + True + _Disable existing popup window + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + + + True + 0 + 0.5 + GTK_SHADOW_NONE + + + + 6 + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + False + 6 + + + + True + True + 6 + + + + True + True + Play a sound + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + True + True + + + + + + True + False + 6 + + + + True + True + True + True + 0 + + True + * + False + + + + 0 + True + True + + + + + + True + True + ... + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + + True + True + GTK_RELIEF_NORMAL + True + + + + + True + gtk-media-play + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + False + False + + + + + + True + True + _Disable existing sound for this event + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + + + + + True + <b>Sounds</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + label_item + + + + + 0 + False + False + + + + + + True + False + 0 + + + + True + True + _Open chat window with user + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + True + True + _Disable auto opening chat window + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + 0 + True + True + + + + + + True + True + False + 0 + + + + True + False + 0 + + + + True + True + 6 + + + + True + True + Launch a command + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + True + True + + + + + + True + False + 6 + + + + True + True + True + True + 0 + + True + * + False + + + + 0 + True + True + + + + + 0 + True + True + + + + + 0 + False + False + + + + + + True + False + 0 + + + + True + True + _Show event in systray + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + True + True + _Disable showing event in systray + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + 0 + True + True + + + + + + True + True + _Activate Windows manager UrgencyHint to make taskbar to flash + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + + + True + Advanced Actions + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 0 + False + False + + + + + + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-add + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Add + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + 0 + False + False + + + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 413 + 0 + + + + True + False + 0 + + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + True + + + + 0 + True + True + GTK_PACK_END + + + + + + + 0 + False + True + + + + + + + diff --git a/data/glade/preferences_window.glade b/data/glade/preferences_window.glade index 4a3c9595e..13f661aeb 100644 --- a/data/glade/preferences_window.glade +++ b/data/glade/preferences_window.glade @@ -17,7 +17,6 @@ False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST - True @@ -192,10 +191,6 @@ 0 0 iconset_combobox - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -207,8 +202,6 @@ True - False - True @@ -266,10 +259,6 @@ 0 0 theme_combobox - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -281,8 +270,6 @@ True - False - True @@ -333,10 +320,6 @@ 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 label_item @@ -392,10 +375,6 @@ 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -436,10 +415,6 @@ 1 0 one_window_type_combobox - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -455,8 +430,6 @@ Always Per account Per type - False - True @@ -518,10 +491,6 @@ Per type 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 @@ -535,8 +504,6 @@ Per type True - False - True @@ -598,10 +565,6 @@ Per type 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -703,10 +666,6 @@ Per type 0 0 after_time_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 2 @@ -732,10 +691,6 @@ Per type 0 0 after_nickname_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 2 @@ -761,10 +716,6 @@ Per type 0 0 before_nickname_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -790,10 +741,6 @@ Per type 0 0 before_time_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -931,10 +878,6 @@ Per type 0 0 incoming_msg_colorbutton - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -960,10 +903,6 @@ Per type 0 0 outgoing_msg_colorbutton - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -989,10 +928,6 @@ Per type 0 0 status_msg_colorbutton - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -1117,10 +1052,6 @@ Per type 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -1157,10 +1088,6 @@ Per type 0 0 conversation_fontbutton - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -1207,10 +1134,6 @@ Per type 0 0 url_msg_colorbutton - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -1264,10 +1187,6 @@ Per type 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 label_item @@ -1323,10 +1242,6 @@ Per type 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -1489,10 +1404,6 @@ Per type 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 @@ -1527,10 +1438,6 @@ Per type 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -1607,6 +1514,102 @@ Per type False + + + + True + False + 0 + + + + True + True + GTK_RELIEF_NORMAL + True + + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-open + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Advanced Notifications Control... + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + 0 + False + False + + + + + + + + + + + + + 0 + True + True + + @@ -1625,10 +1628,6 @@ Per type 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 label_item @@ -1690,10 +1689,6 @@ Per type 0 0 chat_states_combobox - PANGO_ELLIPSIZE_NONE - -1 - False - 0 @@ -1710,8 +1705,6 @@ Per type All chat states Composing only Disabled - False - True @@ -1799,10 +1792,6 @@ Disabled 0 0 soundplayer_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -1862,9 +1851,6 @@ Disabled False False True - False - False - False @@ -1970,10 +1956,6 @@ Disabled 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 label_item @@ -2029,10 +2011,6 @@ Disabled 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -2121,10 +2099,6 @@ Disabled 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 2 @@ -2149,10 +2123,6 @@ Disabled 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 2 @@ -2312,10 +2282,6 @@ Disabled 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -2434,9 +2400,6 @@ Disabled False False True - False - False - False @@ -2551,10 +2514,6 @@ Disabled 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 label_item @@ -2610,10 +2569,6 @@ Disabled 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -2667,8 +2622,6 @@ Disabled Always use GNOME default applications Always use KDE default applications Custom - False - True @@ -2720,10 +2673,6 @@ Custom 0 0 custom_browser_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -2749,10 +2698,6 @@ Custom 0 0 custom_mail_client_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -2822,10 +2767,6 @@ Custom 0 0 custom_file_manager_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -2876,10 +2817,6 @@ Custom 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 label_item @@ -2910,10 +2847,6 @@ Custom 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 label_item @@ -3029,10 +2962,6 @@ Custom 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 label_item @@ -3122,10 +3051,6 @@ Custom 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 @@ -3155,10 +3080,6 @@ Custom 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 label_item @@ -3214,10 +3135,6 @@ Custom 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 0 diff --git a/src/config.py b/src/config.py index 8b6d6ac6a..fcb4bef17 100644 --- a/src/config.py +++ b/src/config.py @@ -552,6 +552,9 @@ class PreferencesWindow: gajim.interface.roster.change_roster_style(None) gajim.interface.save_config() + def on_open_advanced_notifications_button_clicked(self, widget): + dialogs.AdvancedNotificationsWindow() + def on_one_window_type_combo_changed(self, widget): active = widget.get_active() config_type = common.config.opt_one_window_types[active] diff --git a/src/dialogs.py b/src/dialogs.py index 0a5f56f39..30c84d0ff 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -1717,3 +1717,127 @@ class AddSpecialNotificationDialog: active_iter = self.listen_sound_combobox.get_active_iter() listen_sound_model = self.listen_sound_combobox.get_model() print listen_sound_model[active_iter][0] + +class AdvancedNotificationsWindow: + def __init__(self): + self.xml = gtkgui_helpers.get_glade('advanced_notifications_window.glade') + self.window = self.xml.get_widget('advanced_notifications_window') + self.xml.signal_autoconnect(self) + self.conditions_treeview = self.xml.get_widget('conditions_treeview') + self.recipient_type_combobox = self.xml.get_widget('recipient_type_combobox') + self.recipient_list = self.xml.get_widget('recipient_list') + self.list_expander = self.xml.get_widget('list_expander') + + self.status_hbox = self.xml.get_widget('status_hbox') + # Contains status checkboxes + childs = self.status_hbox.get_children() + + self.all_status_rb = childs[0] + self.special_status_rb = childs[1] + self.online_cb = childs[2] + self.away_cb = childs[3] + self.not_available_cb = childs[4] + self.busy_cb = childs[5] + self.invisible_cb = childs[6] + + self.use_sound_cb = self.xml.get_widget('use_sound_cb') + self.disable_sound_cb = self.xml.get_widget('disable_sound_cb') + self.use_popup_cb = self.xml.get_widget('use_popup_cb') + self.disable_popup_cb = self.xml.get_widget('disable_popup_cb') + self.use_auto_open_cb = self.xml.get_widget('use_auto_open_cb') + self.disable_auto_open_cb = self.xml.get_widget('disable_auto_open_cb') + self.use_systray_cb = self.xml.get_widget('use_systray_cb') + self.disable_systray_cb = self.xml.get_widget('disable_systray_cb') + + model = gtk.ListStore(str) + model.clear() + self.conditions_treeview.set_model(model) + + col = gtk.TreeViewColumn(_('Condition')) + self.conditions_treeview.append_column(col) + renderer = gtk.CellRendererText() + col.pack_start(renderer, expand = True) + col.set_attributes(renderer, text = 0) + + if (0==0): # No rule set yet + self.list_expander.set_expanded(False) + + if (0==1): # We have existing rule(s) + #temporary example + model.append(("When Contact Connected for contact Asterix when I am Available",)) + + # TODO : add a "New rule" line + + self.window.show_all() + + # No rule selected at init time + self.initiate_new_rule_state() + + def initiate_new_rule_state(self): + '''Set default value to all widgets''' + # Deal with status line + self.all_status_rb.set_active(True) + self.on_status_radiobutton_toggled(self.all_status_rb) + self.recipient_type_combobox.set_active(0) + + def on_status_radiobutton_toggled(self, widget): + if self.all_status_rb.get_active(): + # 'All status' clicked + self.online_cb.hide() + self.away_cb.hide() + self.not_available_cb.hide() + self.busy_cb.hide() + self.invisible_cb.hide() + + self.online_cb.set_active(False) + self.away_cb.set_active(False) + self.not_available_cb.set_active(False) + self.busy_cb.set_active(False) + self.invisible_cb.set_active(False) + + self.special_status_rb.show() + else: + # 'special status' clicked + self.online_cb.show() + self.away_cb.show() + self.not_available_cb.show() + self.busy_cb.show() + self.invisible_cb.show() + + self.special_status_rb.hide() + def on_recipient_type_combobox_changed(self, widget): + if (self.recipient_type_combobox.get_active()==2 ): + self.recipient_list.hide() + else: + self.recipient_list.show() + + # 8 next functions : Forbid two incompatible actions to be checked together + def on_use_sound_cb_toggled(self, widget): + if self.use_sound_cb.get_active() and self.disable_sound_cb.get_active(): + self.disable_sound_cb.set_active(False) + def on_disable_sound_cb_toggled(self, widget): + if self.use_sound_cb.get_active() and self.disable_sound_cb.get_active(): + self.use_sound_cb.set_active(False) + def on_use_popup_cb_toggled(self, widget): + if self.use_popup_cb.get_active() and self.disable_popup_cb.get_active(): + self.disable_popup_cb.set_active(False) + def on_disable_popup_cb_toggled(self, widget): + if self.use_popup_cb.get_active() and self.disable_popup_cb.get_active(): + self.use_popup_cb.set_active(False) + def on_use_auto_open_cb_toggled(self, widget): + if self.use_auto_open_cb.get_active() and\ + self.disable_auto_open_cb.get_active(): + self.disable_auto_open_cb.set_active(False) + def on_disable_auto_open_cb_toggled(self, widget): + if self.use_auto_open_cb.get_active() and\ + self.disable_auto_open_cb.get_active(): + self.use_auto_open_cb.set_active(False) + def on_use_systray_cb_toggled(self, widget): + if self.use_systray_cb.get_active() and self.disable_systray_cb.get_active(): + self.disable_systray_cb.set_active(False) + def on_disable_systray_cb_toggled(self, widget): + if self.use_systray_cb.get_active() and self.disable_systray_cb.get_active(): + self.use_systray_cb.set_active(False) + + def on_close_window(self, widget): + self.window.destroy()