mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-12 08:40:19 +00:00
Added a GTK3 helper to build icon+label menu items for the channel list context menu entries.
Added a GTK3 helper for icon-name menu items and reused it when building stock icon menu entries. Added a GTK3 helper for spelling-related menu items and reused it for add/ignore/suggestions entries.
This commit is contained in:
@@ -353,6 +353,27 @@ menu_quick_item (char *cmd, char *label, GtkWidget * menu, int flags,
|
||||
return item;
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
static GtkWidget *
|
||||
menu_icon_name_item_new (const char *label, const char *icon_name)
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *box;
|
||||
GtkWidget *image;
|
||||
GtkWidget *label_widget;
|
||||
|
||||
item = gtk_menu_item_new ();
|
||||
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);
|
||||
gtk_box_pack_start (GTK_BOX (box), label_widget, FALSE, FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (item), box);
|
||||
|
||||
return item;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
menu_quick_item_with_callback (void *callback, char *label, GtkWidget * menu,
|
||||
void *arg)
|
||||
@@ -2011,7 +2032,7 @@ create_icon_menu (char *labeltext, void *stock_name, int is_stock)
|
||||
#if HAVE_GTK3
|
||||
const char *icon_name = gtkutil_icon_name_from_stock (stock_name);
|
||||
|
||||
img = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
||||
item = menu_icon_name_item_new (labeltext, icon_name);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
img = gtk_image_new_from_stock (stock_name, GTK_ICON_SIZE_MENU);
|
||||
@@ -2020,6 +2041,7 @@ 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)
|
||||
{
|
||||
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
GtkWidget *label_widget = gtk_label_new_with_mnemonic (labeltext);
|
||||
|
||||
Reference in New Issue
Block a user