[evolution-data-server/cursor-staging: 28/30] Cursor Example: Cursor move API changed to return number of contacts traversed.



commit 61d18724cdbab45d9eb70f2323b378dc2a703683
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Sun Oct 13 04:11:36 2013 +0200

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

 tests/cursor-example/cursor-example.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/tests/cursor-example/cursor-example.c b/tests/cursor-example/cursor-example.c
index efe01fa..35384ed 100644
--- a/tests/cursor-example/cursor-example.c
+++ b/tests/cursor-example/cursor-example.c
@@ -430,7 +430,7 @@ cursor_example_move_cursor (CursorExample     *example,
        CursorExamplePrivate *priv = example->priv;
        GError               *error = NULL;
        GSList               *results = NULL, **results_arg = NULL;
-       gboolean              success;
+       gint                  n_results;
 
        /* We don't ask EDS for results if we're not going to load the view */
        g_assert (load_page == TRUE || full_results == NULL);
@@ -439,14 +439,13 @@ cursor_example_move_cursor (CursorExample     *example,
        if (load_page)
                results_arg = &results;
 
-       success = e_book_client_cursor_move_by_sync (priv->cursor,
-                                                    origin,
-                                                    count,
-                                                    results_arg,
-                                                    NULL, &error);
-
-       if (!success) {
+       n_results = e_book_client_cursor_move_by_sync (priv->cursor,
+                                                      origin,
+                                                      count,
+                                                      results_arg,
+                                                      NULL, &error);
 
+       if (n_results < 0) {
                if (g_error_matches (error,
                                     E_CLIENT_ERROR,
                                     E_CLIENT_ERROR_OUT_OF_SYNC)) {
@@ -471,11 +470,11 @@ cursor_example_move_cursor (CursorExample     *example,
        }
 
        if (full_results)
-               *full_results = g_slist_length (results) == ABS (count);
+               *full_results = (n_results == ABS (count));
 
        g_slist_free_full (results, (GDestroyNotify)g_object_unref);
 
-       return success;
+       return n_results >= 0;
 }
 
 static void


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