mirror of
https://github.com/moparisthebest/FireTray
synced 2024-12-22 22:08:49 -05:00
use Services.jsm and renamed modules to .jsm
This commit is contained in:
parent
8e4e14c8f6
commit
98ee40353e
@ -81,7 +81,7 @@ chrome_sources := $(chrome_sources_js) \
|
||||
modules_dir := modules
|
||||
|
||||
# The sources for the module files.
|
||||
modules_sources := $(wildcard $(modules_dir)/*.js)
|
||||
modules_sources := $(wildcard $(modules_dir)/*.js) $(wildcard $(modules_dir)/*.jsm)
|
||||
|
||||
# The sources for the XPI file. Uses variables defined in the included
|
||||
# Makefiles.
|
||||
|
@ -1,10 +1,9 @@
|
||||
/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
|
||||
// TODO: Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/ctypes.jsm");
|
||||
Components.utils.import("resource://moztray/LibC.js");
|
||||
Components.utils.import("resource://moztray/LibGObject.js");
|
||||
Components.utils.import("resource://moztray/LibGtkStatusIcon.js");
|
||||
Components.utils.import("resource://moztray/LibGObject.jsm");
|
||||
Components.utils.import("resource://moztray/LibGtkStatusIcon.jsm");
|
||||
Components.utils.import("resource://moztray/commons.js");
|
||||
|
||||
const MOZT_ICON_DIR = "chrome/skin/";
|
||||
@ -41,7 +40,7 @@ mozt.Handler = {
|
||||
_getAllWindows: function() {
|
||||
mozt.Debug.debug("_getAllWindows");
|
||||
var baseWindows = new Array();
|
||||
var e = mozt.Utils.windowMediator.getEnumerator(null);
|
||||
var e = Services.wm.getEnumerator(null);
|
||||
while (e.hasMoreElements()) {
|
||||
var w = e.getNext();
|
||||
baseWindows[baseWindows.length] = this._getBaseWindow(w);
|
||||
@ -132,7 +131,7 @@ mozt.Main = {
|
||||
// instanciate tray icon
|
||||
LibGtkStatusIcon.init();
|
||||
this.tray_icon = LibGtkStatusIcon.gtk_status_icon_new();
|
||||
var mozApp = mozt.Utils.appInfoService.name.toLowerCase();
|
||||
var mozApp = Services.appinfo.name.toLowerCase();
|
||||
var iconFilename = MOZT_ICON_DIR + mozApp + MOZT_ICON_SUFFIX;
|
||||
LibGtkStatusIcon.gtk_status_icon_set_from_file(this.tray_icon,
|
||||
iconFilename);
|
||||
@ -153,7 +152,7 @@ mozt.Main = {
|
||||
mozt_activateCb, null);
|
||||
|
||||
} catch (x) {
|
||||
Components.utils.reportError(ex);
|
||||
Components.utils.reportError(x);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -220,3 +219,4 @@ mozt.Main = {
|
||||
// https://developer.mozilla.org/en/XUL_School/JavaScript_Object_Management.html
|
||||
window.addEventListener("load", function (e) { mozt.Main.onLoad(); }, false);
|
||||
window.addEventListener("unload", function(e) { mozt.Main.onQuit(); }, false);
|
||||
// TODO: put all mozt into a module (jsm) so it's loaded only once
|
||||
|
@ -46,7 +46,7 @@ const Ci = Components.interfaces;
|
||||
|
||||
Cu.import("resource://gre/modules/ctypes.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://moztray/LibGObject.js");
|
||||
Cu.import("resource://moztray/LibGObject.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "libgdkwindow", function() {
|
||||
var libgdkwindow = ctypes.open(LIB_GDKWINDOW);
|
@ -20,8 +20,8 @@ var LibGtkStatusIcon = {
|
||||
throw ("Could not load JS-Ctypes");
|
||||
}
|
||||
|
||||
Cu.import("resource://moztray/LibGObject.js");
|
||||
Cu.import("resource://moztray/LibGdkWindow.js");
|
||||
Cu.import("resource://moztray/LibGObject.jsm");
|
||||
Cu.import("resource://moztray/LibGdkWindow.jsm");
|
||||
|
||||
try {
|
||||
// Try to start up dependencies - if they fail, they'll throw
|
@ -12,7 +12,8 @@ const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://moztray/LibC.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://moztray/LibC.jsm");
|
||||
|
||||
const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
|
||||
const THUNDERBIRD_ID = "{3550f703-e582-4d05-9a08-453d09bdfdc6}";
|
||||
@ -77,12 +78,7 @@ mozt.Debug.init();
|
||||
|
||||
|
||||
mozt.Utils = {
|
||||
prefService: Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService)
|
||||
.getBranch("extensions.moztray."),
|
||||
|
||||
appInfoService: Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo), // appInfoService.name.toLower
|
||||
|
||||
windowMediator: Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator)
|
||||
prefService: Services.prefs.getBranch("extensions.moztray.")
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user