[evolution-data-server/account-mgmt: 11/43] Add built-in ESource key files.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/account-mgmt: 11/43] Add built-in ESource key files.
- Date: Sun, 29 Apr 2012 14:48:57 +0000 (UTC)
commit 7e1427acb323f4b695683a06797f0969add9fb14
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 | 37 ++
data/sources/birthdays.in | 11 +
data/sources/caldav-stub.in | 5 +
data/sources/contacts-stub.in | 5 +
data/sources/google-stub.in | 5 +
data/sources/ldap-stub.in | 5 +
data/sources/local-stub.in | 7 +
data/sources/local.in | 9 +
data/sources/sendmail.in | 8 +
data/sources/system-address-book.in | 9 +
data/sources/system-calendar.in | 11 +
data/sources/system-memo-list.in | 11 +
data/sources/system-task-list.in | 11 +
data/sources/vfolder.in | 9 +
data/sources/weather-stub.in | 5 +
data/sources/webcal-stub.in | 5 +
data/sources/webdav-stub.in | 5 +
.../libedataserver/libedataserver-sections.txt | 3 +
libedataserver/e-source-alarms.c | 2 +-
libedataserver/e-source-authentication.c | 6 +-
libedataserver/e-source-authenticator.c | 9 +-
libedataserver/e-source-backend.c | 2 +-
libedataserver/e-source-camel.c | 69 +++-
libedataserver/e-source-collection.c | 2 +-
libedataserver/e-source-goa.c | 2 +-
libedataserver/e-source-mail-account.c | 2 +-
libedataserver/e-source-mail-composition.c | 11 +-
libedataserver/e-source-mail-identity.c | 10 +-
libedataserver/e-source-mail-signature.c | 37 +-
libedataserver/e-source-mail-submission.c | 5 +-
libedataserver/e-source-refresh.c | 6 +-
libedataserver/e-source-registry.c | 413 +++++++++++++++-----
libedataserver/e-source-registry.h | 15 +
libedataserver/e-source-security.c | 2 +-
libedataserver/e-source-selectable.c | 2 +-
libedataserver/e-source-smime.c | 9 +-
libedataserver/e-source-webdav.c | 10 +-
libedataserver/e-source.c | 31 +-
40 files changed, 642 insertions(+), 167 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 85424c3..36a7f6f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1640,6 +1640,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 566afe9..a31232a 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..98fb67a
--- /dev/null
+++ b/data/sources/Makefile.am
@@ -0,0 +1,37 @@
+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 $< $@
+
+EXTRA_DIST = $(ro_sources_in_files) $(rw_sources_in_files)
+
+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..7f90f94
--- /dev/null
+++ b/data/sources/birthdays.in
@@ -0,0 +1,11 @@
+
+[Data Source]
+_DisplayName=Birthdays & Anniversaries
+Enabled=true
+Parent=contacts-stub
+
+[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..90081a3
--- /dev/null
+++ b/data/sources/caldav-stub.in
@@ -0,0 +1,5 @@
+
+[Data Source]
+_DisplayName=CalDAV
+Enabled=true
+Parent=
diff --git a/data/sources/contacts-stub.in b/data/sources/contacts-stub.in
new file mode 100644
index 0000000..f2bcb97
--- /dev/null
+++ b/data/sources/contacts-stub.in
@@ -0,0 +1,5 @@
+
+[Data Source]
+_DisplayName=Contacts
+Enabled=true
+Parent=
diff --git a/data/sources/google-stub.in b/data/sources/google-stub.in
new file mode 100644
index 0000000..93de6f1
--- /dev/null
+++ b/data/sources/google-stub.in
@@ -0,0 +1,5 @@
+
+[Data Source]
+_DisplayName=Google
+Enabled=true
+Parent=
diff --git a/data/sources/ldap-stub.in b/data/sources/ldap-stub.in
new file mode 100644
index 0000000..9c5e324
--- /dev/null
+++ b/data/sources/ldap-stub.in
@@ -0,0 +1,5 @@
+
+[Data Source]
+_DisplayName=On LDAP Servers
+Enabled=true
+Parent=
diff --git a/data/sources/local-stub.in b/data/sources/local-stub.in
new file mode 100644
index 0000000..bad02f0
--- /dev/null
+++ b/data/sources/local-stub.in
@@ -0,0 +1,7 @@
+# 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
+Parent=
diff --git a/data/sources/local.in b/data/sources/local.in
new file mode 100644
index 0000000..1c38384
--- /dev/null
+++ b/data/sources/local.in
@@ -0,0 +1,9 @@
+# Special built-in mail store.
+
+[Data Source]
+_DisplayName=On This Computer
+Enabled=true
+Parent=
+
+[Mail Account]
+BackendName=maildir
diff --git a/data/sources/sendmail.in b/data/sources/sendmail.in
new file mode 100644
index 0000000..ce825cb
--- /dev/null
+++ b/data/sources/sendmail.in
@@ -0,0 +1,8 @@
+
+[Data Source]
+_DisplayName=Sendmail
+Enabled=true
+Parent=
+
+[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..f1cea75
--- /dev/null
+++ b/data/sources/system-address-book.in
@@ -0,0 +1,9 @@
+
+[Data Source]
+_DisplayName=Personal
+Enabled=true
+Parent=local-stub
+
+[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..ffbe161
--- /dev/null
+++ b/data/sources/system-calendar.in
@@ -0,0 +1,11 @@
+
+[Data Source]
+_DisplayName=Personal
+Enabled=true
+Parent=local-stub
+
+[Calendar]
+BackendName=local
+Color=#becedd
+Selected=true
+
diff --git a/data/sources/system-memo-list.in b/data/sources/system-memo-list.in
new file mode 100644
index 0000000..f53f0f0
--- /dev/null
+++ b/data/sources/system-memo-list.in
@@ -0,0 +1,11 @@
+
+[Data Source]
+_DisplayName=Personal
+Enabled=true
+Parent=local-stub
+
+[Memo List]
+BackendName=local
+Color=#becedd
+Selected=true
+
diff --git a/data/sources/system-task-list.in b/data/sources/system-task-list.in
new file mode 100644
index 0000000..22f40bc
--- /dev/null
+++ b/data/sources/system-task-list.in
@@ -0,0 +1,11 @@
+
+[Data Source]
+_DisplayName=Personal
+Enabled=true
+Parent=local-stub
+
+[Task List]
+BackendName=local
+Color=#becedd
+Selected=true
+
diff --git a/data/sources/vfolder.in b/data/sources/vfolder.in
new file mode 100644
index 0000000..98a9df4
--- /dev/null
+++ b/data/sources/vfolder.in
@@ -0,0 +1,9 @@
+# Special built-in mail store.
+
+[Data Source]
+_DisplayName=Search Folders
+Enabled=true
+Parent=
+
+[Mail Account]
+BackendName=vfolder
diff --git a/data/sources/weather-stub.in b/data/sources/weather-stub.in
new file mode 100644
index 0000000..e1a549d
--- /dev/null
+++ b/data/sources/weather-stub.in
@@ -0,0 +1,5 @@
+
+[Data Source]
+_DisplayName=Weather
+Enabled=true
+Parent=
diff --git a/data/sources/webcal-stub.in b/data/sources/webcal-stub.in
new file mode 100644
index 0000000..178cec1
--- /dev/null
+++ b/data/sources/webcal-stub.in
@@ -0,0 +1,5 @@
+
+[Data Source]
+_DisplayName=On The Web
+Enabled=true
+Parent=
diff --git a/data/sources/webdav-stub.in b/data/sources/webdav-stub.in
new file mode 100644
index 0000000..78ec0c4
--- /dev/null
+++ b/data/sources/webdav-stub.in
@@ -0,0 +1,5 @@
+
+[Data Source]
+_DisplayName=WebDAV
+Enabled=true
+Parent=
diff --git a/docs/reference/libedataserver/libedataserver-sections.txt b/docs/reference/libedataserver/libedataserver-sections.txt
index a47647e..977047b 100644
--- a/docs/reference/libedataserver/libedataserver-sections.txt
+++ b/docs/reference/libedataserver/libedataserver-sections.txt
@@ -805,6 +805,9 @@ e_source_registry_commit_source_finish
e_source_registry_create_source_sync
e_source_registry_create_source
e_source_registry_create_source_finish
+e_source_registry_create_multiple_sources_sync
+e_source_registry_create_multiple_sources
+e_source_registry_create_multiple_sources_finish
e_source_registry_ref_source
e_source_registry_list_sources
e_source_registry_find_extension
diff --git a/libedataserver/e-source-alarms.c b/libedataserver/e-source-alarms.c
index e5213b8..ce7e5b5 100644
--- a/libedataserver/e-source-alarms.c
+++ b/libedataserver/e-source-alarms.c
@@ -271,7 +271,7 @@ e_source_alarms_dup_last_notified (ESourceAlarms *extension)
/**
* e_source_alarms_set_last_notified:
* @extension: an #ESourceAlarms
- * @last_notified: an ISO 8601 timestamp, or %NULL
+ * @last_notified: (allow-none): an ISO 8601 timestamp, or %NULL
*
* Sets an ISO 8601 formatted timestamp of when the user was last
* alerted about an upcoming appointment in the calendar described
diff --git a/libedataserver/e-source-authentication.c b/libedataserver/e-source-authentication.c
index 58a7dc2..f8ece63 100644
--- a/libedataserver/e-source-authentication.c
+++ b/libedataserver/e-source-authentication.c
@@ -307,7 +307,7 @@ e_source_authentication_dup_host (ESourceAuthentication *extension)
/**
* e_source_authentication_set_host:
* @extension: an #ESourceAuthentication
- * @host: a host name, or %NULL
+ * @host: (allow-none): a host name, or %NULL
*
* Sets the host name used to authenticate to a remote account.
*
@@ -401,7 +401,7 @@ e_source_authentication_dup_method (ESourceAuthentication *extension)
/**
* e_source_authentication_set_method:
* @extension: an #ESourceAuthentication
- * @method: authentication method, or %NULL
+ * @method: (allow-none): authentication method, or %NULL
*
* Sets the authentication method for a remote account. There are no
* pre-defined method names; backends are free to set this however they
@@ -535,7 +535,7 @@ e_source_authentication_dup_user (ESourceAuthentication *extension)
/**
* e_source_authentication_set_user:
* @extension: an #ESourceAuthentication
- * @user: a user name, or %NULL
+ * @user: (allow-none): a user name, or %NULL
*
* Sets the user name used to authenticate to a remote account.
*
diff --git a/libedataserver/e-source-authenticator.c b/libedataserver/e-source-authenticator.c
index 45afde5..77bada9 100644
--- a/libedataserver/e-source-authenticator.c
+++ b/libedataserver/e-source-authenticator.c
@@ -142,7 +142,7 @@ e_source_authenticator_default_init (ESourceAuthenticatorInterface *interface)
* e_source_authenticator_try_password_sync:
* @auth: an #ESourceAuthenticator
* @password: a user-provided password
- * @cancellable: optional #GCancellable object, or %NULL
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
* Attempts to authenticate using @password.
@@ -185,9 +185,10 @@ e_source_authenticator_try_password_sync (ESourceAuthenticator *auth,
* e_source_authenticator_try_password:
* @auth: an #ESourceAuthenticator
* @password: a user-provided password
- * @cancellable: optional #GCancellable object, or %NULL
- * @callback: a #GAsyncReadyCallback to call when the request is satisfied
- * @user_data: data to pass to the callback function
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
+ * @callback: (scope async): a #GAsyncReadyCallback to call when the request
+ * is satisfied
+ * @user_data: (closure): data to pass to the callback function
*
* Asyncrhonously attempts to authenticate using @password.
*
diff --git a/libedataserver/e-source-backend.c b/libedataserver/e-source-backend.c
index 9b3c311..edfc5d0 100644
--- a/libedataserver/e-source-backend.c
+++ b/libedataserver/e-source-backend.c
@@ -185,7 +185,7 @@ e_source_backend_dup_backend_name (ESourceBackend *extension)
/**
* e_source_backend_set_backend_name:
* @extension: an #ESourceBackend
- * @backend_name: a backend name
+ * @backend_name: (allow-none): a backend name, or %NULL
*
* Sets the backend name for @extension.
*
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
diff --git a/libedataserver/e-source-collection.c b/libedataserver/e-source-collection.c
index 7980878..335c1d5 100644
--- a/libedataserver/e-source-collection.c
+++ b/libedataserver/e-source-collection.c
@@ -270,7 +270,7 @@ e_source_collection_dup_identity (ESourceCollection *extension)
/**
* e_source_collection_set_identity:
* @extension: an #ESourceCollection
- * @identity: the collection identity
+ * @identity: (allow-none): the collection identity, or %NULL
*
* Sets the string used to uniquely identify the user account at the
* service provider. Often this is an email address or user name.
diff --git a/libedataserver/e-source-goa.c b/libedataserver/e-source-goa.c
index 0555dd9..3514b8c 100644
--- a/libedataserver/e-source-goa.c
+++ b/libedataserver/e-source-goa.c
@@ -197,7 +197,7 @@ e_source_goa_dup_account_id (ESourceGoa *extension)
/**
* e_source_goa_set_account_id:
* @extension: an #ESourceGoa
- * @account_id: the associated GNOME Online Account ID, or %NULL
+ * @account_id: (allow-none): the associated GNOME Online Account ID, or %NULL
*
* Sets the identifier string of the GNOME Online Account associated
* with the #ESource to which @extension belongs.
diff --git a/libedataserver/e-source-mail-account.c b/libedataserver/e-source-mail-account.c
index b7d82af..bcfc565 100644
--- a/libedataserver/e-source-mail-account.c
+++ b/libedataserver/e-source-mail-account.c
@@ -200,7 +200,7 @@ e_source_mail_account_dup_identity_uid (ESourceMailAccount *extension)
/**
* e_source_mail_account_set_identity_uid:
* @extension: an #ESourceMailAccount
- * @identity_uid: the mail identity #ESource:uid, or %NULL
+ * @identity_uid: (allow-none): the mail identity #ESource:uid, or %NULL
*
* Sets the #ESource:uid of the #ESource that describes the mail
* identity to be used for this account.
diff --git a/libedataserver/e-source-mail-composition.c b/libedataserver/e-source-mail-composition.c
index e1d2cc8..61cee77 100644
--- a/libedataserver/e-source-mail-composition.c
+++ b/libedataserver/e-source-mail-composition.c
@@ -317,7 +317,7 @@ e_source_mail_composition_dup_bcc (ESourceMailComposition *extension)
/**
* e_source_mail_composition_set_bcc:
* @extension: an #ESource
- * @bcc: a %NULL-terminated string array of Bcc recipients
+ * @bcc: (allow-none): a %NULL-terminated string array of Bcc recipients
*
* Sets the recipients which should automatically be added to the blind
* carbon-copy (Bcc) list when composing a new mail message. The recipient
@@ -398,7 +398,7 @@ e_source_mail_composition_dup_cc (ESourceMailComposition *extension)
/**
* e_source_mail_composition_set_cc:
* @extension: an #ESourceMailComposition
- * @cc: a %NULL-terminated string array of Cc recipients
+ * @cc: (allow-none): a %NULL-terminated string array of Cc recipients
*
* Sets the recipients which should automatically be added to the carbon
* copy (Cc) list when composing a new mail message. The recipient strings
@@ -475,7 +475,8 @@ e_source_mail_composition_dup_drafts_folder (ESourceMailComposition *extension)
/**
* e_source_mail_composition_set_drafts_folder:
* @extension: an #ESourceMailComposition
- * @drafts_folder: an identifier for the preferred drafts folder, or %NULL
+ * @drafts_folder: (allow-none): an identifier for the preferred drafts
+ * folder, or %NULL
*
* Sets the preferred folder for draft messages by an identifier string.
* The format of the identifier string is defined by the client application.
@@ -610,8 +611,8 @@ e_source_mail_composition_dup_templates_folder (ESourceMailComposition *extensio
/**
* e_source_mail_composition_set_templates_folder:
* @extension: an #ESourceMailComposition
- * @templates_folder: an identifier for the preferred templates folder,
- * or %NULL
+ * @templates_folder: (allow-none): an identifier for the preferred templates
+ * folder, or %NULL
*
* Sets the preferred folder for message templates by an identifier string.
* The format of the identifier string is defined by the client application.
diff --git a/libedataserver/e-source-mail-identity.c b/libedataserver/e-source-mail-identity.c
index e4a59ea..2d51ecf 100644
--- a/libedataserver/e-source-mail-identity.c
+++ b/libedataserver/e-source-mail-identity.c
@@ -315,7 +315,7 @@ e_source_mail_identity_dup_address (ESourceMailIdentity *extension)
/**
* e_source_mail_identity_set_address:
* @extension: an #ESourceMailIdentity
- * @address: the sender's email address, or %NULL
+ * @address: (allow-none): the sender's email address, or %NULL
*
* Sets the email address for this identity from which to send messages.
*
@@ -406,7 +406,7 @@ e_source_mail_identity_dup_name (ESourceMailIdentity *extension)
/**
* e_source_mail_identity_set_name:
* @extension: an #ESourceMailIdentity
- * @name: the sender's name, or %NULL
+ * @name: (allow-none): the sender's name, or %NULL
*
* Sets the sender's name for this identity.
*
@@ -501,7 +501,7 @@ e_source_mail_identity_dup_organization (ESourceMailIdentity *extension)
/**
* e_source_mail_identity_set_organization:
* @extension: an #ESourceMailIdentity
- * @organization: the sender's organization, or %NULL
+ * @organization: (allow-none): the sender's organization, or %NULL
*
* Sets the sender's organization for this identity.
*
@@ -593,7 +593,7 @@ e_source_mail_identity_dup_reply_to (ESourceMailIdentity *extension)
/**
* e_source_mail_identity_set_reply_to:
* @extension: an #ESourceMailIdentity
- * @reply_to: the sender's reply-to address, or %NULL
+ * @reply_to: (allow-none): the sender's reply-to address, or %NULL
*
* Sets the email address for this identity to which recipients should
* send replies.
@@ -689,7 +689,7 @@ e_source_mail_identity_dup_signature_uid (ESourceMailIdentity *extension)
/**
* e_source_mail_identity_set_signature_uid:
* @extension: an #ESourceMailIdentity
- * @signature_uid: the sender's signature ID, or %NULL
+ * @signature_uid: (allow-none): the sender's signature ID, or %NULL
*
* Sets the #ESource:uid of an #ESource describing a mail signature.
*
diff --git a/libedataserver/e-source-mail-signature.c b/libedataserver/e-source-mail-signature.c
index 70dbc43..06740a5 100644
--- a/libedataserver/e-source-mail-signature.c
+++ b/libedataserver/e-source-mail-signature.c
@@ -316,7 +316,7 @@ e_source_mail_signature_dup_mime_type (ESourceMailSignature *extension)
/**
* e_source_mail_signature_set_mime_type:
* @extension: an #ESourceMailSignature
- * @mime_type: a MIME type, or %NULL
+ * @mime_type: (allow-none): a MIME type, or %NULL
*
* Sets the MIME type of the signature content for @extension.
*
@@ -385,9 +385,9 @@ source_mail_signature_load_thread (GSimpleAsyncResult *simple,
* e_source_mail_signature_load_sync:
* @source: an #ESource
* @contents: return location for the signature content
- * @length: return location for the length of the signature content,
- * or %NULL if the length is not needed
- * @cancellable: optional #GCancellable object, or %NULL
+ * @length: (allow-none): return location for the length of the signature
+ * content, or %NULL if the length is not needed
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
* Loads a signature from the signature file for @source, which is
@@ -576,9 +576,10 @@ exit:
* e_source_mail_signature_load:
* @source: an #ESource
* @io_priority: the I/O priority of the request
- * @cancellable: optional #GCancellable object, or %NULL
- * @callback: a #GAsyncReadyCallback to call when the request is satisfied
- * @user_data: data to pass to the callback function
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
+ * @callback: (scope async): a #GAsyncReadyCallback to call when the request
+ * is satisfied
+ * @user_data: (closure): data to pass to the callback function
*
* Asynchronously loads a signature from the signature file for @source,
* which is given by e_source_mail_signature_get_file().
@@ -626,8 +627,8 @@ e_source_mail_signature_load (ESource *source,
* @source: an #ESource
* @result: a #GAsyncResult
* @contents: return location for the signature content
- * @length: return location for the length of the signature content,
- * or %NULL if the length is not needed
+ * @length: (allow-none): return location for the length of the signature
+ * content, or %NULL if the length is not needed
* @error: return location for a #GError, or %NULL
*
* Finishes an operation started with e_source_mail_signature_load(). The
@@ -699,7 +700,7 @@ source_mail_signature_replace_thread (GSimpleAsyncResult *simple,
* @source: an #ESource
* @contents: the signature contents
* @length: the length of @contents in bytes
- * @cancellable: optional #GCancellable object, or %NULL
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
* Replaces the signature file for @source with the given @contents
@@ -740,9 +741,10 @@ e_source_mail_signature_replace_sync (ESource *source,
* @contents: the signature contents
* @length: the length of @contents in bytes
* @io_priority: the I/O priority of the request
- * @cancellable: optional #GCancellable object, or %NULL
- * @callback: a #GAsyncReadyCallback to call when the request is satisfied
- * @user_data: data to pass to the callback function
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
+ * @callback: (scope async): a #GAsyncReadyCallback to call when the request
+ * is satisfied
+ * @user_data: (closure): data to pass to the callback function
*
* Asynchrously replaces the signature file for @source with the given
* @contents of @length bytes. The signature file for @source is given
@@ -843,7 +845,7 @@ source_mail_signature_symlink_thread (GSimpleAsyncResult *simple,
* e_source_mail_signature_symlink_sync:
* @source: an #ESource
* @symlink_target: executable filename to link to
- * @cancellable: optional #GCancellable object, or %NULL
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
* Replaces the signature file for @source with a symbolic link to
@@ -887,9 +889,10 @@ e_source_mail_signature_symlink_sync (ESource *source,
* @source: an #ESource
* @symlink_target: executable filename to link to
* @io_priority: the I/O priority of the request
- * @cancellable: optional #GCancellable object, or %NULL
- * @callback: a #GAsyncReadyCallback to call when the request is satisfied
- * @user_data: data to pass to the callback function
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
+ * @callback: (scope async): a #GAsyncReadyCallback to call when the request
+ * is satisfied
+ * @user_data: (closure): data to pass to the callback function
*
* Asynchronously replaces the signature file for @source with a symbolic
* link to @symlink_target, which should be an executable file that prints
diff --git a/libedataserver/e-source-mail-submission.c b/libedataserver/e-source-mail-submission.c
index 5377c61..07b44ab 100644
--- a/libedataserver/e-source-mail-submission.c
+++ b/libedataserver/e-source-mail-submission.c
@@ -229,7 +229,8 @@ e_source_mail_submission_dup_sent_folder (ESourceMailSubmission *extension)
/**
* e_source_mail_submission_set_sent_folder:
* @extension: an #ESourceMailSubmission
- * @sent_folder: an identifier for the preferred sent folder, or %NULL
+ * @sent_folder: (allow-none): an identifier for the preferred sent folder,
+ * or %NULL
*
* Sets the preferred folder for sent messages by an identifier string.
* The format of the identifier string is defined by the client application.
@@ -322,7 +323,7 @@ e_source_mail_submission_dup_transport_uid (ESourceMailSubmission *extension)
/**
* e_source_mail_submission_set_transport_uid:
* @extension: an #ESourceMailSubmission
- * @transport_uid: the mail transport #ESource:uid, or %NULL
+ * @transport_uid: (allow-none): the mail transport #ESource:uid, or %NULL
*
* Sets the #ESource:uid of the #ESource that describes the mail
* transport to be used for outgoing messages.
diff --git a/libedataserver/e-source-refresh.c b/libedataserver/e-source-refresh.c
index 9a2c568..7c5fa57 100644
--- a/libedataserver/e-source-refresh.c
+++ b/libedataserver/e-source-refresh.c
@@ -458,10 +458,12 @@ e_source_refresh_set_interval_minutes (ESourceRefresh *extension,
/**
* e_source_refresh_add_timeout:
* @source: an #ESource
- * @context: a #GMainContext (if %NULL, the default context will be used)
+ * @context: (allow-none): a #GMainContext, or %NULL (if %NULL, the default
+ * context will be used)
* @callback: function to call on each timeout
* @user_data: data to pass to @callback
- * @notify: function to call when the timeout is removed, or %NULL
+ * @notify: (allow-none): function to call when the timeout is removed,
+ * or %NULL
*
* This is a simple way to schedule a periodic data source refresh.
*
diff --git a/libedataserver/e-source-registry.c b/libedataserver/e-source-registry.c
index de19db3..7e812e2 100644
--- a/libedataserver/e-source-registry.c
+++ b/libedataserver/e-source-registry.c
@@ -112,6 +112,7 @@ struct _ESourceRegistryPrivate {
};
struct _AsyncContext {
+ GList *input_sources;
ESource *input_source;
ESource *output_source;
ESourceAuthenticator *auth;
@@ -134,8 +135,8 @@ struct _CreateContext {
ESourceRegistry *registry;
GMainContext *main_context;
GMainLoop *main_loop;
- gchar *object_path;
- ESource *source;
+ ESource *input_source;
+ ESource *output_source;
};
struct _SourceClosure {
@@ -190,6 +191,10 @@ G_DEFINE_TYPE_WITH_CODE (
static void
async_context_free (AsyncContext *async_context)
{
+ g_list_free_full (
+ async_context->input_sources,
+ (GDestroyNotify) g_object_unref);
+
if (async_context->input_source != NULL)
g_object_unref (async_context->input_source);
@@ -234,24 +239,21 @@ create_context_new (ESourceRegistry *registry)
create_context->main_loop = g_main_loop_new (
create_context->main_context, FALSE);
- g_main_context_push_thread_default (create_context->main_context);
-
return create_context;
}
static void
create_context_free (CreateContext *create_context)
{
- g_main_context_pop_thread_default (create_context->main_context);
-
g_object_unref (create_context->registry);
g_main_context_unref (create_context->main_context);
g_main_loop_unref (create_context->main_loop);
- if (create_context->source != NULL)
- g_object_unref (create_context->source);
+ if (create_context->input_source != NULL)
+ g_object_unref (create_context->input_source);
- g_free (create_context->object_path);
+ if (create_context->output_source != NULL)
+ g_object_unref (create_context->output_source);
g_slice_free (CreateContext, create_context);
}
@@ -1261,7 +1263,7 @@ e_source_registry_init (ESourceRegistry *registry)
/**
* e_source_registry_new_sync:
- * @cancellable: optional #GCancellable object, or %NULL
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
* Creates a new #ESourceRegistry front-end for the registry D-Bus service.
@@ -1283,9 +1285,10 @@ e_source_registry_new_sync (GCancellable *cancellable,
/**
* e_source_registry_new:
- * @cancellable: optional #GCancellable object, or %NULL
- * @callback: a #GAsyncReadyCallback to call when the request is satisfied
- * @user_data: data to pass to the callback function
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
+ * @callback: (scope async): a #GAsyncReadyCallback to call when the request
+ * is satisfied
+ * @user_data: (closure): data to pass to the callback function
*
* Asynchronously creates a new #ESourceRegistry front-end for the registry
* D-Bus service.
@@ -1708,7 +1711,7 @@ source_registry_call_authenticate_for_source (ESourceRegistry *registry,
* @registry: an #ESourceRegistry
* @source: an #ESource
* @auth: an #ESourceAuthenticator
- * @cancellable: optional #GCancellable object, or %NULL
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
* Authenticates @source, using @auth to handle the authentication
@@ -1832,9 +1835,10 @@ exit:
* @registry: an #ESourceRegistry
* @source: an #ESource
* @auth: an #ESourceAuthenticator
- * @cancellable: optional #GCancellable object, or %NULL
- * @callback: a #GAsyncReadyCallback to call when the request is satisfied
- * @user_data: data to pass to the callback function
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
+ * @callback: (scope async): a #GAsyncReadyCallback to call when the request
+ * is satisfied
+ * @user_data: (closure): data to pass to the callback function
*
* Asynchronously authenticates @source, using @auth to handle the
* authentication attempts. The operation loops until authentication
@@ -1942,8 +1946,9 @@ source_registry_commit_source_thread (GSimpleAsyncResult *simple,
* e_source_registry_commit_source_sync:
* @registry: an #ESourceRegistry
* @input_source: an #ESource with changes to commit
- * @output_source: return location for the committed #ESource, or %NULL
- * @cancellable: optional #GCancellable object, or %NULL
+ * @output_source: (allow-none): return location for the committed #ESource,
+ * or %NULL
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
* @error: return location for #GError, or %NULL
*
* This is a convenience function intended for use with graphical
@@ -2003,9 +2008,10 @@ e_source_registry_commit_source_sync (ESourceRegistry *registry,
* e_source_registry_commit_source:
* @registry: an #ESourceRegistry
* @input_source: an #ESource with changes to commit
- * @cancellable: optional #GCancellable object, or %NULL
- * @callback: a #GAsyncReadyCallback to call when the request is satisfied
- * @user_data: data to pass to the callback function
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
+ * @callback: (scope async): a #GAsyncReadyCallback to call when the request
+ * is satisfied
+ * @user_data: (closure): data to pass to the callback function
*
* See e_source_registry_commit_source_sync() for details.
*
@@ -2049,7 +2055,8 @@ e_source_registry_commit_source (ESourceRegistry *registry,
* e_source_registry_commit_source_finish:
* @registry: an #ESourceRegistry
* @result: a #GAsyncResult
- * @output_source: return location for the committed #ESource, or %NULL
+ * @output_source: (allow-none): return location for the committed #ESource,
+ * or %NULL
* @error: return location for a #GError, or %NULL
*
* Finishes the operation started with e_source_registry_commit_source().
@@ -2117,18 +2124,11 @@ source_registry_create_idle_cb (gpointer user_data)
{
CreateContext *create_context = user_data;
- /* We should know what object path we're looking for by now. */
- g_return_val_if_fail (create_context->object_path != NULL, FALSE);
-
- /* Find the corresponding ESource in the object path table.
- * Note that the lookup returns a new ESource reference. */
- create_context->source =
- source_registry_object_path_table_lookup (
- create_context->registry, create_context->object_path);
+ /* If we got here it means we found a matching ESource. */
+ g_return_val_if_fail (create_context->output_source != NULL, FALSE);
- /* If we got a hit, terminate the main loop. */
- if (create_context->source != NULL)
- g_main_loop_quit (create_context->main_loop);
+ /* Just need to terminate the main loop. */
+ g_main_loop_quit (create_context->main_loop);
return FALSE;
}
@@ -2139,27 +2139,51 @@ source_registry_create_object_added_cb (GDBusObjectManager *object_manager,
GDBusObject *dbus_object,
CreateContext *create_context)
{
- GSource *idle_source;
+ ESource *source;
+ const gchar *object_path;
- /* Schedule a callback in response to an object being added.
- * Note that we're in the object manager thread here, so we
- * want to do as little as possible. */
+ /* Note that we're in the object manager thread here.
+ * The object manager thread's "object-added" handler
+ * should have already run. We depend on it. */
- idle_source = g_idle_source_new ();
- g_source_set_callback (
- idle_source,
- source_registry_create_idle_cb,
- create_context, (GDestroyNotify) NULL);
- g_source_attach (idle_source, create_context->main_context);
- g_source_unref (idle_source);
+ object_path = g_dbus_object_get_object_path (dbus_object);
+ g_return_if_fail (object_path != NULL);
+
+ /* Find the corresponding ESource in the object path table.
+ * Note that the lookup returns a new ESource reference. */
+ source = source_registry_object_path_table_lookup (
+ create_context->registry, object_path);
+ g_return_if_fail (source != NULL);
+
+ /* Check if this is the source we want based on its UID. */
+ if (e_source_equal (source, create_context->input_source)) {
+ GSource *idle_source;
+
+ create_context->output_source = g_object_ref (source);
+
+ /* Schedule an idle source to quit the main loop.
+ * We do it this way because the main loop may not
+ * be running yet, but an idle source will not be
+ * dispatched until the main loop is running. */
+ idle_source = g_idle_source_new ();
+ g_source_set_callback (
+ idle_source,
+ source_registry_create_idle_cb,
+ create_context, (GDestroyNotify) NULL);
+ g_source_attach (idle_source, create_context->main_context);
+ g_source_unref (idle_source);
+ }
+
+ g_object_unref (source);
}
/**
* e_source_registry_create_source_sync:
* @registry: an #ESourceRegistry
* @input_source: an #ESource with no #GDBusObject
- * @output_source: return location for a newly-created #ESource, or %NULL
- * @cancellable: optional #GCancellable object, or %NULL
+ * @output_source: (allow-none): return location for a newly-created #ESource,
+ * or %NULL
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
* Requests the D-Bus service to create a new key file from @input_source
@@ -2184,6 +2208,8 @@ e_source_registry_create_source_sync (ESourceRegistry *registry,
GError **error)
{
CreateContext *create_context;
+ GVariantBuilder builder;
+ GVariant *variant;
gulong object_added_id;
gchar *source_data;
const gchar *uid;
@@ -2203,59 +2229,71 @@ e_source_registry_create_source_sync (ESourceRegistry *registry,
*
* This is most likely to occur when creating a collection of
* related sources one at a time and the caller is not careful
- * to create parent sources before children. Perhaps a method
- * to create the collection in parallel would help to mitigate
- * the deadlock risk?
+ * to create parent sources before children.
+ *
+ * ADDENDUM
+ *
+ * I wrote e_source_registry_create_multiple_sources_sync()
+ * to address this issue, and so that collections are added
+ * atomically on the server side (wrt the main loop) which
+ * is easier for collection backends to deal with.
*/
+ uid = e_source_get_uid (input_source);
+
create_context = create_context_new (registry);
+ create_context->input_source = g_object_ref (input_source);
+
+ g_main_context_push_thread_default (create_context->main_context);
/* Start listening for the "object-added" signal BEFORE we call
- * the D-Bus method, even though we don't know what object path
- * we're looking for yet. The signal may be emitted before the
- * D-Bus method returns. */
+ * the D-Bus method. The signal may be emitted before the D-Bus
+ * method returns.
+ *
+ * The object manager thread's "object-added" signal handler
+ * will run first and add a new ESource instance to the object
+ * path table. We then grab it from the object path table and
+ * compare it to the input source.
+ */
object_added_id = g_signal_connect_data (
registry->priv->dbus_object_manager, "object-added",
G_CALLBACK (source_registry_create_object_added_cb),
create_context, (GClosureNotify) create_context_free, 0);
- uid = e_source_get_uid (input_source);
source_data = e_source_to_string (input_source, NULL);
- /* Setting the object path directly on the CreateContext
- * is thread-safe because only the idle callbacks on our
- * GMainContext use the object path, but we have not yet
- * started our main loop so any scheduled idle callbacks
- * are still pending. */
- success = e_dbus_source_manager_call_create_source_sync (
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+ g_variant_builder_add (&builder, "{ss}", uid, source_data);
+ variant = g_variant_builder_end (&builder);
+
+ /* This function sinks the floating GVariant reference. */
+ success = e_dbus_source_manager_call_create_sources_sync (
registry->priv->dbus_source_manager,
- uid, source_data, &create_context->object_path,
- cancellable, error);
+ variant, cancellable, error);
- g_free (source_data);
+ g_variant_builder_clear (&builder);
- /* Sanity check. */
- g_warn_if_fail (
- (success && create_context->object_path != NULL) ||
- (!success && create_context->object_path == NULL));
+ g_free (source_data);
if (success) {
/* Now start the main loop. It will terminate
* when we have our newly-created ESource. */
g_main_loop_run (create_context->main_loop);
- g_warn_if_fail (E_IS_SOURCE (create_context->source));
+ g_warn_if_fail (create_context->output_source);
/* Hand the newly-created ESource back to
* the caller if the caller is interested. */
if (output_source != NULL) {
- *output_source = create_context->source;
- create_context->source = NULL;
+ *output_source = create_context->output_source;
+ create_context->output_source = NULL;
}
}
/* Clean up. */
+ g_main_context_pop_thread_default (create_context->main_context);
+
/* This will free the CreateContext signal handler data. */
g_signal_handler_disconnect (
registry->priv->dbus_object_manager, object_added_id);
@@ -2267,9 +2305,10 @@ e_source_registry_create_source_sync (ESourceRegistry *registry,
* e_source_registry_create_source:
* @registry: an #ESourceRegistry
* @input_source: an #ESource with no #EBusObject
- * @cancellable: optional #GCancellable object, or %NULL
- * @callback: a #GAsyncReadyCallback to call when the request is satisfied
- * @user_data: data to pass to the callback function
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
+ * @callback: (scope async): a #GAsyncReadyCallback to call when the request
+ * is satisfied
+ * @user_data: (closure): data to pass to the callback function
*
* See e_source_registry_create_source_sync() for details.
*
@@ -2313,7 +2352,8 @@ e_source_registry_create_source (ESourceRegistry *registry,
* e_source_registry_create_source_finish:
* @registry: an #ESourceRegistry
* @result: a #GAsyncResult
- * @output_source: return location for a newly-created #ESource, or %NULL
+ * @output_source: (allow-none): return location for a newly-created #ESource,
+ * or %NULL
* @error: return location for a #GError, or %NULL
*
* Finishes the operation started with e_source_registry_create_source().
@@ -2354,6 +2394,183 @@ e_source_registry_create_source_finish (ESourceRegistry *registry,
return TRUE;
}
+/* Helper for e_source_registry_create_multiple_sources() */
+static void
+source_registry_create_multiple_sources_thread (GSimpleAsyncResult *simple,
+ GObject *object,
+ GCancellable *cancellable)
+{
+ AsyncContext *async_context;
+ GError *error = NULL;
+
+ async_context = g_simple_async_result_get_op_res_gpointer (simple);
+
+ e_source_registry_create_multiple_sources_sync (
+ E_SOURCE_REGISTRY (object),
+ async_context->input_sources,
+ cancellable, &error);
+
+ if (error != NULL)
+ g_simple_async_result_take_error (simple, error);
+}
+
+/**
+ * e_source_registry_create_multiple_sources_sync:
+ * @registry: an #ESourceRegistry
+ * @input_sources: a list of #ESource instances with no #GDBusObject
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
+ * @error: return location for a #GError, or %NULL
+ *
+ * Requests the D-Bus service create new key files for each #ESource in
+ * @input_sources. Each list element must be a throw-away #ESource with
+ * no #GDBusObject.
+ *
+ * Use this function when creating a collection of related data sources
+ * so the D-Bus service can handle them all at once.
+ *
+ * If an error occurs, the function will set @error and return %FALSE.
+ *
+ * Returns: %TRUE on success, %FALSE on failure
+ *
+ * Since: 3.6
+ **/
+gboolean
+e_source_registry_create_multiple_sources_sync (ESourceRegistry *registry,
+ GList *input_sources,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GVariantBuilder builder;
+ GVariant *variant;
+ GList *link;
+ gboolean success;
+
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
+
+ /* Verify the list elements are all ESources. */
+ for (link = input_sources; link != NULL; link = g_list_next (link))
+ g_return_val_if_fail (E_IS_SOURCE (link->data), FALSE);
+
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+
+ for (link = input_sources; link != NULL; link = g_list_next (link)) {
+ ESource *source;
+ const gchar *uid;
+ gchar *source_data;
+
+ source = E_SOURCE (link->data);
+ uid = e_source_get_uid (source);
+
+ source_data = e_source_to_string (source, NULL);
+ g_variant_builder_add (&builder, "{ss}", uid, source_data);
+ g_free (source_data);
+ }
+
+ variant = g_variant_builder_end (&builder);
+
+ /* This function sinks the floating GVariant reference. */
+ success = e_dbus_source_manager_call_create_sources_sync (
+ registry->priv->dbus_source_manager,
+ variant, cancellable, error);
+
+ g_variant_builder_clear (&builder);
+
+ return success;
+}
+
+/**
+ * e_source_registry_create_multiple_sources:
+ * @registry: an #ESourceRegistry
+ * @input_sources: a list of #ESource instances with no #GDBusObject
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
+ * @callback: (scope async): a #GAsyncReadyCallback to call when the request
+ * is satisfied
+ * @user_data: (closure): data to pass to the callback function
+ *
+ * Asynchronously requests the D-Bus service create new key files for each
+ * #ESource in @input_sources. Each list element must be a throw-away
+ * #ESource with no #GDBusObject.
+ *
+ * Use this function when creating a collection of related data sources
+ * so the D-Bus service can handle them all at once.
+ *
+ * When the operation is finished, @callback will be called. You can then
+ * call e_source_registry_create_multiple_sources_finish() to get the result
+ * of the operation.
+ *
+ * Since: 3.6
+ **/
+void
+e_source_registry_create_multiple_sources (ESourceRegistry *registry,
+ GList *input_sources,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *simple;
+ AsyncContext *async_context;
+ GList *link;
+
+ g_return_if_fail (E_IS_SOURCE_REGISTRY (registry));
+
+ /* Verify the list elements are all ESources. */
+ for (link = input_sources; link != NULL; link = g_list_next (link))
+ g_return_if_fail (E_IS_SOURCE (link->data));
+
+ async_context = g_slice_new0 (AsyncContext);
+ async_context->input_sources = g_list_copy (input_sources);
+
+ g_list_foreach (
+ async_context->input_sources,
+ (GFunc) g_object_ref, NULL);
+
+ simple = g_simple_async_result_new (
+ G_OBJECT (registry), callback, user_data,
+ e_source_registry_create_multiple_sources);
+
+ g_simple_async_result_set_op_res_gpointer (
+ simple, async_context, (GDestroyNotify) async_context_free);
+
+ g_simple_async_result_run_in_thread (
+ simple, source_registry_create_multiple_sources_thread,
+ G_PRIORITY_DEFAULT, cancellable);
+
+ g_object_unref (simple);
+}
+
+/**
+ * e_source_registry_create_multiple_sources_finish:
+ * @registry: an #ESourceRegistry
+ * @result: a #GAsyncResult
+ * @error: return location for a #GError, or %NULL
+ *
+ * Finishes the operation started with
+ * e_source_registry_create_multiple_sources().
+ *
+ * If an error occurred, the function will set @error and return %FALSE.
+ *
+ * Returns: %TRUE on success, %FALSE on failure
+ *
+ * Since: 3.6
+ **/
+gboolean
+e_source_registry_create_multiple_sources_finish (ESourceRegistry *registry,
+ GAsyncResult *result,
+ GError **error)
+{
+ GSimpleAsyncResult *simple;
+
+ g_return_val_if_fail (
+ g_simple_async_result_is_valid (
+ result, G_OBJECT (registry),
+ e_source_registry_create_multiple_sources), FALSE);
+
+ simple = G_SIMPLE_ASYNC_RESULT (result);
+
+ /* Assume success unless a GError is set. */
+ return !g_simple_async_result_propagate_error (simple, error);
+}
+
/**
* e_source_registry_ref_source:
* @registry: an #ESourceRegistry
@@ -2364,7 +2581,7 @@ e_source_registry_create_source_finish (ESourceRegistry *registry,
* The returned #ESource is referenced for thread-safety and must be
* unreferenced with g_object_unref() when finished with it.
*
- * Returns: an #ESource, or %NULL if no match was found
+ * Returns: (transfer full): an #ESource, or %NULL if no match was found
*
* Since: 3.6
**/
@@ -2381,7 +2598,7 @@ e_source_registry_ref_source (ESourceRegistry *registry,
/**
* e_source_registry_list_sources:
* @registry: an #ESourceRegistry
- * @extension_name: an extension name, or %NULL
+ * @extension_name: (allow-none): an extension name, or %NULL
*
* Returns a list of registered sources, sorted by display name. If
* @extension_name is given, restrict the list to sources having that
@@ -2397,7 +2614,7 @@ e_source_registry_ref_source (ESourceRegistry *registry,
* g_list_free_full (list, g_object_unref);
* ]|
*
- * Returns: a sorted list of sources
+ * Returns: (transfer full): a sorted list of sources
*
* Since: 3.6
**/
@@ -2459,7 +2676,7 @@ e_source_registry_list_sources (ESourceRegistry *registry,
* instead of the #ESourceExtension itself because extension instances are
* not to be referenced directly (see e_source_get_extension()).
*
- * Returns: an #ESource, or %NULL if no match was found
+ * Returns: (transfer full): an #ESource, or %NULL if no match was found
*
* Since: 3.6
**/
@@ -2592,7 +2809,7 @@ source_registry_prune_nodes (GNode *node,
/**
* e_source_registry_build_display_tree:
* @registry: an #ESourceRegistry
- * @extension_name: an extension name, or %NULL
+ * @extension_name: (allow-none): an extension name, or %NULL
*
* Returns a single #GNode tree of registered sources that can be used to
* populate a #GtkTreeModel. (The root #GNode is just an empty placeholder.)
@@ -2610,7 +2827,7 @@ source_registry_prune_nodes (GNode *node,
* For convenience, e_source_registry_free_display_tree() does all
* that in one step.
*
- * Returns: a tree of sources, arranged for display
+ * Returns: (transfer full): a tree of sources, arranged for display
*
* Since: 3.6
**/
@@ -2699,7 +2916,7 @@ source_registry_debug_dump_cb (GNode *node)
/**
* e_source_registry_debug_dump:
* @registry: an #ESourceRegistry
- * @extension_name: an extension name, or %NULL
+ * @extension_name: (allow-none): an extension name, or %NULL
*
* Handy debugging function that uses e_source_registry_build_display_tree()
* to print a tree of registered sources to standard output.
@@ -2734,7 +2951,7 @@ e_source_registry_debug_dump (ESourceRegistry *registry,
* The returned #ESource is referenced for thread-safety and must be
* unreferenced with g_object_unref() when finished with it.
*
- * Returns: the built-in address book #ESource
+ * Returns: (transfer full): the built-in address book #ESource
*
* Since: 3.6
**/
@@ -2764,7 +2981,7 @@ e_source_registry_ref_builtin_address_book (ESourceRegistry *registry)
* The returned #ESource is referenced for thread-safety and must be
* unreferenced with g_object_unref() when finished with it.
*
- * Returns: the default address book #ESource
+ * Returns: (transfer full): the default address book #ESource
*
* Since: 3.6
**/
@@ -2794,7 +3011,7 @@ e_source_registry_ref_default_address_book (ESourceRegistry *registry)
/**
* e_source_registry_set_default_address_book:
* @registry: an #ESourceRegistry
- * @default_source: an address book #ESource, or %NULL
+ * @default_source: (allow-none): an address book #ESource, or %NULL
*
* Sets @default_source as the default address book. If @default_source
* is %NULL, the default address book is reset to the built-in address book.
@@ -2836,7 +3053,7 @@ e_source_registry_set_default_address_book (ESourceRegistry *registry,
* The returned #ESource is referenced for thread-safety and must be
* unreferenced with g_object_unref() when finished with it.
*
- * Returns: the built-in calendar #ESource
+ * Returns: (transfer full): the built-in calendar #ESource
*
* Since: 3.6
**/
@@ -2866,7 +3083,7 @@ e_source_registry_ref_builtin_calendar (ESourceRegistry *registry)
* The returned #ESource is referenced for thread-safety and must be
* unreferenced with g_object_unref() when finished with it.
*
- * Returns: the default calendar #ESource
+ * Returns: (transfer full): the default calendar #ESource
*
* Since: 3.6
**/
@@ -2896,7 +3113,7 @@ e_source_registry_ref_default_calendar (ESourceRegistry *registry)
/**
* e_source_registry_set_default_calendar:
* @registry: an #ESourceRegistry
- * @default_source: a calendar #ESource, or %NULL
+ * @default_source: (allow-none): a calendar #ESource, or %NULL
*
* Sets @default_source as the default calendar. If @default_source
* is %NULL, the default calendar is reset to the built-in calendar.
@@ -2938,7 +3155,7 @@ e_source_registry_set_default_calendar (ESourceRegistry *registry,
* The returned #ESource is referenced for thread-safety and must be
* unreferenced with g_object_unref() when finished with it.
*
- * Returns: the built-in mail account #ESource
+ * Returns: (transfer full): the built-in mail account #ESource
*
* Since: 3.6
**/
@@ -2968,7 +3185,7 @@ e_source_registry_ref_builtin_mail_account (ESourceRegistry *registry)
* The returned #ESource is referenced for thread-safety and must be
* unreferenced with g_object_unref() when finished with it.
*
- * Returns: the default mail account #ESource
+ * Returns: (transfer full): the default mail account #ESource
*
* Since: 3.6
**/
@@ -2998,7 +3215,7 @@ e_source_registry_ref_default_mail_account (ESourceRegistry *registry)
/**
* e_source_registry_set_default_mail_account:
* @registry: an #ESourceRegistry
- * @default_source: a mail account #ESource, or %NULL
+ * @default_source: (allow-none): a mail account #ESource, or %NULL
*
* Sets @default_source as the default mail account. If @default_source
* is %NULL, the default mail account is reset to the built-in mail account.
@@ -3040,7 +3257,7 @@ e_source_registry_set_default_mail_account (ESourceRegistry *registry,
* The returned #ESource is referenced for thread-safety and must be
* unreferenced with g_object_unref() when finished with it.
*
- * Returns: the built-in memo list #ESource
+ * Returns: (transfer full): the built-in memo list #ESource
*
* Since: 3.6
**/
@@ -3070,7 +3287,7 @@ e_source_registry_ref_builtin_memo_list (ESourceRegistry *registry)
* The returned #ESource is referenced for thread-safety and must be
* unreferenced with g_object_unref() when finished with it.
*
- * Returns: the default memo list #ESource
+ * Returns: (transfer full): the default memo list #ESource
*
* Since: 3.6
**/
@@ -3100,7 +3317,7 @@ e_source_registry_ref_default_memo_list (ESourceRegistry *registry)
/**
* e_source_registry_set_default_memo_list:
* @registry: an #ESourceRegistry
- * @default_source: a memo list #ESource, or %NULL
+ * @default_source: (allow-none): a memo list #ESource, or %NULL
*
* Sets @default_source as the default memo list. If @default_source
* is %NULL, the default memo list is reset to the built-in memo list.
@@ -3142,7 +3359,7 @@ e_source_registry_set_default_memo_list (ESourceRegistry *registry,
* The returned #ESource is referenced for thread-safety and must be
* unreferenced with g_object_unref() when finished with it.
*
- * Returns: the built-in task list #ESource
+ * Returns: (transfer full): the built-in task list #ESource
*
* Since: 3.6
**/
@@ -3172,7 +3389,7 @@ e_source_registry_ref_builtin_task_list (ESourceRegistry *registry)
* The returned #ESource is referenced for thread-safety and must be
* unreferenced with g_object_unref() when finished with it.
*
- * Returns: the default task list #ESource
+ * Returns: (transfer full): the default task list #ESource
*
* Since: 3.6
**/
@@ -3202,7 +3419,7 @@ e_source_registry_ref_default_task_list (ESourceRegistry *registry)
/**
* e_source_registry_set_default_task_list:
* @registry: an #ESourceRegistry
- * @default_source: a task list #ESource, or %NULL
+ * @default_source: (allow-none): a task list #ESource, or %NULL
*
* Sets @default_source as the default task list. If @default_source
* is %NULL, the default task list is reset to the built-in task list.
@@ -3263,7 +3480,7 @@ e_source_registry_set_default_task_list (ESourceRegistry *registry,
* The returned #ESource is referenced for thread-safety and must be
* unreferenced with g_object_unref() when finished with it.
*
- * Returns: the default #ESource based on @extension_name
+ * Returns: (transfer full): the default #ESource based on @extension_name
*
* Since: 3.6
**/
@@ -3296,7 +3513,7 @@ e_source_registry_ref_default_for_extension_name (ESourceRegistry *registry,
* e_source_registry_set_default_for_extension_name:
* @registry: an #ESourceRegistry
* @extension_name: an extension name
- * @default_source: an #ESource, or %NULL
+ * @default_source: (allow-none): an #ESource, or %NULL
*
* This is a convenience function to set a default #ESource based on
* @extension_name. This only works with a subset of extension names.
diff --git a/libedataserver/e-source-registry.h b/libedataserver/e-source-registry.h
index 523217a..4be5273 100644
--- a/libedataserver/e-source-registry.h
+++ b/libedataserver/e-source-registry.h
@@ -134,6 +134,21 @@ gboolean e_source_registry_create_source_finish
GAsyncResult *result,
ESource **output_source,
GError **error);
+gboolean e_source_registry_create_multiple_sources_sync
+ (ESourceRegistry *registry,
+ GList *input_sources,
+ GCancellable *cancellable,
+ GError **error);
+void e_source_registry_create_multiple_sources
+ (ESourceRegistry *registry,
+ GList *input_sources,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean e_source_registry_create_multiple_sources_finish
+ (ESourceRegistry *registry,
+ GAsyncResult *result,
+ GError **error);
ESource * e_source_registry_ref_source (ESourceRegistry *registry,
const gchar *uid);
GList * e_source_registry_list_sources (ESourceRegistry *registry,
diff --git a/libedataserver/e-source-security.c b/libedataserver/e-source-security.c
index 0f6c87b..c0df815 100644
--- a/libedataserver/e-source-security.c
+++ b/libedataserver/e-source-security.c
@@ -225,7 +225,7 @@ e_source_security_dup_method (ESourceSecurity *extension)
/**
* e_source_security_set_method:
* @extension: an #ESourceSecurity
- * @method: security method, or %NULL
+ * @method: (allow-none): security method, or %NULL
*
* Sets the method used to establish a secure network connection to a
* remote account. There are no pre-defined method names; backends are
diff --git a/libedataserver/e-source-selectable.c b/libedataserver/e-source-selectable.c
index c4a1271..5443179 100644
--- a/libedataserver/e-source-selectable.c
+++ b/libedataserver/e-source-selectable.c
@@ -216,7 +216,7 @@ e_source_selectable_dup_color (ESourceSelectable *extension)
/**
* e_source_selectable_set_color:
* @extension: an #ESourceSelectable
- * @color: a color specification, or %NULL
+ * @color: (allow-none): a color specification, or %NULL
*
* Sets the color specification for the #ESource to which @extension
* belongs. A colored block is often displayed next to the data source's
diff --git a/libedataserver/e-source-smime.c b/libedataserver/e-source-smime.c
index 2099bb2..f380f10 100644
--- a/libedataserver/e-source-smime.c
+++ b/libedataserver/e-source-smime.c
@@ -338,7 +338,8 @@ e_source_smime_dup_encryption_certificate (ESourceSMIME *extension)
/**
* e_source_smime_set_encryption_certificate:
* @extension: an #ESourceSMIME
- * @encryption_certificate: the certificate name used to encrypt messages
+ * @encryption_certificate: (allow-none): the certificate name used to encrypt
+ * messages, or %NULL
*
* Sets the certificate name used to encrypt messages.
*
@@ -508,7 +509,8 @@ e_source_smime_dup_signing_algorithm (ESourceSMIME *extension)
/**
* e_source_smime_set_signing_algorithm:
* @extension: an #ESourceSMIME
- * @signing_algorithm: the signing algorithm for outgoing messages
+ * @signing_algorithm: (allow-none): the signing algorithm for outgoing
+ * messages, or %NULL
*
* Sets the name of the hash algorithm used to digitally sign outgoing
* messages.
@@ -600,7 +602,8 @@ e_source_smime_dup_signing_certificate (ESourceSMIME *extension)
/**
* e_source_smime_set_signing_certificate:
* @extension: an #ESourceSMIME
- * @signing_certificate: the certificate name used to sign messages
+ * @signing_certificate: (allow-none): the certificate name used to sign
+ * messages, or %NULL
*
* Sets the S/MIME certificate name used to sign messages.
*
diff --git a/libedataserver/e-source-webdav.c b/libedataserver/e-source-webdav.c
index eeaf755..9381e11 100644
--- a/libedataserver/e-source-webdav.c
+++ b/libedataserver/e-source-webdav.c
@@ -754,7 +754,8 @@ e_source_webdav_dup_display_name (ESourceWebdav *extension)
/**
* e_source_webdav_set_display_name:
* @extension: an #ESourceWebdav
- * @display_name: the display name of the WebDAV resource
+ * @display_name: (allow-none): the display name of the WebDAV resource,
+ * or %NULL
*
* Updates the last known display name of a WebDAV resource, which may
* differ from the #ESource:display-name property of the #ESource to which
@@ -848,7 +849,7 @@ e_source_webdav_dup_email_address (ESourceWebdav *extension)
/**
* e_source_webdav_set_email_address:
* @extension: an #ESourceWebdav
- * @email_address: the user's email address, or %NULL
+ * @email_address: (allow-none): the user's email address, or %NULL
*
* Sets the user's email address which can be passed to a CalDAV server if
* the user wishes to receive scheduling messages.
@@ -984,7 +985,8 @@ e_source_webdav_dup_resource_path (ESourceWebdav *extension)
/**
* e_source_webdav_set_resource_path:
* @extension: an #ESourceWebdav
- * @resource_path: the absolute path to a WebDAV resource, or %NULL
+ * @resource_path: (allow-none): the absolute path to a WebDAV resource,
+ * or %NULL
*
* Sets the absolute path to a resource on a WebDAV server.
*
@@ -1032,7 +1034,7 @@ e_source_webdav_set_resource_path (ESourceWebdav *extension,
* extension, the #ESourceSecurity extension, and @extension itself.
* Free the returned #SoupURI with soup_uri_free().
*
- * Returns: a newly-allocated #SoupURI
+ * Returns: (transfer full): a newly-allocated #SoupURI
*
* Since: 3.6
**/
diff --git a/libedataserver/e-source.c b/libedataserver/e-source.c
index 06a39d3..73ec605 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -1231,8 +1231,8 @@ e_source_init (ESource *source)
/**
* e_source_new:
- * @dbus_object: a #GDBusObject or %NULL
- * @main_context: a #GMainContext or %NULL
+ * @dbus_object: (allow-none): a #GDBusObject or %NULL
+ * @main_context: (allow-none): a #GMainContext or %NULL
* @error: return location for a #GError, or %NULL
*
* Creates a new #ESource instance.
@@ -1455,7 +1455,7 @@ e_source_dup_parent (ESource *source)
/**
* e_source_set_parent:
* @source: an #ESource
- * @parent: the UID of the parent #ESource
+ * @parent: (allow-none): the UID of the parent #ESource, or %NULL
*
* Identifies the parent of @source by its unique identifier string.
* This can only be set prior to adding @source to an #ESourceRegistry.
@@ -1725,7 +1725,7 @@ e_source_has_extension (ESource *source,
* The returned #GDBusObject is referenced for thread-safety and must be
* unreferenced with g_object_unref() when finished with it.
*
- * Returns: the #GDBusObject for @source, or %NULL
+ * Returns: (transfer full): the #GDBusObject for @source, or %NULL
*
* Since: 3.6
**/
@@ -1750,7 +1750,7 @@ e_source_ref_dbus_object (ESource *source)
* The returned #GMainContext is referenced for thread-safety and must be
* unreferenced with g_main_context_unref() when finished with it.
*
- * Returns: the #GMainContext for signal emissions
+ * Returns: (transfer full): the #GMainContext for signal emissions
*
* Since: 3.6
**/
@@ -1877,7 +1877,8 @@ e_source_compare_by_display_name (ESource *source1,
/**
* e_source_to_string:
* @source: an #ESource
- * @length: return location for the length of the returned string, or %NULL
+ * @length: (allow-none): return location for the length of the returned
+ * string, or %NULL
*
* Outputs the current contents of @source as a key file string.
* Free the returned string with g_free().
@@ -1955,7 +1956,7 @@ e_source_parameter_to_key (const gchar *param_name)
/**
* e_source_remove_sync:
* @source: the #ESource to be removed
- * @cancellable: optional #GCancellable object, or %NULL
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
* Requests the D-Bus service to delete the key files for @source and all of
@@ -1984,9 +1985,10 @@ e_source_remove_sync (ESource *source,
/**
* e_source_remove:
* @source: the #ESource to be removed
- * @cancellable: optional #GCancellable object, or %NULL
- * @callback: a #GAsyncReadyCallback to call when the request is satisfied
- * @user_data: data to pass to the callback function
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
+ * @callback: (scope async): a #GAsyncReadyCallback to call when the request
+ * is satisfied
+ * @user_data: (closure): data to pass to the callback function
*
* Asynchronously requests the D-Bus service to delete the key files for
* @source all of its descendants and broadcast their removal to all clients.
@@ -2044,7 +2046,7 @@ e_source_remove_finish (ESource *source,
/**
* e_source_write_sync:
* @source: a writable #ESource
- * @cancellable: optional #GCancellable object, or %NULL
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
* Submits the current contents of @source to the D-Bus service to be
@@ -2073,9 +2075,10 @@ e_source_write_sync (ESource *source,
/**
* e_source_write:
* @source: a writable #ESource
- * @cancellable: optional #GCancellable object, or %NULL
- * @callback: a #GAsyncReadyCallback to call when the request is satisfied
- * @user_data: data to pass to the callback function
+ * @cancellable: (allow-none): optional #GCancellable object, or %NULL
+ * @callback: (scope async): a #GAsyncReadyCallback to call when the request
+ * is satisfied
+ * @user_data: (closure): data to pass to the callback function
*
* Asynchronously submits the current contents of @source to the D-Bus
* service to be written to disk and broadcast to other clients. This
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]