diff src/browser/libervia_main.py @ 834:2491898b3041

browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
author souliane <souliane@mailoo.org>
date Tue, 12 Jan 2016 17:59:07 +0100
parents f8a7a046ff9c
children a964ff397484
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Tue Jan 12 16:55:43 2016 +0100
+++ b/src/browser/libervia_main.py	Tue Jan 12 17:59:07 2016 +0100
@@ -47,6 +47,7 @@
 from sat_browser import register
 from sat_browser.contact_list import ContactList
 from sat_browser import main_panel
+from sat_browser import chat
 from sat_browser import blog
 from sat_browser import xmlui
 from sat_browser import dialog
@@ -87,8 +88,8 @@
         self._register_box = None
         RootPanel().add(self.panel)
 
-        self.notification = notification.Notification()
         self.alerts_counter = notification.FaviconCounter()
+        self.notification = notification.Notification(self.alerts_counter)
         DOM.addEventPreview(self)
         self.importPlugins()
         self._register = json.RegisterCall()
@@ -272,9 +273,6 @@
             panel = self.tab_panel.deck.getWidget(tab_index)
         panel.addWidget(wid)
 
-    def displayNotification(self, title, body):
-        self.notification.notify(title, body)
-
     def gotMenus(self, backend_menus):
         """Put the menus data in cache and build the main menu bar
 
@@ -612,11 +610,20 @@
     def _newAlert(self, message, title, alert_type):
         dialog.InfoDialog(title, message).show()
 
-    def updateAlertsCounter(self):
+    def isHidden(self):
+        """Tells if the frontend window is hidden.
+
+        @return bool
+        """
+        return self.notification.isHidden()
+
+    def updateAlertsCounter(self, extra_inc=0):
         """Update the over whole alerts counter
 
+        @param extra_inc (int): extra counter
         """
-        self.alerts_counter.update(self.alerts_count)
+        extra = self.alerts_counter.extra + extra_inc
+        self.alerts_counter.update(self.alerts_count, extra=extra)
 
     def _paramUpdate(self, name, value, category, refresh=True):
         """This is called when the paramUpdate signal is received, but also