GNOME Bugzilla – Bug 340107
status icon size returns bogus value
Last modified: 2014-08-30 05:20:40 UTC
The first call to gtk_status_icon_get_size seems to return bogus values (I always get 200 here.) This is bad because you may want to use that value on startup to load your pixbufs at that size for use in the status icon...
Created attachment 64517 [details] testcase as patch for teststatusicon.c
*** Bug 377674 has been marked as a duplicate of this bug. ***
As you can see on the duplicate (reported by me) this indeed happens. Marking as NEW.
*** Bug 348971 has been marked as a duplicate of this bug. ***
Created attachment 81439 [details] [review] proposed patch This patch fixes the problem. It makes sure to only update the size if the icon is embedded, and clarifies the docs to that effect.
This is documentation addition is certainly good: * Note that the returned size is only meaningful while the status * icon is embedded (see gtk_status_icon_is_embedded()) But why do we need to do anything else ? Returning 0 when non-embedded will only break the users which are currently getting a surprise value of 200 in a worse way, since trying to construct a pixbuf of size 0 will fail.
The idea of getting the value before embedding is to construct a correct size pixbuf.
Actually the idea behind returning an invalid size when _not_ embedded was to make it clear that you shouldn't construct a pixbuf before the embedding has negotiated the size.
I have committed the doc addition. 2007-04-28 Matthias Clasen <mclasen@redhat.com> * gtk/gtkstatusicon.c (gtk_status_icon_get_size): Add a note about being embedded. (#340107, Christian Persch)
GtkStatusIcon has been deprecated