[Pkg-mozext-commits] [firetray] 03/11: * Disable Chat if libappindicator is used. * Minor StatusIcon refactoring.

David Prévot taffit at moszumanska.debian.org
Fri Apr 10 02:19:13 UTC 2015


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

taffit pushed a commit to branch master
in repository firetray.

commit 7171d503bdaeb89c9db413d4941c488921568cb4
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Tue Apr 7 21:21:34 2015 +0200

    * Disable Chat if libappindicator is used.
    * Minor StatusIcon refactoring.
---
 src/modules/FiretrayHandler.jsm          | 11 ++++---
 src/modules/linux/FiretrayStatusIcon.jsm | 51 ++++++++++++++++++--------------
 2 files changed, 35 insertions(+), 27 deletions(-)

diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index 08a79a6..78edf1c 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -37,6 +37,7 @@ firetray.Handler = {
   inMailApp: false,
   appHasChat: false,
   appStarted: false,
+  useAppind: false,             // initialized in StatusIcon
   windows: {},
   get windowsCount() {return Object.keys(this.windows).length;},
   get visibleWindowsCount() {
@@ -83,12 +84,14 @@ firetray.Handler = {
 
     Cu.import("resource://firetray/"+this.runtimeOS+"/FiretrayStatusIcon.jsm");
     log.debug("FiretrayStatusIcon "+this.runtimeOS+" imported");
+    log.info("useAppind="+firetray.Handler.useAppind);
     Cu.import("resource://firetray/"+this.runtimeOS+"/FiretrayWindow.jsm");
     log.debug("FiretrayWindow "+this.runtimeOS+" imported");
 
-    this.support['chat']  = ['linux'].indexOf(this.runtimeOS) > -1;
-    this.support['winnt'] = ['winnt']
-      .indexOf(firetray.Handler.runtimeOS) > -1;
+    this.support['chat']  =
+      ['linux'].indexOf(this.runtimeOS) > -1 && !this.useAppind;
+    this.support['winnt'] =
+      ['winnt'].indexOf(firetray.Handler.runtimeOS) > -1;
 
     if (this.appId === FIRETRAY_APP_DB['thunderbird']['id'] ||
         this.appId === FIRETRAY_APP_DB['seamonkey']['id'])
@@ -133,7 +136,7 @@ firetray.Handler = {
             this.existsChatAccount())
           firetray.Chat.init();
       } else {
-        log.warn("Chat not supported for this platform. Chat not loaded");
+        log.warn("Chat not supported for this environment. Chat not loaded");
       }
     }
 
diff --git a/src/modules/linux/FiretrayStatusIcon.jsm b/src/modules/linux/FiretrayStatusIcon.jsm
index 642d478..7d6b341 100644
--- a/src/modules/linux/FiretrayStatusIcon.jsm
+++ b/src/modules/linux/FiretrayStatusIcon.jsm
@@ -29,38 +29,19 @@ firetray.StatusIcon = {
   prefNewMailIconNames: null,
   defaultAppIconName: null,
   defaultNewMailIconName: null,
-  canAppIndicator: null,
 
   init: function() {
     this.defineIconNames();
 
-    // PopupMenu g_connect's some Handler functions. As these are overridden is
-    // StatusIcon implementations, PopupMenu must be initialized *after*
-    // implemenations are imported.
-    Cu.import("resource://firetray/ctypes/linux/appindicator.jsm");
-    this.canAppIndicator =
-      (appind3.available() && this.dbusNotificationWatcherReady());
-    log.info("canAppIndicator="+this.canAppIndicator);
-    /* We can't reliably detect if xembed tray icons are supported, because, for
-     instance, Unity/compiz falsely claims to have support for it through
-     _NET_SYSTEM_TRAY_Sn (compiz). So we end up using the desktop id as a
-     criteria for enabling appindicator. */
-    let desktop = this.getDesktop();
-    log.info("desktop="+JSON.stringify(desktop));
-
-    if (firetray.Utils.prefService.getBoolPref('with_appindicator') &&
-        this.canAppIndicator &&
-        (desktop.name === 'unity' ||
-         (desktop.name === 'kde' && desktop.ver > 4))) {
+    if (firetray.Handler.useAppind) {
       Cu.import("resource://firetray/linux/FiretrayAppIndicator.jsm");
-      /* FIXME: Ubuntu14.04/Unity: successfully closing appind3 crashes FF/TB
-       during exit, in Ubuntu's unity-menubar.patch's code.
-       https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/1393256 */
-      // firetray.Handler.subscribeLibsForClosing([appind3]);
     } else {
       Cu.import("resource://firetray/linux/FiretrayGtkStatusIcon.jsm");
     }
 
+    // PopupMenu g_connect's some Handler functions. As these are overridden is
+    // StatusIcon implementations, PopupMenu must be initialized *after*
+    // implemenations are imported.
     Cu.import("resource://firetray/linux/FiretrayPopupMenu.jsm");
     if (!firetray.PopupMenu.init())
       return false;
@@ -110,6 +91,28 @@ firetray.StatusIcon = {
 
   loadImageCustom: function() { }, // done in setIconImageCustom
 
+  appindEnable: function() {
+    Cu.import("resource://firetray/ctypes/linux/appindicator.jsm");
+    /* FIXME: Ubuntu14.04/Unity: successfully closing appind3 crashes FF/TB
+     during exit, in Ubuntu's unity-menubar.patch's code.
+     https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/1393256 */
+    // firetray.Handler.subscribeLibsForClosing([appind3]);
+    let canAppIndicator =
+          (appind3.available() && this.dbusNotificationWatcherReady());
+    /* We can't reliably detect if xembed tray icons are supported, because,
+     for instance, Unity/compiz falsely claims to have support for it through
+     _NET_SYSTEM_TRAY_Sn (compiz). So we end up using the desktop id as a
+     criteria for enabling appindicator. */
+    let desktop = this.getDesktop();
+    log.info("desktop="+JSON.stringify(desktop));
+    return (
+      firetray.Utils.prefService.getBoolPref('with_appindicator') &&
+        canAppIndicator &&
+        (desktop.name === 'unity' ||
+         (desktop.name === 'kde' && desktop.ver > 4))
+    );
+  },
+
   getDesktop: function() {
     let env = Cc["@mozilla.org/process/environment;1"]
           .createInstance(Ci.nsIEnvironment);
@@ -210,6 +213,8 @@ firetray.StatusIcon = {
 }; // firetray.StatusIcon
 
 
+firetray.Handler.useAppind = firetray.StatusIcon.appindEnable();
+
 firetray.Handler.setIconTooltipDefault = function() {
   if (!this.appName)
     throw "application name not initialized";

-- 
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