[evolution-data-server/october-code-drop-post-api-change: 2/39] EBookBackendSqliteDB: Cursor move API changed to return number of contacts traversed.



commit 3382fca60ab7307e64d546a657422f07a2f0b787
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Sun Oct 13 04:09:44 2013 +0200

    EBookBackendSqliteDB: Cursor move API changed to return number of contacts traversed.

 .../libedata-book/e-book-backend-sqlitedb.c        |   12 ++++++++----
 .../libedata-book/e-book-backend-sqlitedb.h        |    2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend-sqlitedb.c 
b/addressbook/libedata-book/e-book-backend-sqlitedb.c
index 8d45d94..5d6fec1 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -6087,11 +6087,12 @@ collect_results_for_cursor_cb (gpointer ref,
  * the result list will be stored to @results and should be freed with g_slist_free()
  * and all elements freed with e_book_backend_sqlitedb_search_data_free().
  *
- * Returns: %TRUE on success, otherwise %FALSE is returned and @error is set.
+ * Returns: The number of contacts which the cursor has moved by if successfull.
+ * Otherwise -1 is returned and @error is set.
  *
  * Since: 3.12
  */
-gboolean
+gint
 e_book_backend_sqlitedb_cursor_move_by (EBookBackendSqliteDB *ebsdb,
                                        EbSdbCursor          *cursor,
                                        EbSdbCursorOrigin     origin,
@@ -6099,7 +6100,7 @@ e_book_backend_sqlitedb_cursor_move_by (EBookBackendSqliteDB *ebsdb,
                                        GSList              **results,
                                        GError              **error)
 {
-       CursorCollectData data = { NULL, NULL, FALSE, 0 };
+       CursorCollectData data = { NULL, NULL, NULL, FALSE, 0 };
        GString *query;
        gboolean success;
 
@@ -6213,7 +6214,10 @@ e_book_backend_sqlitedb_cursor_move_by (EBookBackendSqliteDB *ebsdb,
                                   (GDestroyNotify)e_book_backend_sqlitedb_search_data_free);
        g_free (data.alloc_vcard);
 
-       return success;
+       if (success)
+               return data.n_results;
+
+       return -1;
 }
 
 /**
diff --git a/addressbook/libedata-book/e-book-backend-sqlitedb.h 
b/addressbook/libedata-book/e-book-backend-sqlitedb.h
index b2d03c5..2ec563c 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.h
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.h
@@ -334,7 +334,7 @@ EbSdbCursor    *e_book_backend_sqlitedb_cursor_new
 void            e_book_backend_sqlitedb_cursor_free
                                                 (EBookBackendSqliteDB *ebsdb,
                                                 EbSdbCursor          *cursor);
-gboolean        e_book_backend_sqlitedb_cursor_move_by
+gint            e_book_backend_sqlitedb_cursor_move_by
                                                 (EBookBackendSqliteDB *ebsdb,
                                                 EbSdbCursor          *cursor,
                                                 EbSdbCursorOrigin     origin,


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