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

#include <adwaita.h>
#include <glib-object.h>
#include "planify.h"
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <gdk/gdk.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

#define TYPE_MAIN_WINDOW (main_window_get_type ())
#define MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW, MainWindow))
#define MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW, MainWindowClass))
#define IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW))
#define IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW))
#define MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW, MainWindowClass))

typedef struct _MainWindow MainWindow;
typedef struct _MainWindowClass MainWindowClass;
typedef struct _MainWindowPrivate MainWindowPrivate;
enum  {
	MAIN_WINDOW_0_PROPERTY,
	MAIN_WINDOW_CAN_CLOSE_PROPERTY,
	MAIN_WINDOW_NUM_PROPERTIES
};
static GParamSpec* main_window_properties[MAIN_WINDOW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TYPE_QUICK_ADD (quick_add_get_type ())
#define QUICK_ADD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_QUICK_ADD, QuickAdd))
#define QUICK_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_QUICK_ADD, QuickAddClass))
#define IS_QUICK_ADD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_QUICK_ADD))
#define IS_QUICK_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_QUICK_ADD))
#define QUICK_ADD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_QUICK_ADD, QuickAddClass))

typedef struct _QuickAdd QuickAdd;
typedef struct _QuickAddClass QuickAddClass;

#define TYPE_DBUS_CLIENT (dbus_client_get_type ())
#define DBUS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DBUS_CLIENT, DBusClient))
#define DBUS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DBUS_CLIENT, DBusClientClass))
#define IS_DBUS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DBUS_CLIENT))
#define IS_DBUS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DBUS_CLIENT))
#define DBUS_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DBUS_CLIENT, DBusClientClass))

typedef struct _DBusClient DBusClient;
typedef struct _DBusClientClass DBusClientClass;
typedef struct _DBusClientPrivate DBusClientPrivate;

#define TYPE_DBUS_CLIENT_INTERFACE (dbus_client_interface_get_type ())
#define DBUS_CLIENT_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DBUS_CLIENT_INTERFACE, DBusClientInterface))
#define IS_DBUS_CLIENT_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DBUS_CLIENT_INTERFACE))
#define DBUS_CLIENT_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_DBUS_CLIENT_INTERFACE, DBusClientInterfaceIface))

typedef struct _DBusClientInterface DBusClientInterface;
typedef struct _DBusClientInterfaceIface DBusClientInterfaceIface;

#define TYPE_DBUS_CLIENT_INTERFACE_PROXY (dbus_client_interface_proxy_get_type ())
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block1Data Block1Data;

struct _MainWindow {
	AdwApplicationWindow parent_instance;
	MainWindowPrivate * priv;
};

struct _MainWindowClass {
	AdwApplicationWindowClass parent_class;
};

struct _MainWindowPrivate {
	LayoutsQuickAddCore* quick_add_widget;
	gboolean _can_close;
};

struct _DBusClientInterfaceIface {
	GTypeInterface parent_iface;
	void (*add_item) (DBusClientInterface* self, const gchar* id, GError** error);
	void (*update_item) (DBusClientInterface* self, const gchar* id, GError** error);
};

struct _DBusClient {
	GObject parent_instance;
	DBusClientPrivate * priv;
	DBusClientInterface* interface;
};

struct _DBusClientClass {
	GObjectClass parent_class;
};

struct _Block1Data {
	int _ref_count_;
	MainWindow* self;
	gboolean active;
};

static gint MainWindow_private_offset;
static gpointer main_window_parent_class = NULL;

VALA_EXTERN GType main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindow, g_object_unref)
VALA_EXTERN GType quick_add_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (QuickAdd, g_object_unref)
VALA_EXTERN MainWindow* main_window_new (QuickAdd* application);
VALA_EXTERN MainWindow* main_window_construct (GType object_type,
                                   QuickAdd* application);
static void main_window_add_item_db (MainWindow* self,
                              ObjectsItem* item,
                              GeeArrayList* reminders);
static void main_window_send_interface_id (MainWindow* self,
                                    const gchar* id);
VALA_EXTERN GType dbus_client_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DBusClient, g_object_unref)
VALA_EXTERN DBusClient* dbus_client_get_default (void);
VALA_EXTERN GType dbus_client_interface_proxy_get_type (void) G_GNUC_CONST ;
VALA_EXTERN guint dbus_client_interface_register_object (void* object,
                                             GDBusConnection* connection,
                                             const gchar* path,
                                             GError** error);
VALA_EXTERN GType dbus_client_interface_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DBusClientInterface, g_object_unref)
VALA_EXTERN void dbus_client_interface_add_item (DBusClientInterface* self,
                                     const gchar* id,
                                     GError** error);
