[Pkg-mozext-commits] [firetray] 04/22: * ctypes-utils: just log 'Info' if lib not found. * Cleaning

David Prévot taffit at moszumanska.debian.org
Wed Dec 31 17:04:37 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 2b0084b69a277611de65f3667b1e57a91d3fe57e
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Tue Nov 11 14:52:14 2014 +0100

    * ctypes-utils: just log 'Info' if lib not found.
    * Cleaning
---
 src/chrome/content/overlay.js            |  4 ++--
 src/modules/ctypes/ctypes-utils.jsm      | 14 ++++++-------
 src/modules/linux/FiretrayStatusIcon.jsm | 34 +++++++++++++++++++-------------
 3 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/src/chrome/content/overlay.js b/src/chrome/content/overlay.js
index 91b6af1..87407b5 100644
--- a/src/chrome/content/overlay.js
+++ b/src/chrome/content/overlay.js
@@ -23,7 +23,7 @@ var firetrayChrome = { // each new window gets a new firetrayChrome !
     firetray_log.debug("Handler initialized: "+firetray.Handler.initialized);
     let init = firetray.Handler.initialized || firetray.Handler.init();
 
-    firetray_log.debug("ONLOAD"); firetray.Handler.dumpWindows();
+    firetray_log.debug("ONLOAD");
     this.winId = firetray.Handler.registerWindow(win);
 
     win.addEventListener('close', firetrayChrome.onClose, true);
@@ -39,7 +39,7 @@ var firetrayChrome = { // each new window gets a new firetrayChrome !
   onQuit: function(win) {
     win.removeEventListener('close', firetrayChrome.onClose, true);
     firetray.Handler.unregisterWindow(win);
-    firetray_log.info("windowsCount="+firetray.Handler.windowsCount+", visibleWindowsCount="+firetray.Handler.visibleWindowsCount);
+    firetray_log.debug("windowsCount="+firetray.Handler.windowsCount+", visibleWindowsCount="+firetray.Handler.visibleWindowsCount);
     firetray_log.debug('Firetray UNLOADED !');
   },
 
diff --git a/src/modules/ctypes/ctypes-utils.jsm b/src/modules/ctypes/ctypes-utils.jsm
index 68b929c..83b0b51 100644
--- a/src/modules/ctypes/ctypes-utils.jsm
+++ b/src/modules/ctypes/ctypes-utils.jsm
@@ -119,17 +119,15 @@ function ctypes_library(aName, aABIs, aDefines, aGlobal) {
     for each (let abi in aABIs) {
       // FIXME: ABI is in fact SO_VER. Now we're mixing .so versions and the
       // .dll extension :(
-      let soname = abi === 'dll' ? aName :
+      let libname = abi === 'dll' ? aName :
         "lib" + aName + ".so." + abi.toString();
-      log.debug("Trying " + soname);
+      log.debug("Trying " + libname);
       try {
-        library = ctypes.open(soname);
+        library = ctypes.open(libname);
         this.ABI = abi;
-        log.debug("Successfully loaded " + soname);
+        log.debug("Successfully loaded " + libname);
         break;
-      } catch(e) {
-        log.warn(soname+" unfound.");
-      }
+      } catch(e) {}
     }
 
     this.name = aName;
@@ -153,7 +151,7 @@ function ctypes_library(aName, aABIs, aDefines, aGlobal) {
     };
 
     if (!library) {
-      log.debug("Failed to load library: " + aName);
+      log.info("Library does not exist: " + aName);
       this.ABI = -1;
       return;
     }
diff --git a/src/modules/linux/FiretrayStatusIcon.jsm b/src/modules/linux/FiretrayStatusIcon.jsm
index 4d9bfaf..04a9afb 100644
--- a/src/modules/linux/FiretrayStatusIcon.jsm
+++ b/src/modules/linux/FiretrayStatusIcon.jsm
@@ -54,20 +54,19 @@ firetray.StatusIcon = {
     if (!firetray.PopupMenu.init())
       return false;
 
+    // FIXME: we may want to split into 2 separate modules: GtkStatusIcon and
+    // AppIndicator.
     Cu.import("resource://firetray/ctypes/linux/appindicator.jsm");
     if (appind3.available() && this.dbusNotificationWatcherReady()) {
       firetray.Handler.subscribeLibsForClosing([appind3]);
-      // FIXME: we may want to split into 2 separate modules: GtkStatusIcon and
-      // AppIndicator.
       this.indicatorInit();
+    } else {
+      this.trayIcon = gtk.gtk_status_icon_new();
+      firetray.Handler.setIconImageDefault();
+      firetray.Handler.setIconTooltipDefault();
+      this.addCallbacks();
     }
 
-    this.trayIcon = gtk.gtk_status_icon_new();
-    firetray.Handler.setIconImageDefault();
-    firetray.Handler.setIconTooltipDefault();
-
-    this.addCallbacks();
-
     this.initialized = true;
     return true;
   },
@@ -246,10 +245,18 @@ firetray.StatusIcon = {
   dbusNotificationWatcherReady: function() {
     let watcherReady = false;
 
+    function error(e) {
+      if (!e.isNull()) {
+        log.error(e.contents.message);
+        glib.g_error_free(e);
+      }
+    }
+
     let conn = new gio.GDBusConnection.ptr;
-    let error = new glib.GError.ptr(null);
-    conn = gio.g_bus_get_sync(gio.G_BUS_TYPE_SESSION, null, error.address());
-    firetray.js.assert(error.isNull());
+    let err = new glib.GError.ptr(null);
+    conn = gio.g_bus_get_sync(gio.G_BUS_TYPE_SESSION, null, err.address());
+    if (error(err)) return watcherReady;
+
     if (!conn.isNull()) {
       let flags = gio.G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START |
             gio.G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
@@ -263,8 +270,8 @@ firetray.StatusIcon = {
         appind3.NOTIFICATION_WATCHER_DBUS_OBJ,
         appind3.NOTIFICATION_WATCHER_DBUS_IFACE,
         null, /* GCancellable */
-        error.address());
-      firetray.js.assert(error.isNull());
+        err.address());
+      if (error(err)) return watcherReady;
 
       if (!proxy.isNull()) {
         let owner = gio.g_dbus_proxy_get_name_owner(proxy);
@@ -276,7 +283,6 @@ firetray.StatusIcon = {
 
       gobject.g_object_unref(conn);
     }
-    glib.g_error_free(error);
 
     return watcherReady;
   }

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