[Pkg-mozext-commits] [itsalltext] 14/459: Added refresh period to the timeout

David Prévot taffit at moszumanska.debian.org
Tue Feb 24 23:26:01 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 b875bff8ecbd0659b289718e61e93f1b8cee2b7d
Author: docwhat at gerf.org <docwhat at gerf.org>
Date:   Sun Dec 10 22:02:06 2006 -0500

    Added refresh period to the timeout
---
 chrome/content/itsalltext.js       | 17 ++++++++++++++++-
 chrome/content/options.xul         |  7 ++++++-
 defaults/preferences/itsalltext.js |  3 +--
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/chrome/content/itsalltext.js b/chrome/content/itsalltext.js
index a8986c4..24890a2 100644
--- a/chrome/content/itsalltext.js
+++ b/chrome/content/itsalltext.js
@@ -124,6 +124,21 @@ function ItsAllTextOverlay() {
   };
 
   /**
+   * A Preference Option: How often should we search for new content?
+   * @returns {int} The number of seconds between checking for new content.
+   */
+  that.getRefresh = function() {
+    var prefs = Components.classes["@mozilla.org/preferences-service;1"].
+      getService(Components.interfaces.nsIPrefService);
+    var branch = prefs.getBranch("extensions."+MYSTRING+".");
+    var refresh = branch.getIntPref("refresh");
+    var retval = Math.round((1000*refresh) + (1000*Math.random()));
+    that.debug('refresh in',retval);
+    return retval;
+
+  };
+
+  /**
    * A Preference Option: What editor should we use?
    * @returns {nsILocalFile} A file object of the editor.
    */
@@ -394,7 +409,7 @@ function ItsAllTextOverlay() {
         that.refreshDocument(doc);
         lasttime = new Date().valueOf();
         cron[id] = lasttime;
-        setTimeout(cronjob, 3000+(1000*Math.random()));
+        setTimeout(cronjob, that.getRefresh);
       }
     };
     cronjob();
diff --git a/chrome/content/options.xul b/chrome/content/options.xul
index 90c4f4c..b00f00d 100644
--- a/chrome/content/options.xul
+++ b/chrome/content/options.xul
@@ -11,15 +11,20 @@
                 name="extensions.itsalltext.charset" type="string"/>
     <preference id="pref_editor"
                 name="extensions.itsalltext.editor" type="string"/>
+    <preference id="pref_seconds"
+                name="extensions.itsalltext.refresh" type="int"/>
   </preferences>
 
   <vbox> 
-    <hbox>
     <hbox align="right">
       <label control="editor" value="Editor (needs full path): "/>
       <textbox preference="pref_editor" id="editor" maxlength="20"/>
     </hbox>
     <hbox align="right">
+      <label control="seconds" value="Seconds between refreshing: "/>
+      <textbox preference="pref_seconds" id="seconds" maxlength="2"/>
+    </hbox>
+    <hbox align="right">
       <label control="charset"
              value="Character Set (default: UTF-8): "/>
       <textbox preference="pref_charset" id="charset" maxlength="8"/>
diff --git a/defaults/preferences/itsalltext.js b/defaults/preferences/itsalltext.js
index f6f21aa..8d3df4b 100644
--- a/defaults/preferences/itsalltext.js
+++ b/defaults/preferences/itsalltext.js
@@ -1,4 +1,3 @@
 pref("extensions.itsalltext.charset",  "UTF-8");
 pref("extensions.itsalltext.editor",   "/usr/bin/gedit");
-
-
+pref("extensions.itsalltext.refresh",  7);

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