[Pkg-mozext-commits] [itsalltext] 180/459: Okay, trying preferences from ANOTHER place

David Prévot taffit at moszumanska.debian.org
Tue Feb 24 23:26:19 UTC 2015


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

taffit pushed a commit to branch master
in repository itsalltext.

commit 9fa4ada807d57eb02b61c29658de07a690a2bb94
Author: Christian Höltje <docwhat at gerf.org>
Date:   Wed Mar 28 21:27:14 2007 -0400

    Okay, trying preferences from ANOTHER place
---
 chrome/content/itsalltext.js | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/chrome/content/itsalltext.js b/chrome/content/itsalltext.js
index 7e58be9..02d2974 100644
--- a/chrome/content/itsalltext.js
+++ b/chrome/content/itsalltext.js
@@ -352,23 +352,26 @@ var ItsAllText = function() {
     /**
      * Open the preferences dialog box.
      * @private
-     */
-    that.openPreferences = function() {
-        var optionsURL = 'chrome://itsalltext/chrome/preferences.xul';
-        /* This code is borrowed from
-           chrome://mozapps/content/extensions/extensions.js 
-           about line 980
-           It fixes the problem with Macs not getting a close button.
-         */
-        var features;
-        try {
-            var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
-            var instantApply = prefs.getBoolPref("browser.preferences.instantApply");
-            features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal");
-        } catch (e) {
-            features = "chrome,titlebar,toolbar,centerscreen,modal";
+     * Stolen from http://wiki.mozilla.org/XUL:Windows
+     * and utilityOverlay.js's openPreferences()
+     */
+    that.openPreferences = function () {
+        var paneID = that.MYSTRING + '_preferences';
+        var instantApply = getBoolPref("browser.preferences.instantApply", false);
+        var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal");
+
+        var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
+        var win = wm.getMostRecentWindow("Browser:Preferences");
+        if (win) {
+            win.focus();
+            if (paneID) {
+                var pane = win.document.getElementById(paneID);
+                win.document.documentElement.showPane(pane);
+            }
+        } else {
+            openDialog('chrome://itsalltext/chrome/preferences.xul',
+                       "", features, paneID);
         }
-        window.openDialog(optionsURL, "", features);
     };
 
     /**

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/itsalltext.git



More information about the Pkg-mozext-commits mailing list