changeset 193495212d31 in /home/hg/repos/gajim
author: Yann Leboulanger asterix@lagaule.org branches: details:http://hg.gajim.org/gajim?cmd=changeset;node=193495212d31 description: add new option to allow popup notifications when a chat control is opened. See #7891, #8158
diffstat:
data/gui/preferences_window.ui | 21 +++++++++++++++++++-- src/common/config.py | 1 + src/common/connection_handlers_events.py | 21 +++++++++++---------- src/config.py | 29 +++++++++++++++++++---------- src/conversation_textview.py | 2 +- 5 files changed, 51 insertions(+), 23 deletions(-)
diffs (179 lines):
diff -r d8128b776f31 -r 193495212d31 data/gui/preferences_window.ui --- a/data/gui/preferences_window.ui Wed Sep 30 20:00:48 2015 +0200 +++ b/data/gui/preferences_window.ui Sun Oct 25 15:06:37 2015 +0100 @@ -683,6 +683,23 @@ </packing> </child> <child> + <object class="GtkCheckButton" id="auto_popup_chat_opened_checkbutton"> + <property name="label" translatable="yes">Allow popup/notifications when a chat window is opened</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_auto_popup_chat_opened_checkbutton_toggled" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">4</property> + </packing> + </child> + <child> <object class="GtkFrame" id="frame_gmail"> <property name="visible">True</property> <property name="sensitive">False</property> @@ -748,7 +765,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> <child> @@ -791,7 +808,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">5</property> + <property name="position">6</property> </packing> </child> </object> diff -r d8128b776f31 -r 193495212d31 src/common/config.py --- a/src/common/config.py Wed Sep 30 20:00:48 2015 +0200 +++ b/src/common/config.py Sun Oct 25 15:06:37 2015 +0100 @@ -73,6 +73,7 @@ 'notify_on_signout': [ opt_bool, False ], 'notify_on_new_message': [ opt_bool, True ], 'autopopupaway': [ opt_bool, False ], + 'autopopup_chat_opened': [ opt_bool, False, _('Show desktop notification even when a chat window is opened for this contact and does not have focus') ], 'sounddnd': [ opt_bool, False, _('Play sound when user is busy')], 'use_notif_daemon': [ opt_bool, True, _('Use D-Bus and Notification-Daemon to show notifications') ], 'showoffline': [ opt_bool, False ], diff -r d8128b776f31 -r 193495212d31 src/common/connection_handlers_events.py --- a/src/common/connection_handlers_events.py Wed Sep 30 20:00:48 2015 +0200 +++ b/src/common/connection_handlers_events.py Sun Oct 25 15:06:37 2015 +0100 @@ -2302,7 +2302,7 @@ if self.control: parent_win = self.control.parent_win if parent_win and self.control == parent_win.get_active_control() \ - and parent_win.window.has_focus: + and parent_win.window.get_property('has-toplevel-focus'): self.control_focused = True
def handle_incoming_msg_event(self, msg_obj): @@ -2364,15 +2364,16 @@ self.popup_title = _('New Message from %(nickname)s') % \ {'nickname': nick}
- if not gajim.config.get('notify_on_new_message') or \ - not self.first_unread: - self.do_popup = False - elif gajim.config.get('autopopupaway'): - # always show notification - self.do_popup = True - elif gajim.connections[self.conn.name].connected in (2, 3): - # we're online or chat - self.do_popup = True + + if gajim.config.get('notify_on_new_message'): + if self.first_unread or (gajim.config.get('autopopup_chat_opened') \ + and not self.control_focused): + if gajim.config.get('autopopupaway'): + # always show notification + self.do_popup = True + if gajim.connections[self.conn.name].connected in (2, 3): + # we're online or chat + self.do_popup = True
if msg_obj.attention and not gajim.config.get( 'ignore_incoming_attention'): diff -r d8128b776f31 -r 193495212d31 src/config.py --- a/src/config.py Wed Sep 30 20:00:48 2015 +0200 +++ b/src/config.py Sun Oct 25 15:06:37 2015 +0100 @@ -97,36 +97,38 @@ self.window = self.xml.get_object('preferences_window') self.window.set_transient_for(gajim.interface.roster.window) self.notebook = self.xml.get_object('preferences_notebook') - self.one_window_type_combobox =\ - self.xml.get_object('one_window_type_combobox') + self.one_window_type_combobox = self.xml.get_object( + 'one_window_type_combobox') self.iconset_combobox = self.xml.get_object('iconset_combobox') self.notify_on_signin_checkbutton = self.xml.get_object( - 'notify_on_signin_checkbutton') + 'notify_on_signin_checkbutton') self.notify_on_signout_checkbutton = self.xml.get_object( - 'notify_on_signout_checkbutton') + 'notify_on_signout_checkbutton') self.auto_popup_away_checkbutton = self.xml.get_object( - 'auto_popup_away_checkbutton') + 'auto_popup_away_checkbutton') + self.auto_popup_chat_opened_checkbutton = self.xml.get_object( + 'auto_popup_chat_opened_checkbutton') self.sound_dnd_checkbutton = self.xml.get_object('sound_dnd_checkbutton') self.auto_away_checkbutton = self.xml.get_object('auto_away_checkbutton') self.auto_away_time_spinbutton = self.xml.get_object( - 'auto_away_time_spinbutton') + 'auto_away_time_spinbutton') self.auto_away_message_entry = self.xml.get_object( - 'auto_away_message_entry') + 'auto_away_message_entry') self.auto_xa_checkbutton = self.xml.get_object('auto_xa_checkbutton') self.auto_xa_time_spinbutton = self.xml.get_object( - 'auto_xa_time_spinbutton') + 'auto_xa_time_spinbutton') self.auto_xa_message_entry = self.xml.get_object('auto_xa_message_entry')
### General tab ### # Display avatars in roster st = gajim.config.get('show_avatars_in_roster') self.xml.get_object('show_avatars_in_roster_checkbutton'). \ - set_active(st) + set_active(st)
# Display status msg under contact name in roster st = gajim.config.get('show_status_msgs_in_roster') self.xml.get_object('show_status_msgs_in_roster_checkbutton'). \ - set_active( st) + set_active( st)
# Display PEP in roster st1 = gajim.config.get('show_mood_in_roster') @@ -313,6 +315,10 @@ st = gajim.config.get('autopopupaway') self.auto_popup_away_checkbutton.set_active(st)
+ # autopopup_chat_opened + st = gajim.config.get('autopopup_chat_opened') + self.auto_popup_chat_opened_checkbutton.set_active(st) + # sounddnd st = gajim.config.get('sounddnd') self.sound_dnd_checkbutton.set_active(st) @@ -847,6 +853,9 @@ def on_auto_popup_away_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'autopopupaway')
+ def on_auto_popup_chat_opened_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'autopopup_chat_opened') + def on_sound_dnd_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'sounddnd')
diff -r d8128b776f31 -r 193495212d31 src/conversation_textview.py --- a/src/conversation_textview.py Wed Sep 30 20:00:48 2015 +0200 +++ b/src/conversation_textview.py Sun Oct 25 15:06:37 2015 +0100 @@ -125,7 +125,7 @@ if not parent: self._disconnect_signals() return - if isinstance(parent, gtk.EventBox): + if isinstance(parent, Gtk.EventBox): parent = parent.get_parent() if not parent: self._disconnect_signals()