/* theme-manager.c generated by valac 0.56.19, the Vala compiler
 * generated from theme-manager.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 2020 Arnaud Bonatti
   Copyright 2026 Andrey Kutejko

   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 <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <adwaita.h>
#include <glycin.h>
#include <float.h>
#include <math.h>
#include <gio/gio.h>
#include <gdk/gdk.h>
#include <glycin-gtk4.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_THEME_MANAGER (theme_manager_get_type ())
#define THEME_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THEME_MANAGER, ThemeManager))
#define THEME_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THEME_MANAGER, ThemeManagerClass))
#define IS_THEME_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THEME_MANAGER))
#define IS_THEME_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THEME_MANAGER))
#define THEME_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THEME_MANAGER, ThemeManagerClass))

typedef struct _ThemeManager ThemeManager;
typedef struct _ThemeManagerClass ThemeManagerClass;
typedef struct _ThemeManagerPrivate ThemeManagerPrivate;

#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  {
	THEME_MANAGER_0_PROPERTY,
	THEME_MANAGER_THEME_PROPERTY,
	THEME_MANAGER_THEME_NAME_PROPERTY,
	THEME_MANAGER_NUM_PROPERTIES
};
static GParamSpec* theme_manager_properties[THEME_MANAGER_NUM_PROPERTIES];
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_dir_close0(var) ((var == NULL) ? NULL : (var = (g_dir_close (var), NULL)))
typedef struct _ThemePrivate ThemePrivate;
enum  {
	THEME_0_PROPERTY,
	THEME_BACKGROUND_RED_PROPERTY,
	THEME_BACKGROUND_GREEN_PROPERTY,
	THEME_BACKGROUND_BLUE_PROPERTY,
	THEME_BACKGROUND_RADIUS_PROPERTY,
	THEME_TEXTURE_ALPHA_PROPERTY,
	THEME_APPLY_TEXTURE_PROPERTY,
	THEME_BORDER_RED_PROPERTY,
	THEME_BORDER_GREEN_PROPERTY,
	THEME_BORDER_BLUE_PROPERTY,
	THEME_BORDER_WIDTH_PROPERTY,
	THEME_SPACING_RED_PROPERTY,
	THEME_SPACING_GREEN_PROPERTY,
	THEME_SPACING_BLUE_PROPERTY,
	THEME_SPACING_WIDTH_PROPERTY,
	THEME_HIGHLIGHT_HARD_RED_PROPERTY,
	THEME_HIGHLIGHT_HARD_GREEN_PROPERTY,
	THEME_HIGHLIGHT_HARD_BLUE_PROPERTY,
	THEME_HIGHLIGHT_HARD_ALPHA_PROPERTY,
	THEME_HIGHLIGHT_SOFT_RED_PROPERTY,
	THEME_HIGHLIGHT_SOFT_GREEN_PROPERTY,
	THEME_HIGHLIGHT_SOFT_BLUE_PROPERTY,
	THEME_HIGHLIGHT_SOFT_ALPHA_PROPERTY,
	THEME_SOUND_FLIP_PROPERTY,
	THEME_SOUND_GAMEOVER_PROPERTY,
	THEME_NUM_PROPERTIES
};
static GParamSpec* theme_properties[THEME_NUM_PROPERTIES];
#define _g_key_file_unref0(var) ((var == NULL) ? NULL : (var = (g_key_file_unref (var), NULL)))

struct _ThemeManager {
	GObject parent_instance;
	ThemeManagerPrivate * priv;
};

struct _ThemeManagerClass {
	GObjectClass parent_class;
};

struct _ThemeManagerPrivate {
	GPtrArray* _themes;
	gboolean theme_set;
	gchar* _theme_name;
	Theme* _theme;
};

struct _Theme {
	GObject parent_instance;
	ThemePrivate * priv;
	gchar* filename;
	gchar* name;
};

struct _ThemeClass {
	GObjectClass parent_class;
};

struct _ThemePrivate {
	GlyImage* image;
	gdouble _background_red;
	gdouble _background_green;
	gdouble _background_blue;
	gint _background_radius;
	gdouble _texture_alpha;
	gboolean _apply_texture;
	gdouble _border_red;
	gdouble _border_green;
	gdouble _border_blue;
	gint _border_width;
	gdouble _spacing_red;
	gdouble _spacing_green;
	gdouble _spacing_blue;
	gint _spacing_width;
	gdouble _highlight_hard_red;
	gdouble _highlight_hard_green;
	gdouble _highlight_hard_blue;
	gdouble _highlight_hard_alpha;
	gdouble _highlight_soft_red;
	gdouble _highlight_soft_green;
	gdouble _highlight_soft_blue;
	gdouble _highlight_soft_alpha;
	gchar* _sound_flip;
	gchar* _sound_gameover;
};

static gint ThemeManager_private_offset;
static gpointer theme_manager_parent_class = NULL;
static gint Theme_private_offset;
static gpointer theme_parent_class = NULL;

VALA_EXTERN GType theme_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ThemeManager, g_object_unref)
VALA_EXTERN GType theme_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Theme, g_object_unref)
static void theme_manager_gtk_theme_changed (ThemeManager* self);
VALA_EXTERN void theme_manager_set_theme_name (ThemeManager* self,
                                   const gchar* value);
static gchar* theme_manager_default_theme_file (ThemeManager* self);
static GPtrArray* theme_manager_load_themes (void);
static void _g_object_unref0_ (gpointer var);
VALA_EXTERN Theme* theme_from_file (const gchar* filepath,
                        GError** error);
VALA_EXTERN GPtrArray* theme_manager_get_themes (ThemeManager* self);
VALA_EXTERN ThemeManager* theme_manager_new (void);
VALA_EXTERN ThemeManager* theme_manager_construct (GType object_type);
VALA_EXTERN Theme* theme_manager_get_theme (ThemeManager* self);
VALA_EXTERN void theme_manager_set_theme (ThemeManager* self,
                              Theme* value);
static const gchar* theme_manager_get_theme_name (ThemeManager* self);
static GObject * theme_manager_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties);
static void _theme_manager_gtk_theme_changed_g_object_notify (GObject* _sender,
                                                       GParamSpec* pspec,
                                                       gpointer self);
static void theme_manager_finalize (GObject * obj);
static GType theme_manager_get_type_once (void);
static void _vala_theme_manager_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static void _vala_theme_manager_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec);
VALA_EXTERN Theme* theme_new (void);
VALA_EXTERN Theme* theme_construct (GType object_type);
static GlyImage* theme_load_image (const gchar* name);
static void theme_set_background_red (Theme* self,
                               gdouble value);
static void theme_set_background_green (Theme* self,
                                 gdouble value);
static void theme_set_background_blue (Theme* self,
                                gdouble value);
static void theme_set_background_radius (Theme* self,
                                  gint value);
static void theme_set_texture_alpha (Theme* self,
                              gdouble value);
VALA_EXTERN gdouble theme_get_texture_alpha (Theme* self);
static void theme_set_apply_texture (Theme* self,
                              gboolean value);
static void theme_set_border_red (Theme* self,
                           gdouble value);
static void theme_set_border_green (Theme* self,
                             gdouble value);
static void theme_set_border_blue (Theme* self,
                            gdouble value);
static void theme_set_border_width (Theme* self,
                             gint value);
static void theme_set_spacing_red (Theme* self,
                            gdouble value);
static void theme_set_spacing_green (Theme* self,
                              gdouble value);
static void theme_set_spacing_blue (Theme* self,
                             gdouble value);
static void theme_set_spacing_width (Theme* self,
                              gint value);
static void theme_set_highlight_hard_red (Theme* self,
                                   gdouble value);
static void theme_set_highlight_hard_green (Theme* self,
                                     gdouble value);
static void theme_set_highlight_hard_blue (Theme* self,
                                    gdouble value);
static void theme_set_highlight_hard_alpha (Theme* self,
                                     gdouble value);
static void theme_set_highlight_soft_red (Theme* self,
                                   gdouble value);
static void theme_set_highlight_soft_green (Theme* self,
                                     gdouble value);
static void theme_set_highlight_soft_blue (Theme* self,
                                    gdouble value);
static void theme_set_highlight_soft_alpha (Theme* self,
                                     gdouble value);
static void theme_set_sound_flip (Theme* self,
                           const gchar* value);
static void theme_set_sound_gameover (Theme* self,
                               const gchar* value);
VALA_EXTERN GdkTexture* theme_tileset_for_size (Theme* self,
                                    gint tile_size);
VALA_EXTERN gdouble theme_get_background_red (Theme* self);
VALA_EXTERN gdouble theme_get_background_green (Theme* self);
VALA_EXTERN gdouble theme_get_background_blue (Theme* self);
VALA_EXTERN gint theme_get_background_radius (Theme* self);
VALA_EXTERN gboolean theme_get_apply_texture (Theme* self);
VALA_EXTERN gdouble theme_get_border_red (Theme* self);
VALA_EXTERN gdouble theme_get_border_green (Theme* self);
VALA_EXTERN gdouble theme_get_border_blue (Theme* self);
VALA_EXTERN gint theme_get_border_width (Theme* self);
VALA_EXTERN gdouble theme_get_spacing_red (Theme* self);
VALA_EXTERN gdouble theme_get_spacing_green (Theme* self);
VALA_EXTERN gdouble theme_get_spacing_blue (Theme* self);
VALA_EXTERN gint theme_get_spacing_width (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_hard_red (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_hard_green (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_hard_blue (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_hard_alpha (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_soft_red (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_soft_green (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_soft_blue (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_soft_alpha (Theme* self);
VALA_EXTERN const gchar* theme_get_sound_flip (Theme* self);
VALA_EXTERN const gchar* theme_get_sound_gameover (Theme* self);
static void theme_finalize (GObject * obj);
static GType theme_get_type_once (void);
static void _vala_theme_get_property (GObject * object,
                               guint property_id,
                               GValue * value,
                               GParamSpec * pspec);
static void _vala_theme_set_property (GObject * object,
                               guint property_id,
                               const GValue * value,
                               GParamSpec * pspec);

static inline gpointer
theme_manager_get_instance_private (ThemeManager* self)
{
	return G_STRUCT_MEMBER_P (self, ThemeManager_private_offset);
}

static void
theme_manager_gtk_theme_changed (ThemeManager* self)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	if (!self->priv->theme_set) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp1_;
		_tmp1_ = self->priv->_theme_name;
		_tmp0_ = g_strcmp0 (_tmp1_, "default") == 0;
	}
	if (_tmp0_) {
		theme_manager_set_theme_name (self, "default");
	}
}

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

static gchar*
theme_manager_default_theme_file (ThemeManager* self)
{
	AdwStyleManager* style_manager = NULL;
	AdwStyleManager* _tmp0_;
	AdwStyleManager* _tmp1_;
	AdwStyleManager* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, 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_) {
		gchar* _tmp5_;
		_tmp5_ = g_strdup ("high_contrast.theme");
		result = _tmp5_;
		_g_object_unref0 (style_manager);
		return result;
	} else {
		AdwStyleManager* _tmp6_;
		gboolean _tmp7_;
		gboolean _tmp8_;
		_tmp6_ = style_manager;
		_tmp7_ = adw_style_manager_get_dark (_tmp6_);
		_tmp8_ = _tmp7_;
		if (_tmp8_) {
			gchar* _tmp9_;
			_tmp9_ = g_strdup ("adwaita.theme");
			result = _tmp9_;
			_g_object_unref0 (style_manager);
			return result;
		} else {
			gchar* _tmp10_;
			_tmp10_ = g_strdup ("classic.theme");
			result = _tmp10_;
			_g_object_unref0 (style_manager);
			return result;
		}
	}
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static GPtrArray*
theme_manager_load_themes (void)
{
	GPtrArray* themes = NULL;
	GPtrArray* _tmp0_;
	GError* _inner_error0_ = NULL;
	GPtrArray* result;
	_tmp0_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	themes = _tmp0_;
	{
		gchar* key_path = NULL;
		gchar* _tmp1_;
		GDir* dir = NULL;
		const gchar* _tmp2_;
		GDir* _tmp3_;
		_tmp1_ = g_build_filename (DATA_DIRECTORY, "themes", "key", NULL);
		key_path = _tmp1_;
		_tmp2_ = key_path;
		_tmp3_ = g_dir_open (_tmp2_, (guint) 0, &_inner_error0_);
		dir = _tmp3_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (key_path);
			if (_inner_error0_->domain == G_FILE_ERROR) {
				goto __catch0_g_file_error;
			}
			_g_ptr_array_unref0 (themes);
			g_critical ("file %s: line %d: unexpected 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 NULL;
		}
		while (TRUE) {
			gchar* filename = NULL;
			GDir* _tmp4_;
			const gchar* _tmp5_;
			gchar* _tmp6_;
			const gchar* _tmp7_;
			const gchar* _tmp8_;
			_tmp4_ = dir;
			_tmp5_ = g_dir_read_name (_tmp4_);
			_tmp6_ = g_strdup (_tmp5_);
			filename = _tmp6_;
			_tmp7_ = filename;
			if (_tmp7_ == NULL) {
				_g_free0 (filename);
				break;
			}
			_tmp8_ = filename;
			if (g_strcmp0 (_tmp8_, "default") == 0) {
				g_warning ("theme-manager.vala:113: There should not be a theme filename named \"d" \
"efault\", ignoring it.");
				_g_free0 (filename);
				continue;
			}
			{
				gchar* filepath = NULL;
				const gchar* _tmp9_;
				const gchar* _tmp10_;
				gchar* _tmp11_;
				Theme* theme = NULL;
				const gchar* _tmp12_;
				Theme* _tmp13_;
				GPtrArray* _tmp14_;
				Theme* _tmp15_;
				Theme* _tmp16_;
				_tmp9_ = key_path;
				_tmp10_ = filename;
				_tmp11_ = g_build_filename (_tmp9_, (const gchar*) _tmp10_, NULL);
				filepath = _tmp11_;
				_tmp12_ = filepath;
				_tmp13_ = theme_from_file (_tmp12_, &_inner_error0_);
				theme = _tmp13_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					_g_free0 (filepath);
					goto __catch1_g_error;
				}
				_tmp14_ = themes;
				_tmp15_ = theme;
				_tmp16_ = _g_object_ref0 (_tmp15_);
				g_ptr_array_add (_tmp14_, _tmp16_);
				_g_object_unref0 (theme);
				_g_free0 (filepath);
			}
			goto __finally1;
			__catch1_g_error:
			{
				GError* e = NULL;
				const gchar* _tmp17_;
				GError* _tmp18_;
				const gchar* _tmp19_;
				e = _inner_error0_;
				_inner_error0_ = NULL;
				_tmp17_ = filename;
				_tmp18_ = e;
				_tmp19_ = _tmp18_->message;
				g_warning ("theme-manager.vala:125: Failed to load theme %s: %s", (const gchar*) _tmp17_, _tmp19_);
				_g_error_free0 (e);
			}
			__finally1:
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_free0 (filename);
				_g_dir_close0 (dir);
				_g_free0 (key_path);
				if (_inner_error0_->domain == G_FILE_ERROR) {
					goto __catch0_g_file_error;
				}
				_g_ptr_array_unref0 (themes);
				g_critical ("file %s: line %d: unexpected 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 NULL;
			}
			_g_free0 (filename);
		}
		_g_dir_close0 (dir);
		_g_free0 (key_path);
	}
	goto __finally0;
	__catch0_g_file_error:
	{
		GError* e = NULL;
		GError* _tmp20_;
		const gchar* _tmp21_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp20_ = e;
		_tmp21_ = _tmp20_->message;
		g_warning ("theme-manager.vala:131: Failed to load themes: %s", _tmp21_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_ptr_array_unref0 (themes);
		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 NULL;
	}
	result = themes;
	return result;
}

static gpointer
_g_ptr_array_ref0 (gpointer self)
{
	return self ? g_ptr_array_ref (self) : NULL;
}

GPtrArray*
theme_manager_get_themes (ThemeManager* self)
{
	GPtrArray* _tmp0_;
	GPtrArray* _tmp1_;
	GPtrArray* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_themes;
	_tmp1_ = _g_ptr_array_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

ThemeManager*
theme_manager_construct (GType object_type)
{
	ThemeManager * self = NULL;
	self = (ThemeManager*) g_object_new (object_type, NULL);
	return self;
}

ThemeManager*
theme_manager_new (void)
{
	return theme_manager_construct (TYPE_THEME_MANAGER);
}

Theme*
theme_manager_get_theme (ThemeManager* self)
{
	Theme* result;
	Theme* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	if (!self->priv->theme_set) {
		g_assert_not_reached ();
	}
	_tmp0_ = self->priv->_theme;
	result = _tmp0_;
	return result;
}

void
theme_manager_set_theme (ThemeManager* self,
                         Theme* value)
{
	Theme* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_theme);
	self->priv->_theme = _tmp0_;
	_tmp1_ = value->name;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (self->priv->_theme_name);
	self->priv->_theme_name = _tmp2_;
	self->priv->theme_set = TRUE;
	g_object_notify_by_pspec ((GObject *) self, theme_manager_properties[THEME_MANAGER_THEME_PROPERTY]);
}

static const gchar*
theme_manager_get_theme_name (ThemeManager* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	if (!self->priv->theme_set) {
		g_assert_not_reached ();
	}
	_tmp0_ = self->priv->_theme_name;
	result = _tmp0_;
	return result;
}

void
theme_manager_set_theme_name (ThemeManager* self,
                              const gchar* value)
{
	gchar* name = NULL;
	gchar* filename = NULL;
	gboolean _tmp0_ = FALSE;
	GPtrArray* _tmp5_;
	g_return_if_fail (self != NULL);
	if (g_strcmp0 (value, "") == 0) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (value, "default") == 0;
	}
	if (_tmp0_) {
		gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = g_strdup ("default");
		_g_free0 (name);
		name = _tmp1_;
		_tmp2_ = theme_manager_default_theme_file (self);
		_g_free0 (filename);
		filename = _tmp2_;
	} else {
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp3_ = g_strdup (value);
		_g_free0 (name);
		name = _tmp3_;
		_tmp4_ = g_strdup (value);
		_g_free0 (filename);
		filename = _tmp4_;
	}
	_tmp5_ = theme_manager_get_themes (self);
	{
		GPtrArray* t_collection = NULL;
		guint t_index = 0U;
		t_collection = _tmp5_;
		for (t_index = 0; t_index < t_collection->len; t_index = t_index + 1) {
			Theme* _tmp6_;
			Theme* t = NULL;
			_tmp6_ = _g_object_ref0 ((Theme*) g_ptr_array_index (t_collection, t_index));
			t = _tmp6_;
			{
				Theme* _tmp7_;
				const gchar* _tmp8_;
				const gchar* _tmp9_;
				_tmp7_ = t;
				_tmp8_ = _tmp7_->filename;
				_tmp9_ = filename;
				if (g_strcmp0 (_tmp8_, _tmp9_) == 0) {
					Theme* _tmp10_;
					const gchar* _tmp11_;
					gchar* _tmp12_;
					_tmp10_ = t;
					theme_manager_set_theme (self, _tmp10_);
					_tmp11_ = name;
					_tmp12_ = g_strdup (_tmp11_);
					_g_free0 (self->priv->_theme_name);
					self->priv->_theme_name = _tmp12_;
					_g_object_unref0 (t);
					_g_ptr_array_unref0 (t_collection);
					_g_free0 (filename);
					_g_free0 (name);
					return;
				}
				_g_object_unref0 (t);
			}
		}
		_g_ptr_array_unref0 (t_collection);
	}
	g_warning ("theme-manager.vala:83: Failed to load theme: %s", value);
	_g_free0 (filename);
	_g_free0 (name);
}

static void
_theme_manager_gtk_theme_changed_g_object_notify (GObject* _sender,
                                                  GParamSpec* pspec,
                                                  gpointer self)
{
	theme_manager_gtk_theme_changed ((ThemeManager*) self);
}

static GObject *
theme_manager_constructor (GType type,
                           guint n_construct_properties,
                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ThemeManager * self;
	AdwStyleManager* style_manager = NULL;
	AdwStyleManager* _tmp0_;
	AdwStyleManager* _tmp1_;
	AdwStyleManager* _tmp2_;
	AdwStyleManager* _tmp3_;
	GPtrArray* _tmp4_;
	parent_class = G_OBJECT_CLASS (theme_manager_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_THEME_MANAGER, ThemeManager);
	_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) _theme_manager_gtk_theme_changed_g_object_notify, self, 0);
	_tmp3_ = style_manager;
	g_signal_connect_object ((GObject*) _tmp3_, "notify::high-contrast", (GCallback) _theme_manager_gtk_theme_changed_g_object_notify, self, 0);
	_tmp4_ = theme_manager_load_themes ();
	_g_ptr_array_unref0 (self->priv->_themes);
	self->priv->_themes = _tmp4_;
	theme_manager_set_theme_name (self, "default");
	_g_object_unref0 (style_manager);
	return obj;
}

static void
theme_manager_class_init (ThemeManagerClass * klass,
                          gpointer klass_data)
{
	theme_manager_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ThemeManager_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_theme_manager_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_theme_manager_set_property;
	G_OBJECT_CLASS (klass)->constructor = theme_manager_constructor;
	G_OBJECT_CLASS (klass)->finalize = theme_manager_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_MANAGER_THEME_PROPERTY, theme_manager_properties[THEME_MANAGER_THEME_PROPERTY] = g_param_spec_object ("theme", "theme", "theme", TYPE_THEME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_MANAGER_THEME_NAME_PROPERTY, theme_manager_properties[THEME_MANAGER_THEME_NAME_PROPERTY] = g_param_spec_string ("theme-name", "theme-name", "theme-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
}

static void
theme_manager_instance_init (ThemeManager * self,
                             gpointer klass)
{
	self->priv = theme_manager_get_instance_private (self);
	self->priv->theme_set = FALSE;
}

static void
theme_manager_finalize (GObject * obj)
{
	ThemeManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_THEME_MANAGER, ThemeManager);
	_g_ptr_array_unref0 (self->priv->_themes);
	_g_free0 (self->priv->_theme_name);
	_g_object_unref0 (self->priv->_theme);
	G_OBJECT_CLASS (theme_manager_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
theme_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ThemeManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) theme_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ThemeManager), 0, (GInstanceInitFunc) theme_manager_instance_init, NULL };
	GType theme_manager_type_id;
	theme_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "ThemeManager", &g_define_type_info, G_TYPE_FLAG_NONE);
	ThemeManager_private_offset = g_type_add_instance_private (theme_manager_type_id, sizeof (ThemeManagerPrivate));
	return theme_manager_type_id;
}

GType
theme_manager_get_type (void)
{
	static gsize theme_manager_type_id__once = 0;
	if (g_once_init_enter (&theme_manager_type_id__once)) {
		GType theme_manager_type_id;
		theme_manager_type_id = theme_manager_get_type_once ();
		g_once_init_leave (&theme_manager_type_id__once, theme_manager_type_id);
	}
	return theme_manager_type_id__once;
}

static void
_vala_theme_manager_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	ThemeManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_THEME_MANAGER, ThemeManager);
	switch (property_id) {
		case THEME_MANAGER_THEME_PROPERTY:
		g_value_set_object (value, theme_manager_get_theme (self));
		break;
		case THEME_MANAGER_THEME_NAME_PROPERTY:
		g_value_set_string (value, theme_manager_get_theme_name (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_theme_manager_set_property (GObject * object,
                                  guint property_id,
                                  const GValue * value,
                                  GParamSpec * pspec)
{
	ThemeManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_THEME_MANAGER, ThemeManager);
	switch (property_id) {
		case THEME_MANAGER_THEME_PROPERTY:
		theme_manager_set_theme (self, g_value_get_object (value));
		break;
		case THEME_MANAGER_THEME_NAME_PROPERTY:
		theme_manager_set_theme_name (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
theme_get_instance_private (Theme* self)
{
	return G_STRUCT_MEMBER_P (self, Theme_private_offset);
}

Theme*
theme_from_file (const gchar* filepath,
                 GError** error)
{
	GKeyFile* key = NULL;
	GKeyFile* _tmp0_;
	GKeyFile* _tmp1_;
	Theme* theme = NULL;
	Theme* _tmp2_;
	Theme* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_ = NULL;
	GKeyFile* _tmp6_;
	gchar* _tmp7_;
	Theme* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_ = NULL;
	GKeyFile* _tmp11_;
	gchar* _tmp12_;
	Theme* _tmp13_;
	GlyImage* _tmp14_;
	gdouble _tmp15_ = 0.0;
	GKeyFile* _tmp16_;
	Theme* _tmp17_;
	gdouble _tmp18_ = 0.0;
	GKeyFile* _tmp19_;
	Theme* _tmp20_;
	gdouble _tmp21_ = 0.0;
	GKeyFile* _tmp22_;
	Theme* _tmp23_;
	gint _tmp24_ = 0;
	GKeyFile* _tmp25_;
	Theme* _tmp26_;
	gdouble _tmp27_ = 0.0;
	GKeyFile* _tmp28_;
	Theme* _tmp29_;
	gboolean _tmp30_ = FALSE;
	Theme* _tmp31_;
	gdouble _tmp32_;
	Theme* _tmp35_;
	gdouble _tmp36_ = 0.0;
	GKeyFile* _tmp37_;
	Theme* _tmp38_;
	gdouble _tmp39_ = 0.0;
	GKeyFile* _tmp40_;
	Theme* _tmp41_;
	gdouble _tmp42_ = 0.0;
	GKeyFile* _tmp43_;
	Theme* _tmp44_;
	gint _tmp45_ = 0;
	GKeyFile* _tmp46_;
	Theme* _tmp47_;
	gdouble _tmp48_ = 0.0;
	GKeyFile* _tmp49_;
	Theme* _tmp50_;
	gdouble _tmp51_ = 0.0;
	GKeyFile* _tmp52_;
	Theme* _tmp53_;
	gdouble _tmp54_ = 0.0;
	GKeyFile* _tmp55_;
	Theme* _tmp56_;
	gint _tmp57_ = 0;
	GKeyFile* _tmp58_;
	Theme* _tmp59_;
	gdouble _tmp60_ = 0.0;
	GKeyFile* _tmp61_;
	Theme* _tmp62_;
	gdouble _tmp63_ = 0.0;
	GKeyFile* _tmp64_;
	Theme* _tmp65_;
	gdouble _tmp66_ = 0.0;
	GKeyFile* _tmp67_;
	Theme* _tmp68_;
	gdouble _tmp69_ = 0.0;
	GKeyFile* _tmp70_;
	Theme* _tmp71_;
	gdouble _tmp72_ = 0.0;
	GKeyFile* _tmp73_;
	Theme* _tmp74_;
	gdouble _tmp75_ = 0.0;
	GKeyFile* _tmp76_;
	Theme* _tmp77_;
	gdouble _tmp78_ = 0.0;
	GKeyFile* _tmp79_;
	Theme* _tmp80_;
	gdouble _tmp81_ = 0.0;
	GKeyFile* _tmp82_;
	Theme* _tmp83_;
	gchar* _tmp84_ = NULL;
	GKeyFile* _tmp85_;
	gchar* _tmp86_;
	Theme* _tmp87_;
	gchar* _tmp88_ = NULL;
	GKeyFile* _tmp89_;
	gchar* _tmp90_;
	Theme* _tmp91_;
	GError* _inner_error0_ = NULL;
	Theme* result;
	g_return_val_if_fail (filepath != NULL, NULL);
	_tmp0_ = g_key_file_new ();
	key = _tmp0_;
	_tmp1_ = key;
	g_key_file_load_from_file (_tmp1_, filepath, G_KEY_FILE_NONE, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp2_ = theme_new ();
	theme = _tmp2_;
	_tmp3_ = theme;
	_tmp4_ = g_path_get_basename (filepath);
	_g_free0 (_tmp3_->filename);
	_tmp3_->filename = _tmp4_;
	_tmp6_ = key;
	_tmp7_ = g_key_file_get_locale_string (_tmp6_, "Theme", "Name", NULL, &_inner_error0_);
	_tmp5_ = _tmp7_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp8_ = theme;
	_tmp9_ = _tmp5_;
	_tmp5_ = NULL;
	_g_free0 (_tmp8_->name);
	_tmp8_->name = _tmp9_;
	_tmp11_ = key;
	_tmp12_ = g_key_file_get_string (_tmp11_, "Pieces", "File", &_inner_error0_);
	_tmp10_ = _tmp12_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp13_ = theme;
	_tmp14_ = theme_load_image (_tmp10_);
	_g_object_unref0 (_tmp13_->priv->image);
	_tmp13_->priv->image = _tmp14_;
	_tmp16_ = key;
	_tmp15_ = g_key_file_get_double (_tmp16_, "Background", "Red", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp17_ = theme;
	theme_set_background_red (_tmp17_, _tmp15_);
	_tmp19_ = key;
	_tmp18_ = g_key_file_get_double (_tmp19_, "Background", "Green", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp20_ = theme;
	theme_set_background_green (_tmp20_, _tmp18_);
	_tmp22_ = key;
	_tmp21_ = g_key_file_get_double (_tmp22_, "Background", "Blue", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp23_ = theme;
	theme_set_background_blue (_tmp23_, _tmp21_);
	_tmp25_ = key;
	_tmp24_ = g_key_file_get_integer (_tmp25_, "Background", "Radius", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp26_ = theme;
	theme_set_background_radius (_tmp26_, _tmp24_);
	_tmp28_ = key;
	_tmp27_ = g_key_file_get_double (_tmp28_, "Background", "TextureAlpha", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp29_ = theme;
	theme_set_texture_alpha (_tmp29_, _tmp27_);
	_tmp31_ = theme;
	_tmp32_ = _tmp31_->priv->_texture_alpha;
	if (_tmp32_ > 0.0) {
		Theme* _tmp33_;
		gdouble _tmp34_;
		_tmp33_ = theme;
		_tmp34_ = _tmp33_->priv->_texture_alpha;
		_tmp30_ = _tmp34_ <= 1.0;
	} else {
		_tmp30_ = FALSE;
	}
	_tmp35_ = theme;
	theme_set_apply_texture (_tmp35_, _tmp30_);
	_tmp37_ = key;
	_tmp36_ = g_key_file_get_double (_tmp37_, "Border", "Red", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp38_ = theme;
	theme_set_border_red (_tmp38_, _tmp36_);
	_tmp40_ = key;
	_tmp39_ = g_key_file_get_double (_tmp40_, "Border", "Green", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp41_ = theme;
	theme_set_border_green (_tmp41_, _tmp39_);
	_tmp43_ = key;
	_tmp42_ = g_key_file_get_double (_tmp43_, "Border", "Blue", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp44_ = theme;
	theme_set_border_blue (_tmp44_, _tmp42_);
	_tmp46_ = key;
	_tmp45_ = g_key_file_get_integer (_tmp46_, "Border", "Width", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp47_ = theme;
	theme_set_border_width (_tmp47_, _tmp45_);
	_tmp49_ = key;
	_tmp48_ = g_key_file_get_double (_tmp49_, "Spacing", "Red", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp50_ = theme;
	theme_set_spacing_red (_tmp50_, _tmp48_);
	_tmp52_ = key;
	_tmp51_ = g_key_file_get_double (_tmp52_, "Spacing", "Green", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp53_ = theme;
	theme_set_spacing_green (_tmp53_, _tmp51_);
	_tmp55_ = key;
	_tmp54_ = g_key_file_get_double (_tmp55_, "Spacing", "Blue", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp56_ = theme;
	theme_set_spacing_blue (_tmp56_, _tmp54_);
	_tmp58_ = key;
	_tmp57_ = g_key_file_get_integer (_tmp58_, "Spacing", "Width", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp59_ = theme;
	theme_set_spacing_width (_tmp59_, _tmp57_);
	_tmp61_ = key;
	_tmp60_ = g_key_file_get_double (_tmp61_, "Highlight hard", "Red", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp62_ = theme;
	theme_set_highlight_hard_red (_tmp62_, _tmp60_);
	_tmp64_ = key;
	_tmp63_ = g_key_file_get_double (_tmp64_, "Highlight hard", "Green", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp65_ = theme;
	theme_set_highlight_hard_green (_tmp65_, _tmp63_);
	_tmp67_ = key;
	_tmp66_ = g_key_file_get_double (_tmp67_, "Highlight hard", "Blue", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp68_ = theme;
	theme_set_highlight_hard_blue (_tmp68_, _tmp66_);
	_tmp70_ = key;
	_tmp69_ = g_key_file_get_double (_tmp70_, "Highlight hard", "Alpha", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp71_ = theme;
	theme_set_highlight_hard_alpha (_tmp71_, _tmp69_);
	_tmp73_ = key;
	_tmp72_ = g_key_file_get_double (_tmp73_, "Highlight soft", "Red", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp74_ = theme;
	theme_set_highlight_soft_red (_tmp74_, _tmp72_);
	_tmp76_ = key;
	_tmp75_ = g_key_file_get_double (_tmp76_, "Highlight soft", "Green", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp77_ = theme;
	theme_set_highlight_soft_green (_tmp77_, _tmp75_);
	_tmp79_ = key;
	_tmp78_ = g_key_file_get_double (_tmp79_, "Highlight soft", "Blue", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp80_ = theme;
	theme_set_highlight_soft_blue (_tmp80_, _tmp78_);
	_tmp82_ = key;
	_tmp81_ = g_key_file_get_double (_tmp82_, "Highlight soft", "Alpha", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp83_ = theme;
	theme_set_highlight_soft_alpha (_tmp83_, _tmp81_);
	_tmp85_ = key;
	_tmp86_ = g_key_file_get_string (_tmp85_, "Sound", "Flip", &_inner_error0_);
	_tmp84_ = _tmp86_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp87_ = theme;
	theme_set_sound_flip (_tmp87_, _tmp84_);
	_tmp89_ = key;
	_tmp90_ = g_key_file_get_string (_tmp89_, "Sound", "GameOver", &_inner_error0_);
	_tmp88_ = _tmp90_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (_tmp84_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_object_unref0 (theme);
		_g_key_file_unref0 (key);
		return NULL;
	}
	_tmp91_ = theme;
	theme_set_sound_gameover (_tmp91_, _tmp88_);
	result = theme;
	_g_free0 (_tmp88_);
	_g_free0 (_tmp84_);
	_g_free0 (_tmp10_);
	_g_free0 (_tmp5_);
	_g_key_file_unref0 (key);
	return result;
}

static GlyImage*
theme_load_image (const gchar* name)
{
	gchar* svg_path = NULL;
	gchar* _tmp0_;
	gchar* pieces_file = NULL;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	gboolean _tmp7_;
	GFile* file = NULL;
	const gchar* _tmp10_;
	GFile* _tmp11_;
	GlyLoader* loader = NULL;
	GlyLoader* _tmp12_;
	GlyImage* _tmp13_ = NULL;
	GlyImage* _tmp14_;
	GlyImage* _tmp15_;
	GError* _inner_error0_ = NULL;
	GlyImage* result;
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = g_build_filename (DATA_DIRECTORY, "themes", "svg", NULL);
	svg_path = _tmp0_;
	_tmp1_ = svg_path;
	_tmp2_ = g_build_filename (_tmp1_, name, NULL);
	pieces_file = _tmp2_;
	_tmp3_ = pieces_file;
	_tmp4_ = g_path_get_dirname (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = svg_path;
	_tmp7_ = g_strcmp0 (_tmp5_, _tmp6_) != 0;
	_g_free0 (_tmp5_);
	if (_tmp7_) {
		const gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp8_ = svg_path;
		_tmp9_ = g_build_filename (_tmp8_, "black_and_white.svg", NULL);
		_g_free0 (pieces_file);
		pieces_file = _tmp9_;
	}
	_tmp10_ = pieces_file;
	_tmp11_ = g_file_new_for_path (_tmp10_);
	file = _tmp11_;
	_tmp12_ = gly_loader_new (file);
	loader = _tmp12_;
	_tmp14_ = gly_loader_load (loader, &_inner_error0_);
	_tmp13_ = _tmp14_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (loader);
		_g_object_unref0 (file);
		_g_free0 (pieces_file);
		_g_free0 (svg_path);
		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 NULL;
	}
	_tmp15_ = _tmp13_;
	_tmp13_ = NULL;
	result = _tmp15_;
	_g_object_unref0 (_tmp13_);
	_g_object_unref0 (loader);
	_g_object_unref0 (file);
	_g_free0 (pieces_file);
	_g_free0 (svg_path);
	return result;
}

GdkTexture*
theme_tileset_for_size (Theme* self,
                        gint tile_size)
{
	GError* _inner_error0_ = NULL;
	GdkTexture* result;
	g_return_val_if_fail (self != NULL, NULL);
	{
		gint width = 0;
		gint height = 0;
		GlyFrameRequest* request = NULL;
		GlyFrameRequest* _tmp0_;
		GlyFrame* frame = NULL;
		GlyImage* _tmp1_;
		GlyFrame* _tmp2_;
		GdkTexture* _tmp3_;
		width = tile_size * 8;
		height = tile_size * 4;
		_tmp0_ = gly_frame_request_new ();
		request = _tmp0_;
		gly_frame_request_set_scale (request, (guint32) width, (guint32) height);
		_tmp1_ = self->priv->image;
		_tmp2_ = gly_image_get_specific_frame (_tmp1_, request, &_inner_error0_);
		frame = _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (request);
			goto __catch0_g_error;
		}
		_tmp3_ = gly_gtk_frame_get_texture (frame);
		result = _tmp3_;
		_g_object_unref0 (frame);
		_g_object_unref0 (request);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp4_;
		const gchar* _tmp5_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp4_ = e;
		_tmp5_ = _tmp4_->message;
		g_warning ("theme-manager.vala:267: %s", _tmp5_);
		result = NULL;
		_g_error_free0 (e);
		return result;
	}
	__finally0:
	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 NULL;
}

Theme*
theme_construct (GType object_type)
{
	Theme * self = NULL;
	self = (Theme*) g_object_new (object_type, NULL);
	return self;
}

Theme*
theme_new (void)
{
	return theme_construct (TYPE_THEME);
}

gdouble
theme_get_background_red (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_background_red;
	return result;
}

static void
theme_set_background_red (Theme* self,
                          gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_background_red = value;
}

gdouble
theme_get_background_green (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_background_green;
	return result;
}

static void
theme_set_background_green (Theme* self,
                            gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_background_green = value;
}

gdouble
theme_get_background_blue (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_background_blue;
	return result;
}

static void
theme_set_background_blue (Theme* self,
                           gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_background_blue = value;
}

gint
theme_get_background_radius (Theme* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_background_radius;
	return result;
}

static void
theme_set_background_radius (Theme* self,
                             gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_background_radius = value;
}

gdouble
theme_get_texture_alpha (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_texture_alpha;
	return result;
}

static void
theme_set_texture_alpha (Theme* self,
                         gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_texture_alpha = value;
}

gboolean
theme_get_apply_texture (Theme* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_apply_texture;
	return result;
}

static void
theme_set_apply_texture (Theme* self,
                         gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_apply_texture = value;
}

gdouble
theme_get_border_red (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_border_red;
	return result;
}

static void
theme_set_border_red (Theme* self,
                      gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_border_red = value;
}

gdouble
theme_get_border_green (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_border_green;
	return result;
}

static void
theme_set_border_green (Theme* self,
                        gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_border_green = value;
}

gdouble
theme_get_border_blue (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_border_blue;
	return result;
}

static void
theme_set_border_blue (Theme* self,
                       gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_border_blue = value;
}

gint
theme_get_border_width (Theme* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_border_width;
	return result;
}

static void
theme_set_border_width (Theme* self,
                        gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_border_width = value;
}

gdouble
theme_get_spacing_red (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_spacing_red;
	return result;
}

static void
theme_set_spacing_red (Theme* self,
                       gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_spacing_red = value;
}

gdouble
theme_get_spacing_green (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_spacing_green;
	return result;
}

static void
theme_set_spacing_green (Theme* self,
                         gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_spacing_green = value;
}

gdouble
theme_get_spacing_blue (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_spacing_blue;
	return result;
}

static void
theme_set_spacing_blue (Theme* self,
                        gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_spacing_blue = value;
}

gint
theme_get_spacing_width (Theme* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_spacing_width;
	return result;
}

static void
theme_set_spacing_width (Theme* self,
                         gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_spacing_width = value;
}

gdouble
theme_get_highlight_hard_red (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_highlight_hard_red;
	return result;
}

static void
theme_set_highlight_hard_red (Theme* self,
                              gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_highlight_hard_red = value;
}

gdouble
theme_get_highlight_hard_green (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_highlight_hard_green;
	return result;
}

static void
theme_set_highlight_hard_green (Theme* self,
                                gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_highlight_hard_green = value;
}

gdouble
theme_get_highlight_hard_blue (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_highlight_hard_blue;
	return result;
}

static void
theme_set_highlight_hard_blue (Theme* self,
                               gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_highlight_hard_blue = value;
}

gdouble
theme_get_highlight_hard_alpha (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_highlight_hard_alpha;
	return result;
}

static void
theme_set_highlight_hard_alpha (Theme* self,
                                gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_highlight_hard_alpha = value;
}

gdouble
theme_get_highlight_soft_red (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_highlight_soft_red;
	return result;
}

static void
theme_set_highlight_soft_red (Theme* self,
                              gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_highlight_soft_red = value;
}

gdouble
theme_get_highlight_soft_green (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_highlight_soft_green;
	return result;
}

static void
theme_set_highlight_soft_green (Theme* self,
                                gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_highlight_soft_green = value;
}

gdouble
theme_get_highlight_soft_blue (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_highlight_soft_blue;
	return result;
}

static void
theme_set_highlight_soft_blue (Theme* self,
                               gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_highlight_soft_blue = value;
}

gdouble
theme_get_highlight_soft_alpha (Theme* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_highlight_soft_alpha;
	return result;
}

static void
theme_set_highlight_soft_alpha (Theme* self,
                                gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_highlight_soft_alpha = value;
}

const gchar*
theme_get_sound_flip (Theme* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_sound_flip;
	result = _tmp0_;
	return result;
}

static void
theme_set_sound_flip (Theme* self,
                      const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_sound_flip);
	self->priv->_sound_flip = _tmp0_;
}

const gchar*
theme_get_sound_gameover (Theme* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_sound_gameover;
	result = _tmp0_;
	return result;
}

static void
theme_set_sound_gameover (Theme* self,
                          const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_sound_gameover);
	self->priv->_sound_gameover = _tmp0_;
}

static void
theme_class_init (ThemeClass * klass,
                  gpointer klass_data)
{
	theme_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &Theme_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_theme_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_theme_set_property;
	G_OBJECT_CLASS (klass)->finalize = theme_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_BACKGROUND_RED_PROPERTY, theme_properties[THEME_BACKGROUND_RED_PROPERTY] = g_param_spec_double ("background-red", "background-red", "background-red", -G_MAXDOUBLE, G_MAXDOUBLE, 0.2, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_BACKGROUND_GREEN_PROPERTY, theme_properties[THEME_BACKGROUND_GREEN_PROPERTY] = g_param_spec_double ("background-green", "background-green", "background-green", -G_MAXDOUBLE, G_MAXDOUBLE, 0.6, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_BACKGROUND_BLUE_PROPERTY, theme_properties[THEME_BACKGROUND_BLUE_PROPERTY] = g_param_spec_double ("background-blue", "background-blue", "background-blue", -G_MAXDOUBLE, G_MAXDOUBLE, 0.4, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_BACKGROUND_RADIUS_PROPERTY, theme_properties[THEME_BACKGROUND_RADIUS_PROPERTY] = g_param_spec_int ("background-radius", "background-radius", "background-radius", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_TEXTURE_ALPHA_PROPERTY, theme_properties[THEME_TEXTURE_ALPHA_PROPERTY] = g_param_spec_double ("texture-alpha", "texture-alpha", "texture-alpha", -G_MAXDOUBLE, G_MAXDOUBLE, 0.25, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_APPLY_TEXTURE_PROPERTY, theme_properties[THEME_APPLY_TEXTURE_PROPERTY] = g_param_spec_boolean ("apply-texture", "apply-texture", "apply-texture", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_BORDER_RED_PROPERTY, theme_properties[THEME_BORDER_RED_PROPERTY] = g_param_spec_double ("border-red", "border-red", "border-red", -G_MAXDOUBLE, G_MAXDOUBLE, 0.1, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_BORDER_GREEN_PROPERTY, theme_properties[THEME_BORDER_GREEN_PROPERTY] = g_param_spec_double ("border-green", "border-green", "border-green", -G_MAXDOUBLE, G_MAXDOUBLE, 0.1, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_BORDER_BLUE_PROPERTY, theme_properties[THEME_BORDER_BLUE_PROPERTY] = g_param_spec_double ("border-blue", "border-blue", "border-blue", -G_MAXDOUBLE, G_MAXDOUBLE, 0.1, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_BORDER_WIDTH_PROPERTY, theme_properties[THEME_BORDER_WIDTH_PROPERTY] = g_param_spec_int ("border-width", "border-width", "border-width", G_MININT, G_MAXINT, 3, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_SPACING_RED_PROPERTY, theme_properties[THEME_SPACING_RED_PROPERTY] = g_param_spec_double ("spacing-red", "spacing-red", "spacing-red", -G_MAXDOUBLE, G_MAXDOUBLE, 0.1, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_SPACING_GREEN_PROPERTY, theme_properties[THEME_SPACING_GREEN_PROPERTY] = g_param_spec_double ("spacing-green", "spacing-green", "spacing-green", -G_MAXDOUBLE, G_MAXDOUBLE, 0.3, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_SPACING_BLUE_PROPERTY, theme_properties[THEME_SPACING_BLUE_PROPERTY] = g_param_spec_double ("spacing-blue", "spacing-blue", "spacing-blue", -G_MAXDOUBLE, G_MAXDOUBLE, 0.2, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_SPACING_WIDTH_PROPERTY, theme_properties[THEME_SPACING_WIDTH_PROPERTY] = g_param_spec_int ("spacing-width", "spacing-width", "spacing-width", G_MININT, G_MAXINT, 2, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_HIGHLIGHT_HARD_RED_PROPERTY, theme_properties[THEME_HIGHLIGHT_HARD_RED_PROPERTY] = g_param_spec_double ("highlight-hard-red", "highlight-hard-red", "highlight-hard-red", -G_MAXDOUBLE, G_MAXDOUBLE, 0.1, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_HIGHLIGHT_HARD_GREEN_PROPERTY, theme_properties[THEME_HIGHLIGHT_HARD_GREEN_PROPERTY] = g_param_spec_double ("highlight-hard-green", "highlight-hard-green", "highlight-hard-green", -G_MAXDOUBLE, G_MAXDOUBLE, 0.3, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_HIGHLIGHT_HARD_BLUE_PROPERTY, theme_properties[THEME_HIGHLIGHT_HARD_BLUE_PROPERTY] = g_param_spec_double ("highlight-hard-blue", "highlight-hard-blue", "highlight-hard-blue", -G_MAXDOUBLE, G_MAXDOUBLE, 0.2, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_HIGHLIGHT_HARD_ALPHA_PROPERTY, theme_properties[THEME_HIGHLIGHT_HARD_ALPHA_PROPERTY] = g_param_spec_double ("highlight-hard-alpha", "highlight-hard-alpha", "highlight-hard-alpha", -G_MAXDOUBLE, G_MAXDOUBLE, 0.4, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_HIGHLIGHT_SOFT_RED_PROPERTY, theme_properties[THEME_HIGHLIGHT_SOFT_RED_PROPERTY] = g_param_spec_double ("highlight-soft-red", "highlight-soft-red", "highlight-soft-red", -G_MAXDOUBLE, G_MAXDOUBLE, 0.1, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_HIGHLIGHT_SOFT_GREEN_PROPERTY, theme_properties[THEME_HIGHLIGHT_SOFT_GREEN_PROPERTY] = g_param_spec_double ("highlight-soft-green", "highlight-soft-green", "highlight-soft-green", -G_MAXDOUBLE, G_MAXDOUBLE, 0.3, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_HIGHLIGHT_SOFT_BLUE_PROPERTY, theme_properties[THEME_HIGHLIGHT_SOFT_BLUE_PROPERTY] = g_param_spec_double ("highlight-soft-blue", "highlight-soft-blue", "highlight-soft-blue", -G_MAXDOUBLE, G_MAXDOUBLE, 0.2, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_HIGHLIGHT_SOFT_ALPHA_PROPERTY, theme_properties[THEME_HIGHLIGHT_SOFT_ALPHA_PROPERTY] = g_param_spec_double ("highlight-soft-alpha", "highlight-soft-alpha", "highlight-soft-alpha", -G_MAXDOUBLE, G_MAXDOUBLE, 0.2, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_SOUND_FLIP_PROPERTY, theme_properties[THEME_SOUND_FLIP_PROPERTY] = g_param_spec_string ("sound-flip", "sound-flip", "sound-flip", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), THEME_SOUND_GAMEOVER_PROPERTY, theme_properties[THEME_SOUND_GAMEOVER_PROPERTY] = g_param_spec_string ("sound-gameover", "sound-gameover", "sound-gameover", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
}

static void
theme_instance_init (Theme * self,
                     gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	self->priv = theme_get_instance_private (self);
	self->priv->_background_red = 0.2;
	self->priv->_background_green = 0.6;
	self->priv->_background_blue = 0.4;
	self->priv->_background_radius = 0;
	self->priv->_texture_alpha = 0.25;
	self->priv->_apply_texture = FALSE;
	self->priv->_border_red = 0.1;
	self->priv->_border_green = 0.1;
	self->priv->_border_blue = 0.1;
	self->priv->_border_width = 3;
	self->priv->_spacing_red = 0.1;
	self->priv->_spacing_green = 0.3;
	self->priv->_spacing_blue = 0.2;
	self->priv->_spacing_width = 2;
	self->priv->_highlight_hard_red = 0.1;
	self->priv->_highlight_hard_green = 0.3;
	self->priv->_highlight_hard_blue = 0.2;
	self->priv->_highlight_hard_alpha = 0.4;
	self->priv->_highlight_soft_red = 0.1;
	self->priv->_highlight_soft_green = 0.3;
	self->priv->_highlight_soft_blue = 0.2;
	self->priv->_highlight_soft_alpha = 0.2;
	_tmp0_ = g_strdup ("");
	self->priv->_sound_flip = _tmp0_;
	_tmp1_ = g_strdup ("");
	self->priv->_sound_gameover = _tmp1_;
}

static void
theme_finalize (GObject * obj)
{
	Theme * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_THEME, Theme);
	_g_free0 (self->filename);
	_g_free0 (self->name);
	_g_object_unref0 (self->priv->image);
	_g_free0 (self->priv->_sound_flip);
	_g_free0 (self->priv->_sound_gameover);
	G_OBJECT_CLASS (theme_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
theme_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ThemeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) theme_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Theme), 0, (GInstanceInitFunc) theme_instance_init, NULL };
	GType theme_type_id;
	theme_type_id = g_type_register_static (G_TYPE_OBJECT, "Theme", &g_define_type_info, G_TYPE_FLAG_NONE);
	Theme_private_offset = g_type_add_instance_private (theme_type_id, sizeof (ThemePrivate));
	return theme_type_id;
}

GType
theme_get_type (void)
{
	static gsize theme_type_id__once = 0;
	if (g_once_init_enter (&theme_type_id__once)) {
		GType theme_type_id;
		theme_type_id = theme_get_type_once ();
		g_once_init_leave (&theme_type_id__once, theme_type_id);
	}
	return theme_type_id__once;
}

static void
_vala_theme_get_property (GObject * object,
                          guint property_id,
                          GValue * value,
                          GParamSpec * pspec)
{
	Theme * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_THEME, Theme);
	switch (property_id) {
		case THEME_BACKGROUND_RED_PROPERTY:
		g_value_set_double (value, theme_get_background_red (self));
		break;
		case THEME_BACKGROUND_GREEN_PROPERTY:
		g_value_set_double (value, theme_get_background_green (self));
		break;
		case THEME_BACKGROUND_BLUE_PROPERTY:
		g_value_set_double (value, theme_get_background_blue (self));
		break;
		case THEME_BACKGROUND_RADIUS_PROPERTY:
		g_value_set_int (value, theme_get_background_radius (self));
		break;
		case THEME_TEXTURE_ALPHA_PROPERTY:
		g_value_set_double (value, theme_get_texture_alpha (self));
		break;
		case THEME_APPLY_TEXTURE_PROPERTY:
		g_value_set_boolean (value, theme_get_apply_texture (self));
		break;
		case THEME_BORDER_RED_PROPERTY:
		g_value_set_double (value, theme_get_border_red (self));
		break;
		case THEME_BORDER_GREEN_PROPERTY:
		g_value_set_double (value, theme_get_border_green (self));
		break;
		case THEME_BORDER_BLUE_PROPERTY:
		g_value_set_double (value, theme_get_border_blue (self));
		break;
		case THEME_BORDER_WIDTH_PROPERTY:
		g_value_set_int (value, theme_get_border_width (self));
		break;
		case THEME_SPACING_RED_PROPERTY:
		g_value_set_double (value, theme_get_spacing_red (self));
		break;
		case THEME_SPACING_GREEN_PROPERTY:
		g_value_set_double (value, theme_get_spacing_green (self));
		break;
		case THEME_SPACING_BLUE_PROPERTY:
		g_value_set_double (value, theme_get_spacing_blue (self));
		break;
		case THEME_SPACING_WIDTH_PROPERTY:
		g_value_set_int (value, theme_get_spacing_width (self));
		break;
		case THEME_HIGHLIGHT_HARD_RED_PROPERTY:
		g_value_set_double (value, theme_get_highlight_hard_red (self));
		break;
		case THEME_HIGHLIGHT_HARD_GREEN_PROPERTY:
		g_value_set_double (value, theme_get_highlight_hard_green (self));
		break;
		case THEME_HIGHLIGHT_HARD_BLUE_PROPERTY:
		g_value_set_double (value, theme_get_highlight_hard_blue (self));
		break;
		case THEME_HIGHLIGHT_HARD_ALPHA_PROPERTY:
		g_value_set_double (value, theme_get_highlight_hard_alpha (self));
		break;
		case THEME_HIGHLIGHT_SOFT_RED_PROPERTY:
		g_value_set_double (value, theme_get_highlight_soft_red (self));
		break;
		case THEME_HIGHLIGHT_SOFT_GREEN_PROPERTY:
		g_value_set_double (value, theme_get_highlight_soft_green (self));
		break;
		case THEME_HIGHLIGHT_SOFT_BLUE_PROPERTY:
		g_value_set_double (value, theme_get_highlight_soft_blue (self));
		break;
		case THEME_HIGHLIGHT_SOFT_ALPHA_PROPERTY:
		g_value_set_double (value, theme_get_highlight_soft_alpha (self));
		break;
		case THEME_SOUND_FLIP_PROPERTY:
		g_value_set_string (value, theme_get_sound_flip (self));
		break;
		case THEME_SOUND_GAMEOVER_PROPERTY:
		g_value_set_string (value, theme_get_sound_gameover (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_theme_set_property (GObject * object,
                          guint property_id,
                          const GValue * value,
                          GParamSpec * pspec)
{
	Theme * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_THEME, Theme);
	switch (property_id) {
		case THEME_BACKGROUND_RED_PROPERTY:
		theme_set_background_red (self, g_value_get_double (value));
		break;
		case THEME_BACKGROUND_GREEN_PROPERTY:
		theme_set_background_green (self, g_value_get_double (value));
		break;
		case THEME_BACKGROUND_BLUE_PROPERTY:
		theme_set_background_blue (self, g_value_get_double (value));
		break;
		case THEME_BACKGROUND_RADIUS_PROPERTY:
		theme_set_background_radius (self, g_value_get_int (value));
		break;
		case THEME_TEXTURE_ALPHA_PROPERTY:
		theme_set_texture_alpha (self, g_value_get_double (value));
		break;
		case THEME_APPLY_TEXTURE_PROPERTY:
		theme_set_apply_texture (self, g_value_get_boolean (value));
		break;
		case THEME_BORDER_RED_PROPERTY:
		theme_set_border_red (self, g_value_get_double (value));
		break;
		case THEME_BORDER_GREEN_PROPERTY:
		theme_set_border_green (self, g_value_get_double (value));
		break;
		case THEME_BORDER_BLUE_PROPERTY:
		theme_set_border_blue (self, g_value_get_double (value));
		break;
		case THEME_BORDER_WIDTH_PROPERTY:
		theme_set_border_width (self, g_value_get_int (value));
		break;
		case THEME_SPACING_RED_PROPERTY:
		theme_set_spacing_red (self, g_value_get_double (value));
		break;
		case THEME_SPACING_GREEN_PROPERTY:
		theme_set_spacing_green (self, g_value_get_double (value));
		break;
		case THEME_SPACING_BLUE_PROPERTY:
		theme_set_spacing_blue (self, g_value_get_double (value));
		break;
		case THEME_SPACING_WIDTH_PROPERTY:
		theme_set_spacing_width (self, g_value_get_int (value));
		break;
		case THEME_HIGHLIGHT_HARD_RED_PROPERTY:
		theme_set_highlight_hard_red (self, g_value_get_double (value));
		break;
		case THEME_HIGHLIGHT_HARD_GREEN_PROPERTY:
		theme_set_highlight_hard_green (self, g_value_get_double (value));
		break;
		case THEME_HIGHLIGHT_HARD_BLUE_PROPERTY:
		theme_set_highlight_hard_blue (self, g_value_get_double (value));
		break;
		case THEME_HIGHLIGHT_HARD_ALPHA_PROPERTY:
		theme_set_highlight_hard_alpha (self, g_value_get_double (value));
		break;
		case THEME_HIGHLIGHT_SOFT_RED_PROPERTY:
		theme_set_highlight_soft_red (self, g_value_get_double (value));
		break;
		case THEME_HIGHLIGHT_SOFT_GREEN_PROPERTY:
		theme_set_highlight_soft_green (self, g_value_get_double (value));
		break;
		case THEME_HIGHLIGHT_SOFT_BLUE_PROPERTY:
		theme_set_highlight_soft_blue (self, g_value_get_double (value));
		break;
		case THEME_HIGHLIGHT_SOFT_ALPHA_PROPERTY:
		theme_set_highlight_soft_alpha (self, g_value_get_double (value));
		break;
		case THEME_SOUND_FLIP_PROPERTY:
		theme_set_sound_flip (self, g_value_get_string (value));
		break;
		case THEME_SOUND_GAMEOVER_PROPERTY:
		theme_set_sound_gameover (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

