[gnome-online-accounts] daemon: Fail as early as possible if the provider is missing
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts] daemon: Fail as early as possible if the provider is missing
- Date: Mon, 25 Jun 2012 12:34:53 +0000 (UTC)
commit c4ff59d04f4794ae1f47b1189ac19428c8f94479
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Jun 25 13:57:35 2012 +0200
daemon: Fail as early as possible if the provider is missing
src/daemon/goadaemon.c | 54 ++++++++++++++++++++++++------------------------
1 files changed, 27 insertions(+), 27 deletions(-)
---
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
index c20ebe9..e2cca23 100644
--- a/src/daemon/goadaemon.c
+++ b/src/daemon/goadaemon.c
@@ -719,6 +719,33 @@ on_manager_handle_add_account (GoaManager *manager,
data = NULL;
object_path = NULL;
+ providers = goa_provider_get_all ();
+ for (l = providers; l != NULL; l = l->next)
+ {
+ GoaProvider *p;
+ const gchar *type;
+
+ p = GOA_PROVIDER (l->data);
+ type = goa_provider_get_provider_type (p);
+ if (g_strcmp0 (type, provider_type) == 0)
+ {
+ provider = p;
+ break;
+ }
+ }
+
+ if (provider == NULL)
+ {
+ error= NULL;
+ g_set_error (&error,
+ GOA_ERROR,
+ GOA_ERROR_FAILED, /* TODO: more specific */
+ _("Failed to find a provider for: %s"),
+ provider_type);
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ goto out;
+ }
+
key_file = g_key_file_new ();
path = g_strdup_printf ("%s/goa-1.0/accounts.conf", g_get_user_config_dir ());
error = NULL;
@@ -787,33 +814,6 @@ on_manager_handle_add_account (GoaManager *manager,
goto out;
}
- providers = goa_provider_get_all ();
- for (l = providers; l != NULL; l = l->next)
- {
- GoaProvider *p;
- const gchar *type;
-
- p = GOA_PROVIDER (l->data);
- type = goa_provider_get_provider_type (p);
- if (g_strcmp0 (type, provider_type) == 0)
- {
- provider = p;
- break;
- }
- }
-
- if (provider == NULL)
- {
- error= NULL;
- g_set_error (&error,
- GOA_ERROR,
- GOA_ERROR_FAILED, /* TODO: more specific */
- _("Failed to find a provider for: %s"),
- provider_type);
- g_dbus_method_invocation_return_gerror (invocation, error);
- goto out;
- }
-
/* We don't want to fail AddAccount if we could not store the
* credentials in the keyring.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]