[Pkg-mozext-commits] [firetray] 08/399: * use 'mozt' namespace in .js files * style: '_' prefix for private attributes (common.js)
David Prévot
taffit at alioth.debian.org
Tue Oct 29 18:23:04 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 0d25df1d17ff30b87eab1d90fa5f212aa37a8f2d
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Wed Jul 6 02:14:17 2011 +0200
* use 'mozt' namespace in .js files
* style: '_' prefix for private attributes (common.js)
---
src/chrome/content/overlay.js | 22 ++++++++++++----------
src/modules/commons.js | 28 ++++++++++++++--------------
2 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/src/chrome/content/overlay.js b/src/chrome/content/overlay.js
index 826ec42..2bbffb3 100644
--- a/src/chrome/content/overlay.js
+++ b/src/chrome/content/overlay.js
@@ -6,17 +6,19 @@ Components.utils.import("resource://moztray/LibGtkStatusIcon.js");
const MOZT_ICON_DIR = "chrome/skin/";
const MOZT_ICON_FIREFOX = "firefox32.png";
-moztray.Main = {
+mozt.Main = {
onLoad: function() {
+ mozt.Debug.dump('Moztray GO !');
+
// initialization code
this.initialized = null;
this.strings = document.getElementById("moztray-strings");
try {
// Set up preference change observer
- moztray.Utils.prefService.QueryInterface(Ci.nsIPrefBranch2);
- moztray.Utils.prefService.addObserver("", this, false);
+ mozt.Utils.prefService.QueryInterface(Ci.nsIPrefBranch2);
+ mozt.Utils.prefService.addObserver("", this, false);
}
catch (ex) {
Components.utils.reportError(ex);
@@ -29,28 +31,28 @@ moztray.Main = {
LibGtkStatusIcon.gtk_status_icon_set_from_file(this.tray_icon,
icon_filename);
- moztray.Debug.dump('Moztray LOADED !');
+ mozt.Debug.dump('Moztray LOADED !');
this.initialized = true;
return true;
},
onQuit: function() {
// Remove observer
- moztray.Utils.prefService.removeObserver("", this);
+ mozt.Utils.prefService.removeObserver("", this);
LibGtkStatusIcon.shutdown();
- moztray.Debug.dump('Moztray UNLOADED !');
+ mozt.Debug.dump('Moztray UNLOADED !');
this.initialized = false;
},
observe: function(subject, topic, data) {
// Observer for pref changes
if (topic != "nsPref:changed") return;
- moztray.Debug.dump('Pref changed: '+data);
+ mozt.Debug.dump('Pref changed: '+data);
switch(data) {
// case 'enabled':
- // var enable = moztray.Utils.prefService.getBoolPref('enabled');
+ // var enable = mozt.Utils.prefService.getBoolPref('enabled');
// this._toggle(enable);
// break;
}
@@ -62,5 +64,5 @@ moztray.Main = {
// should be sufficient for a delayed Startup (no need for window.setTimeout())
// https://developer.mozilla.org/en/Extensions/Performance_best_practices_in_extensions
// https://developer.mozilla.org/en/XUL_School/JavaScript_Object_Management.html
-window.addEventListener("load", function (e) { moztray.Main.onLoad(); }, false);
-window.addEventListener("unload", function(e) { moztray.Main.onQuit(); }, false);
+window.addEventListener("load", function (e) { mozt.Main.onLoad(); }, false);
+window.addEventListener("unload", function(e) { mozt.Main.onQuit(); }, false);
diff --git a/src/modules/commons.js b/src/modules/commons.js
index 17b145f..7e2339b 100644
--- a/src/modules/commons.js
+++ b/src/modules/commons.js
@@ -6,31 +6,31 @@
* http://developer.mozilla.org/en/XUL_School/JavaScript_Object_Management.html
*/
-var EXPORTED_SYMBOLS = [ "moztray" ];
+var EXPORTED_SYMBOLS = [ "mozt" ];
const Cc = Components.classes;
const Ci = Components.interfaces;
/**
- * moztray namespace.
+ * mozt namespace.
*/
-if ("undefined" == typeof(moztray)) {
- var moztray = {
+if ("undefined" == typeof(mozt)) {
+ var mozt = {
DEBUG_MODE: true,
};
};
-moztray.Debug = {
- initialized: false,
+mozt.Debug = {
+ _initialized: false,
/**
* Object constructor.
*/
init: function() {
- if (this.initialized) return;
- this.consoleService = Cc['@mozilla.org/consoleservice;1'].getService(Ci.nsIConsoleService);
+ if (this._initialized) return;
+ this._consoleService = Cc['@mozilla.org/consoleservice;1'].getService(Ci.nsIConsoleService);
this.dump("Moztray Debug initialized");
- this.initialized = true;
+ this._initialized = true;
},
/* Console logging functions */
@@ -40,12 +40,12 @@ moztray.Debug = {
* IT'S IMPORTANT THAT DEBUG CALLS ARE WRITTEN ON A SINGLE LINE !
*/
dump: function(message) { // Debuging function -- prints to javascript console
- if(!moztray.DEBUG_MODE) return;
- this.consoleService.logStringMessage(message);
+ if(!mozt.DEBUG_MODE) return;
+ this._consoleService.logStringMessage(message);
},
dumpObj: function(obj) {
- if(!moztray.DEBUG_MODE) return;
+ if(!mozt.DEBUG_MODE) return;
var str = "";
for(i in obj) {
try {
@@ -59,10 +59,10 @@ moztray.Debug = {
};
// build it !
-moztray.Debug.init();
+mozt.Debug.init();
-moztray.Utils = {
+mozt.Utils = {
prefService: Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService)
.getBranch("extensions.moztray."),
--
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