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

/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
   This file is part of GNOME Reversi, also known as Iagno.

   Copyright 2015, 2016, 2019 Arnaud Bonatti

   GNOME Reversi 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.

   GNOME Reversi 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 GNOME Reversi.  If not, see <https://www.gnu.org/licenses/>.
*/

#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>

#define IAGNO_PROGRAM_NAME _ ("Reversi")
#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_GAME_WINDOW (game_window_get_type ())
#define GAME_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GAME_WINDOW, GameWindow))
#define GAME_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GAME_WINDOW, GameWindowClass))
#define IS_GAME_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GAME_WINDOW))
#define IS_GAME_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GAME_WINDOW))
#define GAME_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GAME_WINDOW, GameWindowClass))

typedef struct _GameWindow GameWindow;
typedef struct _GameWindowClass GameWindowClass;
typedef struct _GameWindowPrivate GameWindowPrivate;

#define TYPE_GAME_SELECT_LABEL (game_select_label_get_type ())
#define GAME_SELECT_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GAME_SELECT_LABEL, GameSelectLabel))
#define GAME_SELECT_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GAME_SELECT_LABEL, GameSelectLabelClass))
#define IS_GAME_SELECT_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GAME_SELECT_LABEL))
#define IS_GAME_SELECT_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GAME_SELECT_LABEL))
#define GAME_SELECT_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GAME_SELECT_LABEL, GameSelectLabelClass))

typedef struct _GameSelectLabel GameSelectLabel;
typedef struct _GameSelectLabelClass GameSelectLabelClass;

#define TYPE_HISTORY_BUTTON_LABEL (history_button_label_get_type ())
#define HISTORY_BUTTON_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HISTORY_BUTTON_LABEL, HistoryButtonLabel))
#define HISTORY_BUTTON_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HISTORY_BUTTON_LABEL, HistoryButtonLabelClass))
#define IS_HISTORY_BUTTON_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HISTORY_BUTTON_LABEL))
#define IS_HISTORY_BUTTON_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HISTORY_BUTTON_LABEL))
#define HISTORY_BUTTON_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HISTORY_BUTTON_LABEL, HistoryButtonLabelClass))

typedef struct _HistoryButtonLabel HistoryButtonLabel;
typedef struct _HistoryButtonLabelClass HistoryButtonLabelClass;

#define TYPE_THEME (theme_get_type ())
#define THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THEME, Theme))
#define THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THEME, ThemeClass))
#define IS_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THEME))
#define IS_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THEME))
#define THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THEME, ThemeClass))

typedef struct _Theme Theme;
typedef struct _ThemeClass ThemeClass;
enum  {
	GAME_WINDOW_0_PROPERTY,
	GAME_WINDOW_THEME_PROPERTY,
	GAME_WINDOW_NUM_PROPERTIES
};
static GParamSpec* game_window_properties[GAME_WINDOW_NUM_PROPERTIES];
typedef void (*GSimpleActionActivateCallback) (GSimpleAction* action, GVariant* parameter, gpointer user_data);
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef enum  {
	PLAYER_NONE,
	PLAYER_DARK,
	PLAYER_LIGHT
} Player;

#define TYPE_PLAYER (player_get_type ())
enum  {
	GAME_WINDOW_PLAY_SIGNAL,
	GAME_WINDOW_WAIT_SIGNAL,
	GAME_WINDOW_BACK_SIGNAL,
	GAME_WINDOW_RESTART_SIGNAL,
	GAME_WINDOW_UNDO_SIGNAL,
	GAME_WINDOW_REDO_SIGNAL,
	GAME_WINDOW_HINT_SIGNAL,
	GAME_WINDOW_NUM_SIGNALS
};
static guint game_window_signals[GAME_WINDOW_NUM_SIGNALS] = {0};

struct _GameWindow {
	AdwApplicationWindow parent_instance;
	GameWindowPrivate * priv;
};

struct _GameWindowClass {
	AdwApplicationWindowClass parent_class;
};

struct _GameWindowPrivate {
	AdwWindowTitle* window_title;
	GtkButton* new_game_button;
	GtkButton* back_button;
	GtkMenuButton* info_button;
	AdwToastOverlay* toast_overlay;
	GtkStack* game_stack;
	GtkBox* game_box;
	GtkButton* start_game_button;
	GtkBox* action_bar;
	GtkLabel* game_label;
	GtkBox* new_game_screen;
	GameSelectLabel* reversi_label;
	GameSelectLabel* reverse_label;
	GtkMenuButton* game_type_button;
	GtkMenuButton* level_button;
	AdwToggleGroup* games_box;
	GtkBox* options_box;
	GtkLabel* games_label;
	GtkLabel* options_label;
	GtkSeparator* options_separator;
	GtkBox* history_button1_box;
	GtkMenuButton* history_button1;
	GtkMenuButton* history_button2;
	HistoryButtonLabel* history_button1_label;
	HistoryButtonLabel* history_button2_label;
	GMenu* history_menu;
	GMenu* finish_menu;
	gboolean game_finished;
	GMenu* appearance_menu;
	GtkWidget* game_content;
	Theme* _theme;
	GSimpleAction* escape_action;
	GSimpleAction* undo_action;
	GSimpleAction* redo_action;
	gboolean back_action_disabled;
};

static gint GameWindow_private_offset;
static gpointer game_window_parent_class = NULL;

VALA_EXTERN GType game_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GameWindow, g_object_unref)
VALA_EXTERN GType game_select_label_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GameSelectLabel, g_object_unref)
VALA_EXTERN GType history_button_label_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (HistoryButtonLabel, g_object_unref)
VALA_EXTERN GType theme_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Theme, g_object_unref)
static void game_window_escape_pressed (GameWindow* self);
static void _game_window_escape_pressed_gsimple_action_activate_callback (GSimpleAction* action,
                                                                   GVariant* parameter,
                                                                   gpointer self);
