[Pkg-mozext-commits] [tabmixplus] 15/44: Show missing tabview notification on all windows, close all notification when user close it in one window

David Prévot taffit at moszumanska.debian.org
Fri Mar 18 20:57:15 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository tabmixplus.

commit 0217a98cf76f41628d69acfbce37a092a91b2dd5
Author: onemen <tabmix.onemen at gmail.com>
Date:   Sun Feb 28 21:40:23 2016 +0200

    Show missing tabview notification on all windows, close all notification when user close it in one window
---
 chrome/content/session/session.js |  4 ++++
 modules/TabGroupsMigrator.jsm     | 28 ++++++++++++++++++++++++----
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index 3f0f99e..235fd87 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -403,6 +403,10 @@ TabmixSessionManager = {
 
       Tabmix.prefs.clearUserPref("warnAboutClosingTabs.timeout");
     } else if (this.enableManager && "tabmixdata" in window) {
+      let show = TabmixSvc.sm.showMissingTabViewNotification;
+      if (show) {
+        this.TabmixGroupsMigrator.missingTabViewNotification(window, show.msg);
+      }
       let path = window.tabmixdata.path;
       let caller = window.tabmixdata.caller;
 
diff --git a/modules/TabGroupsMigrator.jsm b/modules/TabGroupsMigrator.jsm
index 1f9974d..20c6e51 100644
--- a/modules/TabGroupsMigrator.jsm
+++ b/modules/TabGroupsMigrator.jsm
@@ -72,6 +72,7 @@ this.TabmixGroupsMigrator = {
         saveSessions("crashed", 0);
       }
       if (notify) {
+        TabmixSvc.sm.showMissingTabViewNotification = {msg: string("msg")};
         this.missingTabViewNotification(window, string("msg"));
       }
     } catch (ex) {
@@ -79,13 +80,26 @@ this.TabmixGroupsMigrator = {
     }
   },
 
+  getNotificationBox: function(doc) {
+    return doc.getElementById("high-priority-global-notificationbox") ||
+      doc.getElementById("global-notificationbox");
+  },
+
+  closeNotificationFromAllWindows: function() {
+    TabmixSvc.forEachBrowserWindow(aWindow => {
+      let notificationBox = this.getNotificationBox(aWindow.document);
+      let notification = notificationBox.getNotificationWithValue("tabmix-missing-tabview");
+      if (notification) {
+        notificationBox.removeNotification(notification);
+      }
+    });
+  },
+
   missingTabViewNotification: function(win, backup = "") {
     let string = s => TabmixSvc.getSMString("sm.tabview." + s);
-    let doc = win.document;
 
     // If there's already an existing notification bar, don't do anything.
-    let notificationBox = doc.getElementById("high-priority-global-notificationbox") ||
-                          doc.getElementById("global-notificationbox");
+    let notificationBox = this.getNotificationBox(win.document);
     let notification = notificationBox.getNotificationWithValue("tabmix-missing-tabview");
     if (notification) {
       if (notification.tabmixSavedBackup) {
@@ -123,7 +137,13 @@ this.TabmixGroupsMigrator = {
       "tabmix-missing-tabview",
       "chrome://tabmixplus/skin/tmpsmall.png",
       notificationBox.PRIORITY_WARNING_MEDIUM,
-      buttons
+      buttons,
+      (aEventType) => {
+        if (aEventType == "removed") {
+          TabmixSvc.sm.showMissingTabViewNotification = null;
+          this.closeNotificationFromAllWindows();
+        }
+      }
     );
     if (backup) {
       notification.tabmixSavedBackup = true;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git



More information about the Pkg-mozext-commits mailing list