mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
Updated create_icon_menu to build GTK3 menu items with a boxed image + mnemonic label and icon-name-based images.
This commit is contained in:
@@ -2037,6 +2037,8 @@ create_icon_menu (char *labeltext, void *stock_name, int is_stock)
|
||||
{
|
||||
GtkWidget *item, *img;
|
||||
#if HAVE_GTK3
|
||||
GtkWidget *box;
|
||||
GtkWidget *label_widget;
|
||||
const char *icon_name;
|
||||
#endif
|
||||
|
||||
@@ -2044,6 +2046,9 @@ create_icon_menu (char *labeltext, void *stock_name, int is_stock)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
icon_name = gtkutil_icon_name_from_stock (stock_name);
|
||||
img = NULL;
|
||||
if (icon_name)
|
||||
img = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
img = gtk_image_new_from_stock (stock_name, GTK_ICON_SIZE_MENU);
|
||||
@@ -2052,10 +2057,13 @@ create_icon_menu (char *labeltext, void *stock_name, int is_stock)
|
||||
else
|
||||
img = gtk_image_new_from_pixbuf (*((GdkPixbuf **)stock_name));
|
||||
#if HAVE_GTK3
|
||||
if (is_stock)
|
||||
item = menu_item_new_with_icon_name_and_label (icon_name, labeltext);
|
||||
else
|
||||
item = menu_item_new_with_image_and_label (img, labeltext);
|
||||
item = gtk_menu_item_new ();
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
label_widget = gtk_label_new_with_mnemonic (labeltext);
|
||||
if (img)
|
||||
gtk_box_pack_start (GTK_BOX (box), img, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), label_widget, FALSE, FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (item), box);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
item = gtk_image_menu_item_new_with_mnemonic (labeltext);
|
||||
|
||||
Reference in New Issue
Block a user