[evolution-data-server/meego-eds] Revert "EBook: Add methods to fetch vCards"



commit 39dfa8e21ecf38d6d87ddc520dc3fdac67625713
Author: Christophe Dumez <christophe dumez intel com>
Date:   Tue Jun 21 21:22:56 2011 +0300

    Revert "EBook: Add methods to fetch vCards"
    
    This reverts commit 7dd30d503b6f615aa6f2dc9655efe5b486b127e7.
    
    These functions are no longer needed now that we have lazy vCard
    parsing.

 addressbook/libebook/e-book.c |  189 -----------------------------------------
 addressbook/libebook/e-book.h |   33 +-------
 2 files changed, 1 insertions(+), 221 deletions(-)
---
diff --git a/addressbook/libebook/e-book.c b/addressbook/libebook/e-book.c
index 70c9dab..b8c67dd 100644
--- a/addressbook/libebook/e-book.c
+++ b/addressbook/libebook/e-book.c
@@ -1268,34 +1268,6 @@ e_book_get_contact (EBook       *book,
 	return unwrap_gerror (err, error);
 }
 
-/**
- * e_book_get_vcard:
- * @book: an #EBook
- * @id: a unique string ID specifying the contact
- * @vcard: (out) (transfer: full): a raw vCard
- * @error: a #GError to set on failure
- *
- * Fills in @vcard with the contents of the raw vcard in @book
- * corresponding to @id.
- *
- * Returns: %TRUE if successful, %FALSE otherwise
- **/
-gboolean 
-e_book_get_vcard (EBook       *book,
-		  const gchar *id,
-		  gchar       *vcard,
-		  GError     **error)
-{
-	GError *err = NULL;
-
-	e_return_error_if_fail (E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
-	e_return_error_if_fail (book->priv->gdbus_book, E_BOOK_ERROR_REPOSITORY_OFFLINE);
-
-	e_gdbus_book_call_get_contact_sync (book->priv->gdbus_book, id, &vcard, NULL, &err);
-
-	return unwrap_gerror (err, error);
-}
-
 static void
 get_contact_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data)
 {
@@ -1330,32 +1302,6 @@ get_contact_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data)
 	g_slice_free (AsyncData, data);
 }
 
