[Pkg-mozext-commits] [firetray] 07/22: * AppIndicator: disable chat icon (TB). * AppIndicator: disable new message count option (TB).

David Prévot taffit at moszumanska.debian.org
Wed Dec 31 17:04:38 UTC 2014


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

taffit pushed a commit to branch master
in repository firetray.

commit 58130c5a7d638933000386380cb15a467dbabc98
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Fri Nov 21 11:13:12 2014 +0100

    * AppIndicator: disable chat icon (TB).
    * AppIndicator: disable new message count option (TB).
---
 src/chrome/content/options.js   | 78 ++++++++++++++++++++++++++---------------
 src/modules/FiretrayHandler.jsm | 14 ++++----
 src/modules/commons.js          | 15 ++++----
 3 files changed, 62 insertions(+), 45 deletions(-)

diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index 3c9a730..67809f0 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -38,7 +38,8 @@ var firetrayUIOptions = {
     }
 
     if (firetray.Handler.isChatProvided() &&
-        FIRETRAY_CHAT_SUPPORTED_OS.indexOf(firetray.Handler.runtimeOS) > -1) {
+        firetray.Handler.support['chat'] &&
+        !firetray.AppIndicator) {
       Cu.import("resource://firetray/"+firetray.Handler.runtimeOS+"/FiretrayChat.jsm");
       this.initChatControls();
     } else {
@@ -48,13 +49,22 @@ var firetrayUIOptions = {
     this.updateWindowAndIconOptions();
     this.updateScrollOptions();
     this.initAppIconType();
-    if (firetray.Handler.support['full_feat']) {
+    if (firetray.Handler.support['winnt']) {
+      this.hideUnsupportedOptions([
+        'ui_hides_last_only', 'ui_show_activates', 'ui_remember_desktop',
+        'app_icon_default', 'ui_show_icon_on_hide', 'ui_scroll_hides',
+        'ui_radiogroup_scroll', 'ui_scroll_hides', 'newmail_icon_names'
+      ]);
+    } else if (firetray.AppIndicator) {
+      this.hideUnsupportedOptions([
+        'app_icon_default', 'ui_mail_notification_unread_count',
+        'newmail_icon_names'
+      ]);
+    } else {
       this.initAppIconNames();
       if (firetray.Handler.inMailApp)
         this.initNewMailIconNames();
-    } else {
-      this.hideUnsupportedOptions();
-    };
+    }
 
     window.sizeToContent();
   },
@@ -66,26 +76,38 @@ var firetrayUIOptions = {
     }
   },
 