VALA_EXTERN void main_window_hide_destroy (MainWindow* self);
VALA_EXTERN gboolean main_window_get_can_close (MainWindow* self);
static gboolean __lambda5_ (MainWindow* self);
static gboolean ___lambda5__gsource_func (gpointer self);
VALA_EXTERN void main_window_set_can_close (MainWindow* self,
                                gboolean value);
static GObject * main_window_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties);
static void _main_window_hide_destroy_layouts_quick_add_core_hide_destroy (LayoutsQuickAddCore* _sender,
                                                                    gpointer self);
static void _main_window_send_interface_id_layouts_quick_add_core_send_interface_id (LayoutsQuickAddCore* _sender,
                                                                              const gchar* id,
                                                                              gpointer self);
static void _main_window_add_item_db_layouts_quick_add_core_add_item_db (LayoutsQuickAddCore* _sender,
                                                                  ObjectsItem* item,
                                                                  GeeArrayList* reminders,
                                                                  gpointer self);
static void _main_window___lambda6_ (MainWindow* self,
                              gboolean active);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static gboolean __lambda7_ (Block1Data* _data1_);
static gboolean ___lambda7__gsource_func (gpointer self);
static void __main_window___lambda6__layouts_quick_add_core_parent_can_close (LayoutsQuickAddCore* _sender,
                                                                       gboolean active,
                                                                       gpointer self);
static void main_window_finalize (GObject * obj);
static GType main_window_get_type_once (void);
static void _vala_main_window_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec);
static void _vala_main_window_set_property (GObject * object,
                                     guint property_id,
                                     const GValue * value,
                                     GParamSpec * pspec);

static inline gpointer
main_window_get_instance_private (MainWindow* self)
{
	return G_STRUCT_MEMBER_P (self, MainWindow_private_offset);
}

MainWindow*
main_window_construct (GType object_type,
                       QuickAdd* application)
{
	MainWindow * self = NULL;
	g_return_val_if_fail (application != NULL, NULL);
	self = (MainWindow*) g_object_new (object_type, "application", application, "icon-name", "io.github.alainm23.planify", "title", _ ("Planify - Quick Add"), "resizable", FALSE, "width-request", 600, "halign", GTK_ALIGN_START, NULL);
	return self;
}

MainWindow*
main_window_new (QuickAdd* application)
{
	return main_window_construct (TYPE_MAIN_WINDOW, application);
}

static void
main_window_add_item_db (MainWindow* self,
                         ObjectsItem* item,
                         GeeArrayList* reminders)
{
	ServicesStore* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gboolean _tmp12_ = FALSE;
	ServicesSettings* _tmp13_;
	ServicesSettings* _tmp14_;
	gboolean _tmp15_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	LayoutsQuickAddCore* _tmp24_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	g_return_if_fail (reminders != NULL);
	_tmp0_ = services_store_instance ();
	services_store_insert_item (_tmp0_, item, TRUE, TRUE);
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) reminders);
	_tmp2_ = _tmp1_;
	if (_tmp2_ > 0) {
		LayoutsQuickAddCore* _tmp3_;
		_tmp3_ = self->priv->quick_add_widget;
		layouts_quick_add_core_set_is_loading (_tmp3_, TRUE);
		{
			GeeArrayList* _reminder_list = NULL;
			gint _reminder_size = 0;
			GeeArrayList* _tmp4_;
			gint _tmp5_;
			gint _tmp6_;
			gint _reminder_index = 0;
			_reminder_list = reminders;
			_tmp4_ = _reminder_list;
			_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
			_tmp6_ = _tmp5_;
			_reminder_size = _tmp6_;
			_reminder_index = -1;
			while (TRUE) {
				gint _tmp7_;
				gint _tmp8_;
				ObjectsReminder* reminder = NULL;
				GeeArrayList* _tmp9_;
				gpointer _tmp10_;
				ObjectsReminder* _tmp11_;
				_reminder_index = _reminder_index + 1;
				_tmp7_ = _reminder_index;
				_tmp8_ = _reminder_size;
				if (!(_tmp7_ < _tmp8_)) {
					break;
				}
				_tmp9_ = _reminder_list;
				_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _reminder_index);
				reminder = (ObjectsReminder*) _tmp10_;
				_tmp11_ = reminder;
				objects_item_add_reminder (item, _tmp11_);
				_g_object_unref0 (reminder);
			}
		}
	}
	_tmp13_ = services_settings_get_default ();
	_tmp14_ = _tmp13_;
	_tmp15_ = services_settings_get_boolean (_tmp14_, "automatic-reminders-enabled");
	_g_object_unref0 (_tmp14_);
	if (_tmp15_) {
		gboolean _tmp16_;
		gboolean _tmp17_;
		_tmp16_ = objects_item_get_has_time (item);
		_tmp17_ = _tmp16_;
		_tmp12_ = _tmp17_;
	} else {
		_tmp12_ = FALSE;
	}
	if (_tmp12_) {
		ObjectsReminder* reminder = NULL;
		ObjectsReminder* _tmp18_;
		ObjectsReminder* _tmp19_;
		ObjectsReminder* _tmp20_;
		ObjectsReminder* _tmp21_;
		_tmp18_ = objects_reminder_new ();
		reminder = _tmp18_;
		_tmp19_ = reminder;
		objects_reminder_set_mm_offset (_tmp19_, util_get_reminders_mm_offset ());
		_tmp20_ = reminder;
		objects_reminder_set_reminder_type (_tmp20_, REMINDER_TYPE_RELATIVE);
		_tmp21_ = reminder;
		objects_item_add_reminder (item, _tmp21_);
		_g_object_unref0 (reminder);
	}
	_tmp22_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
	_tmp23_ = _tmp22_;
	main_window_send_interface_id (self, _tmp23_);
	_tmp24_ = self->priv->quick_add_widget;
	layouts_quick_add_core_added_successfully (_tmp24_);
}

