aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar/e-memo-shell-backend.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/calendar/e-memo-shell-backend.c')
-rw-r--r--modules/calendar/e-memo-shell-backend.c77
1 files changed, 53 insertions, 24 deletions
diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c
index 2be78895f6..6f8070094e 100644
--- a/modules/calendar/e-memo-shell-backend.c
+++ b/modules/calendar/e-memo-shell-backend.c
@@ -84,11 +84,15 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend)
shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
- if (!e_cal_client_get_sources (
+ e_cal_client_get_sources (
&memo_shell_backend->priv->source_list,
- E_CAL_CLIENT_SOURCE_TYPE_MEMOS, &error)) {
- g_debug ("%s: Could not get memo sources: %s", G_STRFUNC, error ? error->message : "Unknown error");
- g_clear_error (&error);
+ E_CAL_CLIENT_SOURCE_TYPE_MEMOS, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Could not get memo sources: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
return;
}
@@ -172,13 +176,16 @@ memo_shell_backend_new_memo (ESource *source,
CompEditor *editor;
GError *error = NULL;
- if (!e_client_utils_open_new_finish (source, result, &client, &error))
- client = NULL;
+ e_client_utils_open_new_finish (source, result, &client, &error);
/* XXX Handle errors better. */
- if (!client) {
- g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error");
- g_clear_error (&error);
+ if (error != NULL) {
+ g_warn_if_fail (client == NULL);
+ g_warning (
+ "%s: Failed to open '%s': %s",
+ G_STRFUNC, e_source_peek_name (source),
+ error->message);
+ g_error_free (error);
return;
}
@@ -197,19 +204,24 @@ memo_shell_backend_new_memo (ESource *source,
}
static void
-memo_shell_backend_memo_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell)
+memo_shell_backend_memo_new_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer shell)
{
CompEditorFlags flags = 0;
flags |= COMP_EDITOR_NEW_ITEM;
- memo_shell_backend_new_memo (E_SOURCE (source_object), result, shell, flags);
+ memo_shell_backend_new_memo (
+ E_SOURCE (source_object), result, shell, flags);
g_object_unref (shell);
}
static void
-memo_shell_backend_memo_shared_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell)
+memo_shell_backend_memo_shared_new_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer shell)
{
CompEditorFlags flags = 0;
@@ -217,7 +229,8 @@ memo_shell_backend_memo_shared_new_cb (GObject *source_object, GAsyncResult *res
flags |= COMP_EDITOR_IS_SHARED;
flags |= COMP_EDITOR_USER_ORG;
- memo_shell_backend_new_memo (E_SOURCE (source_object), result, shell, flags);
+ memo_shell_backend_new_memo (
+ E_SOURCE (source_object), result, shell, flags);
g_object_unref (shell);
}
@@ -379,8 +392,12 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
* we successfully open it is another matter... */
handled = TRUE;
- if (!e_cal_client_get_sources (&source_list, source_type, &error)) {
- g_debug ("%s: Could not get memo sources: %s", G_STRFUNC, error ? error->message : "Unknown error");
+ e_cal_client_get_sources (&source_list, source_type, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Could not get memo sources: %s",
+ G_STRFUNC, error->message);
g_clear_error (&error);
goto exit;
}
@@ -393,13 +410,20 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
}
client = e_cal_client_new (source, source_type, &error);
- if (client)
- g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
- if (client == NULL || !e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error)) {
- g_debug ("%s: Failed to create/open client: %s", G_STRFUNC, error ? error->message : "Unknown error");
- g_clear_error (&error);
+ if (client != NULL) {
+ g_signal_connect (
+ client, "authenticate",
+ G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+ e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error);
+ }
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to create/open client: %s",
+ G_STRFUNC, error->message);
g_object_unref (source_list);
+ g_error_free (error);
goto exit;
}
@@ -411,16 +435,21 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
if (editor != NULL)
goto present;
- if (!e_cal_client_get_object_sync (client, comp_uid, comp_rid, &icalcomp, NULL, &error)) {
- g_debug ("%s: Failed to get object: %s", G_STRFUNC, error ? error->message : "Unknown error");
+ e_cal_client_get_object_sync (
+ client, comp_uid, comp_rid, &icalcomp, NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to get object: %s",
+ G_STRFUNC, error->message);
g_object_unref (source_list);
- g_clear_error (&error);
+ g_error_free (error);
goto exit;
}
comp = e_cal_component_new ();
if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
- g_debug ("%s: Failed to set icalcomp to comp\n", G_STRFUNC);
+ g_warning ("%s: Failed to set icalcomp to comp\n", G_STRFUNC);
icalcomponent_free (icalcomp);
icalcomp = NULL;
}