[Pkg-mozext-commits] [firetray] 258/399: oops forgot libfiretray.jsm

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:54 UTC 2013


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

taffit pushed a commit to branch dfsg-clean
in repository firetray.

commit ee9f484b0dcd419b7f338a8761f9481311b9fc13
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Wed Jun 13 23:18:46 2012 +0200

    oops forgot libfiretray.jsm
---
 src/modules/ctypes/libfiretray.jsm |   58 ++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/src/modules/ctypes/libfiretray.jsm b/src/modules/ctypes/libfiretray.jsm
new file mode 100644
index 0000000..c9f7afb
--- /dev/null
+++ b/src/modules/ctypes/libfiretray.jsm
@@ -0,0 +1,58 @@
+/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+
+var EXPORTED_SYMBOLS = ["libfiretray"];
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+
+Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://firetray/logging.jsm");
+
+const _path = (function(){
+  var uri = Services.io.newURI('resource://firetray-lib', null, null);
+  if (uri instanceof Ci.nsIFileURL)
+    return uri.file.path;
+  throw new Error("path not resolved");
+})();
+
+var libfiretray = {
+
+  _lib: null,
+
+  init: function() {
+    // If ctypes doesn't exist, try to get it
+    Cu.import("resource://gre/modules/ctypes.jsm");
+    // If we still don't have ctypes, this isn't going to work...
+    if (typeof(ctypes) == "undefined") {
+      throw ("Could not load JS-Ctypes");
+    }
+
+    try {
+      // Try to start up dependencies - if they fail, they'll throw
+      // exceptions. ex: GObjectLib.init();
+
+      this._lib = ctypes.open(_path);
+      if (!this._lib)
+        throw ("Could not load " + _path);
+
+    } catch (e) {
+      this.shutdown();
+      throw(e);
+    }
+
+    // Ok, we got everything - let's declare.
+    this._declare();
+  },
+
+  shutdown: function() {
+    // Close our connection to the library.
+    if (this._lib)
+      this._lib.close();
+  },
+
+  _declare: function() {
+    this.gdk_is_window = this._lib.declare("gdk_is_window", ctypes.default_abi, ctypes.int, ctypes.void_t.ptr);
+  }
+
+};

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