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 void get_revision_compare_cycle (EBookClient *client) { gchar *revision_before = NULL, *revision_after = NULL; EContact *contact = NULL; GError *error = NULL; if (!e_client_get_backend_property_sync (E_CLIENT (client), CLIENT_BACKEND_PROPERTY_REVISION, &revision_before, NULL, &error)) g_error ("Error getting book revision: %s", error->message); if (!add_contact_from_test_case_verify (client, "simple-1", &contact)) { g_object_unref (client); exit (1); } if (!e_book_client_remove_contact_sync (client, contact, NULL, &error)) g_error ("Unable to remove contact: %s", error->message); g_object_unref (contact); if (!e_client_get_backend_property_sync (E_CLIENT (client), CLIENT_BACKEND_PROPERTY_REVISION, &revision_after, NULL, &error)) g_error ("Error getting book revision: %s", error->message); g_assert (revision_before); g_assert (revision_after); g_assert (strcmp (revision_before, revision_after) != 0); g_message ( "Passed cycle, revision before '%s' revision after '%s'", revision_before, revision_after); g_free (revision_before); g_free (revision_after); }
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 (); }
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; }
/* fill_widgets handler for the alarm page */ static void alarm_to_dialog (Dialog *dialog) { GtkTreeModel *model; GtkTreeIter iter; gboolean valid; gboolean repeat; ECalComponentAlarmAction action; gchar *email; gint i; /* Clean the page */ clear_widgets (dialog); /* Alarm types */ model = gtk_combo_box_get_model (GTK_COMBO_BOX (dialog->action_combo)); valid = gtk_tree_model_get_iter_first (model, &iter); for (i = 0; valid && action_map[i] != -1; i++) { gtk_list_store_set ( GTK_LIST_STORE (model), &iter, 1, !e_client_check_capability (E_CLIENT (dialog->cal_client), action_map_cap[i]), -1); valid = gtk_tree_model_iter_next (model, &iter); } /* Set a default address if possible */ if (!e_client_check_capability (E_CLIENT (dialog->cal_client), CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS) && !e_cal_component_alarm_has_attendees (dialog->alarm) && e_client_get_backend_property_sync (E_CLIENT (dialog->cal_client), CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS, &email, NULL, NULL)) { ECalComponentAttendee *a; GSList attendee_list; a = g_new0 (ECalComponentAttendee, 1); a->value = email; a->cutype = ICAL_CUTYPE_INDIVIDUAL; a->status = ICAL_PARTSTAT_NEEDSACTION; a->role = ICAL_ROLE_REQPARTICIPANT; attendee_list.data = a; attendee_list.next = NULL; e_cal_component_alarm_set_attendee_list (dialog->alarm, &attendee_list); g_free (email); g_free (a); } /* If we can repeat */ repeat = !e_client_check_capability (E_CLIENT (dialog->cal_client), CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT); gtk_widget_set_sensitive (dialog->repeat_toggle, repeat); /* if we are editing a exiting alarm */ e_cal_component_alarm_get_action (dialog->alarm, &action); if (action) populate_widgets_from_alarm (dialog); }
static gboolean test_sync (ECalClient *cal_client) { GError *error = NULL; g_print ("Refresh supported: %s\n", e_client_check_refresh_supported (E_CLIENT (cal_client)) ? "yes" : "no"); if (!e_client_refresh_sync (E_CLIENT (cal_client), NULL, &error)) { report_error ("refresh sync", &error); return FALSE; } return TRUE; }
static gboolean is_meeting_owner (ECalComponent *comp, ECalClient *client) { ECalComponentOrganizer org; gchar *email = NULL; const gchar *strip = NULL; gboolean ret_val = FALSE; if (!(e_cal_component_has_attendees (comp) && e_cal_client_check_save_schedules (client))) return ret_val; e_cal_component_get_organizer (comp, &org); strip = itip_strip_mailto (org.value); if (e_client_get_backend_property_sync (E_CLIENT (client), CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &email, NULL, NULL) && !g_ascii_strcasecmp (email, strip)) { ret_val = TRUE; } if (!ret_val) ret_val = itip_address_is_user (strip); g_free (email); return ret_val; }
static void action_address_book_delete_cb (GtkAction *action, EBookShellView *book_shell_view) { EShellView *shell_view; EShellWindow *shell_window; EBookShellBackend *book_shell_backend; EBookShellSidebar *book_shell_sidebar; ESource *source; ESourceSelector *selector; ESourceGroup *source_group; ESourceList *source_list; EBookClient *book; gint response; GError *error = NULL; shell_view = E_SHELL_VIEW (book_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); book_shell_backend = book_shell_view->priv->book_shell_backend; source_list = e_book_shell_backend_get_source_list (book_shell_backend); book_shell_sidebar = book_shell_view->priv->book_shell_sidebar; selector = e_book_shell_sidebar_get_selector (book_shell_sidebar); source = e_source_selector_get_primary_selection (selector); g_return_if_fail (source != NULL); response = e_alert_run_dialog_for_args ( GTK_WINDOW (shell_window), "addressbook:ask-delete-addressbook", e_source_peek_name (source), NULL); if (response != GTK_RESPONSE_YES) return; book = e_book_client_new (source, &error); if (error != NULL) { g_warning ("Error removing addressbook: %s", error->message); g_error_free (error); return; } if (!e_client_remove_sync (E_CLIENT (book), NULL, NULL)) { e_alert_run_dialog_for_args ( GTK_WINDOW (shell_window), "addressbook:remove-addressbook", NULL); g_object_unref (book); return; } if (e_source_selector_source_is_selected (selector, source)) e_source_selector_unselect_source (selector, source); source_group = e_source_peek_group (source); e_source_group_remove_source (source_group, source); e_source_list_sync (source_list, NULL); g_object_unref (book); }
static void action_calendar_taskpad_new_cb (GtkAction *action, ECalShellView *cal_shell_view) { EShellView *shell_view; EShellWindow *shell_window; ECalShellContent *cal_shell_content; ECalModelComponent *comp_data; ETaskTable *task_table; GSList *list; shell_view = E_SHELL_VIEW (cal_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); cal_shell_content = cal_shell_view->priv->cal_shell_content; task_table = e_cal_shell_content_get_task_table (cal_shell_content); list = e_task_table_get_selected (task_table); g_return_if_fail (list != NULL); comp_data = list->data; g_slist_free (list); e_cal_ops_new_component_editor (shell_window, E_CAL_CLIENT_SOURCE_TYPE_TASKS, e_source_get_uid (e_client_get_source (E_CLIENT (comp_data->client))), FALSE); }
static void calendar_appointment_init (CalendarAppointment *appointment, icalcomponent *ical, ECalClient *cal, icaltimezone *default_zone) { const char *source_uid; appointment->uid = get_ical_uid (ical); appointment->rid = get_ical_rid (ical); appointment->backend_name = get_source_backend_name (cal); appointment->summary = get_ical_summary (ical); appointment->description = get_ical_description (ical); appointment->color_string = get_source_color (cal); appointment->start_time = get_ical_start_time (ical, default_zone); appointment->end_time = get_ical_end_time (ical, default_zone); appointment->is_all_day = get_ical_is_all_day (ical, appointment->start_time, default_zone); /* While the UID is usually enough to identify an event, only the triple * of (source,UID,RID) is fully unambiguous; neither may contain '\n', * so we can safely use it to create a unique ID from the triple */ source_uid = e_source_get_uid (e_client_get_source (E_CLIENT (cal))); appointment->id = g_strdup_printf ("%s\n%s\n%s", source_uid, appointment->uid, appointment->rid ? appointment->rid : ""); }
static gboolean addressbook_model_idle_cb (EAddressbookModel *model) { model->priv->client_view_idle_id = 0; if (model->priv->book_client && model->priv->query_str) { remove_book_view (model); if (model->priv->first_get_view) { model->priv->first_get_view = FALSE; if (e_client_check_capability (E_CLIENT (model->priv->book_client), "do-initial-query")) { e_book_client_get_view ( model->priv->book_client, model->priv->query_str, NULL, client_view_ready_cb, model); } else { free_data (model); g_signal_emit ( model, signals[MODEL_CHANGED], 0); g_signal_emit ( model, signals[STOP_STATE_CHANGED], 0); } } else e_book_client_get_view ( model->priv->book_client, model->priv->query_str, NULL, client_view_ready_cb, model); } g_object_unref (model); return FALSE; }
gchar * eab_book_and_contact_list_to_string (EBookClient *book_client, const GSList *contacts) { gchar *s0, *s1; s0 = eab_contact_list_to_string (contacts); if (!s0) s0 = g_strdup (""); if (book_client != NULL) { EClient *client; ESource *source; const gchar *uid; client = E_CLIENT (book_client); source = e_client_get_source (client); uid = e_source_get_uid (source); s1 = g_strconcat ("Book: ", uid, "\r\n", s0, NULL); } else s1 = g_strdup (s0); g_free (s0); return s1; }
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; }
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; }
static gchar * get_source_backend_name (ECalClient *esource) { ESource *source; ECalClientSourceType source_type; ESourceBackend *extension; const gchar *extension_name; g_return_val_if_fail (E_IS_CAL_CLIENT (esource), NULL); source = e_client_get_source (E_CLIENT (esource)); source_type = e_cal_client_get_source_type (esource); switch (source_type) { case E_CAL_CLIENT_SOURCE_TYPE_EVENTS: extension_name = E_SOURCE_EXTENSION_CALENDAR; break; case E_CAL_CLIENT_SOURCE_TYPE_TASKS: extension_name = E_SOURCE_EXTENSION_TASK_LIST; break; default: g_return_val_if_reached (NULL); } extension = e_source_get_extension (source, extension_name); return e_source_backend_dup_backend_name (extension); }
static void gcal_week_view_component_removed (ECalDataModelSubscriber *subscriber, ECalClient *client, const gchar *uid, const gchar *rid) { GcalWeekView *self = GCAL_WEEK_VIEW (subscriber); ESource *source; gchar *uuid; GCAL_ENTRY; source = e_client_get_source (E_CLIENT (client)); if (rid != NULL) uuid = g_strdup_printf ("%s:%s:%s", e_source_get_uid (source), uid, rid); else uuid = g_strdup_printf ("%s:%s", e_source_get_uid (source), uid); gcal_week_header_remove_event (GCAL_WEEK_HEADER (self->header), uuid); gcal_week_grid_remove_event (GCAL_WEEK_GRID (self->week_grid), uuid); g_free (uuid); GCAL_EXIT; }
static void test_refresh_async (ETestServerFixture *fixture, gconstpointer user_data) { ECalClient *cal; gboolean supported; cal = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient); supported = e_client_check_refresh_supported (E_CLIENT (cal)); if (!supported) return; setup_cal (cal); e_client_refresh (E_CLIENT (cal), NULL, async_refresh_result_ready, fixture->loop); g_main_loop_run (fixture->loop); }
void e_cal_shell_view_memopad_actions_update (ECalShellView *cal_shell_view) { ECalShellContent *cal_shell_content; EShellWindow *shell_window; EShellView *shell_view; EMemoTable *memo_table; GtkAction *action; GSList *list, *iter; gboolean editable = TRUE; gboolean has_url = FALSE; gboolean sensitive; gint n_selected; shell_view = E_SHELL_VIEW (cal_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); cal_shell_content = cal_shell_view->priv->cal_shell_content; memo_table = e_cal_shell_content_get_memo_table (cal_shell_content); n_selected = e_table_selected_count (E_TABLE (memo_table)); list = e_memo_table_get_selected (memo_table); for (iter = list; iter != NULL; iter = iter->next) { ECalModelComponent *comp_data = iter->data; icalproperty *prop; gboolean read_only; read_only = e_client_is_readonly (E_CLIENT (comp_data->client)); editable &= !read_only; prop = icalcomponent_get_first_property ( comp_data->icalcomp, ICAL_URL_PROPERTY); has_url |= (prop != NULL); } g_slist_free (list); action = ACTION (CALENDAR_MEMOPAD_FORWARD); sensitive = (n_selected == 1); gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_MEMOPAD_OPEN); sensitive = (n_selected == 1); gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_MEMOPAD_OPEN_URL); sensitive = (n_selected == 1) && has_url; gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_MEMOPAD_PRINT); sensitive = (n_selected == 1); gtk_action_set_sensitive (action, sensitive); action = ACTION (CALENDAR_MEMOPAD_SAVE_AS); sensitive = (n_selected == 1); gtk_action_set_sensitive (action, sensitive); }
/* synchronously in idle with main-loop running */ static gboolean test_sync_in_idle (gpointer user_data) { ECalClient *cal_client = user_data; g_return_val_if_fail (cal_client != NULL, FALSE); g_return_val_if_fail (E_IS_CAL_CLIENT (cal_client), FALSE); if (!test_sync (cal_client)) { stop_main_loop (1); return FALSE; } g_print ("Refresh supported: %s\n", e_client_check_refresh_supported (E_CLIENT (cal_client)) ? "yes" : "no"); e_client_refresh (E_CLIENT (cal_client), NULL, async_refresh_result_ready, NULL); return FALSE; }
/* asynchronous open callback with a main-loop running */ static void async_open_ready (GObject *source_object, GAsyncResult *result, gpointer user_data) { ECalClient *cal_client; GError *error = NULL; cal_client = E_CAL_CLIENT (source_object); if (!e_client_open_finish (E_CLIENT (cal_client), result, &error)) { report_error ("open finish", &error); g_object_unref (cal_client); stop_main_loop (1); return; } e_client_remove (E_CLIENT (cal_client), NULL, async_remove_ready, NULL); }
static ECompEditor * get_component_editor (EShell *shell, ECalClient *client, ECalComponent *comp, gboolean is_new, GError **error) { ECompEditorFlags flags = 0; ECompEditor *comp_editor = NULL; ESourceRegistry *registry; g_return_val_if_fail (E_IS_SHELL (shell), NULL); g_return_val_if_fail (E_IS_CAL_CLIENT (client), NULL); g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL); registry = e_shell_get_registry (shell); if (is_new) { flags |= E_COMP_EDITOR_FLAG_IS_NEW; } else { comp_editor = e_comp_editor_find_existing_for ( e_client_get_source (E_CLIENT (client)), e_cal_component_get_icalcomponent (comp)); } if (!comp_editor) { if (itip_organizer_is_user (registry, comp, client)) flags |= E_COMP_EDITOR_FLAG_ORGANIZER_IS_USER; if (e_cal_component_has_attendees (comp)) flags |= E_COMP_EDITOR_FLAG_WITH_ATTENDEES; comp_editor = e_comp_editor_open_for_component (NULL, shell, e_client_get_source (E_CLIENT (client)), e_cal_component_get_icalcomponent (comp), flags); if (comp_editor) { /* request save for new events */ e_comp_editor_set_changed (comp_editor, is_new); } } return comp_editor; }
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; }
static void readonly_cb (EBookClient *book_client, GParamSpec *pspec, EAddressbookModel *model) { gboolean editable; editable = !e_client_is_readonly (E_CLIENT (book_client)); e_addressbook_model_set_editable (model, editable); }
static void test_refresh_sync (ETestServerFixture *fixture, gconstpointer user_data) { ECalClient *cal; GError *error = NULL; gboolean supported; cal = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient); supported = e_client_check_refresh_supported (E_CLIENT (cal)); g_print ("Refresh supported: %s\n", supported ? "yes" : "no"); if (!supported) return; setup_cal (cal); if (!e_client_refresh_sync (E_CLIENT (cal), NULL, &error)) g_error ("refresh sync: %s", error->message); }
static void get_revision_compare_cycle (ECalClient *client) { icalcomponent *icalcomp; struct icaltimetype now; gchar *revision_before = NULL, *revision_after = NULL, *uid = NULL; GError *error = NULL; /* Build up new component */ 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_client_get_backend_property_sync (E_CLIENT (client), CLIENT_BACKEND_PROPERTY_REVISION, &revision_before, NULL, &error)) g_error ("Error getting book revision: %s", error->message); if (!e_cal_client_create_object_sync (client, icalcomp, &uid, NULL, &error)) g_error ("Error creating object: %s", error->message); if (!e_client_get_backend_property_sync (E_CLIENT (client), CLIENT_BACKEND_PROPERTY_REVISION, &revision_after, NULL, &error)) g_error ("Error getting book revision: %s", error->message); g_assert (revision_before); g_assert (revision_after); g_assert (strcmp (revision_before, revision_after) != 0); g_message ("Passed cycle, revision before '%s' revision after '%s'", revision_before, revision_after); g_free (revision_before); g_free (revision_after); g_free (uid); icalcomponent_free (icalcomp); }
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; }