static void game_window_toggle_hamburger (GameWindow* self);
static void _game_window_toggle_hamburger_gsimple_action_activate_callback (GSimpleAction* action,
                                                                     GVariant* parameter,
                                                                     gpointer self);
static void game_window_show_shortcuts (GameWindow* self);
static void _game_window_show_shortcuts_gsimple_action_activate_callback (GSimpleAction* action,
                                                                   GVariant* parameter,
                                                                   gpointer self);
static void game_window_new_game_cb (GameWindow* self);
static void _game_window_new_game_cb_gsimple_action_activate_callback (GSimpleAction* action,
                                                                GVariant* parameter,
                                                                gpointer self);
static void game_window_start_game_cb (GameWindow* self);
static void _game_window_start_game_cb_gsimple_action_activate_callback (GSimpleAction* action,
                                                                  GVariant* parameter,
                                                                  gpointer self);
static void game_window_undo_cb (GameWindow* self);
static void _game_window_undo_cb_gsimple_action_activate_callback (GSimpleAction* action,
                                                            GVariant* parameter,
                                                            gpointer self);
static void game_window_redo_cb (GameWindow* self);
static void _game_window_redo_cb_gsimple_action_activate_callback (GSimpleAction* action,
                                                            GVariant* parameter,
                                                            gpointer self);
static void game_window_hint_cb (GameWindow* self);
static void _game_window_hint_cb_gsimple_action_activate_callback (GSimpleAction* action,
                                                            GVariant* parameter,
                                                            gpointer self);
VALA_EXTERN GameWindow* game_window_new (AdwApplication* app,
                             gboolean start_now,
                             GtkWidget* view_content,
                             GMenu* appearance_menu);
VALA_EXTERN GameWindow* game_window_construct (GType object_type,
                                   AdwApplication* app,
                                   gboolean start_now,
                                   GtkWidget* view_content,
                                   GMenu* appearance_menu);
VALA_EXTERN void game_window_update_hamburger_menu (GameWindow* self);
static void game_window_install_action_entries (GameWindow* self);
static void game_window_install_ui_action_entries (GameWindow* self);
static gboolean __lambda20_ (GameWindow* self,
                      GBinding* binding,
                      GValue* srcval,
                      GValue* targetval);
static gboolean ___lambda20__gbinding_transform_func (GBinding* binding,
                                               GValue* from_value,
                                               GValue* to_value,
                                               gpointer self);
static void game_window_show_view (GameWindow* self);
static void game_window_show_new_game_screen (GameWindow* self);
static void game_window_append_or_not_night_mode_entry (GameWindow* self,
                                                 GMenu** section);
VALA_EXTERN void game_window_update_game_type_label (GameWindow* self,
                                         const gchar* label);
VALA_EXTERN void game_window_update_level_label (GameWindow* self,
                                     const gchar* label);
VALA_EXTERN void game_window_update_level_menu (GameWindow* self,
                                    GMenu* menu);
VALA_EXTERN void game_window_update_level_sensitivity (GameWindow* self,
                                           gboolean new_sensitivity);
VALA_EXTERN void game_window_finish_game (GameWindow* self);
static void game_window_back_cb (GameWindow* self);
VALA_EXTERN gboolean game_window_game_content_visible_if_true (GameWindow* self);
VALA_EXTERN void game_window_configure_transition (GameWindow* self,
                                       GtkStackTransitionType transition_type,
                                       guint transition_duration);
VALA_EXTERN void game_window_hide_notification (GameWindow* self);
VALA_EXTERN void game_window_update_title (GameWindow* self,
                               const gchar* new_title);
VALA_EXTERN void game_window_show_game_content (GameWindow* self,
                                    gboolean grab_focus);
static void game_window_new_game (GameWindow* self);
VALA_EXTERN void game_window_new_turn_start (GameWindow* self,
                                 gboolean can_undo);
VALA_EXTERN void game_window_show_notification (GameWindow* self,
                                    const gchar* notification);
VALA_EXTERN void game_window_set_game_finished (GameWindow* self,
                                    gboolean finished);
VALA_EXTERN GType player_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void game_window_set_player (GameWindow* self,
                             Player player);
VALA_EXTERN void history_button_label_set_player (HistoryButtonLabel* self,
                                      Player value);
VALA_EXTERN Theme* game_window_get_theme (GameWindow* self);
VALA_EXTERN void game_window_set_theme (GameWindow* self,
                            Theme* value);
static GObject * game_window_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties);
static void _game_window_update_hamburger_menu_g_object_notify (GObject* _sender,
                                                         GParamSpec* pspec,
                                                         gpointer self);
static void game_window_finalize (GObject * obj);
static GType game_window_get_type_once (void);
static void _vala_game_window_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec);
static void _vala_game_window_set_property (GObject * object,
                                     guint property_id,
                                     const GValue * value,
                                     GParamSpec * pspec);

static const GActionEntry GAME_WINDOW_action_entries[3] = {{"escape", _game_window_escape_pressed_gsimple_action_activate_callback}, {"toggle-hamburger", _game_window_toggle_hamburger_gsimple_action_activate_callback}, {"show-shortcuts", _game_window_show_shortcuts_gsimple_action_activate_callback}};
static const GActionEntry GAME_WINDOW_ui_action_entries[5] = {{"new-game", _game_window_new_game_cb_gsimple_action_activate_callback}, {"start-game", _game_window_start_game_cb_gsimple_action_activate_callback}, {"undo", _game_window_undo_cb_gsimple_action_activate_callback}, {"redo", _game_window_redo_cb_gsimple_action_activate_callback}, {"hint", _game_window_hint_cb_gsimple_action_activate_callback}};

static inline gpointer
game_window_get_instance_private (GameWindow* self)
{
	return G_STRUCT_MEMBER_P (self, GameWindow_private_offset);
}

