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.
This commit is contained in:
Jean-Marie Traissard 2006-09-30 14:28:10 +00:00
parent e8c152dc38
commit 452f8bea2b
3 changed files with 25 additions and 14 deletions

View File

@ -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)

View File

@ -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):

View File

@ -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)