[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-launcher/master] Improve progress dialog.



commit 0ae1c7685850958c4f5a81919d7a5d9c98bd6f15
Author: Kathy Brade <brade@xxxxxxxxxxxxxx>
Date:   Wed Apr 10 11:28:25 2013 -0400

    Improve progress dialog.
    
    Show "Connecting to the Tor network" heading and, if browser window is not open yet,
      show "Your browser will open after you are connected." message.
---
 src/chrome/content/network-settings.js |    3 ++-
 src/chrome/content/progress.js         |   16 +++++++++++++++-
 src/chrome/content/progress.xul        |    3 ++-
 src/chrome/locale/en/progress.dtd      |    2 ++
 src/chrome/skin/progress.css           |    5 +++++
 src/components/tl-process.js           |   23 ++++++++++++++---------
 6 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/src/chrome/content/network-settings.js b/src/chrome/content/network-settings.js
index a2f57ad..85f7422 100644
--- a/src/chrome/content/network-settings.js
+++ b/src/chrome/content/network-settings.js
@@ -291,7 +291,8 @@ function openProgressDialog()
 {
   var chromeURL = "chrome://torlauncher/content/progress.xul";
   var features = "chrome,dialog=yes,modal=yes,dependent=yes";
-  window.openDialog(chromeURL, "_blank", features, onProgressDialogClose);
+  window.openDialog(chromeURL, "_blank", features,
+                    gIsInitialBootstrap, onProgressDialogClose);
 }
 
 
diff --git a/src/chrome/content/progress.js b/src/chrome/content/progress.js
index 33bdcda..0f21d4c 100644
--- a/src/chrome/content/progress.js
+++ b/src/chrome/content/progress.js
@@ -27,8 +27,14 @@ function initDialog()
   }
   catch (e) {}
 
+  var isBrowserStartup = false;
   if (window.arguments)
-    gOpenerCallbackFunc = window.arguments[0];
+  {
+    isBrowserStartup = window.arguments[0];
+
+    if (window.arguments.length > 1)
+      gOpenerCallbackFunc = window.arguments[1];
+  }
 
   // If this dialog was not opened from network settings, change Cancel to Quit.
   if (!gOpenerCallbackFunc)
@@ -37,6 +43,14 @@ function initDialog()
     var quitKey = (TorLauncherUtil.isWindows) ? "quit_win" : "quit";
     cancelBtn.label = TorLauncherUtil.getLocalizedString(quitKey);
   }
+
+  // If opened during browser startup, display the "please wait" message.
+  if (isBrowserStartup)
+  {
+    var pleaseWait = document.getElementById("progressPleaseWait");
+    if (pleaseWait)
+      pleaseWait.removeAttribute("hidden");
+  }
 }
 
 
diff --git a/src/chrome/content/progress.xul b/src/chrome/content/progress.xul
index b8b2026..c5c5aca 100644
--- a/src/chrome/content/progress.xul
+++ b/src/chrome/content/progress.xul
@@ -30,10 +30,11 @@
       </vbox>
       <separator orient="vertical" />
       <vbox>
-        <label id="progressHeading" value="&torprogress.dialog.title;" />
+        <label id="progressHeading" value="&torprogress.heading;" />
         <description id="progressDesc" />
       </vbox>
     </hbox>
     <progressmeter id="progressMeter" mode="determined" value="0" />
+    <label id="progressPleaseWait" value="&torprogress.pleaseWait;" hidden="true" />
   </vbox>
 </dialog>
diff --git a/src/chrome/locale/en/progress.dtd b/src/chrome/locale/en/progress.dtd
index 1fe3a86..ce247a4 100644
--- a/src/chrome/locale/en/progress.dtd
+++ b/src/chrome/locale/en/progress.dtd
@@ -1 +1,3 @@
 <!ENTITY torprogress.dialog.title "Tor Status">
+<!ENTITY torprogress.heading "Connecting to the Tor network">
+<!ENTITY torprogress.pleaseWait "Your browser will open after you are connected.">
diff --git a/src/chrome/skin/progress.css b/src/chrome/skin/progress.css
index c3ca079..671870f 100644
--- a/src/chrome/skin/progress.css
+++ b/src/chrome/skin/progress.css
@@ -15,6 +15,11 @@ dialog {
   font-weight: bold;
 }
 
+#progressPleaseWait {
+  font-size: 110%;
+  margin-bottom: 15px;
+}
+
 #tbb-icon {
   list-style-image: url("chrome://torlauncher/skin/default48.png");
   width: 48px;
diff --git a/src/components/tl-process.js b/src/components/tl-process.js
index 4d77d21..655745e 100644
--- a/src/components/tl-process.js
+++ b/src/components/tl-process.js
@@ -342,14 +342,7 @@ TorProcessService.prototype =
     var wwSvc = Cc["@mozilla.org/embedcomp/window-watcher;1"]
                   .getService(Ci.nsIWindowWatcher);
     var winFeatures = "chrome,dialog=yes,modal,all";
-
-    var argsArray = Cc["@mozilla.org/array;1"]
-                      .createInstance(Ci.nsIMutableArray);
-    var variant = Cc["@mozilla.org/variant;1"]
-                    .createInstance(Ci.nsIWritableVariant);
-    variant.setFromVariant(aIsInitialBootstrap);
-    argsArray.appendElement(variant, false);
-
+    var argsArray = this._createOpenWindowArgsArray(aIsInitialBootstrap);
     wwSvc.openWindow(null, kChromeURL, "_blank", winFeatures, argsArray);
   },
 
@@ -359,7 +352,19 @@ TorProcessService.prototype =
     var wwSvc = Cc["@mozilla.org/embedcomp/window-watcher;1"]
                   .getService(Ci.nsIWindowWatcher);
     var winFeatures = "chrome,dialog=yes,modal,all";
-    wwSvc.openWindow(null, chromeURL, "_blank", winFeatures, null);
+    var argsArray = this._createOpenWindowArgsArray(true);
+    wwSvc.openWindow(null, chromeURL, "_blank", winFeatures, argsArray);
+  },
+
+  _createOpenWindowArgsArray: function(aBool)
+  {
+    var argsArray = Cc["@mozilla.org/array;1"]
+                      .createInstance(Ci.nsIMutableArray);
+    var variant = Cc["@mozilla.org/variant;1"]
+                    .createInstance(Ci.nsIWritableVariant);
+    variant.setFromVariant(aBool);
+    argsArray.appendElement(variant, false);
+    return argsArray;
   },
 
   // Returns an nsIFile.

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits