[evolution-kolab/ek-wip-porting] addressbook: rewrite of util functions to GCancellable
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting] addressbook: rewrite of util functions to GCancellable
- Date: Sat, 10 Dec 2011 23:42:28 +0000 (UTC)
commit 9d202e1ac30ad5c96469fbfd7abd735d539ddbbf
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Sun Dec 11 00:37:32 2011 +0100
addressbook: rewrite of util functions to GCancellable
* added GCancellable* argument to util functions
where needed by KolabMailAccess
* added GError** arguments where functions can fail
(improved on the somewhat poor or non-exsitent
error handling/reporting, needs more attention)
* let functions which can fail indicate success or
failure with a gboolena return value (if no other
data is returned), in addition to a GError set
src/addressbook/kolab-util-contact-cache.c | 138 ++++++++++++++++++++-------
src/addressbook/kolab-util-contact-cache.h | 120 +++++++++++++++---------
src/addressbook/kolab-util-contact.c | 144 ++++++++++++++++++----------
src/addressbook/kolab-util-contact.h | 67 ++++++++++----
4 files changed, 323 insertions(+), 146 deletions(-)
---
diff --git a/src/addressbook/kolab-util-contact-cache.c b/src/addressbook/kolab-util-contact-cache.c
index 4e20849..94b090d 100644
--- a/src/addressbook/kolab-util-contact-cache.c
+++ b/src/addressbook/kolab-util-contact-cache.c
@@ -1,22 +1,30 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/***************************************************************************
+ * kolab-util-contact-cache.c
+ *
+ * 2011
+ * Copyright 2011 Silvan Marco Fin
+ * <silvan kernelconcepts de>
+ ****************************************************************************/
+
/*
- * evolution-kolab
- * Copyright (C) Silvan Marco Fin 2011 <silvan kernelconcepts de>
- *
- * evolution-kolab is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * evolution-kolab 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, see <http://www.gnu.org/licenses/>.
+ * This program is free software; you can redistribute it and/or
+ * 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
*/
+/*----------------------------------------------------------------------------*/
+
#include "kolab-util-contact-cache.h"
#include "kolab-util-contact.h"
@@ -24,26 +32,37 @@
#include <libecal/e-cal.h>
-EContact *
+/*----------------------------------------------------------------------------*/
+
+EContact*
kolab_util_contact_cache_get_object (EBookBackendCache *cache,
KolabMailAccess *koma,
const gchar *uri,
const gchar *uid,
gboolean bulk,
+ GCancellable *cancellable,
GError **error)
{
const KolabMailHandle *kmh = NULL;
EContact *econtact = NULL;
GError *tmp_error = NULL;
gchar *sourcename = NULL;
+ gboolean ok = FALSE;
g_assert (E_IS_BOOK_BACKEND_CACHE (cache));
g_assert (KOLAB_IS_MAIL_ACCESS (koma));
+ g_assert (uri != NULL);
+ g_assert (uid != NULL);
+ /* cancellable may be NULL */
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
sourcename = kolab_util_backend_get_relative_path_from_uri (uri);
- kmh = kolab_mail_access_get_handle (koma, uid, sourcename, &tmp_error);
+ kmh = kolab_mail_access_get_handle (koma,
+ uid,
+ sourcename,
+ cancellable,
+ &tmp_error);
g_free (sourcename);
if (kmh == NULL) {
/* empty object, could be "nothing found" */
@@ -53,7 +72,12 @@ kolab_util_contact_cache_get_object (EBookBackendCache *cache,
}
return NULL;
}
- if (! kolab_mail_access_retrieve_handle (koma, kmh, bulk, &tmp_error)) {
+ ok = kolab_mail_access_retrieve_handle (koma,
+ kmh,
+ bulk,
+ cancellable,
+ &tmp_error);
+ if (! ok) {
g_propagate_error (error, tmp_error);
return NULL;
}
@@ -62,23 +86,36 @@ kolab_util_contact_cache_get_object (EBookBackendCache *cache,
return econtact;
} /* kolab_util_contact_cache_get_object () */
-void
+gboolean
kolab_util_contact_cache_update_object (EBookBackendCache *cache,
KolabMailAccess *koma,
const gchar *uri,
const gchar *uid,
gboolean bulk,
+ GCancellable *cancellable,
GError **error)
{
EContact *tmp_contact = NULL;
g_assert (E_IS_BOOK_BACKEND_CACHE (cache));
g_assert (KOLAB_IS_MAIL_ACCESS (koma));
- g_return_if_fail (error == NULL || *error == NULL);
+ g_assert (uri != NULL);
+ g_assert (uid != NULL);
+ /* cancellable may be NULL */
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- tmp_contact = kolab_util_contact_cache_get_object (cache, koma, uri, uid, bulk, error);
+ tmp_contact = kolab_util_contact_cache_get_object (cache,
+ koma,
+ uri,
+ uid,
+ bulk,
+ cancellable,
+ error);
if (tmp_contact != NULL)
g_object_unref (tmp_contact);
+ if (error != NULL)
+ return FALSE;
+ return TRUE;
}
/**
@@ -97,9 +134,10 @@ kolab_util_contact_cache_update_object (EBookBackendCache *cache,
gboolean
kolab_util_contact_cache_assure_uid_on_econtact (EBookBackendCache *cache,
KolabMailAccess *koma,
- const gchar *uri,
EContact *econtact,
+ const gchar *uri,
gboolean bulk,
+ GCancellable *cancellable,
GError **error)
{
EContact *tmp_contact = NULL;
@@ -110,17 +148,26 @@ kolab_util_contact_cache_assure_uid_on_econtact (EBookBackendCache *cache,
g_assert (E_IS_BOOK_BACKEND_CACHE (cache));
g_assert (KOLAB_IS_MAIL_ACCESS (koma));
g_assert (E_IS_CONTACT (econtact));
+ g_assert (uri != NULL);
+ /* cancellable may be NULL */
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
ksettings = kolab_mail_access_get_settings_handler (koma);
if (ksettings == NULL) {
+ /* FIXME set a GError */
return FALSE;
}
uid = e_contact_get (econtact, E_CONTACT_UID);
if (uid == NULL)
uid = e_cal_component_gen_uid();
for (;;) {
- tmp_contact = kolab_util_contact_cache_get_object (cache, koma, uri, uid, bulk, &tmp_error);
+ tmp_contact = kolab_util_contact_cache_get_object (cache,
+ koma,
+ uri,
+ uid,
+ bulk,
+ cancellable,
+ &tmp_error);
if (tmp_error != NULL) {
g_propagate_error (error, tmp_error);
g_free (uid);
@@ -150,33 +197,44 @@ kolab_util_contact_cache_assure_uid_on_econtact (EBookBackendCache *cache,
* Retrieves the changed and not yet cached objects and puts them into the
* @cache.
*/
-void
+gboolean
kolab_util_contact_cache_update_on_query (EBookBackendCache *cache,
KolabMailAccess *koma,
const gchar *query,
- const gchar *uri)
+ const gchar *uri,
+ GCancellable *cancellable,
+ GError **error)
{
GList *changed_uids = NULL;
gchar *sourcename = NULL;
GError *tmp_error = NULL;
-g_debug ("%s()[%u] called.", __func__, __LINE__);
+
+ g_debug ("%s()[%u] called.", __func__, __LINE__);
sourcename = kolab_util_backend_get_relative_path_from_uri (uri);
g_assert (E_IS_BOOK_BACKEND_CACHE (cache));
g_assert (KOLAB_IS_MAIL_ACCESS (koma));
+ /* query may be NULL */
+ g_assert (uri != NULL);
+ /* cancellable may be NULL */
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* First task: Update the BackendCache in case of changes */
- changed_uids = kolab_mail_access_query_changed_uids (koma, sourcename, query, &tmp_error);
+ changed_uids = kolab_mail_access_query_changed_uids (koma,
+ sourcename,
+ query,
+ cancellable,
+ &tmp_error);
if (tmp_error != NULL) {
- g_warning ("%s()[%u]: %s", __func__, __LINE__, tmp_error->message);
- g_error_free (tmp_error);
- tmp_error = NULL;
+ g_propagate_error (error, tmp_error);
+ return FALSE;
}
if (changed_uids != NULL)
g_debug (" + changed_uids count: %u", g_list_length (changed_uids));
else
g_debug (" + changed_uids empty!");
kolab_util_glib_glist_free (changed_uids);
+ return TRUE;
}
GList*
@@ -184,6 +242,7 @@ kolab_util_contact_cache_get_contacts (EBookBackendCache *cache,
KolabMailAccess *koma,
const gchar *query,
const gchar *uri,
+ GCancellable *cancellable,
GError **error)
{
GList *contact_list = NULL;
@@ -194,11 +253,14 @@ kolab_util_contact_cache_get_contacts (EBookBackendCache *cache,
EContact *econtact = NULL;
gboolean ok = FALSE;
GError *tmp_error = NULL;
-g_debug ("%s()[%u] called.", __func__, __LINE__);
+ g_debug ("%s()[%u] called.", __func__, __LINE__);
sourcename = kolab_util_backend_get_relative_path_from_uri (uri);
g_assert (E_IS_BOOK_BACKEND_CACHE (cache));
g_assert (KOLAB_IS_MAIL_ACCESS (koma));
+ /* query may be NULL */
+ g_assert (uri != NULL);
+ /* cancellable may be NULL */
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
/* get list of Kolab UIDs */
@@ -210,14 +272,22 @@ g_debug ("%s()[%u] called.", __func__, __LINE__);
/* generate list */
for (it = g_list_first (uid_list); it != NULL; it = g_list_next (it)) {
- kmh = kolab_mail_access_get_handle (koma, (gchar *)it->data, sourcename, &tmp_error);
+ kmh = kolab_mail_access_get_handle (koma,
+ (gchar *)it->data,
+ sourcename,
+ cancellable,
+ &tmp_error);
if (kmh == NULL) {
g_warning ("%s()[%u]: %s", __func__, __LINE__, tmp_error->message);
g_error_free (tmp_error);
tmp_error = NULL;
continue;
}
- ok = kolab_mail_access_retrieve_handle (koma, kmh, TRUE, &tmp_error);
+ ok = kolab_mail_access_retrieve_handle (koma,
+ kmh,
+ TRUE,
+ cancellable,
+ &tmp_error);
if (! ok) {
g_warning ("%s()[%u]: %s", __func__, __LINE__, tmp_error->message);
g_error_free (tmp_error);
@@ -235,3 +305,5 @@ g_debug ("%s()[%u] called.", __func__, __LINE__);
g_list_free (uid_list);
return contact_list;
}
+
+/*----------------------------------------------------------------------------*/
diff --git a/src/addressbook/kolab-util-contact-cache.h b/src/addressbook/kolab-util-contact-cache.h
index 5629045..50bda91 100644
--- a/src/addressbook/kolab-util-contact-cache.h
+++ b/src/addressbook/kolab-util-contact-cache.h
@@ -1,56 +1,88 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/***************************************************************************
+ * kolab-util-contact-cache.h
+ *
+ * 2011
+ * Copyright 2011 Silvan Marco Fin
+ * <silvan kernelconcepts de>
+ ****************************************************************************/
+
/*
- * evolution-kolab
- * Copyright (C) Silvan Marco Fin 2011 <silvan kernelconcepts de>
- *
- * evolution-kolab is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * evolution-kolab 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, see <http://www.gnu.org/licenses/>.
+ * This program is free software; you can redistribute it and/or
+ * 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 _KOLAB_UTIL_CONTACT_CACHE_H_
#define _KOLAB_UTIL_CONTACT_CACHE_H_
-#include <libekolab/kolab-mail-access.h>
+/*----------------------------------------------------------------------------*/
#include <glib.h>
+#include <gio/gio.h>
+
+#include <libekolab/kolab-mail-access.h>
+
#include <libedata-book/e-book-backend-cache.h>
-gboolean kolab_util_contact_cache_assure_uid_on_econtact (EBookBackendCache *cache,
- KolabMailAccess *koma,
- const gchar *uri,
- EContact *econtact,
- gboolean bulk,
- GError **error);
-EContact *kolab_util_contact_cache_get_object (EBookBackendCache *cache,
- KolabMailAccess *koma,
- const gchar *uri,
- const gchar *uid,
- gboolean bulk,
- GError **error);
-void kolab_util_contact_cache_update_object (EBookBackendCache *cache,
- KolabMailAccess *koma,
- const gchar *uri,
- const gchar *uid,
- gboolean bulk,
- GError **error);
-void kolab_util_contact_cache_update_on_query (EBookBackendCache *cache,
- KolabMailAccess *koma,
- const gchar *query,
- const gchar *uri);
-
-GList* kolab_util_contact_cache_get_contacts (EBookBackendCache *cache,
- KolabMailAccess *koma,
- const gchar *query,
- const gchar *uri,
- GError **error);
+/*----------------------------------------------------------------------------*/
+
+gboolean
+kolab_util_contact_cache_assure_uid_on_econtact (EBookBackendCache *cache,
+ KolabMailAccess *koma,
+ EContact *econtact,
+ const gchar *uri,
+ gboolean bulk,
+ GCancellable *cancellable,
+ GError **error);
+
+EContact*
+kolab_util_contact_cache_get_object (EBookBackendCache *cache,
+ KolabMailAccess *koma,
+ const gchar *uri,
+ const gchar *uid,
+ gboolean bulk,
+ GCancellable *cancellable,
+ GError **error);
+gboolean
+kolab_util_contact_cache_update_object (EBookBackendCache *cache,
+ KolabMailAccess *koma,
+ const gchar *uri,
+ const gchar *uid,
+ gboolean bulk,
+ GCancellable *cancellable,
+ GError **error);
+
+gboolean
+kolab_util_contact_cache_update_on_query (EBookBackendCache *cache,
+ KolabMailAccess *koma,
+ const gchar *query,
+ const gchar *uri,
+ GCancellable *cancellable,
+ GError **error);
+
+GList*
+kolab_util_contact_cache_get_contacts (EBookBackendCache *cache,
+ KolabMailAccess *koma,
+ const gchar *query,
+ const gchar *uri,
+ GCancellable *cancellable,
+ GError **error);
+
+/*----------------------------------------------------------------------------*/
+
#endif /* _KOLAB_UTIL_CONTACT_CACHE_H_ */
+
+/*----------------------------------------------------------------------------*/
diff --git a/src/addressbook/kolab-util-contact.c b/src/addressbook/kolab-util-contact.c
index d1c4d3e..7aa935d 100644
--- a/src/addressbook/kolab-util-contact.c
+++ b/src/addressbook/kolab-util-contact.c
@@ -1,22 +1,30 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/***************************************************************************
+ * kolab-util-contact.c
+ *
+ * 2011
+ * Copyright 2011 Silvan Marco Fin
+ * <silvan kernelconcepts de>
+ ****************************************************************************/
+
/*
- * evolution-kolab
- * Copyright (C) Silvan Marco Fin 2011 <silvan kernelconcepts de>
- *
- * evolution-kolab is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * evolution-kolab 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, see <http://www.gnu.org/licenses/>.
+ * This program is free software; you can redistribute it and/or
+ * 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
*/
+/*----------------------------------------------------------------------------*/
+
#include <libekolab/kolab-mail-access.h>
#include <libebook/e-contact.h>
@@ -24,11 +32,15 @@
#include "kolab-util-contact.h"
+/*----------------------------------------------------------------------------*/
+
gboolean
kolab_util_contact_has_id (EContact *contact)
{
gchar *uid = NULL;
+ g_assert (E_IS_CONTACT (contact));
+
uid = (gchar *) e_contact_get (contact, E_CONTACT_UID);
if (uid == NULL)
@@ -44,6 +56,8 @@ kolab_util_contact_gen_uid_if_none (EContact **contact)
{
gchar *uid = NULL;
+ g_assert (E_IS_CONTACT (*contact));
+
if (! kolab_util_contact_has_id (*contact)) {
/* no uid yet */
uid = e_cal_component_gen_uid ();
@@ -55,38 +69,49 @@ kolab_util_contact_gen_uid_if_none (EContact **contact)
}
KolabMailAccessOpmodeID
-kolab_util_contact_deploy_mode_by_koma (KolabMailAccess *koma, KolabMailAccessOpmodeID koma_mode)
+kolab_util_contact_deploy_mode_by_koma (KolabMailAccess *koma,
+ KolabMailAccessOpmodeID koma_mode,
+ GCancellable *cancellable,
+ GError **error)
{
KolabMailAccessOpmodeID tmp_mode;
- GError *error = NULL;
+ GError *tmp_error = NULL;
gboolean ok;
-g_debug ("%s()[%u] called.", __func__, __LINE__);
+
+ g_debug ("%s()[%u] called.", __func__, __LINE__);
+
if (koma == NULL) {
- g_debug ("%s()[%u] error: KolabMailAccess object not existent.", __func__, __LINE__);
+ g_debug ("%s()[%u] error: KolabMailAccess object not existent.",
+ __func__, __LINE__);
+ /* FIXME set GError */
return KOLAB_MAIL_ACCESS_OPMODE_INVAL;
}
- tmp_mode = kolab_mail_access_get_opmode (koma, &error);
+ tmp_mode = kolab_mail_access_get_opmode (koma,
+ &tmp_error);
if (error != NULL) {
- g_warning ("%s()[%u] error getting mode: %s",__func__, __LINE__, error->message);
- g_error_free (error);
+ g_propagate_error (error, tmp_error);
return KOLAB_MAIL_ACCESS_OPMODE_INVAL;
}
if (tmp_mode < KOLAB_MAIL_ACCESS_OPMODE_OFFLINE) {
- g_debug ("%s()[%u] KolabMailAccess object not ready, deferring.", __func__, __LINE__);
+ g_debug ("%s()[%u] KolabMailAccess object not ready, deferring.",
+ __func__, __LINE__);
return tmp_mode;
}
- ok = kolab_mail_access_set_opmode (koma, koma_mode, &error);
- if (error != NULL) {
- g_warning ("%s()[%u] error setting mode: %s", __func__, __LINE__, error->message);
- g_error_free (error);
+ ok = kolab_mail_access_set_opmode (koma,
+ koma_mode,
+ cancellable,
+ &tmp_error);
+ if (! ok) {
+ g_propagate_error (error, tmp_error);
return KOLAB_MAIL_ACCESS_OPMODE_INVAL;
}
return koma_mode;
} /* kolab_util_contacts_deploy_by_koma_mode () */
+#if 0
gboolean
kolab_util_contact_deploy_mode_by_backend (KolabMailAccess *koma,
- GNOME_Evolution_Addressbook_BookMode backend_mode)
+ GNOME_Evolution_Addressbook_BookMode backend_mode)
{
KolabMailAccessOpmodeID koma_mode;
KolabMailAccessOpmodeID tmp_mode;
@@ -102,33 +127,45 @@ kolab_util_contact_deploy_mode_by_backend (KolabMailAccess *koma,
return tmp_mode == koma_mode;
}
+#endif
-void
-kolab_util_contact_store (EContact *econtact, KolabMailAccess *koma, const gchar *uri, GError **error)
+gboolean
+kolab_util_contact_store (EContact *econtact,
+ KolabMailAccess *koma,
+ const gchar *uri,
+ GCancellable *cancellable,
+ GError **error)
{
const gchar *sourcename = NULL;
KolabMailHandle *kmh = NULL;
GError *tmp_error = NULL;
- KolabSettingsHandler *ksettings = NULL;
-
- g_return_if_fail (error == NULL || *error == NULL);
+ gboolean ok = FALSE;
- ksettings = kolab_mail_access_get_settings_handler (koma);
- if (ksettings == NULL)
- /* FIXME: obviously, this lacks some conclusive error notification */
- return;
+ g_assert (E_IS_CONTACT (econtact));
+ g_assert (KOLAB_IS_MAIL_ACCESS (koma));
+ g_assert (uri != NULL);
+ /* cancellable may be NULL */
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
sourcename = kolab_util_backend_get_relative_path_from_uri (uri);
kolab_util_backend_modtime_set_on_econtact (econtact);
kmh = kolab_mail_handle_new_from_econtact (econtact);
- if (! kolab_mail_access_store_handle (koma, kmh, sourcename, &tmp_error))
+ ok = kolab_mail_access_store_handle (koma,
+ kmh,
+ sourcename,
+ cancellable,
+ &tmp_error);
+ if (! ok) {
g_propagate_error (error, tmp_error);
-
- g_object_unref (ksettings);
+ return FALSE;
+ }
+
+ return TRUE;
} /* kolab_util_contact_store () */
+#if 0
EBookBackendSyncStatus
kolab_util_contact_map_error (GError *error)
{
@@ -138,20 +175,23 @@ kolab_util_contact_map_error (GError *error)
return GNOME_Evolution_Addressbook_Success;
switch (error->code) {
- case KOLAB_BACKEND_ERROR_SYNC_NOTSTORED:
- status = GNOME_Evolution_Addressbook_Success;
- break;
- case KOLAB_BACKEND_ERROR_NOTFOUND:
- status = GNOME_Evolution_Addressbook_ContactNotFound;
- break;
- case KOLAB_BACKEND_ERROR_CONTEXT_MISUSE:
- case KOLAB_BACKEND_ERROR_INFODB_NOFOLDER:
- status = GNOME_Evolution_Addressbook_NoSuchBook;
- break;
- default:
- status = GNOME_Evolution_Addressbook_OtherError;
+ case KOLAB_BACKEND_ERROR_SYNC_NOTSTORED:
+ status = GNOME_Evolution_Addressbook_Success;
+ break;
+ case KOLAB_BACKEND_ERROR_NOTFOUND:
+ status = GNOME_Evolution_Addressbook_ContactNotFound;
+ break;
+ case KOLAB_BACKEND_ERROR_CONTEXT_MISUSE:
+ case KOLAB_BACKEND_ERROR_INFODB_NOFOLDER:
+ status = GNOME_Evolution_Addressbook_NoSuchBook;
+ break;
+ default:
+ status = GNOME_Evolution_Addressbook_OtherError;
}
g_debug ("%s()[%u] EBookBackendSyncStatus: %i", __func__, __LINE__, status);
return status;
}
+#endif
+
+/*----------------------------------------------------------------------------*/
diff --git a/src/addressbook/kolab-util-contact.h b/src/addressbook/kolab-util-contact.h
index 725779a..8cce1b6 100644
--- a/src/addressbook/kolab-util-contact.h
+++ b/src/addressbook/kolab-util-contact.h
@@ -1,38 +1,67 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
- * evolution-kolab
- * Copyright (C) Silvan Marco Fin 2011 <silvan kernelconcepts de>
+/***************************************************************************
+ * kolab-util-contact.h
*
- * evolution-kolab is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * 2011
+ * Copyright 2011 Silvan Marco Fin
+ * <silvan kernelconcepts de>
+ ****************************************************************************/
+
+/*
+ * This program is free software; you can redistribute it and/or
+ * 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.
*
- * evolution-kolab 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.
+ * 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, see <http://www.gnu.org/licenses/>.
+ * 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 _KOLAB_UTIL_CONTACT_H_
#define _KOLAB_UTIL_CONTACT_H_
+/*----------------------------------------------------------------------------*/
+
+#include <glib.h>
+#include <gio/gio.h>
#include <glib-object.h>
+
#include <libebook/e-contact.h>
#include <libedata-book/e-data-book-types.h>
#include <libedata-book/e-book-backend-sync.h>
#include <libekolab/kolab-mail-access.h>
+/*----------------------------------------------------------------------------*/
+
G_BEGIN_DECLS
-gboolean kolab_util_contact_has_id (EContact *contact);
-void kolab_util_contact_gen_uid_if_none (EContact **contact);
-KolabMailAccessOpmodeID kolab_util_contact_deploy_mode_by_koma (KolabMailAccess *koma, KolabMailAccessOpmodeID koma_mode);
-void kolab_util_contact_store (EContact *econtact, KolabMailAccess *koma, const gchar *uri, GError **error);
+gboolean
+kolab_util_contact_has_id (EContact *contact);
+
+void
+kolab_util_contact_gen_uid_if_none (EContact **contact);
+
+KolabMailAccessOpmodeID
+kolab_util_contact_deploy_mode_by_koma (KolabMailAccess *koma,
+ KolabMailAccessOpmodeID koma_mode,
+ GCancellable *cancellable,
+ GError **error);
+
+gboolean
+kolab_util_contact_store (EContact *econtact,
+ KolabMailAccess *koma,
+ const gchar *uri,
+ GCancellable *cancellable,
+ GError **error);
#if 0
gboolean kolab_util_contact_deploy_mode_by_backend (KolabMailAccess *koma, GNOME_Evolution_Addressbook_BookMode backend_mode);
@@ -41,4 +70,8 @@ EBookBackendSyncStatus kolab_util_contact_map_error (GError *error);
G_END_DECLS
+/*----------------------------------------------------------------------------*/
+
#endif /* _KOLAB_UTIL_CONTACT_H_ */
+
+/*----------------------------------------------------------------------------*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]