Bug 517757 - Small calendar-statusbar.js cleanup. r=philipp
authorMartin Schroeder <mschroeder@mozilla.x-home.org>
Mon, 26 Oct 2009 00:10:00 +0100
changeset 4241 0e7946684b94504eea39cdbf68d8f0ed5c1027e5
parent 4240 1cee73f0baea5f8f6b40a92018aadff059d8ff5f
child 4242 dab073a1923f94a69d03393242130a6f8a1145ee
push id3312
push usermschroeder@mozilla.x-home.org
push dateSun, 25 Oct 2009 23:10:11 +0000
treeherdercomm-central@0e7946684b94 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilipp
bugs517757
Bug 517757 - Small calendar-statusbar.js cleanup. r=philipp
calendar/base/content/calendar-statusbar.js
--- a/calendar/base/content/calendar-statusbar.js
+++ b/calendar/base/content/calendar-statusbar.js
@@ -8,22 +8,24 @@
  *
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
  *
  * The Original Code is Sun Microsystems code.
  *
- * The Initial Developer of the Original Code is Sun Microsystems.
+ * The Initial Developer of the Original Code is
+ * Sun Microsystems.
  * Portions created by the Initial Developer are Copyright (C) 2008
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *   Berend Cornelius <berend.cornelius@sun.com>
+ *   Martin Schroeder <mschroeder@mozilla.x-home.org>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -34,45 +36,40 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 /**
  * This code might change soon if we support Thunderbird's activity manager.
  * NOTE: The naming "Meteors" is historical.
  */
  var gCalendarStatusFeedback = {
-     mCalendarValue: 0,
      mCalendarStep: 0,
      mCalendarCount: 0,
      mWindow: null,
      mStatusText: null,
      mStatusBar: null,
      mStatusProgressPanel: null,
      mThrobber: null,
      mProgressMode: Components.interfaces.calIStatusObserver.NO_PROGRESS,
      mCurIndex: 0,
      mInitialized: false,
-     mProps: null,
      mCalendars: {},
 
     QueryInterface: function cStObs_QueryInterface(aIID) {
         return doQueryInterface(this, null, aIID, [Components.interfaces.calIStatusObserver])
     },
 
      initialize: function cStObs_initialize(aWindow) {
-        if (this.mInitialized == false) {
+        if (!this.mInitialized) {
             this.mWindow = aWindow;
             this.mStatusText = this.mWindow.document.getElementById("statusText");
             this.mStatusBar = this.mWindow.document.getElementById("statusbar-icon");
             this.mStatusProgressPanel = this.mWindow.document.getElementById("statusbar-progresspanel");
             this.mThrobber = this.mWindow.document.getElementById("navigator-throbber");
-            var sbs = Components.classes["@mozilla.org/intl/stringbundle;1"]
-                            .getService(Components.interfaces.nsIStringBundleService);
-            this.mProps = sbs.createBundle("chrome://calendar/locale/calendar.properties");
-            this. mInitialized = true;
+            this.mInitialized = true;
         }
      },
 
      showStatusString: function cStObs_showStatusString(status){
          this.mStatusText.setAttribute("label", status);
      },
 
      get spinning cStObs_spinning() {
@@ -115,32 +112,31 @@
              this.mStatusProgressPanel.collapsed = true;
              this.mStatusBar.setAttribute("mode", "normal");
              this.mStatusBar.value = 0;
              this.mCalendarCount = 0;
              this.showStatusString("");
              if (this.mThrobber) {
                  this.mThrobber.setAttribute("busy", false);
              }
-             this.mCalendarValue = 0;
          }
      },
 
      calendarCompleted: function cStObs_calendarCompleted(aCalendar) {
          if (!this.mInitialized) {
             return;
          }
          if (this.spinning != Components.interfaces.calIStatusObserver.NO_PROGRESS) {
              if (this.spinning == Components.interfaces.calIStatusObserver.DETERMINED_PROGRESS) {
                  if (!this.mCalendars[aCalendar.id] || this.mCalendars[aCalendar.id] === undefined) {
                      this.mCalendars[aCalendar.id] = true;
                      this.mStatusBar.value = (parseInt(this.mStatusBar.value) + this.mCalendarStep);
                      this.mCurIndex++;
-                     var curStatus = this.mProps.formatStringFromName("gettingCalendarInfoDetail",
-                              [this.mCurIndex, this.mCalendarCount], 2);
+                     let curStatus = calGetString("calendar", "gettingCalendarInfoDetail",
+                                                  [this.mCurIndex, this.mCalendarCount]);
                      this.showStatusString(curStatus);
                  }
              }
              if (this.mThrobber){
                  this.mThrobber.setAttribute("busy", true);
              }
          }
      }