-  hideUnsupportedOptions: function() { // full_feat
-    // windows prefs
-    ['ui_hides_last_only', 'ui_show_activates', 'ui_remember_desktop']
-      .forEach(function(id){
-       document.getElementById(id).hidden = true;
-     });
-
-    // icon prefs
-    ['app_icon_default', 'ui_show_icon_on_hide', 'ui_scroll_hides',
-     'ui_radiogroup_scroll'].forEach(function(id){
-       document.getElementById(id).hidden = true;
-     });
-    document.getElementById("ui_scroll_hides").removeAttribute("oncommand");
-
-    // mail prefs
-    document.getElementById("newmail_icon_names").hidden = true;
-    for (let i=1; i<4; ++i) {
-      document.getElementById("radio_mail_notification_newmail_icon_name"+i).
-        setAttribute("observes", void(0));
-    }
+  hideUnsupportedOptions: function(uiElts) {
+    uiElts.forEach(function(id){
+      switch(id){
+        // windows prefs
+      case 'ui_hides_last_only':
+      case 'ui_show_activates':
+      case 'ui_remember_desktop':
+        // icon prefs
+      case 'app_icon_default':
+      case 'ui_show_icon_on_hide':
+      case 'ui_scroll_hides':
+      case 'ui_radiogroup_scroll':
+        document.getElementById(id).hidden = true;
+        break;
+      case 'ui_scroll_hides':
+        document.getElementById(id).removeAttribute("oncommand");
+        break;
+        // mail prefs
+      case 'newmail_icon_names':
+        for (let i=1; i<4; ++i) {
+          document.getElementById("radio_mail_notification_newmail_icon_name"+i).
+            setAttribute("observes", void(0));
+        }
+      case 'ui_mail_notification_unread_count':
+        document.getElementById(id).hidden = true;
+        break;
+      default:
+        log.error("Unhandled id: "+id);
+      };
+    });
+
+
   },
 
   hidePrefPane: function(name){
@@ -196,7 +218,7 @@ var firetrayUIOptions = {
   },
 
   disableIconTypeMaybe: function(appIconType) {
-    if (firetray.Handler.support['full_feat']) {
+    if (firetray.Handler.support['winnt']) {
       let appIconDefaultGroup = document.getElementById("app_icon_default");
       this.disableNChildren(appIconDefaultGroup, 2,
         (appIconType !== FIRETRAY_APPLICATION_ICON_TYPE_THEMED));
@@ -301,7 +323,7 @@ var firetrayUIOptions = {
     this.disableChildren(iconTextColor,
       (notificationSetting !== FIRETRAY_NOTIFICATION_MESSAGE_COUNT));
 
-    if (firetray.Handler.support['full_feat']) {
+    if (firetray.Handler.support['winnt']) {
       let newMailIconNames = document.getElementById("newmail_icon_names");
       this.disableNChildren(newMailIconNames, 2,
         (notificationSetting !== FIRETRAY_NOTIFICATION_NEWMAIL_ICON));
@@ -323,7 +345,7 @@ var firetrayUIOptions = {
     let mailNotificationType = +mailNotifyRadio.getItemAtIndex(mailNotifyRadio.selectedIndex).value;
     if (msgCountTypeIsNewMessages && (mailNotificationType === FIRETRAY_NOTIFICATION_MESSAGE_COUNT)) {
       mailNotifyRadio.selectedIndex = this.radioGetIndexByValue(mailNotifyRadio, FIRETRAY_NOTIFICATION_NEWMAIL_ICON);
-      if (firetray.Handler.support['full_feat']) {
+      if (firetray.Handler.support['winnt']) {
         let newMailIconNames = document.getElementById("newmail_icon_names");
         this.disableNChildren(newMailIconNames, 2, false);
       }
diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index 3b7e55c..4c1f67f 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -62,15 +62,15 @@ firetray.Handler = {
     }
     throw new Error("not resolved");
   })(),
-  support: {chat: false, full_feat: false},
+  support: {chat: false, winnt: false},
 
   init: function() {            // does creates icon
     firetray.PrefListener.register(false);
     firetray.MailChatPrefListener.register(false);
 
     log.info("OS=" + this.runtimeOS + ", ABI=" + this.runtimeABI + ", XULrunner=" + this.xulVer);
-    if (FIRETRAY_SUPPORTED_OS.indexOf(this.runtimeOS) < 0) {
-      let platforms = FIRETRAY_SUPPORTED_OS.join(", ");
+    if (FIRETRAY_OS_SUPPORT.indexOf(this.runtimeOS) < 0) {
+      let platforms = FIRETRAY_OS_SUPPORT.join(", ");
       log.error("Only "+platforms+" platform(s) supported at this time. Firetray not loaded");
       return false;
     } else if (this.runtimeOS == "winnt" &&
@@ -83,9 +83,8 @@ firetray.Handler = {
     Cu.import("resource://firetray/"+this.runtimeOS+"/FiretrayWindow.jsm");
     log.debug("FiretrayWindow "+this.runtimeOS+" imported");
 
-    this.support['chat'] = FIRETRAY_CHAT_SUPPORTED_OS
-      .indexOf(this.runtimeOS) > -1;
-    this.support['full_feat'] = FIRETRAY_FULL_FEAT_SUPPORTED_OS
+    this.support['chat']  = ['linux'].indexOf(this.runtimeOS) > -1;
+    this.support['winnt'] = ['winnt']
       .indexOf(firetray.Handler.runtimeOS) > -1;
 
     if (this.appId === FIRETRAY_APP_DB['thunderbird']['id'] ||
@@ -131,8 +130,7 @@ firetray.Handler = {
             this.existsChatAccount())
           firetray.Chat.init();
       } else {
-        let platforms = FIRETRAY_CHAT_SUPPORTED_OS.join(", ");
-        log.warn("Only "+platforms+" platform(s) supported at this time. Chat not loaded");
+        log.warn("Chat not supported for this platform. Chat not loaded");
       }
     }
 
diff --git a/src/modules/commons.js b/src/modules/commons.js
index c2f2cf6..7e9bec4 100644
--- a/src/modules/commons.js
+++ b/src/modules/commons.js
@@ -3,8 +3,7 @@
 /* for now, logging facilities (imported from logging.jsm) and Services are
    automatically provided by this module */
 var EXPORTED_SYMBOLS =
-  [ "firetray", "FIRETRAY_VERSION", "FIRETRAY_SUPPORTED_OS",
-    "FIRETRAY_CHAT_SUPPORTED_OS", "FIRETRAY_FULL_FEAT_SUPPORTED_OS",
+  [ "firetray", "FIRETRAY_VERSION", "FIRETRAY_OS_SUPPORT",
     "FIRETRAY_ID", "FIRETRAY_PREF_BRANCH", "FIRETRAY_SPLASH_PAGE",
     "FIRETRAY_APPLICATION_ICON_TYPE_THEMED",
     "FIRETRAY_APPLICATION_ICON_TYPE_CUSTOM",
@@ -25,13 +24,11 @@ const Cu = Components.utils;
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://firetray/logging.jsm");
 
-const FIRETRAY_VERSION           = "0.5.3"; // needed for sync call of onVersionChange() :(
-const FIRETRAY_SUPPORTED_OS      = ['linux', 'winnt']; // install.rdf sync :(
-const FIRETRAY_CHAT_SUPPORTED_OS = ['linux'];
-const FIRETRAY_FULL_FEAT_SUPPORTED_OS = FIRETRAY_CHAT_SUPPORTED_OS;
-const FIRETRAY_ID                = "{9533f794-00b4-4354-aa15-c2bbda6989f8}";
-const FIRETRAY_PREF_BRANCH       = "extensions.firetray.";
-const FIRETRAY_SPLASH_PAGE       = "http://foudfou.github.com/FireTray/";
+const FIRETRAY_VERSION     = "0.5.3"; // needed for sync call of onVersionChange() :(
+const FIRETRAY_OS_SUPPORT  = ['linux', 'winnt']; // install.rdf sync :(
+const FIRETRAY_ID          = "{9533f794-00b4-4354-aa15-c2bbda6989f8}";
+const FIRETRAY_PREF_BRANCH = "extensions.firetray.";
+const FIRETRAY_SPLASH_PAGE = "http://foudfou.github.com/FireTray/";
 
 const FIRETRAY_APPLICATION_ICON_TYPE_THEMED = 0;
 const FIRETRAY_APPLICATION_ICON_TYPE_CUSTOM = 1;

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



More information about the Pkg-mozext-commits mailing list