diff --git a/configure.ac b/configure.ac index 4f313330c0a0cc854766b192698bf415bbd94030..d06f128205853928fe4e5d5aa040c41573d9d37a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([Gajim - A Jabber Instant Messager], - [0.11.4.1-svn],[http://trac.gajim.org/],[gajim]) + [0.11.4.2-svn],[http://trac.gajim.org/],[gajim]) AC_PREREQ([2.59]) AM_INIT_AUTOMAKE([1.8]) AC_CONFIG_HEADER(config.h) diff --git a/src/common/config.py b/src/common/config.py index 913b94b9eb65e1bea10e5159ade51ec2b21ed9ba..e7cedb5cf90f95a343399c208ce79ff4d4bfaec8 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -408,7 +408,8 @@ class Config: soundevents_default = { 'first_message_received': [ True, '../data/sounds/message1.wav' ], - 'next_message_received': [ True, '../data/sounds/message2.wav' ], + 'next_message_received_focused': [ True, '../data/sounds/message2.wav' ], + 'next_message_received_unfocused': [ True, '../data/sounds/message2.wav' ], 'contact_connected': [ True, '../data/sounds/connected.wav' ], 'contact_disconnected': [ True, '../data/sounds/disconnected.wav' ], 'message_sent': [ True, '../data/sounds/sent.wav' ], diff --git a/src/common/defs.py b/src/common/defs.py index b30457a31c4edc462e230fa06eff4a62c5a0e135..7cdfe01116322cec62eaa18fe348a58cbc0558ef 100644 --- a/src/common/defs.py +++ b/src/common/defs.py @@ -2,7 +2,7 @@ docdir = '../' datadir = '../' -version = '0.11.4.1-svn' +version = '0.11.4.2-svn' import sys, os.path for base in ('.', 'common'): diff --git a/src/common/optparser.py b/src/common/optparser.py index e50206420a764ef4c9f19b1a18a2d4c4fd5e5016..72b6fe6e7232c025a434b95f688104dcc089051a 100644 --- a/src/common/optparser.py +++ b/src/common/optparser.py @@ -176,6 +176,8 @@ class OptionsParser: self.update_config_to_01121() if old < [0, 11, 4, 1] and new >= [0, 11, 4, 1]: self.update_config_to_01141() + if old < [0, 11, 4, 2] and new >= [0, 11, 4, 2]: + self.update_config_to_01142() gajim.logger.init_vars() gajim.config.set('version', new_version) @@ -526,3 +528,18 @@ class OptionsParser: con.close() gajim.config.set('version', '0.11.4.1') + def update_config_to_01142(self): + '''next_message_received sound event is splittedin 2 events''' + gajim.config.add_per('soundevents', 'next_message_received_focused') + gajim.config.add_per('soundevents', 'next_message_received_unfocused') + if gajim.config.get_per('soundevents', 'next_message_received'): + enabled = gajim.config.get_per('soundevents', 'next_message_received', + 'enabled') + path = gajim.config.get_per('soundevents', 'next_message_received', + 'path') + gajim.config.del_per('soundevents', 'next_message_received') + gajim.config.set_per('soundevents', 'next_message_received_focused', + 'enabled', enabled) + gajim.config.set_per('soundevents', 'next_message_received_focused', + 'path', path) + gajim.config.set('version', '0.11.1.2') diff --git a/src/config.py b/src/config.py index b70ff264ded2e3e08230ea21cf9383980d035944..d766c61ae961a20e7a464878941c2c5c72c66d37 100644 --- a/src/config.py +++ b/src/config.py @@ -1089,12 +1089,15 @@ class PreferencesWindow: 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': _('Next 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'), diff --git a/src/gajim.py b/src/gajim.py index dde618e6585bd7d6120d0a0e16bbd895fdd3a1d9..1561a819ab6e266db39fab9a2948842fb0c6381a 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -847,8 +847,14 @@ class Interface: msg = message if subject: msg = _('Subject: %s') % subject + '\n' + msg + focused = False + if chat_control: + parent_win = chat_control.parent_win + if chat_control == parent_win.get_active_control() and \ + parent_win.window.has_focus: + focused = True notify.notify('new_message', jid_of_control, account, [msg_type, - first, nickname, msg], advanced_notif_num) + first, nickname, msg, focused], advanced_notif_num) if self.remote_ctrl: self.remote_ctrl.raise_signal('NewMessage', (account, array)) diff --git a/src/notify.py b/src/notify.py index ab2f0d20b481e8ace95647fc3b9735650c06ac17..6106227c39267f3a09db383193fe46c52192862f 100644 --- a/src/notify.py +++ b/src/notify.py @@ -175,14 +175,20 @@ def notify(event, jid, account, parameters, advanced_notif_num = None): else: # We don't want message preview, do_preview = False message = '' + focused = parameters[4] if helpers.allow_showing_notification(account, 'notify_on_new_message', advanced_notif_num, is_first_message): do_popup = True if is_first_message and helpers.allow_sound_notification( 'first_message_received', advanced_notif_num): do_sound = True - elif not is_first_message and helpers.allow_sound_notification( - 'next_message_received', advanced_notif_num): + elif not is_first_message and focused and \ + helpers.allow_sound_notification('next_message_received_focused', + advanced_notif_num): + do_sound = True + elif not is_first_message and not focused and \ + helpers.allow_sound_notification('next_message_received_unfocused', + advanced_notif_num): do_sound = True else: print '*Event not implemeted yet*' @@ -285,8 +291,10 @@ def notify(event, jid, account, parameters, advanced_notif_num = None): pass # do not set snd_event elif is_first_message: snd_event = 'first_message_received' + elif focused: + snd_event = 'next_message_received_focused' else: - snd_event = 'next_message_received' + snd_event = 'next_message_received_unfocused' elif event in ('contact_connected', 'contact_disconnected'): snd_event = event if snd_file: