[feat] Add icons to bitmask status bar
authorSukhbir Singh <sukhbir@torproject.org>
Sun, 17 Dec 2017 17:05:35 +0000 (12:05 -0500)
committerRuben Pollan <meskio@sindominio.net>
Wed, 20 Dec 2017 16:09:55 +0000 (18:09 +0200)
Display the status of bitmaskd in Thunderbird's status bar by connecting
to it using bitmask.js

chrome/content/accountWizard/bitmaskMessengerOverlay.js
chrome/content/accountWizard/bitmaskMessengerOverlay.xul
chrome/locale/en-US/bitmaskMessengerOverlay.properties [new file with mode: 0644]
chrome/skin/off.png [new file with mode: 0644]
chrome/skin/on.png [new file with mode: 0644]

index aa6bff8..148290c 100644 (file)
@@ -8,16 +8,19 @@ window.setInterval(function() {
 
 function overlayStartup() {
   let myPanel = document.getElementById("bitmaskStatusBarPanel");
+  let strBundle = document.getElementById("bitmaskMessengerStrings");
 
   // We just need to check if bitmaskd is running and if we were able to
   // authorize with it using the token from bitmask.js
   let promise = bitmask.core.status();
   promise.then(function(data) {
-    myPanel.label = "bitmask is " + data["mail"];
+    myPanel.label = strBundle.getFormattedString("bitmaskStatusOn", [ data["mail"] ]);
     myPanel.style.color = "green";
+    myPanel.src = "chrome://bitmask/skin/on.png";
   }, function(error) {
-    myPanel.label = "bitmask is not running";
+    myPanel.label = strBundle.getString("bitmaskStatusOff");
     myPanel.style.color = "red";
+    myPanel.src = "chrome://bitmask/skin/off.png";
     console.log(error);
   });
 }
index e6406d1..da906f6 100644 (file)
@@ -9,8 +9,12 @@
   <script type="application/javascript"
           src="chrome://bitmask/content/accountWizard/bitmaskMessengerOverlay.js"/>
 
+  <stringbundleset id="stringbundleset">
+    <stringbundle id="bitmaskMessengerStrings" src="chrome://bitmask/locale/bitmaskMessengerOverlay.properties"/>
+  </stringbundleset>
+
   <statusbar id="status-bar">
-      <statusbarpanel id="bitmaskStatusBarPanel" />
+    <statusbarpanel id="bitmaskStatusBarPanel" class="statusbarpanel-iconic-text" />
   </statusbar>
 
   <menupopup id="menu_NewPopup">
diff --git a/chrome/locale/en-US/bitmaskMessengerOverlay.properties b/chrome/locale/en-US/bitmaskMessengerOverlay.properties
new file mode 100644 (file)
index 0000000..eaf9434
--- /dev/null
@@ -0,0 +1,2 @@
+bitmaskStatusOn=bitmask is %S
+bitmaskStatusOff=bitmask is not running
diff --git a/chrome/skin/off.png b/chrome/skin/off.png
new file mode 100644 (file)
index 0000000..949ac98
Binary files /dev/null and b/chrome/skin/off.png differ
diff --git a/chrome/skin/on.png b/chrome/skin/on.png
new file mode 100644 (file)
index 0000000..e34c570
Binary files /dev/null and b/chrome/skin/on.png differ