/* AsyncTask.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from AsyncTask.vala, do not modify */

/* AsyncTask.vala
 *
 * Copyright 2024 Diego Iván <diegoivan.mae@gmail.com>
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <glib-object.h>
#include <glib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

typedef struct _PaperClipAsyncTask PaperClipAsyncTask;
typedef enum  {
	PAPER_CLIP_TASK_STATUS_CANCELLED,
	PAPER_CLIP_TASK_STATUS_SUCCEEDED,
	PAPER_CLIP_TASK_STATUS_RUNNING
} PaperClipTaskStatus;

#define PAPER_CLIP_TYPE_TASK_STATUS (paper_clip_task_status_get_type ())

struct _PaperClipAsyncTask {
	PaperClipTaskStatus status;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
};

VALA_EXTERN void paper_clip_async_task_free (PaperClipAsyncTask * self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PaperClipAsyncTask, paper_clip_async_task_free)
VALA_EXTERN GType paper_clip_task_status_get_type (void) G_GNUC_CONST ;
static void paper_clip_async_task_instance_init (PaperClipAsyncTask * self);
VALA_EXTERN PaperClipAsyncTask* paper_clip_async_task_new (GSourceFunc callback,
                                               gpointer callback_target,
                                               GDestroyNotify callback_target_destroy_notify);

PaperClipAsyncTask*
paper_clip_async_task_new (GSourceFunc callback,
                           gpointer callback_target,
                           GDestroyNotify callback_target_destroy_notify)
{
	PaperClipAsyncTask* self;
	GSourceFunc _tmp0_;
	gpointer _tmp0__target;
	GDestroyNotify _tmp0__target_destroy_notify;
	self = g_slice_new0 (PaperClipAsyncTask);
	paper_clip_async_task_instance_init (self);
	_tmp0_ = callback;
	_tmp0__target = callback_target;
	_tmp0__target_destroy_notify = callback_target_destroy_notify;
	callback = NULL;
	callback_target = NULL;
	callback_target_destroy_notify = NULL;
	(self->callback_target_destroy_notify == NULL) ? NULL : (self->callback_target_destroy_notify (self->callback_target), NULL);
	self->callback = NULL;
	self->callback_target = NULL;
	self->callback_target_destroy_notify = NULL;
	self->callback = _tmp0_;
	self->callback_target = _tmp0__target;
	self->callback_target_destroy_notify = _tmp0__target_destroy_notify;
	(callback_target_destroy_notify == NULL) ? NULL : (callback_target_destroy_notify (callback_target), NULL);
	callback = NULL;
	callback_target = NULL;
	callback_target_destroy_notify = NULL;
	return self;
}

static void
paper_clip_async_task_instance_init (PaperClipAsyncTask * self)
{
	self->status = PAPER_CLIP_TASK_STATUS_RUNNING;
}

void
paper_clip_async_task_free (PaperClipAsyncTask * self)
{
	(self->callback_target_destroy_notify == NULL) ? NULL : (self->callback_target_destroy_notify (self->callback_target), NULL);
	self->callback = NULL;
	self->callback_target = NULL;
	self->callback_target_destroy_notify = NULL;
	g_slice_free (PaperClipAsyncTask, self);
}

static GType
paper_clip_task_status_get_type_once (void)
{
	static const GEnumValue values[] = {{PAPER_CLIP_TASK_STATUS_CANCELLED, "PAPER_CLIP_TASK_STATUS_CANCELLED", "cancelled"}, {PAPER_CLIP_TASK_STATUS_SUCCEEDED, "PAPER_CLIP_TASK_STATUS_SUCCEEDED", "succeeded"}, {PAPER_CLIP_TASK_STATUS_RUNNING, "PAPER_CLIP_TASK_STATUS_RUNNING", "running"}, {0, NULL, NULL}};
	GType paper_clip_task_status_type_id;
	paper_clip_task_status_type_id = g_enum_register_static ("PaperClipTaskStatus", values);
	return paper_clip_task_status_type_id;
}

GType
paper_clip_task_status_get_type (void)
{
	static volatile gsize paper_clip_task_status_type_id__once = 0;
	if (g_once_init_enter (&paper_clip_task_status_type_id__once)) {
		GType paper_clip_task_status_type_id;
		paper_clip_task_status_type_id = paper_clip_task_status_get_type_once ();
		g_once_init_leave (&paper_clip_task_status_type_id__once, paper_clip_task_status_type_id);
	}
	return paper_clip_task_status_type_id__once;
}

