mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
Restructured icon menu item creation in menu_quick_item to use explicit GTK3 GtkMenuItem + GtkBox + GtkImage/GtkLabel handling with a GTK2 GtkImageMenuItem fallback.
Added GTK3 image null checks and explicit GTK3/GTK2 branching for chanlist icon menu items. Added GTK3 image null checks and explicit GTK3/GTK2 branching for sexy spell entry icon menu items.
This commit is contained in:
@@ -138,11 +138,11 @@ chanlist_icon_menu_item (const char *label, const char *icon_name,
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
||||
label_widget = gtk_label_new_with_mnemonic (label);
|
||||
gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
|
||||
if (image)
|
||||
gtk_box_pack_start (GTK_BOX (box), image, 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
|
||||
#else
|
||||
GtkWidget *image;
|
||||
|
||||
item = gtk_image_menu_item_new_with_mnemonic (label);
|
||||
|
||||
@@ -284,9 +284,6 @@ menu_quick_item (char *cmd, char *label, GtkWidget * menu, int flags,
|
||||
/*if (flags & XCMENU_MARKUP)
|
||||
item = gtk_image_menu_item_new_with_markup (label);
|
||||
else*/
|
||||
#if !HAVE_GTK3
|
||||
item = gtk_image_menu_item_new_with_mnemonic (label);
|
||||
#endif
|
||||
img = NULL;
|
||||
if (access (icon, R_OK) == 0) /* try fullpath */
|
||||
img = gtk_image_new_from_file (icon);
|
||||
@@ -301,8 +298,7 @@ menu_quick_item (char *cmd, char *label, GtkWidget * menu, int flags,
|
||||
#if HAVE_GTK3
|
||||
icon_name = gtkutil_icon_name_from_stock (icon);
|
||||
img = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
#else
|
||||
img = gtk_image_new_from_stock (icon, GTK_ICON_SIZE_MENU);
|
||||
#endif
|
||||
}
|
||||
@@ -317,9 +313,9 @@ menu_quick_item (char *cmd, char *label, GtkWidget * menu, int flags,
|
||||
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
|
||||
#else
|
||||
item = gtk_image_menu_item_new_with_mnemonic (label);
|
||||
if (img)
|
||||
#if !HAVE_GTK3
|
||||
gtk_image_menu_item_set_image ((GtkImageMenuItem *)item, img);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -644,11 +644,11 @@ sexy_spell_entry_icon_menu_item (const char *label, const char *stock_name)
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
||||
label_widget = gtk_label_new_with_mnemonic (label);
|
||||
gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
|
||||
if (image)
|
||||
gtk_box_pack_start (GTK_BOX (box), image, 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
|
||||
#else
|
||||
GtkWidget *image;
|
||||
|
||||
item = gtk_image_menu_item_new_with_label (label);
|
||||
|
||||
Reference in New Issue
Block a user