[evolution-data-server/openismus-work-master: 117/137] EDataBookCursorSqlite: Cursor move API changed to return number of contacts traversed.



commit 983dbf3246b8a87b819b4d7f759fec25f312ebbd
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Sun Oct 13 04:10:25 2013 +0200

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

 .../libedata-book/e-data-book-cursor-sqlite.c      |   30 +++++++++++++------
 1 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/addressbook/libedata-book/e-data-book-cursor-sqlite.c 
b/addressbook/libedata-book/e-data-book-cursor-sqlite.c
index 99bad53..c9b24ba 100644
--- a/addressbook/libedata-book/e-data-book-cursor-sqlite.c
+++ b/addressbook/libedata-book/e-data-book-cursor-sqlite.c
@@ -47,7 +47,7 @@ static void e_data_book_cursor_sqlite_set_property (GObject *object,
 static gboolean e_data_book_cursor_sqlite_set_sexp             (EDataBookCursor     *cursor,
                                                                const gchar         *sexp,
                                                                GError             **error);
-static gboolean e_data_book_cursor_sqlite_move_by              (EDataBookCursor     *cursor,
+static gint     e_data_book_cursor_sqlite_move_by              (EDataBookCursor     *cursor,
                                                                const gchar         *revision_guard,
                                                                EBookCursorOrigin    origin,
                                                                gint                 count,
@@ -270,7 +270,7 @@ convert_origin (EBookCursorOrigin    src_origin,
        return success;
 }
 
-static gboolean
+static gint
 e_data_book_cursor_sqlite_move_by (EDataBookCursor     *cursor,
                                   const gchar         *revision_guard,
                                   EBookCursorOrigin    origin,
@@ -284,6 +284,7 @@ e_data_book_cursor_sqlite_move_by (EDataBookCursor     *cursor,
        EbSdbCursorOrigin sqlitedb_origin = EBSDB_CURSOR_ORIGIN_CURRENT;
        gchar *revision = NULL;
        gboolean success = FALSE;
+       gint n_results = -1;
 
        cursor_sqlite = E_DATA_BOOK_CURSOR_SQLITE (cursor);
        priv = cursor_sqlite->priv;
@@ -316,13 +317,19 @@ e_data_book_cursor_sqlite_move_by (EDataBookCursor     *cursor,
                success = FALSE;
        }
 
-       if (success)
-               success = e_book_backend_sqlitedb_cursor_move_by (priv->ebsdb,
-                                                                 priv->cursor,
-                                                                 sqlitedb_origin,
-                                                                 count,
-                                                                 &local_results,
-                                                                 error);
+       if (success) {
+
+               /* Only pass 'local_results' if the caller passed 'results'
+                */
+               n_results = e_book_backend_sqlitedb_cursor_move_by (priv->ebsdb,
+                                                                   priv->cursor,
+                                                                   sqlitedb_origin,
+                                                                   count,
+                                                                   results ? &local_results : NULL,
+                                                                   error);
+               if (n_results < 0)
+                       success = FALSE;
+       }
 
        if (success) {
                success = e_book_backend_sqlitedb_unlock_updates (priv->ebsdb, TRUE, error);
@@ -355,7 +362,10 @@ e_data_book_cursor_sqlite_move_by (EDataBookCursor     *cursor,
 
        g_free (revision);
 
-       return success;
+       if (success)
+               return n_results;
+
+       return -1;
 }
 
 static gboolean


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