From 452f8bea2bf58a9a38f619969f7adf1fc3f86749 Mon Sep 17 00:00:00 2001 From: Jean-Marie Traissard Date: Sat, 30 Sep 2006 14:28:10 +0000 Subject: [PATCH] Count only gc HIGHLIGHTED messages, except if notify_o_all_muc_meessages. Show count in tab. Note that this disable previous inconsistent behaviour where all gc_messages were counted in systray whereas tray icon was not animated. notify_on_all_muc_messages can still be used for that. --- src/chat_control.py | 12 +++++++++--- src/groupchat_control.py | 25 +++++++++++++++---------- src/roster_window.py | 2 +- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index 1056ecb80..e42a1f289 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -112,7 +112,7 @@ class ChatControlBase(MessageControl): acct, resource = None): MessageControl.__init__(self, type_id, parent_win, widget_name, display_names, contact, acct, resource = resource); - # when/if we do XHTML we will but formatting buttons back + # when/if we do XHTML we will put formatting buttons back widget = self.xml.get_widget('emoticons_button') id = widget.connect('clicked', self.on_emoticons_button_clicked) self.handlers[id] = widget @@ -554,9 +554,15 @@ class ChatControlBase(MessageControl): full_jid != self.parent_win.get_active_jid() or \ not self.parent_win.is_active() or not end) and \ kind in ('incoming', 'incoming_queue'): - if self.notify_on_new_messages(): + gc_message = False + if self.type_id == message_control.TYPE_GC: + gc_message = True + if self.notify_on_new_messages() or \ + (gc_message and other_tags_for_text == ['marked']): + # we want to have save this message in events list + # other_tags_for_text == ['marked'] --> highlighted gc message type_ = 'printed_' + self.type_id - if self.type_id == message_control.TYPE_GC: + if gc_message: type_ = 'printed_gc_msg' show_in_roster = notify.get_show_in_roster('message_received', self.account, self.contact) diff --git a/src/groupchat_control.py b/src/groupchat_control.py index 8cb80f410..519117df6 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -322,8 +322,7 @@ class GroupchatControl(ChatControlBase): menu.show_all() def notify_on_new_messages(self): - return gajim.config.get('notify_on_all_muc_messages') or \ - self.attention_flag + return gajim.config.get('notify_on_all_muc_messages') def on_treeview_size_allocate(self, widget, allocation): '''The MUC treeview has resized. Move the hpaned in all tabs to match''' @@ -390,21 +389,27 @@ class GroupchatControl(ChatControlBase): color = gtk.gdk.colormap_get_system().alloc_color(color_name) label_str = self.name + + # count waiting highlighted messages + unread = '' + jid = self.contact.jid + num_unread = len(gajim.events.get_events(self.account, jid, + ['printed_gc_msg'])) + if num_unread > 1: + unread = '[' + unicode(num_unread) + ']' + label_str = unread + label_str return (label_str, color) def get_tab_image(self): - # Set tab image (always 16x16); unread messages show the 'message' image + # Set tab image (always 16x16) img_16 = gajim.interface.roster.get_appropriate_state_images( - self.room_jid, icon_name = 'message') + self.room_jid) tab_image = None - if self.attention_flag and gajim.config.get('show_unread_tab_icon'): - tab_image = img_16['message'] + if gajim.gc_connected[self.account][self.room_jid]: + tab_image = img_16['muc_active'] else: - if gajim.gc_connected[self.account][self.room_jid]: - tab_image = img_16['muc_active'] - else: - tab_image = img_16['muc_inactive'] + tab_image = img_16['muc_inactive'] return tab_image def update_ui(self): diff --git a/src/roster_window.py b/src/roster_window.py index 23055b0b0..250ae15bc 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -464,7 +464,7 @@ class RosterWindow: def get_appropriate_state_images(self, jid, size = '16', icon_name = 'online'): '''check jid and return the appropriate state images dict for - the demanded size. icon_name is taken into account when jis is from + the demanded size. icon_name is taken into account when jid is from transport: transport iconset doesn't contain all icons, so we fall back to jabber one''' transport = gajim.get_transport_name_from_jid(jid)