/* imigration.c generated by valac 0.56.19, the Vala compiler
 * generated from imigration.vala, do not modify */

#include "protonplus_core.h"
#include <glib-object.h>
#include <glib.h>
#include <gio/gio.h>
#include <string.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

enum  {
	PROTON_PLUS_SERVICES_MIGRATIONS_MIGRATION_CONTEXT_0_PROPERTY,
	PROTON_PLUS_SERVICES_MIGRATIONS_MIGRATION_CONTEXT_WINDOW_PROPERTY,
	PROTON_PLUS_SERVICES_MIGRATIONS_MIGRATION_CONTEXT_NUM_PROPERTIES
};
static GParamSpec* proton_plus_services_migrations_migration_context_properties[PROTON_PLUS_SERVICES_MIGRATIONS_MIGRATION_CONTEXT_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ProtonPlusServicesMigrationsMigrationContextPrivate {
	ProtonPlusWidgetsWindow* _window;
};

static gint ProtonPlusServicesMigrationsMigrationContext_private_offset;
static gpointer proton_plus_services_migrations_migration_context_parent_class = NULL;

static void proton_plus_services_migrations_migration_context_finalize (GObject * obj);
static GType proton_plus_services_migrations_migration_context_get_type_once (void);
static void _vala_proton_plus_services_migrations_migration_context_get_property (GObject * object,
                                                                           guint property_id,
                                                                           GValue * value,
                                                                           GParamSpec * pspec);
static void _vala_proton_plus_services_migrations_migration_context_set_property (GObject * object,
                                                                           guint property_id,
                                                                           const GValue * value,
                                                                           GParamSpec * pspec);
static GType proton_plus_services_migrations_imigration_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
proton_plus_services_migrations_migration_context_get_instance_private (ProtonPlusServicesMigrationsMigrationContext* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusServicesMigrationsMigrationContext_private_offset);
}

ProtonPlusServicesMigrationsMigrationContext*
proton_plus_services_migrations_migration_context_construct (GType object_type,
                                                             ProtonPlusWidgetsWindow* window)
{
	ProtonPlusServicesMigrationsMigrationContext * self = NULL;
	self = (ProtonPlusServicesMigrationsMigrationContext*) g_object_new (object_type, NULL);
	proton_plus_services_migrations_migration_context_set_window (self, window);
	return self;
}

ProtonPlusServicesMigrationsMigrationContext*
proton_plus_services_migrations_migration_context_new (ProtonPlusWidgetsWindow* window)
{
	return proton_plus_services_migrations_migration_context_construct (PROTON_PLUS_SERVICES_MIGRATIONS_TYPE_MIGRATION_CONTEXT, window);
}

ProtonPlusWidgetsWindow*
proton_plus_services_migrations_migration_context_get_window (ProtonPlusServicesMigrationsMigrationContext* self)
{
	ProtonPlusWidgetsWindow* result;
	ProtonPlusWidgetsWindow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_window;
	result = _tmp0_;
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

void
proton_plus_services_migrations_migration_context_set_window (ProtonPlusServicesMigrationsMigrationContext* self,
                                                              ProtonPlusWidgetsWindow* value)
{
	ProtonPlusWidgetsWindow* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_services_migrations_migration_context_get_window (self);
	if (old_value != value) {
		ProtonPlusWidgetsWindow* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_window);
		self->priv->_window = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_services_migrations_migration_context_properties[PROTON_PLUS_SERVICES_MIGRATIONS_MIGRATION_CONTEXT_WINDOW_PROPERTY]);
	}
}

static void
proton_plus_services_migrations_migration_context_class_init (ProtonPlusServicesMigrationsMigrationContextClass * klass,
                                                              gpointer klass_data)
{
	proton_plus_services_migrations_migration_context_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusServicesMigrationsMigrationContext_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_services_migrations_migration_context_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_services_migrations_migration_context_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_services_migrations_migration_context_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_SERVICES_MIGRATIONS_MIGRATION_CONTEXT_WINDOW_PROPERTY, proton_plus_services_migrations_migration_context_properties[PROTON_PLUS_SERVICES_MIGRATIONS_MIGRATION_CONTEXT_WINDOW_PROPERTY] = g_param_spec_object ("window", "window", "window", PROTON_PLUS_WIDGETS_TYPE_WINDOW, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
proton_plus_services_migrations_migration_context_instance_init (ProtonPlusServicesMigrationsMigrationContext * self,
                                                                 gpointer klass)
{
	self->priv = proton_plus_services_migrations_migration_context_get_instance_private (self);
}

static void
proton_plus_services_migrations_migration_context_finalize (GObject * obj)
{
	ProtonPlusServicesMigrationsMigrationContext * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_SERVICES_MIGRATIONS_TYPE_MIGRATION_CONTEXT, ProtonPlusServicesMigrationsMigrationContext);
	_g_object_unref0 (self->priv->_window);
	G_OBJECT_CLASS (proton_plus_services_migrations_migration_context_parent_class)->finalize (obj);
}

static GType
proton_plus_services_migrations_migration_context_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusServicesMigrationsMigrationContextClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_services_migrations_migration_context_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusServicesMigrationsMigrationContext), 0, (GInstanceInitFunc) proton_plus_services_migrations_migration_context_instance_init, NULL };
	GType proton_plus_services_migrations_migration_context_type_id;
	proton_plus_services_migrations_migration_context_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusServicesMigrationsMigrationContext", &g_define_type_info, 0);
	ProtonPlusServicesMigrationsMigrationContext_private_offset = g_type_add_instance_private (proton_plus_services_migrations_migration_context_type_id, sizeof (ProtonPlusServicesMigrationsMigrationContextPrivate));
	return proton_plus_services_migrations_migration_context_type_id;
}

