XfceScaledImage in libxfce4panel or libxfce4ui

Mike Massonnet mmassonnet at gmail.com
Tue May 26 11:03:34 CEST 2009


2009/5/26 Brian J. Tarricone <bjt23 at cornell.edu>:
> On 05/26/2009 12:10 AM, Nick Schermer wrote:
>>
>> Devs,
>>
>> For the new panel i've improved the XfceScaledImage widget so it's
>> useable with icon-names and filenames. Now as you might know this
>> widget is already in libxfcegui4, the question is do we move it to
>> libxfce4ui or keep it in libxfce4panel. AFAIK it is only used by panel
>> plugins atm, also in 4.6 and since we had to goal for libxfcegui4 to
>> move all specific/spesialized widgets into the module, it makes sence
>> not putting it in 4ui.
>> Thoughts?
>
> Honestly... neither.  It should be scrapped.  It's never worked properly and
> always requires some manual math for the sizing to work out correctly
> anyway.  It was a nice idea, but it just doesn't seem to work -- or even
> when it does work, it sizes the icons down smaller than they need to be.
>  (The menu plugin and mailwatch plugin don't use XfceScaledImage anymore
> because of just that.)

Well a scaled image wrapper function is useful for panel plugins. When
you create an image of e.g. 19 pixels and don't scale it, the
resulting image can be of size 16 or 22 pixels, and such an image does
not fit into the panel. Having to do an extra scale on the icon is
extra code that gets duplicated amongst every plugin which is
annoying.

So of course I'm in favor of keeping such a wrapper, would it be a
simple wrapper function or an object I don't care.

> I'd say get rid of it and provide some convenience API in libxfce4panel to
> aid in sizing images.  You could do something like pass the container widget
> to the function, and it'll calculate the correct size based on the widget
> padding of the parents of that widget up to the GtkPlug and return the
> correct height (or width, for vertical panels) that the plugin should use
> when scaling the images.

Yeah, btw that reminds me that at some point I wrote an
XfcePanelButton object, because the only use case where size
calculation was annoying was with the buttons and their thickness.
(Figuring out where I left it, and actually uups, I deleted the whole
thing). Well the object resized itself when needed so this spared
extra code for the size-changed signal, and other common stuff.

About lib4panel vs lib4ui, I had say panel, cause I don't/never needed
scaling images outside panel plugins.

>        -b

Mike



More information about the Xfce4-dev mailing list