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:
parent
e8c152dc38
commit
452f8bea2b
3 changed files with 25 additions and 14 deletions
|
@ -112,7 +112,7 @@ class ChatControlBase(MessageControl):
|
||||||
acct, resource = None):
|
acct, resource = None):
|
||||||
MessageControl.__init__(self, type_id, parent_win, widget_name,
|
MessageControl.__init__(self, type_id, parent_win, widget_name,
|
||||||
display_names, contact, acct, resource = resource);
|
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')
|
widget = self.xml.get_widget('emoticons_button')
|
||||||
id = widget.connect('clicked', self.on_emoticons_button_clicked)
|
id = widget.connect('clicked', self.on_emoticons_button_clicked)
|
||||||
self.handlers[id] = widget
|
self.handlers[id] = widget
|
||||||
|
@ -554,9 +554,15 @@ class ChatControlBase(MessageControl):
|
||||||
full_jid != self.parent_win.get_active_jid() or \
|
full_jid != self.parent_win.get_active_jid() or \
|
||||||
not self.parent_win.is_active() or not end) and \
|
not self.parent_win.is_active() or not end) and \
|
||||||
kind in ('incoming', 'incoming_queue'):
|
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
|
type_ = 'printed_' + self.type_id
|
||||||
if self.type_id == message_control.TYPE_GC:
|
if gc_message:
|
||||||
type_ = 'printed_gc_msg'
|
type_ = 'printed_gc_msg'
|
||||||
show_in_roster = notify.get_show_in_roster('message_received',
|
show_in_roster = notify.get_show_in_roster('message_received',
|
||||||
self.account, self.contact)
|
self.account, self.contact)
|
||||||
|
|
|
@ -322,8 +322,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
menu.show_all()
|
menu.show_all()
|
||||||
|
|
||||||
def notify_on_new_messages(self):
|
def notify_on_new_messages(self):
|
||||||
return gajim.config.get('notify_on_all_muc_messages') or \
|
return gajim.config.get('notify_on_all_muc_messages')
|
||||||
self.attention_flag
|
|
||||||
|
|
||||||
def on_treeview_size_allocate(self, widget, allocation):
|
def on_treeview_size_allocate(self, widget, allocation):
|
||||||
'''The MUC treeview has resized. Move the hpaned in all tabs to match'''
|
'''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)
|
color = gtk.gdk.colormap_get_system().alloc_color(color_name)
|
||||||
|
|
||||||
label_str = self.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)
|
return (label_str, color)
|
||||||
|
|
||||||
def get_tab_image(self):
|
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(
|
img_16 = gajim.interface.roster.get_appropriate_state_images(
|
||||||
self.room_jid, icon_name = 'message')
|
self.room_jid)
|
||||||
|
|
||||||
tab_image = None
|
tab_image = None
|
||||||
if self.attention_flag and gajim.config.get('show_unread_tab_icon'):
|
if gajim.gc_connected[self.account][self.room_jid]:
|
||||||
tab_image = img_16['message']
|
tab_image = img_16['muc_active']
|
||||||
else:
|
else:
|
||||||
if gajim.gc_connected[self.account][self.room_jid]:
|
tab_image = img_16['muc_inactive']
|
||||||
tab_image = img_16['muc_active']
|
|
||||||
else:
|
|
||||||
tab_image = img_16['muc_inactive']
|
|
||||||
return tab_image
|
return tab_image
|
||||||
|
|
||||||
def update_ui(self):
|
def update_ui(self):
|
||||||
|
|
|
@ -464,7 +464,7 @@ class RosterWindow:
|
||||||
def get_appropriate_state_images(self, jid, size = '16',
|
def get_appropriate_state_images(self, jid, size = '16',
|
||||||
icon_name = 'online'):
|
icon_name = 'online'):
|
||||||
'''check jid and return the appropriate state images dict for
|
'''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
|
transport: transport iconset doesn't contain all icons, so we fall back
|
||||||
to jabber one'''
|
to jabber one'''
|
||||||
transport = gajim.get_transport_name_from_jid(jid)
|
transport = gajim.get_transport_name_from_jid(jid)
|
||||||
|
|
Loading…
Add table
Reference in a new issue