[gnome-contacts/gnome-3-16] Don't show authentication UI from the search provide



commit 738983f4c523a482e1eec31a1cdda84ce074a137
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jun 11 18:29:49 2015 +0200

    Don't show authentication UI from the search provide
    
    https://bugzilla.gnome.org/show_bug.cgi?id=750724

 src/contacts-app.vala                   |    2 +-
 src/contacts-esd-setup.c                |    5 ++++-
 src/contacts-esd-setup.h                |    2 +-
 src/contacts-shell-search-provider.vala |    2 +-
 vapi/custom.vapi                        |    2 +-
 5 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 9123051..050569b 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -254,7 +254,7 @@ public class Contacts.App : Gtk.Application {
   }
 
   public override void startup () {
-    if (!ensure_eds_accounts ())
+    if (!ensure_eds_accounts (true))
       quit ();
 
     contacts_store = new Store ();
diff --git a/src/contacts-esd-setup.c b/src/contacts-esd-setup.c
index 3560c59..049635a 100644
--- a/src/contacts-esd-setup.c
+++ b/src/contacts-esd-setup.c
@@ -97,7 +97,7 @@ eds_source_credentials_required_cb (ESourceRegistry *registry,
 ESourceRegistry *eds_source_registry = NULL;
 static ECredentialsPrompter *eds_credentials_prompter = NULL;
 
-gboolean contacts_ensure_eds_accounts (void)
+gboolean contacts_ensure_eds_accounts (gboolean allow_interaction)
 {
   ESourceCredentialsProvider *credentials_provider;
   GList *list, *link;
@@ -121,6 +121,9 @@ gboolean contacts_ensure_eds_accounts (void)
 
   eds_credentials_prompter = e_credentials_prompter_new (eds_source_registry);
 
+  if (!allow_interaction)
+      e_credentials_prompter_set_auto_prompt (eds_credentials_prompter, FALSE);
+
   /* First disable credentials prompt for all but addressbook sources... */
   list = e_source_registry_list_sources (eds_source_registry, NULL);
 
diff --git a/src/contacts-esd-setup.h b/src/contacts-esd-setup.h
index be4cfcd..0096618 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>
 
-gboolean contacts_ensure_eds_accounts (void);
+gboolean contacts_ensure_eds_accounts (gboolean allow_interaction);
 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 d029ee3..53a00dd 100644
--- a/src/contacts-shell-search-provider.vala
+++ b/src/contacts-shell-search-provider.vala
@@ -10,7 +10,7 @@ public class Contacts.SearchProvider : Object {
 
   public SearchProvider (SearchProviderApp app) {
     this.app = app;
-    if (!ensure_eds_accounts ())
+    if (!ensure_eds_accounts (false))
       app.quit ();
     store = new Store ();
     contacts_map = new Gee.HashMap<string, Contact> ();
diff --git a/vapi/custom.vapi b/vapi/custom.vapi
index 340e0b5..47930ea 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 bool ensure_eds_accounts ();
+       public static bool ensure_eds_accounts (bool allow_interaction);
        [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")]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]