mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 16:00:18 +00:00
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:
@@ -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);
|
||||
|
||||
@@ -1563,14 +1563,22 @@ servlist_username_changed_cb (GtkEntry *entry, gpointer userdata)
|
||||
|
||||
if (gtk_entry_get_text (entry)[0] == 0)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY, "dialog-error");
|
||||
#else
|
||||
gtk_entry_set_icon_from_stock (entry, GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_DIALOG_ERROR);
|
||||
#endif
|
||||
gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY,
|
||||
_("User name cannot be left blank."));
|
||||
gtk_widget_set_sensitive (connect_btn, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
#else
|
||||
gtk_entry_set_icon_from_stock (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
#endif
|
||||
gtk_widget_set_sensitive (connect_btn, TRUE);
|
||||
}
|
||||
}
|
||||
@@ -1585,22 +1593,35 @@ servlist_nick_changed_cb (GtkEntry *entry, gpointer userdata)
|
||||
if (!nick1[0] || !nick2[0])
|
||||
{
|
||||
entry = GTK_ENTRY(!nick1[0] ? entry_nick1 : entry_nick2);
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY, "dialog-error");
|
||||
#else
|
||||
gtk_entry_set_icon_from_stock (entry, GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_DIALOG_ERROR);
|
||||
#endif
|
||||
gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY,
|
||||
_("You cannot have an empty nick name."));
|
||||
gtk_widget_set_sensitive (connect_btn, FALSE);
|
||||
}
|
||||
else if (!rfc_casecmp (nick1, nick2))
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY, "dialog-error");
|
||||
#else
|
||||
gtk_entry_set_icon_from_stock (entry, GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_DIALOG_ERROR);
|
||||
#endif
|
||||
gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY,
|
||||
_("You must have two unique nick names."));
|
||||
gtk_widget_set_sensitive (connect_btn, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
gtk_entry_set_icon_from_icon_name (GTK_ENTRY(entry_nick1), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
gtk_entry_set_icon_from_icon_name (GTK_ENTRY(entry_nick2), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
#else
|
||||
gtk_entry_set_icon_from_stock (GTK_ENTRY(entry_nick1), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
gtk_entry_set_icon_from_stock (GTK_ENTRY(entry_nick2), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
#endif
|
||||
gtk_widget_set_sensitive (connect_btn, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user