static void
_game_window_escape_pressed_gsimple_action_activate_callback (GSimpleAction* action,
                                                              GVariant* parameter,
                                                              gpointer self)
{
	game_window_escape_pressed ((GameWindow*) self);
}

static void
_game_window_toggle_hamburger_gsimple_action_activate_callback (GSimpleAction* action,
                                                                GVariant* parameter,
                                                                gpointer self)
{
	game_window_toggle_hamburger ((GameWindow*) self);
}

static void
_game_window_show_shortcuts_gsimple_action_activate_callback (GSimpleAction* action,
                                                              GVariant* parameter,
                                                              gpointer self)
{
	game_window_show_shortcuts ((GameWindow*) self);
}

static void
_game_window_new_game_cb_gsimple_action_activate_callback (GSimpleAction* action,
                                                           GVariant* parameter,
                                                           gpointer self)
{
	game_window_new_game_cb ((GameWindow*) self);
}

static void
_game_window_start_game_cb_gsimple_action_activate_callback (GSimpleAction* action,
                                                             GVariant* parameter,
                                                             gpointer self)
{
	game_window_start_game_cb ((GameWindow*) self);
}

static void
_game_window_undo_cb_gsimple_action_activate_callback (GSimpleAction* action,
                                                       GVariant* parameter,
                                                       gpointer self)
{
	game_window_undo_cb ((GameWindow*) self);
}

static void
_game_window_redo_cb_gsimple_action_activate_callback (GSimpleAction* action,
                                                       GVariant* parameter,
                                                       gpointer self)
{
	game_window_redo_cb ((GameWindow*) self);
}

static void
_game_window_hint_cb_gsimple_action_activate_callback (GSimpleAction* action,
                                                       GVariant* parameter,
                                                       gpointer self)
{
	game_window_hint_cb ((GameWindow*) self);
}

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

static gboolean
__lambda20_ (GameWindow* self,
             GBinding* binding,
             GValue* srcval,
             GValue* targetval)
{
	GtkOrientation _tmp0_ = 0;
	gboolean result;
	g_return_val_if_fail (binding != NULL, FALSE);
	g_return_val_if_fail (srcval != NULL, FALSE);
	g_return_val_if_fail (targetval != NULL, FALSE);
	if (g_value_get_enum (srcval) == ((gint) GTK_ORIENTATION_HORIZONTAL)) {
		_tmp0_ = GTK_ORIENTATION_VERTICAL;
	} else {
		_tmp0_ = GTK_ORIENTATION_HORIZONTAL;
	}
	g_value_set_enum (targetval, (gint) _tmp0_);
	result = TRUE;
	return result;
}

static gboolean
___lambda20__gbinding_transform_func (GBinding* binding,
                                      GValue* from_value,
                                      GValue* to_value,
                                      gpointer self)
{
	gboolean result;
	result = __lambda20_ ((GameWindow*) self, binding, from_value, to_value);
	return result;
}

