mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 940494 - when a Social provider has a status button, the provider's icon should go to the status button rather than the social api toolbar button, r=markh.
This commit is contained in:
parent
4de147d201
commit
1cc530aee0
@ -136,7 +136,7 @@ SocialUI = {
|
||||
|
||||
// Provider-specific notifications
|
||||
case "social:ambient-notification-changed":
|
||||
SocialStatus.updateNotification(data);
|
||||
SocialStatus.updateButton(data);
|
||||
if (this._matchesCurrentProvider(data)) {
|
||||
SocialToolbar.updateButton();
|
||||
SocialMenu.populate();
|
||||
@ -146,9 +146,12 @@ SocialUI = {
|
||||
// make sure anything that happens here only affects the provider for
|
||||
// which the profile is changing, and that anything we call actually
|
||||
// needs to change based on profile data.
|
||||
SocialStatus.updateButton(data);
|
||||
if (this._matchesCurrentProvider(data)) {
|
||||
SocialToolbar.updateProvider();
|
||||
}
|
||||
// Refresh the provider menus, as the icons may have changed.
|
||||
SocialToolbar.populateProviderMenus();
|
||||
break;
|
||||
case "social:frameworker-error":
|
||||
if (this.enabled && Social.provider.origin == data) {
|
||||
@ -834,17 +837,22 @@ SocialToolbar = {
|
||||
// Called when the Social.provider changes
|
||||
updateProvider: function () {
|
||||
let provider = Social.provider;
|
||||
if (provider) {
|
||||
// If the provider uses the new SocialStatus button, then they do
|
||||
// not get to customize the old toolbar button. Since the status
|
||||
// button depends on multiple workers, if not enabled we will
|
||||
// ignore this limitation. That allows a provider to migrate to
|
||||
// the new functionality once we enable multiple workers.
|
||||
if (provider && (!provider.statusURL || !Social.allowMultipleWorkers)) {
|
||||
this.button.setAttribute("label", provider.name);
|
||||
this.button.setAttribute("tooltiptext", provider.name);
|
||||
this.button.style.listStyleImage = "url(" + provider.iconURL + ")";
|
||||
|
||||
this.updateProfile();
|
||||
} else {
|
||||
this.button.setAttribute("label", gNavigatorBundle.getString("service.toolbarbutton.label"));
|
||||
this.button.setAttribute("tooltiptext", gNavigatorBundle.getString("service.toolbarbutton.tooltiptext"));
|
||||
this.button.style.removeProperty("list-style-image");
|
||||
}
|
||||
if (provider)
|
||||
this.updateProfile();
|
||||
this.updateButton();
|
||||
},
|
||||
|
||||
@ -1432,7 +1440,7 @@ SocialStatus = {
|
||||
aButton.setAttribute("notificationFrameId", notificationFrameId);
|
||||
},
|
||||
|
||||
updateNotification: function(origin) {
|
||||
updateButton: function(origin) {
|
||||
if (!Social.allowMultipleWorkers)
|
||||
return;
|
||||
let provider = Social._getProviderFromOrigin(origin);
|
||||
@ -1442,16 +1450,23 @@ SocialStatus = {
|
||||
let icons = provider.ambientNotificationIcons;
|
||||
let iconNames = Object.keys(icons);
|
||||
let notif = icons[iconNames[0]];
|
||||
|
||||
// The image and tooltip need to be updated for both
|
||||
// ambient notification and profile changes.
|
||||
let iconURL, tooltiptext;
|
||||
if (notif) {
|
||||
iconURL = notif.iconURL;
|
||||
tooltiptext = notif.label;
|
||||
}
|
||||
button.setAttribute("image", iconURL || provider.iconURL);
|
||||
button.setAttribute("tooltiptext", tooltiptext || provider.name);
|
||||
|
||||
if (!notif) {
|
||||
button.setAttribute("badge", "");
|
||||
button.setAttribute("aria-label", "");
|
||||
button.setAttribute("tooltiptext", "");
|
||||
return;
|
||||
}
|
||||
|
||||
button.style.listStyleImage = "url(" + notif.iconURL || provider.iconURL + ")";
|
||||
button.setAttribute("tooltiptext", notif.label);
|
||||
|
||||
let badge = notif.counter || "";
|
||||
button.setAttribute("badge", badge);
|
||||
let ariaLabel = notif.label;
|
||||
|
@ -140,7 +140,7 @@ var tests = {
|
||||
port.close();
|
||||
waitForCondition(function() { return btn.getAttribute("badge"); },
|
||||
function() {
|
||||
is(btn.style.listStyleImage, "url(\"" + icon.iconURL + "\")", "notification icon updated");
|
||||
is(btn.getAttribute("image"), icon.iconURL, "notification icon updated");
|
||||
next();
|
||||
}, "button updated by notification");
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ function checkSocialUI(win) {
|
||||
|
||||
isbool(!doc.getElementById("social-toolbar-item").hidden, active, "toolbar items visible?");
|
||||
if (active) {
|
||||
if (!enabled) {
|
||||
if (!enabled || (Social.defaultProvider.statusURL && Social.allowMultipleWorkers)) {
|
||||
_ok(!win.SocialToolbar.button.style.listStyleImage, "toolbar button is default icon");
|
||||
} else {
|
||||
_is(win.SocialToolbar.button.style.listStyleImage, 'url("' + Social.defaultProvider.iconURL + '")', "toolbar button has provider icon");
|
||||
@ -576,4 +576,3 @@ function closeAllChats() {
|
||||
let chatbar = window.SocialChatBar.chatbar;
|
||||
chatbar.removeAll();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user