After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 659270 - popup-menu: Add 'sensitive' flag to item parameters
popup-menu: Add 'sensitive' flag to item parameters
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks: 659275
 
 
Reported: 2011-09-16 17:24 UTC by Florian Müllner
Modified: 2011-09-19 16:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
popup-menu: Add 'sensitive' flag to item parameters (4.33 KB, patch)
2011-09-16 17:24 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2011-09-16 17:24:13 UTC
See patch.
Comment 1 Florian Müllner 2011-09-16 17:24:17 UTC
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.
Comment 2 Matthias Clasen 2011-09-17 18:13:35 UTC
Do we have a user for this api ?
Comment 3 Florian Müllner 2011-09-17 18:35:29 UTC
Yes, see bug 659275
Comment 4 Dan Winship 2011-09-19 14:11:01 UTC
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
Comment 5 Florian Müllner 2011-09-19 14:59:39 UTC
(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?
Comment 6 Dan Winship 2011-09-19 16:50:16 UTC
nah, i guess it makes sense
Comment 7 Florian Müllner 2011-09-19 16:54:56 UTC
Attachment 196753 [details] pushed as 8242203 - popup-menu: Add 'sensitive' flag to item parameters