Bug 516500: Update buttons in addons panel throw an error if there are no addons previously installed [r=gavin.sharp r=mark.finkle]
authorVivien Nicolas <21@vingtetun.org>
Mon, 21 Sep 2009 16:10:54 -0400
changeset 65583 7bcec3ae8504754d379d237b69389bb22f3c1c59
parent 65582 a711dc4304cda7c82af414345b084ce139d5df76
child 65584 6ca9357850929e6f9f5ee9a37e29c42fcbbd2b51
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin, mark
bugs516500
Bug 516500: Update buttons in addons panel throw an error if there are no addons previously installed [r=gavin.sharp r=mark.finkle]
mobile/chrome/content/browser.xul
mobile/chrome/content/extensions.js
mobile/themes/hildon/browser.css
mobile/themes/wince/browser.css
--- a/mobile/chrome/content/browser.xul
+++ b/mobile/chrome/content/browser.xul
@@ -321,17 +321,18 @@
           <hbox id="addons-header" class="panel-header">
             <label value="&addonsHeader.label;"/>
           </hbox>
           <notificationbox id="addons-messages" flex="1">
             <richlistbox id="addons-list" flex="1" onselect="ExtensionsView.hideOptions()">
               <richlistitem id="addons-local" class="section-header" align="center">
                 <label value="&addonsLocal.label;" flex="1"/>
                 <spacer flex="1"/>
-                <button class="button-dark" label="&addonsUpdate.label;" oncommand="ExtensionsView.updateAll();"/>
+                <button id="addons-update-all" class="button-dark" label="&addonsUpdate.label;"
+                        oncommand="ExtensionsView.updateAll();"/>
               </richlistitem>
               <richlistitem id="addons-repo" class="section-header">
                 <label value="&addonsRepo.label;" flex="1"/>
                 <textbox id="addons-search-text" emptytext="&addonsSearch2.emptytext;" type="search" searchbutton="false"
                          oncommand="ExtensionsView.getAddonsFromRepo(this.value);"/>
               </richlistitem>
             </richlistbox>
           </notificationbox>
--- a/mobile/chrome/content/extensions.js
+++ b/mobile/chrome/content/extensions.js
@@ -291,16 +291,17 @@ var ExtensionsView = {
 
   getAddonsFromLocal: function ev_getAddonsFromLocal() {
     this.clearSection("local");
 
     let items = this._extmgr.getItemList(Ci.nsIUpdateItem.TYPE_ANY, {});
     if (items.length == 0) {
       let strings = document.getElementById("bundle_browser");
       this.displaySectionMessage("local", strings.getString("addonsLocalNone.label"), null, true);
+      document.getElementById("addons-update-all").disabled = true;
     }
 
     for (let i = 0; i < items.length; i++) {
       let addon = items[i];
 
       // Some information is not directly accessible from the extmgr
       let isDisabled = this._getRDFProperty(addon.id, "isDisabled") == "true";
       let appDisabled = this._getRDFProperty(addon.id, "appDisabled");
@@ -519,17 +520,17 @@ var ExtensionsView = {
       return;
   
     // To support custom views we check the add-ons displayed in the list
     let items = [];
     let start = this._localItem.nextSibling;
     let end = this._repoItem;
 
     while (start != end) {
-      if (start.getAttribute("updateable") != "false")
+      if (start.getAttribute("updateable") == "true")
         items.push(this._extmgr.getItemForID(start.getAttribute("addonID")));
       start = start.nextSibling;
     }
   
     if (items.length > 0) {
       let listener = new UpdateCheckListener();
       this._extmgr.update(items, items.length, Ci.nsIExtensionManager.UPDATE_CHECK_NEWVERSION, listener);
     }
--- a/mobile/themes/hildon/browser.css
+++ b/mobile/themes/hildon/browser.css
@@ -354,16 +354,24 @@ toolbarbutton.page-button {
 
 @media (orientation: portrait) {
   #addons-repo {
     -moz-box-orient: vertical;
     -moz-box-pack: center;
   }
 }
 
+#addons-update-all {
+  color: #000 !important;
+}
+
+#addons-update-all[disabled="true"] {
+  color: #aaa !important;
+}
+
 .addon-rating[rating] {
   width: 78px;
   height: 18px;
   list-style-image: url("chrome://browser/skin/images/ratings-18.png");
 }
 
 .addon-rating[rating="0"] {
   -moz-image-region: rect(0px 78px 18px 0px);
--- a/mobile/themes/wince/browser.css
+++ b/mobile/themes/wince/browser.css
@@ -179,16 +179,24 @@ toolbarbutton.page-button {
   }
 
   /* let the buttons in a selected addon wrap */
   #addons-list > richlistitem .buttons-box {
     display: block;
   }
 }
 
+#addons-update-all {
+  color: #000 !important;
+}
+
+#addons-update-all[disabled="true"] {
+  color: #aaa !important;
+}
+
 /* console panel UI   ------------------------------------------------------ */
 @media (orientation: landscape) {
   #console-filter-warnings,
   #console-filter-messages {
     visibility: visible;
   }
 }