mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-17 19:20:20 +00:00
Added a GTK3-only helper to build button images from stock IDs via icon-name mapping, and refactored gtkutil_button to use it while keeping GTK2 stock handling intact.
Verified gtkutil_button(...) callers with rg -n "gtkutil_button\\s*\\(" src/fe-gtk.
This commit is contained in:
@@ -118,6 +118,14 @@ gtkutil_icon_name_from_stock (const char *stock_name)
|
|||||||
|
|
||||||
return stock_name;
|
return stock_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GtkWidget *
|
||||||
|
gtkutil_image_new_from_stock (const char *stock, GtkIconSize size)
|
||||||
|
{
|
||||||
|
const char *icon_name = gtkutil_icon_name_from_stock (stock);
|
||||||
|
|
||||||
|
return gtk_image_new_from_icon_name (icon_name, size);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -584,11 +592,7 @@ gtkutil_button (GtkWidget *box, char *stock, char *tip, void *callback,
|
|||||||
img = NULL;
|
img = NULL;
|
||||||
#if HAVE_GTK3
|
#if HAVE_GTK3
|
||||||
if (stock)
|
if (stock)
|
||||||
{
|
img = gtkutil_image_new_from_stock (stock, GTK_ICON_SIZE_BUTTON);
|
||||||
const char *icon_name = gtkutil_icon_name_from_stock (stock);
|
|
||||||
|
|
||||||
img = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#if !HAVE_GTK3
|
#if !HAVE_GTK3
|
||||||
if (stock)
|
if (stock)
|
||||||
@@ -609,11 +613,7 @@ gtkutil_button (GtkWidget *box, char *stock, char *tip, void *callback,
|
|||||||
img = NULL;
|
img = NULL;
|
||||||
#if HAVE_GTK3
|
#if HAVE_GTK3
|
||||||
if (stock)
|
if (stock)
|
||||||
{
|
img = gtkutil_image_new_from_stock (stock, GTK_ICON_SIZE_BUTTON);
|
||||||
const char *icon_name = gtkutil_icon_name_from_stock (stock);
|
|
||||||
|
|
||||||
img = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#if !HAVE_GTK3
|
#if !HAVE_GTK3
|
||||||
if (stock)
|
if (stock)
|
||||||
|
|||||||
Reference in New Issue
Block a user