aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar/e-memo-shell-backend.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-01-24 05:05:08 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-01-30 22:35:27 +0800
commitf19241d136043d5cfffbfbaf5b2d6d1affc70682 (patch)
tree6abc10286b092dfc9b046bde599f24767ad0c177 /modules/calendar/e-memo-shell-backend.c
parente583928e0401a4baea4432c5b7e12a1b1eff8c2e (diff)
downloadgsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.tar
gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.tar.gz
gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.tar.bz2
gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.tar.lz
gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.tar.xz
gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.tar.zst
gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.zip
Use e_cal_client_connect().
Instead of e_client_utils_open_new() or e_cal_client_new().
Diffstat (limited to 'modules/calendar/e-memo-shell-backend.c')
-rw-r--r--modules/calendar/e-memo-shell-backend.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c
index 75fabd6d83..6f3d481d95 100644
--- a/modules/calendar/e-memo-shell-backend.c
+++ b/modules/calendar/e-memo-shell-backend.c
@@ -62,17 +62,21 @@ memo_shell_backend_new_memo (ESource *source,
EShell *shell,
CompEditorFlags flags)
{
- EClient *client = NULL;
+ EClient *client;
ECalClient *cal_client;
ECalComponent *comp;
CompEditor *editor;
GError *error = NULL;
- 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),
@@ -81,8 +85,6 @@ memo_shell_backend_new_memo (ESource *source,
return;
}
- g_return_if_fail (E_IS_CAL_CLIENT (client));
-
cal_client = E_CAL_CLIENT (client);
comp = cal_comp_memo_new_with_defaults (cal_client);
cal_comp_update_time_by_active_window (comp, shell);
@@ -134,7 +136,7 @@ action_memo_new_cb (GtkAction *action,
EShell *shell;
ESource *source;
ESourceRegistry *registry;
- EClientSourceType source_type;
+ ECalClientSourceType source_type;
const gchar *action_name;
/* This callback is used for both memos and shared memos. */
@@ -142,20 +144,20 @@ action_memo_new_cb (GtkAction *action,
shell = e_shell_window_get_shell (shell_window);
registry = e_shell_get_registry (shell);
- source_type = E_CLIENT_SOURCE_TYPE_MEMOS;
+ source_type = E_CAL_CLIENT_SOURCE_TYPE_MEMOS;
source = e_source_registry_ref_default_memo_list (registry);
/* Use a callback function appropriate for the action.
* FIXME Need to obtain a better default time zone. */
action_name = gtk_action_get_name (action);
if (g_strcmp0 (action_name, "memo-shared-new") == 0)
- e_client_utils_open_new (
- source, source_type, FALSE, NULL,
+ e_cal_client_connect (
+ source, source_type, NULL,
memo_shell_backend_memo_shared_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,
memo_shell_backend_memo_new_cb,
g_object_ref (shell));
@@ -226,7 +228,7 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
EShell *shell;
CompEditor *editor;
CompEditorFlags flags = 0;
- ECalClient *client;
+ EClient *client;
ECalComponent *comp;
ESource *source;
ESourceRegistry *registry;
@@ -304,17 +306,17 @@ memo_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",
G_STRFUNC, error->message);
- if (client != NULL)
- g_object_unref (client);
g_object_unref (source);
g_error_free (error);
goto exit;
@@ -332,7 +334,8 @@ memo_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 (
@@ -353,10 +356,10 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
if (e_cal_component_has_organizer (comp))
flags |= COMP_EDITOR_IS_SHARED;
- if (itip_organizer_is_user (registry, comp, client))
+ if (itip_organizer_is_user (registry, comp, E_CAL_CLIENT (client)))
flags |= COMP_EDITOR_USER_ORG;
- editor = memo_editor_new (client, shell, flags);
+ editor = memo_editor_new (E_CAL_CLIENT (client), shell, flags);
comp_editor_edit_comp (editor, comp);
g_object_unref (comp);