GameWindow*
game_window_construct (GType object_type,
                       AdwApplication* app,
                       gboolean start_now,
                       GtkWidget* view_content,
                       GMenu* appearance_menu)
{
	GameWindow * self = NULL;
	AdwWindowTitle* _tmp0_;
	GtkWidget* _tmp1_;
	GMenu* _tmp2_;
	GMenu* _tmp3_;
	GMenu* _tmp4_;
	GMenu* _tmp5_;
	GMenu* _tmp6_;
	GMenu* _tmp7_;
	GMenu* _tmp8_;
	GtkWidget* _tmp9_;
	GtkWidget* _tmp10_;
	GtkWidget* _tmp11_;
	GtkWidget* _tmp12_;
	GtkWidget* _tmp13_;
	GtkWidget* _tmp14_;
	GtkWidget* _tmp15_;
	GtkWidget* _tmp16_;
	GtkBox* _tmp17_;
	GtkWidget* _tmp18_;
	GtkBox* _tmp19_;
	GtkSeparator* _tmp20_;
	HistoryButtonLabel* _tmp21_;
	HistoryButtonLabel* _tmp22_;
	GSettings* settings = NULL;
	GSettings* _tmp23_;
	GSettings* _tmp24_;
	GSettings* _tmp25_;
	GSettings* _tmp26_;
	GSettings* settings_app = NULL;
	GSettings* _tmp27_;
	GSettings* _tmp28_;
	AdwToggleGroup* _tmp29_;
	g_return_val_if_fail (app != NULL, NULL);
	g_return_val_if_fail (view_content != NULL, NULL);
	self = (GameWindow*) g_object_new (object_type, "application", app, "title", IAGNO_PROGRAM_NAME, NULL);
	_tmp0_ = self->priv->window_title;
	adw_window_title_set_title (_tmp0_, IAGNO_PROGRAM_NAME);
	_tmp1_ = _g_object_ref0 (view_content);
	_g_object_unref0 (self->priv->game_content);
	self->priv->game_content = _tmp1_;
	if (g_str_has_suffix (APP_ID, ".Devel")) {
		gtk_widget_add_css_class ((GtkWidget*) self, "devel");
	}
	_tmp2_ = _g_object_ref0 (appearance_menu);
	_g_object_unref0 (self->priv->appearance_menu);
	self->priv->appearance_menu = _tmp2_;
	game_window_update_hamburger_menu (self);
	_tmp3_ = g_menu_new ();
	_g_object_unref0 (self->priv->history_menu);
	self->priv->history_menu = _tmp3_;
	_tmp4_ = self->priv->history_menu;
	g_menu_append (_tmp4_, _ ("_Undo last move"), "ui.undo");
	_tmp5_ = self->priv->history_menu;
	g_menu_freeze (_tmp5_);
	_tmp6_ = g_menu_new ();
	_g_object_unref0 (self->priv->finish_menu);
	self->priv->finish_menu = _tmp6_;
	_tmp7_ = self->priv->finish_menu;
	g_menu_append (_tmp7_, _ ("_Show final board"), "ui.undo");
	_tmp8_ = self->priv->finish_menu;
	g_menu_freeze (_tmp8_);
	_tmp9_ = self->priv->game_content;
	gtk_widget_set_hexpand (_tmp9_, TRUE);
	_tmp10_ = self->priv->game_content;
	gtk_widget_set_vexpand (_tmp10_, TRUE);
	_tmp11_ = self->priv->game_content;
	gtk_widget_set_halign (_tmp11_, GTK_ALIGN_FILL);
	_tmp12_ = self->priv->game_content;
	gtk_widget_set_valign (_tmp12_, GTK_ALIGN_FILL);
	_tmp13_ = self->priv->game_content;
	gtk_widget_set_margin_start (_tmp13_, 6);
	_tmp14_ = self->priv->game_content;
	gtk_widget_set_margin_end (_tmp14_, 6);
	_tmp15_ = self->priv->game_content;
	gtk_widget_set_margin_top (_tmp15_, 6);
	_tmp16_ = self->priv->game_content;
	gtk_widget_set_margin_bottom (_tmp16_, 6);
	_tmp17_ = self->priv->game_box;
	_tmp18_ = self->priv->game_content;
	gtk_box_prepend (_tmp17_, _tmp18_);
	game_window_install_action_entries (self);
	game_window_install_ui_action_entries (self);
	_tmp19_ = self->priv->new_game_screen;
	_tmp20_ = self->priv->options_separator;
	g_object_bind_property_with_closures ((GObject*) _tmp19_, "orientation", (GObject*) _tmp20_, "orientation", G_BINDING_SYNC_CREATE, (GClosure*) ((___lambda20__gbinding_transform_func == NULL) ? NULL : g_cclosure_new ((GCallback) ___lambda20__gbinding_transform_func, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp21_ = self->priv->history_button1_label;
	g_object_bind_property_with_closures ((GObject*) self, "theme", (GObject*) _tmp21_, "theme", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp22_ = self->priv->history_button2_label;
	g_object_bind_property_with_closures ((GObject*) self, "theme", (GObject*) _tmp22_, "theme", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp23_ = g_settings_new_with_path ("org.gnome.Reversi.Lib", "/org/gnome/iagno/");
	settings = _tmp23_;
	_tmp24_ = settings;
	g_settings_bind (_tmp24_, "window-width", (GObject*) self, "default-width", G_SETTINGS_BIND_DEFAULT);
	_tmp25_ = settings;
	g_settings_bind (_tmp25_, "window-height", (GObject*) self, "default-height", G_SETTINGS_BIND_DEFAULT);
	_tmp26_ = settings;
	g_settings_bind (_tmp26_, "window-is-maximized", (GObject*) self, "maximized", G_SETTINGS_BIND_DEFAULT);
	_tmp27_ = g_settings_new ("org.gnome.Reversi");
	settings_app = _tmp27_;
	_tmp28_ = settings_app;
	_tmp29_ = self->priv->games_box;
	g_settings_bind (_tmp28_, "type", (GObject*) _tmp29_, "active-name", G_SETTINGS_BIND_DEFAULT);
	if (start_now) {
		game_window_show_view (self);
	} else {
		game_window_show_new_game_screen (self);
	}
	_g_object_unref0 (settings_app);
	_g_object_unref0 (settings);
	return self;
}

GameWindow*
game_window_new (AdwApplication* app,
                 gboolean start_now,
                 GtkWidget* view_content,
                 GMenu* appearance_menu)
{
	return game_window_construct (TYPE_GAME_WINDOW, app, start_now, view_content, appearance_menu);
}

void
game_window_update_hamburger_menu (GameWindow* self)
{
	GMenu* menu = NULL;
	GMenu* _tmp0_;
	GtkMenuButton* _tmp14_;
	GMenu* _tmp15_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_menu_new ();
	menu = _tmp0_;
	{
		GMenu* section = NULL;
		GMenu* _tmp1_;
		GMenu* _tmp2_;
		GMenu* _tmp5_;
		GMenu* _tmp6_;
		GMenu* _tmp7_;
		_tmp1_ = g_menu_new ();
		section = _tmp1_;
		_tmp2_ = self->priv->appearance_menu;
		if (_tmp2_ != NULL) {
			GMenu* _tmp3_;
			GMenu* _tmp4_;
			_tmp3_ = section;
			_tmp4_ = self->priv->appearance_menu;
			g_menu_append_submenu (_tmp3_, _ ("A_ppearance"), (GMenuModel*) G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, g_menu_get_type (), GMenu));
		}
		_tmp5_ = section;
		g_menu_append (_tmp5_, _ ("_Sound"), "app.sound");
		_tmp6_ = menu;
		_tmp7_ = section;
		g_menu_append_section (_tmp6_, NULL, (GMenuModel*) _tmp7_);
		_g_object_unref0 (section);
	}
	{
		GMenu* section = NULL;
		GMenu* _tmp8_;
		GMenu* _tmp9_;
		GMenu* _tmp10_;
		GMenu* _tmp11_;
		GMenu* _tmp12_;
		GMenu* _tmp13_;
		_tmp8_ = g_menu_new ();
		section = _tmp8_;
		game_window_append_or_not_night_mode_entry (self, &section);
		_tmp9_ = section;
		g_menu_append (_tmp9_, _ ("_Keyboard Shortcuts"), "base.show-shortcuts");
		_tmp10_ = section;
		g_menu_append (_tmp10_, _ ("_Help"), "app.help");
		_tmp11_ = section;
		g_menu_append (_tmp11_, _ ("_About Reversi"), "app.about");
		_tmp12_ = menu;
		_tmp13_ = section;
		g_menu_append_section (_tmp12_, NULL, (GMenuModel*) _tmp13_);
		_g_object_unref0 (section);
	}
	_tmp14_ = self->priv->info_button;
	_tmp15_ = menu;
	gtk_menu_button_set_menu_model (_tmp14_, G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, g_menu_model_get_type (), GMenuModel));
	_g_object_unref0 (menu);
}

static void
game_window_append_or_not_night_mode_entry (GameWindow* self,
                                            GMenu** section)
{
	AdwStyleManager* style_manager = NULL;
	AdwStyleManager* _tmp0_;
	AdwStyleManager* _tmp1_;
	AdwStyleManager* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	AdwStyleManager* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (*section != NULL);
	_tmp0_ = adw_style_manager_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	style_manager = _tmp1_;
	_tmp2_ = style_manager;
	_tmp3_ = adw_style_manager_get_high_contrast (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		_g_object_unref0 (style_manager);
		return;
	}
	_tmp5_ = style_manager;
	_tmp6_ = adw_style_manager_get_dark (_tmp5_);
	_tmp7_ = _tmp6_;
	if (_tmp7_) {
		g_menu_append (*section, _ ("Pause night mode"), "app.set-use-night-mode(false)");
	} else {
		AdwStyleManager* _tmp8_;
		AdwColorScheme _tmp9_;
		AdwColorScheme _tmp10_;
		_tmp8_ = style_manager;
		_tmp9_ = adw_style_manager_get_color_scheme (_tmp8_);
		_tmp10_ = _tmp9_;
		if (_tmp10_ != ADW_COLOR_SCHEME_PREFER_DARK) {
			g_menu_append (*section, _ ("Reuse night mode"), "app.set-use-night-mode(true)");
		} else {
			g_menu_append (*section, _ ("Use night mode"), "app.set-use-night-mode(true)");
		}
	}
	_g_object_unref0 (style_manager);
}

inline void
game_window_update_game_type_label (GameWindow* self,
                                    const gchar* label)
{
	GtkMenuButton* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label != NULL);
	_tmp0_ = self->priv->game_type_button;
	gtk_menu_button_set_label (_tmp0_, label);
}

inline void
game_window_update_level_label (GameWindow* self,
                                const gchar* label)
{
	GtkMenuButton* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label != NULL);
	_tmp0_ = self->priv->level_button;
	gtk_menu_button_set_label (_tmp0_, label);
}

inline void
game_window_update_level_menu (GameWindow* self,
                               GMenu* menu)
{
	GtkMenuButton* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (menu != NULL);
	_tmp0_ = self->priv->level_button;
	gtk_menu_button_set_menu_model (_tmp0_, (GMenuModel*) menu);
}

inline void
game_window_update_level_sensitivity (GameWindow* self,
                                      gboolean new_sensitivity)
{
	GtkMenuButton* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->level_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, new_sensitivity);
}