static void
main_window_send_interface_id (MainWindow* self,
                               const gchar* id)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (id != NULL);
	{
		DBusClient* _tmp0_;
		DBusClientInterface* _tmp1_;
		_tmp0_ = dbus_client_get_default ();
		_tmp1_ = _tmp0_->interface;
		dbus_client_interface_add_item (_tmp1_, id, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp2_;
		const gchar* _tmp3_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = e;
		_tmp3_ = _tmp2_->message;
		g_debug ("MainWindow.vala:64: %s", _tmp3_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static gboolean
__lambda5_ (MainWindow* self)
{
	gboolean result;
	gtk_window_destroy ((GtkWindow*) self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda5__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda5_ ((MainWindow*) self);
	return result;
}

void
main_window_hide_destroy (MainWindow* self)
{
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_can_close;
	if (!_tmp0_) {
		return;
	}
	gtk_widget_hide ((GtkWidget*) self);
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 500, ___lambda5__gsource_func, g_object_ref (self), g_object_unref);
}

gboolean
main_window_get_can_close (MainWindow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_can_close;
	return result;
}

void
main_window_set_can_close (MainWindow* self,
                           gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = main_window_get_can_close (self);
	if (old_value != value) {
		self->priv->_can_close = value;
		g_object_notify_by_pspec ((GObject *) self, main_window_properties[MAIN_WINDOW_CAN_CLOSE_PROPERTY]);
	}
}

static void
_main_window_hide_destroy_layouts_quick_add_core_hide_destroy (LayoutsQuickAddCore* _sender,
                                                               gpointer self)
{
	main_window_hide_destroy ((MainWindow*) self);
}

static void
_main_window_send_interface_id_layouts_quick_add_core_send_interface_id (LayoutsQuickAddCore* _sender,
                                                                         const gchar* id,
                                                                         gpointer self)
{
	main_window_send_interface_id ((MainWindow*) self, id);
}

static void
_main_window_add_item_db_layouts_quick_add_core_add_item_db (LayoutsQuickAddCore* _sender,
                                                             ObjectsItem* item,
                                                             GeeArrayList* reminders,
                                                             gpointer self)
{
	main_window_add_item_db ((MainWindow*) self, item, reminders);
}

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		MainWindow* self;
		self = _data1_->self;
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}

static gboolean
__lambda7_ (Block1Data* _data1_)
{
	MainWindow* self;
	gboolean result;
	self = _data1_->self;
	main_window_set_can_close (self, _data1_->active);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda7__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda7_ (self);
	return result;
}

static void
_main_window___lambda6_ (MainWindow* self,
                         gboolean active)
{
	Block1Data* _data1_;
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->self = g_object_ref (self);
	_data1_->active = active;
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 250, ___lambda7__gsource_func, block1_data_ref (_data1_), block1_data_unref);
	block1_data_unref (_data1_);
	_data1_ = NULL;
}

static void
__main_window___lambda6__layouts_quick_add_core_parent_can_close (LayoutsQuickAddCore* _sender,
                                                                  gboolean active,
                                                                  gpointer self)
{
	_main_window___lambda6_ ((MainWindow*) self, active);
}

static GObject *
main_window_constructor (GType type,
                         guint n_construct_properties,
                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	MainWindow * self;
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	LayoutsQuickAddCore* _tmp2_;
	LayoutsQuickAddCore* _tmp3_;
	LayoutsQuickAddCore* _tmp4_;
	LayoutsQuickAddCore* _tmp5_;
	LayoutsQuickAddCore* _tmp6_;
	LayoutsQuickAddCore* _tmp7_;
	parent_class = G_OBJECT_CLASS (main_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAIN_WINDOW, MainWindow);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	services_database_init_database (_tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = layouts_quick_add_core_new (TRUE);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->quick_add_widget);
	self->priv->quick_add_widget = _tmp2_;
	_tmp3_ = self->priv->quick_add_widget;
	adw_application_window_set_content ((AdwApplicationWindow*) self, (GtkWidget*) _tmp3_);
	_tmp4_ = self->priv->quick_add_widget;
	g_signal_connect_object (_tmp4_, "hide-destroy", (GCallback) _main_window_hide_destroy_layouts_quick_add_core_hide_destroy, self, 0);
	_tmp5_ = self->priv->quick_add_widget;
	g_signal_connect_object (_tmp5_, "send-interface-id", (GCallback) _main_window_send_interface_id_layouts_quick_add_core_send_interface_id, self, 0);
	_tmp6_ = self->priv->quick_add_widget;
	g_signal_connect_object (_tmp6_, "add-item-db", (GCallback) _main_window_add_item_db_layouts_quick_add_core_add_item_db, self, 0);
	_tmp7_ = self->priv->quick_add_widget;
	g_signal_connect_object (_tmp7_, "parent-can-close", (GCallback) __main_window___lambda6__layouts_quick_add_core_parent_can_close, self, 0);
	return obj;
}

static void
main_window_class_init (MainWindowClass * klass,
                        gpointer klass_data)
{
	GtkIconTheme* default_theme = NULL;
	GdkDisplay* _tmp0_;
	GtkIconTheme* _tmp1_;
	GtkIconTheme* _tmp2_;
	main_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MainWindow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_main_window_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_main_window_set_property;
	G_OBJECT_CLASS (klass)->constructor = main_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = main_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), MAIN_WINDOW_CAN_CLOSE_PROPERTY, main_window_properties[MAIN_WINDOW_CAN_CLOSE_PROPERTY] = g_param_spec_boolean ("can-close", "can-close", "can-close", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = gtk_icon_theme_get_for_display (_tmp0_);
	default_theme = _tmp1_;
	_tmp2_ = default_theme;
	gtk_icon_theme_add_resource_path (_tmp2_, "/io/github/alainm23/planify/");
}

static void
main_window_instance_init (MainWindow * self,
                           gpointer klass)
{
	self->priv = main_window_get_instance_private (self);
	self->priv->_can_close = TRUE;
}

static void
main_window_finalize (GObject * obj)
{
	MainWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAIN_WINDOW, MainWindow);
	_g_object_unref0 (self->priv->quick_add_widget);
	G_OBJECT_CLASS (main_window_parent_class)->finalize (obj);
}

