[evolution-data-server/gnome-3-6] Revert "Revert "Bug #678400 - ECollectionBackend populates disabled accounts""



commit b775fba157e0937baeec6df62ec3b943e0d1aa67
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Oct 25 13:03:52 2012 -0400

    Revert "Revert "Bug #678400 - ECollectionBackend populates disabled accounts""
    
    This reverts commit 99f0208d4005f2650729c9b63a629c17e1cd964b.
    
    This reverts my revert, since I mistakenly thought it was breaking the
    ESourceCollection API.  The solution is not ideal, but is fine as a
    stop-gap measure for Evolution-Data-Server 3.6.x.
    
    In 3.7.x I've added an e_source_registry_check_enabled() function and
    swapped out most of the e_source_get_enabled() calls throughout Evo and
    EDS, which obviates the need to keep enabled states for child sources
    sychronized with parent sources at all times.

 libebackend/e-collection-backend.c |   37 ++++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/libebackend/e-collection-backend.c b/libebackend/e-collection-backend.c
index 87b1861..d332093 100644
--- a/libebackend/e-collection-backend.c
+++ b/libebackend/e-collection-backend.c
@@ -349,6 +349,19 @@ collection_backend_child_is_mail (ESource *child_source)
 	return FALSE;
 }
 
+static gboolean
+include_master_source_enabled_transform (GBinding *binding,
+					 const GValue *source_value,
+					 GValue *target_value,
+					 gpointer backend)
+{
+	g_value_set_boolean (target_value,
+		g_value_get_boolean (source_value) &&
+		e_source_get_enabled (e_backend_get_source (backend)));
+
+	return TRUE;
+}
+
 static void
 collection_backend_bind_child_enabled (ECollectionBackend *backend,
                                        ESource *child_source)
@@ -365,26 +378,38 @@ collection_backend_bind_child_enabled (ECollectionBackend *backend,
 	extension = e_source_get_extension (collection_source, extension_name);
 
 	if (collection_backend_child_is_calendar (child_source)) {
-		g_object_bind_property (
+		g_object_bind_property_full (
 			extension, "calendar-enabled",
 			child_source, "enabled",
-			G_BINDING_SYNC_CREATE);
+			G_BINDING_SYNC_CREATE,
+			include_master_source_enabled_transform,
+			include_master_source_enabled_transform,
+			backend,
+			NULL);
 		return;
 	}
 
 	if (collection_backend_child_is_contacts (child_source)) {
-		g_object_bind_property (
+		g_object_bind_property_full (
 			extension, "contacts-enabled",
 			child_source, "enabled",
-			G_BINDING_SYNC_CREATE);
+			G_BINDING_SYNC_CREATE,
+			include_master_source_enabled_transform,
+			include_master_source_enabled_transform,
+			backend,
+			NULL);
 		return;
 	}
 
 	if (collection_backend_child_is_mail (child_source)) {
-		g_object_bind_property (
+		g_object_bind_property_full (
 			extension, "mail-enabled",
 			child_source, "enabled",
-			G_BINDING_SYNC_CREATE);
+			G_BINDING_SYNC_CREATE,
+			include_master_source_enabled_transform,
+			include_master_source_enabled_transform,
+			backend,
+			NULL);
 		return;
 	}
 }



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