[Pkg-mozext-commits] [firetray] 340/399: fix options' filepickers (#82)
David Prévot
taffit at alioth.debian.org
Tue Oct 29 18:24:10 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 2bbab712301de53bebc3da7a820e88933165cb10
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Sun Feb 10 21:52:53 2013 +0100
fix options' filepickers (#82)
Not sure as why the filepicker callback passed to |open()| is working in all
Mozilla's code without having an explicite |done| method...
---
src/chrome/content/options.js | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index cbd57a4..df76a5d 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -306,28 +306,30 @@ var firetrayUIOptions = {
},
chooseAppIconFile: function() {
+ let updateIcon = firetray.Handler.setIconImageDefault.bind(firetray.Handler);
this._chooseIconFile("app_icon_custom_filename");
- firetray.Handler.setIconImageDefault();
},
chooseMailIconFile: function() {
- this._chooseIconFile("custom_mail_icon_filename");
- firetray.Messaging.updateIcon();
+ let updateIcon = firetray.Messaging.updateIcon.bind(firetray.Messaging);
+ this._chooseIconFile("custom_mail_icon_filename", updateIcon);
},
- _chooseIconFile: function(elementId, prefpaneId) {
+ _chooseIconFile: function(elementId, callback) {
const nsIFilePicker = Ci.nsIFilePicker;
var filePicker = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
- let fpCallback = function fpCallback_done(aResult) {
+ let fpCallback = { done: function(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);
+
+ callback.call();
}
- };
+ }};
filePicker.init(window, "Select Icon", nsIFilePicker.modeOpen); // FIXME: i18n
filePicker.appendFilters(nsIFilePicker.filterImages);
--
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