summaryrefslogtreecommitdiff
path: root/libebackend/e-source-registry-server.c
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2014-05-26 01:19:32 +0200
committerFabiano FidĂȘncio <fidencio@redhat.com>2014-07-11 09:32:33 +0200
commitf3f1e94faf38fa7af9ed3072461f4c5e5c6c4b30 (patch)
treef4fa8e7c764e52c79c995f82b09b8122d478b277 /libebackend/e-source-registry-server.c
parent3a4f47ec0abd375d57cfab1a4c899e46d2bd4d81 (diff)
downloadevolution-data-server-f3f1e94faf38fa7af9ed3072461f4c5e5c6c4b30.tar.gz
Bug #732948 - Add backend-per-process support
With this we can have all backends running on theirs own processes, in this way, if a backend crashes we don't have the whole factory crashing together. Also, each instance of the EBackendFactory can decide if they want to have all instances of the same backend (like calendar, memo list, and task list) running in only one process (useful for evolution-ews and evolution-mapi where we can share the connections between calendar, memo list and task list) or have each extension running on its own process. Apart from that, a configure option was added and, in case the user wants to keep the old behavior, it can be disabled by passing "--disable-backend-per-process" to the configure. As a side effect of these changes, we are enforcing that the hash-key used to keep track of the backend-factories will be built internally and that *always* will follow the "backend-name:extension-name" structure, even for ECollectionBackends.
Diffstat (limited to 'libebackend/e-source-registry-server.c')
-rw-r--r--libebackend/e-source-registry-server.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/libebackend/e-source-registry-server.c b/libebackend/e-source-registry-server.c
index abd9333a6..2e7230420 100644
--- a/libebackend/e-source-registry-server.c
+++ b/libebackend/e-source-registry-server.c
@@ -1146,9 +1146,11 @@ source_registry_server_source_added (ESourceRegistryServer *server,
extension_name = E_SOURCE_EXTENSION_COLLECTION;
if (e_source_has_extension (source, extension_name)) {
- EBackend *backend;
+ EBackend *backend = NULL;
+ ECollectionBackendFactory *backend_factory;
ESourceBackend *extension;
const gchar *backend_name;
+ GError *error = NULL;
extension = e_source_get_extension (source, extension_name);
backend_name = e_source_backend_get_backend_name (extension);
@@ -1157,8 +1159,18 @@ source_registry_server_source_added (ESourceRegistryServer *server,
* itself, which creates a reference cycle. The cycle is
* explicitly broken when the ESource is removed from the
* 'sources' hash table (see unref_data_source() above). */
- backend = e_data_factory_ref_backend (
- E_DATA_FACTORY (server), backend_name, source);
+ backend_factory = e_source_registry_server_ref_backend_factory (server, source);
+ backend = e_backend_factory_new_backend (E_BACKEND_FACTORY (backend_factory), source);
+
+ if (G_IS_INITABLE (backend)) {
+ GInitable *initable = G_INITABLE (backend);
+
+ if (!g_initable_init (initable, NULL, &error))
+ g_clear_object (&backend);
+ }
+
+ g_object_unref (backend_factory);
+
if (backend != NULL) {
g_object_set_data_full (
G_OBJECT (source),
@@ -1166,8 +1178,10 @@ source_registry_server_source_added (ESourceRegistryServer *server,
(GDestroyNotify) g_object_unref);
} else {
g_warning (
- "No collection backend '%s' for %s",
- backend_name, e_source_get_uid (source));
+ "No collection backend '%s' for %s: %s",
+ backend_name, e_source_get_uid (source), error->message);
+
+ g_clear_error (&error);
}
}
@@ -2296,7 +2310,7 @@ e_source_registry_server_ref_backend_factory (ESourceRegistryServer *server,
backend_name = e_source_backend_get_backend_name (extension);
factory = e_data_factory_ref_backend_factory (
- E_DATA_FACTORY (server), backend_name);
+ E_DATA_FACTORY (server), backend_name, extension_name);
if (factory == NULL)
return NULL;