show the number of unread messages in the systray tooltip
This commit is contained in:
parent
068d75dbc1
commit
ec0950075f
1 changed files with 30 additions and 0 deletions
|
@ -65,12 +65,42 @@ class systray:
|
||||||
if not list in self.jids:
|
if not list in self.jids:
|
||||||
self.jids.append(list)
|
self.jids.append(list)
|
||||||
self.set_img()
|
self.set_img()
|
||||||
|
#we look for the number of unread messages
|
||||||
|
#in roster
|
||||||
|
nb = self.plugin.roster.nb_unread
|
||||||
|
for acct in self.plugin.accounts:
|
||||||
|
#in chat / groupchat windows
|
||||||
|
for kind in ['chats', 'gc']:
|
||||||
|
for jid in self.plugin.windows[acct][kind]:
|
||||||
|
if jid != 'tabbed':
|
||||||
|
nb += self.plugin.windows[acct][kind][jid].nb_unread[jid]
|
||||||
|
if nb > 1:
|
||||||
|
label = _('Gajim - %s unread messages') % nb
|
||||||
|
else:
|
||||||
|
label = _('Gajim - 1 unread message')
|
||||||
|
self.tip.set_tip(self.t, label)
|
||||||
|
|
||||||
def remove_jid(self, jid, account):
|
def remove_jid(self, jid, account):
|
||||||
list = [account, jid]
|
list = [account, jid]
|
||||||
if list in self.jids:
|
if list in self.jids:
|
||||||
self.jids.remove(list)
|
self.jids.remove(list)
|
||||||
self.set_img()
|
self.set_img()
|
||||||
|
#we look for the number of unread messages
|
||||||
|
#in roster
|
||||||
|
nb = self.plugin.roster.nb_unread
|
||||||
|
for acct in self.plugin.accounts:
|
||||||
|
#in chat / groupchat windows
|
||||||
|
for kind in ['chats', 'gc']:
|
||||||
|
for jid in self.plugin.windows[acct][kind]:
|
||||||
|
if jid != 'tabbed':
|
||||||
|
nb += self.plugin.windows[acct][kind][jid].nb_unread[jid]
|
||||||
|
if nb > 1:
|
||||||
|
label = _('Gajim - %s unread messages') % nb
|
||||||
|
elif nb == 1:
|
||||||
|
label = _('Gajim - 1 unread message')
|
||||||
|
else:
|
||||||
|
label = 'Gajim'
|
||||||
|
self.tip.set_tip(self.t, label)
|
||||||
|
|
||||||
def set_status(self, status):
|
def set_status(self, status):
|
||||||
self.status = status
|
self.status = status
|
||||||
|
|
Loading…
Add table
Reference in a new issue