diff frontends/src/primitivus/contact_list.py @ 1658:683b76c1145d

quick_frontend, primitivus: display the number of alerts for each contact and not only a symbol (*)
author souliane <souliane@mailoo.org>
date Tue, 24 Nov 2015 13:31:28 +0100
parents 8a7145138330
children d17772b0fe22
line wrap: on
line diff
--- a/frontends/src/primitivus/contact_list.py	Tue Nov 24 10:39:22 2015 +0100
+++ b/frontends/src/primitivus/contact_list.py	Tue Nov 24 13:31:28 2015 +0100
@@ -136,7 +136,7 @@
         @param selected: boolean returned by the widget, telling if it is selected
         """
         entity = contact_wid.data
-        self.removeAlert(entity, use_bare_jid)
+        self.removeAlerts(entity, use_bare_jid)
         self.host.modeHint(C.MODE_INSERTION)
         self._emit('click', entity)
 
@@ -163,10 +163,8 @@
         """
         markup = []
         if use_bare_jid:
-            alerts = {entity.bare for entity in self._alerts}
             selected = {entity.bare for entity in self._selected}
         else:
-            alerts = self._alerts
             selected = self._selected
         if keys is None:
             entity_txt = entity
@@ -191,9 +189,10 @@
         else:
             entity_attr = 'default'
 
-        if with_alert and entity in alerts:
+        alerts_count = self.getAlerts(entity, use_bare_jid=use_bare_jid)
+        if with_alert and alerts_count:
             entity_attr = 'alert'
-            header = C.ALERT_HEADER
+            header = C.ALERT_HEADER % alerts_count
         else:
             header = ''