Yann Leboulanger pushed to branch master at gajim / gajim
Commits:
07ba85b4 by Yann Leboulanger at 2017-08-20T23:07:58+02:00
Ability to be notified on all message. Option is now perroom. Fixes #8646
- - - - -
6 changed files:
- data/gui/gc_control_popup_menu.ui
- gajim/chat_control_base.py
- gajim/common/config.py
- gajim/groupchat_control.py
- gajim/message_window.py
- gajim/notify.py
Changes:
=====================================
data/gui/gc_control_popup_menu.ui
=====================================
--- a/data/gui/gc_control_popup_menu.ui
+++ b/data/gui/gc_control_popup_menu.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkMenu" id="gc_control_popup_menu">
@@ -66,6 +66,13 @@
</object>
</child>
<child>
+ <object class="GtkCheckMenuItem" id="notify_menuitem">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Notify on all
messages</property>
+ </object>
+ </child>
+ <child>
<object class="GtkSeparatorMenuItem" id="request_voice_separator">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
=====================================
gajim/chat_control_base.py
=====================================
--- a/gajim/chat_control_base.py
+++ b/gajim/chat_control_base.py
@@ -957,6 +957,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor,
CommandTools):
if kind == 'incoming':
if not self.type_id == message_control.TYPE_GC or \
app.config.get('notify_on_all_muc_messages') or \
+ app.config.get_per('rooms', jid, 'notify_on_all_messages') or \
'marked' in other_tags_for_text:
# it's a normal message, or a muc message with want to be
# notified about if quitting just after
@@ -1141,6 +1142,10 @@ class ChatControlBase(MessageControl,
ChatCommandProcessor, CommandTools):
app.config.set_per('accounts', self.account, 'non_minimized_gc',
' '.join(non_minimized_gc))
+ def on_notify_menuitem_toggled(self, widget):
+ app.config.set_per('rooms', self.contact.jid, 'notify_on_all_messages',
+ widget.get_active())
+
def set_control_active(self, state):
if state:
self.set_emoticon_popover()
=====================================
gajim/common/config.py
=====================================
--- a/gajim/common/config.py
+++ b/gajim/common/config.py
@@ -492,6 +492,7 @@ class Config:
'speller_language': [ opt_str, '', _('Language for which
we want to check misspelled words')],
'muc_restore_lines': [opt_int, -2, _('How many lines to
request from server when entering a groupchat. -1 means no limit, -2 means
global value')],
'muc_restore_timeout': [opt_int, -2, _('Minutes of backlog
to request when entering a groupchat. -1 means no limit, -2 means global
value')],
+ 'notify_on_all_messages': [opt_bool, False, _('State
whether we want a notification for every message in this room')],
}, {}),
'plugins': ({
'active': [opt_bool, False, _('State whether plugins should be
activated on startup (this is saved on Gajim exit). This option SHOULD NOT be
used to (de)activate plug-ins. Use GUI instead.')],
=====================================
gajim/groupchat_control.py
=====================================
--- a/gajim/groupchat_control.py
+++ b/gajim/groupchat_control.py
@@ -905,6 +905,7 @@ class GroupchatControl(ChatControlBase):
history_menuitem = xml.get_object('history_menuitem')
disconnect_menuitem = xml.get_object('disconnect_menuitem')
minimize_menuitem = xml.get_object('minimize_menuitem')
+ notify_menuitem = xml.get_object('notify_menuitem')
request_voice_menuitem = xml.get_object('request_voice_menuitem')
bookmark_separator = xml.get_object('bookmark_separator')
separatormenuitem2 = xml.get_object('separatormenuitem2')
@@ -943,6 +944,8 @@ class GroupchatControl(ChatControlBase):
if self.contact.jid not in app.config.get_per('accounts', self.account,
'non_minimized_gc').split(' '):
minimize_menuitem.set_active(True)
+ notify_menuitem.set_active(app.config.get_per('rooms',
self.contact.jid,
+ 'notify_on_all_messages'))
conn = app.connections[self.account]
if not conn.private_storage_supported and (not conn.pubsub_supported
or \
not conn.pubsub_publish_options_supported):
@@ -1009,6 +1012,10 @@ class GroupchatControl(ChatControlBase):
self.on_minimize_menuitem_toggled)
self.handlers[id_] = minimize_menuitem
+ id_ = notify_menuitem.connect('toggled',
+ self.on_notify_menuitem_toggled)
+ self.handlers[id_] = notify_menuitem
+
menu.connect('selection-done', self.destroy_menu,
change_nick_menuitem, change_subject_menuitem,
bookmark_room_menuitem, history_menuitem)
@@ -1245,7 +1252,8 @@ class GroupchatControl(ChatControlBase):
def get_nb_unread(self):
type_events = ['printed_marked_gc_msg']
- if app.config.get('notify_on_all_muc_messages'):
+ if app.config.get('notify_on_all_muc_messages') or \
+ app.config.get_per('rooms', self.room_jid, 'notify_on_all_messages'):
type_events.append('printed_gc_msg')
nb = len(app.events.get_events(self.account, self.room_jid,
type_events))
=====================================
gajim/message_window.py
=====================================
--- a/gajim/message_window.py
+++ b/gajim/message_window.py
@@ -501,7 +501,8 @@ class MessageWindow(object):
for ctrl in self.controls():
if ctrl.type_id == message_control.TYPE_GC and not \
app.config.get('notify_on_all_muc_messages') and not \
- ctrl.attention_flag:
+ app.config.get_per('rooms', ctrl.room_jid,
+ 'notify_on_all_messages') and not ctrl.attention_flag:
# count only pm messages
unread += ctrl.get_nb_unread_pm()
continue
@@ -518,7 +519,9 @@ class MessageWindow(object):
if control.type_id == message_control.TYPE_GC:
name = control.room_jid.split('@')[0]
urgent = control.attention_flag or \
- app.config.get('notify_on_all_muc_messages')
+ app.config.get('notify_on_all_muc_messages') or \
+ app.config.get_per('rooms', control.room_jid,
+ 'notify_on_all_messages')
else:
name = control.contact.get_shown_name()
if control.resource:
=====================================
gajim/notify.py
=====================================
--- a/gajim/notify.py
+++ b/gajim/notify.py
@@ -68,7 +68,8 @@ def get_show_in_systray(event, account, contact, type_=None):
Return True if this event must be shown in systray, else False
"""
if type_ == 'printed_gc_msg' and not app.config.get(
- 'notify_on_all_muc_messages'):
+ 'notify_on_all_muc_messages') and not app.config.get_per('rooms',
+ contact.jid, 'notify_on_all_messages'):
# it's not an highlighted message, don't show in systray
return False
return app.config.get('trayicon_notification_on_events')
View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/07ba85b45675990f0a9de46b22ffd2df93df5a74
---
View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/07ba85b45675990f0a9de46b22ffd2df93df5a74
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits