Bug 1247114 - do a one-off move of the synced-tabs button to the panel if Sync is initialized. r=Gijs

This commit is contained in:
Mark Hammond 2016-02-16 12:22:19 +11:00
parent 1b66f34e7e
commit bfd38fcc3a

View File

@ -87,6 +87,8 @@ var gSyncUI = {
sidebarBroadcaster.removeAttribute("hidden");
}
this.maybeMoveSyncedTabsButton();
this.updateUI();
},
@ -332,6 +334,28 @@ var gSyncUI = {
}
},
/* 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,