[evolution-data-server] e_extensible_load_extensions: Allow for retries.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] e_extensible_load_extensions: Allow for retries.
- Date: Sat, 16 Feb 2013 23:47:19 +0000 (UTC)
commit 525fba8cf6b93f9e86e34d3ff6d5dfa1cad4459e
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat Feb 16 17:42:42 2013 -0500
e_extensible_load_extensions: Allow for retries.
If e_extensible_load_extensions() does not find any extensions, remove
the GPtrArray from the extensible object. It may be the extension types
have not been registered yet. Subsequent e_extensible_load_extensions()
calls on the same object should rescan until extensions are found.
libebackend/e-extensible.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/libebackend/e-extensible.c b/libebackend/e-extensible.c
index f7f59dd..6a6c7e9 100644
--- a/libebackend/e-extensible.c
+++ b/libebackend/e-extensible.c
@@ -136,11 +136,22 @@ e_extensible_load_extensions (EExtensible *extensible)
g_object_set_qdata_full (
G_OBJECT (extensible), extensible_quark,
- extensions, (GDestroyNotify) g_ptr_array_unref);
+ g_ptr_array_ref (extensions),
+ (GDestroyNotify) g_ptr_array_unref);
e_type_traverse (
E_TYPE_EXTENSION, (ETypeFunc)
extensible_load_extension, extensible);
+
+ /* If the extension array is still empty, remove it from the
+ * extensible object. It may be that no extension types have
+ * been registered yet, so this allows for trying again later. */
+ if (extensions->len == 0)
+ g_object_set_qdata (
+ G_OBJECT (extensible),
+ extensible_quark, NULL);
+
+ g_ptr_array_unref (extensions);
}
/**
@@ -173,7 +184,10 @@ e_extensible_list_extensions (EExtensible *extensible,
e_extensible_load_extensions (extensible);
extensions = extensible_get_extensions (extensible);
- g_return_val_if_fail (extensions != NULL, NULL);
+
+ /* This will be NULL if no extensions are present. */
+ if (extensions == NULL)
+ return NULL;
for (ii = 0; ii < extensions->len; ii++) {
GObject *object;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]