[evolution-data-server] Add AllowAuthPromptAll() method to SourceManager interface.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Add AllowAuthPromptAll() method to SourceManager interface.
- Date: Thu, 1 Nov 2012 18:03:20 +0000 (UTC)
commit ef65cec8a261e8dbace68435da9740d1fd021557
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Nov 1 13:52:05 2012 -0400
Add AllowAuthPromptAll() method to SourceManager interface.
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 | 2 +-
.../private/libedbus-private-sections.txt | 4 +++
libebackend/e-source-registry-server.c | 26 ++++++++++++++++++++
libedataserver/e-source-registry.c | 8 ++++++
libedataserver/e-source.c | 15 -----------
...rg.gnome.evolution.dataserver.SourceManager.xml | 9 +++++++
6 files changed, 48 insertions(+), 16 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9d07aa0..88083d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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,
diff --git a/docs/reference/private/libedbus-private-sections.txt b/docs/reference/private/libedbus-private-sections.txt
index 134dd46..486bf25 100644
--- a/docs/reference/private/libedbus-private-sections.txt
+++ b/docs/reference/private/libedbus-private-sections.txt
@@ -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
diff --git a/libebackend/e-source-registry-server.c b/libebackend/e-source-registry-server.c
index 91ecbf7..b91ede9 100644
--- a/libebackend/e-source-registry-server.c
+++ b/libebackend/e-source-registry-server.c
@@ -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);
diff --git a/libedataserver/e-source-registry.c b/libedataserver/e-source-registry.c
index 32feabb..7c0025f 100644
--- a/libedataserver/e-source-registry.c
+++ b/libedataserver/e-source-registry.c
@@ -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;
}
diff --git a/libedataserver/e-source.c b/libedataserver/e-source.c
index 1c27c18..1ce85eb 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -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
diff --git a/private/org.gnome.evolution.dataserver.SourceManager.xml b/private/org.gnome.evolution.dataserver.SourceManager.xml
index a202be6..ac58f97 100644
--- a/private/org.gnome.evolution.dataserver.SourceManager.xml
+++ b/private/org.gnome.evolution.dataserver.SourceManager.xml
@@ -11,6 +11,15 @@
-->
<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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]