Bug 868523 - snapped synced tabs entry doesnt hide if sync is not enabled.r=jimm
authorAllison Naaktgeboren <ally@mozilla.com>
Tue, 07 May 2013 19:29:41 -0700
changeset 131203 229cd16b078aae64e3a36093828f956bbf953182
parent 131202 42e458069da3d884542e5d67eca1133852335683
child 131204 6e240d2c2ce8e66469b55a24a7ee87da01f28e37
push id27725
push useranaaktgeboren@mozilla.com
push dateWed, 08 May 2013 02:29:55 +0000
treeherdermozilla-inbound@229cd16b078a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs868523
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 868523 - snapped synced tabs entry doesnt hide if sync is not enabled.r=jimm
browser/metro/base/content/RemoteTabs.js
browser/metro/base/content/browser.xul
browser/metro/locales/en-US/chrome/browser.dtd
--- a/browser/metro/base/content/RemoteTabs.js
+++ b/browser/metro/base/content/RemoteTabs.js
@@ -14,36 +14,36 @@ Components.utils.import("resource://serv
  * not make calls that start sync or sync tabs since this module loads really
  * early during startup.
  *
  * @param    aSet         Control implementing nsIDOMXULSelectControlElement.
  * @param    aSetUIAccess The UI element that should be hidden when Sync is
  *                          disabled. Must sanely support 'hidden' attribute.
  *                          You may only have one UI access point at this time.
  */
-function RemoteTabsView(aSet, aSetUIAccess) {
+function RemoteTabsView(aSet, aSetUIAccessList) {
   this._set = aSet;
   this._set.controller = this;
-  this._uiAccessElement = aSetUIAccess;
+  this._uiAccessElements = aSetUIAccessList;
 
   // Sync uses special voodoo observers.
   // If you want to change this code, talk to the fx-si team
   Weave.Svc.Obs.add("weave:service:sync:finish", this);
   Weave.Svc.Obs.add("weave:service:start-over", this);
   if (this.isSyncEnabled() ) {
     this.populateGrid();
   }
   else {
     this.setUIAccessVisible(false);
   }
 }
 
 RemoteTabsView.prototype = {
   _set: null,
-  _uiAccessElement: null,
+  _uiAccessElements: [],
 
   handleItemClick: function tabview_handleItemClick(aItem) {
     let url = aItem.getAttribute("value");
     BrowserUI.goToURI(url);
   },
 
   observe: function(subject, topic, data) {
     switch (topic) {
@@ -52,17 +52,19 @@ RemoteTabsView.prototype = {
         break;
       case "weave:service:start-over":
         this.setUIAccessVisible(false);
         break;
     }
   },
 
   setUIAccessVisible: function setUIAccessVisible(aVisible) {
-    this._uiAccessElement.hidden = !aVisible;
+    for (let elem of this._uiAccessElements) {
+      elem.hidden = !aVisible;
+    }
   },
 
   populateGrid: function populateGrid() {
 
     let tabsEngine = Weave.Service.engineManager.get("tabs");
     let list = this._set;
     let seenURLs = new Set();
 
@@ -103,17 +105,18 @@ RemoteTabsView.prototype = {
 };
 
 let RemoteTabsStartView = {
   _view: null,
   get _grid() { return document.getElementById("start-remotetabs-grid"); },
 
   init: function init() {
     let vbox = document.getElementById("start-remotetabs");
-    this._view = new RemoteTabsView(this._grid, vbox);
+    let uiList = [vbox];
+    this._view = new RemoteTabsView(this._grid, uiList);
   },
 
   uninit: function uninit() {
     this._view.destruct();
   },
 
   show: function show() {
     this._grid.arrangeItems();
@@ -122,19 +125,21 @@ let RemoteTabsStartView = {
 
 let RemoteTabsPanelView = {
   _view: null,
 
   get _grid() { return document.getElementById("remotetabs-list"); },
   get visible() { return PanelUI.isPaneVisible("remotetabs-container"); },
 
   init: function init() {
-    //decks are fragile, don't hide the tab panel(bad things happen), hide link.
+    //decks are fragile, don't hide the tab panel(bad things happen), hide link in menu.
     let menuEntry = document.getElementById("menuitem-remotetabs");
-    this._view = new RemoteTabsView(this._grid, menuEntry);
+    let snappedEntry = document.getElementById("snappedRemoteTabsLabel");
+    let uiList = [menuEntry, snappedEntry];
+    this._view = new RemoteTabsView(this._grid, uiList);
   },
 
   show: function show() {
     this._grid.arrangeItems();
   },
 
   uninit: function uninit() {
     this._view.destruct();
--- a/browser/metro/base/content/browser.xul
+++ b/browser/metro/base/content/browser.xul
@@ -286,17 +286,17 @@
               <vbox id="snapped-topsites">
                 <label class="meta-section-title" value="&startTopSitesHeader.label;"/>
                 <richgrid id="snapped-topsites-grid" class="canSnapTiles" rows="8" columns="1" flex="1"/>
               </vbox>
               <label class="meta-section-title" value="&startBookmarksHeader.label;"
                 onclick="PanelUI.show('bookmarks-container');"/>
               <label class="meta-section-title" value="&startHistoryHeader.label;"
                 onclick="PanelUI.show('history-container');" inputProcessing="true"/>
-              <label class="meta-section-title" value="&startRemoteTabsHeader.label;"
+              <label id="snappedRemoteTabsLabel" class="meta-section-title" value="&snappedRemoteTabsHeader.label;"
                 onclick="PanelUI.show('remotetabs-container');" inputProcessing="true"/>
             </scrollbox>
           </vbox>
           <!-- Autocompletion interface -->
           <box id="start-autocomplete" observes="bcast_windowState"/>
         </hbox>
       </vbox> <!-- end tray -->
 
--- a/browser/metro/locales/en-US/chrome/browser.dtd
+++ b/browser/metro/locales/en-US/chrome/browser.dtd
@@ -12,16 +12,19 @@
 
 <!ENTITY appbarFindInPage2.label    "Find in page">
 <!ENTITY appbarViewOnDesktop2.label "View on desktop">
 
 <!ENTITY startTopSitesHeader.label        "Top Sites">
 <!ENTITY startBookmarksHeader.label       "Bookmarks">
 <!ENTITY startHistoryHeader.label         "Recent History">
 <!ENTITY startRemoteTabsHeader.label      "Tabs from Other Devices">
+<!-- LOCALIZATION NOTE (snappedRemoteTabsHeader.label): shortened version of startRemoteTabsHeader.label.
+     Needs to be two words or shorter to fit in narrow vertical space.-->
+<!ENTITY snappedRemoteTabsHeader.label    "Remote Tabs">
 
 <!ENTITY autocompleteResultsHeader.label  "Your Results">
 <!ENTITY autocompleteSearchesHeader.label "Internet Searches"> 
 
 <!ENTITY downloadsHeader.label     "Downloads">
 <!ENTITY downloadShowPage.label    "Go to Page">
 <!ENTITY downloadShow2.label       "Find">
 <!ENTITY downloadOpen2.label       "Open">