void
game_window_finish_game (GameWindow* self)
{
	GtkMenuButton* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	self->priv->game_finished = TRUE;
	_tmp0_ = self->priv->history_button1;
	_tmp1_ = gtk_menu_button_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		GtkButton* _tmp3_;
		_tmp3_ = self->priv->new_game_button;
		gtk_widget_grab_focus ((GtkWidget*) _tmp3_);
	} else {
		GtkButton* _tmp4_;
		_tmp4_ = self->priv->new_game_button;
		gtk_window_set_default_widget ((GtkWindow*) self, (GtkWidget*) _tmp4_);
	}
}

static void
game_window_escape_pressed (GameWindow* self)
{
	g_return_if_fail (self != NULL);
	if (!self->priv->back_action_disabled) {
		game_window_back_cb (self);
	}
}

static void
game_window_back_cb (GameWindow* self)
{
	g_return_if_fail (self != NULL);
	if (game_window_game_content_visible_if_true (self)) {
		return;
	}
	game_window_configure_transition (self, GTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT, (guint) 800);
	game_window_show_view (self);
	g_signal_emit (self, game_window_signals[GAME_WINDOW_BACK_SIGNAL], 0);
}

static void
game_window_show_new_game_screen (GameWindow* self)
{
	GtkStack* _tmp0_;
	GtkBox* _tmp1_;
	gboolean _tmp2_ = FALSE;
	g_return_if_fail (self != NULL);
	game_window_hide_notification (self);
	game_window_update_title (self, IAGNO_PROGRAM_NAME);
	_tmp0_ = self->priv->game_stack;
	gtk_stack_set_visible_child_name (_tmp0_, "new-game");
	_tmp1_ = self->priv->history_button1_box;
	gtk_widget_set_visible ((GtkWidget*) _tmp1_, FALSE);
	if (!self->priv->game_finished) {
		GtkButton* _tmp3_;
		gboolean _tmp4_;
		gboolean _tmp5_;
		_tmp3_ = self->priv->back_button;
		_tmp4_ = gtk_widget_get_visible ((GtkWidget*) _tmp3_);
		_tmp5_ = _tmp4_;
		_tmp2_ = _tmp5_;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		GtkButton* _tmp6_;
		_tmp6_ = self->priv->back_button;
		gtk_widget_grab_focus ((GtkWidget*) _tmp6_);
	} else {
		GtkButton* _tmp7_;
		_tmp7_ = self->priv->start_game_button;
		gtk_widget_grab_focus ((GtkWidget*) _tmp7_);
	}
}

static void
game_window_show_view (GameWindow* self)
{
	GtkButton* _tmp0_;
	GtkButton* _tmp1_;
	GtkBox* _tmp2_;
	gboolean grabs_focus = FALSE;
	GSimpleAction* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->back_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, FALSE);
	_tmp1_ = self->priv->new_game_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp1_, TRUE);
	_tmp2_ = self->priv->history_button1_box;
	gtk_widget_set_visible ((GtkWidget*) _tmp2_, TRUE);
	if (self->priv->game_finished) {
		GtkButton* _tmp3_;
		_tmp3_ = self->priv->new_game_button;
		gtk_widget_grab_focus ((GtkWidget*) _tmp3_);
		grabs_focus = FALSE;
	} else {
		grabs_focus = TRUE;
	}
	game_window_show_game_content (self, grabs_focus);
	_tmp4_ = self->priv->escape_action;
	g_simple_action_set_enabled (_tmp4_, FALSE);
}

