Ejemplo n.º 1
0
static void
mail_shell_view_got_folder_cb (CamelStore *store,
                               GAsyncResult *result,
                               AsyncContext *context)
{
	EAlertSink *alert_sink;
	CamelFolder *folder;
	GError *error = NULL;

	alert_sink = e_activity_get_alert_sink (context->activity);

	folder = camel_store_get_folder_finish (store, result, &error);

	if (e_activity_handle_cancellation (context->activity, error)) {
		g_warn_if_fail (folder == NULL);
		async_context_free (context);
		g_error_free (error);
		return;

	} else if (error != NULL) {
		g_warn_if_fail (folder == NULL);
		e_alert_submit (
			alert_sink, "mail:folder-open",
			error->message, NULL);
		async_context_free (context);
		g_error_free (error);
		return;
	}

	e_mail_reader_set_folder (context->reader, folder);
	e_shell_view_update_actions_in_idle (context->shell_view);

	g_object_unref (folder);

	async_context_free (context);
}
Ejemplo n.º 2
0
static void
source_util_remove_cb (GObject *source_object,
                       GAsyncResult *result,
                       gpointer user_data)
{
	ESource *source;
	EActivity *activity;
	EAlertSink *alert_sink;
	AsyncContext *async_context;
	const gchar *display_name;
	GError *error = NULL;

	source = E_SOURCE (source_object);
	async_context = (AsyncContext *) user_data;

	activity = async_context->activity;
	alert_sink = e_activity_get_alert_sink (activity);
	display_name = e_source_get_display_name (source);

	e_source_remove_finish (source, result, &error);

	if (e_activity_handle_cancellation (activity, error)) {
		g_error_free (error);

	} else if (error != NULL) {
		e_alert_submit (
			alert_sink,
			"system:remove-source-fail",
			display_name, error->message, NULL);
		g_error_free (error);

	} else {
		e_activity_set_state (activity, E_ACTIVITY_COMPLETED);
	}

	async_context_free (async_context);
}