GNOME Bugzilla – Bug 658605
userMenu: Update the user information if the object is already loaded
Last modified: 2011-09-19 16:40:35 UTC
This can happen in a few cases, such as the alternative-status-menu extension.
Created attachment 196038 [details] [review] userMenu: Update the user information if the object is already loaded Any time we get a cached user object from the AccountsService, it will already be loaded.
Review of attachment 196038 [details] [review]: Basically looks fine, suggestion below. You should do the same for UserMenuButton (and possibly EndSessionDialog) though. Also, the commit message's subject line is a bit cryptic (what's "the object"?) ... ::: js/ui/userMenu.js @@ +194,3 @@ + Lang.bind(this, + this._updateUser)); + } _updateUser() already handles the case where is_loaded is false, so you could just add this._updateUser(); after connecting the signals (which is consistent with polkitAuthenticationAgent).
Created attachment 196045 [details] [review] userMenu: Update the user information if the object is already loaded Any time we get a cached user object from the AccountsService, it will already be loaded. I couldn't exactly use what you said
Review of attachment 196045 [details] [review]: ::: js/ui/userMenu.js @@ +196,3 @@ Lang.bind(this, this._updateUser)); + this.actor.connect('realize', Lang.bind(this, function() { don't use ::realize — it doesn't do what you think it does. the signal to know if an actor is going to be painted — i.e. it's visible and it's on the stage — is notify:mapped.
Review of attachment 196045 [details] [review]: (In reply to comment #4) > the signal to know if an actor is going to be painted — i.e. it's visible and > it's on the stage — is notify:mapped. Of course that'll mean that we update too often (e.g. every time the menu is opened rather than just the first time), but it shouldn't matter much. If ::style-changed works as well, it's probably slightly better though (as this.actor is non-reactive, so no :hover or similar style changes) ... ::: js/ui/userMenu.js @@ +6,3 @@ const GLib = imports.gi.GLib; const Lang = imports.lang; +const Meta = imports.gi.Meta; Supposed left-over from trying to use Meta.later_add()
Created attachment 196159 [details] [review] userMenu: Update the user information if the object is already loaded Any time we get a cached user object from the AccountsService, it will already be loaded.
Review of attachment 196159 [details] [review]: Looks OK, though using notify::mapped means that we reload the avatar image way too often.
Attachment 196159 [details] pushed as 543b29e - userMenu: Update the user information if the object is already loaded