[evolution-data-server/account-mgmt: 11/43] Add built-in ESource key files.



commit 2a447bf409128875b4f127d9afbddc6b9ed77d8d
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Nov 27 10:25:32 2010 -0500

    Add built-in ESource key files.

 configure.ac                        |    1 +
 data/Makefile.am                    |    2 +
 data/sources/Makefile.am            |   35 ++++++++++++++++++
 data/sources/birthdays.in           |   10 +++++
 data/sources/caldav-stub.in         |    3 ++
 data/sources/contacts-stub.in       |    3 ++
 data/sources/google-stub.in         |    3 ++
 data/sources/ldap-stub.in           |    3 ++
 data/sources/local-stub.in          |    6 +++
 data/sources/local.in               |    8 ++++
 data/sources/sendmail.in            |    6 +++
 data/sources/system-address-book.in |    8 ++++
 data/sources/system-calendar.in     |    9 +++++
 data/sources/system-memo-list.in    |    9 +++++
 data/sources/system-task-list.in    |    9 +++++
 data/sources/vfolder.in             |    8 ++++
 data/sources/weather-stub.in        |    3 ++
 data/sources/webcal-stub.in         |    3 ++
 data/sources/webdav-stub.in         |    3 ++
 libedataserver/e-source-camel.c     |   69 +++++++++++++++++++++++++++++++++--
 20 files changed, 198 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9d01212..9c5287a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1632,6 +1632,7 @@ camel/tests/misc/Makefile
 camel/tests/smime/Makefile
 camel/camel.pc
 data/Makefile
+data/sources/Makefile
 libebackend/Makefile
 libebackend/libebackend.pc
 libedataserver/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index b416bfc..dcd8536 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = sources
+
 gsettings_SCHEMAS = \
 	org.gnome.Evolution.DefaultSources.gschema.xml
 
