From a941a19a9033902b25576f3d2975c94cdaf4b875 Mon Sep 17 00:00:00 2001 From: Einar Egilsson Date: Sat, 14 Nov 2009 06:36:38 +0000 Subject: Bugfixes. 2.0.1 release git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@304 119bf307-c92d-0410-89bd-8f53e6181181 --- chrome/content/code/browserOverlay.xul.js | 2 +- chrome/content/code/prefs.js | 93 ----------------------------- chrome/content/code/redirector.prototype.js | 2 +- chrome/content/code/redirectorprefs.js | 93 +++++++++++++++++++++++++++++ chrome/content/code/settings.xul.js | 2 +- 5 files changed, 96 insertions(+), 96 deletions(-) delete mode 100644 chrome/content/code/prefs.js create mode 100644 chrome/content/code/redirectorprefs.js (limited to 'chrome/content/code') diff --git a/chrome/content/code/browserOverlay.xul.js b/chrome/content/code/browserOverlay.xul.js index e194e5f..19a37df 100644 --- a/chrome/content/code/browserOverlay.xul.js +++ b/chrome/content/code/browserOverlay.xul.js @@ -15,7 +15,7 @@ var RedirectorOverlay = { .addEventListener("popupshowing", function(e) { RedirectorOverlay.showContextMenu(e); }, false); this.strings = document.getElementById("redirector-strings"); - this.prefs = new Prefs(); + this.prefs = new RedirectorPrefs(); this.changedPrefs(this.prefs); this.prefs.addListener(this); } catch(e) { diff --git a/chrome/content/code/prefs.js b/chrome/content/code/prefs.js deleted file mode 100644 index 055293b..0000000 --- a/chrome/content/code/prefs.js +++ /dev/null @@ -1,93 +0,0 @@ -// $Id$ - -function Prefs() { - this.init(); -} - -Prefs.prototype = { - - //Preferences: - _version : null, - _enabled : null, - _showStatusBarIcon : null, - _showContextMenu : null, - _debugEnabled : null, - _defaultDir : null, - _redirects : null, - - _prefBranch : null, - - _listeners : null, - - //Preferences props - - get version() { return this._version; }, - set version(value) { this._prefBranch.setCharPref('version', value); }, - - get enabled() { return this._enabled; }, - set enabled(value) { this._prefBranch.setBoolPref('enabled', value); }, - - get showStatusBarIcon() { return this._showStatusBarIcon; }, - set showStatusBarIcon(value) { this._prefBranch.setBoolPref('showStatusBarIcon', value); }, - - get showContextMenu() { return this._showContextMenu; }, - set showContextMenu(value) { this._prefBranch.setBoolPref('showContextMenu', value); }, - - get debugEnabled() { return this._debugEnabled; }, - set debugEnabled(value) { this._prefBranch.setBoolPref('debugEnabled', value); }, - - get defaultDir() { return this._defaultDir; }, - set defaultDir(value) { this._prefBranch.setCharPref('defaultDir', value); }, - - get redirects() { return this._redirects; }, - set redirects(value) { this._prefBranch.setCharPref('redirects', value); }, - - init : function() { - this._prefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.redirector."); - this.reload(); - this._listeners = []; - this.service.addObserver('extensions.redirector', this, false); - }, - - dispose : function() { - this._listeners = null; - this.service.removeObserver('extensions.redirector', this); - }, - - reload : function() { - this._version = this._prefBranch.getCharPref('version'); - this._enabled = this._prefBranch.getBoolPref('enabled'); - this._showStatusBarIcon = this._prefBranch.getBoolPref('showStatusBarIcon'); - this._showContextMenu = this._prefBranch.getBoolPref('showContextMenu'); - this._debugEnabled = this._prefBranch.getBoolPref('debugEnabled'); - this._defaultDir = this._prefBranch.getCharPref('defaultDir'); - this._redirects = this._prefBranch.getCharPref('redirects'); - }, - - get service() { - return Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranchInternal); - }, - - observe : function(subject, topic, data) { - if (topic != 'nsPref:changed') { - return; - } - this.reload(); - for each (var listener in this._listeners) { - listener && listener.changedPrefs && listener.changedPrefs(this); - } - }, - - addListener : function(listener) { - this._listeners.push(listener); - }, - - removeListener : function(listener) { - for (var i = 0; i < this._listeners.length; i++) { - if (this._listeners[i] == listener) { - this._listeners.splice(i,1); - return; - } - } - }, -} \ No newline at end of file diff --git a/chrome/content/code/redirector.prototype.js b/chrome/content/code/redirector.prototype.js index ecdcbd3..8f4cf6a 100644 --- a/chrome/content/code/redirector.prototype.js +++ b/chrome/content/code/redirector.prototype.js @@ -237,7 +237,7 @@ Redirector.prototype = { if (this._prefs) { this._prefs.dispose(); } - this._prefs = new Prefs(); + this._prefs = new RedirectorPrefs(); //Check if we need to update existing redirects var data = this._prefs.redirects; var version = this._prefs.version; diff --git a/chrome/content/code/redirectorprefs.js b/chrome/content/code/redirectorprefs.js new file mode 100644 index 0000000..52c3056 --- /dev/null +++ b/chrome/content/code/redirectorprefs.js @@ -0,0 +1,93 @@ +// $Id$ + +function RedirectorPrefs() { + this.init(); +} + +RedirectorPrefs.prototype = { + + //Preferences: + _version : null, + _enabled : null, + _showStatusBarIcon : null, + _showContextMenu : null, + _debugEnabled : null, + _defaultDir : null, + _redirects : null, + + _prefBranch : null, + + _listeners : null, + + //Preferences props + + get version() { return this._version; }, + set version(value) { this._prefBranch.setCharPref('version', value); }, + + get enabled() { return this._enabled; }, + set enabled(value) { this._prefBranch.setBoolPref('enabled', value); }, + + get showStatusBarIcon() { return this._showStatusBarIcon; }, + set showStatusBarIcon(value) { this._prefBranch.setBoolPref('showStatusBarIcon', value); }, + + get showContextMenu() { return this._showContextMenu; }, + set showContextMenu(value) { this._prefBranch.setBoolPref('showContextMenu', value); }, + + get debugEnabled() { return this._debugEnabled; }, + set debugEnabled(value) { this._prefBranch.setBoolPref('debugEnabled', value); }, + + get defaultDir() { return this._defaultDir; }, + set defaultDir(value) { this._prefBranch.setCharPref('defaultDir', value); }, + + get redirects() { return this._redirects; }, + set redirects(value) { this._prefBranch.setCharPref('redirects', value); }, + + init : function() { + this._prefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.redirector."); + this.reload(); + this._listeners = []; + this.service.addObserver('extensions.redirector', this, false); + }, + + dispose : function() { + this._listeners = null; + this.service.removeObserver('extensions.redirector', this); + }, + + reload : function() { + this._version = this._prefBranch.getCharPref('version'); + this._enabled = this._prefBranch.getBoolPref('enabled'); + this._showStatusBarIcon = this._prefBranch.getBoolPref('showStatusBarIcon'); + this._showContextMenu = this._prefBranch.getBoolPref('showContextMenu'); + this._debugEnabled = this._prefBranch.getBoolPref('debugEnabled'); + this._defaultDir = this._prefBranch.getCharPref('defaultDir'); + this._redirects = this._prefBranch.getCharPref('redirects'); + }, + + get service() { + return Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranchInternal); + }, + + observe : function(subject, topic, data) { + if (topic != 'nsPref:changed') { + return; + } + this.reload(); + for each (var listener in this._listeners) { + listener && listener.changedPrefs && listener.changedPrefs(this); + } + }, + + addListener : function(listener) { + this._listeners.push(listener); + }, + + removeListener : function(listener) { + for (var i = 0; i < this._listeners.length; i++) { + if (this._listeners[i] == listener) { + this._listeners.splice(i,1); + return; + } + } + }, +} \ No newline at end of file diff --git a/chrome/content/code/settings.xul.js b/chrome/content/code/settings.xul.js index 21f514f..4fa65a2 100644 --- a/chrome/content/code/settings.xul.js +++ b/chrome/content/code/settings.xul.js @@ -35,7 +35,7 @@ var Settings = { this.chkShowContextMenu = document.getElementById('chkShowContextMenu'); this.chkEnableDebugOutput = document.getElementById('chkEnableDebugOutput'); - this.prefs = new Prefs(); + this.prefs = new RedirectorPrefs(); //Preferences this.changedPrefs(this.prefs); this.prefs.addListener(this); -- cgit v1.2.3-70-g09d2