aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar/e-cal-shell-backend.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/calendar/e-cal-shell-backend.c')
-rw-r--r--modules/calendar/e-cal-shell-backend.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index 476831987a..4d9eee63c4 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -67,18 +67,22 @@ cal_shell_backend_new_event (ESource *source,
CompEditorFlags flags,
gboolean all_day)
{
- EClient *client = NULL;
+ EClient *client;
ECalClient *cal_client;
ECalComponent *comp;
EShellSettings *shell_settings;
CompEditor *editor;
GError *error = NULL;
- /* XXX Handle errors better. */
- e_client_utils_open_new_finish (source, result, &client, &error);
+ client = e_cal_client_connect_finish (result, &error);
+
+ /* Sanity check. */
+ g_return_if_fail (
+ ((client != NULL) && (error == NULL)) ||
+ ((client == NULL) && (error != NULL)));
+ /* XXX Handle errors better. */
if (error != NULL) {
- g_warn_if_fail (client == NULL);
g_warning (
"%s: Failed to open '%s': %s",
G_STRFUNC, e_source_get_display_name (source),
@@ -87,8 +91,6 @@ cal_shell_backend_new_event (ESource *source,
return;
}
- g_return_if_fail (E_IS_CAL_CLIENT (client));
-
cal_client = E_CAL_CLIENT (client);
shell_settings = e_shell_get_shell_settings (shell);
@@ -173,7 +175,7 @@ action_event_new_cb (GtkAction *action,
EShellBackend *shell_backend;
ESource *source;
ESourceRegistry *registry;
- EClientSourceType source_type;
+ ECalClientSourceType source_type;
const gchar *action_name;
shell = e_shell_window_get_shell (shell_window);
@@ -216,7 +218,7 @@ action_event_new_cb (GtkAction *action,
/* This callback is used for both appointments and meetings. */
- source_type = E_CLIENT_SOURCE_TYPE_EVENTS;
+ source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS;
registry = e_shell_get_registry (shell);
source = e_source_registry_ref_default_calendar (registry);
@@ -227,18 +229,18 @@ action_event_new_cb (GtkAction *action,
/* Use a callback function appropriate for the action.
* FIXME Need to obtain a better default time zone. */
if (strcmp (action_name, "event-all-day-new") == 0)
- e_client_utils_open_new (
- source, source_type, FALSE, NULL,
+ e_cal_client_connect (
+ source, source_type, NULL,
cal_shell_backend_event_all_day_new_cb,
g_object_ref (shell));
else if (strcmp (action_name, "event-meeting-new") == 0)
- e_client_utils_open_new (
- source, source_type, FALSE, NULL,
+ e_cal_client_connect (
+ source, source_type, NULL,
cal_shell_backend_event_meeting_new_cb,
g_object_ref (shell));
else
- e_client_utils_open_new (
- source, source_type, FALSE, NULL,
+ e_cal_client_connect (
+ source, source_type, NULL,
cal_shell_backend_event_new_cb,
g_object_ref (shell));
@@ -346,7 +348,7 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
EShellSettings *shell_settings;
CompEditor *editor;
CompEditorFlags flags = 0;
- ECalClient *client;
+ EClient *client;
ECalComponent *comp;
ESource *source;
ESourceRegistry *registry;
@@ -457,18 +459,18 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
goto exit;
}
- client = e_cal_client_new (source, source_type, &error);
+ client = e_cal_client_connect_sync (source, source_type, NULL, &error);
- if (client != NULL)
- e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error);
+ /* Sanity check. */
+ g_return_val_if_fail (
+ ((client != NULL) && (error == NULL)) ||
+ ((client == NULL) && (error != NULL)), FALSE);
if (error != NULL) {
g_warning (
"%s: Failed to create/open client '%s': %s",
G_STRFUNC, e_source_get_display_name (source),
error->message);
- if (client != NULL)
- g_object_unref (client);
g_object_unref (source);
g_error_free (error);
goto exit;
@@ -486,7 +488,8 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
goto present;
e_cal_client_get_object_sync (
- client, comp_uid, comp_rid, &icalcomp, NULL, &error);
+ E_CAL_CLIENT (client),comp_uid,
+ comp_rid, &icalcomp, NULL, &error);
if (error != NULL) {
g_warning (
@@ -509,16 +512,16 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
if (icalprop != NULL)
flags |= COMP_EDITOR_MEETING;
- if (itip_organizer_is_user (registry, comp, client))
+ if (itip_organizer_is_user (registry, comp, E_CAL_CLIENT (client)))
flags |= COMP_EDITOR_USER_ORG;
- if (itip_sentby_is_user (registry, comp, client))
+ if (itip_sentby_is_user (registry, comp, E_CAL_CLIENT (client)))
flags |= COMP_EDITOR_USER_ORG;
if (!e_cal_component_has_attendees (comp))
flags |= COMP_EDITOR_USER_ORG;
- editor = event_editor_new (client, shell, flags);
+ editor = event_editor_new (E_CAL_CLIENT (client), shell, flags);
comp_editor_edit_comp (editor, comp);
g_object_unref (comp);