[evolution] Fix up error handling around e_book/cal_client_connect_finish().



commit 763081aa862908e845bc780b784d939a07abd508
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Jan 30 12:20:16 2013 -0500

    Fix up error handling around e_book/cal_client_connect_finish().

 addressbook/gui/contact-editor/e-contact-editor.c  |   44 ++++++++++++++++----
 .../gui/contact-editor/e-contact-quick-add.c       |   10 ++--
 .../contact-list-editor/e-contact-list-editor.c    |   31 +++++++++++---
 addressbook/gui/widgets/e-addressbook-selector.c   |    4 +-
 addressbook/gui/widgets/eab-gui-util.c             |    4 +-
 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 +-
 e-util/e-name-selector-dialog.c                    |    9 +---
 e-util/e-name-selector-entry.c                     |    2 +-
 e-util/e-name-selector.c                           |    5 +--
 modules/addressbook/e-book-shell-backend.c         |    8 +---
 modules/calendar/e-cal-attachment-handler.c        |   12 +----
 modules/calendar/e-cal-shell-backend.c             |    5 +--
 modules/calendar/e-memo-shell-backend.c            |    5 +--
 modules/calendar/e-task-shell-backend.c            |    5 +--
 modules/itip-formatter/itip-view.c                 |   23 ++++-------
 modules/vcard-inline/e-mail-parser-vcard-inline.c  |    4 +-
 plugins/pst-import/pst-importer.c                  |    2 +-
 24 files changed, 101 insertions(+), 135 deletions(-)
---
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index a0bd221..0f3aef0 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -63,6 +63,11 @@ enum {
 	NUM_IM_COLUMNS
 };
 
+typedef struct {
+	EContactEditor *editor;
+	ESource *source;
+} ConnectClosure;
+
 static void	e_contact_editor_set_property	(GObject *object,
 						 guint property_id,
 						 const GValue *value,
@@ -196,6 +201,18 @@ static const gint email_default[] = { 0, 1, 2, 2 };
 G_DEFINE_TYPE (EContactEditor, e_contact_editor, EAB_TYPE_EDITOR)
 
 static void
+connect_closure_free (ConnectClosure *connect_closure)
+{
+	if (connect_closure->editor != NULL)
+		g_object_unref (connect_closure->editor);
+
+	if (connect_closure->source != NULL)
+		g_object_unref (connect_closure->source);
+
+	g_slice_free (ConnectClosure, connect_closure);
+}
+
+static void
 e_contact_editor_contact_added (EABEditor *editor,
                                 const GError *error,
                                 EContact *contact)
@@ -3088,8 +3105,7 @@ contact_editor_client_connect_cb (GObject *source_object,
                                   GAsyncResult *result,
                                   gpointer user_data)
 {
-	ESource *source = E_SOURCE (source_object);
-	EContactEditor *editor = user_data;
+	ConnectClosure *closure = user_data;
 	EClient *client;
 	GError *error = NULL;
 
@@ -3110,31 +3126,37 @@ contact_editor_client_connect_cb (GObject *source_object,
 		GtkWidget *source_combo_box;
 		GtkWindow *parent;
 
-		parent = eab_editor_get_window (EAB_EDITOR (editor));
-		eab_load_error_dialog (GTK_WIDGET (parent), NULL, source, error);
+		parent = eab_editor_get_window (EAB_EDITOR (closure->editor));
+
+		eab_load_error_dialog (
+			GTK_WIDGET (parent), NULL,
+			closure->source, error);
 
 		source_combo_box = e_builder_get_widget (
-			editor->builder, "source-combo-box-source");
+			closure->editor->builder,
+			"source-combo-box-source");
 		e_source_combo_box_set_active (
-			E_SOURCE_COMBO_BOX (source_combo_box), source);
+			E_SOURCE_COMBO_BOX (source_combo_box),
+			closure->source);
 
 		g_error_free (error);
 		goto exit;
 	}
 
 	/* FIXME Write a private contact_editor_set_target_client(). */
-	g_object_set (editor, "target_client", client, NULL);
+	g_object_set (closure->editor, "target_client", client, NULL);
 
 	g_object_unref (client);
 
 exit:
