aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-07-01 12:07:26 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-08-13 23:27:51 +0800
commitf59681796df8fe0138a1754abbe8ec781bc1535e (patch)
tree0ced0c119ffed095713d7f64732686df9b2d9152 /modules/calendar
parentbf4a1a13e3295deefc4031a446627ff9b1c95c7a (diff)
downloadgsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.gz
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.zst
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.zip
Coding style and whitespace cleanup.
Diffstat (limited to 'modules/calendar')
-rw-r--r--modules/calendar/e-cal-attachment-handler.c56
-rw-r--r--modules/calendar/e-cal-shell-backend.c87
-rw-r--r--modules/calendar/e-cal-shell-sidebar.c90
-rw-r--r--modules/calendar/e-cal-shell-view-actions.c76
-rw-r--r--modules/calendar/e-cal-shell-view-private.c18
-rw-r--r--modules/calendar/e-cal-shell-view.c10
-rw-r--r--modules/calendar/e-memo-shell-backend.c77
-rw-r--r--modules/calendar/e-memo-shell-sidebar.c90
-rw-r--r--modules/calendar/e-memo-shell-view-actions.c34
-rw-r--r--modules/calendar/e-task-shell-backend.c77
-rw-r--r--modules/calendar/e-task-shell-sidebar.c97
-rw-r--r--modules/calendar/e-task-shell-view-actions.c34
-rw-r--r--modules/calendar/e-task-shell-view-private.c20
13 files changed, 544 insertions, 222 deletions
diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c
index a2932a0d17..24a73f6d1a 100644
--- a/modules/calendar/e-cal-attachment-handler.c
+++ b/modules/calendar/e-cal-attachment-handler.c
@@ -141,10 +141,15 @@ attachment_handler_update_objects (ECalClient *client,
return FALSE;
}
- success = e_cal_client_receive_objects_sync (client, vcalendar, NULL, &error);
- if (error)
- g_debug ("%s: Failed to receive objects: %s", G_STRFUNC, error ? error->message : "Unknown error");
- g_clear_error (&error);
+ success = e_cal_client_receive_objects_sync (
+ client, vcalendar, NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to receive objects: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
+ }
icalcomponent_free (vcalendar);
@@ -152,8 +157,11 @@ attachment_handler_update_objects (ECalClient *client,
}
static void
-attachment_handler_import_event (GObject *source_object, GAsyncResult *result, gpointer user_data)
+attachment_handler_import_event (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
+ ESource *source = E_SOURCE (source_object);
EAttachment *attachment = user_data;
EClient *client = NULL;
GError *error = NULL;
@@ -161,15 +169,21 @@ attachment_handler_import_event (GObject *source_object, GAsyncResult *result, g
icalcomponent *subcomponent;
icalcompiter iter;
- if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error))
- client = NULL;
+ e_client_utils_open_new_finish (source, result, &client, &error);
- if (!client) {
- g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (E_SOURCE (source_object)), error ? error->message : "Unknown 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_object_unref (attachment);
+ g_error_free (error);
return;
}
+ g_return_if_fail (E_IS_CLIENT (client));
+
component = attachment_handler_get_component (attachment);
g_return_if_fail (component != NULL);
@@ -199,8 +213,11 @@ attachment_handler_import_event (GObject *source_object, GAsyncResult *result, g
}
static void
-attachment_handler_import_todo (GObject *source_object, GAsyncResult *result, gpointer user_data)
+attachment_handler_import_todo (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
+ ESource *source = E_SOURCE (source_object);
EAttachment *attachment = user_data;
EClient *client = NULL;
GError *error = NULL;
@@ -208,15 +225,21 @@ attachment_handler_import_todo (GObject *source_object, GAsyncResult *result, gp
icalcomponent *subcomponent;
icalcompiter iter;
- if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error))
- client = NULL;
+ e_client_utils_open_new_finish (source, result, &client, &error);
- if (!client) {
- g_debug ("%s: Failed to open '%s': %s", G_STRFUNC, e_source_peek_name (E_SOURCE (source_object)), error ? error->message : "Unknown 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_object_unref (attachment);
+ g_error_free (error);
return;
}
+ g_return_if_fail (E_IS_CLIENT (client));
+
component = attachment_handler_get_component (attachment);
g_return_if_fail (component != NULL);
@@ -270,8 +293,11 @@ attachment_handler_run_dialog (GtkWindow *parent,
g_return_if_fail (component != NULL);
e_cal_client_get_sources (&source_list, source_type, &error);
+
if (error != NULL) {
- g_debug ("%s: Faield to get cal sources: %s", G_STRFUNC, error ? error->message : "Unknown error");
+ g_warning (
+ "%s: Failed to get cal sources: %s",
+ G_STRFUNC, error->message);
g_clear_error (&error);
return;
}
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index 744cd60b18..96077cf19e 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -95,11 +95,15 @@ cal_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 (
&cal_shell_backend->priv->source_list,
- E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error)) {
- g_debug ("%s: Could not get calendar sources: %s", G_STRFUNC, error ? error->message : "Unknown error");
- g_clear_error (&error);
+ E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Could not get calendar sources: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
return;
}
@@ -244,12 +248,15 @@ cal_shell_backend_new_event (ESource *source,
GError *error = NULL;
/* XXX Handle errors better. */
- if (!e_client_utils_open_new_finish (source, result, &client, &error))
- client = NULL;
-
- 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);
+ e_client_utils_open_new_finish (source, result, &client, &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;
}
@@ -279,7 +286,9 @@ cal_shell_backend_new_event (ESource *source,
}
static void
-cal_shell_backend_event_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell)
+cal_shell_backend_event_new_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer shell)
{
CompEditorFlags flags = 0;
gboolean all_day = FALSE;
@@ -287,13 +296,16 @@ cal_shell_backend_event_new_cb (GObject *source_object, GAsyncResult *result, gp
flags |= COMP_EDITOR_NEW_ITEM;
flags |= COMP_EDITOR_USER_ORG;
- cal_shell_backend_new_event (E_SOURCE (source_object), result, shell, flags, all_day);
+ cal_shell_backend_new_event (
+ E_SOURCE (source_object), result, shell, flags, all_day);
g_object_unref (shell);
}
static void
-cal_shell_backend_event_all_day_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell)
+cal_shell_backend_event_all_day_new_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer shell)
{
CompEditorFlags flags = 0;
gboolean all_day = TRUE;
@@ -301,13 +313,16 @@ cal_shell_backend_event_all_day_new_cb (GObject *source_object, GAsyncResult *re
flags |= COMP_EDITOR_NEW_ITEM;
flags |= COMP_EDITOR_USER_ORG;
- cal_shell_backend_new_event (E_SOURCE (source_object), result, shell, flags, all_day);
+ cal_shell_backend_new_event (
+ E_SOURCE (source_object), result, shell, flags, all_day);
g_object_unref (shell);
}
static void
-cal_shell_backend_event_meeting_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell)
+cal_shell_backend_event_meeting_new_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer shell)
{
CompEditorFlags flags = 0;
gboolean all_day = FALSE;
@@ -316,7 +331,8 @@ cal_shell_backend_event_meeting_new_cb (GObject *source_object, GAsyncResult *re
flags |= COMP_EDITOR_USER_ORG;
flags |= COMP_EDITOR_MEETING;
- cal_shell_backend_new_event (E_SOURCE (source_object), result, shell, flags, all_day);
+ cal_shell_backend_new_event (
+ E_SOURCE (source_object), result, shell, flags, all_day);
g_object_unref (shell);
}
@@ -587,24 +603,36 @@ cal_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 calendar sources: %s", G_STRFUNC, error ? error->message : "Unknown error");
- g_clear_error (&error);
+ e_cal_client_get_sources (&source_list, source_type, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Could not get calendar sources: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
goto exit;
}
source = e_source_list_peek_source_by_uid (source_list, source_uid);
+
if (source == NULL) {
- g_debug ("%s: No source for UID '%s'", G_STRFUNC, source_uid);
+ g_warning ("%s: No source for UID '%s'", G_STRFUNC, source_uid);
g_object_unref (source_list);
goto exit;
}
client = e_cal_client_new (source, source_type, &error);
- if (client == NULL || !e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error)) {
- g_debug ("%s: Failed to create/open client '%s': %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error");
- g_clear_error (&error);
+
+ if (client != NULL)
+ e_client_open_sync (E_CLIENT (client), TRUE, NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to create/open client '%s': %s",
+ G_STRFUNC, e_source_peek_name (source),
+ error->message);
g_object_unref (source_list);
+ g_error_free (error);
goto exit;
}
@@ -616,16 +644,21 @@ cal_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 from client: %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 from client: %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;
}
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index e296f6ff31..77c5639a78 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -165,7 +165,9 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar,
}
static void
-cal_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+cal_shell_sidebar_retrieve_capabilies_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
ECalClient *client = E_CAL_CLIENT (source_object);
ECalShellSidebar *cal_shell_sidebar = user_data;
@@ -174,10 +176,12 @@ cal_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *
g_return_if_fail (client != NULL);
g_return_if_fail (cal_shell_sidebar != NULL);
- e_client_retrieve_capabilities_finish (E_CLIENT (client), result, &capabilities, NULL);
+ e_client_retrieve_capabilities_finish (
+ E_CLIENT (client), result, &capabilities, NULL);
g_free (capabilities);
- cal_shell_sidebar_emit_status_message (cal_shell_sidebar, _("Loading calendars"));
+ cal_shell_sidebar_emit_status_message (
+ cal_shell_sidebar, _("Loading calendars"));
cal_shell_sidebar_emit_client_added (cal_shell_sidebar, client);
cal_shell_sidebar_emit_status_message (cal_shell_sidebar, NULL);
}
@@ -205,15 +209,20 @@ free_retry_open_data (gpointer data)
}
static void
-cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+cal_shell_sidebar_client_opened_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
ECalClient *client = E_CAL_CLIENT (source_object);
ECalShellSidebar *cal_shell_sidebar = user_data;
+ ESource *source;
EShellView *shell_view;
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
GError *error = NULL;
+ source = e_client_get_source (E_CLIENT (client));
+
e_client_open_finish (E_CLIENT (client), result, &error);
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
@@ -227,7 +236,10 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result
e_client_utils_forget_password (E_CLIENT (client));
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED)) {
- e_client_open (E_CLIENT (client), FALSE, cal_shell_sidebar->priv->loading_clients, cal_shell_sidebar_client_opened_cb, user_data);
+ e_client_open (
+ E_CLIENT (client), FALSE,
+ cal_shell_sidebar->priv->loading_clients,
+ cal_shell_sidebar_client_opened_cb, user_data);
g_clear_error (&error);
return;
@@ -242,7 +254,10 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result
rod->cancellable = g_object_ref (cal_shell_sidebar->priv->loading_clients);
/* postpone for 1/2 of a second, backend is busy now */
- g_timeout_add_full (G_PRIORITY_DEFAULT, 500, cal_shell_sidebar_retry_open_timeout_cb, rod, free_retry_open_data);
+ g_timeout_add_full (
+ G_PRIORITY_DEFAULT, 500,
+ cal_shell_sidebar_retry_open_timeout_cb,
+ rod, free_retry_open_data);
g_clear_error (&error);
return;
@@ -258,7 +273,10 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result
break;
case E_CLIENT_ERROR_BUSY:
- g_debug ("%s: Cannot open '%s', it's busy (%s)", G_STRFUNC, e_source_peek_name (e_client_get_source (E_CLIENT (client))), error->message);
+ g_warning (
+ "%s: Cannot open '%s', it's busy (%s)",
+ G_STRFUNC, e_source_peek_name (source),
+ error->message);
g_clear_error (&error);
return;
@@ -287,7 +305,10 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result
g_clear_error (&error);
/* to have them ready for later use */
- e_client_retrieve_capabilities (E_CLIENT (client), NULL, cal_shell_sidebar_retrieve_capabilies_cb, cal_shell_sidebar);
+ e_client_retrieve_capabilities (
+ E_CLIENT (client), NULL,
+ cal_shell_sidebar_retrieve_capabilies_cb,
+ cal_shell_sidebar);
}
static gboolean
@@ -303,14 +324,21 @@ cal_shell_sidebar_retry_open_timeout_cb (gpointer user_data)
if (g_cancellable_is_cancelled (rod->cancellable))
return FALSE;
- e_client_open (rod->client, FALSE, rod->cal_shell_sidebar->priv->loading_clients, cal_shell_sidebar_client_opened_cb, rod->cal_shell_sidebar);
+ e_client_open (
+ rod->client, FALSE,
+ rod->cal_shell_sidebar->priv->loading_clients,
+ cal_shell_sidebar_client_opened_cb,
+ rod->cal_shell_sidebar);
return FALSE;
}
static void
-cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+cal_shell_sidebar_default_loaded_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
+ ESource *source = E_SOURCE (source_object);
EShellSidebar *shell_sidebar = user_data;
ECalShellSidebarPrivate *priv;
EShellContent *shell_content;
@@ -322,21 +350,22 @@ cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resul
priv = E_CAL_SHELL_SIDEBAR (shell_sidebar)->priv;
- if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error))
- client = NULL;
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ cal_shell_content = E_CAL_SHELL_CONTENT (shell_content);
+ model = e_cal_shell_content_get_model (cal_shell_content);
+
+ e_client_utils_open_new_finish (source, result, &client, &error);
+ /* Ignore cancellations. */
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_warn_if_fail (client == NULL);
g_error_free (error);
goto exit;
- }
-
- shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- shell_content = e_shell_view_get_shell_content (shell_view);
- cal_shell_content = E_CAL_SHELL_CONTENT (shell_content);
- model = e_cal_shell_content_get_model (cal_shell_content);
- if (error != NULL) {
+ } else if (error != NULL) {
+ g_warn_if_fail (client == NULL);
e_alert_submit (
E_ALERT_SINK (shell_content),
"calendar:failed-open-calendar",
@@ -352,7 +381,8 @@ cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resul
priv->default_client = E_CAL_CLIENT (client);
- e_cal_client_set_default_timezone (priv->default_client, e_cal_model_get_timezone (model));
+ e_cal_client_set_default_timezone (
+ priv->default_client, e_cal_model_get_timezone (model));
g_object_notify (G_OBJECT (shell_sidebar), "default-client");
@@ -401,9 +431,13 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar,
priv->loading_default_client = g_cancellable_new ();
- e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, priv->loading_default_client,
- e_client_utils_authenticate_handler, GTK_WINDOW (shell_window),
- cal_shell_sidebar_default_loaded_cb, g_object_ref (shell_sidebar));
+ e_client_utils_open_new (
+ source, E_CLIENT_SOURCE_TYPE_EVENTS,
+ FALSE, priv->loading_default_client,
+ e_client_utils_authenticate_handler,
+ GTK_WINDOW (shell_window),
+ cal_shell_sidebar_default_loaded_cb,
+ g_object_ref (shell_sidebar));
}
static void
@@ -1064,7 +1098,9 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
if (client == NULL) {
client = e_cal_client_new (source, source_type, NULL);
if (client)
- g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+ g_signal_connect (
+ client, "authenticate",
+ G_CALLBACK (e_client_utils_authenticate_handler), NULL);
}
g_return_if_fail (client != NULL);
@@ -1099,7 +1135,11 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
timezone = e_cal_model_get_timezone (model);
e_cal_client_set_default_timezone (client, timezone);
- e_client_open (E_CLIENT (client), FALSE, cal_shell_sidebar->priv->loading_clients, cal_shell_sidebar_client_opened_cb, cal_shell_sidebar);
+
+ e_client_open (
+ E_CLIENT (client), FALSE,
+ cal_shell_sidebar->priv->loading_clients,
+ cal_shell_sidebar_client_opened_cb, cal_shell_sidebar);
}
void
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 6537cde8b4..f8b426c6f2 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -102,14 +102,19 @@ action_calendar_delete_cb (GtkAction *action,
uri = e_source_get_uri (source);
client = e_cal_model_get_client_for_uri (model, uri);
if (client == NULL)
- client = e_cal_client_new_from_uri (uri, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
+ client = e_cal_client_new_from_uri (
+ uri, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
g_free (uri);
g_return_if_fail (client != NULL);
- if (!e_client_remove_sync (E_CLIENT (client), NULL, &error)) {
- g_debug ("%s: Failed to remove client: %s", G_STRFUNC, error ? error->message : "Unknown error");
- g_clear_error (&error);
+ e_client_remove_sync (E_CLIENT (client), NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to remove client: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
return;
}
@@ -124,9 +129,14 @@ action_calendar_delete_cb (GtkAction *action,
source_list = e_cal_shell_backend_get_source_list (
E_CAL_SHELL_BACKEND (shell_backend));
- if (!e_source_list_sync (source_list, &error)) {
- g_debug ("%s: Failed to sync source list: %s", G_STRFUNC, error ? error->message : "Unknown error");
- g_clear_error (&error);
+
+ e_source_list_sync (source_list, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to sync source list: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
}
}
@@ -386,9 +396,14 @@ action_calendar_refresh_cb (GtkAction *action,
g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client)));
- if (!e_client_refresh_sync (E_CLIENT (client), NULL, &error)) {
- g_debug ("%s: Failed to refresh '%s', %s\n", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error");
- g_clear_error (&error);
+ e_client_refresh_sync (E_CLIENT (client), NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to refresh '%s', %s",
+ G_STRFUNC, e_source_peek_name (source),
+ error->message);
+ g_error_free (error);
}
}
@@ -515,12 +530,14 @@ action_event_copy_cb (GtkAction *action,
ECalendarViewEvent *event = selected->data;
if (is_comp_data_valid (event) && event->comp_data->client)
- source_source = e_client_get_source (E_CLIENT (event->comp_data->client));
+ source_source = e_client_get_source (
+ E_CLIENT (event->comp_data->client));
}
/* Get a destination source from the user. */
destination_source = select_source_dialog (
- GTK_WINDOW (shell_window), E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source);
+ GTK_WINDOW (shell_window),
+ E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source);
if (destination_source == NULL)
return;
@@ -529,11 +546,17 @@ action_event_copy_cb (GtkAction *action,
destination_source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
if (destination_client == NULL)
goto exit;
- g_signal_connect (destination_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+ g_signal_connect (
+ destination_client, "authenticate",
+ G_CALLBACK (e_client_utils_authenticate_handler), NULL);
- if (!e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error)) {
- g_debug ("%s: Failed to open destination client: %s", G_STRFUNC, error ? error->message : "Unknown error");
- g_clear_error (&error);
+ e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to open destination client: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
goto exit;
}
@@ -791,23 +814,32 @@ action_event_move_cb (GtkAction *action,
ECalendarViewEvent *event = selected->data;
if (is_comp_data_valid (event) && event->comp_data->client)
- source_source = e_client_get_source (E_CLIENT (event->comp_data->client));
+ source_source = e_client_get_source (
+ E_CLIENT (event->comp_data->client));
}
/* Get a destination source from the user. */
destination_source = select_source_dialog (
- GTK_WINDOW (shell_window), E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source);
+ GTK_WINDOW (shell_window),
+ E_CAL_CLIENT_SOURCE_TYPE_EVENTS, source_source);
if (destination_source == NULL)
return;
/* Open the destination calendar. */
- destination_client = e_cal_client_new (destination_source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
+ destination_client = e_cal_client_new (
+ destination_source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
if (destination_client == NULL)
goto exit;
- g_signal_connect (destination_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+ g_signal_connect (
+ destination_client, "authenticate",
+ G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+
+ e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error);
- if (!e_client_open_sync (E_CLIENT (destination_client), FALSE, NULL, &error)) {
- g_debug ("%s: Failed to open destination client: %s", G_STRFUNC, error ? error->message : "Unknown error");
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to open destination client: %s",
+ G_STRFUNC, error->message);
g_clear_error (&error);
goto exit;
}
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index 01ae23cc1c..7a9fdaac69 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -933,12 +933,17 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view,
}
new_uid = NULL;
- icalcomponent_foreach_tzid (icalcomp_clone, add_timezone_to_cal_cb, &ftd);
+ icalcomponent_foreach_tzid (
+ icalcomp_clone, add_timezone_to_cal_cb, &ftd);
success = e_cal_client_create_object_sync (
- destination_client, icalcomp_clone, &new_uid, NULL, &error);
+ destination_client, icalcomp_clone,
+ &new_uid, NULL, &error);
if (!success) {
icalcomponent_free (icalcomp_clone);
- g_debug ("%s: Failed to create object: %s", G_STRFUNC, error ? error->message : "Unknown error");
+ g_warning (
+ "%s: Failed to create object: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
return;
}
@@ -962,10 +967,13 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view,
else
rid = NULL;
e_cal_client_remove_object_sync (
- source_client, uid, rid, CALOBJ_MOD_ALL, NULL, NULL);
+ source_client, uid, rid,
+ CALOBJ_MOD_ALL, NULL, NULL);
g_free (rid);
} else
- e_cal_client_remove_object_sync (source_client, uid, NULL, CALOBJ_MOD_THIS, NULL, NULL);
+ e_cal_client_remove_object_sync (
+ source_client, uid, NULL,
+ CALOBJ_MOD_THIS, NULL, NULL);
}
}
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c
index 2249bf96e4..03914f1793 100644
--- a/modules/calendar/e-cal-shell-view.c
+++ b/modules/calendar/e-cal-shell-view.c
@@ -391,9 +391,13 @@ cal_shell_view_update_actions (EShellView *shell_view)
itip_organizer_is_user (comp, client);
is_delegatable =
- e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED) &&
- (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY) ||
- (!user_org && !is_delegated (icalcomp, user_email)));
+ e_client_check_capability (
+ E_CLIENT (client),
+ CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED) &&
+ (e_client_check_capability (
+ E_CLIENT (client),
+ CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY) ||
+ (!user_org && !is_delegated (icalcomp, user_email)));
g_free (user_email);
g_object_unref (comp);
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;
}
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index cf38c219b5..df9ea9a59a 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -160,7 +160,9 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar,
}
static void
-memo_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+memo_shell_sidebar_retrieve_capabilies_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
ECalClient *client = E_CAL_CLIENT (source_object);
EMemoShellSidebar *memo_shell_sidebar = user_data;
@@ -169,10 +171,12 @@ memo_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult
g_return_if_fail (client != NULL);
g_return_if_fail (memo_shell_sidebar != NULL);
- e_client_retrieve_capabilities_finish (E_CLIENT (client), result, &capabilities, NULL);
+ e_client_retrieve_capabilities_finish (
+ E_CLIENT (client), result, &capabilities, NULL);
g_free (capabilities);
- memo_shell_sidebar_emit_status_message (memo_shell_sidebar, _("Loading memos"));
+ memo_shell_sidebar_emit_status_message (
+ memo_shell_sidebar, _("Loading memos"));
memo_shell_sidebar_emit_client_added (memo_shell_sidebar, client);
memo_shell_sidebar_emit_status_message (memo_shell_sidebar, NULL);
}
@@ -200,15 +204,20 @@ free_retry_open_data (gpointer data)
}
static void
-memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+memo_shell_sidebar_client_opened_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
ECalClient *client = E_CAL_CLIENT (source_object);
EMemoShellSidebar *memo_shell_sidebar = user_data;
+ ESource *source;
EShellView *shell_view;
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
GError *error = NULL;
+ source = e_client_get_source (E_CLIENT (client));
+
e_client_open_finish (E_CLIENT (client), result, &error);
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
@@ -222,7 +231,10 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul
e_client_utils_forget_password (E_CLIENT (client));
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED)) {
- e_client_open (E_CLIENT (client), FALSE, memo_shell_sidebar->priv->loading_clients, memo_shell_sidebar_client_opened_cb, user_data);
+ e_client_open (
+ E_CLIENT (client), FALSE,
+ memo_shell_sidebar->priv->loading_clients,
+ memo_shell_sidebar_client_opened_cb, user_data);
g_clear_error (&error);
return;
}
@@ -236,7 +248,10 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul
rod->cancellable = g_object_ref (memo_shell_sidebar->priv->loading_clients);
/* postpone for 1/2 of a second, backend is busy now */
- g_timeout_add_full (G_PRIORITY_DEFAULT, 500, memo_shell_sidebar_retry_open_timeout_cb, rod, free_retry_open_data);
+ g_timeout_add_full (
+ G_PRIORITY_DEFAULT, 500,
+ memo_shell_sidebar_retry_open_timeout_cb,
+ rod, free_retry_open_data);
g_clear_error (&error);
return;
@@ -252,7 +267,10 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul
break;
case E_CLIENT_ERROR_BUSY:
- g_debug ("%s: Cannot open '%s', it's busy (%s)", G_STRFUNC, e_source_peek_name (e_client_get_source (E_CLIENT (client))), error->message);
+ g_warning (
+ "%s: Cannot open '%s', it's busy (%s)",
+ G_STRFUNC, e_source_peek_name (source),
+ error->message);
g_clear_error (&error);
return;
@@ -281,7 +299,10 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul
g_clear_error (&error);
/* to have them ready for later use */
- e_client_retrieve_capabilities (E_CLIENT (client), NULL, memo_shell_sidebar_retrieve_capabilies_cb, memo_shell_sidebar);
+ e_client_retrieve_capabilities (
+ E_CLIENT (client), NULL,
+ memo_shell_sidebar_retrieve_capabilies_cb,
+ memo_shell_sidebar);
}
static gboolean
@@ -297,14 +318,21 @@ memo_shell_sidebar_retry_open_timeout_cb (gpointer user_data)
if (g_cancellable_is_cancelled (rod->cancellable))
return FALSE;
- e_client_open (rod->client, FALSE, rod->memo_shell_sidebar->priv->loading_clients, memo_shell_sidebar_client_opened_cb, rod->memo_shell_sidebar);
+ e_client_open (
+ rod->client, FALSE,
+ rod->memo_shell_sidebar->priv->loading_clients,
+ memo_shell_sidebar_client_opened_cb,
+ rod->memo_shell_sidebar);
return FALSE;
}
static void
-memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+memo_shell_sidebar_default_loaded_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
+ ESource *source = E_SOURCE (source_object);
EShellSidebar *shell_sidebar = user_data;
EMemoShellSidebarPrivate *priv;
EShellContent *shell_content;
@@ -316,21 +344,22 @@ memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu
priv = E_MEMO_SHELL_SIDEBAR (shell_sidebar)->priv;
- if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error))
- client = NULL;
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content);
+ model = e_memo_shell_content_get_memo_model (memo_shell_content);
+
+ e_client_utils_open_new_finish (source, result, &client, &error);
+ /* Ignore cancellations. */
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_warn_if_fail (client == NULL);
g_error_free (error);
goto exit;
- }
-
- shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- shell_content = e_shell_view_get_shell_content (shell_view);
- memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content);
- model = e_memo_shell_content_get_memo_model (memo_shell_content);
- if (error != NULL) {
+ } else if (error != NULL) {
+ g_warn_if_fail (client == NULL);
e_alert_submit (
E_ALERT_SINK (shell_content),
"calendar:failed-open-memos",
@@ -346,7 +375,8 @@ memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu
priv->default_client = E_CAL_CLIENT (client);
- e_cal_client_set_default_timezone (priv->default_client, e_cal_model_get_timezone (model));
+ e_cal_client_set_default_timezone (
+ priv->default_client, e_cal_model_get_timezone (model));
g_object_notify (G_OBJECT (shell_sidebar), "default-client");
@@ -395,9 +425,13 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar,
priv->loading_default_client = g_cancellable_new ();
- e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_MEMOS, FALSE, priv->loading_default_client,
- e_client_utils_authenticate_handler, GTK_WINDOW (shell_window),
- memo_shell_sidebar_default_loaded_cb, g_object_ref (shell_sidebar));
+ e_client_utils_open_new (
+ source, E_CLIENT_SOURCE_TYPE_MEMOS,
+ FALSE, priv->loading_default_client,
+ e_client_utils_authenticate_handler,
+ GTK_WINDOW (shell_window),
+ memo_shell_sidebar_default_loaded_cb,
+ g_object_ref (shell_sidebar));
}
static void
@@ -950,7 +984,9 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
if (client == NULL) {
client = e_cal_client_new (source, source_type, NULL);
if (client)
- g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+ g_signal_connect (
+ client, "authenticate",
+ G_CALLBACK (e_client_utils_authenticate_handler), NULL);
}
g_return_if_fail (client != NULL);
@@ -985,7 +1021,11 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
timezone = e_cal_model_get_timezone (model);
e_cal_client_set_default_timezone (client, timezone);
- e_client_open (E_CLIENT (client), FALSE, memo_shell_sidebar->priv->loading_clients, memo_shell_sidebar_client_opened_cb, memo_shell_sidebar);
+
+ e_client_open (
+ E_CLIENT (client), FALSE,
+ memo_shell_sidebar->priv->loading_clients,
+ memo_shell_sidebar_client_opened_cb, memo_shell_sidebar);
}
void
diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c
index 75d957c684..eacb5c1da7 100644
--- a/modules/calendar/e-memo-shell-view-actions.c
+++ b/modules/calendar/e-memo-shell-view-actions.c
@@ -170,14 +170,19 @@ action_memo_list_delete_cb (GtkAction *action,
uri = e_source_get_uri (source);
client = e_cal_model_get_client_for_uri (model, uri);
if (client == NULL)
- client = e_cal_client_new_from_uri (uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL);
+ client = e_cal_client_new_from_uri (
+ uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL);
g_free (uri);
g_return_if_fail (client != NULL);
- if (!e_client_remove_sync (E_CLIENT (client), NULL, &error)) {
- g_debug ("%s: Failed to remove client: %s", G_STRFUNC, error ? error->message : "Unknown error");
- g_clear_error (&error);
+ e_client_remove_sync (E_CLIENT (client), NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to remove client: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
return;
}
@@ -190,9 +195,13 @@ action_memo_list_delete_cb (GtkAction *action,
source_group = e_source_peek_group (source);
e_source_group_remove_source (source_group, source);
- if (!e_source_list_sync (source_list, &error)) {
- g_debug ("%s: Failed to sync source list: %s", G_STRFUNC, error ? error->message : "Unknown error");
- g_clear_error (&error);
+ e_source_list_sync (source_list, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to sync source list: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
}
}
@@ -290,9 +299,14 @@ action_memo_list_refresh_cb (GtkAction *action,
g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client)));
- if (!e_client_refresh_sync (E_CLIENT (client), NULL, &error)) {
- g_debug ("%s: Failed to refresh '%s', %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error");
- g_clear_error (&error);
+ e_client_refresh_sync (E_CLIENT (client), NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to refresh '%s', %s",
+ G_STRFUNC, e_source_peek_name (source),
+ error->message);
+ g_error_free (error);
}
}
diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c
index ebee92479b..bb296fd5c2 100644
--- a/modules/calendar/e-task-shell-backend.c
+++ b/modules/calendar/e-task-shell-backend.c
@@ -84,11 +84,15 @@ task_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 (
&task_shell_backend->priv->source_list,
- E_CAL_CLIENT_SOURCE_TYPE_TASKS, &error)) {
- g_debug ("%s: Could not get task sources: %s", G_STRFUNC, error ? error->message : "Unknown error");
- g_clear_error (&error);
+ E_CAL_CLIENT_SOURCE_TYPE_TASKS, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Could not get task sources: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
return;
}
@@ -172,13 +176,16 @@ task_shell_backend_new_task (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;
}
@@ -196,19 +203,24 @@ task_shell_backend_new_task (ESource *source,
}
static void
-task_shell_backend_task_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell)
+task_shell_backend_task_new_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer shell)
{
CompEditorFlags flags = 0;
flags |= COMP_EDITOR_NEW_ITEM;
- task_shell_backend_new_task (E_SOURCE (source_object), result, shell, flags);
+ task_shell_backend_new_task (
+ E_SOURCE (source_object), result, shell, flags);
g_object_unref (shell);
}
static void
-task_shell_backend_task_assigned_new_cb (GObject *source_object, GAsyncResult *result, gpointer shell)
+task_shell_backend_task_assigned_new_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer shell)
{
CompEditorFlags flags = 0;
@@ -216,7 +228,8 @@ task_shell_backend_task_assigned_new_cb (GObject *source_object, GAsyncResult *r
flags |= COMP_EDITOR_IS_ASSIGNED;
flags |= COMP_EDITOR_USER_ORG;
- task_shell_backend_new_task (E_SOURCE (source_object), result, shell, flags);
+ task_shell_backend_new_task (
+ E_SOURCE (source_object), result, shell, flags);
g_object_unref (shell);
}
@@ -379,9 +392,13 @@ task_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 task sources: %s", G_STRFUNC, error ? error->message : "Unknown error");
- g_clear_error (&error);
+ e_cal_client_get_sources (&source_list, source_type, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Could not get task sources: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
goto exit;
}
@@ -393,13 +410,20 @@ task_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,8 +435,13 @@ task_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_error_free (error);
goto exit;
@@ -420,7 +449,7 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
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;
}
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index 3e693afd7e..7987071eb8 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -160,7 +160,9 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar,
}
static void
-task_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+task_shell_sidebar_retrieve_capabilies_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
ECalClient *client = E_CAL_CLIENT (source_object);
ETaskShellSidebar *task_shell_sidebar = user_data;
@@ -169,10 +171,12 @@ task_shell_sidebar_retrieve_capabilies_cb (GObject *source_object, GAsyncResult
g_return_if_fail (client != NULL);
g_return_if_fail (task_shell_sidebar != NULL);
- e_client_retrieve_capabilities_finish (E_CLIENT (client), result, &capabilities, NULL);
+ e_client_retrieve_capabilities_finish (
+ E_CLIENT (client), result, &capabilities, NULL);
g_free (capabilities);
- task_shell_sidebar_emit_status_message (task_shell_sidebar, _("Loading tasks"));
+ task_shell_sidebar_emit_status_message (
+ task_shell_sidebar, _("Loading tasks"));
task_shell_sidebar_emit_client_added (task_shell_sidebar, client);
task_shell_sidebar_emit_status_message (task_shell_sidebar, NULL);
}
@@ -200,15 +204,20 @@ free_retry_open_data (gpointer data)
}
static void
-task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+task_shell_sidebar_client_opened_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
ECalClient *client = E_CAL_CLIENT (source_object);
ETaskShellSidebar *task_shell_sidebar = user_data;
+ ESource *source;
EShellView *shell_view;
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
GError *error = NULL;
+ source = e_client_get_source (E_CLIENT (client));
+
e_client_open_finish (E_CLIENT (client), result, &error);
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
@@ -222,7 +231,10 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul
e_client_utils_forget_password (E_CLIENT (client));
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED)) {
- e_client_open (E_CLIENT (client), FALSE, task_shell_sidebar->priv->loading_clients, task_shell_sidebar_client_opened_cb, user_data);
+ e_client_open (
+ E_CLIENT (client), FALSE,
+ task_shell_sidebar->priv->loading_clients,
+ task_shell_sidebar_client_opened_cb, user_data);
g_clear_error (&error);
return;
}
@@ -236,7 +248,10 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul
rod->cancellable = g_object_ref (task_shell_sidebar->priv->loading_clients);
/* postpone for 1/2 of a second, backend is busy now */
- g_timeout_add_full (G_PRIORITY_DEFAULT, 500, task_shell_sidebar_retry_open_timeout_cb, rod, free_retry_open_data);
+ g_timeout_add_full (
+ G_PRIORITY_DEFAULT, 500,
+ task_shell_sidebar_retry_open_timeout_cb,
+ rod, free_retry_open_data);
g_clear_error (&error);
return;
@@ -252,7 +267,10 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul
break;
case E_CLIENT_ERROR_BUSY:
- g_debug ("%s: Cannot open '%s', it's busy (%s)", G_STRFUNC, e_source_peek_name (e_client_get_source (E_CLIENT (client))), error->message);
+ g_warning (
+ "%s: Cannot open '%s', it's busy (%s)",
+ G_STRFUNC, e_source_peek_name (source),
+ error->message);
g_clear_error (&error);
return;
@@ -281,7 +299,10 @@ task_shell_sidebar_client_opened_cb (GObject *source_object, GAsyncResult *resul
g_clear_error (&error);
/* to have them ready for later use */
- e_client_retrieve_capabilities (E_CLIENT (client), NULL, task_shell_sidebar_retrieve_capabilies_cb, task_shell_sidebar);
+ e_client_retrieve_capabilities (
+ E_CLIENT (client), NULL,
+ task_shell_sidebar_retrieve_capabilies_cb,
+ task_shell_sidebar);
}
static gboolean
@@ -297,14 +318,21 @@ task_shell_sidebar_retry_open_timeout_cb (gpointer user_data)
if (g_cancellable_is_cancelled (rod->cancellable))
return FALSE;
- e_client_open (rod->client, FALSE, rod->task_shell_sidebar->priv->loading_clients, task_shell_sidebar_client_opened_cb, rod->task_shell_sidebar);
+ e_client_open (
+ rod->client, FALSE,
+ rod->task_shell_sidebar->priv->loading_clients,
+ task_shell_sidebar_client_opened_cb,
+ rod->task_shell_sidebar);
return FALSE;
}
static void
-task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+task_shell_sidebar_default_loaded_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
+ ESource *source = E_SOURCE (source_object);
EShellSidebar *shell_sidebar = user_data;
ETaskShellSidebarPrivate *priv;
EShellContent *shell_content;
@@ -316,21 +344,22 @@ task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu
priv = E_TASK_SHELL_SIDEBAR (shell_sidebar)->priv;
- if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error))
- client = NULL;
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ task_shell_content = E_TASK_SHELL_CONTENT (shell_content);
+ model = e_task_shell_content_get_task_model (task_shell_content);
+
+ e_client_utils_open_new_finish (source, result, &client, &error);
+ /* Ignore cancellations. */
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_warn_if_fail (client == NULL);
g_error_free (error);
goto exit;
- }
-
- shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- shell_content = e_shell_view_get_shell_content (shell_view);
- task_shell_content = E_TASK_SHELL_CONTENT (shell_content);
- model = e_task_shell_content_get_task_model (task_shell_content);
- if (error != NULL) {
+ } else if (error != NULL) {
+ g_warn_if_fail (client == NULL);
e_alert_submit (
E_ALERT_SINK (shell_content),
"calendar:failed-open-tasks",
@@ -346,7 +375,8 @@ task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu
priv->default_client = E_CAL_CLIENT (client);
- e_cal_client_set_default_timezone (priv->default_client, e_cal_model_get_timezone (model));
+ e_cal_client_set_default_timezone (
+ priv->default_client, e_cal_model_get_timezone (model));
g_object_notify (G_OBJECT (shell_sidebar), "default-client");
@@ -395,9 +425,13 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar,
priv->loading_default_client = g_cancellable_new ();
- e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_TASKS, FALSE, priv->loading_default_client,
- e_client_utils_authenticate_handler, GTK_WINDOW (shell_window),
- task_shell_sidebar_default_loaded_cb, g_object_ref (shell_sidebar));
+ e_client_utils_open_new (
+ source, E_CLIENT_SOURCE_TYPE_TASKS,
+ FALSE, priv->loading_default_client,
+ e_client_utils_authenticate_handler,
+ GTK_WINDOW (shell_window),
+ task_shell_sidebar_default_loaded_cb,
+ g_object_ref (shell_sidebar));
}
static void
@@ -696,13 +730,14 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
can_delete = !is_system;
delete_prop = e_source_get_property (source, "delete");
- can_delete = can_delete && (delete_prop == NULL || strcmp (delete_prop, "no") != 0);
+ can_delete = can_delete &&
+ (delete_prop == NULL || strcmp (delete_prop, "no") != 0);
client = g_hash_table_lookup (
task_shell_sidebar->priv->client_table,
e_source_peek_uid (source));
- refresh_supported =
- client && e_client_check_refresh_supported (E_CLIENT (client));
+ refresh_supported = client &&
+ e_client_check_refresh_supported (E_CLIENT (client));
}
if (source != NULL)
@@ -950,7 +985,9 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
if (client == NULL) {
client = e_cal_client_new (source, source_type, NULL);
if (client)
- g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+ g_signal_connect (
+ client, "authenticate",
+ G_CALLBACK (e_client_utils_authenticate_handler), NULL);
}
g_return_if_fail (client != NULL);
@@ -985,7 +1022,11 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
timezone = e_cal_model_get_timezone (model);
e_cal_client_set_default_timezone (client, timezone);
- e_client_open (E_CLIENT (client), FALSE, task_shell_sidebar->priv->loading_clients, task_shell_sidebar_client_opened_cb, task_shell_sidebar);
+
+ e_client_open (
+ E_CLIENT (client), FALSE,
+ task_shell_sidebar->priv->loading_clients,
+ task_shell_sidebar_client_opened_cb, task_shell_sidebar);
}
void
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index 4938452309..1fb4867205 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -193,14 +193,19 @@ action_task_list_delete_cb (GtkAction *action,
uri = e_source_get_uri (source);
client = e_cal_model_get_client_for_uri (model, uri);
if (client == NULL)
- client = e_cal_client_new_from_uri (uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL);
+ client = e_cal_client_new_from_uri (
+ uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL);
g_free (uri);
g_return_if_fail (client != NULL);
- if (!e_client_remove_sync (E_CLIENT (client), NULL, &error)) {
- g_debug ("%s: Failed to remove client: %s", G_STRFUNC, error ? error->message : "Unknown error");
- g_clear_error (&error);
+ e_client_remove_sync (E_CLIENT (client), NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to remove client: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
return;
}
@@ -213,9 +218,13 @@ action_task_list_delete_cb (GtkAction *action,
source_group = e_source_peek_group (source);
e_source_group_remove_source (source_group, source);
- if (!e_source_list_sync (source_list, &error)) {
- g_debug ("%s: Failed to sync srouce list: %s", G_STRFUNC, error ? error->message : "Unknown error");
- g_clear_error (&error);
+ e_source_list_sync (source_list, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to sync srouce list: %s",
+ G_STRFUNC, error->message);
+ g_error_free (error);
}
}
@@ -313,9 +322,14 @@ action_task_list_refresh_cb (GtkAction *action,
g_return_if_fail (e_client_check_refresh_supported (E_CLIENT (client)));
- if (!e_client_refresh_sync (E_CLIENT (client), NULL, &error)) {
- g_debug ("%s: Failed to refresh '%s', %s", G_STRFUNC, e_source_peek_name (source), error ? error->message : "Unknown error");
- g_clear_error (&error);
+ e_client_refresh_sync (E_CLIENT (client), NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to refresh '%s', %s",
+ G_STRFUNC, e_source_peek_name (source),
+ error->message);
+ g_error_free (error);
}
}
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index 77e4beae1e..b8122786f2 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -479,8 +479,13 @@ e_task_shell_view_delete_completed (ETaskShellView *task_shell_view)
if (e_client_is_readonly (E_CLIENT (client)))
continue;
- if (!e_cal_client_get_object_list_sync (client, sexp, &objects, NULL, &error)) {
- g_debug ("%s: Failed to get object list: %s", G_STRFUNC, error ? error->message : "Unknown error");
+ e_cal_client_get_object_list_sync (
+ client, sexp, &objects, NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to get object list: %s",
+ G_STRFUNC, error->message);
g_clear_error (&error);
continue;
}
@@ -490,8 +495,15 @@ e_task_shell_view_delete_completed (ETaskShellView *task_shell_view)
const gchar *uid;
uid = icalcomponent_get_uid (component);
- if (!e_cal_client_remove_object_sync (client, uid, NULL, CALOBJ_MOD_THIS, NULL, &error)) {
- g_debug ("%s: Failed to remove object: %s", G_STRFUNC, error ? error->message : "Unknown error");
+
+ e_cal_client_remove_object_sync (
+ client, uid, NULL,
+ CALOBJ_MOD_THIS, NULL, &error);
+
+ if (error != NULL) {
+ g_warning (
+ "%s: Failed to remove object: %s",
+ G_STRFUNC, error->message);
g_clear_error (&error);
}