[Pkg-mozext-commits] [itsalltext] 125/459: browse starts in directory of current choice, if it exists.

David Prévot taffit at moszumanska.debian.org
Tue Feb 24 23:26:13 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 8c3d5c77688ee76c87ff192682131af5f0d20d06
Author: Christian Höltje <docwhat at gerf.org>
Date:   Sun Feb 11 20:15:18 2007 -0500

    browse starts in directory of current choice, if it exists.
---
 chrome/content/preferences.js | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/chrome/content/preferences.js b/chrome/content/preferences.js
index cb9f2f4..e52b8da 100644
--- a/chrome/content/preferences.js
+++ b/chrome/content/preferences.js
@@ -1,11 +1,10 @@
 // @todo [6] [pref] Better strategy for getting the default editor: EDITOR env variable or view_source.editor.path
 // @todo [3] [pref] Preference dialog redesign
-// @todo [3] [pref] Browse button should start in directory of current editor choice.
 /**
  * Open a filepicker to select the value of the editor.
  */
 function pref_editor_select() {  
-    // Note: If jslint could, we'd use const here
+    var pref_editor = document.getElementById('pref_editor');
     var nsIFilePicker = Components.interfaces.nsIFilePicker;
  
     var fp = Components.classes["@mozilla.org/filepicker;1"].
@@ -16,18 +15,18 @@ function pref_editor_select() {
     var initdir = Components.classes["@mozilla.org/file/local;1"].
         createInstance(Components.interfaces.nsILocalFile);
     try {
-        initdir.initWithPath('/usr/bin');
+        initdir.initWithPath(pref_editor.value);
+        initdir = initdir.parent;
         if (initdir.exists() && initdir.isDirectory()) {
             fp.displayDirectory = initdir;
         }
     } catch(e) {
-        // Ignore error - /usr/bin only useful for unix boxen.
+        // Ignore error, the pref may not have been set or who knows.
     }
   
     var rv = fp.show();
     if (rv == nsIFilePicker.returnOK) {
         var file = fp.file;
-        var pref_editor = document.getElementById('pref_editor');
         pref_editor.value = file.path;
         var editor = document.getElementById('editor');
         editor.style.color = 'inherit';

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