[evolution-kolab/ek-wip-porting] CamelKolabIMAPXProvider: fixed parent provider init
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting] CamelKolabIMAPXProvider: fixed parent provider init
- Date: Tue, 17 Jan 2012 18:04:23 +0000 (UTC)
commit 099208eb6c27acfbb9647cbe5fae28544382d615
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Tue Jan 17 19:01:30 2012 +0100
CamelKolabIMAPXProvider: fixed parent provider init
* in our kolab2 camel_provider_init() function, initialize
the IMAPX provider indirectly via a call to camel_provider_get(),
which will not try to re-register IMAPX in case it has
already been registered
src/camel/camel-kolab-imapx-provider.c | 19 +++++++++++++++++--
src/camel/camel-kolab-imapx-provider.h | 6 +++---
2 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/src/camel/camel-kolab-imapx-provider.c b/src/camel/camel-kolab-imapx-provider.c
index 6fe9cf9..6f93fb1 100644
--- a/src/camel/camel-kolab-imapx-provider.c
+++ b/src/camel/camel-kolab-imapx-provider.c
@@ -142,7 +142,23 @@ extern void camel_imapx_module_init (void);
void
camel_kolab_imapx_provider_module_init (void)
{
- camel_imapx_module_init (); /* init parent module */
+ CamelProvider *imapx_provider = NULL;
+ GError *tmp_err = NULL;
+
+ /* Load and init the parent module, if that not already
+ * happened. The CamelProvider returned is owned by Camel,
+ * so we must not free() it
+ */
+ imapx_provider = camel_provider_get ("imapx",
+ &tmp_err);
+ if (tmp_err != NULL) {
+ /* cannot propagate errors from here... */
+ g_warning ("%s: %s",
+ __func__, tmp_err->message);
+ g_error_free (tmp_err);
+ }
+ /* last resort... */
+ g_assert (imapx_provider != NULL);
kolab_provider.object_types[CAMEL_PROVIDER_STORE] = camel_kolab_imapx_store_get_type ();
kolab_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = G_TYPE_INVALID;
@@ -160,7 +176,6 @@ camel_kolab_imapx_provider_module_init (void)
void
camel_provider_module_init (void)
{
- g_assert (kolab_provider.object_types[CAMEL_PROVIDER_STORE] != G_TYPE_INVALID);
camel_kolab_imapx_provider_module_init ();
camel_provider_register (&kolab_provider);
g_debug ("%s: %s provider registered",
diff --git a/src/camel/camel-kolab-imapx-provider.h b/src/camel/camel-kolab-imapx-provider.h
index 045e2ca..0ae5dd1 100644
--- a/src/camel/camel-kolab-imapx-provider.h
+++ b/src/camel/camel-kolab-imapx-provider.h
@@ -12,17 +12,17 @@
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
*/
-
+
/*----------------------------------------------------------------------------*/
#ifndef _CAMEL_KOLAB_IMAPX_PROVIDER_H_
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]