[Patch] Add xfce_image_menu_item_new to libxfce4ui

Florian Weigelt weigelt.florian at gmx.net
Sun Feb 5 18:27:39 CET 2017


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",
> GTK_ICON_SIZE_MENU);
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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://mail.xfce.org/pipermail/xfce4-dev/attachments/20170205/8f19ea21/attachment-0001.sig>


More information about the Xfce4-dev mailing list