Add AllowAuthPromptAll() method to SourceManager interface.
authorMatthew Barnes <mbarnes@redhat.com>
Thu, 1 Nov 2012 17:52:05 +0000 (13:52 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Thu, 1 Nov 2012 17:52:05 +0000 (13:52 -0400)
Equivalent to calling AllowAuthPrompt() on each exported data source,
but cuts way down on the D-Bus traffic.  Since the registry service is
commonly activated during a desktop session startup, this can actually
clog up the session bus and slow down login.

This leaves the source-specific AllowAuthPrompt() method unused, but
there are still use cases for it which we haven't implemented yet, so
leave it be.

configure.ac
docs/reference/private/libedbus-private-sections.txt
libebackend/e-source-registry-server.c
libedataserver/e-source-registry.c
libedataserver/e-source.c
private/org.gnome.evolution.dataserver.SourceManager.xml

index 9d07aa0..88083d7 100644 (file)
@@ -63,7 +63,7 @@ dnl D-Bus versioning
 dnl ******************************
 ADDRESS_BOOK_DBUS_SERVICE_NAME="org.gnome.evolution.dataserver.AddressBook4"
 CALENDAR_DBUS_SERVICE_NAME="org.gnome.evolution.dataserver.Calendar3"
-SOURCES_DBUS_SERVICE_NAME="org.gnome.evolution.dataserver.Sources0"
+SOURCES_DBUS_SERVICE_NAME="org.gnome.evolution.dataserver.Sources1"
 
 AC_DEFINE_UNQUOTED(
        ADDRESS_BOOK_DBUS_SERVICE_NAME,
index 134dd46..486bf25 100644 (file)
@@ -241,6 +241,10 @@ e_dbus_source_skeleton_get_type
 <FILE>e-dbus-source-manager</FILE>
 <TITLE>EDBusSourceManager</TITLE>
 EDBusSourceManager
+e_dbus_source_manager_call_allow_auth_prompt_all_sync
+e_dbus_source_manager_call_allow_auth_prompt_all
+e_dbus_source_manager_call_allow_auth_prompt_all_finish
+e_dbus_source_manager_complete_allow_auth_prompt_all
 e_dbus_source_manager_call_authenticate_sync
 e_dbus_source_manager_call_authenticate
 e_dbus_source_manager_call_authenticate_finish
index 91ecbf7..b91ede9 100644 (file)
@@ -643,6 +643,27 @@ source_registry_server_wait_for_client_cb (GObject *source_object,
 }
 
 static gboolean
+source_registry_server_allow_auth_prompt_all_cb (EDBusSourceManager *interface,
+                                                 GDBusMethodInvocation *invocation,
+                                                 ESourceRegistryServer *server)
+{
+       GList *list, *link;
+
+       list = e_source_registry_server_list_sources (server, NULL);
+
+       for (link = list; link != NULL; link = g_list_next (link))
+               e_server_side_source_set_allow_auth_prompt (
+                       E_SERVER_SIDE_SOURCE (link->data), TRUE);
+
+       g_list_free_full (list, (GDestroyNotify) g_object_unref);
+
+       e_dbus_source_manager_complete_allow_auth_prompt_all (
+               interface, invocation);
+
+       return TRUE;
+}
+
+static gboolean
 source_registry_server_authenticate_cb (EDBusSourceManager *interface,
                                         GDBusMethodInvocation *invocation,
                                         const gchar *source_uid,
@@ -1374,6 +1395,11 @@ e_source_registry_server_init (ESourceRegistryServer *server)
        server->priv->running_auths = running_auths;
 
        g_signal_connect (
+               source_manager, "handle-allow-auth-prompt-all",
+               G_CALLBACK (source_registry_server_allow_auth_prompt_all_cb),
+               server);
+
+       g_signal_connect (
                source_manager, "handle-authenticate",
                G_CALLBACK (source_registry_server_authenticate_cb),
                server);
index 32feabb..7c0025f 100644 (file)
@@ -1078,6 +1078,14 @@ source_registry_initable_init (GInitable *initable,
        if (registry->priv->dbus_source_manager == NULL)
                return FALSE;
 
+       /* Allow authentication prompts for all exported data sources
+        * when a new EDBusSourceManagerProxy is created.  The thought
+        * being, if you cancel an authentication prompt you will not
+        * be bothered again until you start (or restart) a new E-D-S
+        * client app.  Failure here is non-fatal, ignore errors. */
+       e_dbus_source_manager_call_allow_auth_prompt_all_sync (
+               registry->priv->dbus_source_manager, cancellable, NULL);
+
        return TRUE;
 }
 
index 1c27c18..1ce85eb 100644 (file)
@@ -1306,21 +1306,6 @@ source_initable_init (GInitable *initable,
                dbus_source = e_dbus_object_get_source (dbus_object);
                g_return_val_if_fail (E_DBUS_IS_SOURCE (dbus_source), FALSE);
 
-               /* Allow authentication prompts for a data source
-                * when a new client-side proxy object is created.
-                * The thought being if you cancel an authentication
-                * prompt you won't be bothered again until you start
-                * (or restart) a new E-D-S client app.
-                *
-                * Failure here is non-fatal, ignore errors.
-                *
-                * XXX Only GDBusProxy objects may call this.  Sources
-                *     created server-side can't invoke remote methods.
-                */
-               if (G_IS_DBUS_PROXY (dbus_source))
-                       e_dbus_source_call_allow_auth_prompt_sync (
-                               dbus_source, cancellable, NULL);
-
                /* The UID never changes, so we can cache a copy.
                 *
                 * XXX Note, EServerSideSource may have already set this
index a202be6..ac58f97 100644 (file)
 -->
 <interface name="org.gnome.evolution.dataserver.SourceManager">
   <!--
+      AllowAuthPromptAll:
+      @since: 3.8
+
+      This method is equivalent to calling AllowAuthPrompt() on each
+      managed object, but does so in a single method invocation.
+  -->
+  <method name="AllowAuthPromptAll"/>
+
+  <!--
       Authenticate:
       @uid: Unique identifier for the authenticating source
       @prompt_title: The title of the prompt