-	g_object_unref (editor);
+	connect_closure_free (closure);
 }
 
 static void
 source_changed (ESourceComboBox *source_combo_box,
                 EContactEditor *editor)
 {
+	ConnectClosure *closure;
 	ESource *target_source;
 	ESource *source_source;
 	ESource *source;
@@ -3163,10 +3185,14 @@ source_changed (ESourceComboBox *source_combo_box,
 
 	editor->cancellable = g_cancellable_new ();
 
+	closure = g_slice_new0 (ConnectClosure);
+	closure->editor = g_object_ref (editor);
+	closure->source = g_object_ref (source);
+
 	e_book_client_connect (
 		source, editor->cancellable,
 		contact_editor_client_connect_cb,
-		g_object_ref (editor));
+		closure);
 
 exit:
 	g_object_unref (source);
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index afbd817..0bfa46b 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -124,7 +124,6 @@ merge_cb (GObject *source_object,
           GAsyncResult *result,
           gpointer user_data)
 {
-	ESource *source = E_SOURCE (source_object);
 	QuickAdd *qa = user_data;
 	EClient *client;
 	GError *error = NULL;
@@ -156,12 +155,15 @@ merge_cb (GObject *source_object,
 		eab_merging_book_add_contact (
 			qa->registry, E_BOOK_CLIENT (client),
 			qa->contact, NULL, NULL);
-	else
+	else {
+		ESource *source = e_client_get_source (client);
+
 		e_alert_run_dialog_for_args (
 			e_shell_get_active_window (NULL),
 			"addressbook:error-read-only",
 			e_source_get_display_name (source),
 			NULL);
+	}
 
 	if (qa->cb)
 		qa->cb (qa->contact, qa->closure);
@@ -299,9 +301,7 @@ ce_have_book (GObject *source_object,
 	}
 
 	if (error != NULL) {
-		g_warning (
-			"Couldn't open local address book (%s).",
-			error->message);
+		g_warning ("%s", error->message);
 		quick_add_unref (qa);
 		g_error_free (error);
 		return;
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 6f92e51..d160563 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -134,8 +134,25 @@ struct _EContactListEditorPrivate {
 	guint in_async_call : 1;
 };
 
+typedef struct {
+	EContactListEditor *editor;
+	ESource *source;
+} ConnectClosure;
+
 G_DEFINE_TYPE (EContactListEditor, e_contact_list_editor, EAB_TYPE_EDITOR)
 
+static void
+connect_closure_free (ConnectClosure *connect_closure)
+{
+	if (connect_closure->editor != NULL)
+		g_object_unref (connect_closure->editor);
+
+	if (connect_closure->source != NULL)
+		g_object_unref (connect_closure->source);
+
+	g_slice_free (ConnectClosure, connect_closure);
+}
+
 static EContactListEditor *
 contact_list_editor_extract (GtkWidget *widget)
 {
@@ -305,9 +322,8 @@ contact_list_editor_client_connect_cb (GObject *source_object,
                                        GAsyncResult *result,
                                        gpointer user_data)
 {
-	ESource *source = E_SOURCE (source_object);
-	EContactListEditor *editor = user_data;
-	EContactListEditorPrivate *priv = editor->priv;
+	ConnectClosure *closure = user_data;
+	EContactListEditor *editor = closure->editor;
 	EContactStore *contact_store;
 	ENameSelectorEntry *entry;
 	EClient *client;
@@ -325,11 +341,14 @@ contact_list_editor_client_connect_cb (GObject *source_object,
 		GtkWindow *parent;
 
 		parent = eab_editor_get_window (EAB_EDITOR (editor));
-		eab_load_error_dialog (GTK_WIDGET (parent), NULL, source, error);
+
+		eab_load_error_dialog (
+			GTK_WIDGET (parent), NULL,
+			closure->source, error);
 
 		e_source_combo_box_set_active (
 			E_SOURCE_COMBO_BOX (WIDGET (SOURCE_MENU)),
-			e_client_get_source (E_CLIENT (priv->book_client)));
+			closure->source);
 
 		g_error_free (error);
 		goto exit;
@@ -345,7 +364,7 @@ contact_list_editor_client_connect_cb (GObject *source_object,
 	g_object_unref (client);
 
 exit:
-	g_object_unref (editor);
+	connect_closure_free (closure);
 }
 
 static void
diff --git a/addressbook/gui/widgets/e-addressbook-selector.c b/addressbook/gui/widgets/e-addressbook-selector.c
index eedc776..73a3334 100644
--- a/addressbook/gui/widgets/e-addressbook-selector.c
+++ b/addressbook/gui/widgets/e-addressbook-selector.c
@@ -265,9 +265,7 @@ target_client_connect_cb (GObject *source_object,
 		((client == NULL) && (error != NULL)));
 
 	if (error != NULL) {
-		g_warning (
-			"%s: Failed to open targer client: %s",
-			G_STRFUNC, error->message);
+		g_warning ("%s: %s", G_STRFUNC, error->message);
 		g_error_free (error);
 	}
 
diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c
index 2f0f29e..2967ca9 100644
--- a/addressbook/gui/widgets/eab-gui-util.c
+++ b/addressbook/gui/widgets/eab-gui-util.c
@@ -540,9 +540,7 @@ book_client_connect_cb (GObject *source_object,
 		((client == NULL) && (error != NULL)));
 
 	if (error != NULL) {
-		g_warning (
-			"%s: Failed to open destination client: %s",
-			G_STRFUNC, error->message);
+		g_warning ("%s: %s", G_STRFUNC, error->message);
 		g_error_free (error);
 		goto exit;
 	}
diff --git a/calendar/alarm-notify/alarm-notify.c b/calendar/alarm-notify/alarm-notify.c
index a4552a0..73fadc1 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 6850a3b..a65da34 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 a93068c..54de19e 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 b728b6f..af13c3e 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 798280f..c0bbb4c 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 74ca1d1..b5fd421 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 151967f..c82ef40 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 96c10bd..4d8657d 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;
diff --git a/e-util/e-name-selector-dialog.c b/e-util/e-name-selector-dialog.c
index 36b426b..fd72818 100644
--- a/e-util/e-name-selector-dialog.c
+++ b/e-util/e-name-selector-dialog.c
@@ -1157,14 +1157,9 @@ book_client_connect_cb (GObject *source_object,
 	}
 
 	if (error != NULL) {
-		gchar *message;
-
-		message = g_strdup_printf (
-			_("Error loading address book: %s"), error->message);
 		gtk_label_set_text (
-			name_selector_dialog->priv->status_label, message);
-		g_free (message);
-
+			name_selector_dialog->priv->status_label,
+			error->message);
 		g_error_free (error);
 		goto exit;
 	}
diff --git a/e-util/e-name-selector-entry.c b/e-util/e-name-selector-entry.c
index 58c7b39..25b0183 100644
--- a/e-util/e-name-selector-entry.c
+++ b/e-util/e-name-selector-entry.c
@@ -2227,7 +2227,7 @@ book_client_connect_cb (GObject *source_object,
 	}
 
 	if (error != NULL) {
-		g_warning ("%s", error->message);
+		g_warning ("%s: %s", G_STRFUNC, error->message);
 		g_error_free (error);
 		goto exit;
 	}
diff --git a/e-util/e-name-selector.c b/e-util/e-name-selector.c
index 66d9351..21cd93c 100644
--- a/e-util/e-name-selector.c
+++ b/e-util/e-name-selector.c
@@ -95,7 +95,6 @@ name_selector_book_client_connect_cb (GObject *source_object,
                                       gpointer user_data)
 {
 	ENameSelector *name_selector = user_data;
-	ESource *source = E_SOURCE (source_object);
 	EBookClient *book_client;
 	EClient *client;
 	GArray *sections;
@@ -115,9 +114,7 @@ name_selector_book_client_connect_cb (GObject *source_object,
 		    && !g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_OFFLINE_UNAVAILABLE)
 		    && !g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)
 		    && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-			g_warning (
-				"ENameSelector: Could not load \"%s\": %s",
-				e_source_get_display_name (source), error->message);
+			g_warning ("%s: %s", G_STRFUNC, error->message);
 		g_error_free (error);
 		goto exit;
 	}
diff --git a/modules/addressbook/e-book-shell-backend.c b/modules/addressbook/e-book-shell-backend.c
index 3cc5c9d..4de01f9 100644
--- a/modules/addressbook/e-book-shell-backend.c
+++ b/modules/addressbook/e-book-shell-backend.c
@@ -108,9 +108,7 @@ book_shell_backend_new_contact_cb (GObject *source_object,
 
 	/* XXX Handle errors better. */
 	if (error != NULL) {
-		g_warning (
-			"%s: Failed to open book: %s",
-			G_STRFUNC, error->message);
+		g_warning ("%s: %s", G_STRFUNC, error->message);
 		g_error_free (error);
 		goto exit;
 	}
@@ -149,9 +147,7 @@ book_shell_backend_new_contact_list_cb (GObject *source_object,
 
 	/* XXX Handle errors better. */
 	if (error != NULL) {
-		g_warning (
-			"%s: Failed to open book: %s",
-			G_STRFUNC, error->message);
+		g_warning ("%s: %s", G_STRFUNC, error->message);
 		g_error_free (error);
 		goto exit;
 	}
diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c
index d16f4a6..539a5ba 100644
--- a/modules/calendar/e-cal-attachment-handler.c
+++ b/modules/calendar/e-cal-attachment-handler.c
@@ -169,7 +169,6 @@ attachment_handler_import_event (GObject *source_object,
                                  GAsyncResult *result,
                                  gpointer user_data)
 {
-	ESource *source = E_SOURCE (source_object);
 	EAttachment *attachment = user_data;
 	EClient *client;
 	icalcomponent *component;
@@ -185,10 +184,7 @@ attachment_handler_import_event (GObject *source_object,
 		((client == NULL) && (error != NULL)));
 
 	if (error != NULL) {
-		g_warning (
-			"%s: Failed to open '%s': %s",
-			G_STRFUNC, e_source_get_display_name (source),
-			error->message);
+		g_warning ("%s: %s", G_STRFUNC, error->message);
 		g_object_unref (attachment);
 		g_error_free (error);
 		return;
@@ -227,7 +223,6 @@ attachment_handler_import_todo (GObject *source_object,
                                 GAsyncResult *result,
                                 gpointer user_data)
 {
-	ESource *source = E_SOURCE (source_object);
 	EAttachment *attachment = user_data;
 	EClient *client;
 	icalcomponent *component;
@@ -243,10 +238,7 @@ attachment_handler_import_todo (GObject *source_object,
 		((client == NULL) && (error != NULL)));
 
 	if (error != NULL) {
-		g_warning (
-			"%s: Failed to open '%s': %s",
-			G_STRFUNC, e_source_get_display_name (source),
-			error->message);
+		g_warning ("%s: %s", G_STRFUNC, error->message);
 		g_object_unref (attachment);
 		g_error_free (error);
 		return;
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index 4d9eee6..f2453e9 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -83,10 +83,7 @@ cal_shell_backend_new_event (ESource *source,
 
 	/* XXX Handle errors better. */
 	if (error != NULL) {
-		g_warning (
-			"%s: Failed to open '%s': %s",
-			G_STRFUNC, e_source_get_display_name (source),
-			error->message);
+		g_warning ("%s: %s", G_STRFUNC, error->message);
 		g_error_free (error);
 		return;
 	}
diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c
index 6f3d481..7ac64a9 100644
--- a/modules/calendar/e-memo-shell-backend.c
+++ b/modules/calendar/e-memo-shell-backend.c
@@ -77,10 +77,7 @@ memo_shell_backend_new_memo (ESource *source,
 
 	/* XXX Handle errors better. */
 	if (error != NULL) {
-		g_warning (
-			"%s: Failed to open '%s': %s",
-			G_STRFUNC, e_source_get_display_name (source),
-			error->message);
+		g_warning ("%s: %s", G_STRFUNC, error->message);
 		g_error_free (error);
 		return;
 	}
diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c
index 831e35d..6fbd2af 100644
--- a/modules/calendar/e-task-shell-backend.c
+++ b/modules/calendar/e-task-shell-backend.c
@@ -75,10 +75,7 @@ task_shell_backend_new_task (ESource *source,
 
 	/* XXX Handle errors better. */
 	if (error != NULL) {
-		g_warning (
-			"%s: Failed to open '%s': %s",
-			G_STRFUNC, e_source_get_display_name (source),
-			error->message);
+		g_warning ("%s: %s", G_STRFUNC, error->message);
 		g_error_free (error);
 		return;
 	}
diff --git a/modules/itip-formatter/itip-view.c b/modules/itip-formatter/itip-view.c
index a996b1e..1a8742b 100644
--- a/modules/itip-formatter/itip-view.c
+++ b/modules/itip-formatter/itip-view.c
@@ -3489,22 +3489,13 @@ set_buttons_sensitive (EMailPartItip *pitip,
 
 static void
 add_failed_to_load_msg (ItipView *view,
-                        ESource *source,
                         const GError *error)
 {
-	gchar *msg;
-
 	g_return_if_fail (view != NULL);
-	g_return_if_fail (source != NULL);
 	g_return_if_fail (error != NULL);
 
-	/* Translators: The first '%s' is replaced with a calendar name,
-	 * the second '%s' with an error message */
-	msg = g_strdup_printf (_("Failed to load the calendar '%s' (%s)"), e_source_get_display_name (source), error->message);
-
-	itip_view_add_lower_info_item (view, ITIP_VIEW_INFO_ITEM_TYPE_WARNING, msg);
-
-	g_free (msg);
+	itip_view_add_lower_info_item (
+		view, ITIP_VIEW_INFO_ITEM_TYPE_WARNING, error->message);
 }
 
 static void
@@ -3512,11 +3503,11 @@ cal_opened_cb (GObject *source_object,
                GAsyncResult *result,
                gpointer user_data)
 {
-	ESource *source = E_SOURCE (source_object);
 	ItipView *view = user_data;
 	EMailPartItip *pitip = itip_view_get_mail_part (view);
 	ECalClientSourceType source_type;
 	EClient *client;
+	ESource *source;
 	ECalClient *cal_client;
 	const gchar *uid;
 	GError *error = NULL;
@@ -3535,7 +3526,7 @@ cal_opened_cb (GObject *source_object,
 		return;
 
 	} else if (error != NULL) {
-		add_failed_to_load_msg (view, source, error);
+		add_failed_to_load_msg (view, error);
 		g_error_free (error);
 		return;
 	}
@@ -3543,6 +3534,7 @@ cal_opened_cb (GObject *source_object,
 	cal_client = E_CAL_CLIENT (client);
 	g_return_if_fail (cal_client != NULL);
 
+	source = e_client_get_source (client);
 	uid = e_source_get_uid (source);
 	source_type = e_cal_client_get_source_type (cal_client);
 	g_hash_table_insert (
@@ -3984,12 +3976,12 @@ find_cal_opened_cb (GObject *source_object,
                     GAsyncResult *result,
                     gpointer user_data)
 {
-	ESource *source = E_SOURCE (source_object);
 	FormatItipFindData *fd = user_data;
 	EMailPartItip *pitip = fd->puri;
 	ItipView *view = fd->view;
 	ECalClientSourceType source_type;
 	EClient *client;
+	ESource *source;
 	ECalClient *cal_client;
 	gboolean search_for_conflicts = FALSE;
 	const gchar *extension_name;
@@ -4021,7 +4013,7 @@ find_cal_opened_cb (GObject *source_object,
 		/* FIXME Do we really want to warn here?  If we fail
 		 * to find the item, this won't be cleared but the
 		 * selector might be shown */
-		add_failed_to_load_msg (view, source, error);
+		add_failed_to_load_msg (view, error);
 		decrease_find_data (fd);
 		g_error_free (error);
 		return;
@@ -4037,6 +4029,7 @@ find_cal_opened_cb (GObject *source_object,
 	cal_client = E_CAL_CLIENT (client);
 	source_type = e_cal_client_get_source_type (cal_client);
 
+	source = e_client_get_source (client);
 	uid = e_source_get_uid (source);
 	g_hash_table_insert (
 		pitip->clients[source_type], g_strdup (uid), cal_client);
diff --git a/modules/vcard-inline/e-mail-parser-vcard-inline.c b/modules/vcard-inline/e-mail-parser-vcard-inline.c
index 2580059..00fed5b 100644
--- a/modules/vcard-inline/e-mail-parser-vcard-inline.c
+++ b/modules/vcard-inline/e-mail-parser-vcard-inline.c
@@ -113,9 +113,7 @@ client_connect_cb (GObject *source_object,
 		((client == NULL) && (error != NULL)));
 
 	if (error != NULL) {
-		g_warning (
-			"%s: Failed to open book client: %s",
-			G_STRFUNC, error->message);
+		g_warning ("%s: %s", G_STRFUNC, error->message);
 		g_error_free (error);
 		goto exit;
 	}
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index 4654a8e..17f9eed 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -611,7 +611,7 @@ client_connect_cb (GObject *source_object,
 		((client == NULL) && (error != NULL)));
 
 	if (error)
-		g_debug ("%s: Failed to open client: %s", G_STRFUNC, error->message);
+		g_debug ("%s: %s", G_STRFUNC, error->message);
 	g_clear_error (&error);
 
 	if (client) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]