diff --git a/gajim/chat_control.py b/gajim/chat_control.py
index f10487df4..9bb62c40a 100644
--- a/gajim/chat_control.py
+++ b/gajim/chat_control.py
@@ -669,19 +669,14 @@ class ChatControl(ChatControlBase):
status_reduced = ''
status_escaped = GLib.markup_escape_text(status_reduced)
- st = app.config.get('displayed_chat_state_notifications')
if self.TYPE_ID == 'pm':
cs = self.gc_contact.chatstate
else:
cs = app.contacts.get_combined_chatstate(
self.account, self.contact.jid)
- if cs and st in ('composing_only', 'all'):
- if contact.show == 'offline':
- chatstate = ''
- elif st == 'all' or cs == 'composing':
- chatstate = helpers.get_uf_chatstate(cs)
- else:
- chatstate = ''
+
+ if app.config.get('show_chatstate_in_banner'):
+ chatstate = helpers.get_uf_chatstate(cs)
label_text = '%s%s %s' \
% (name, acct_info, chatstate)
diff --git a/gajim/common/config.py b/gajim/common/config.py
index ca12c578a..88001fd50 100644
--- a/gajim/common/config.py
+++ b/gajim/common/config.py
@@ -187,7 +187,6 @@ class Config:
'always_english_wiktionary': [opt_bool, True],
'remote_control': [opt_bool, False, _('If checked, Gajim can be controlled remotely using gajim-remote.'), True],
'outgoing_chat_state_notifications': [opt_str, 'all', _('Sent chat state notifications. Can be one of all, composing_only, disabled.')],
- 'displayed_chat_state_notifications': [opt_str, 'all', _('Displayed chat state notifications in chat windows. Can be one of all, composing_only, disabled.')],
'autodetect_browser_mailer': [opt_bool, True, '', True],
'print_ichat_every_foo_minutes': [opt_int, 5, _('When not printing time for every message (print_time==sometimes), print it every x minutes.')],
'confirm_close_muc': [opt_bool, True, _('Ask before closing a group chat tab/window.')],
@@ -296,6 +295,9 @@ class Config:
'public_room_sync_threshold': [opt_int, 1, _('Maximum history in days we request from a public room archive. 0: As much as possible')],
'private_room_sync_threshold': [opt_int, 0, _('Maximum history in days we request from a private room archive. 0: As much as possible')],
'show_subject_on_join': [opt_bool, True, _('If the room subject is shown in chat on join')],
+ 'show_chatstate_in_roster': [opt_bool, True, _('If the contact row is colored according to the current chatstate of the contact')],
+ 'show_chatstate_in_tabs': [opt_bool, True, _('If the tab is colored according to the current chatstate of the contact')],
+ 'show_chatstate_in_banner': [opt_bool, True, _('Shows a text in the banner that describes the current chatstate of the contact')],
}, {}) # type: Tuple[Dict[str, List[Any]], Dict[Any, Any]]
__options_per_key = {
diff --git a/gajim/data/gui/preferences_window.ui b/gajim/data/gui/preferences_window.ui
index 618c17fda..7a726ebc8 100644
--- a/gajim/data/gui/preferences_window.ui
+++ b/gajim/data/gui/preferences_window.ui
@@ -737,43 +737,6 @@
0
-
-
-
- 0
- 1
-
-
-
-
-
- 1
- 1
-
-
False
@@ -802,6 +765,100 @@
0
+
+
+ True
+ False
+ 0
+ none
+
+
+ True
+ False
+ 0
+
+
+ True
+ False
+ 6
+ vertical
+ 6
+
+
+ Show chatstate in tabs
+ True
+ True
+ False
+ If checked, the tab will be colored according to the current chatstate of the contact
+ start
+ True
+ True
+
+
+
+ False
+ True
+ 0
+
+
+
+
+ Show chatstate in roster
+ True
+ True
+ False
+ If checked, the contact row will be colored according to the current chatstate of the contact
+ start
+ True
+ True
+
+
+
+ False
+ True
+ 1
+
+
+
+
+ Show chatstate in banner
+ True
+ True
+ False
+ If checked, a desciption of the contacts current chatstate is shown in the banner
+ start
+ True
+ True
+
+
+
+ False
+ True
+ 2
+
+
+
+
+
+
+
+
+ True
+ False
+ Chatstate
+
+
+
+
+
+ False
+ True
+ 1
+
+
chat
diff --git a/gajim/gtk/preferences.py b/gajim/gtk/preferences.py
index 9ba5b79fc..4f177b654 100644
--- a/gajim/gtk/preferences.py
+++ b/gajim/gtk/preferences.py
@@ -157,13 +157,14 @@ class Preferences(Gtk.ApplicationWindow):
self._ui.print_status_in_muc_combobox.set_active(2)
# Displayed chat state notifications
- st = app.config.get('displayed_chat_state_notifications')
- if st == 'all':
- self._ui.displayed_chat_states_combobox.set_active(0)
- elif st == 'composing_only':
- self._ui.displayed_chat_states_combobox.set_active(1)
- else: # disabled
- self._ui.displayed_chat_states_combobox.set_active(2)
+ st = app.config.get('show_chatstate_in_tabs')
+ self._ui.show_chatstate_in_tabs.set_active(st)
+
+ st = app.config.get('show_chatstate_in_roster')
+ self._ui.show_chatstate_in_roster.set_active(st)
+
+ st = app.config.get('show_chatstate_in_banner')
+ self._ui.show_chatstate_in_banner.set_active(st)
### Notifications tab ###
## Visual Notifications
@@ -612,15 +613,14 @@ class Preferences(Gtk.ApplicationWindow):
else: # in_and_out
app.config.set('print_status_in_muc', 'in_and_out')
- def on_displayed_chat_states_combobox_changed(self, widget):
- active = widget.get_active()
- if active == 0: # all
- app.config.set('displayed_chat_state_notifications', 'all')
- elif active == 1: # only composing
- app.config.set('displayed_chat_state_notifications',
- 'composing_only')
- else: # disabled
- app.config.set('displayed_chat_state_notifications', 'disabled')
+ def on_show_chatstate_in_tabs_toggled(self, widget):
+ self.on_checkbutton_toggled(widget, 'show_chatstate_in_tabs')
+
+ def on_show_chatstate_in_roster_toggled(self, widget):
+ self.on_checkbutton_toggled(widget, 'show_chatstate_in_roster')
+
+ def on_show_chatstate_in_banner_toggled(self, widget):
+ self.on_checkbutton_toggled(widget, 'show_chatstate_in_banner')
### Notifications tab ###
def on_systray_combobox_changed(self, widget):
diff --git a/gajim/message_window.py b/gajim/message_window.py
index cb23c2c53..799cd27f6 100644
--- a/gajim/message_window.py
+++ b/gajim/message_window.py
@@ -652,7 +652,9 @@ class MessageWindow:
if isinstance(ctrl, ChatControl):
tab_label_str = ctrl.get_tab_label()
# Set Label Color
- gtkgui_helpers.add_css_class(nick_label, chatstate, 'gajim-state-')
+ if app.config.get('show_chatstate_in_tabs'):
+ gtkgui_helpers.add_css_class(
+ nick_label, chatstate, 'gajim-state-')
else:
tab_label_str, color = ctrl.get_tab_label(chatstate)
# Set Label Color
diff --git a/gajim/roster_window.py b/gajim/roster_window.py
index a04f6afb2..aa9a06a39 100644
--- a/gajim/roster_window.py
+++ b/gajim/roster_window.py
@@ -4639,6 +4639,11 @@ class RosterWindow:
gtkgui_helpers.set_unset_urgency_hint(self.window, nb_unread)
+ def _nec_chatstate_received(self, event):
+ if event.contact.is_gc_contact or event.contact.is_pm_contact:
+ return
+ self.draw_contact(event.contact.jid, event.account)
+
def _style_changed(self, *args):
self.change_roster_style(None)
@@ -4741,17 +4746,22 @@ class RosterWindow:
return
jid = model[titer][Column.JID]
account = model[titer][Column.ACCOUNT]
+
color = None
if type_ == 'groupchat':
- ctrl = app.interface.minimized_controls[account].get(jid,
- None)
+ ctrl = app.interface.minimized_controls[account].get(jid, None)
if ctrl and ctrl.attention_flag:
color = app.css_config.get_value(
'.state_muc_directed_msg_color', StyleAttr.COLOR)
- renderer.set_property('foreground', color)
- if not color:
- color = app.css_config.get_value('.gajim-contact-row', StyleAttr.COLOR)
- renderer.set_property('foreground', color)
+ elif app.config.get('show_chatstate_in_roster'):
+ chatstate = app.contacts.get_combined_chatstate(account, jid)
+ if chatstate not in (None, 'active'):
+ color = app.css_config.get_value(
+ '.gajim-state-%s' % chatstate, StyleAttr.COLOR)
+ else:
+ color = app.css_config.get_value(
+ '.gajim-contact-row', StyleAttr.COLOR)
+ renderer.set_property('foreground', color)
self._set_contact_row_background_color(renderer, jid, account)
desc = app.css_config.get_font('.gajim-contact-row')
@@ -5886,3 +5896,5 @@ class RosterWindow:
self._nec_blocking)
app.ged.register_event_handler('style-changed', ged.GUI1,
self._style_changed)
+ app.ged.register_event_handler('chatstate-received', ged.GUI1,
+ self._nec_chatstate_received)