diff --git a/data/sources/Makefile.am b/data/sources/Makefile.am
new file mode 100644
index 0000000..8393636
--- /dev/null
+++ b/data/sources/Makefile.am
@@ -0,0 +1,35 @@
+NULL =
+
+# These are non-removable and non-writable.
+ro_sources_in_files = \
+	caldav-stub.in \
+	contacts-stub.in \
+	google-stub.in \
+	ldap-stub.in \
+	local-stub.in \
+	weather-stub.in \
+	webcal-stub.in \
+	webdav-stub.in \
+	$(NULL)
+ro_sources_DATA = $(ro_sources_in_files:.in=)
+
+# These are non-removable, but can be changed
+# and written to the user's sources directory.
+rw_sources_in_files = \
+	birthdays.in \
+	local.in \
+	sendmail.in \
+	system-address-book.in \
+	system-calendar.in \
+	system-memo-list.in \
+	system-task-list.in \
+	vfolder.in \
+	$(NULL)
+rw_sources_DATA = $(rw_sources_in_files:.in=)
+
+%: %.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po)
+	LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
+
+CLEANFILES = $(ro_sources_DATA) $(rw_sources_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/data/sources/birthdays.in b/data/sources/birthdays.in
new file mode 100644
index 0000000..2c577b4
--- /dev/null
+++ b/data/sources/birthdays.in
@@ -0,0 +1,10 @@
+[Data Source]
+_DisplayName=Birthdays & Anniversaries
+Parent=contacts-stub
+Enabled=true
+
+[Calendar]
+BackendName=contacts
+Color=#fed4d3
+Enabled=true
+Writable=false
diff --git a/data/sources/caldav-stub.in b/data/sources/caldav-stub.in
new file mode 100644
index 0000000..ec2a50d
--- /dev/null
+++ b/data/sources/caldav-stub.in
@@ -0,0 +1,3 @@
+[Data Source]
+_DisplayName=CalDAV
+Enabled=true
diff --git a/data/sources/contacts-stub.in b/data/sources/contacts-stub.in
new file mode 100644
index 0000000..f4bacde
--- /dev/null
+++ b/data/sources/contacts-stub.in
@@ -0,0 +1,3 @@
+[Data Source]
+_DisplayName=Contacts
+Enabled=true
diff --git a/data/sources/google-stub.in b/data/sources/google-stub.in
new file mode 100644
index 0000000..d597476
--- /dev/null
+++ b/data/sources/google-stub.in
@@ -0,0 +1,3 @@
+[Data Source]
+_DisplayName=Google
+Enabled=true
diff --git a/data/sources/ldap-stub.in b/data/sources/ldap-stub.in
new file mode 100644
index 0000000..afb1650
--- /dev/null
+++ b/data/sources/ldap-stub.in
@@ -0,0 +1,3 @@
+[Data Source]
+_DisplayName=On LDAP Servers
+Enabled=true
diff --git a/data/sources/local-stub.in b/data/sources/local-stub.in
new file mode 100644
index 0000000..fc5c282
--- /dev/null
+++ b/data/sources/local-stub.in
@@ -0,0 +1,6 @@
+# An unfortunate name collision with the "On This Computer"
+# mail store forced the introduction of this "stub" suffix.
+
+[Data Source]
+_DisplayName=On This Computer
+Enabled=true
diff --git a/data/sources/local.in b/data/sources/local.in
new file mode 100644
index 0000000..6c605e9
--- /dev/null
+++ b/data/sources/local.in
@@ -0,0 +1,8 @@
+# Special built-in mail store.
+
+[Data Source]
+_DisplayName=On This Computer
+Enabled=true
+
+[Mail Account]
+BackendName=maildir
diff --git a/data/sources/sendmail.in b/data/sources/sendmail.in
new file mode 100644
index 0000000..ff4ff68
--- /dev/null
+++ b/data/sources/sendmail.in
@@ -0,0 +1,6 @@
+[Data Source]
+_DisplayName=Sendmail
+Enabled=true
+
+[Mail Transport]
+BackendName=sendmail
diff --git a/data/sources/system-address-book.in b/data/sources/system-address-book.in
new file mode 100644
index 0000000..eb3a6f1
--- /dev/null
+++ b/data/sources/system-address-book.in
@@ -0,0 +1,8 @@
+[Data Source]
+_DisplayName=Personal
+Parent=local-stub
+Enabled=true
+
+[Address Book]
+BackendName=local
+Color=#becedd
diff --git a/data/sources/system-calendar.in b/data/sources/system-calendar.in
new file mode 100644
index 0000000..4246a84
--- /dev/null
+++ b/data/sources/system-calendar.in
@@ -0,0 +1,9 @@
+[Data Source]
+_DisplayName=Personal
+Parent=local-stub
+Enabled=true
+
+[Calendar]
+BackendName=local
+Color=#becedd
+
diff --git a/data/sources/system-memo-list.in b/data/sources/system-memo-list.in
new file mode 100644
index 0000000..2dc171a
--- /dev/null
+++ b/data/sources/system-memo-list.in
@@ -0,0 +1,9 @@
+[Data Source]
+_DisplayName=Personal
+Parent=local-stub
+Enabled=true
+
+[Memo List]
+BackendName=local
+Color=#becedd
+
diff --git a/data/sources/system-task-list.in b/data/sources/system-task-list.in
new file mode 100644
index 0000000..0df1dda
--- /dev/null
+++ b/data/sources/system-task-list.in
@@ -0,0 +1,9 @@
+[Data Source]
+_DisplayName=Personal
+Parent=local-stub
+Enabled=true
+
+[Task List]
+BackendName=local
+Color=#becedd
+
diff --git a/data/sources/vfolder.in b/data/sources/vfolder.in
new file mode 100644
index 0000000..a87b4f8
--- /dev/null
+++ b/data/sources/vfolder.in
@@ -0,0 +1,8 @@
+# Special built-in mail store.
+
+[Data Source]
+_DisplayName=Search Folders
+Enabled=true
+
+[Mail Account]
+BackendName=vfolder
diff --git a/data/sources/weather-stub.in b/data/sources/weather-stub.in
new file mode 100644
index 0000000..3b3d8e3
--- /dev/null
+++ b/data/sources/weather-stub.in
@@ -0,0 +1,3 @@
+[Data Source]
+_DisplayName=Weather
+Enabled=true
diff --git a/data/sources/webcal-stub.in b/data/sources/webcal-stub.in
new file mode 100644
index 0000000..349c5eb
--- /dev/null
+++ b/data/sources/webcal-stub.in
@@ -0,0 +1,3 @@
+[Data Source]
+_DisplayName=On The Web
+Enabled=true
diff --git a/data/sources/webdav-stub.in b/data/sources/webdav-stub.in
new file mode 100644
index 0000000..b61fceb
--- /dev/null
+++ b/data/sources/webdav-stub.in
@@ -0,0 +1,3 @@
+[Data Source]
+_DisplayName=WebDAV
+Enabled=true
diff --git a/libedataserver/e-source-camel.c b/libedataserver/e-source-camel.c
index 0ab9f5f..ba8f65a 100644
--- a/libedataserver/e-source-camel.c
+++ b/libedataserver/e-source-camel.c
@@ -122,6 +122,71 @@ G_DEFINE_ABSTRACT_TYPE (
 	e_source_camel,
 	E_TYPE_SOURCE_EXTENSION)
 
+/* XXX A function like this belongs in GObject.  I may yet propose it,
+ *     GParamSpecClass still has some reserved slots.  This fiddles with
+ *     GParamSpec fields that are supposed to be private to GObject, but
+ *     I have no other choice.
+ *
+ * XXX Historical note, originally I tried (ab)using override properties
+ *     in ESourceCamel, which redirected to the equivalent CamelSettings
+ *     property.  Seemed to work at first, and I was proud of my clever
+ *     hack, but it turns out g_object_class_list_properties() excludes
+ *     override properties.  So the ESourceCamel properties were being
+ *     skipped in source_load_from_key_file() (e-source.c). */
+static GParamSpec *
+param_spec_clone (GParamSpec *pspec)
+{
+	GParamSpec *clone;
+	GTypeQuery query;
+
+	/* Query the instance size. */
+	g_type_query (G_PARAM_SPEC_TYPE (pspec), &query);
+
+	/* Start with a memcpy()'d buffer. */
+	clone = g_slice_alloc0 (query.instance_size);
+	memcpy (clone, pspec, query.instance_size);
+
+	/* This sort of mimics g_param_spec_init(). */
+
+#define PARAM_FLOATING_FLAG 0x2  /* from gparam.c */
+	g_datalist_set_flags (&clone->qdata, PARAM_FLOATING_FLAG);
+	clone->ref_count = 1;
+
+	/* Clear the owner_type. */
+	clone->owner_type = G_TYPE_INVALID;
+
+	/* Clear the param_id. */
+	clone->param_id = 0;
+
+	/* This sort of mimics g_param_spec_internal(). */
+
+	/* Param name should already be canonicalized and interned. */
+
+	/* Always copy the nickname. */
+	clone->flags &= ~G_PARAM_STATIC_NICK;
+	clone->_nick = g_strdup (g_param_spec_get_nick (pspec));
+
+	/* Always copy the blurb. */
+	clone->flags &= ~G_PARAM_STATIC_BLURB;
+	clone->_blurb = g_strdup (g_param_spec_get_blurb (pspec));
+
+	/* Handle special cases. */
+
+	if (G_IS_PARAM_SPEC_STRING (clone)) {
+		GParamSpecString *clone_s;
+
+		clone_s = (GParamSpecString *) clone;
+		clone_s->default_value = g_strdup (clone_s->default_value);
+	}
+
+	/* Some types we don't handle but shouldn't need to. */
+	g_warn_if_fail (!G_IS_PARAM_SPEC_VALUE_ARRAY (clone));
+	g_warn_if_fail (!G_IS_PARAM_SPEC_OVERRIDE (clone));
+	g_warn_if_fail (!G_IS_PARAM_SPEC_VARIANT (clone));
+
+	return clone;
+}
+
 static gint
 subclass_get_binding_index (GParamSpec *settings_property)
 {
@@ -248,15 +313,13 @@ source_camel_register_subtype (GType service_type,
 
 	for (ii = 0; ii < n_properties; ii++) {
 		GParamSpec *pspec;
-		const gchar *name;
 
 		/* Some properties in CamelSettings may be covered
 		 * by other ESourceExtensions.  Skip them here. */
 		if (subclass_get_binding_index (properties[ii]) >= 0)
 			continue;
 
-		name = properties[ii]->name;
-		pspec = g_param_spec_override (name, properties[ii]);
+		pspec = param_spec_clone (properties[ii]);
 		pspec->flags |= E_SOURCE_PARAM_SETTING;
 
 		/* Clear the G_PARAM_CONSTRUCT flag.  We apply default



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