diff options
-rw-r--r-- | src/contacts-app.vala | 4 | ||||
-rw-r--r-- | src/contacts-esd-setup.c | 11 | ||||
-rw-r--r-- | src/contacts-esd-setup.h | 2 | ||||
-rw-r--r-- | src/contacts-shell-search-provider.vala | 3 | ||||
-rw-r--r-- | vapi/custom.vapi | 2 |
5 files changed, 15 insertions, 7 deletions
diff --git a/src/contacts-app.vala b/src/contacts-app.vala index 6b86e80..9123051 100644 --- a/src/contacts-app.vala +++ b/src/contacts-app.vala @@ -254,7 +254,9 @@ public class Contacts.App : Gtk.Application { } public override void startup () { - ensure_eds_accounts (); + if (!ensure_eds_accounts ()) + quit (); + contacts_store = new Store (); base.startup (); diff --git a/src/contacts-esd-setup.c b/src/contacts-esd-setup.c index b6d8da8..3560c59 100644 --- a/src/contacts-esd-setup.c +++ b/src/contacts-esd-setup.c @@ -97,14 +97,14 @@ eds_source_credentials_required_cb (ESourceRegistry *registry, ESourceRegistry *eds_source_registry = NULL; static ECredentialsPrompter *eds_credentials_prompter = NULL; -void contacts_ensure_eds_accounts (void) +gboolean contacts_ensure_eds_accounts (void) { ESourceCredentialsProvider *credentials_provider; GList *list, *link; GError *error = NULL; if (eds_source_registry) - return; + return TRUE; /* XXX This blocks while connecting to the D-Bus service. * Maybe it should be created in the Contacts class @@ -114,7 +114,10 @@ void contacts_ensure_eds_accounts (void) /* If this fails it's game over. */ if (error != NULL) - g_error ("%s: %s", G_STRFUNC, error->message); + { + g_error ("%s: %s", G_STRFUNC, error->message); + return FALSE; + } eds_credentials_prompter = e_credentials_prompter_new (eds_source_registry); @@ -154,6 +157,8 @@ void contacts_ensure_eds_accounts (void) G_CALLBACK (eds_source_credentials_required_cb), eds_credentials_prompter); e_credentials_prompter_process_awaiting_credentials (eds_credentials_prompter); + + return TRUE; } gboolean contacts_has_goa_account (void) diff --git a/src/contacts-esd-setup.h b/src/contacts-esd-setup.h index 4dda4e6..be4cfcd 100644 --- a/src/contacts-esd-setup.h +++ b/src/contacts-esd-setup.h @@ -1,7 +1,7 @@ #include <libebook/libebook.h> #include <gtk/gtk.h> -void contacts_ensure_eds_accounts (void); +gboolean contacts_ensure_eds_accounts (void); const char *contacts_lookup_esource_name_by_uid (const char *uid); const char *contacts_lookup_esource_name_by_uid_for_contact (const char *uid); gboolean contacts_esource_uid_is_google (const char *uid); diff --git a/src/contacts-shell-search-provider.vala b/src/contacts-shell-search-provider.vala index 2940db4..d029ee3 100644 --- a/src/contacts-shell-search-provider.vala +++ b/src/contacts-shell-search-provider.vala @@ -10,7 +10,8 @@ public class Contacts.SearchProvider : Object { public SearchProvider (SearchProviderApp app) { this.app = app; - ensure_eds_accounts (); + if (!ensure_eds_accounts ()) + app.quit (); store = new Store (); contacts_map = new Gee.HashMap<string, Contact> (); next_id = 0; diff --git a/vapi/custom.vapi b/vapi/custom.vapi index 222d1db..340e0b5 100644 --- a/vapi/custom.vapi +++ b/vapi/custom.vapi @@ -20,7 +20,7 @@ namespace Gnome { [CCode (cprefix = "Contacts", lower_case_cprefix = "contacts_", cheader_filename = "contacts-esd-setup.h")] namespace Contacts { [CCode (cname = "contacts_ensure_eds_accounts")] - public static void ensure_eds_accounts (); + public static bool ensure_eds_accounts (); [CCode (cname = "contacts_lookup_esource_name_by_uid")] public static unowned string? lookup_esource_name_by_uid (string uid); [CCode (cname = "contacts_lookup_esource_name_by_uid_for_contact")] |