mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-14 09:40:20 +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;
|
GtkWidget *item, *img;
|
||||||
#if HAVE_GTK3
|
#if HAVE_GTK3
|
||||||
|
GtkWidget *box;
|
||||||
|
GtkWidget *label_widget;
|
||||||
const char *icon_name;
|
const char *icon_name;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2044,6 +2046,9 @@ create_icon_menu (char *labeltext, void *stock_name, int is_stock)
|
|||||||
{
|
{
|
||||||
#if HAVE_GTK3
|
#if HAVE_GTK3
|
||||||
icon_name = gtkutil_icon_name_from_stock (stock_name);
|
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
|
#endif
|
||||||
#if !HAVE_GTK3
|
#if !HAVE_GTK3
|
||||||
img = gtk_image_new_from_stock (stock_name, GTK_ICON_SIZE_MENU);
|
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
|
else
|
||||||
img = gtk_image_new_from_pixbuf (*((GdkPixbuf **)stock_name));
|
img = gtk_image_new_from_pixbuf (*((GdkPixbuf **)stock_name));
|
||||||
#if HAVE_GTK3
|
#if HAVE_GTK3
|
||||||
if (is_stock)
|
item = gtk_menu_item_new ();
|
||||||
item = menu_item_new_with_icon_name_and_label (icon_name, labeltext);
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||||
else
|
label_widget = gtk_label_new_with_mnemonic (labeltext);
|
||||||
item = menu_item_new_with_image_and_label (img, 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
|
#endif
|
||||||
#if !HAVE_GTK3
|
#if !HAVE_GTK3
|
||||||
item = gtk_image_menu_item_new_with_mnemonic (labeltext);
|
item = gtk_image_menu_item_new_with_mnemonic (labeltext);
|
||||||
|
|||||||
Reference in New Issue
Block a user