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

#include "protonplus_core.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.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_VERSIONS_V0_6_0_0_PROPERTY,
	PROTON_PLUS_SERVICES_MIGRATIONS_VERSIONS_V0_6_0_VERSION_PROPERTY,
	PROTON_PLUS_SERVICES_MIGRATIONS_VERSIONS_V0_6_0_NUM_PROPERTIES
};
static GParamSpec* proton_plus_services_migrations_versions_v0_6_0_properties[PROTON_PLUS_SERVICES_MIGRATIONS_VERSIONS_V0_6_0_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _ProtonPlusServicesMigrationsVersionsV060MigrateData ProtonPlusServicesMigrationsVersionsV060MigrateData;

#define PROTON_PLUS_WIDGETS_INTRODUCTION_TYPE_INTRODUCTION (proton_plus_widgets_introduction_introduction_get_type ())
#define PROTON_PLUS_WIDGETS_INTRODUCTION_INTRODUCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_WIDGETS_INTRODUCTION_TYPE_INTRODUCTION, ProtonPlusWidgetsIntroductionIntroduction))
#define PROTON_PLUS_WIDGETS_INTRODUCTION_INTRODUCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_WIDGETS_INTRODUCTION_TYPE_INTRODUCTION, ProtonPlusWidgetsIntroductionIntroductionClass))
#define PROTON_PLUS_WIDGETS_INTRODUCTION_IS_INTRODUCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_WIDGETS_INTRODUCTION_TYPE_INTRODUCTION))
#define PROTON_PLUS_WIDGETS_INTRODUCTION_IS_INTRODUCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_WIDGETS_INTRODUCTION_TYPE_INTRODUCTION))
#define PROTON_PLUS_WIDGETS_INTRODUCTION_INTRODUCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_WIDGETS_INTRODUCTION_TYPE_INTRODUCTION, ProtonPlusWidgetsIntroductionIntroductionClass))

typedef struct _ProtonPlusWidgetsIntroductionIntroduction ProtonPlusWidgetsIntroductionIntroduction;
typedef struct _ProtonPlusWidgetsIntroductionIntroductionClass ProtonPlusWidgetsIntroductionIntroductionClass;

struct _ProtonPlusServicesMigrationsVersionsv0_6_0Private {
	gchar* _version;
};

struct _ProtonPlusServicesMigrationsVersionsV060MigrateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesMigrationsVersionsv0_6_0* self;
	GError* _tmp0_;
	GError* _inner_error0_;
};

static gint ProtonPlusServicesMigrationsVersionsv0_6_0_private_offset;
static gpointer proton_plus_services_migrations_versions_v0_6_0_parent_class = NULL;
static ProtonPlusServicesMigrationsIMigrationIface * proton_plus_services_migrations_versions_v0_6_0_proton_plus_services_migrations_imigration_parent_iface = NULL;

static void proton_plus_services_migrations_versions_v0_6_0_real_migrate_data_free (gpointer _data);
static void proton_plus_services_migrations_versions_v0_6_0_real_migrate (ProtonPlusServicesMigrationsIMigration* base,
                                                                   GAsyncReadyCallback _callback_,
                                                                   gpointer _user_data_);
static gboolean proton_plus_services_migrations_versions_v0_6_0_real_migrate_co (ProtonPlusServicesMigrationsVersionsV060MigrateData* _data_);
static void proton_plus_services_migrations_versions_v0_6_0_migrate_ready (GObject* source_object,
                                                                    GAsyncResult* _res_,
                                                                    gpointer _user_data_);
static void proton_plus_services_migrations_versions_v0_6_0_real_post_migrate (ProtonPlusServicesMigrationsIMigration* base,
                                                                        ProtonPlusServicesMigrationsMigrationContext* context);
