[Pkg-mozext-commits] [nostalgy] 203/252: Make the number of recent folders customizable + bug fixes.

David Prévot taffit at moszumanska.debian.org
Tue Jun 14 15:24:58 UTC 2016


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

taffit pushed a commit to branch master
in repository nostalgy.

commit a095fbd902bc2df3a9bec5b81f40a24bbce67cc8
Author: frisch <frisch at 56b81dcf-5a2f-0410-9db0-014be2e416ff>
Date:   Fri Aug 6 13:28:37 2010 +0000

    Make the number of recent folders customizable + bug fixes.
---
 CHANGES                |  7 ++++---
 content/edit_prefs.js  | 19 ++++++++++++++++++-
 content/edit_prefs.xul |  4 ++++
 content/folders.js     |  1 -
 content/misc.js        |  2 +-
 content/nostalgy.js    | 10 ++++++++++
 6 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/CHANGES b/CHANGES
index fd19e86..1b7909f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
-Since 0.2.24
-  - use a prefix for all public identifiers in order to comply with amo
-    packaging policy
+0.2.25
+  - Use a prefix for all public identifiers in order to comply with amo
+    packaging policy.
+  - Make the number of "recent folders" customizable.
 
 0.2.24
   - Remove special support for the QuickSearch box
diff --git a/content/edit_prefs.js b/content/edit_prefs.js
index ed1ed83..bf1de18 100644
--- a/content/edit_prefs.js
+++ b/content/edit_prefs.js
@@ -203,6 +203,11 @@ function NostalgyDoMoveDown(idx1,idx2) {
 function onNostalgyAcceptChanges() {
   var prefs = NostalgyPrefBranch();
   prefs.setCharPref("extensions.nostalgy.rules", NostalgyMkPrefStr());
+  try {
+      prefs.setIntPref("extensions.nostalgy.number_of_recent_folders", 0 + NostalgyEBI("number_of_recent_folders").value);
+  } catch (exn) {
+      NostalgyDebug(exn);
+  }
 
   for (var n in nostalgy_completion_options)
     prefs.setBoolPref("extensions.nostalgy."+n,	NostalgyEBI(n).checked);
@@ -252,11 +257,21 @@ function NostalgyDoDelete() {
 function NostalgyGetBoolPref(prefs,s) {
  var b = false;
  try {
-  b=prefs.NostalgyGetBoolPref("extensions.nostalgy." + s); }
+  b=prefs.getBoolPref("extensions.nostalgy." + s); }
  catch (ex) { }
  return b;
 }
 
+function NostalgyGetIntPref(prefs,s,def) {
+ var b = def;
+ try {
+     b=prefs.getIntPref("extensions.nostalgy." + s);
+ }
+ catch (ex) {
+ }
+ return b;
+}
+
 function NostalgyCreateElem(tag,attrs,children) {
  var x = document.createElement(tag);
  for (var a in attrs) x.setAttribute(a,attrs[a]);
@@ -304,6 +319,8 @@ function onNostalgyLoad() {
  for (var n in nostalgy_completion_options)
    NostalgyEBI(n).checked = NostalgyGetBoolPref(prefs, n);
 
+ NostalgyEBI("number_of_recent_folders").value = NostalgyGetIntPref(prefs, "number_of_recent_folders", 5);
+
  nostalgy_key_rows = NostalgyEBI("nostalgy_key_rows");
  for (var i = 0; i < nostalgy_keys.length; i++) {
   var v = nostalgy_keys[i][2];
diff --git a/content/edit_prefs.xul b/content/edit_prefs.xul
index fd847b5..531cd2f 100644
--- a/content/edit_prefs.xul
+++ b/content/edit_prefs.xul
@@ -84,6 +84,10 @@ shortcuts to move/copy the message to this folder.</label>
              id="always_include_tags"/>
    <checkbox label="Use Statistical Prediction"
              id="use_statistical_prediction"/>
+   <hbox align="center">
+     <label>Number of recent folders to remember:</label>
+     <textbox type="number" min="0" max="50" id="number_of_recent_folders"/>
+   </hbox>
  </groupbox>
  </tabpanel>
 
diff --git a/content/folders.js b/content/folders.js
index b14c4cb..3d6cf8e 100644
--- a/content/folders.js
+++ b/content/folders.js
@@ -15,7 +15,6 @@ var nostalgy_completion_options = {
 
 var nostalgy_recent_folders = [ ];
 var nostalgy_recent_folders_max_size = 5;
-// TODO: make that customizable
 
 function NostalgySaveRecentFolder(recent) {
   NostalgyPrefBranch().
diff --git a/content/misc.js b/content/misc.js
index cc5057c..4c25ed8 100644
--- a/content/misc.js
+++ b/content/misc.js
@@ -24,7 +24,7 @@ function NostalgyStopEvent(ev) {
 
 function NostalgyJSONEval(s) {
   if (/^("(\\.|[^"\\\n\r"])*?"|[a-z]+:|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(s)) {
-    try {  
+    try {
       return eval('(' + s + ')');
     } catch (e) {
       NostalgyDebug("parseJSON 1: " + s);
diff --git a/content/nostalgy.js b/content/nostalgy.js
index 3b0e876..483e3fa 100644
--- a/content/nostalgy.js
+++ b/content/nostalgy.js
@@ -52,6 +52,12 @@ var NostalgyRules =
         nostalgy_completion_options[n] = this._branch.getBoolPref(n);
       } catch (ex) { }
     }
+    try {
+        nostalgy_completion_options[n] = this._branch.getBoolPref(n);
+    } catch (ex) { }
+    try {
+        nostalgy_recent_folders_max_size = this._branch.getIntPref("number_of_recent_folders");
+    } catch (ex) { }
     NostalgyInstallRecentFolders();
   },
 
@@ -118,6 +124,10 @@ var NostalgyRules =
       if (!nostalgy_in_message_window) NostalgyDefLabel();
       return;
     }
+    if (aData = "number_of_recent_folders") {
+        nostalgy_recent_folders_max_size = this._branch.getIntPref("number_of_recent_folders");
+        return;
+    }
     if (nostalgy_completion_options[aData] != undefined) {
      nostalgy_completion_options[aData] = this._branch.getBoolPref(aData);
      if (!nostalgy_in_message_window) NostalgyDefLabel();

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



More information about the Pkg-mozext-commits mailing list