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 623652 - Allow for changing image dynamically in popup menu items
Allow for changing image dynamically in popup menu items
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-07-06 07:51 UTC by Giovanni Campagna
Modified: 2010-09-15 17:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PopupImageMenuItem] Support setting the image after construction (1.54 KB, patch)
2010-07-06 07:53 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2010-07-06 07:51:26 UTC
Currently, PopupImageMenuItem allows for setting the image only at creation time, requiring to recreate the item if the image changes, which is bad for performance if the image is changed often (e.g. wireless strength indicator).
Comment 1 Giovanni Campagna 2010-07-06 07:53:49 UTC
Created attachment 165330 [details] [review]
[PopupImageMenuItem] Support setting the image after construction

This patch allows the icon in PopupImageMenuItems to be changed at
any time, while preserving the item and all other properties (style,
signals) attached and without rebuilding the whole menu. This is useful
for images reflecting a dynamic status (e.g. cellular strength
indicator or battery level)
Comment 2 Dan Winship 2010-07-12 20:28:15 UTC
Comment on attachment 165330 [details] [review]
[PopupImageMenuItem] Support setting the image after construction

>-        box.add(new St.Label({ text: text }), { expand: true });
>+        this.label = new St.Label({ text: text });
>+        box.add(this.label, { expand: true });

what is this change for? If we also want to be able to update the label, then there should be a setter for that, like with setIcon. And if we don't, then the change is unnecessary?
Comment 3 Giovanni Campagna 2010-07-13 09:41:38 UTC
(In reply to comment #2)
> (From update of attachment 165330 [details] [review])
> >-        box.add(new St.Label({ text: text }), { expand: true });
> >+        this.label = new St.Label({ text: text });
> >+        box.add(this.label, { expand: true });
> 
> what is this change for? If we also want to be able to update the label, then
> there should be a setter for that, like with setIcon. And if we don't, then the
> change is unnecessary?

The icon cannot be a normal property, as the actor needs to be recreated every time, so you need a setter, either explicit or implicit (and implicit setters conflict with GJS style guide), while the label can be exposed directly (this is from discussion of bug 621356)
Comment 4 Giovanni Campagna 2010-09-15 13:06:56 UTC
Any progress of this? Should I prepare an updated patch that does not make .label public?
Comment 5 Dan Winship 2010-09-15 17:35:24 UTC
i guess it's ok as is