Added GTK3 icon-name handling around entry error icon updates in the server list UI while keeping stock icon calls for non-GTK3 builds.

Updated search UI entry icon handling to use GTK3 icon-name APIs with GTK2 fallbacks for stock icons.
This commit is contained in:
2026-01-23 12:57:52 -07:00
parent 8d76d94131
commit 2b6fc7dbe5
2 changed files with 41 additions and 0 deletions

View File

@@ -3283,7 +3283,11 @@ search_handle_event(int search_type, session *sess)
if (err)
{
#if HAVE_GTK3
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, "dialog-error");
#else
gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_DIALOG_ERROR);
#endif
gtk_entry_set_icon_tooltip_text (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, _(err->message));
g_error_free (err);
}
@@ -3291,7 +3295,11 @@ search_handle_event(int search_type, session *sess)
{
if (text && text[0] == 0) /* empty string, no error */
{
#if HAVE_GTK3
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL);
#else
gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL);
#endif
}
else
{
@@ -3299,14 +3307,22 @@ search_handle_event(int search_type, session *sess)
last = gtk_xtext_search (GTK_XTEXT (sess->gui->xtext), text, flags, &err);
if (!last) /* Not found error */
{
#if HAVE_GTK3
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, "dialog-error");
#else
gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_DIALOG_ERROR);
#endif
gtk_entry_set_icon_tooltip_text (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, _("No results found."));
}
}
}
else
{
#if HAVE_GTK3
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL);
#else
gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL);
#endif
}
}
@@ -3353,7 +3369,11 @@ mg_search_toggle(session *sess)
else
{
/* Reset search state */
#if HAVE_GTK3
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL);
#else
gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL);
#endif
/* Show and focus */
gtk_widget_show(sess->gui->shbox);