VALA_EXTERN GType proton_plus_widgets_introduction_introduction_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ProtonPlusWidgetsIntroductionIntroduction* proton_plus_widgets_introduction_introduction_new (void);
VALA_EXTERN ProtonPlusWidgetsIntroductionIntroduction* proton_plus_widgets_introduction_introduction_construct (GType object_type);
static void proton_plus_services_migrations_versions_v0_6_0_finalize (GObject * obj);
static GType proton_plus_services_migrations_versions_v0_6_0_get_type_once (void);
static void _vala_proton_plus_services_migrations_versions_v0_6_0_get_property (GObject * object,
                                                                         guint property_id,
                                                                         GValue * value,
                                                                         GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
proton_plus_services_migrations_versions_v0_6_0_get_instance_private (ProtonPlusServicesMigrationsVersionsv0_6_0* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusServicesMigrationsVersionsv0_6_0_private_offset);
}

static void
proton_plus_services_migrations_versions_v0_6_0_real_migrate_data_free (gpointer _data)
{
	ProtonPlusServicesMigrationsVersionsV060MigrateData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesMigrationsVersionsV060MigrateData, _data_);
}

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

static void
proton_plus_services_migrations_versions_v0_6_0_real_migrate (ProtonPlusServicesMigrationsIMigration* base,
                                                              GAsyncReadyCallback _callback_,
                                                              gpointer _user_data_)
{
	ProtonPlusServicesMigrationsVersionsv0_6_0 * self;
	ProtonPlusServicesMigrationsVersionsV060MigrateData* _data_;
	ProtonPlusServicesMigrationsVersionsv0_6_0* _tmp0_;
	self = (ProtonPlusServicesMigrationsVersionsv0_6_0*) base;
	_data_ = g_slice_new0 (ProtonPlusServicesMigrationsVersionsV060MigrateData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_migrations_versions_v0_6_0_real_migrate_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	proton_plus_services_migrations_versions_v0_6_0_real_migrate_co (_data_);
}

static void
proton_plus_services_migrations_versions_v0_6_0_migrate_finish (ProtonPlusServicesMigrationsIMigration* base,
                                                                GAsyncResult* _res_,
                                                                GError** error)
{
	ProtonPlusServicesMigrationsVersionsV060MigrateData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
proton_plus_services_migrations_versions_v0_6_0_migrate_ready (GObject* source_object,
                                                               GAsyncResult* _res_,
                                                               gpointer _user_data_)
{
	ProtonPlusServicesMigrationsVersionsV060MigrateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_migrations_versions_v0_6_0_real_migrate_co (_data_);
}

static gboolean
proton_plus_services_migrations_versions_v0_6_0_real_migrate_co (ProtonPlusServicesMigrationsVersionsV060MigrateData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_print ("Migration: Performing specific changes for version 0.6.0…\n");
	_data_->_state_ = 1;
	proton_plus_utils_cache_manager_clear_cache (proton_plus_services_migrations_versions_v0_6_0_migrate_ready, _data_);
	return FALSE;
	_state_1:
	if (!proton_plus_utils_cache_manager_clear_cache_finish (_data_->_res_)) {
		_data_->_tmp0_ = g_error_new (g_quark_from_string ("protonplus-migration"), 0, "Could not clear and recreate the cache directory.");
		_data_->_inner_error0_ = _data_->_tmp0_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
proton_plus_services_migrations_versions_v0_6_0_real_post_migrate (ProtonPlusServicesMigrationsIMigration* base,
                                                                   ProtonPlusServicesMigrationsMigrationContext* context)
{
	ProtonPlusServicesMigrationsVersionsv0_6_0 * self;
	gboolean _tmp0_ = FALSE;
	ProtonPlusWidgetsIntroductionIntroduction* dialog = NULL;
	ProtonPlusWidgetsIntroductionIntroduction* _tmp3_;
	ProtonPlusWidgetsIntroductionIntroduction* _tmp4_;
	ProtonPlusWidgetsWindow* _tmp5_;
	ProtonPlusWidgetsWindow* _tmp6_;
	self = (ProtonPlusServicesMigrationsVersionsv0_6_0*) base;
	if (context == NULL) {
		_tmp0_ = TRUE;
	} else {
		ProtonPlusWidgetsWindow* _tmp1_;
		ProtonPlusWidgetsWindow* _tmp2_;
		_tmp1_ = proton_plus_services_migrations_migration_context_get_window (context);
		_tmp2_ = _tmp1_;
		_tmp0_ = _tmp2_ == NULL;
	}
	if (_tmp0_) {
		return;
	}
	_tmp3_ = proton_plus_widgets_introduction_introduction_new ();
	g_object_ref_sink (_tmp3_);
	dialog = _tmp3_;
	_tmp4_ = dialog;
	_tmp5_ = proton_plus_services_migrations_migration_context_get_window (context);
	_tmp6_ = _tmp5_;
	proton_plus_widgets_window_present_dialog_for_controller ((AdwDialog*) _tmp4_, (GtkWidget*) _tmp6_);
	_g_object_unref0 (dialog);
}

ProtonPlusServicesMigrationsVersionsv0_6_0*
proton_plus_services_migrations_versions_v0_6_0_construct (GType object_type)
{
	ProtonPlusServicesMigrationsVersionsv0_6_0 * self = NULL;
	self = (ProtonPlusServicesMigrationsVersionsv0_6_0*) g_object_new (object_type, NULL);
	return self;
}

ProtonPlusServicesMigrationsVersionsv0_6_0*
proton_plus_services_migrations_versions_v0_6_0_new (void)
{
	return proton_plus_services_migrations_versions_v0_6_0_construct (PROTON_PLUS_SERVICES_MIGRATIONS_VERSIONS_TYPE_V0_6_0);
}

static const gchar*
proton_plus_services_migrations_versions_v0_6_0_real_get_version (ProtonPlusServicesMigrationsIMigration* base)
{
	const gchar* result;
	ProtonPlusServicesMigrationsVersionsv0_6_0* self;
	const gchar* _tmp0_;
	self = (ProtonPlusServicesMigrationsVersionsv0_6_0*) base;
	_tmp0_ = self->priv->_version;
	result = _tmp0_;
	return result;
}

static void
proton_plus_services_migrations_versions_v0_6_0_class_init (ProtonPlusServicesMigrationsVersionsv0_6_0Class * klass,
                                                            gpointer klass_data)
{
	proton_plus_services_migrations_versions_v0_6_0_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusServicesMigrationsVersionsv0_6_0_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_services_migrations_versions_v0_6_0_get_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_services_migrations_versions_v0_6_0_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_SERVICES_MIGRATIONS_VERSIONS_V0_6_0_VERSION_PROPERTY, proton_plus_services_migrations_versions_v0_6_0_properties[PROTON_PLUS_SERVICES_MIGRATIONS_VERSIONS_V0_6_0_VERSION_PROPERTY] = g_param_spec_string ("version", "version", "version", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
proton_plus_services_migrations_versions_v0_6_0_proton_plus_services_migrations_imigration_interface_init (ProtonPlusServicesMigrationsIMigrationIface * iface,
                                                                                                           gpointer iface_data)
{
	proton_plus_services_migrations_versions_v0_6_0_proton_plus_services_migrations_imigration_parent_iface = g_type_interface_peek_parent (iface);
	iface->migrate = (void (*) (ProtonPlusServicesMigrationsIMigration*, GAsyncReadyCallback, gpointer)) proton_plus_services_migrations_versions_v0_6_0_real_migrate;
	iface->migrate_finish = (void (*) (ProtonPlusServicesMigrationsIMigration*, GAsyncResult*, GError**)) proton_plus_services_migrations_versions_v0_6_0_migrate_finish;
	iface->post_migrate = (void (*) (ProtonPlusServicesMigrationsIMigration*, ProtonPlusServicesMigrationsMigrationContext*)) proton_plus_services_migrations_versions_v0_6_0_real_post_migrate;
	iface->get_version = proton_plus_services_migrations_versions_v0_6_0_real_get_version;
}

static void
proton_plus_services_migrations_versions_v0_6_0_instance_init (ProtonPlusServicesMigrationsVersionsv0_6_0 * self,
                                                               gpointer klass)
{
	gchar* _tmp0_;
	self->priv = proton_plus_services_migrations_versions_v0_6_0_get_instance_private (self);
	_tmp0_ = g_strdup ("0.6.0");
	self->priv->_version = _tmp0_;
}

static void
proton_plus_services_migrations_versions_v0_6_0_finalize (GObject * obj)
{
	ProtonPlusServicesMigrationsVersionsv0_6_0 * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_SERVICES_MIGRATIONS_VERSIONS_TYPE_V0_6_0, ProtonPlusServicesMigrationsVersionsv0_6_0);
	_g_free0 (self->priv->_version);
	G_OBJECT_CLASS (proton_plus_services_migrations_versions_v0_6_0_parent_class)->finalize (obj);
}

static GType
proton_plus_services_migrations_versions_v0_6_0_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusServicesMigrationsVersionsv0_6_0Class), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_services_migrations_versions_v0_6_0_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusServicesMigrationsVersionsv0_6_0), 0, (GInstanceInitFunc) proton_plus_services_migrations_versions_v0_6_0_instance_init, NULL };
	static const GInterfaceInfo proton_plus_services_migrations_imigration_info = { (GInterfaceInitFunc) proton_plus_services_migrations_versions_v0_6_0_proton_plus_services_migrations_imigration_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType proton_plus_services_migrations_versions_v0_6_0_type_id;
	proton_plus_services_migrations_versions_v0_6_0_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusServicesMigrationsVersionsv0_6_0", &g_define_type_info, 0);
	g_type_add_interface_static (proton_plus_services_migrations_versions_v0_6_0_type_id, PROTON_PLUS_SERVICES_MIGRATIONS_TYPE_IMIGRATION, &proton_plus_services_migrations_imigration_info);
	ProtonPlusServicesMigrationsVersionsv0_6_0_private_offset = g_type_add_instance_private (proton_plus_services_migrations_versions_v0_6_0_type_id, sizeof (ProtonPlusServicesMigrationsVersionsv0_6_0Private));
	return proton_plus_services_migrations_versions_v0_6_0_type_id;
}

GType
proton_plus_services_migrations_versions_v0_6_0_get_type (void)
{
	static volatile gsize proton_plus_services_migrations_versions_v0_6_0_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_services_migrations_versions_v0_6_0_type_id__once)) {
		GType proton_plus_services_migrations_versions_v0_6_0_type_id;
		proton_plus_services_migrations_versions_v0_6_0_type_id = proton_plus_services_migrations_versions_v0_6_0_get_type_once ();
		g_once_init_leave (&proton_plus_services_migrations_versions_v0_6_0_type_id__once, proton_plus_services_migrations_versions_v0_6_0_type_id);
	}
	return proton_plus_services_migrations_versions_v0_6_0_type_id__once;
}

static void
_vala_proton_plus_services_migrations_versions_v0_6_0_get_property (GObject * object,
                                                                    guint property_id,
                                                                    GValue * value,
                                                                    GParamSpec * pspec)
{
	ProtonPlusServicesMigrationsVersionsv0_6_0 * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_SERVICES_MIGRATIONS_VERSIONS_TYPE_V0_6_0, ProtonPlusServicesMigrationsVersionsv0_6_0);
	switch (property_id) {
		case PROTON_PLUS_SERVICES_MIGRATIONS_VERSIONS_V0_6_0_VERSION_PROPERTY:
		g_value_set_string (value, proton_plus_services_migrations_imigration_get_version ((ProtonPlusServicesMigrationsIMigration*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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;
}

