pidgin/pidgin

Parents cd297cfc56f3
Children 4be9a7876d35
Make the CredentialManager the only thing in charge of its preferences.

Testing Done:
Started pidgin3 with an empty config directory, verified the notify dialog didn't pop up. Set the preference and exited a few times to make sure everything was working properly.

Reviewed at https://reviews.imfreedom.org/r/1079/
--- a/libpurple/purplecredentialmanager.c Tue Oct 19 03:00:48 2021 -0500
+++ b/libpurple/purplecredentialmanager.c Tue Oct 19 03:12:31 2021 -0500
@@ -128,11 +128,24 @@
priv = purple_credential_manager_get_instance_private(manager);
if(!PURPLE_IS_CREDENTIAL_PROVIDER(priv->active)) {
- purple_notify_error(NULL, _("Credential Manager"),
- _("Failed to load the selected credential "
- "provider."),
- _("Check your system configuration or select "
- "another one in the preferences dialog."), NULL);
+ GError *error = NULL;
+ const gchar *id = NULL;
+
+ id = purple_prefs_get_string("/purple/credentials/active-provider");
+
+ if(!purple_credential_manager_set_active(manager, id, &error)) {
+ g_warning("Failed to make %s the active credential provider : %s",
+ id, error != NULL ? error->message : "unknown error");
+
+ purple_notify_error(NULL, _("Credential Manager"),
+ _("Failed to load the selected credential "
+ "provider."),
+ _("Check your system configuration or select "
+ "another one in the preferences dialog."),
+ NULL);
+ }
+
+ g_clear_error(&error);
}
}
@@ -245,6 +258,11 @@
2,
PURPLE_TYPE_CREDENTIAL_PROVIDER,
PURPLE_TYPE_CREDENTIAL_PROVIDER);
+
+ /* Add our purple preferences. */
+ purple_prefs_add_none("/purple/credentials");
+ purple_prefs_add_string("/purple/credentials/active-provider",
+ "noop-provider");
}
/******************************************************************************
@@ -407,6 +425,11 @@
g_clear_object(&previous);
+ /* Finally update the preference. */
+ if(id != NULL) {
+ purple_prefs_set_string("/purple/credentials/active-provider", id);
+ }
+
purple_debug_info("credential-manager", "set active provider to '%s'", id);
return TRUE;
--- a/pidgin/prefs/pidgincredentialspage.c Tue Oct 19 03:00:48 2021 -0500
+++ b/pidgin/prefs/pidgincredentialspage.c Tue Oct 19 03:12:31 2021 -0500
@@ -100,8 +100,6 @@
manager = purple_credential_manager_get_default();
if(purple_credential_manager_set_active(manager, id, &error)) {
- purple_prefs_set_string("/purple/credentials/active-provider", id);
-
return;
}
@@ -161,9 +159,6 @@
gtk_widget_init_template(GTK_WIDGET(page));
- purple_prefs_add_none("/purple/credentials");
- purple_prefs_add_string("/purple/credentials/active-provider", NULL);
-
manager = purple_credential_manager_get_default();
purple_credential_manager_foreach(
manager,