# HG changeset patch
# Node ID 8fce276d49392c66ea10bda7ffdaeb1e79a9271d
# Parent  567e86fd4234098660d47defa29a5dfca9d55f52
diff --git a/libpurple/plugins/keychain-access/keychain-access.c b/libpurple/plugins/keychain-access/keychain-access.c
--- a/libpurple/plugins/keychain-access/keychain-access.c
+++ b/libpurple/plugins/keychain-access/keychain-access.c
@@ -404,7 +404,7 @@
 
 	instance = purple_keychain_access_new();
 
-	ret = purple_credential_manager_register(manager, instance, error);
+	ret = purple_credential_manager_add(manager, instance, error);
 	if(!ret) {
 		g_clear_object(&instance);
 	}
@@ -421,7 +421,7 @@
 	gboolean ret = FALSE;
 
 	manager = purple_credential_manager_get_default();
-	ret = purple_credential_manager_unregister(manager, instance, error);
+	ret = purple_credential_manager_remove(manager, instance, error);
 	if(!ret) {
 		return ret;
 	}
diff --git a/libpurple/plugins/kwallet/purplekwallet.cpp b/libpurple/plugins/kwallet/purplekwallet.cpp
--- a/libpurple/plugins/kwallet/purplekwallet.cpp
+++ b/libpurple/plugins/kwallet/purplekwallet.cpp
@@ -631,7 +631,7 @@
 
 	instance = purple_kwallet_provider_new();
 
-	return purple_credential_manager_register(manager, instance, error);
+	return purple_credential_manager_add(manager, instance, error);
 }
 
 static gboolean
@@ -643,7 +643,7 @@
 	gboolean ret = FALSE;
 
 	manager = purple_credential_manager_get_default();
-	ret = purple_credential_manager_unregister(manager, instance, error);
+	ret = purple_credential_manager_remove(manager, instance, error);
 
 	if(!ret) {
 		return ret;
diff --git a/libpurple/plugins/libsecret/libsecret.c b/libpurple/plugins/libsecret/libsecret.c
--- a/libpurple/plugins/libsecret/libsecret.c
+++ b/libpurple/plugins/libsecret/libsecret.c
@@ -321,7 +321,7 @@
 
 	instance = purple_libsecret_new();
 
-	return purple_credential_manager_register(manager, instance, error);
+	return purple_credential_manager_add(manager, instance, error);
 }
 
 static gboolean
@@ -333,7 +333,7 @@
 	gboolean ret = FALSE;
 
 	manager = purple_credential_manager_get_default();
-	ret = purple_credential_manager_unregister(manager, instance, error);
+	ret = purple_credential_manager_remove(manager, instance, error);
 	if(!ret) {
 		return ret;
 	}
diff --git a/libpurple/plugins/wincred/wincred.c b/libpurple/plugins/wincred/wincred.c
--- a/libpurple/plugins/wincred/wincred.c
+++ b/libpurple/plugins/wincred/wincred.c
@@ -420,7 +420,7 @@
 
 	instance = purple_wincred_new();
 
-	return purple_credential_manager_register(manager, instance, error);
+	return purple_credential_manager_add(manager, instance, error);
 }
 
 static gboolean
@@ -432,7 +432,7 @@
 	gboolean ret = FALSE;
 
 	manager = purple_credential_manager_get_default();
-	ret = purple_credential_manager_unregister(manager, instance, error);
+	ret = purple_credential_manager_remove(manager, instance, error);
 	if (!ret) {
 		return ret;
 	}
diff --git a/libpurple/purplecredentialmanager.c b/libpurple/purplecredentialmanager.c
--- a/libpurple/purplecredentialmanager.c
+++ b/libpurple/purplecredentialmanager.c
@@ -35,8 +35,8 @@
 #include "util.h"
 
 enum {
-	SIG_REGISTERED,
-	SIG_UNREGISTERED,
+	SIG_ADDED,
+	SIG_REMOVED,
 	SIG_ACTIVE_CHANGED,
 	N_SIGNALS,
 };
