[Patch] Add xfce_image_menu_item_new to libxfce4ui
mbrush at codebrainz.ca
Mon Feb 6 00:46:20 CET 2017
On 2017-02-05 09:27 AM, Florian Weigelt wrote:
> Thanks for your feedback.
>> This function would be very helpful, as we have lots of menu items and
>> IMHO dropping icons is not desired in the porting process.
>> Just a couple questions/requests:
>> * An option to create the icon from a string:
>> xfce_image_menu_item_new_with_icon ("About", TRUE, "gtk-about",
> Changing the function header to what you propose (icon name and icon
> size instead of a pre-created GtkImage) is possible, but less flexible.
> Images in menus could also be created from a pixbuf. We could also offer
> a generic xfce_image_menu_item_new_from_label_and_image and a
> specialized xfce_image_menu_item_new_from_label_and_icon_name (the names
> here are just to reflect the function headers). I am not sure: Do we
> need the generic version? Do we have cases where we create a
> GtkImageMenuItem from something different than an icon name? If not, we
> can change the function to what you proposed.
>> * What about accelerators? I can use gtk_widget_add_accelerator with the
>> returned GtkMenuItem, but the label is required to use
>> gtk_accel_label_set_accel_widget. Creating a label and adding it to
>> menu_item defeats the purpose of this function.
> This function is intended to be used for small popup menus, like opening
> the application menu in xfdesktop or a popup menu on panel plugins. I
> don't see AccelLabels there, only in menu bars. For menu bars I highly
> recommend using GMenu. AccelLabels are supported there.
> The documentation for GtkImageMenuItem shows how accelerators can be
> added to the approach of mimicking an GtkImageMenuItem with a box, an
> image and a label. If it is *really* neccessary I will add it, but
> currently I do not see the need for adding complexity to support a
> feature that, to my knowledge, is not used.
>> * Is it possible to remove the ugly left pad of menu? (See attachment).
> Short answer: Yes. Why shouldn't it? But I will have to look into it
> where the space is coming from.
Out of curiosity, have you considered just copying the code of
gtkimagemenuitem.[ch] into libxfce4ui and changing the symbol name
prefix? Assuming it's not too intertangled with other modules, it should
be pretty easy and the licenses (and even coding conventions) are
The main advantage here is not requiring much changes to applications
using the gtk_ versions, and avoiding the bug shown by André and which
happens in GMenu where the icon is pushed to the right instead of going
where the checkbox/radiobutton goes for other item kinds. Additionally
it could be added to the Glade catalog to allow applications to use
Glade still, which is not supported by your function or GMenu (last time
More information about the Xfce4-dev