static void
game_window_install_action_entries (GameWindow* self)
{
	GSimpleActionGroup* action_group = NULL;
	GSimpleActionGroup* _tmp0_;
	GAction* tmp_action = NULL;
	GAction* _tmp1_;
	GAction* _tmp2_;
	GSimpleAction* _tmp3_;
	GSimpleAction* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_simple_action_group_new ();
	action_group = _tmp0_;
	g_action_map_add_action_entries ((GActionMap*) action_group, GAME_WINDOW_action_entries, (gint) G_N_ELEMENTS (GAME_WINDOW_action_entries), self);
	gtk_widget_insert_action_group ((GtkWidget*) self, "base", (GActionGroup*) action_group);
	_tmp1_ = g_action_map_lookup_action ((GActionMap*) action_group, "escape");
	_tmp2_ = _g_object_ref0 (_tmp1_);
	tmp_action = _tmp2_;
	if (tmp_action == NULL) {
		g_assert_not_reached ();
	}
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (tmp_action, g_action_get_type (), GAction), g_simple_action_get_type (), GSimpleAction));
	_g_object_unref0 (self->priv->escape_action);
	self->priv->escape_action = _tmp3_;
	_tmp4_ = self->priv->escape_action;
	g_simple_action_set_enabled (_tmp4_, FALSE);
	_g_object_unref0 (tmp_action);
	_g_object_unref0 (action_group);
}

static void
game_window_install_ui_action_entries (GameWindow* self)
{
	GSimpleActionGroup* action_group = NULL;
	GSimpleActionGroup* _tmp0_;
	GAction* _tmp1_;
	GSimpleAction* _tmp2_;
	GAction* _tmp3_;
	GSimpleAction* _tmp4_;
	GSimpleAction* _tmp5_;
	GSimpleAction* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_simple_action_group_new ();
	action_group = _tmp0_;
	g_action_map_add_action_entries ((GActionMap*) action_group, GAME_WINDOW_ui_action_entries, (gint) G_N_ELEMENTS (GAME_WINDOW_ui_action_entries), self);
	gtk_widget_insert_action_group ((GtkWidget*) self, "ui", (GActionGroup*) action_group);
	_tmp1_ = g_action_map_lookup_action ((GActionMap*) action_group, "undo");
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, g_simple_action_get_type (), GSimpleAction));
	_g_object_unref0 (self->priv->undo_action);
	self->priv->undo_action = _tmp2_;
	_tmp3_ = g_action_map_lookup_action ((GActionMap*) action_group, "redo");
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, g_simple_action_get_type (), GSimpleAction));
	_g_object_unref0 (self->priv->redo_action);
	self->priv->redo_action = _tmp4_;
	_tmp5_ = self->priv->undo_action;
	g_simple_action_set_enabled (_tmp5_, FALSE);
	_tmp6_ = self->priv->redo_action;
	g_simple_action_set_enabled (_tmp6_, FALSE);
	_g_object_unref0 (action_group);
}

static void
game_window_toggle_hamburger (GameWindow* self)
{
	GtkMenuButton* _tmp0_;
	GtkMenuButton* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->info_button;
	_tmp1_ = self->priv->info_button;
	_tmp2_ = gtk_menu_button_get_active (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_menu_button_set_active (_tmp0_, !_tmp3_);
}

static void
game_window_show_shortcuts (GameWindow* self)
{
	GtkBuilder* builder = NULL;
	GtkBuilder* _tmp0_;
	AdwDialog* dialog = NULL;
	GObject* _tmp1_;
	AdwDialog* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_builder_new_from_resource ("/org/gnome/Reversi/ui/help-overlay.ui");
	builder = _tmp0_;
	_tmp1_ = gtk_builder_get_object (builder, "help_overlay");
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, adw_dialog_get_type (), AdwDialog));
	dialog = _tmp2_;
	adw_dialog_present (dialog, (GtkWidget*) self);
	_g_object_unref0 (dialog);
	_g_object_unref0 (builder);
}

static void
game_window_new_game_cb (GameWindow* self)
{
	g_return_if_fail (self != NULL);
	if (!game_window_game_content_visible_if_true (self)) {
		return;
	}
	game_window_new_game (self);
}

static void
game_window_undo_cb (GameWindow* self)
{
	g_return_if_fail (self != NULL);
	if (!game_window_game_content_visible_if_true (self)) {
		if (!self->priv->back_action_disabled) {
			game_window_back_cb (self);
		}
		return;
	}
	self->priv->game_finished = FALSE;
	game_window_show_game_content (self, TRUE);
	g_signal_emit (self, game_window_signals[GAME_WINDOW_UNDO_SIGNAL], 0);
}

static void
game_window_redo_cb (GameWindow* self)
{
	GSimpleAction* _tmp0_;
	g_return_if_fail (self != NULL);
	if (!game_window_game_content_visible_if_true (self)) {
		return;
	}
	game_window_show_game_content (self, TRUE);
	_tmp0_ = self->priv->undo_action;
	g_simple_action_set_enabled (_tmp0_, TRUE);
	g_signal_emit (self, game_window_signals[GAME_WINDOW_REDO_SIGNAL], 0);
}

static void
game_window_hint_cb (GameWindow* self)
{
	g_return_if_fail (self != NULL);
	if (!game_window_game_content_visible_if_true (self)) {
		return;
	}
	g_signal_emit (self, game_window_signals[GAME_WINDOW_HINT_SIGNAL], 0);
}