static GType
main_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MainWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) main_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MainWindow), 0, (GInstanceInitFunc) main_window_instance_init, NULL };
	GType main_window_type_id;
	main_window_type_id = g_type_register_static (adw_application_window_get_type (), "MainWindow", &g_define_type_info, 0);
	MainWindow_private_offset = g_type_add_instance_private (main_window_type_id, sizeof (MainWindowPrivate));
	return main_window_type_id;
}

GType
main_window_get_type (void)
{
	static volatile gsize main_window_type_id__once = 0;
	if (g_once_init_enter (&main_window_type_id__once)) {
		GType main_window_type_id;
		main_window_type_id = main_window_get_type_once ();
		g_once_init_leave (&main_window_type_id__once, main_window_type_id);
	}
	return main_window_type_id__once;
}

static void
_vala_main_window_get_property (GObject * object,
                                guint property_id,
                                GValue * value,
                                GParamSpec * pspec)
{
	MainWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MAIN_WINDOW, MainWindow);
	switch (property_id) {
		case MAIN_WINDOW_CAN_CLOSE_PROPERTY:
		g_value_set_boolean (value, main_window_get_can_close (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_main_window_set_property (GObject * object,
                                guint property_id,
                                const GValue * value,
                                GParamSpec * pspec)
{
	MainWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MAIN_WINDOW, MainWindow);
	switch (property_id) {
		case MAIN_WINDOW_CAN_CLOSE_PROPERTY:
		main_window_set_can_close (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

