aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-book-source-config.c
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/misc/e-book-source-config.c')
-rw-r--r--widgets/misc/e-book-source-config.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/widgets/misc/e-book-source-config.c b/widgets/misc/e-book-source-config.c
index 6fca964b68..56d9771d9f 100644
--- a/widgets/misc/e-book-source-config.c
+++ b/widgets/misc/e-book-source-config.c
@@ -130,6 +130,37 @@ book_source_config_get_backend_extension_name (ESourceConfig *config)
return E_SOURCE_EXTENSION_ADDRESS_BOOK;
}
+static GList *
+book_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_book_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_contacts_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
book_source_config_init_candidate (ESourceConfig *config,
ESource *scratch_source)
@@ -202,6 +233,8 @@ e_book_source_config_class_init (EBookSourceConfigClass *class)
source_config_class = E_SOURCE_CONFIG_CLASS (class);
source_config_class->get_backend_extension_name =
book_source_config_get_backend_extension_name;
+ source_config_class->list_eligible_collections =
+ book_source_config_list_eligible_collections;
source_config_class->init_candidate = book_source_config_init_candidate;
source_config_class->commit_changes = book_source_config_commit_changes;
}