pidgin/pidgin

Fix account request field in Pidgin when filtering

12 months ago, Elliott Sales de Andrade
6996b5faa09e
Parents 0d14fedafd4a
Children eb8592c26889
Fix account request field in Pidgin when filtering

The field is set to its default value first, filtered, then a notify signal is connected. If the filter excludes the default, then the notification is not fired at this point.

So if there's a filter that excludes that default and you don't change the selection from the UI, then nothing will have told the field that the default is not the selection, and the field result will not match what the user thought they selected.

Testing Done:
Tried a few times in the I'dle Mak'er plugin.

Previously, if accounts loaded such that a Demo account is before an XMPP account, then even though the XMPP account appeared in the selector initially, the idle would be attempted on the Demo account. Now it is always the XMPP account as expected from the UI.

Reviewed at https://reviews.imfreedom.org/r/2443/
--- a/pidgin/gtkrequest.c Tue Apr 25 01:02:47 2023 -0500
+++ b/pidgin/gtkrequest.c Tue Apr 25 15:00:33 2023 -0500
@@ -1239,14 +1239,14 @@
pidgin_account_chooser_set_selected(PIDGIN_ACCOUNT_CHOOSER(widget),
account);
+ g_signal_connect(widget, "notify::account", G_CALLBACK(field_account_cb),
+ field);
+
if(GTK_IS_FILTER(filter)) {
pidgin_account_chooser_set_filter(PIDGIN_ACCOUNT_CHOOSER(widget), filter);
g_object_unref(filter);
}
- g_signal_connect(widget, "notify::account", G_CALLBACK(field_account_cb),
- field);
-
type_hint = purple_request_field_get_type_hint(field);
if(purple_strequal(type_hint, "account")) {
*account_hint = widget;