Bug 813316 - User details menuitem is blank on OSX menu. r=jaws

This commit is contained in:
Felipe Gomes 2012-11-19 17:22:42 -08:00
Родитель 70ef6eb69a
Коммит b944d105a8
4 изменённых файлов: 19 добавлений и 11 удалений

Просмотреть файл

@ -508,12 +508,13 @@
<menu id="menu_socialAmbientMenu">
<menupopup id="menu_social-statusarea-popup">
<menuitem class="social-statusarea-user menuitem-iconic" pack="start" align="center"
observes="socialBroadcaster_userDetails"
oncommand="SocialUI.showProfile(); document.getElementById('social-statusarea-popup').hidePopup();">
<image class="social-statusarea-user-portrait"
observes="socialBroadcaster_userPortrait"/>
observes="socialBroadcaster_userDetails"/>
<vbox>
<label class="social-statusarea-loggedInStatus"
observes="socialBroadcaster_loggedInStatus"/>
observes="socialBroadcaster_userDetails"/>
</vbox>
</menuitem>
#ifndef XP_WIN

Просмотреть файл

@ -252,8 +252,7 @@
oncommand="openUILinkIn('https://addons.mozilla.org/firefox/collections/mozilla/webdeveloper/', 'tab');"/>
<!-- SocialAPI broadcasters -->
<broadcaster id="socialBroadcaster_userPortrait"/>
<broadcaster id="socialBroadcaster_loggedInStatus"
<broadcaster id="socialBroadcaster_userDetails"
notLoggedInLabel="&social.notLoggedIn.label;"/>
</broadcasterset>

Просмотреть файл

@ -673,12 +673,19 @@ var SocialToolbar = {
// social:profile-changed
let profile = Social.provider.profile || {};
let userPortrait = profile.portrait || "chrome://global/skin/icons/information-32.png";
document.getElementById("socialBroadcaster_userPortrait").setAttribute("src", userPortrait);
let loggedInStatusBroadcaster = document.getElementById("socialBroadcaster_loggedInStatus");
let notLoggedInString = loggedInStatusBroadcaster.getAttribute("notLoggedInLabel");
let loggedInStatusValue = profile.userName ? profile.userName : notLoggedInString;
loggedInStatusBroadcaster.setAttribute("value", loggedInStatusValue);
let userDetailsBroadcaster = document.getElementById("socialBroadcaster_userDetails");
let loggedInStatusValue = profile.userName ?
profile.userName :
userDetailsBroadcaster.getAttribute("notLoggedInLabel");;
// "image" and "label" are used by Mac's native menus that do not render the menuitem's children
// elements. "src" and "value" are used by the image/label children on the other platforms.
userDetailsBroadcaster.setAttribute("src", userPortrait);
userDetailsBroadcaster.setAttribute("image", userPortrait);
userDetailsBroadcaster.setAttribute("value", loggedInStatusValue);
userDetailsBroadcaster.setAttribute("label", loggedInStatusValue);
},
updateButton: function SocialToolbar_updateButton() {

Просмотреть файл

@ -668,12 +668,13 @@
type="menu">
<menupopup id="social-statusarea-popup">
<menuitem class="social-statusarea-user menuitem-iconic" pack="start" align="center"
observes="socialBroadcaster_userDetails"
oncommand="SocialUI.showProfile(); document.getElementById('social-statusarea-popup').hidePopup();">
<image class="social-statusarea-user-portrait"
observes="socialBroadcaster_userPortrait"/>
observes="socialBroadcaster_userDetails"/>
<vbox>
<label class="social-statusarea-loggedInStatus"
observes="socialBroadcaster_loggedInStatus"/>
observes="socialBroadcaster_userDetails"/>
</vbox>
</menuitem>
#ifndef XP_WIN