-static void
-get_vcard_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data)
-{
-	gchar *vcard = NULL;
-	GError *err = NULL, *error = NULL;
-	AsyncData *data = user_data;
-	EBookVCardAsyncCallback excb = data->excallback;
-
-	e_gdbus_book_call_get_contact_finish (E_GDBUS_BOOK (gdbus_book), &vcard, res, &error);
-
-	unwrap_gerror (error, &err);
-
-	/* Protect against garbage return values on error */
-	if (error)
-		vcard = NULL;
-
-	if (excb)
-		excb (data->book, err, err ? NULL : vcard, data->closure);
-
-	if (err)
-		g_error_free (err);
-
-	g_object_unref (data->book);
-	g_slice_free (AsyncData, data);
-}
-
 #ifndef E_BOOK_DISABLE_DEPRECATED
 /**
  * e_book_async_get_contact:
@@ -1429,39 +1375,6 @@ e_book_get_contact_async (EBook                     *book,
 }
 
 /**
- * e_book_get_vcard_async:
- * @book: an #EBook
- * @id: a unique string ID specifying the contact
- * @cb: function to call when operation finishes
- * @closure: data to pass to callback function
- *
- * Retrieves a vcard specified by @id from @book.
- *
- * Returns: %FALSE if successful, %TRUE otherwise
- **/
-gboolean  
-e_book_get_vcard_async (EBook                    *book,
-			const gchar              *id,
-			EBookVCardAsyncCallback   cb,
-			gpointer                  closure)
-{
-	AsyncData *data;
-
-	e_return_ex_async_error_val_if_fail (E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
-	e_return_ex_async_error_val_if_fail (book->priv->gdbus_book, E_BOOK_ERROR_REPOSITORY_OFFLINE);
-	e_return_ex_async_error_val_if_fail (id, E_BOOK_ERROR_INVALID_ARG);
-
-	data = g_slice_new0 (AsyncData);
-	data->book = g_object_ref (book);
-	data->excallback = cb;
-	data->closure = closure;
-
-	e_gdbus_book_call_get_contact (book->priv->gdbus_book, id, NULL, get_vcard_reply, data);
-
-	return TRUE;
-}
-
-/**
  * e_book_remove_contact:
  * @book: an #EBook
  * @id: a string
@@ -2185,45 +2098,6 @@ e_book_get_contact_uids (EBook       *book,
 	}
 }
 
-/**
- * e_book_get_vcards:
- * @book: an #EBook
- * @query: an #EBookQuery
- * @vcards: a pointer, will be set to the array of vcards
- * @error: a #GError to set on failure
- *
- * Query @book with @query, setting @vcards to a @NULL terminated array
- * of vcards which matched. On failed, @error will be set and %FALSE 
- * returned.
- *
- * Returns: %TRUE on success, %FALSE otherwise
- **/
-gboolean
-e_book_get_vcards (EBook       *book,
-		   EBookQuery  *query,
-		   gchar      **vcards,
-		   GError     **error)
-{
-	GError *err = NULL;
-	gchar *sexp;
-
-	e_return_error_if_fail (E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
-	e_return_error_if_fail (book->priv->gdbus_book, E_BOOK_ERROR_REPOSITORY_OFFLINE);
-
-	sexp = e_book_query_to_string (query);
-
-	e_gdbus_book_call_get_contact_list_sync (book->priv->gdbus_book, sexp, &vcards, NULL, &err);
-
-	g_free (sexp);
-
-	if (!err) {
-		return TRUE;
-	} else {
-		vcards = NULL;
-		return unwrap_gerror (err, error);
-	}
-}
-
 static void
 get_contacts_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data)
 {
@@ -2300,30 +2174,6 @@ get_contact_uids_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_da
 	g_slice_free (AsyncData, data);
 }
 
-static void
-get_vcards_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data)
-{
-	gchar **vcards = NULL;
-	GError *err = NULL, *error = NULL;
-	AsyncData *data = user_data;
-	EBookVCardsAsyncCallback excb = data->excallback;
-
-	e_gdbus_book_call_get_contact_list_finish (E_GDBUS_BOOK (gdbus_book), &vcards, res, &error);
-
-	unwrap_gerror (error, &err);
-
-	if (excb)
-		excb (data->book, err, vcards, data->closure);
-	else if (vcards)
-		g_strfreev (vcards);
-
-	if (err)
-		g_error_free (err);
-
-	g_object_unref (data->book);
-	g_slice_free (AsyncData, data);
-}
-
 #ifndef E_BOOK_DISABLE_DEPRECATED
 /**
  * e_book_async_get_contacts:
@@ -2444,45 +2294,6 @@ e_book_get_contact_uids_async (EBook                 *book,
 	return TRUE;
 }
 
-/**
- * e_book_get_vcards_async:
- * @book: an #EBook
- * @query: an #EBookQuery
- * @cb: a function to call when the operation finishes
- * @closure: data to pass to callback function
- *
- * Query @book with @query.
- *
- * Returns: %FALSE on success, %TRUE otherwise
- *
- **/
-gboolean
-e_book_get_vcards_async (EBook                    *book,
-			 EBookQuery               *query,
-			 EBookVCardsAsyncCallback  cb,
-			 gpointer                  closure)
-{
-	AsyncData *data;
-	gchar *sexp;
-
-	e_return_ex_async_error_val_if_fail (E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
-	e_return_ex_async_error_val_if_fail (book->priv->gdbus_book, E_BOOK_ERROR_REPOSITORY_OFFLINE);
-	e_return_ex_async_error_val_if_fail (query, E_BOOK_ERROR_INVALID_ARG);
-
-	sexp = e_book_query_to_string (query);
-
-	data = g_slice_new0 (AsyncData);
-	data->book = g_object_ref (book);
-	data->excallback = cb;
-	data->closure = closure;
-
-	e_gdbus_book_call_get_contact_list (book->priv->gdbus_book, sexp, NULL, get_vcards_reply, data);
-
-	g_free (sexp);
-
-	return TRUE;
-}
-
 static GList *
 parse_changes_array (GVariant *var_changes)
 {
diff --git a/addressbook/libebook/e-book.h b/addressbook/libebook/e-book.h
index f5b7d70..c33fb51 100644
--- a/addressbook/libebook/e-book.h
+++ b/addressbook/libebook/e-book.h
@@ -98,16 +98,6 @@ typedef void (*EBookBookViewAsyncCallback) (EBook *book, const GError *error, EB
  **/
 typedef void (*EBookEListAsyncCallback)   (EBook *book, const GError *error, EList *list, gpointer closure);
 
-/**
- * EBookVCardsASyncCallback:
- **/
-typedef void (*EBookVCardsAsyncCallback)   (EBook *book, const GError *error, gchar **vcards, gpointer closure);
-
-/**
- * EBookVCardASyncCallback:
- **/
-typedef void (*EBookVCardAsyncCallback)   (EBook *book, const GError *error, gchar *vcards, gpointer closure);
-
 struct _EBook {
 	GObject       parent;
 	/*< private >*/
@@ -235,15 +225,10 @@ gboolean e_book_authenticate_user_async (EBook                *book,
 
 /* Fetching contacts. */
 gboolean e_book_get_contact                (EBook       *book,
-					    const gchar *id,
+					    const gchar  *id,
 					    EContact   **contact,
 					    GError     **error);
 
-gboolean e_book_get_vcard                  (EBook       *book,
-					    const gchar *id,
-					    gchar       *vcard,
-					    GError     **error);
-
 #ifndef E_BOOK_DISABLE_DEPRECATED
 guint     e_book_async_get_contact         (EBook                 *book,
 					    const gchar            *id,
@@ -256,11 +241,6 @@ gboolean  e_book_get_contact_async      (EBook                    *book,
 					 EBookContactAsyncCallback cb,
 					 gpointer                  closure);
 
-gboolean  e_book_get_vcard_async        (EBook                    *book,
-					 const gchar              *id,
-					 EBookVCardAsyncCallback   cb,
-					 gpointer                  closure);
-
 /* Deleting contacts. */
 gboolean e_book_remove_contact             (EBook       *book,
 					    const gchar  *id,
@@ -371,11 +351,6 @@ gboolean e_book_get_contact_uids               (EBook       *book,
 					    GList      **uids,
 					    GError     **error);
 
-gboolean e_book_get_vcards                 (EBook       *book,
-					    EBookQuery  *query,
-					    gchar      **vcards,
-					    GError     **error);
-
 #ifndef E_BOOK_DISABLE_DEPRECATED
 guint     e_book_async_get_contacts        (EBook             *book,
 					    EBookQuery        *query,
@@ -393,12 +368,6 @@ gboolean  e_book_get_contact_uids_async     (EBook                 *book,
 					     EBookListAsyncCallback cb,
 					     gpointer               closure);
 
-
-gboolean  e_book_get_vcards_async       (EBook                   *book,
-					 EBookQuery              *query,
-					 EBookVCardsAsyncCallback cb,
-					 gpointer                 closure);
-
 /* Needed for syncing */
 gboolean e_book_get_changes                (EBook       *book,
 					    const gchar *changeid,



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