gint main (gint argc, gchar **argv) { #if 0 /* ACCOUNT_MGMT */ gchar *uri = NULL; EBookClient *book_client; GError *error = NULL; gint ii; main_initialize (); book_client = new_temp_client (&uri); g_return_val_if_fail (book_client != NULL, 1); g_return_val_if_fail (uri != NULL, 1); g_object_unref (book_client); /* open and close the same book repeatedly */ for (ii = 0; ii < NUM_OPENS; ii++) { book_client = e_book_client_new_from_uri (uri, &error); if (!book_client) { report_error ("new from uri", &error); break; } if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) { report_error ("client open sync", &error); g_object_unref (book_client); break; } g_object_unref (book_client); } book_client = e_book_client_new_from_uri (uri, &error); if (!book_client) { g_clear_error (&error); } else if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) { report_error ("client open sync", &error); g_object_unref (book_client); g_free (uri); return 1; } else if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) { report_error ("client remove sync", &error); g_object_unref (book_client); g_free (uri); return 1; } g_free (uri); g_object_unref (book_client); return ii == NUM_OPENS ? 0 : 1; #endif /* ACCOUNT_MGMT */ return 0; }
gint main (gint argc, gchar **argv) { ECalClientSourceType source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS; gchar *uri = NULL; ECalClient *cal_client; GError *error = NULL; gint ii; main_initialize (); cal_client = new_temp_client (source_type, &uri); g_return_val_if_fail (cal_client != NULL, 1); g_return_val_if_fail (uri != NULL, 1); g_object_unref (cal_client); /* open and close the same cal repeatedly */ for (ii = 0; ii < NUM_OPENS; ii++) { cal_client = e_cal_client_new_from_uri (uri, source_type, &error); if (!cal_client) { report_error ("new from uri", &error); break; } if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) { report_error ("client open sync", &error); g_object_unref (cal_client); break; } g_object_unref (cal_client); } cal_client = e_cal_client_new_from_uri (uri, source_type, &error); if (!cal_client) { g_clear_error (&error); } else if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) { report_error ("client open sync", &error); g_object_unref (cal_client); g_free (uri); return 1; } else if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) { report_error ("client remove sync", &error); g_object_unref (cal_client); g_free (uri); return 1; } g_free (uri); g_object_unref (cal_client); return ii == NUM_OPENS ? 0 : 1; }
gint main (gint argc, gchar **argv) { #if 0 /* ACCOUNT_MGMT */ EBookClient *client = NULL; const gchar *test_vcard_str = "BEGIN:VCARD\r\n" "VERSION:3.0\r\n" "EMAIL;TYPE=OTHER:[email protected]\r\n" "FN:zyx mix\r\n" "N:zyx;mix;;;\r\n" "END:VCARD"; g_type_init (); /* Create EBook Client */ client = e_book_client_new_system (NULL); g_return_val_if_fail (client != NULL, 1); /* Open address book */ g_return_val_if_fail (e_client_open_sync (E_CLIENT (client), FALSE, NULL, NULL), 1); g_print ("Testing bulk addition then removal...\n"); g_return_val_if_fail (test_bulk_add_remove (client, test_vcard_str, BATCH_SIZE), 1); g_print ("Passed.\n"); g_print ("Testing bulk modification...\n"); g_return_val_if_fail (test_bulk_modify (client, test_vcard_str, BATCH_SIZE), 1); g_print ("Passed.\n"); g_object_unref (client); #endif /* ACCOUNT_MGMT */ return 0; }
gint main (gint argc, gchar **argv) { ECalClientSourceType source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS; GError *error = NULL; gint ii; main_initialize (); /* Serially create, open, (close), and remove many cals */ for (ii = 0; ii < NUM_CLIENTS; ii++) { ECalClient *cal_client = new_temp_client (source_type, NULL); g_return_val_if_fail (cal_client != NULL, 1); if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) { report_error ("client open sync", &error); return 1; } if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) { report_error ("client remove sync", &error); g_object_unref (cal_client); return 1; } g_object_unref (cal_client); } return 0; }
static gboolean setup_book (EBookClient **book_out) { GError *error = NULL; gint i; g_return_val_if_fail (book_out != NULL, FALSE); *book_out = new_temp_client (NULL); g_return_val_if_fail (*book_out != NULL, FALSE); if (!e_client_open_sync (E_CLIENT (*book_out), FALSE, NULL, &error)) { report_error ("client open sync", &error); g_object_unref (*book_out); return FALSE; } for (i = 0; i < N_TEST_CONTACTS; i++) { EContact *contact = e_contact_new (); gchar *name = g_strdup_printf ("Contact #%d", i + 1); e_contact_set (contact, E_CONTACT_FULL_NAME, name); e_contact_set (contact, E_CONTACT_NICKNAME, name); /* verify the contact was added "successfully" (not thorough) */ if (!add_contact_verify (*book_out, contact)) g_error ("Failed to add contact"); g_free (name); g_object_unref (contact); } return TRUE; }
gint main (gint argc, gchar **argv) { GError *error = NULL; gint ii; main_initialize (); /* Serially create, open, (close), and remove many books */ for (ii = 0; ii < NUM_CLIENTS; ii++) { EBookClient *book_client = new_temp_client (NULL); g_return_val_if_fail (book_client != NULL, 1); if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) { report_error ("client open sync", &error); return 1; } 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 0; }
static gboolean test_sync (void) { ECalClient *cal_client; GError *error = NULL; cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL); g_return_val_if_fail (cal_client != NULL, FALSE); if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) { report_error ("client open sync", &error); g_object_unref (cal_client); return FALSE; } if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) { report_error ("client remove sync", &error); g_object_unref (cal_client); return FALSE; } g_object_unref (cal_client); return TRUE; }
gint main (gint argc, gchar **argv) { ECalClient *cal_client; GError *error = NULL; icalcomponent *icalcomp; struct icaltimetype now; gchar *uid = NULL; main_initialize (); cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL); g_return_val_if_fail (cal_client != NULL, FALSE); if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) { report_error ("client open sync", &error); g_object_unref (cal_client); return 1; } now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ()); icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT); icalcomponent_set_summary (icalcomp, "Test event summary"); icalcomponent_set_dtstart (icalcomp, now); icalcomponent_set_dtend (icalcomp, icaltime_from_timet (icaltime_as_timet (now) + 60 * 60 * 60, 0)); if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, &error)) { report_error ("create object sync", &error); icalcomponent_free (icalcomp); g_object_unref (cal_client); return 1; } icalcomponent_free (icalcomp); g_free (uid); /* synchronously without main-loop */ if (!test_sync (cal_client)) { g_object_unref (cal_client); return 1; } start_in_thread_with_main_loop (test_sync_in_thread, cal_client); if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) { report_error ("client remove sync", &error); g_object_unref (cal_client); return 1; } g_object_unref (cal_client); if (get_main_loop_stop_result () == 0) g_print ("Test finished successfully.\n"); return get_main_loop_stop_result (); }
static void setup_book (EBookClient **book_out) { EBookClient *book; GError *error = NULL; book = new_temp_client (NULL); g_assert (book != NULL); if (!e_client_open_sync (E_CLIENT (book), FALSE, NULL, &error)) { g_error ("failed to open client: %s", error->message); } add_contact_inline (book); add_contact_uri (book); *book_out = book; }
gint main (gint argc, gchar **argv) { ECalClientSourceType source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS; ECalClient *cal_clients[NUM_CLIENTS]; GError *error = NULL; gint ii; main_initialize (); /* Create and open many cals; then remove each of them */ for (ii = 0; ii < NUM_CLIENTS; ii++) { cal_clients[ii] = new_temp_client (source_type, NULL); g_return_val_if_fail (cal_clients[ii] != NULL, 1); if (!e_client_open_sync (E_CLIENT (cal_clients[ii]), FALSE, NULL, &error)) { report_error ("client open sync", &error); while (ii >= 0) { g_object_unref (cal_clients[ii]); ii--; } return 1; } } for (ii = 0; ii < NUM_CLIENTS; ii++) { if (!e_client_remove_sync (E_CLIENT (cal_clients[ii]), NULL, &error)) { report_error ("client remove sync", &error); while (ii < NUM_CLIENTS) { g_object_unref (cal_clients[ii]); ii++; } return 1; } g_object_unref (cal_clients[ii]); } return 0; }
gint main (gint argc, gchar **argv) { ECalClient *cal_client; GError *error = NULL; main_initialize (); cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL); g_return_val_if_fail (cal_client != NULL, FALSE); if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) { report_error ("client open sync", &error); g_object_unref (cal_client); return 1; } /* synchronously without main-loop */ if (!test_sync (cal_client)) { g_object_unref (cal_client); return 1; } start_in_thread_with_main_loop (test_sync_in_thread, cal_client); if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) { report_error ("client remove sync", &error); g_object_unref (cal_client); return 1; } g_object_unref (cal_client); if (get_main_loop_stop_result () == 0) g_print ("Test finished successfully.\n"); return get_main_loop_stop_result (); }
gint main (gint argc, gchar **argv) { ECalClient *cal_client; GError *error = NULL; gint i; main_initialize (); /* * Setup */ cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL); g_return_val_if_fail (cal_client != NULL, 1); if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) { report_error ("client open sync", &error); g_object_unref (cal_client); return 1; } /* Test that modifications make the revisions increment */ for (i = 0; i < CYCLES; i++) get_revision_compare_cycle (cal_client); if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) { report_error ("client remove sync", &error); g_object_unref (cal_client); return 1; } g_object_unref (cal_client); return 0; }
static void app_load_events (App *app) { GList *clients; GList *l; GList *ll; gchar *since_iso8601; gchar *until_iso8601; /* out with the old */ g_hash_table_remove_all (app->appointments); /* nuke existing views */ for (ll = app->live_views; ll != NULL; ll = ll->next) { ECalClientView *view = E_CAL_CLIENT_VIEW (ll->data); g_signal_handlers_disconnect_by_func (view, on_objects_added, app); g_signal_handlers_disconnect_by_func (view, on_objects_modified, app); g_signal_handlers_disconnect_by_func (view, on_objects_removed, app); e_cal_client_view_stop (view, NULL); g_object_unref (view); } g_list_free (app->live_views); app->live_views = NULL; /* timezone could have changed */ app_update_timezone (app); since_iso8601 = isodate_from_time_t (app->since); until_iso8601 = isodate_from_time_t (app->until); print_debug ("Loading events since %s until %s", since_iso8601, until_iso8601); clients = calendar_sources_get_appointment_clients (app->sources); for (l = clients; l != NULL; l = l->next) { ECalClient *cal = E_CAL_CLIENT (l->data); GError *error; gchar *query; GSList *objects, *j; ECalClientView *view; e_cal_client_set_default_timezone (cal, app->zone); error = NULL; if (!e_client_open_sync (E_CLIENT (cal), TRUE, NULL, &error)) { ESource *source = e_client_get_source (E_CLIENT (cal)); g_warning ("Error opening calendar %s: %s\n", e_source_get_uid (source), error->message); g_error_free (error); continue; } query = g_strdup_printf ("occur-in-time-range? (make-time \"%s\") " "(make-time \"%s\")", since_iso8601, until_iso8601); error = NULL; objects = NULL; if (!e_cal_client_get_object_list_sync (cal, query, &objects, NULL, /* cancellable */ &error)) { ESource *source = e_client_get_source (E_CLIENT (cal)); g_warning ("Error querying calendar %s: %s\n", e_source_get_uid (source), error->message); g_error_free (error); g_free (query); continue; } for (j = objects; j != NULL; j = j->next) { icalcomponent *ical = j->data; CalendarAppointment *appointment; appointment = calendar_appointment_new (ical, cal, app->zone); if (appointment == NULL) continue; calendar_appointment_generate_occurrences (appointment, ical, cal, app->since, app->until, app->zone); g_hash_table_insert (app->appointments, g_strdup (appointment->uid), appointment); } e_cal_client_free_icalcomp_slist (objects); error = NULL; if (!e_cal_client_get_view_sync (cal, query, &view, NULL, /* cancellable */ &error)) { g_warning ("Error setting up live-query on calendar: %s\n", error->message); g_error_free (error); } else { g_signal_connect (view, "objects-added", G_CALLBACK (on_objects_added), app); g_signal_connect (view, "objects-modified", G_CALLBACK (on_objects_modified), app); g_signal_connect (view, "objects-removed", G_CALLBACK (on_objects_removed), app); e_cal_client_view_start (view, NULL); app->live_views = g_list_prepend (app->live_views, view); } g_free (query); } g_list_free (clients); g_free (since_iso8601); g_free (until_iso8601); app->cache_invalid = FALSE; }
static void do_save_calendar_csv (FormatHandler *handler, ESourceSelector *selector, ECalClientSourceType type, gchar *dest_uri) { /* * According to some documentation about CSV, newlines 'are' allowed * in CSV-files. But you 'do' have to put the value between quotes. * The helper 'string_needsquotes' will check for that * * http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm * http://www.creativyst.com/cgi-bin/Prod/15/eg/csv2xml.pl */ ESource *primary_source; ECalClient *source_client; GError *error = NULL; GSList *objects = NULL; GOutputStream *stream; GString *line = NULL; CsvConfig *config = NULL; CsvPluginData *d = handler->data; const gchar *tmp = NULL; if (!dest_uri) return; primary_source = e_source_selector_get_primary_selection (selector); /* open source client */ source_client = e_cal_client_new (primary_source, type, &error); if (source_client) g_signal_connect ( source_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); if (!source_client || !e_client_open_sync (E_CLIENT (source_client), TRUE, NULL, &error)) { display_error_message ( gtk_widget_get_toplevel (GTK_WIDGET (selector)), error); if (source_client) g_object_unref (source_client); g_error_free (error); return; } config = g_new (CsvConfig, 1); tmp = gtk_entry_get_text (GTK_ENTRY (d->delimiter_entry)); config->delimiter = userstring_to_systemstring (tmp?tmp:", "); tmp = gtk_entry_get_text (GTK_ENTRY (d->newline_entry)); config->newline = userstring_to_systemstring (tmp?tmp:"\\n"); tmp = gtk_entry_get_text (GTK_ENTRY (d->quote_entry)); config->quote = userstring_to_systemstring (tmp?tmp:"\""); config->header = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON (d->header_check)); stream = open_for_writing ( GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (selector))), dest_uri, &error); if (stream && e_cal_client_get_object_list_as_comps_sync (source_client, "#t", &objects, NULL, NULL)) { GSList *iter; if (config->header) { gint i = 0; static const gchar *labels[] = { N_("UID"), N_("Summary"), N_("Description List"), N_("Categories List"), N_("Comment List"), N_("Completed"), N_("Created"), N_("Contact List"), N_("Start"), N_("End"), N_("Due"), N_("percent Done"), N_("Priority"), N_("URL"), N_("Attendees List"), N_("Location"), N_("Modified"), }; line = g_string_new (""); for (i = 0; i < G_N_ELEMENTS (labels); i++) { if (i > 0) g_string_append (line, config->delimiter); g_string_append (line, _(labels[i])); } g_string_append (line, config->newline); g_output_stream_write_all ( stream, line->str, line->len, NULL, NULL, NULL); g_string_free (line, TRUE); } for (iter = objects; iter; iter = iter->next) { ECalComponent *comp = objects->data; gchar *delimiter_temp = NULL; const gchar *temp_constchar; GSList *temp_list; ECalComponentDateTime temp_dt; struct icaltimetype *temp_time; gint *temp_int; ECalComponentText temp_comptext; line = g_string_new (""); /* Getting the stuff */ e_cal_component_get_uid (comp, &temp_constchar); line = add_string_to_csv (line, temp_constchar, config); e_cal_component_get_summary (comp, &temp_comptext); line = add_string_to_csv ( line, temp_comptext.value, config); e_cal_component_get_description_list (comp, &temp_list); line = add_list_to_csv ( line, temp_list, config, ECALCOMPONENTTEXT); if (temp_list) e_cal_component_free_text_list (temp_list); e_cal_component_get_categories_list (comp, &temp_list); line = add_list_to_csv ( line, temp_list, config, CONSTCHAR); if (temp_list) e_cal_component_free_categories_list (temp_list); e_cal_component_get_comment_list (comp, &temp_list); line = add_list_to_csv ( line, temp_list, config, ECALCOMPONENTTEXT); if (temp_list) e_cal_component_free_text_list (temp_list); e_cal_component_get_completed (comp, &temp_time); line = add_time_to_csv (line, temp_time, config); if (temp_time) e_cal_component_free_icaltimetype (temp_time); e_cal_component_get_created (comp, &temp_time); line = add_time_to_csv (line, temp_time, config); if (temp_time) e_cal_component_free_icaltimetype (temp_time); e_cal_component_get_contact_list (comp, &temp_list); line = add_list_to_csv ( line, temp_list, config, ECALCOMPONENTTEXT); if (temp_list) e_cal_component_free_text_list (temp_list); e_cal_component_get_dtstart (comp, &temp_dt); line = add_time_to_csv ( line, temp_dt.value ? temp_dt.value : NULL, config); e_cal_component_free_datetime (&temp_dt); e_cal_component_get_dtend (comp, &temp_dt); line = add_time_to_csv ( line, temp_dt.value ? temp_dt.value : NULL, config); e_cal_component_free_datetime (&temp_dt); e_cal_component_get_due (comp, &temp_dt); line = add_time_to_csv ( line, temp_dt.value ? temp_dt.value : NULL, config); e_cal_component_free_datetime (&temp_dt); e_cal_component_get_percent (comp, &temp_int); line = add_nummeric_to_csv (line, temp_int, config); e_cal_component_get_priority (comp, &temp_int); line = add_nummeric_to_csv (line, temp_int, config); e_cal_component_get_url (comp, &temp_constchar); line = add_string_to_csv (line, temp_constchar, config); if (e_cal_component_has_attendees (comp)) { e_cal_component_get_attendee_list (comp, &temp_list); line = add_list_to_csv ( line, temp_list, config, ECALCOMPONENTATTENDEE); if (temp_list) e_cal_component_free_attendee_list (temp_list); } else { line = add_list_to_csv ( line, NULL, config, ECALCOMPONENTATTENDEE); } e_cal_component_get_location (comp, &temp_constchar); line = add_string_to_csv (line, temp_constchar, config); e_cal_component_get_last_modified (comp, &temp_time); /* Append a newline (record delimiter) */ delimiter_temp = config->delimiter; config->delimiter = config->newline; line = add_time_to_csv (line, temp_time, config); /* And restore for the next record */ config->delimiter = delimiter_temp; /* Important note! * The documentation is not requiring this! * * if (temp_time) * e_cal_component_free_icaltimetype (temp_time); * * Please uncomment and fix documentation if untrue * http://www.gnome.org/projects/evolution/ * developer-doc/libecal/ECalComponent.html * #e-cal-component-get-last-modified */ g_output_stream_write_all ( stream, line->str, line->len, NULL, NULL, &error); /* It's written, so we can free it */ g_string_free (line, TRUE); } g_output_stream_close (stream, NULL, NULL); e_cal_client_free_ecalcomp_slist (objects); } if (stream) g_object_unref (stream); g_object_unref (source_client); g_free (config->delimiter); g_free (config->quote); g_free (config->newline); g_free (config); if (error) { display_error_message ( gtk_widget_get_toplevel (GTK_WIDGET (selector)), error); g_error_free (error); } return; }
gint main (gint argc, gchar **argv) { EBookClient *book_client; GError *error = NULL; EContact *contact; gchar *vcard; main_initialize (); /* * Setup */ book_client = new_temp_client (NULL); g_return_val_if_fail (book_client != NULL, 1); if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) { report_error ("client open sync", &error); g_object_unref (book_client); return 1; } /* * Sync version */ if (!add_contact_from_test_case_verify (book_client, "simple-1", &contact)) { g_object_unref (book_client); return 1; } g_object_unref (contact); 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 */ book_client = new_temp_client (NULL); g_return_val_if_fail (book_client != NULL, 1); if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) { report_error ("client open sync", &error); g_object_unref (book_client); return 1; } vcard = new_vcard_from_test_case ("simple-1"); contact = e_contact_new_from_vcard (vcard); g_free (vcard); e_book_client_add_contact (book_client, contact, NULL, add_contact_cb, NULL); g_object_unref (contact); 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); return get_main_loop_stop_result (); }
gint main (gint argc, gchar **argv) { EBookClient *book_client; GError *error = NULL; EContact *contact; gchar *uid; main_initialize (); /* * Setup */ book_client = new_temp_client (NULL); g_return_val_if_fail (book_client != NULL, 1); if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) { report_error ("client open sync", &error); g_object_unref (book_client); return 1; } /* * Sync version */ if (!add_contact_from_test_case_verify (book_client, "simple-1", &contact)) { g_object_unref (book_client); return 1; } uid = e_contact_get (contact, E_CONTACT_UID); g_object_unref (contact); if (!e_book_client_remove_contact_by_uid_sync (book_client, uid, NULL, &error)) { report_error ("remove contact sync", &error); g_object_unref (book_client); g_free (uid); return 1; } if (!e_book_client_get_contact_sync (book_client, uid, &contact, NULL, &error) && g_error_matches (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND)) { g_clear_error (&error); } else { report_error ("fail with get contact sync on removed contact", &error); g_object_unref (book_client); g_free (uid); return 1; } g_free (uid); 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 */ book_client = new_temp_client (NULL); g_return_val_if_fail (book_client != NULL, 1); if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) { report_error ("client open sync", &error); g_object_unref (book_client); return 1; } contact = NULL; if (!add_contact_from_test_case_verify (book_client, "simple-1", &contact)) { g_object_unref (book_client); return 1; } uid = e_contact_get (contact, E_CONTACT_UID); g_object_unref (contact); e_book_client_remove_contact_by_uid (book_client, uid, NULL, remove_contact_by_uid_cb, uid); start_main_loop (NULL, NULL); g_free (uid); 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 0; }