static void
task_shell_view_backend_error_cb (EClientCache *client_cache,
                                  EClient *client,
                                  EAlert *alert,
                                  ETaskShellView *task_shell_view)
{
	ETaskShellContent *task_shell_content;
	ESource *source;
	const gchar *extension_name;

	task_shell_content = task_shell_view->priv->task_shell_content;

	source = e_client_get_source (client);
	extension_name = E_SOURCE_EXTENSION_TASK_LIST;

	/* Only submit alerts from task list backends. */
	if (e_source_has_extension (source, extension_name)) {
		EAlertSink *alert_sink;

		alert_sink = E_ALERT_SINK (task_shell_content);
		e_alert_sink_submit_alert (alert_sink, alert);
	}
}
static void
cal_shell_view_backend_error_cb (EClientCache *client_cache,
                                 EClient *client,
                                 EAlert *alert,
                                 ECalShellView *cal_shell_view)
{
	ECalShellContent *cal_shell_content;
	ESource *source;
	const gchar *extension_name;

	cal_shell_content = cal_shell_view->priv->cal_shell_content;

	source = e_client_get_source (client);
	extension_name = E_SOURCE_EXTENSION_CALENDAR;

	/* Only submit alerts from calendar backends. */
	if (e_source_has_extension (source, extension_name)) {
		EAlertSink *alert_sink;

		alert_sink = E_ALERT_SINK (cal_shell_content);
		e_alert_sink_submit_alert (alert_sink, alert);
	}
}
static gboolean
report_error_to_ui_cb (gpointer user_data)
{
	struct ReportErrorToUIData *data = user_data;
	EShellView *shell_view = NULL;

	g_return_val_if_fail (data != NULL, FALSE);
	g_return_val_if_fail (data->display_name != NULL, FALSE);
	g_return_val_if_fail (data->error_ident != NULL, FALSE);
	g_return_val_if_fail (data->error != NULL, FALSE);

	if (send_recv_dialog) {
		GtkWidget *parent;

		parent = gtk_widget_get_parent (send_recv_dialog);
		if (parent && E_IS_SHELL_WINDOW (parent)) {
			EShellWindow *shell_window = E_SHELL_WINDOW (parent);

			shell_view = e_shell_window_get_shell_view (shell_window, "mail");
		}
	}

	if (!shell_view) {
		EShell *shell;
		GtkWindow *active_window;

		shell = e_shell_get_default ();
		active_window = e_shell_get_active_window (shell);

		if (E_IS_SHELL_WINDOW (active_window)) {
			EShellWindow *shell_window = E_SHELL_WINDOW (active_window);

			shell_view = e_shell_window_get_shell_view (shell_window, "mail");
		}
	}

	if (shell_view) {
		EShellContent *shell_content;
		EAlertSink *alert_sink;
		EAlert *alert;

		shell_content = e_shell_view_get_shell_content (shell_view);
		alert_sink = E_ALERT_SINK (shell_content);

		alert = e_alert_new (data->error_ident, data->display_name, data->error->message, NULL);

		e_alert_sink_submit_alert (alert_sink, alert);

		g_object_unref (alert);
	} else {
		/* This may not happen, but just in case... */
		g_warning ("%s: %s '%s': %s\n", G_STRFUNC, data->error_ident, data->display_name, data->error->message);
	}

	g_free (data->display_name);
	g_free (data->error_ident);
	g_error_free (data->error);
	g_free (data);

	return FALSE;
}