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

/* window.vala
 *
 * Copyright 2022 Vojtěch Perník
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <adwaita.h>
#include <glib-object.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.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 WG_TYPE_WINDOW (wg_window_get_type ())
#define WG_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WG_TYPE_WINDOW, WGWindow))
#define WG_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WG_TYPE_WINDOW, WGWindowClass))
#define WG_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WG_TYPE_WINDOW))
#define WG_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WG_TYPE_WINDOW))
#define WG_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WG_TYPE_WINDOW, WGWindowClass))

typedef struct _WGWindow WGWindow;
typedef struct _WGWindowClass WGWindowClass;
typedef struct _WGWindowPrivate WGWindowPrivate;
enum  {
	WG_WINDOW_0_PROPERTY,
	WG_WINDOW_SHOW_BACK_BUTTON_PROPERTY,
	WG_WINDOW_NUM_PROPERTIES
};
static GParamSpec* wg_window_properties[WG_WINDOW_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

#define WG_TYPE_GAME_PAGE (wg_game_page_get_type ())
#define WG_GAME_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WG_TYPE_GAME_PAGE, WGGamePage))
#define WG_GAME_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WG_TYPE_GAME_PAGE, WGGamePageClass))
#define WG_IS_GAME_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WG_TYPE_GAME_PAGE))
#define WG_IS_GAME_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WG_TYPE_GAME_PAGE))
#define WG_GAME_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WG_TYPE_GAME_PAGE, WGGamePageClass))

typedef struct _WGGamePage WGGamePage;
typedef struct _WGGamePageClass WGGamePageClass;

#define WG_TYPE_RESULT_PAGE (wg_result_page_get_type ())
#define WG_RESULT_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WG_TYPE_RESULT_PAGE, WGResultPage))
#define WG_RESULT_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WG_TYPE_RESULT_PAGE, WGResultPageClass))
#define WG_IS_RESULT_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WG_TYPE_RESULT_PAGE))
#define WG_IS_RESULT_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WG_TYPE_RESULT_PAGE))
#define WG_RESULT_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WG_TYPE_RESULT_PAGE, WGResultPageClass))

typedef struct _WGResultPage WGResultPage;
typedef struct _WGResultPageClass WGResultPageClass;
typedef struct _Block1Data Block1Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define WG_TYPE_WELCOME_PAGE (wg_welcome_page_get_type ())
#define WG_WELCOME_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WG_TYPE_WELCOME_PAGE, WGWelcomePage))
#define WG_WELCOME_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WG_TYPE_WELCOME_PAGE, WGWelcomePageClass))
#define WG_IS_WELCOME_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WG_TYPE_WELCOME_PAGE))
#define WG_IS_WELCOME_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WG_TYPE_WELCOME_PAGE))
#define WG_WELCOME_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WG_TYPE_WELCOME_PAGE, WGWelcomePageClass))

typedef struct _WGWelcomePage WGWelcomePage;
typedef struct _WGWelcomePageClass WGWelcomePageClass;

#define WG_TYPE_HELP_PAGE (wg_help_page_get_type ())
#define WG_HELP_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WG_TYPE_HELP_PAGE, WGHelpPage))
#define WG_HELP_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WG_TYPE_HELP_PAGE, WGHelpPageClass))
#define WG_IS_HELP_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WG_TYPE_HELP_PAGE))
#define WG_IS_HELP_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WG_TYPE_HELP_PAGE))
#define WG_HELP_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WG_TYPE_HELP_PAGE, WGHelpPageClass))

typedef struct _WGHelpPage WGHelpPage;
typedef struct _WGHelpPageClass WGHelpPageClass;

#define WG_DATA_PARSER_TYPE_WORD (wg_data_parser_word_get_type ())
#define WG_DATA_PARSER_WORD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WG_DATA_PARSER_TYPE_WORD, WGDataParserWord))
#define WG_DATA_PARSER_WORD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WG_DATA_PARSER_TYPE_WORD, WGDataParserWordClass))
#define WG_DATA_PARSER_IS_WORD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WG_DATA_PARSER_TYPE_WORD))
#define WG_DATA_PARSER_IS_WORD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WG_DATA_PARSER_TYPE_WORD))
#define WG_DATA_PARSER_WORD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WG_DATA_PARSER_TYPE_WORD, WGDataParserWordClass))

typedef struct _WGDataParserWord WGDataParserWord;
typedef struct _WGDataParserWordClass WGDataParserWordClass;

struct _WGWindow {
	AdwApplicationWindow parent_instance;
	WGWindowPrivate * priv;
};

struct _WGWindowClass {
	AdwApplicationWindowClass parent_class;
};

struct _WGWindowPrivate {
	gboolean _show_back_button;
	gboolean game_started;
	gboolean game_over;
	GtkButton* back_button;
	GtkMenuButton* menu_button;
	GtkStack* stack;
};

struct _Block1Data {
	int _ref_count_;
	WGWindow* self;
	WGGamePage* game_page;
	WGResultPage* result_page;
};

static gint WGWindow_private_offset;
static gpointer wg_window_parent_class = NULL;

VALA_EXTERN GType wg_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WGWindow, g_object_unref)
VALA_EXTERN WGWindow* wg_window_new (GtkApplication* app);
VALA_EXTERN WGWindow* wg_window_construct (GType object_type,
                               GtkApplication* app);
static void wg_window_back (WGWindow* self);
static void wg_window_update_back_btn_visibility (WGWindow* self);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
static void wg_window_set_show_back_button (WGWindow* self,
                                     gboolean value);
VALA_EXTERN void wg_window_open_menu (WGWindow* self);
VALA_EXTERN gboolean wg_window_get_show_back_button (WGWindow* self);
static GObject * wg_window_constructor (GType type,
                                 guint n_construct_properties,
                                 GObjectConstructParam * construct_properties);
VALA_EXTERN GType wg_game_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WGGamePage, g_object_unref)
VALA_EXTERN GType wg_result_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WGResultPage, g_object_unref)
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void _wg_window___lambda4_ (WGWindow* self);
static void __wg_window___lambda4__g_simple_action_activate (GSimpleAction* _sender,
                                                      GVariant* parameter,
                                                      gpointer self);
static void _wg_window_update_back_btn_visibility_g_object_notify (GObject* _sender,
                                                            GParamSpec* pspec,
                                                            gpointer self);
static void _wg_window_back_gtk_button_clicked (GtkButton* _sender,
                                         gpointer self);
VALA_EXTERN GType wg_welcome_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WGWelcomePage, g_object_unref)
VALA_EXTERN WGWelcomePage* wg_welcome_page_new (void);
VALA_EXTERN WGWelcomePage* wg_welcome_page_construct (GType object_type);
VALA_EXTERN WGGamePage* wg_game_page_new (void);
VALA_EXTERN WGGamePage* wg_game_page_construct (GType object_type);
VALA_EXTERN WGResultPage* wg_result_page_new (void);
VALA_EXTERN WGResultPage* wg_result_page_construct (GType object_type);
VALA_EXTERN GType wg_help_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WGHelpPage, g_object_unref)
VALA_EXTERN WGHelpPage* wg_help_page_new (void);
VALA_EXTERN WGHelpPage* wg_help_page_construct (GType object_type);
static void _wg_window___lambda18_ (Block1Data* _data1_);
VALA_EXTERN void wg_game_page_new_word (WGGamePage* self);
static void __wg_window___lambda18__wg_welcome_page_play (WGWelcomePage* _sender,
                                                   gpointer self);
VALA_EXTERN GType wg_data_parser_word_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WGDataParserWord, g_object_unref)
static void _wg_window___lambda19_ (Block1Data* _data1_,
                             WGDataParserWord* word,
                             gboolean win);
VALA_EXTERN void wg_result_page_set_win (WGResultPage* self,
                             gboolean value);
VALA_EXTERN void wg_result_page_set_word (WGResultPage* self,
                              WGDataParserWord* value);
VALA_EXTERN void wg_result_page_reload (WGResultPage* self);
static void __wg_window___lambda19__wg_game_page_game_over (WGGamePage* _sender,
                                                     WGDataParserWord* word,
                                                     gboolean win,
                                                     gpointer self);
static void _wg_window___lambda20_ (WGWindow* self);
static void __wg_window___lambda20__wg_result_page_play_again (WGResultPage* _sender,
                                                        gpointer self);
static void _gtk_window_close_wg_result_page_quit (WGResultPage* _sender,
                                            gpointer self);
static void _wg_window_back_wg_help_page_back (WGHelpPage* _sender,
                                        gpointer self);
static void wg_window_finalize (GObject * obj);
static GType wg_window_get_type_once (void);
static void _vala_wg_window_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec);
static void _vala_wg_window_set_property (GObject * object,
                                   guint property_id,
                                   const GValue * value,
                                   GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
wg_window_get_instance_private (WGWindow* self)
{
	return G_STRUCT_MEMBER_P (self, WGWindow_private_offset);
}

WGWindow*
wg_window_construct (GType object_type,
                     GtkApplication* app)
{
	WGWindow * self = NULL;
	g_return_val_if_fail (app != NULL, NULL);
	self = (WGWindow*) g_object_new (object_type, "application", app, NULL);
	return self;
}

WGWindow*
wg_window_new (GtkApplication* app)
{
	return wg_window_construct (WG_TYPE_WINDOW, app);
}

static void
wg_window_back (WGWindow* self)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	if (self->priv->game_started) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = self->priv->game_over;
	}
	if (_tmp0_) {
		if (self->priv->game_over) {
			GtkStack* _tmp1_;
			_tmp1_ = self->priv->stack;
			gtk_stack_set_visible_child_name (_tmp1_, "result");
		} else {
			GtkStack* _tmp2_;
			_tmp2_ = self->priv->stack;
			gtk_stack_set_visible_child_name (_tmp2_, "game");
		}
	} else {
		GtkStack* _tmp3_;
		_tmp3_ = self->priv->stack;
		gtk_stack_set_visible_child_name (_tmp3_, "welcome");
	}
}

static gboolean
_vala_string_array_contains (gchar* * stack,
                             gssize stack_length,
                             const gchar* needle)
{
	gssize i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}

static void
wg_window_update_back_btn_visibility (WGWindow* self)
{
	gchar** visible_on = NULL;
	gchar* _tmp0_;
	gchar** _tmp1_;
	gint visible_on_length1;
	gint _visible_on_size_;
	gchar* current_page = NULL;
	GtkStack* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup ("help");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	visible_on = _tmp1_;
	visible_on_length1 = 1;
	_visible_on_size_ = visible_on_length1;
	_tmp2_ = self->priv->stack;
	_tmp3_ = gtk_stack_get_visible_child_name (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strdup (_tmp4_);
	current_page = _tmp5_;
	wg_window_set_show_back_button (self, _vala_string_array_contains (visible_on, visible_on_length1, current_page));
	_g_free0 (current_page);
	visible_on = (_vala_array_free (visible_on, visible_on_length1, (GDestroyNotify) g_free), NULL);
}

void
wg_window_open_menu (WGWindow* self)
{
	GtkMenuButton* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->menu_button;
	gtk_menu_button_popup (_tmp0_);
}

gboolean
wg_window_get_show_back_button (WGWindow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_show_back_button;
	return result;
}

static void
wg_window_set_show_back_button (WGWindow* self,
                                gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = wg_window_get_show_back_button (self);
	if (old_value != value) {
		self->priv->_show_back_button = value;
		g_object_notify_by_pspec ((GObject *) self, wg_window_properties[WG_WINDOW_SHOW_BACK_BUTTON_PROPERTY]);
	}
}

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_)) {
		WGWindow* self;
		self = _data1_->self;
		_g_object_unref0 (_data1_->result_page);
		_g_object_unref0 (_data1_->game_page);
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}

static void
_wg_window___lambda4_ (WGWindow* self)
{
	GtkStack* _tmp0_;
	_tmp0_ = self->priv->stack;
	gtk_stack_set_visible_child_name (_tmp0_, "help");
}

static void
__wg_window___lambda4__g_simple_action_activate (GSimpleAction* _sender,
                                                 GVariant* parameter,
                                                 gpointer self)
{
	_wg_window___lambda4_ ((WGWindow*) self);
}

static void
_wg_window_update_back_btn_visibility_g_object_notify (GObject* _sender,
                                                       GParamSpec* pspec,
                                                       gpointer self)
{
	wg_window_update_back_btn_visibility ((WGWindow*) self);
}

static void
_wg_window_back_gtk_button_clicked (GtkButton* _sender,
                                    gpointer self)
{
	wg_window_back ((WGWindow*) self);
}

static void
_wg_window___lambda18_ (Block1Data* _data1_)
{
	WGWindow* self;
	GtkStack* _tmp0_;
	WGGamePage* _tmp1_;
	self = _data1_->self;
	_tmp0_ = self->priv->stack;
	gtk_stack_set_visible_child_name (_tmp0_, "game");
	self->priv->game_started = TRUE;
	_tmp1_ = _data1_->game_page;
	wg_game_page_new_word (_tmp1_);
}

static void
__wg_window___lambda18__wg_welcome_page_play (WGWelcomePage* _sender,
                                              gpointer self)
{
	_wg_window___lambda18_ (self);
}

static void
_wg_window___lambda19_ (Block1Data* _data1_,
                        WGDataParserWord* word,
                        gboolean win)
{
	WGWindow* self;
	WGResultPage* _tmp0_;
	WGResultPage* _tmp1_;
	WGResultPage* _tmp2_;
	GtkStack* _tmp3_;
	self = _data1_->self;
	g_return_if_fail (word != NULL);
	self->priv->game_over = TRUE;
	_tmp0_ = _data1_->result_page;
	wg_result_page_set_win (_tmp0_, win);
	_tmp1_ = _data1_->result_page;
	wg_result_page_set_word (_tmp1_, word);
	_tmp2_ = _data1_->result_page;
	wg_result_page_reload (_tmp2_);
	_tmp3_ = self->priv->stack;
	gtk_stack_set_visible_child_name (_tmp3_, "result");
}

static void
__wg_window___lambda19__wg_game_page_game_over (WGGamePage* _sender,
                                                WGDataParserWord* word,
                                                gboolean win,
                                                gpointer self)
{
	_wg_window___lambda19_ (self, word, win);
}

static void
_wg_window___lambda20_ (WGWindow* self)
{
	GtkStack* _tmp0_;
	self->priv->game_started = FALSE;
	self->priv->game_over = FALSE;
	_tmp0_ = self->priv->stack;
	gtk_stack_set_visible_child_name (_tmp0_, "welcome");
}

static void
__wg_window___lambda20__wg_result_page_play_again (WGResultPage* _sender,
                                                   gpointer self)
{
	_wg_window___lambda20_ ((WGWindow*) self);
}

static void
_gtk_window_close_wg_result_page_quit (WGResultPage* _sender,
                                       gpointer self)
{
	gtk_window_close ((GtkWindow*) self);
}

static void
_wg_window_back_wg_help_page_back (WGHelpPage* _sender,
                                   gpointer self)
{
	wg_window_back ((WGWindow*) self);
}

static GObject *
wg_window_constructor (GType type,
                       guint n_construct_properties,
                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WGWindow * self;
	Block1Data* _data1_;
	GSimpleAction* help_action = NULL;
	GSimpleAction* _tmp0_;
	GSimpleAction* _tmp1_;
	GSimpleAction* _tmp2_;
	GtkStack* _tmp3_;
	GtkButton* _tmp4_;
	WGWelcomePage* welcome_page = NULL;
	WGWelcomePage* _tmp5_;
	GtkStack* _tmp6_;
	WGWelcomePage* _tmp7_;
	WGGamePage* _tmp8_;
	GtkStack* _tmp9_;
	WGGamePage* _tmp10_;
	WGResultPage* _tmp11_;
	GtkStack* _tmp12_;
	WGResultPage* _tmp13_;
	WGHelpPage* help_page = NULL;
	WGHelpPage* _tmp14_;
	GtkStack* _tmp15_;
	WGHelpPage* _tmp16_;
	WGWelcomePage* _tmp17_;
	WGGamePage* _tmp18_;
	WGResultPage* _tmp19_;
	WGResultPage* _tmp20_;
	WGHelpPage* _tmp21_;
	parent_class = G_OBJECT_CLASS (wg_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WG_TYPE_WINDOW, WGWindow);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->self = g_object_ref (self);
	_tmp0_ = g_simple_action_new ("help", NULL);
	help_action = _tmp0_;
	_tmp1_ = help_action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp1_);
	_tmp2_ = help_action;
	g_signal_connect_object (_tmp2_, "activate", (GCallback) __wg_window___lambda4__g_simple_action_activate, self, 0);
	_tmp3_ = self->priv->stack;
	g_signal_connect_object ((GObject*) _tmp3_, "notify::visible-child-name", (GCallback) _wg_window_update_back_btn_visibility_g_object_notify, self, 0);
	_tmp4_ = self->priv->back_button;
	g_signal_connect_object (_tmp4_, "clicked", (GCallback) _wg_window_back_gtk_button_clicked, self, 0);
	_tmp5_ = wg_welcome_page_new ();
	g_object_ref_sink (_tmp5_);
	welcome_page = _tmp5_;
	_tmp6_ = self->priv->stack;
	_tmp7_ = welcome_page;
	gtk_stack_add_named (_tmp6_, (GtkWidget*) _tmp7_, "welcome");
	_tmp8_ = wg_game_page_new ();
	g_object_ref_sink (_tmp8_);
	_data1_->game_page = _tmp8_;
	_tmp9_ = self->priv->stack;
	_tmp10_ = _data1_->game_page;
	gtk_stack_add_named (_tmp9_, (GtkWidget*) _tmp10_, "game");
	_tmp11_ = wg_result_page_new ();
	g_object_ref_sink (_tmp11_);
	_data1_->result_page = _tmp11_;
	_tmp12_ = self->priv->stack;
	_tmp13_ = _data1_->result_page;
	gtk_stack_add_named (_tmp12_, (GtkWidget*) _tmp13_, "result");
	_tmp14_ = wg_help_page_new ();
	g_object_ref_sink (_tmp14_);
	help_page = _tmp14_;
	_tmp15_ = self->priv->stack;
	_tmp16_ = help_page;
	gtk_stack_add_named (_tmp15_, (GtkWidget*) _tmp16_, "help");
	_tmp17_ = welcome_page;
	g_signal_connect_data (_tmp17_, "play", (GCallback) __wg_window___lambda18__wg_welcome_page_play, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
	_tmp18_ = _data1_->game_page;
	g_signal_connect_data (_tmp18_, "game-over", (GCallback) __wg_window___lambda19__wg_game_page_game_over, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
	_tmp19_ = _data1_->result_page;
	g_signal_connect_object (_tmp19_, "play-again", (GCallback) __wg_window___lambda20__wg_result_page_play_again, self, 0);
	_tmp20_ = _data1_->result_page;
	g_signal_connect_object (_tmp20_, "quit", (GCallback) _gtk_window_close_wg_result_page_quit, (GtkWindow*) self, 0);
	_tmp21_ = help_page;
	g_signal_connect_object (_tmp21_, "back", (GCallback) _wg_window_back_wg_help_page_back, self, 0);
	_g_object_unref0 (help_page);
	_g_object_unref0 (welcome_page);
	_g_object_unref0 (help_action);
	block1_data_unref (_data1_);
	_data1_ = NULL;
	return obj;
}

static void
wg_window_class_init (WGWindowClass * klass,
                      gpointer klass_data)
{
	wg_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WGWindow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_wg_window_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_wg_window_set_property;
	G_OBJECT_CLASS (klass)->constructor = wg_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = wg_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WG_WINDOW_SHOW_BACK_BUTTON_PROPERTY, wg_window_properties[WG_WINDOW_SHOW_BACK_BUTTON_PROPERTY] = g_param_spec_boolean ("show-back-button", "show-back-button", "show-back-button", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/app/drey/Blurble/window.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "back_button", FALSE, WGWindow_private_offset + G_STRUCT_OFFSET (WGWindowPrivate, back_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "menu_button", FALSE, WGWindow_private_offset + G_STRUCT_OFFSET (WGWindowPrivate, menu_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "stack", FALSE, WGWindow_private_offset + G_STRUCT_OFFSET (WGWindowPrivate, stack));
}

static void
wg_window_instance_init (WGWindow * self,
                         gpointer klass)
{
	self->priv = wg_window_get_instance_private (self);
	self->priv->game_started = FALSE;
	self->priv->game_over = FALSE;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
wg_window_finalize (GObject * obj)
{
	WGWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WG_TYPE_WINDOW, WGWindow);
	G_OBJECT_CLASS (wg_window_parent_class)->finalize (obj);
}

static GType
wg_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WGWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) wg_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WGWindow), 0, (GInstanceInitFunc) wg_window_instance_init, NULL };
	GType wg_window_type_id;
	wg_window_type_id = g_type_register_static (adw_application_window_get_type (), "WGWindow", &g_define_type_info, 0);
	WGWindow_private_offset = g_type_add_instance_private (wg_window_type_id, sizeof (WGWindowPrivate));
	return wg_window_type_id;
}

GType
wg_window_get_type (void)
{
	static volatile gsize wg_window_type_id__once = 0;
	if (g_once_init_enter (&wg_window_type_id__once)) {
		GType wg_window_type_id;
		wg_window_type_id = wg_window_get_type_once ();
		g_once_init_leave (&wg_window_type_id__once, wg_window_type_id);
	}
	return wg_window_type_id__once;
}

static void
_vala_wg_window_get_property (GObject * object,
                              guint property_id,
                              GValue * value,
                              GParamSpec * pspec)
{
	WGWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WG_TYPE_WINDOW, WGWindow);
	switch (property_id) {
		case WG_WINDOW_SHOW_BACK_BUTTON_PROPERTY:
		g_value_set_boolean (value, wg_window_get_show_back_button (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_wg_window_set_property (GObject * object,
                              guint property_id,
                              const GValue * value,
                              GParamSpec * pspec)
{
	WGWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WG_TYPE_WINDOW, WGWindow);
	switch (property_id) {
		case WG_WINDOW_SHOW_BACK_BUTTON_PROPERTY:
		wg_window_set_show_back_button (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

