aboutsummaryrefslogtreecommitdiffstats
path: root/modules/cal-config-contacts
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-06-22 20:52:52 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-06-22 20:54:08 +0800
commit71a6bc922c394d3786e12f6996ba957c3bb0266e (patch)
treec02711a585909d38dfbf0213464d3a7d4864ef9d /modules/cal-config-contacts
parent4027a29c2b083d85103a305e11d8b7fe3df10308 (diff)
downloadgsoc2013-evolution-71a6bc922c394d3786e12f6996ba957c3bb0266e.tar
gsoc2013-evolution-71a6bc922c394d3786e12f6996ba957c3bb0266e.tar.gz
gsoc2013-evolution-71a6bc922c394d3786e12f6996ba957c3bb0266e.tar.bz2
gsoc2013-evolution-71a6bc922c394d3786e12f6996ba957c3bb0266e.tar.lz
gsoc2013-evolution-71a6bc922c394d3786e12f6996ba957c3bb0266e.tar.xz
gsoc2013-evolution-71a6bc922c394d3786e12f6996ba957c3bb0266e.tar.zst
gsoc2013-evolution-71a6bc922c394d3786e12f6996ba957c3bb0266e.zip
ESourceContacts: Only include local address book by default.
A more reasonable default than including all address books by default. Weeds out large, remote address books that can take forever to query.
Diffstat (limited to 'modules/cal-config-contacts')
-rw-r--r--modules/cal-config-contacts/e-source-contacts.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/modules/cal-config-contacts/e-source-contacts.c b/modules/cal-config-contacts/e-source-contacts.c
index 1d2040cd72..5f6b43224a 100644
--- a/modules/cal-config-contacts/e-source-contacts.c
+++ b/modules/cal-config-contacts/e-source-contacts.c
@@ -72,6 +72,34 @@ source_contacts_get_property (GObject *object,
}
static void
+source_contacts_constructed (GObject *object)
+{
+ ESource *source;
+ ESourceExtension *extension;
+ ESourceBackend *backend_extension;
+ ESourceContacts *contacts_extension;
+ const gchar *backend_name;
+ const gchar *extension_name;
+ gboolean include_me;
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_source_contacts_parent_class)->constructed (object);
+
+ extension = E_SOURCE_EXTENSION (object);
+ source = e_source_extension_get_source (extension);
+
+ extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
+ backend_extension = e_source_get_extension (source, extension_name);
+ backend_name = e_source_backend_get_backend_name (backend_extension);
+
+ /* Only include local address books by default. */
+ include_me = (g_strcmp0 (backend_name, "local") == 0);
+
+ contacts_extension = E_SOURCE_CONTACTS (extension);
+ e_source_contacts_set_include_me (contacts_extension, include_me);
+}
+
+static void
e_source_contacts_class_init (ESourceContactsClass *class)
{
GObjectClass *object_class;
@@ -82,6 +110,7 @@ e_source_contacts_class_init (ESourceContactsClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->set_property = source_contacts_set_property;
object_class->get_property = source_contacts_get_property;
+ object_class->constructed = source_contacts_constructed;
extension_class = E_SOURCE_EXTENSION_CLASS (class);
extension_class->name = E_SOURCE_EXTENSION_CONTACTS_BACKEND;
@@ -93,9 +122,8 @@ e_source_contacts_class_init (ESourceContactsClass *class)
"include-me",
"Include Me",
"Include this address book in the contacts calendar",
- TRUE,
+ FALSE, /* see constructed() */
G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
E_SOURCE_PARAM_SETTING));
}