static void test_get_view_sync (ETestServerFixture *fixture, gconstpointer user_data) { EBookClient *book_client; EBookQuery *query; EBookClientView *view; gchar *sexp; GError *error = NULL; UIDOnlyClosure *closure = (UIDOnlyClosure *) user_data; uids_only = closure->uids_only; book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient); setup_book (book_client); query = e_book_query_any_field_contains (""); sexp = e_book_query_to_string (query); e_book_query_unref (query); if (!e_book_client_get_view_sync (book_client, sexp, &view, NULL, &error)) { g_error ("get book view sync: %s", error->message); g_free (sexp); g_object_unref (book_client); } g_free (sexp); setup_and_start_view (view, fixture->loop); g_main_loop_run (fixture->loop); }
static void test_photo_is_uri (ETestServerFixture *fixture, gconstpointer user_data) { EBookClient *book_client; EBookClientView *view; EBookQuery *query; GError *error = NULL; gchar *sexp; book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient); add_contact_inline (book_client); add_contact_uri (book_client); query = e_book_query_any_field_contains (""); sexp = e_book_query_to_string (query); e_book_query_unref (query); if (!e_book_client_get_view_sync (book_client, sexp, &view, NULL, &error)) g_error ("get book view sync: %s", error->message); g_free (sexp); setup_and_start_view (view); loop = fixture->loop; g_main_loop_run (loop); }
gint main (gint argc, gchar **argv) { EBookClient *book; EBookClientView *view; EBookQuery *query; GError *error = NULL; gchar *sexp; g_type_init (); setup_book (&book); query = e_book_query_any_field_contains (""); sexp = e_book_query_to_string (query); e_book_query_unref (query); if (!e_book_client_get_view_sync (book, sexp, &view, NULL, &error)) { report_error ("get book view sync", &error); g_free (sexp); g_object_unref (book); return 1; } g_free (sexp); setup_and_start_view (view); loop = g_main_loop_new (NULL, TRUE); g_main_loop_run (loop); if (!e_client_remove_sync (E_CLIENT (book), NULL, &error)) { report_error ("client remove sync", &error); g_object_unref (book); return 1; } g_object_unref (book); return 0; }
gint main (gint argc, gchar **argv) { EBookClient *book_client; EBookQuery *query; EBookClientView *view; gchar *sexp; GError *error = NULL; main_initialize (); /* * Sync version */ if (!setup_book (&book_client)) return 1; query = e_book_query_any_field_contains (""); sexp = e_book_query_to_string (query); e_book_query_unref (query); if (!e_book_client_get_view_sync (book_client, sexp, &view, NULL, &error)) { report_error ("get book view sync", &error); g_free (sexp); g_object_unref (book_client); return 1; } g_free (sexp); setup_and_start_view (view); start_main_loop (NULL, NULL); if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) { report_error ("client remove sync", &error); g_object_unref (book_client); return 1; } g_object_unref (book_client); /* * Async version uids only */ if (!setup_book (&book_client)) return 1; start_in_idle_with_main_loop (call_get_view, book_client); if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) { report_error ("client remove sync", &error); g_object_unref (book_client); return 1; } g_object_unref (book_client); return get_main_loop_stop_result (); }