[evolution] cal-config-caldav: Hide host details for collection members.



commit b1562e75b0a51346d4a80d9799319b04ddf99cd1
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jun 15 12:30:12 2012 -0400

    cal-config-caldav: Hide host details for collection members.

 .../evolution-cal-config-caldav.c                  |   34 +++++++++++++++-----
 1 files changed, 26 insertions(+), 8 deletions(-)
---
diff --git a/modules/cal-config-caldav/evolution-cal-config-caldav.c b/modules/cal-config-caldav/evolution-cal-config-caldav.c
index f6da2df..2f38c46 100644
--- a/modules/cal-config-caldav/evolution-cal-config-caldav.c
+++ b/modules/cal-config-caldav/evolution-cal-config-caldav.c
@@ -209,6 +209,7 @@ cal_config_caldav_insert_widgets (ESourceConfigBackend *backend,
                                   ESource *scratch_source)
 {
 	ESourceConfig *config;
+	ESource *collection_source;
 	ESourceExtension *extension;
 	ECalClientSourceType source_type;
 	GtkWidget *widget;
@@ -218,20 +219,26 @@ cal_config_caldav_insert_widgets (ESourceConfigBackend *backend,
 	const gchar *label;
 	const gchar *uid;
 
-	context = cal_config_caldav_context_new (backend, scratch_source);
-	uid = e_source_get_uid (scratch_source);
 	config = e_source_config_backend_get_config (backend);
+	collection_source = e_source_config_get_collection_source (config);
+
+	e_cal_source_config_add_offline_toggle (
+		E_CAL_SOURCE_CONFIG (config), scratch_source);
+
+	/* If this data source is a collection member,
+	 * just add a refresh interval and skip the rest. */
+	if (collection_source != NULL) {
+		e_source_config_add_refresh_interval (config, scratch_source);
+		return;
+	}
+
+	uid = e_source_get_uid (scratch_source);
+	context = cal_config_caldav_context_new (backend, scratch_source);
 
 	g_object_set_data_full (
 		G_OBJECT (backend), uid, context,
 		(GDestroyNotify) cal_config_caldav_context_free);
 
-	source_type = e_cal_source_config_get_source_type (
-		E_CAL_SOURCE_CONFIG (config));
-
-	e_cal_source_config_add_offline_toggle (
-		E_CAL_SOURCE_CONFIG (config), scratch_source);
-
 	widget = gtk_entry_new ();
 	e_source_config_insert_widget (
 		config, scratch_source, _("Server:"), widget);
@@ -254,6 +261,9 @@ cal_config_caldav_insert_widgets (ESourceConfigBackend *backend,
 
 	e_source_config_add_user_entry (config, scratch_source);
 
+	source_type = e_cal_source_config_get_source_type (
+		E_CAL_SOURCE_CONFIG (config));
+
 	switch (source_type) {
 		case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
 			label = _("Find Calendars");
@@ -325,10 +335,18 @@ static gboolean
 cal_config_caldav_check_complete (ESourceConfigBackend *backend,
                                   ESource *scratch_source)
 {
+	ESourceConfig *config;
+	ESource *collection_source;
 	Context *context;
 	const gchar *uid;
 	gboolean complete;
 
+	config = e_source_config_backend_get_config (backend);
+	collection_source = e_source_config_get_collection_source (config);
+
+	if (collection_source != NULL)
+		return TRUE;
+
 	uid = e_source_get_uid (scratch_source);
 	context = g_object_get_data (G_OBJECT (backend), uid);
 	g_return_val_if_fail (context != NULL, FALSE);



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