GType
proton_plus_services_migrations_migration_context_get_type (void)
{
	static volatile gsize proton_plus_services_migrations_migration_context_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_services_migrations_migration_context_type_id__once)) {
		GType proton_plus_services_migrations_migration_context_type_id;
		proton_plus_services_migrations_migration_context_type_id = proton_plus_services_migrations_migration_context_get_type_once ();
		g_once_init_leave (&proton_plus_services_migrations_migration_context_type_id__once, proton_plus_services_migrations_migration_context_type_id);
	}
	return proton_plus_services_migrations_migration_context_type_id__once;
}

static void
_vala_proton_plus_services_migrations_migration_context_get_property (GObject * object,
                                                                      guint property_id,
                                                                      GValue * value,
                                                                      GParamSpec * pspec)
{
	ProtonPlusServicesMigrationsMigrationContext * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_SERVICES_MIGRATIONS_TYPE_MIGRATION_CONTEXT, ProtonPlusServicesMigrationsMigrationContext);
	switch (property_id) {
		case PROTON_PLUS_SERVICES_MIGRATIONS_MIGRATION_CONTEXT_WINDOW_PROPERTY:
		g_value_set_object (value, proton_plus_services_migrations_migration_context_get_window (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_services_migrations_migration_context_set_property (GObject * object,
                                                                      guint property_id,
                                                                      const GValue * value,
                                                                      GParamSpec * pspec)
{
	ProtonPlusServicesMigrationsMigrationContext * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_SERVICES_MIGRATIONS_TYPE_MIGRATION_CONTEXT, ProtonPlusServicesMigrationsMigrationContext);
	switch (property_id) {
		case PROTON_PLUS_SERVICES_MIGRATIONS_MIGRATION_CONTEXT_WINDOW_PROPERTY:
		proton_plus_services_migrations_migration_context_set_window (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

void
proton_plus_services_migrations_imigration_migrate (ProtonPlusServicesMigrationsIMigration* self,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_)
{
	ProtonPlusServicesMigrationsIMigrationIface* _iface_;
	_iface_ = PROTON_PLUS_SERVICES_MIGRATIONS_IMIGRATION_GET_INTERFACE (self);
	if (_iface_->migrate) {
		_iface_->migrate (self, _callback_, _user_data_);
	}
}

void
proton_plus_services_migrations_imigration_migrate_finish (ProtonPlusServicesMigrationsIMigration* self,
                                                           GAsyncResult* _res_,
                                                           GError** error)
{
	ProtonPlusServicesMigrationsIMigrationIface* _iface_;
	_iface_ = PROTON_PLUS_SERVICES_MIGRATIONS_IMIGRATION_GET_INTERFACE (self);
	if (_iface_->migrate_finish) {
		_iface_->migrate_finish (self, _res_, error);
	}
}

void
proton_plus_services_migrations_imigration_post_migrate (ProtonPlusServicesMigrationsIMigration* self,
                                                         ProtonPlusServicesMigrationsMigrationContext* context)
{
	ProtonPlusServicesMigrationsIMigrationIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = PROTON_PLUS_SERVICES_MIGRATIONS_IMIGRATION_GET_INTERFACE (self);
	if (_iface_->post_migrate) {
		_iface_->post_migrate (self, context);
	}
}

const gchar*
proton_plus_services_migrations_imigration_get_version (ProtonPlusServicesMigrationsIMigration* self)
{
	ProtonPlusServicesMigrationsIMigrationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = PROTON_PLUS_SERVICES_MIGRATIONS_IMIGRATION_GET_INTERFACE (self);
	if (_iface_->get_version) {
		return _iface_->get_version (self);
	}
	return NULL;
}

static void
proton_plus_services_migrations_imigration_default_init (ProtonPlusServicesMigrationsIMigrationIface * iface,
                                                         gpointer iface_data)
{
	g_object_interface_install_property (iface, g_param_spec_string ("version", "version", "version", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static GType
proton_plus_services_migrations_imigration_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusServicesMigrationsIMigrationIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_services_migrations_imigration_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType proton_plus_services_migrations_imigration_type_id;
	proton_plus_services_migrations_imigration_type_id = g_type_register_static (G_TYPE_INTERFACE, "ProtonPlusServicesMigrationsIMigration", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (proton_plus_services_migrations_imigration_type_id, G_TYPE_OBJECT);
	return proton_plus_services_migrations_imigration_type_id;
}

GType
proton_plus_services_migrations_imigration_get_type (void)
{
	static volatile gsize proton_plus_services_migrations_imigration_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_services_migrations_imigration_type_id__once)) {
		GType proton_plus_services_migrations_imigration_type_id;
		proton_plus_services_migrations_imigration_type_id = proton_plus_services_migrations_imigration_get_type_once ();
		g_once_init_leave (&proton_plus_services_migrations_imigration_type_id__once, proton_plus_services_migrations_imigration_type_id);
	}
	return proton_plus_services_migrations_imigration_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