void
game_window_new_turn_start (GameWindow* self,
                            gboolean can_undo)
{
	GSimpleAction* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->undo_action;
	g_simple_action_set_enabled (_tmp0_, can_undo);
	game_window_hide_notification (self);
}

void
game_window_update_title (GameWindow* self,
                          const gchar* new_title)
{
	AdwWindowTitle* _tmp0_;
	GtkLabel* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_title != NULL);
	_tmp0_ = self->priv->window_title;
	adw_window_title_set_title (_tmp0_, new_title);
	_tmp1_ = self->priv->game_label;
	gtk_label_set_label (_tmp1_, new_title);
}

static void
game_window_new_game (GameWindow* self)
{
	GtkButton* _tmp0_;
	GtkButton* _tmp1_;
	GSimpleAction* _tmp2_;
	g_return_if_fail (self != NULL);
	g_signal_emit (self, game_window_signals[GAME_WINDOW_WAIT_SIGNAL], 0);
	game_window_configure_transition (self, GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT, (guint) 800);
	_tmp0_ = self->priv->back_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, TRUE);
	_tmp1_ = self->priv->new_game_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp1_, FALSE);
	self->priv->back_action_disabled = FALSE;
	_tmp2_ = self->priv->escape_action;
	g_simple_action_set_enabled (_tmp2_, TRUE);
	game_window_show_new_game_screen (self);
}

static void
game_window_start_game_cb (GameWindow* self)
{
	GSimpleAction* _tmp0_;
	g_return_if_fail (self != NULL);
	if (game_window_game_content_visible_if_true (self)) {
		return;
	}
	self->priv->game_finished = FALSE;
	_tmp0_ = self->priv->undo_action;
	g_simple_action_set_enabled (_tmp0_, FALSE);
	g_signal_emit (self, game_window_signals[GAME_WINDOW_PLAY_SIGNAL], 0);
	game_window_configure_transition (self, GTK_STACK_TRANSITION_TYPE_SLIDE_DOWN, (guint) 1000);
	game_window_show_view (self);
}

void
game_window_show_notification (GameWindow* self,
                               const gchar* notification)
{
	AdwToastOverlay* _tmp0_;
	AdwToast* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (notification != NULL);
	_tmp0_ = self->priv->toast_overlay;
	_tmp1_ = adw_toast_new (notification);
	adw_toast_overlay_add_toast (_tmp0_, _tmp1_);
}

void
game_window_hide_notification (GameWindow* self)
{
	AdwToastOverlay* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->toast_overlay;
	adw_toast_overlay_dismiss_all (_tmp0_);
}

void
game_window_show_game_content (GameWindow* self,
                               gboolean grab_focus)
{
	GtkStack* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->game_stack;
	gtk_stack_set_visible_child_name (_tmp0_, "game");
	if (grab_focus) {
		GtkWidget* _tmp1_;
		_tmp1_ = self->priv->game_content;
		gtk_widget_grab_focus (_tmp1_);
	}
}

gboolean
game_window_game_content_visible_if_true (GameWindow* self)
{
	GtkStack* _tmp0_;
	const gchar* _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->game_stack;
	_tmp1_ = gtk_stack_get_visible_child_name (_tmp0_);
	result = g_strcmp0 (_tmp1_, "game") == 0;
	return result;
}

void
game_window_configure_transition (GameWindow* self,
                                  GtkStackTransitionType transition_type,
                                  guint transition_duration)
{
	GtkStack* _tmp0_;
	GtkStack* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->game_stack;
	gtk_stack_set_transition_type (_tmp0_, transition_type);
	_tmp1_ = self->priv->game_stack;
	gtk_stack_set_transition_duration (_tmp1_, transition_duration);
}

void
game_window_set_game_finished (GameWindow* self,
                               gboolean finished)
{
	GMenu* _tmp0_ = NULL;
	GMenu* menu = NULL;
	GMenu* _tmp3_;
	GtkMenuButton* _tmp4_;
	GtkMenuButton* _tmp5_;
	g_return_if_fail (self != NULL);
	if (finished) {
		GMenu* _tmp1_;
		_tmp1_ = self->priv->finish_menu;
		_tmp0_ = _tmp1_;
	} else {
		GMenu* _tmp2_;
		_tmp2_ = self->priv->history_menu;
		_tmp0_ = _tmp2_;
	}
	_tmp3_ = _g_object_ref0 (_tmp0_);
	menu = _tmp3_;
	_tmp4_ = self->priv->history_button1;
	gtk_menu_button_set_menu_model (_tmp4_, (GMenuModel*) menu);
	_tmp5_ = self->priv->history_button2;
	gtk_menu_button_set_menu_model (_tmp5_, (GMenuModel*) menu);
	_g_object_unref0 (menu);
}

void
game_window_set_player (GameWindow* self,
                        Player player)
{
	HistoryButtonLabel* _tmp0_;
	HistoryButtonLabel* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->history_button1_label;
	history_button_label_set_player (_tmp0_, player);
	_tmp1_ = self->priv->history_button2_label;
	history_button_label_set_player (_tmp1_, player);
}

Theme*
game_window_get_theme (GameWindow* self)
{
	Theme* result;
	Theme* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_theme;
	result = _tmp0_;
	return result;
}

void
game_window_set_theme (GameWindow* self,
                       Theme* value)
{
	Theme* old_value;
	g_return_if_fail (self != NULL);
	old_value = game_window_get_theme (self);
	if (old_value != value) {
		Theme* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_theme);
		self->priv->_theme = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, game_window_properties[GAME_WINDOW_THEME_PROPERTY]);
	}
}

static void
_game_window_update_hamburger_menu_g_object_notify (GObject* _sender,
                                                    GParamSpec* pspec,
                                                    gpointer self)
{
	game_window_update_hamburger_menu ((GameWindow*) self);
}

