[evolution-data-server] e_source_registry_commit_source_sync(): Handle collection members.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] e_source_registry_commit_source_sync(): Handle collection members.
- Date: Fri, 3 Aug 2012 15:40:37 +0000 (UTC)
commit 64f574c094cb64686eab50d461096e6c3ff9c378
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed Jul 25 14:47:57 2012 -0400
e_source_registry_commit_source_sync(): Handle collection members.
If a scratch source (with no GDBusObject) references a collection source
as an ancestor call e_source_remote_create_sync() on the collection source
instead of e_source_registry_create_sources_sync().
libedataserver/e-source-registry.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/libedataserver/e-source-registry.c b/libedataserver/e-source-registry.c
index cdd1c7d..c9783d6 100644
--- a/libedataserver/e-source-registry.c
+++ b/libedataserver/e-source-registry.c
@@ -1824,7 +1824,9 @@ source_registry_commit_source_thread (GSimpleAsyncResult *simple,
*
* If @source does NOT have a #GDBusObject (implying it's a scratch
* #ESource), its contents are submitted to the D-Bus service through
- * e_source_registry_create_sources_sync().
+ * either e_source_remote_create_sync() if @source is to be a collection
+ * member, or e_source_registry_create_sources_sync() if @source to be an
+ * independent data source.
*
* If an error occurs, the function will set @error and return %FALSE.
*
@@ -1839,6 +1841,8 @@ e_source_registry_commit_source_sync (ESourceRegistry *registry,
GError **error)
{
GDBusObject *dbus_object;
+ ESource *collection_source;
+ gboolean collection_member;
gboolean success;
g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
@@ -1846,9 +1850,21 @@ e_source_registry_commit_source_sync (ESourceRegistry *registry,
dbus_object = e_source_ref_dbus_object (source);
+ collection_source = e_source_registry_find_extension (
+ registry, source, E_SOURCE_EXTENSION_COLLECTION);
+
+ collection_member =
+ (collection_source != NULL) &&
+ (collection_source != source);
+
if (dbus_object != NULL) {
success = e_source_write_sync (source, cancellable, error);
g_object_unref (dbus_object);
+
+ } else if (collection_member) {
+ success = e_source_remote_create_sync (
+ collection_source, source, cancellable, error);
+
} else {
GList *list = g_list_prepend (NULL, source);
success = e_source_registry_create_sources_sync (
@@ -1856,6 +1872,9 @@ e_source_registry_commit_source_sync (ESourceRegistry *registry,
g_list_free (list);
}
+ if (collection_source != NULL)
+ g_object_unref (collection_source);
+
return success;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]