[evolution-data-server/openismus-work-3-8] EBookBackendSqliteDB: Cursor move API changed to return number of contacts traversed.



commit 64a5bd95c0bd5953e4382e45805202fde8f372e4
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 d901ea0..4b57a8a 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -6084,11 +6084,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,
@@ -6096,7 +6097,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;
 
@@ -6210,7 +6211,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]