From a8a879f2a0e16da2432cdc8222d5e01f4dbdc0d0 Mon Sep 17 00:00:00 2001 From: Mike Buchholz Date: Fri, 13 Mar 2026 12:39:55 -0600 Subject: [PATCH] ui: bundle ok/cancel icons; improve emoji fallback, incl PNG/SVG on Windows --- data/icons/menu/dark/cancel.png | Bin 0 -> 583 bytes data/icons/menu/dark/cancel.svg | 12 ++++++++++++ data/icons/menu/dark/ok.png | Bin 0 -> 669 bytes data/icons/menu/dark/ok.svg | 12 ++++++++++++ data/icons/menu/light/cancel.png | Bin 0 -> 639 bytes data/icons/menu/light/cancel.svg | 12 ++++++++++++ data/icons/menu/light/ok.png | Bin 0 -> 676 bytes data/icons/menu/light/ok.svg | 12 ++++++++++++ data/zoitechat.gresource.xml | 8 ++++++++ src/fe-gtk/icon-resolver.c | 2 ++ src/fe-gtk/icon-resolver.h | 2 ++ src/fe-gtk/maingui.c | 16 +++++++++++++++- src/fe-gtk/menu.c | 4 ++-- 13 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 data/icons/menu/dark/cancel.png create mode 100644 data/icons/menu/dark/cancel.svg create mode 100644 data/icons/menu/dark/ok.png create mode 100644 data/icons/menu/dark/ok.svg create mode 100644 data/icons/menu/light/cancel.png create mode 100644 data/icons/menu/light/cancel.svg create mode 100644 data/icons/menu/light/ok.png create mode 100644 data/icons/menu/light/ok.svg diff --git a/data/icons/menu/dark/cancel.png b/data/icons/menu/dark/cancel.png new file mode 100644 index 0000000000000000000000000000000000000000..9f8511955def44333e0f3242c214d5ac2489138e GIT binary patch literal 583 zcmV-N0=WH&P)pu@p)tP!R{HgNx3Set&wru)(R*MhrcZDYwn#Ul3)?h-&_mDJ?seb;_bSJ0N zDMY8TwU(8k{(-LW$wQcU>ZvKnT6p#dQ+iBc@K(2EsO*f-^tS;nqZjf~F36ra|J%r2 zn4g5Mtl#sK{w~mDgMfUL3sLS>8=$l*^+r(^fY+O_SA#nRpEy71&wDi=1N>WEZUe-r zA!9->``E(rdIypwFR%L;U`&WODYgNKT;J@B2Bj|#fSk8bOInE!q@L5C_iAu^5MECB z7?30hN~v1Mg2-k)Zg_ojrHiu9+nFl?P;VTbAhOX>fLe?X8!c-s*aWtBJD$^;Z0~|i zur?u%k4{}+mo5y_&gjf@6{xjhVX!-E%pXf(Z9?_i_oj1h>fXoIcNYLDL^4$JQ7-I_ za#`~mWRn(gd}!lFqlL(HntTNSurof>?}tQ{MN|<$DXAiCxWF!rynl0WZO8s~{Q@jO V*+?(;wM+m2002ovPDHLkV1lxO1ycY3 literal 0 HcmV?d00001 diff --git a/data/icons/menu/dark/cancel.svg b/data/icons/menu/dark/cancel.svg new file mode 100644 index 00000000..d38e65ea --- /dev/null +++ b/data/icons/menu/dark/cancel.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/data/icons/menu/dark/ok.png b/data/icons/menu/dark/ok.png new file mode 100644 index 0000000000000000000000000000000000000000..b22df7ed46a1b3aef7705820f82dfc86da4bdcee GIT binary patch literal 669 zcmV;O0%HA%P)>byZC_HOAGthB{5* zI)n^RDwQyo%ejSF%MYYTeecXXs}e8=lF9l=&7;<~BYa6&Ls2-8kYI!&L^ag1D2OXD zHvY+8c8cwPL`cPU;CUfxchr9Ey*Z+kzNFn0@pa6iB z>)%dB58-&E8Ffk&Ba0t#JAMJ2YItD1#bADP^K`P}fKZwhj)z;b&yn>OaLQ;wpP2%u z8t%=%`G*VuzFh`kB)bto1{udHx|Y9!>(goEyk!7Df9@5A3h%3Wv8|Og63F371VxG- z+giEC8+PbFBa65^bsur97UT9*71=AfaPq6ZS0=pxzyM(3<%GTS%;B$Y!9K0maCMCd z%y~;&k{2hkwv_VH%$28OfAz5rGo3g`C>spN43*a#Ity!+%#KxboqW-Ql + + + + + + + + + + + \ No newline at end of file diff --git a/data/icons/menu/light/cancel.png b/data/icons/menu/light/cancel.png new file mode 100644 index 0000000000000000000000000000000000000000..4583575c100adc6f625b37f8c91b9c4b817096b5 GIT binary patch literal 639 zcmV-_0)YLAP)Ajk!km#%q2fiQ9 z_k0iVpGAHjY@9EowU(SEgxru)WdJ~dFc@x$}ozXCS%V?}B?%e}+Hda5U5 zn1%r*1e#tQd(}^T@5_#mO5M5k_T{4vz-E4|==5bC3>6AC+4UgyJwPdtL;}>Yp!c|7 zegoxaPyH}pQxSwlYlCXbeci5o>dGa!cW*)ofmZzx;`;%_zK4^Om(hFcI>jR4ft;f&@nFh2*Hv_X?L2IlABjOIZog-JDZ+1e5zE)a*Y&6m2O;mTQm5DbmaufiRQvIfG0sv&AiCSp^tXzRL zGSndk0MoD_l^TdGsN=HM5+IcR94HmbC;(7GcX+@7pu++yS77E&BXj>AXwn7%u#kfi zvJ(SZO0Ij20}cTFrRlb{f3?$Jng#&W8y-_qt;T?W>x-W6g)HEZjKkmBjy*>=@wc`i z83zj(Jl_*UgiCFY^!V(BNsVX^2h&-{GORz|f&~npzgB%I!rNEhz1nC4L=Z~IN|)WO zr%rU45r~Hj2ZtW7`(CI-Ybp|V003YuH}2X-Fat`9>PJ+BkeZTem56X@;{EGy$AtE8 Zbp&SF4ovw3T`B+o002ovPDHLkV1mnMAano# literal 0 HcmV?d00001 diff --git a/data/icons/menu/light/cancel.svg b/data/icons/menu/light/cancel.svg new file mode 100644 index 00000000..a58fb86e --- /dev/null +++ b/data/icons/menu/light/cancel.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/data/icons/menu/light/ok.png b/data/icons/menu/light/ok.png new file mode 100644 index 0000000000000000000000000000000000000000..264939da507b6029f22756b625153f616f4b4563 GIT binary patch literal 676 zcmV;V0$crwP)q`<~}} z5A0B4>p@}jsRBo+O$xFeNihHlQ___^s;#tz+xw&c4e&SD1r1$)w!dtj?)UFDbW0nGA*P*vwoCS6+;^4ZO$*@Hf{5i+2@t)EueuOxtrrR~K=mi=k-b7#>Qp{g8qW zgG1Jm6~C|%A~vvHAtp)>m1eIhYb2ax#;%9=RL~h{Wi&F*x%Mk@byX=3xA#XC07s}z zM!u=d%av`-)&2u?23qkMUWQ|17`a)x<8d0(^#F>H^;%w*xn0Xg3l7o|Xu)TAdHVeg z4@O_2=bNTL32p}9QlywF4V86VtG$Gw>Hr)otfV8*LXPg?{%9{ZN1msPGgWY934oS< zM*?uNq?+SJRro!*bd9~|(TPU9n#tWSJv{vS>R&XGHl+y^Wm?(}S3f>saydevw1$pA zD_+gy_UG;lvuisb#Pnu>blsk{1>2sr<~cubotc$60B(Hh;_ + + + + + + + + + + + \ No newline at end of file diff --git a/data/zoitechat.gresource.xml b/data/zoitechat.gresource.xml index d7bdfdf2..954df153 100644 --- a/data/zoitechat.gresource.xml +++ b/data/zoitechat.gresource.xml @@ -74,6 +74,10 @@ icons/menu/light/help.svg icons/menu/light/about.png icons/menu/light/about.svg + icons/menu/light/ok.png + icons/menu/light/ok.svg + icons/menu/light/cancel.png + icons/menu/light/cancel.svg icons/menu/light/update.png icons/menu/light/update.svg icons/menu/light/emoji.png @@ -131,6 +135,10 @@ icons/menu/dark/help.svg icons/menu/dark/about.png icons/menu/dark/about.svg + icons/menu/dark/ok.png + icons/menu/dark/ok.svg + icons/menu/dark/cancel.png + icons/menu/dark/cancel.svg icons/menu/dark/update.png icons/menu/dark/update.svg icons/menu/dark/emoji.png diff --git a/src/fe-gtk/icon-resolver.c b/src/fe-gtk/icon-resolver.c index 1a825752..426961da 100644 --- a/src/fe-gtk/icon-resolver.c +++ b/src/fe-gtk/icon-resolver.c @@ -46,6 +46,8 @@ static const IconRegistryEntry icon_registry[] = { { ICON_RESOLVER_ROLE_MENU_ACTION, ICON_RESOLVER_MENU_ACTION_NEXT, "zc-menu-next", "go-next", "next" }, { ICON_RESOLVER_ROLE_MENU_ACTION, ICON_RESOLVER_MENU_ACTION_HELP, "zc-menu-help", "help-browser", "help" }, { ICON_RESOLVER_ROLE_MENU_ACTION, ICON_RESOLVER_MENU_ACTION_ABOUT, "zc-menu-about", "help-about", "about" }, + { ICON_RESOLVER_ROLE_MENU_ACTION, ICON_RESOLVER_MENU_ACTION_OK, "zc-menu-ok", "dialog-ok", "ok" }, + { ICON_RESOLVER_ROLE_MENU_ACTION, ICON_RESOLVER_MENU_ACTION_CANCEL, "zc-menu-cancel", "dialog-cancel", "cancel" }, { ICON_RESOLVER_ROLE_MENU_ACTION, ICON_RESOLVER_MENU_ACTION_EMOJI, "zc-menu-emoji", "face-smile", "emoji" }, { ICON_RESOLVER_ROLE_MENU_ACTION, ICON_RESOLVER_MENU_ACTION_UPDATE, "zc-menu-update", "software-update-available", "update" }, { ICON_RESOLVER_ROLE_MENU_ACTION, ICON_RESOLVER_MENU_ACTION_CHANLIST, "zc-menu-chanlist", "network-workgroup", "chanlist" }, diff --git a/src/fe-gtk/icon-resolver.h b/src/fe-gtk/icon-resolver.h index fa486b30..7b5729a8 100644 --- a/src/fe-gtk/icon-resolver.h +++ b/src/fe-gtk/icon-resolver.h @@ -45,6 +45,8 @@ typedef enum ICON_RESOLVER_MENU_ACTION_NEXT, ICON_RESOLVER_MENU_ACTION_HELP, ICON_RESOLVER_MENU_ACTION_ABOUT, + ICON_RESOLVER_MENU_ACTION_OK, + ICON_RESOLVER_MENU_ACTION_CANCEL, ICON_RESOLVER_MENU_ACTION_EMOJI, ICON_RESOLVER_MENU_ACTION_UPDATE, ICON_RESOLVER_MENU_ACTION_CHANLIST diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index a5ba248d..8a4fe7c9 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -46,6 +46,7 @@ #include "theme/theme-css.h" #include "banlist.h" #include "gtkutil.h" +#include "icon-resolver.h" #include "joind.h" #include "theme/theme-access.h" #include "theme/theme-palette.h" @@ -1560,7 +1561,7 @@ mg_open_quit_dialog (gboolean minimize_button) button = gtk_button_new_with_mnemonic (_("_Cancel")); gtk_button_set_image (GTK_BUTTON (button), - gtk_image_new_from_icon_name ("dialog-cancel", GTK_ICON_SIZE_BUTTON)); + gtkutil_image_new_from_stock ("gtk-cancel", GTK_ICON_SIZE_BUTTON)); gtk_widget_show (button); gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_CANCEL); @@ -3261,8 +3262,21 @@ mg_find_available_icon_name (const char *const *icon_names) for (i = 0; icon_names[i] != NULL; i++) { + int action; + if (gtk_icon_theme_has_icon (theme, icon_names[i])) return icon_names[i]; + + if (icon_resolver_menu_action_from_name (icon_names[i], &action)) + { + char *resource_path = icon_resolver_resolve_path (ICON_RESOLVER_ROLE_MENU_ACTION, action, GTK_ICON_SIZE_MENU, "menu", ICON_RESOLVER_THEME_SYSTEM, NULL); + + if (resource_path) + { + g_free (resource_path); + return icon_names[i]; + } + } } return NULL; diff --git a/src/fe-gtk/menu.c b/src/fe-gtk/menu.c index e7a0fb2d..b4f41a4d 100644 --- a/src/fe-gtk/menu.c +++ b/src/fe-gtk/menu.c @@ -1533,12 +1533,12 @@ menu_join (GtkWidget * wid, gpointer none) button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), GTK_RESPONSE_REJECT); if (button) gtk_button_set_image (GTK_BUTTON (button), - gtk_image_new_from_icon_name ("dialog-cancel", GTK_ICON_SIZE_BUTTON)); + gtkutil_image_new_from_stock ("gtk-cancel", GTK_ICON_SIZE_BUTTON)); button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); if (button) gtk_button_set_image (GTK_BUTTON (button), - gtk_image_new_from_icon_name ("dialog-ok", GTK_ICON_SIZE_BUTTON)); + gtkutil_image_new_from_stock ("gtk-ok", GTK_ICON_SIZE_BUTTON)); } content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); gtk_box_set_homogeneous (GTK_BOX (content_area), TRUE);