diff --git a/src/calendar-server/calendar-sources.c b/src/calendar-server/calendar-sources.c index 8d68af930..f89bdf99f 100644 --- a/src/calendar-server/calendar-sources.c +++ b/src/calendar-server/calendar-sources.c @@ -31,9 +31,9 @@ #include #include #define HANDLE_LIBICAL_MEMORY -#include +#include #include -#include +#include #undef CALENDAR_ENABLE_DEBUG #include "calendar-debug.h" @@ -60,7 +60,7 @@ typedef struct _CalendarSourceData CalendarSourceData; struct _CalendarSourceData { - ECalSourceType source_type; + ECalClientSourceType source_type; CalendarSources *sources; guint changed_signal; @@ -88,7 +88,7 @@ static void calendar_sources_class_init (CalendarSourcesClass *klass); static void calendar_sources_init (CalendarSources *sources); static void calendar_sources_finalize (GObject *object); -static void backend_died_cb (ECal *client, CalendarSourceData *source_data); +static void backend_died_cb (EClient *client, CalendarSourceData *source_data); static void calendar_sources_esource_list_changed (ESourceList *source_list, CalendarSourceData *source_data); @@ -172,12 +172,12 @@ calendar_sources_init (CalendarSources *sources) { sources->priv = CALENDAR_SOURCES_GET_PRIVATE (sources); - sources->priv->appointment_sources.source_type = E_CAL_SOURCE_TYPE_EVENT; + sources->priv->appointment_sources.source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS; sources->priv->appointment_sources.sources = sources; sources->priv->appointment_sources.changed_signal = signals [APPOINTMENT_SOURCES_CHANGED]; sources->priv->appointment_sources.timeout_id = 0; - sources->priv->task_sources.source_type = E_CAL_SOURCE_TYPE_TODO; + sources->priv->task_sources.source_type = E_CAL_CLIENT_SOURCE_TYPE_TASKS; sources->priv->task_sources.sources = sources; sources->priv->task_sources.changed_signal = signals [TASK_SOURCES_CHANGED]; sources->priv->task_sources.timeout_id = 0; @@ -295,30 +295,14 @@ is_source_selected (ESource *esource, return FALSE; } -static char * -auth_func_cb (ECal *ecal, - const char *prompt, - const char *key, - gpointer user_data) -{ - ESource *source; - const gchar *auth_domain; - const gchar *component_name; - - source = e_cal_get_source (ecal); - auth_domain = e_source_get_property (source, "auth-domain"); - component_name = auth_domain ? auth_domain : "Calendar"; - - return e_passwords_get_password (component_name, key); -} - /* The clients are just created here but not loaded */ -static ECal * -get_ecal_from_source (ESource *esource, - ECalSourceType source_type, - GSList *existing_clients) +static ECalClient * +get_ecal_from_source (ESource *esource, + ECalClientSourceType source_type, + GSList *existing_clients) { - ECal *retval; + ECalClient *retval; + GError *error = NULL; if (existing_clients) { @@ -326,9 +310,9 @@ get_ecal_from_source (ESource *esource, for (l = existing_clients; l; l = l->next) { - ECal *client = E_CAL (l->data); + EClient *client = E_CLIENT (l->data); - if (e_source_equal (esource, e_cal_get_source (client))) + if (e_source_equal (esource, e_client_get_source (client))) { dprintf (" load_esource: found existing source ... returning that\n"); @@ -337,16 +321,19 @@ get_ecal_from_source (ESource *esource, } } - retval = e_cal_new (esource, source_type); + retval = e_cal_client_new (esource, source_type, &error); if (!retval) { - g_warning ("Could not load source '%s' from '%s'\n", + g_warning ("Could not load source '%s' from '%s': %s", e_source_peek_name (esource), - e_source_peek_relative_uri (esource)); + e_source_peek_relative_uri (esource), + error->message); + g_clear_error(&error); return NULL; } - e_cal_set_auth_func (retval, auth_func_cb, NULL); + g_signal_connect (retval, "authenticate", + G_CALLBACK (e_client_utils_authenticate_handler), NULL); return retval; } @@ -399,13 +386,13 @@ debug_dump_ecal_list (GSList *ecal_list) dprintf ("Loaded clients:\n"); for (l = ecal_list; l; l = l->next) { - ECal *client = l->data; - ESource *source = e_cal_get_source (client); + EClient *client = l->data; + ESource *source = e_client_get_source (client); dprintf (" %s %s %s\n", e_source_peek_uid (source), e_source_peek_name (source), - e_cal_get_uri (client)); + e_client_get_uri (client)); } #endif } @@ -426,7 +413,7 @@ backend_restart (gpointer data) } static void -backend_died_cb (ECal *client, CalendarSourceData *source_data) +backend_died_cb (EClient *client, CalendarSourceData *source_data) { const char *uristr; @@ -436,7 +423,7 @@ backend_died_cb (ECal *client, CalendarSourceData *source_data) g_slist_free (source_data->clients); source_data->clients = NULL; } - uristr = e_cal_get_uri (client); + uristr = e_client_get_uri (client); g_warning ("The calendar backend for %s has crashed.", uristr); if (source_data->timeout_id != 0) @@ -472,8 +459,8 @@ calendar_sources_load_esource_list (CalendarSourceData *source_data) esources = e_source_group_peek_sources (l->data); for (s = esources; s; s = s->next) { - ESource *esource = E_SOURCE (s->data); - ECal *client; + ESource *esource = E_SOURCE (s->data); + ECalClient *client; dprintf (" type = '%s' uid = '%s', name = '%s', relative uri = '%s': \n", source_data->source_type == E_CAL_SOURCE_TYPE_EVENT ? "appointment" : "task", @@ -510,7 +497,7 @@ calendar_sources_load_esource_list (CalendarSourceData *source_data) * were already there before) */ for (l = source_data->clients; l; l = l->next) { - g_signal_connect (G_OBJECT (l->data), "backend_died", + g_signal_connect (G_OBJECT (l->data), "backend-died", G_CALLBACK (backend_died_cb), source_data); } diff --git a/src/calendar-server/gnome-shell-calendar-server.c b/src/calendar-server/gnome-shell-calendar-server.c index cfdd61340..4129c434e 100644 --- a/src/calendar-server/gnome-shell-calendar-server.c +++ b/src/calendar-server/gnome-shell-calendar-server.c @@ -36,7 +36,7 @@ #include #define HANDLE_LIBICAL_MEMORY -#include +#include #include #include #include @@ -250,27 +250,27 @@ get_ical_completed_time (icalcomponent *ical, } static char * -get_source_color (ECal *esource) +get_source_color (ECalClient *esource) { ESource *source; - g_return_val_if_fail (E_IS_CAL (esource), NULL); + g_return_val_if_fail (E_IS_CAL_CLIENT (esource), NULL); - source = e_cal_get_source (esource); + source = e_client_get_source (E_CLIENT (esource)); return g_strdup (e_source_peek_color_spec (source)); } static gchar * -get_source_uri (ECal *esource) +get_source_uri (ECalClient *esource) { ESource *source; gchar *string; gchar **list; - g_return_val_if_fail (E_IS_CAL (esource), NULL); + g_return_val_if_fail (E_IS_CAL_CLIENT (esource), NULL); - source = e_cal_get_source (esource); + source = e_client_get_source (E_CLIENT (esource)); string = g_strdup (e_source_get_uri (source)); if (string) { list = g_strsplit (string, ":", 2); @@ -358,7 +358,7 @@ calendar_appointment_free (CalendarAppointment *appointment) static void calendar_appointment_init (CalendarAppointment *appointment, icalcomponent *ical, - ECal *cal, + ECalClient *cal, icaltimezone *default_zone) { appointment->uid = get_ical_uid (ical); @@ -376,14 +376,14 @@ calendar_appointment_init (CalendarAppointment *appointment, static icaltimezone * resolve_timezone_id (const char *tzid, - ECal *source) + ECalClient *source) { icaltimezone *retval; retval = icaltimezone_get_builtin_timezone_from_tzid (tzid); if (!retval) { - e_cal_get_timezone (source, tzid, &retval, NULL); + e_cal_client_get_timezone_sync (source, tzid, &retval, NULL, NULL); } return retval; @@ -410,7 +410,7 @@ calendar_appointment_collect_occurrence (ECalComponent *component, static void calendar_appointment_generate_occurrences (CalendarAppointment *appointment, icalcomponent *ical, - ECal *cal, + ECalClient *cal, time_t start, time_t end, icaltimezone *default_zone) @@ -439,7 +439,7 @@ calendar_appointment_generate_occurrences (CalendarAppointment *appointment, static CalendarAppointment * calendar_appointment_new (icalcomponent *ical, - ECal *cal, + ECalClient *cal, icaltimezone *default_zone) { CalendarAppointment *appointment; @@ -535,12 +535,12 @@ invalidate_cache (App *app) } static void -on_objects_added (ECalView *view, - GList *objects, - gpointer user_data) +on_objects_added (ECalClientView *view, + GSList *objects, + gpointer user_data) { App *app = user_data; - GList *l; + GSList *l; print_debug ("%s for calendar", G_STRFUNC); @@ -561,9 +561,9 @@ on_objects_added (ECalView *view, } static void -on_objects_modified (ECalView *view, - GList *objects, - gpointer user_data) +on_objects_modified (ECalClientView *view, + GSList *objects, + gpointer user_data) { App *app = user_data; print_debug ("%s for calendar", G_STRFUNC); @@ -572,9 +572,9 @@ on_objects_modified (ECalView *view, } static void -on_objects_removed (ECalView *view, - GList *uids, - gpointer user_data) +on_objects_removed (ECalClientView *view, + GSList *uids, + gpointer user_data) { App *app = user_data; print_debug ("%s for calendar", G_STRFUNC); @@ -596,11 +596,11 @@ app_load_events (App *app) /* nuke existing views */ for (ll = app->live_views; ll != NULL; ll = ll->next) { - ECalView *view = E_CAL_VIEW (ll->data); + 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_view_stop (view); + e_cal_client_view_stop (view, NULL); g_object_unref (view); } g_list_free (app->live_views); @@ -619,23 +619,16 @@ app_load_events (App *app) sources = calendar_sources_get_appointment_sources (app->sources); for (l = sources; l != NULL; l = l->next) { - ECal *cal = E_CAL (l->data); + ECalClient *cal = E_CAL_CLIENT (l->data); GError *error; gchar *query; - GList *objects; - GList *j; - ECalView *view; + GSList *objects, *j; + ECalClientView *view; + + e_cal_client_set_default_timezone (cal, app->zone); error = NULL; - if (!e_cal_set_default_timezone (cal, app->zone, &error)) - { - g_printerr ("Error setting timezone on calendar: %s\n", error->message); - g_error_free (error); - continue; - } - - error = NULL; - if (!e_cal_open (cal, TRUE, &error)) + if (!e_client_open_sync (E_CLIENT (cal), TRUE, NULL, &error)) { g_printerr ("Error opening calendar: %s\n", error->message); g_error_free (error); @@ -648,10 +641,11 @@ app_load_events (App *app) until_iso8601); error = NULL; objects = NULL; - if (!e_cal_get_object_list (cal, - query, - &objects, - &error)) + if (!e_cal_client_get_object_list_sync (cal, + query, + &objects, + NULL, /* cancellable */ + &error)) { g_printerr ("Error querying calendar: %s\n", error->message); g_error_free (error); @@ -677,13 +671,14 @@ app_load_events (App *app) g_hash_table_insert (app->appointments, g_strdup (appointment->uid), appointment); } - e_cal_free_object_list (objects); + e_cal_client_free_icalcomp_slist (objects); error = NULL; - if (!e_cal_get_query (cal, - query, - &view, - &error)) + if (!e_cal_client_get_view_sync (cal, + query, + &view, + NULL, /* cancellable */ + &error)) { g_printerr ("Error setting up live-query on calendar: %s\n", error->message); g_error_free (error); @@ -702,7 +697,7 @@ app_load_events (App *app) "objects-removed", G_CALLBACK (on_objects_removed), app); - e_cal_view_start (view); + e_cal_client_view_start (view, NULL); app->live_views = g_list_prepend (app->live_views, view); } @@ -752,11 +747,11 @@ app_free (App *app) GList *ll; for (ll = app->live_views; ll != NULL; ll = ll->next) { - ECalView *view = E_CAL_VIEW (ll->data); + 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_view_stop (view); + e_cal_client_view_stop (view, NULL); g_object_unref (view); } g_list_free (app->live_views);