Bug 675821 - Part 2: update sync links in aboutHome UI on sync setup or unlink. r=philikon

This commit is contained in:
Chenxia Liu 2011-10-26 21:26:53 -04:00
parent 809c000574
commit 53784af0a7

View File

@ -211,6 +211,24 @@ let gSyncUI = {
this.clearError(title);
},
// Set visibility of "Setup Sync" link
showSetupSyncAboutHome: function SUI_showSetupSyncAboutHome(toShow) {
let browsers = gBrowser.browsers;
for (let i = 0; i < browsers.length; i++) {
let b = browsers[i];
if ("about:home" == b.currentURI.spec) {
b.contentDocument.getElementById("setupSyncLink").hidden = !toShow;
}
}
},
onSetupComplete: function SUI_onSetupComplete() {
// Remove "setup sync" link in about:home if it is open.
this.showSetupSyncAboutHome(false);
onLoginFinish();
},
onLoginError: function SUI_onLoginError() {
// if login fails, any other notifications are essentially moot
Weave.Notifications.removeAll();
@ -255,6 +273,8 @@ let gSyncUI = {
onStartOver: function SUI_onStartOver() {
this.clearError();
// Make "setup sync" link visible in about:home if it is open.
this.showSetupSyncAboutHome(true);
},
onQuotaNotice: function onQuotaNotice(subject, data) {
@ -486,7 +506,7 @@ let gSyncUI = {
this.onQuotaNotice();
break;
case "weave:service:setup-complete":
this.onLoginFinish();
this.onSetupComplete();
break;
case "weave:service:login:start":
this.onActivityStart();