@@ -198,16 +198,16 @@
 	obj_class->finalize = purple_credential_manager_finalize;
 
 	/**
-	 * PurpleCredentialManager::registered:
+	 * PurpleCredentialManager::added:
 	 * @manager: The #PurpleCredentialManager instance.
-	 * @provider: The #PurpleCredentialProvider that was registered.
+	 * @provider: The #PurpleCredentialProvider that was added.
 	 *
-	 * Emitted after @provider has been registered in @manager.
+	 * Emitted after @provider has been added to @manager.
 	 *
 	 * Since: 3.0
 	 */
-	signals[SIG_REGISTERED] = g_signal_new_class_handler(
-		"registered",
+	signals[SIG_ADDED] = g_signal_new_class_handler(
+		"added",
 		G_OBJECT_CLASS_TYPE(klass),
 		G_SIGNAL_RUN_LAST,
 		NULL,
@@ -219,16 +219,16 @@
 		PURPLE_TYPE_CREDENTIAL_PROVIDER);
 
 	/**
-	 * PurpleCredentialManager::unregistered:
+	 * PurpleCredentialManager::removed:
 	 * @manager: The #PurpleCredentialManager instance.
-	 * @provider: The #PurpleCredentialProvider that was unregistered.
+	 * @provider: The #PurpleCredentialProvider that was removed.
 	 *
-	 * Emitted after @provider has been unregistered from @manager.
+	 * Emitted after @provider has been removed from @manager.
 	 *
 	 * Since: 3.0
 	 */
-	signals[SIG_UNREGISTERED] = g_signal_new_class_handler(
-		"unregistered",
+	signals[SIG_REMOVED] = g_signal_new_class_handler(
+		"removed",
 		G_OBJECT_CLASS_TYPE(klass),
 		G_SIGNAL_RUN_LAST,
 		NULL,
@@ -292,7 +292,7 @@
 		                        default_manager, G_CONNECT_DEFAULT);
 
 		noop = purple_noop_credential_provider_new();
-		if(!purple_credential_manager_register(default_manager, noop, &error)) {
+		if(!purple_credential_manager_add(default_manager, noop, &error)) {
 			g_warning("failed to register the noop credential manager: %s",
 			          error ? error->message : "unknown");
 			g_clear_error(&error);
@@ -311,8 +311,8 @@
 		 */
 		if(PURPLE_IS_CREDENTIAL_PROVIDER(noop)) {
 			GError *error = NULL;
-			if(!purple_credential_manager_unregister(default_manager,
-			                                         noop, &error))
+			if(!purple_credential_manager_remove(default_manager, noop,
+			                                     &error))
 			{
 				g_warning("failed to unregister the noop provider: %s",
 				          error ? error->message : "unknown");
@@ -335,15 +335,10 @@
 /******************************************************************************
  * Public API
  *****************************************************************************/
-PurpleCredentialManager *
-purple_credential_manager_get_default(void) {
-	return default_manager;
-}
-
 gboolean
-purple_credential_manager_register(PurpleCredentialManager *manager,
-                                   PurpleCredentialProvider *provider,
-                                   GError **error)
+purple_credential_manager_add(PurpleCredentialManager *manager,
+                              PurpleCredentialProvider *provider,
+                              GError **error)
 {
 	const char *id = NULL;
 
@@ -359,7 +354,7 @@
 	id = purple_credential_provider_get_id(provider);
 	if(g_hash_table_lookup(manager->providers, id) != NULL) {
 		g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0,
-		            _("provider %s is already registered"), id);
+		            _("provider %s has already been added"), id);
 
 		return FALSE;
 	}
@@ -367,7 +362,7 @@
 	g_hash_table_insert(manager->providers, g_strdup(id),
 	                    g_object_ref(provider));
 
-	g_signal_emit(G_OBJECT(manager), signals[SIG_REGISTERED], 0, provider);
+	g_signal_emit(G_OBJECT(manager), signals[SIG_ADDED], 0, provider);
 
 	/* If we don't currently have an active provider, check if the newly
 	 * registered provider has the id of the stored provider in preferences.
@@ -390,36 +385,9 @@
 	return TRUE;
 }
 
-gboolean
-purple_credential_manager_unregister(PurpleCredentialManager *manager,
-                                     PurpleCredentialProvider *provider,
-                                     GError **error)
-{
-	const char *id = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE);
-	g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE);
-
-	id = purple_credential_provider_get_id(provider);
-
-	if(provider == manager->active) {
-		g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0,
-		            _("provider %s is currently in use"), id);
-
-		return FALSE;
-	}
-
-	if(g_hash_table_remove(manager->providers, id)) {
-		g_signal_emit(G_OBJECT(manager), signals[SIG_UNREGISTERED], 0,
-		              provider);
-
-		return TRUE;
-	}
-
-	g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0,
-	            _("provider %s is not registered"), id);
-
-	return FALSE;
+PurpleCredentialManager *
+purple_credential_manager_get_default(void) {
+	return default_manager;
 }
 
 gboolean
@@ -630,3 +598,34 @@
 		func(PURPLE_CREDENTIAL_PROVIDER(value), data);
 	}
 }
+
+gboolean
+purple_credential_manager_remove(PurpleCredentialManager *manager,
+                                 PurpleCredentialProvider *provider,
+                                 GError **error)
+{
+	const char *id = NULL;
+
+	g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE);
+	g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE);
+
+	id = purple_credential_provider_get_id(provider);
+
+	if(provider == manager->active) {
+		g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0,
+		            _("provider %s is currently in use"), id);
+
+		return FALSE;
+	}
+
+	if(g_hash_table_remove(manager->providers, id)) {
+		g_signal_emit(G_OBJECT(manager), signals[SIG_REMOVED], 0, provider);
+
+		return TRUE;
+	}
+
+	g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0,
+	            _("provider %s has not been added"), id);
+
+	return FALSE;
+}
diff --git a/libpurple/purplecredentialmanager.h b/libpurple/purplecredentialmanager.h
--- a/libpurple/purplecredentialmanager.h
+++ b/libpurple/purplecredentialmanager.h
@@ -57,8 +57,8 @@
  * PurpleCredentialManager:
  *
  * Purple Credential Manager is the main API access to different credential
- * providers. Providers register themselves with the manager and then the user
- * can choose which provider to use.
+ * providers. Providers are added to the manager and then the user can choose
+ * which provider to use.
  *
  * Once a provider is selected, all credential access will be directed to that
  * provider.
@@ -79,6 +79,21 @@
 typedef void (*PurpleCredentialManagerForeachFunc)(PurpleCredentialProvider *provider, gpointer data);
 
 /**
+ * purple_credential_manager_add:
+ * @manager: The instance.
+ * @provider: The provider to add.
+ * @error: Return address for a #GError, or %NULL.
+ *
+ * Adds @provider to @manager.
+ *
+ * Returns: %TRUE if @provider was successfully added, otherwise %FALSE.
+ *
+ * Since: 3.0
+ */
+PURPLE_AVAILABLE_IN_3_0
+gboolean purple_credential_manager_add(PurpleCredentialManager *manager, PurpleCredentialProvider *provider, GError **error);
+
+/**
  * purple_credential_manager_get_default:
  *
  * Gets the default [class@CredentialManager] instance.
@@ -91,38 +106,6 @@
 PurpleCredentialManager *purple_credential_manager_get_default(void);
 
 /**
- * purple_credential_manager_register:
- * @manager: The instance.
- * @provider: The provider to register.
- * @error: Return address for a #GError, or %NULL.
- *
- * Registers @provider with @manager.
- *
- * Returns: %TRUE if @provider was successfully registered with @manager,
- *          %FALSE otherwise.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-gboolean purple_credential_manager_register(PurpleCredentialManager *manager, PurpleCredentialProvider *provider, GError **error);
-
-/**
- * purple_credential_manager_unregister:
- * @manager: The instance.
- * @provider: The provider to unregister.
- * @error: Return address for a #GError, or %NULL.
- *
- * Unregisters @provider from @manager.
- *
- * Returns: %TRUE if @provider was successfully unregistered from @provider,
- *          %FALSE otherwise.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-gboolean purple_credential_manager_unregister(PurpleCredentialManager *manager, PurpleCredentialProvider *provider, GError **error);
-
-/**
  * purple_credential_manager_set_active:
  * @manager: The instance.
  * @id: (nullable): The id of the provider to use or %NULL to disable the
@@ -269,6 +252,22 @@
 PURPLE_AVAILABLE_IN_3_0
 void purple_credential_manager_foreach(PurpleCredentialManager *manager, PurpleCredentialManagerForeachFunc func, gpointer data);
 
+/**
+ * purple_credential_manager_remove:
+ * @manager: The instance.
+ * @provider: The provider to remove.
+ * @error: Return address for a #GError, or %NULL.
+ *
+ * Removes @provider from @manager.
+ *
+ * Returns: %TRUE if @provider was successfully removed from @provider,
+ *          %FALSE otherwise.
+ *
+ * Since: 3.0
+ */
+PURPLE_AVAILABLE_IN_3_0
+gboolean purple_credential_manager_remove(PurpleCredentialManager *manager, PurpleCredentialProvider *provider, GError **error);
+
 G_END_DECLS
 
 #endif /* PURPLE_CREDENTIAL_MANAGER_H */
diff --git a/libpurple/tests/test_credential_manager.c b/libpurple/tests/test_credential_manager.c
--- a/libpurple/tests/test_credential_manager.c
+++ b/libpurple/tests/test_credential_manager.c
@@ -151,24 +151,24 @@
 	provider = test_purple_credential_provider_new();
 
 	/* Register the first time cleanly. */
-	result = purple_credential_manager_register(manager, provider, &error);
+	result = purple_credential_manager_add(manager, provider, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
 	/* Register again and verify the error. */
-	result = purple_credential_manager_register(manager, provider, &error);
+	result = purple_credential_manager_add(manager, provider, &error);
 	g_assert_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0);
 	g_clear_error(&error);
 
 	g_assert_false(result);
 
 	/* Unregister the provider. */
-	result = purple_credential_manager_unregister(manager, provider, &error);
+	result = purple_credential_manager_remove(manager, provider, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
 	/* Unregister the provider again and verify the error. */
-	result = purple_credential_manager_unregister(manager, provider, &error);
+	result = purple_credential_manager_remove(manager, provider, &error);
 	g_assert_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0);
 	g_clear_error(&error);
 
@@ -227,7 +227,7 @@
 
 	/* Create the provider and register it in the manager. */
 	provider = test_purple_credential_provider_new();
-	result = purple_credential_manager_register(manager, provider, &error);
+	result = purple_credential_manager_add(manager, provider, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
@@ -238,7 +238,7 @@
 	g_assert_true(result);
 
 	/* Verify that unregistering the provider fails. */
-	result = purple_credential_manager_unregister(manager, provider, &error);
+	result = purple_credential_manager_remove(manager, provider, &error);
 	g_assert_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0);
 	g_clear_error(&error);
 	g_assert_false(result);
@@ -249,7 +249,7 @@
 	g_assert_true(result);
 
 	/* Finally unregister the provider now that it's no longer active. */
-	result = purple_credential_manager_unregister(manager, provider, &error);
+	result = purple_credential_manager_remove(manager, provider, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
@@ -401,7 +401,7 @@
 	manager = g_object_new(PURPLE_TYPE_CREDENTIAL_MANAGER, NULL);
 	provider = test_purple_credential_provider_new();
 
-	result = purple_credential_manager_register(manager, provider, &error);
+	result = purple_credential_manager_add(manager, provider, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
@@ -423,7 +423,7 @@
 	g_assert_no_error(error);
 	g_assert_true(result);
 
-	result = purple_credential_manager_unregister(manager, provider, &error);
+	result = purple_credential_manager_remove(manager, provider, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
@@ -459,7 +459,7 @@
 	manager = g_object_new(PURPLE_TYPE_CREDENTIAL_MANAGER, NULL);
 	provider = test_purple_credential_provider_new();
 
-	result = purple_credential_manager_register(manager, provider, &error);
+	result = purple_credential_manager_add(manager, provider, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
@@ -482,7 +482,7 @@
 	g_assert_no_error(error);
 	g_assert_true(result);
 
-	result = purple_credential_manager_unregister(manager, provider, &error);
+	result = purple_credential_manager_remove(manager, provider, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
@@ -517,7 +517,7 @@
 	manager = g_object_new(PURPLE_TYPE_CREDENTIAL_MANAGER, NULL);
 	provider = test_purple_credential_provider_new();
 
-	result = purple_credential_manager_register(manager, provider, &error);
+	result = purple_credential_manager_add(manager, provider, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
@@ -539,7 +539,7 @@
 	g_assert_no_error(error);
 	g_assert_true(result);
 
-	result = purple_credential_manager_unregister(manager, provider, &error);
+	result = purple_credential_manager_remove(manager, provider, &error);
 	g_assert_no_error(error);
 	g_assert_true(result);
 