static GObject *
game_window_constructor (GType type,
                         guint n_construct_properties,
                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GameWindow * self;
	AdwStyleManager* style_manager = NULL;
	AdwStyleManager* _tmp0_;
	AdwStyleManager* _tmp1_;
	AdwStyleManager* _tmp2_;
	AdwStyleManager* _tmp3_;
	parent_class = G_OBJECT_CLASS (game_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_GAME_WINDOW, GameWindow);
	_tmp0_ = adw_style_manager_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	style_manager = _tmp1_;
	_tmp2_ = style_manager;
	g_signal_connect_object ((GObject*) _tmp2_, "notify::dark", (GCallback) _game_window_update_hamburger_menu_g_object_notify, self, 0);
	_tmp3_ = style_manager;
	g_signal_connect_object ((GObject*) _tmp3_, "notify::high-contrast", (GCallback) _game_window_update_hamburger_menu_g_object_notify, self, 0);
	_g_object_unref0 (style_manager);
	return obj;
}

static void
game_window_class_init (GameWindowClass * klass,
                        gpointer klass_data)
{
	game_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GameWindow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_game_window_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_game_window_set_property;
	G_OBJECT_CLASS (klass)->constructor = game_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = game_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAME_WINDOW_THEME_PROPERTY, game_window_properties[GAME_WINDOW_THEME_PROPERTY] = g_param_spec_object ("theme", "theme", "theme", TYPE_THEME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Reversi/ui/game-window.ui");
	game_window_signals[GAME_WINDOW_PLAY_SIGNAL] = g_signal_new ("play", TYPE_GAME_WINDOW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	game_window_signals[GAME_WINDOW_WAIT_SIGNAL] = g_signal_new ("wait", TYPE_GAME_WINDOW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	game_window_signals[GAME_WINDOW_BACK_SIGNAL] = g_signal_new ("back", TYPE_GAME_WINDOW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	game_window_signals[GAME_WINDOW_RESTART_SIGNAL] = g_signal_new ("restart", TYPE_GAME_WINDOW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	game_window_signals[GAME_WINDOW_UNDO_SIGNAL] = g_signal_new ("undo", TYPE_GAME_WINDOW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	game_window_signals[GAME_WINDOW_REDO_SIGNAL] = g_signal_new ("redo", TYPE_GAME_WINDOW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	game_window_signals[GAME_WINDOW_HINT_SIGNAL] = g_signal_new ("hint", TYPE_GAME_WINDOW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "window_title", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, window_title));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "new_game_button", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, new_game_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "back_button", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, back_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "info_button", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, info_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "toast_overlay", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, toast_overlay));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "game_stack", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, game_stack));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "game_box", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, game_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "start_game_button", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, start_game_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "action_bar", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, action_bar));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "game_label", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, game_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "new_game_screen", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, new_game_screen));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "reversi_label", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, reversi_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "reverse_label", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, reverse_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "game_type_button", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, game_type_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "level_button", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, level_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "games_box", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, games_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "options_box", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, options_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "games_label", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, games_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "options_label", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, options_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "options_separator", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, options_separator));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "history_button1_box", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, history_button1_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "history_button1", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, history_button1));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "history_button2", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, history_button2));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "history_button1_label", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, history_button1_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "history_button2_label", FALSE, GameWindow_private_offset + G_STRUCT_OFFSET (GameWindowPrivate, history_button2_label));
}

static void
game_window_instance_init (GameWindow * self,
                           gpointer klass)
{
	self->priv = game_window_get_instance_private (self);
	self->priv->game_finished = FALSE;
	self->priv->appearance_menu = NULL;
	self->priv->back_action_disabled = TRUE;
	g_type_ensure (TYPE_GAME_SELECT_LABEL);
	g_type_ensure (TYPE_GAME_SELECT_LABEL);
	g_type_ensure (TYPE_HISTORY_BUTTON_LABEL);
	g_type_ensure (TYPE_HISTORY_BUTTON_LABEL);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
game_window_finalize (GObject * obj)
{
	GameWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_GAME_WINDOW, GameWindow);
	_g_object_unref0 (self->priv->history_menu);
	_g_object_unref0 (self->priv->finish_menu);
	_g_object_unref0 (self->priv->appearance_menu);
	_g_object_unref0 (self->priv->game_content);
	_g_object_unref0 (self->priv->_theme);
	_g_object_unref0 (self->priv->escape_action);
	_g_object_unref0 (self->priv->undo_action);
	_g_object_unref0 (self->priv->redo_action);
	G_OBJECT_CLASS (game_window_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
game_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GameWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) game_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GameWindow), 0, (GInstanceInitFunc) game_window_instance_init, NULL };
	GType game_window_type_id;
	game_window_type_id = g_type_register_static (adw_application_window_get_type (), "GameWindow", &g_define_type_info, G_TYPE_FLAG_NONE);
	GameWindow_private_offset = g_type_add_instance_private (game_window_type_id, sizeof (GameWindowPrivate));
	return game_window_type_id;
}

GType
game_window_get_type (void)
{
	static gsize game_window_type_id__once = 0;
	if (g_once_init_enter (&game_window_type_id__once)) {
		GType game_window_type_id;
		game_window_type_id = game_window_get_type_once ();
		g_once_init_leave (&game_window_type_id__once, game_window_type_id);
	}
	return game_window_type_id__once;
}

static void
_vala_game_window_get_property (GObject * object,
                                guint property_id,
                                GValue * value,
                                GParamSpec * pspec)
{
	GameWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_GAME_WINDOW, GameWindow);
	switch (property_id) {
		case GAME_WINDOW_THEME_PROPERTY:
		g_value_set_object (value, game_window_get_theme (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_game_window_set_property (GObject * object,
                                guint property_id,
                                const GValue * value,
                                GParamSpec * pspec)
{
	GameWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_GAME_WINDOW, GameWindow);
	switch (property_id) {
		case GAME_WINDOW_THEME_PROPERTY:
		game_window_set_theme (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

