[Pkg-mozext-commits] [firetray] 325/399: use filePicker.open() instead of deprecated show() - see Bug 731307

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:24:07 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 d17bcf97218d15da15bfac9a3565373df4b20627
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Fri Nov 9 13:26:48 2012 +0100

    use filePicker.open() instead of deprecated show() - see Bug 731307
---
 src/chrome/content/options.js |   28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index 8b4a20f..bbc09e8 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -316,18 +316,22 @@ var firetrayUIOptions = {
   },
 
   _chooseIconFile: function(elementId, prefpaneId) {
-	  const nsIFilePicker = Ci.nsIFilePicker;
-	  var filePicker = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
-	  filePicker.init(window, "Select Icon", nsIFilePicker.modeOpen); // FIXME: i18n
-	  filePicker.appendFilters(nsIFilePicker.filterImages);
-
-	  var rv = filePicker.show();
-	  if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
-      let filenameElt = document.getElementById(elementId);
-		  filenameElt.value = filePicker.file.path;
-      let prefpane = this.getAncestorPrefpane(filenameElt);
-		  prefpane.userChangedValue(filenameElt);
-	  }
+    const nsIFilePicker = Ci.nsIFilePicker;
+    var filePicker = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+
+    let fpCallback = function fpCallback_done(aResult) {
+      if (aResult == nsIFilePicker.returnOK ||
+          aResult == nsIFilePicker.returnReplace) {
+        let filenameElt = document.getElementById(elementId);
+        filenameElt.value = filePicker.file.path;
+        let prefpane = firetrayUIOptions.getAncestorPrefpane(filenameElt);
+        prefpane.userChangedValue(filenameElt);
+      }
+    };
+
+    filePicker.init(window, "Select Icon", nsIFilePicker.modeOpen); // FIXME: i18n
+    filePicker.appendFilters(nsIFilePicker.filterImages);
+    filePicker.open(fpCallback);
   },
 
   getAncestorPrefpane: function(elt) {

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