GNOME Bugzilla – Bug 659270
popup-menu: Add 'sensitive' flag to item parameters
Last modified: 2011-09-19 16:55:00 UTC
See patch.
Created attachment 196753 [details] [review] popup-menu: Add 'sensitive' flag to item parameters A menu action may not make sense at any time, so add API to mark an item insensitive to indicate that its action is currently unavailable, but may become activatable at a later point.
Do we have a user for this api ?
Yes, see bug 659275
Comment on attachment 196753 [details] [review] popup-menu: Add 'sensitive' flag to item parameters >+ } else if (sensitive && this._activeMenuItem == null) { >+ if (global.stage.get_key_focus() == this.actor) >+ menuItem.actor.grab_key_focus(); that seems dubious. I think I'd just leave the focus where it was good to commit with that change
(In reply to comment #4) > (From update of attachment 196753 [details] [review]) > >+ } else if (sensitive && this._activeMenuItem == null) { > >+ if (global.stage.get_key_focus() == this.actor) > >+ menuItem.actor.grab_key_focus(); > > that seems dubious. It is. When all items in the menu are insensitive, the key focus is moved to the entire menu (assuming it is better to have a "useless" focus than leaving it outside the menu). This code tries to move it "back" in case setSensitive() is called after the menu has been popped up (which may happen for the "Paste" item in bug 659275). Better to move the cludge there?
nah, i guess it makes sense
Attachment 196753 [details] pushed as 8242203 - popup-menu: Add 'sensitive' flag to item parameters