aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-cal-source-config.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-06-24 07:02:01 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-06-24 07:02:01 +0800
commit18420e77507819dcee97dcc6cf5f5811915df82a (patch)
tree0dcab97792e92e478818ce4fe5bb6d410c1a4141 /widgets/misc/e-cal-source-config.c
parent922ca943bb348ca1445cb5403aa77aaa4c1cdec6 (diff)
downloadgsoc2013-evolution-18420e77507819dcee97dcc6cf5f5811915df82a.tar
gsoc2013-evolution-18420e77507819dcee97dcc6cf5f5811915df82a.tar.gz
gsoc2013-evolution-18420e77507819dcee97dcc6cf5f5811915df82a.tar.bz2
gsoc2013-evolution-18420e77507819dcee97dcc6cf5f5811915df82a.tar.lz
gsoc2013-evolution-18420e77507819dcee97dcc6cf5f5811915df82a.tar.xz
gsoc2013-evolution-18420e77507819dcee97dcc6cf5f5811915df82a.tar.zst
gsoc2013-evolution-18420e77507819dcee97dcc6cf5f5811915df82a.zip
Bug 678634 - Criticals warnings when creating new book/cal
This required some reworking of assumptions I made early on when I first wrote ESourceConfig, before I thought up the whole "collection" concept. Not all ESourceConfigBackends will use a fixed parent UID, specifically collection backends. In fact we may use multiple instances of the same ESourceConfigBackend subclass if, for example, a user has two different Exchange Web Services accounts configured. We would need to show both EWS account (or "collection") names in the "Type" combo box. For the moment collection-based ESourceConfigBackends are not listed when creating a new calendar or address book since we lack support for creating new resources on a remote server. A D-Bus interface for that is in the works.
Diffstat (limited to 'widgets/misc/e-cal-source-config.c')
-rw-r--r--widgets/misc/e-cal-source-config.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/widgets/misc/e-cal-source-config.c b/widgets/misc/e-cal-source-config.c
index 1d3243c77b..e57d0c6745 100644
--- a/widgets/misc/e-cal-source-config.c
+++ b/widgets/misc/e-cal-source-config.c
@@ -229,6 +229,37 @@ cal_source_config_get_backend_extension_name (ESourceConfig *config)
return extension_name;
}
+static GList *
+cal_source_config_list_eligible_collections (ESourceConfig *config)
+{
+ GQueue trash = G_QUEUE_INIT;
+ GList *list, *link;
+
+ /* Chain up to parent's list_eligible_collections() method. */
+ list = E_SOURCE_CONFIG_CLASS (e_cal_source_config_parent_class)->
+ list_eligible_collections (config);
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
+ ESourceCollection *extension;
+ const gchar *extension_name;
+
+ extension_name = E_SOURCE_EXTENSION_COLLECTION;
+ extension = e_source_get_extension (source, extension_name);
+
+ if (!e_source_collection_get_calendar_enabled (extension))
+ g_queue_push_tail (&trash, link);
+ }
+
+ /* Remove ineligible collections from the list. */
+ while ((link = g_queue_pop_head (&trash)) != NULL) {
+ g_object_unref (link->data);
+ list = g_list_delete_link (list, link);
+ }
+
+ return list;
+}
+
static void
cal_source_config_init_candidate (ESourceConfig *config,
ESource *scratch_source)
@@ -306,6 +337,8 @@ e_cal_source_config_class_init (ECalSourceConfigClass *class)
source_config_class = E_SOURCE_CONFIG_CLASS (class);
source_config_class->get_backend_extension_name =
cal_source_config_get_backend_extension_name;
+ source_config_class->list_eligible_collections =
+ cal_source_config_list_eligible_collections;
source_config_class->init_candidate = cal_source_config_init_candidate;
source_config_class->commit_changes = cal_source_config_commit_changes;