diff --git a/data/glade/manage_sounds_window.glade b/data/glade/manage_sounds_window.glade new file mode 100644 index 000000000..44cd23977 --- /dev/null +++ b/data/glade/manage_sounds_window.glade @@ -0,0 +1,106 @@ + + + + + + 400 + 350 + 6 + + + + True + 6 + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + + + + + + + + True + 6 + + + True + True + + + + + + True + True + ... + True + 0 + + + + False + False + 1 + + + + + True + True + 0 + + + + True + gtk-media-play + + + + + False + False + 2 + + + + + False + 1 + + + + + True + 6 + GTK_BUTTONBOX_END + + + True + True + True + gtk-close + True + 0 + + + + + + False + 2 + + + + + + diff --git a/data/glade/preferences_window.glade b/data/glade/preferences_window.glade index 4c31a2233..127186201 100644 --- a/data/glade/preferences_window.glade +++ b/data/glade/preferences_window.glade @@ -211,37 +211,62 @@ 6 6 - - 50 + True - Detached roster with detached chats -Detached roster with single chat -Single window for everything -Detached roster with chat grouped by account -Detached roster with chat grouped by type - + 0 + 1 + _Window behavior: + True + one_window_type_combobox + + + 1 + 2 + GTK_FILL + + + + + True + 1 2 - 1 - 2 - + + True + If not disabled, Gajim will replace ascii smilies like ':)' with equivalent animated or static graphical emoticons + + + True + 0 + 1 + _Emoticons: + True + + + + + GTK_FILL + + + + True - If checked, Gajim will highlight spelling errors in input fields of chat windows. If no language is explicitly set via right click on the input field, the default language will be used for this contact or group chat. - _Highlight misspelled words + Hide all buttons in chat windows + Ma_ke message windows compact True 0 True - + 2 - 4 - 5 + 2 + 3 GTK_FILL @@ -264,63 +289,38 @@ Detached roster with chat grouped by type - + True - Hide all buttons in chat windows - Ma_ke message windows compact + If checked, Gajim will highlight spelling errors in input fields of chat windows. If no language is explicitly set via right click on the input field, the default language will be used for this contact or group chat. + _Highlight misspelled words True 0 True - + 2 - 2 - 3 + 4 + 5 GTK_FILL - + + 50 True - If not disabled, Gajim will replace ascii smilies like ':)' with equivalent animated or static graphical emoticons - - - True - 0 - 1 - _Emoticons: - True - - - - - GTK_FILL - - - - - True - + Detached roster with detached chats +Detached roster with single chat +Single window for everything +Detached roster with chat grouped by account +Detached roster with chat grouped by type + 1 2 - - - - - True - 0 - 1 - _Window behavior: - True - one_window_type_combobox - - 1 2 - GTK_FILL @@ -582,7 +582,7 @@ Show only in roster 6 12 - + True 6 @@ -600,73 +600,18 @@ Show only in roster - + True True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - - - True - True - - - - - - 1 - - - - - True - 6 - - - True - True - - - - - - True - True - ... - True - 0 - - - - False - False - 1 - - - - - True - True - 0 - - - - True - gtk-media-play - - - - - False - False - 2 - - + True + Ma_nage... + True + 0 + False - 2 + 1 @@ -686,6 +631,7 @@ Show only in roster + False 1 @@ -732,33 +678,18 @@ Show only in roster 6 6 - + True All chat states Composing only Disabled - + 1 2 - - - - - True - Gajim can send and receive meta-information related to a conversation you may have with a contact. Here you can specify which chatstates you want to send to the other party. - - - True - 0 - _Send chat state notifications: - True - - - - - GTK_FILL + 1 + 2 @@ -781,18 +712,33 @@ Disabled - + + True + Gajim can send and receive meta-information related to a conversation you may have with a contact. Here you can specify which chatstates you want to send to the other party. + + + True + 0 + _Send chat state notifications: + True + + + + + GTK_FILL + + + + True All chat states Composing only Disabled - + 1 2 - 1 - 2 @@ -856,37 +802,90 @@ Disabled 12 6 - + True True - The auto not available status message. If empty, Gajim will not change the current status message -$S will be replaced by previous status message -$T will be replaced by auto-not-available timeout - + If checked, Gajim will change status to Away when the computer is unused. + _Away after: + True + 0 + True + - 3 - 4 - 1 - 2 + GTK_FILL - + True True - The auto away status message. If empty, Gajim will not change the current status message -$S will be replaced by previous status message -$T will be replaced by auto-away timeout - + If checked, Gajim will change status to Not Available when the computer has not been used even longer + _Not available after: + True + 0 + True + - 3 - 4 + 1 + 2 + GTK_FILL + + + True + 0 + minutes + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + minutes + + + 2 + 3 + 1 + 2 + GTK_FILL + + + + + + True + 1 + 0 + + + 50 + True + True + 12 1 720 1 10 10 + 1 + + + + + + 1 + 2 + GTK_FILL + GTK_FILL + + True @@ -913,87 +912,34 @@ $T will be replaced by auto-away timeout - - True - 1 - 0 - - - 50 - True - True - 12 1 720 1 10 10 - 1 - - - - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - 0 - minutes - - - 2 - 3 - 1 - 2 - GTK_FILL - - - - - - True - 0 - minutes - - - 2 - 3 - GTK_FILL - - - - - + True True - If checked, Gajim will change status to Not Available when the computer has not been used even longer - _Not available after: - True - 0 - True - + The auto away status message. If empty, Gajim will not change the current status message +$S will be replaced by previous status message +$T will be replaced by auto-away timeout + - 1 - 2 - GTK_FILL + 3 + 4 - + True True - If checked, Gajim will change status to Away when the computer is unused. - _Away after: - True - 0 - True - + The auto not available status message. If empty, Gajim will not change the current status message +$S will be replaced by previous status message +$T will be replaced by auto-not-available timeout + - GTK_FILL + 3 + 4 + 1 + 2 @@ -1153,46 +1099,6 @@ $T will be replaced by auto-away timeout - - - True - True - GTK_POLICY_NEVER - GTK_POLICY_NEVER - GTK_SHADOW_IN - - - True - True - 3 - GTK_WRAP_WORD - - - - - 1 - 2 - GTK_FILL - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - - - True - True - False - - - - - - True @@ -1231,6 +1137,46 @@ $T will be replaced by auto-away timeout GTK_FILL + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + False + + + + + + + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_NEVER + GTK_SHADOW_IN + + + True + True + 3 + GTK_WRAP_WORD + + + + + 1 + 2 + GTK_FILL + + @@ -1293,14 +1239,15 @@ $T will be replaced by auto-away timeout - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Chat message: + True + 0 + - GTK_FILL - GTK_FILL + 1 + 2 @@ -1321,15 +1268,14 @@ $T will be replaced by auto-away timeout - + True - True - 0 - + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Chat message: - 1 - 2 + GTK_FILL + GTK_FILL @@ -1379,18 +1325,62 @@ $T will be replaced by auto-away timeout - + True - 0 - T_heme: + True + If checked, Gajim will use protocol-specific status icons. (eg. A contact from MSN will have the equivalent msn icon for status online, away, busy, etc...) + Use _transports icons True - theme_combobox + 0 + True + + 1 + 3 + 2 + 3 + + + + + True + + + + 1 + 2 + 1 + 2 GTK_FILL GTK_FILL + + + True + 0 + Status _iconset: + True + iconset_combobox + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + + + + 1 + 2 + + True @@ -1409,62 +1399,18 @@ $T will be replaced by auto-away timeout - - True - - - - 1 - 2 - - - - + True 0 - Status _iconset: + T_heme: True - iconset_combobox + theme_combobox - 1 - 2 GTK_FILL GTK_FILL - - - True - - - - 1 - 2 - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - True - If checked, Gajim will use protocol-specific status icons. (eg. A contact from MSN will have the equivalent msn icon for status online, away, busy, etc...) - Use _transports icons - True - 0 - True - - - - 1 - 3 - 2 - 3 - - @@ -1503,6 +1449,135 @@ $T will be replaced by auto-away timeout 4 12 6 + + + True + 0 + _Incoming message: + True + GTK_JUSTIFY_CENTER + True + incoming_msg_colorbutton + + + GTK_FILL + + + + + + True + True + True + True + True + 0 + + + + 1 + 2 + + + + + + + True + 0 + _Outgoing message: + True + GTK_JUSTIFY_CENTER + True + outgoing_msg_colorbutton + + + 2 + 3 + GTK_FILL + + + + + + True + True + 0 + + + + 3 + 4 + GTK_FILL + + + + + + True + 0 + _Status message: + True + GTK_JUSTIFY_CENTER + True + status_msg_colorbutton + + + 1 + 2 + GTK_FILL + + + + + + True + True + 0 + + + + 1 + 2 + 1 + 2 + + + + + + + True + 0 + _URL highlight: + True + url_msg_colorbutton + + + 2 + 3 + 1 + 2 + GTK_FILL + + + + + + True + True + 0 + + + + 3 + 4 + 1 + 2 + GTK_FILL + + + True @@ -1571,135 +1646,6 @@ $T will be replaced by auto-away timeout GTK_FILL - - - True - True - 0 - - - - 3 - 4 - 1 - 2 - GTK_FILL - - - - - - True - 0 - _URL highlight: - True - url_msg_colorbutton - - - 2 - 3 - 1 - 2 - GTK_FILL - - - - - - True - True - 0 - - - - 1 - 2 - 1 - 2 - - - - - - - True - 0 - _Status message: - True - GTK_JUSTIFY_CENTER - True - status_msg_colorbutton - - - 1 - 2 - GTK_FILL - - - - - - True - True - 0 - - - - 3 - 4 - GTK_FILL - - - - - - True - 0 - _Outgoing message: - True - GTK_JUSTIFY_CENTER - True - outgoing_msg_colorbutton - - - 2 - 3 - GTK_FILL - - - - - - True - True - True - True - True - 0 - - - - 1 - 2 - - - - - - - True - 0 - _Incoming message: - True - GTK_JUSTIFY_CENTER - True - incoming_msg_colorbutton - - - GTK_FILL - - - @@ -1784,56 +1730,16 @@ Custom 12 6 - - True - 0 - _Browser: - True - custom_browser_entry - - - GTK_FILL - - - - - - True - 0 - _Mail client: - True - custom_mail_client_entry - - - 1 - 2 - GTK_FILL - - - - - + True True - - - - 1 - 2 - 1 - 2 - - - - - - True - True - + 1 2 + 2 + 3 @@ -1853,16 +1759,56 @@ Custom - + True True - + 1 2 - 2 - 3 + + + + + + True + True + + + + 1 + 2 + 1 + 2 + + + + + + True + 0 + _Mail client: + True + custom_mail_client_entry + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + _Browser: + True + custom_browser_entry + + + GTK_FILL @@ -1926,19 +1872,18 @@ Custom 6 6 - + True True - If checked, Gajim will keep logs for encrypted messages. Please note that when using E2E encryption the remote party has to agree on logging, else the messages will not be logged. - Log _encrypted chat session + If checked, Gajim will ignore incoming events from unauthorized contacts. Use with caution, because it blocks all messages from any contact that is not in the roster + _Ignore events from contacts not in the roster True 0 True - + - 2 - 3 + GTK_FILL @@ -1958,18 +1903,19 @@ Custom - + True True - If checked, Gajim will ignore incoming events from unauthorized contacts. Use with caution, because it blocks all messages from any contact that is not in the roster - _Ignore events from contacts not in the roster + If checked, Gajim will keep logs for encrypted messages. Please note that when using E2E encryption the remote party has to agree on logging, else the messages will not be logged. + Log _encrypted chat session True 0 True - + - GTK_FILL + 2 + 3 diff --git a/src/config.py b/src/config.py index 30ac755a5..5eb92ee56 100644 --- a/src/config.py +++ b/src/config.py @@ -305,31 +305,7 @@ class PreferencesWindow: if gajim.config.get('sounds_on'): self.xml.get_widget('play_sounds_checkbutton').set_active(True) else: - self.xml.get_widget('sounds_scrolledwindow').set_sensitive(False) - self.xml.get_widget('browse_sounds_hbox').set_sensitive(False) - - # sounds treeview - self.sound_tree = self.xml.get_widget('sounds_treeview') - - # active, event ui name, path to sound file, event_config_name - model = gtk.ListStore(bool, str, str, str) - self.sound_tree.set_model(model) - - col = gtk.TreeViewColumn(_('Active')) - self.sound_tree.append_column(col) - renderer = gtk.CellRendererToggle() - renderer.set_property('activatable', True) - renderer.connect('toggled', self.sound_toggled_cb) - col.pack_start(renderer) - col.set_attributes(renderer, active = 0) - - col = gtk.TreeViewColumn(_('Event')) - self.sound_tree.append_column(col) - renderer = gtk.CellRendererText() - col.pack_start(renderer) - col.set_attributes(renderer, text = 1) - - self.fill_sound_treeview() + self.xml.get_widget('manage_sounds_button').set_sensitive(False) # Notify user of new gmail e-mail messages, # make checkbox sensitive if user has a gtalk account @@ -500,8 +476,6 @@ class PreferencesWindow: self.xml.signal_autoconnect(self) - self.sound_tree.get_model().connect('row-changed', - self.on_sounds_treemodel_row_changed) self.msg_tree.get_model().connect('row-changed', self.on_msg_treemodel_row_changed) self.msg_tree.get_model().connect('row-deleted', @@ -510,6 +484,7 @@ class PreferencesWindow: self.on_default_msg_treemodel_row_changed) self.theme_preferences = None + self.sounds_preferences = None self.notebook.set_current_page(0) @@ -750,16 +725,13 @@ class PreferencesWindow: def on_play_sounds_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'sounds_on', - [self.xml.get_widget('sounds_scrolledwindow'), - self.xml.get_widget('browse_sounds_hbox')]) - - def on_sounds_treemodel_row_changed(self, model, path, iter_): - sound_event = model[iter_][3].decode('utf-8') - gajim.config.set_per('soundevents', sound_event, 'enabled', - bool(model[path][0])) - gajim.config.set_per('soundevents', sound_event, 'path', - model[iter_][2].decode('utf-8')) - gajim.interface.save_config() + [self.xml.get_widget('manage_sounds_button')]) + + def on_manage_sounds_button_clicked(self, widget): + if self.sounds_preferences is None: + self.sounds_preferences = ManageSoundsWindow() + else: + self.sounds_preferences.window.present() def update_text_tags(self): '''Update color tags in Opened Chat Windows''' @@ -1032,88 +1004,6 @@ class PreferencesWindow: if event.keyval == gtk.keysyms.Delete: self.on_delete_msg_button_clicked(widget) - def sound_toggled_cb(self, cell, path): - model = self.sound_tree.get_model() - model[path][0] = not model[path][0] - - def fill_sound_treeview(self): - model = self.sound_tree.get_model() - model.clear() - model.set_sort_column_id(1, gtk.SORT_ASCENDING) - - # NOTE: sounds_ui_names MUST have all items of - # sounds = gajim.config.get_per('soundevents') as keys - sounds_dict = { - 'first_message_received': _('First Message Received'), - 'next_message_received_focused': _('Next Message Received Focused'), - 'next_message_received_unfocused': - _('Next Message Received Unfocused'), - 'contact_connected': _('Contact Connected'), - 'contact_disconnected': _('Contact Disconnected'), - 'message_sent': _('Message Sent'), - 'muc_message_highlight': _('Group Chat Message Highlight'), - 'muc_message_received': _('Group Chat Message Received'), - 'gmail_received': _('GMail Email Received') - } - - for sound_event_config_name, sound_ui_name in sounds_dict.items(): - enabled = gajim.config.get_per('soundevents', - sound_event_config_name, 'enabled') - path = gajim.config.get_per('soundevents', - sound_event_config_name, 'path') - model.append((enabled, sound_ui_name, path, sound_event_config_name)) - - def on_treeview_sounds_cursor_changed(self, widget, data = None): - (model, iter_) = self.sound_tree.get_selection().get_selected() - sounds_entry = self.xml.get_widget('sounds_entry') - if not iter_: - sounds_entry.set_text('') - return - path_to_snd_file = model[iter_][2] - sounds_entry.set_text(path_to_snd_file) - - def on_browse_for_sounds_button_clicked(self, widget, data = None): - (model, iter_) = self.sound_tree.get_selection().get_selected() - if not iter_: - return - def on_ok(widget, path_to_snd_file): - self.dialog.destroy() - model, iter_ = self.sound_tree.get_selection().get_selected() - if not path_to_snd_file: - model[iter_][2] = '' - self.xml.get_widget('sounds_entry').set_text('') - model[iter_][0] = False - return - directory = os.path.dirname(path_to_snd_file) - gajim.config.set('last_sounds_dir', directory) - self.xml.get_widget('sounds_entry').set_text(path_to_snd_file) - - model[iter_][2] = path_to_snd_file # set new path to sounds_model - model[iter_][0] = True # set the sound to enabled - - def on_cancel(widget): - self.dialog.destroy() - model, iter_ = self.sound_tree.get_selection().get_selected() - model[iter_][2] = '' - model[iter_][0] = False - - path_to_snd_file = model[iter_][2].decode('utf-8') - path_to_snd_file = os.path.join(os.getcwd(), path_to_snd_file) - self.dialog = dialogs.SoundChooserDialog(path_to_snd_file, on_ok, - on_cancel) - - def on_sounds_entry_changed(self, widget): - path_to_snd_file = widget.get_text() - model, iter_ = self.sound_tree.get_selection().get_selected() - model[iter_][2] = path_to_snd_file # set new path to sounds_model - - def on_play_button_clicked(self, widget): - model, iter_ = self.sound_tree.get_selection().get_selected() - if not iter_: - return - snd_event_config_name = model[iter_][3] - helpers.play_sound(snd_event_config_name) - def on_open_advanced_editor_button_clicked(self, widget, data = None): if 'advanced_config' in gajim.interface.instances: gajim.interface.instances['advanced_config'].window.present() @@ -3608,4 +3498,135 @@ class ManagePEPServicesWindow: window.set_title(title) window.show_all() +class ManageSoundsWindow: + def __init__(self): + self.xml = gtkgui_helpers.get_glade('manage_sounds_window.glade') + self.window = self.xml.get_widget('manage_sounds_window') + + # sounds treeview + self.sound_tree = self.xml.get_widget('sounds_treeview') + + # active, event ui name, path to sound file, event_config_name + model = gtk.ListStore(bool, str, str, str) + self.sound_tree.set_model(model) + + col = gtk.TreeViewColumn(_('Active')) + self.sound_tree.append_column(col) + renderer = gtk.CellRendererToggle() + renderer.set_property('activatable', True) + renderer.connect('toggled', self.sound_toggled_cb) + col.pack_start(renderer) + col.set_attributes(renderer, active = 0) + + col = gtk.TreeViewColumn(_('Event')) + self.sound_tree.append_column(col) + renderer = gtk.CellRendererText() + col.pack_start(renderer) + col.set_attributes(renderer, text = 1) + + self.fill_sound_treeview() + + self.xml.signal_autoconnect(self) + + self.sound_tree.get_model().connect('row-changed', + self.on_sounds_treemodel_row_changed) + + self.window.show_all() + + def on_sounds_treemodel_row_changed(self, model, path, iter_): + sound_event = model[iter_][3].decode('utf-8') + gajim.config.set_per('soundevents', sound_event, 'enabled', + bool(model[path][0])) + gajim.config.set_per('soundevents', sound_event, 'path', + model[iter_][2].decode('utf-8')) + gajim.interface.save_config() + + def sound_toggled_cb(self, cell, path): + model = self.sound_tree.get_model() + model[path][0] = not model[path][0] + + def fill_sound_treeview(self): + model = self.sound_tree.get_model() + model.clear() + model.set_sort_column_id(1, gtk.SORT_ASCENDING) + + # NOTE: sounds_ui_names MUST have all items of + # sounds = gajim.config.get_per('soundevents') as keys + sounds_dict = { + 'first_message_received': _('First Message Received'), + 'next_message_received_focused': _('Next Message Received Focused'), + 'next_message_received_unfocused': + _('Next Message Received Unfocused'), + 'contact_connected': _('Contact Connected'), + 'contact_disconnected': _('Contact Disconnected'), + 'message_sent': _('Message Sent'), + 'muc_message_highlight': _('Group Chat Message Highlight'), + 'muc_message_received': _('Group Chat Message Received'), + 'gmail_received': _('GMail Email Received') + } + + for sound_event_config_name, sound_ui_name in sounds_dict.items(): + enabled = gajim.config.get_per('soundevents', + sound_event_config_name, 'enabled') + path = gajim.config.get_per('soundevents', + sound_event_config_name, 'path') + model.append((enabled, sound_ui_name, path, sound_event_config_name)) + + def on_treeview_sounds_cursor_changed(self, widget, data = None): + (model, iter_) = self.sound_tree.get_selection().get_selected() + sounds_entry = self.xml.get_widget('sounds_entry') + if not iter_: + sounds_entry.set_text('') + return + path_to_snd_file = model[iter_][2] + sounds_entry.set_text(path_to_snd_file) + + def on_browse_for_sounds_button_clicked(self, widget, data = None): + (model, iter_) = self.sound_tree.get_selection().get_selected() + if not iter_: + return + def on_ok(widget, path_to_snd_file): + self.dialog.destroy() + model, iter_ = self.sound_tree.get_selection().get_selected() + if not path_to_snd_file: + model[iter_][2] = '' + self.xml.get_widget('sounds_entry').set_text('') + model[iter_][0] = False + return + directory = os.path.dirname(path_to_snd_file) + gajim.config.set('last_sounds_dir', directory) + self.xml.get_widget('sounds_entry').set_text(path_to_snd_file) + + model[iter_][2] = path_to_snd_file # set new path to sounds_model + model[iter_][0] = True # set the sound to enabled + + def on_cancel(widget): + self.dialog.destroy() + model, iter_ = self.sound_tree.get_selection().get_selected() + model[iter_][2] = '' + model[iter_][0] = False + + path_to_snd_file = model[iter_][2].decode('utf-8') + path_to_snd_file = os.path.join(os.getcwd(), path_to_snd_file) + self.dialog = dialogs.SoundChooserDialog(path_to_snd_file, on_ok, + on_cancel) + + def on_sounds_entry_changed(self, widget): + path_to_snd_file = widget.get_text() + model, iter_ = self.sound_tree.get_selection().get_selected() + model[iter_][2] = path_to_snd_file # set new path to sounds_model + + def on_play_button_clicked(self, widget): + model, iter_ = self.sound_tree.get_selection().get_selected() + if not iter_: + return + snd_event_config_name = model[iter_][3] + helpers.play_sound(snd_event_config_name) + + def on_close_button_clicked(self, widget): + self.window.hide() + + def on_manage_sounds_window_delete_event(self, widget, event): + self.window.hide() + return True # do NOT destroy the window # vim: se ts=3: