From 763081aa862908e845bc780b784d939a07abd508 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 30 Jan 2013 12:20:16 -0500 Subject: Fix up error handling around e_book/cal_client_connect_finish(). --- calendar/alarm-notify/alarm-notify.c | 9 ++++----- calendar/gui/dialogs/event-page.c | 10 +--------- calendar/gui/dialogs/memo-page.c | 10 +--------- calendar/gui/dialogs/task-page.c | 10 +--------- calendar/gui/e-calendar-selector.c | 4 +--- calendar/gui/e-memo-list-selector.c | 8 ++------ calendar/gui/e-task-list-selector.c | 8 ++------ calendar/importers/icalendar-importer.c | 4 +--- 8 files changed, 13 insertions(+), 50 deletions(-) (limited to 'calendar') diff --git a/calendar/alarm-notify/alarm-notify.c b/calendar/alarm-notify/alarm-notify.c index a4552a055b..73fadc100c 100644 --- a/calendar/alarm-notify/alarm-notify.c +++ b/calendar/alarm-notify/alarm-notify.c @@ -229,9 +229,9 @@ client_connect_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { - ESource *source = E_SOURCE (source_object); AlarmNotify *an = ALARM_NOTIFY (user_data); EClient *client; + ESource *source; ECalClient *cal_client; GError *error = NULL; @@ -243,14 +243,13 @@ client_connect_cb (GObject *source_object, ((client == NULL) && (error != NULL))); if (error != NULL) { - debug ( - ("Failed to open '%s' (%s): %s", - e_source_get_display_name (source), - e_source_get_uid (source), error->message)); + debug (("%s", error->message)); g_error_free (error); return; } + source = e_client_get_source (client); + g_hash_table_insert ( an->priv->clients, g_object_ref (source), client); diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 6850a3b151..a65da3469b 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -3016,13 +3016,9 @@ epage_client_connect_cb (GObject *source_object, if (error) { GtkWidget *dialog; ECalClient *old_client; - ESource *source; old_client = comp_editor_get_client (editor); - source = e_source_combo_box_ref_active ( - E_SOURCE_COMBO_BOX (priv->source_combo_box)); - e_source_combo_box_set_active ( E_SOURCE_COMBO_BOX (priv->source_combo_box), e_client_get_source (E_CLIENT (old_client))); @@ -3030,14 +3026,10 @@ epage_client_connect_cb (GObject *source_object, dialog = gtk_message_dialog_new ( NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - _("Unable to open the calendar '%s': %s"), - e_source_get_display_name (source), - error->message); + "%s", error->message); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); - g_object_unref (source); - g_clear_error (&error); } else { gchar *backend_addr = NULL; diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index a93068cb14..54de19e954 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -970,13 +970,9 @@ mpage_client_connect_cb (GObject *source_object, if (error != NULL) { GtkWidget *dialog; ECalClient *old_client; - ESource *source; old_client = comp_editor_get_client (editor); - source = e_source_combo_box_ref_active ( - E_SOURCE_COMBO_BOX (priv->source_combo_box)); - e_source_combo_box_set_active ( E_SOURCE_COMBO_BOX (priv->source_combo_box), e_client_get_source (E_CLIENT (old_client))); @@ -984,14 +980,10 @@ mpage_client_connect_cb (GObject *source_object, dialog = gtk_message_dialog_new ( NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - _("Unable to open memos in '%s': %s"), - e_source_get_display_name (source), - error->message); + "%s", error->message); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); - g_object_unref (source); - g_clear_error (&error); } else { icaltimezone *zone; diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index b728b6f873..af13c3eaf8 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1812,13 +1812,9 @@ tpage_client_connect_cb (GObject *source_object, if (error) { GtkWidget *dialog; ECalClient *old_client; - ESource *source; old_client = comp_editor_get_client (editor); - source = e_source_combo_box_ref_active ( - E_SOURCE_COMBO_BOX (priv->source_combo_box)); - e_source_combo_box_set_active ( E_SOURCE_COMBO_BOX (priv->source_combo_box), e_client_get_source (E_CLIENT (old_client))); @@ -1826,14 +1822,10 @@ tpage_client_connect_cb (GObject *source_object, dialog = gtk_message_dialog_new ( NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - _("Unable to open tasks in '%s': %s"), - e_source_get_display_name (source), - error->message); + "%s", error->message); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); - g_object_unref (source); - g_clear_error (&error); } else { icaltimezone *zone; diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c index 798280f852..c0bbb4cc7b 100644 --- a/calendar/gui/e-calendar-selector.c +++ b/calendar/gui/e-calendar-selector.c @@ -135,9 +135,7 @@ client_connect_cb (GObject *source_object, ((client == NULL) && (error != NULL))); if (error != NULL) { - g_warning ( - "%s: Failed to open client: %s", - G_STRFUNC, error->message); + g_warning ("%s: %s", G_STRFUNC, error->message); g_error_free (error); } diff --git a/calendar/gui/e-memo-list-selector.c b/calendar/gui/e-memo-list-selector.c index 74ca1d1b64..b5fd4216e0 100644 --- a/calendar/gui/e-memo-list-selector.c +++ b/calendar/gui/e-memo-list-selector.c @@ -136,9 +136,7 @@ client_connect_cb (GObject *source_object, ((client == NULL) && (error != NULL))); if (error != NULL) { - g_warning ( - "%s: Failed to open memo list: %s", - G_STRFUNC, error->message); + g_warning ("%s: %s", G_STRFUNC, error->message); g_error_free (error); goto exit; } @@ -246,9 +244,7 @@ client_connect_for_drop_cb (GObject *source_object, ((client == NULL) && (error != NULL))); if (error != NULL) { - g_warning ( - "%s: Failed to open memo list: %s", - G_STRFUNC, error->message); + g_warning ("%s: %s", G_STRFUNC, error->message); g_error_free (error); goto exit; } diff --git a/calendar/gui/e-task-list-selector.c b/calendar/gui/e-task-list-selector.c index 151967f7f4..c82ef4097c 100644 --- a/calendar/gui/e-task-list-selector.c +++ b/calendar/gui/e-task-list-selector.c @@ -137,9 +137,7 @@ client_connect_cb (GObject *source_object, ((client == NULL) && (error != NULL))); if (error != NULL) { - g_warning ( - "%s: Failed to open task list: %s", - G_STRFUNC, error->message); + g_warning ("%s: %s", G_STRFUNC, error->message); g_error_free (error); goto exit; } @@ -248,9 +246,7 @@ client_connect_for_drop_cb (GObject *source_object, ((client == NULL) && (error != NULL))); if (error != NULL) { - g_warning ( - "%s: Failed to open task list: %s", - G_STRFUNC, error->message); + g_warning ("%s: %s", G_STRFUNC, error->message); g_error_free (error); goto exit; } diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c index 96c10bd6ab..4d8657df5b 100644 --- a/calendar/importers/icalendar-importer.c +++ b/calendar/importers/icalendar-importer.c @@ -429,9 +429,7 @@ ivcal_connect_cb (GObject *source_object, ((client == NULL) && (error != NULL))); if (error != NULL) { - g_warning ( - "%s: Failed to open calendar: %s", - G_STRFUNC, error->message); + g_warning ("%s: %s", G_STRFUNC, error->message); g_error_free (error); ivcal_import_done (ici); return; -- cgit