diff --git a/data/gui/preferences_window.ui b/data/gui/preferences_window.ui
index 917b9e15d..c73835a00 100644
--- a/data/gui/preferences_window.ui
+++ b/data/gui/preferences_window.ui
@@ -682,6 +682,23 @@
3
+
+
+
+ False
+ False
+ 4
+
+
@@ -791,7 +808,7 @@
False
True
- 5
+ 6
diff --git a/src/common/config.py b/src/common/config.py
index 4d6ad1de5..1f07f6a99 100644
--- a/src/common/config.py
+++ b/src/common/config.py
@@ -73,6 +73,7 @@ class Config:
'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 --git a/src/common/connection_handlers_events.py b/src/common/connection_handlers_events.py
index 4cd91e97e..96a8bc8ef 100644
--- a/src/common/connection_handlers_events.py
+++ b/src/common/connection_handlers_events.py
@@ -2302,7 +2302,7 @@ class NotificationEvent(nec.NetworkIncomingEvent):
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 @@ class NotificationEvent(nec.NetworkIncomingEvent):
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 --git a/src/config.py b/src/config.py
index bc8883421..5fd8f3c84 100644
--- a/src/config.py
+++ b/src/config.py
@@ -97,36 +97,38 @@ class PreferencesWindow:
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 @@ class PreferencesWindow:
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 @@ class PreferencesWindow:
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 --git a/src/conversation_textview.py b/src/conversation_textview.py
index a39fec1eb..0a71a49e6 100644
--- a/src/conversation_textview.py
+++ b/src/conversation_textview.py
@@ -125,7 +125,7 @@ class TextViewImage(Gtk.Image):
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()