Bug 1247114 - do a one-off move of the synced-tabs button to the panel if Sync is initialized. r=Gijs
--- a/browser/base/content/browser-syncui.js
+++ b/browser/base/content/browser-syncui.js
@@ -82,16 +82,18 @@ var gSyncUI = {
broadcaster.setAttribute("label", this._stringBundle.GetStringFromName("syncnow.label"));
// Initialize the Synced Tabs Sidebar
if (Services.prefs.getBoolPref("services.sync.syncedTabsUIRefresh")) {
let sidebarBroadcaster = document.getElementById("viewTabsSidebar");
sidebarBroadcaster.removeAttribute("hidden");
}
+ this.maybeMoveSyncedTabsButton();
+
this.updateUI();
},
// Returns a promise that resolves with true if Sync needs to be configured,
// false otherwise.
_needsSetup() {
// If Sync is configured for FxAccounts then we do that promise-dance.
@@ -327,16 +329,38 @@ var gSyncUI = {
PanelUI.showSubView("PanelUI-remotetabs", anchor, area);
}).catch(Cu.reportError);
} else {
// It is placed somewhere else - just try and show it.
PanelUI.showSubView("PanelUI-remotetabs", anchor, area);
}
},
+ /* After Sync is initialized we perform a once-only check for the sync
+ button being in "customize purgatory" and if so, move it to the panel.
+ This is done primarily for profiles created before SyncedTabs landed,
+ where the button defaulted to being in that purgatory.
+ We use a preference to ensure we only do it once, so people can still
+ customize it away and have it stick.
+ */
+ maybeMoveSyncedTabsButton() {
+ const prefName = "browser.migrated-sync-button";
+ let migrated = false;
+ try {
+ migrated = Services.prefs.getBoolPref(prefName);
+ } catch (_) {}
+ if (migrated) {
+ return;
+ }
+ if (!CustomizableUI.getPlacementOfWidget("sync-button")) {
+ CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
+ }
+ Services.prefs.setBoolPref(prefName, true);
+ },
+
/* Update the tooltip for the sync-status broadcaster (which will update the
Sync Toolbar button and the Sync spinner in the FxA hamburger area.)
If Sync is configured, the tooltip is when the last sync occurred,
otherwise the tooltip reflects the fact that Sync needs to be
(re-)configured.
*/
_updateSyncButtonsTooltip: Task.async(function* () {
if (!gBrowser)