/* score-overlay.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from score-overlay.vala, do not modify */

/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-

   This file is part of GNOME Tetravex.

   Copyright (C) 2019 Arnaud Bonatti

   GNOME Tetravex 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 2 of the License, or
   (at your option) any later version.

   GNOME Tetravex is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with this GNOME Tetravex.  If not, see <https://www.gnu.org/licenses/>.
*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.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_SCORE_OVERLAY (score_overlay_get_type ())
#define SCORE_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCORE_OVERLAY, ScoreOverlay))
#define SCORE_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCORE_OVERLAY, ScoreOverlayClass))
#define IS_SCORE_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SCORE_OVERLAY))
#define IS_SCORE_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SCORE_OVERLAY))
#define SCORE_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SCORE_OVERLAY, ScoreOverlayClass))

typedef struct _ScoreOverlay ScoreOverlay;
typedef struct _ScoreOverlayClass ScoreOverlayClass;
typedef struct _ScoreOverlayPrivate ScoreOverlayPrivate;

#define TYPE_SCORE_OVERLAY_ENTRY (score_overlay_entry_get_type ())
#define SCORE_OVERLAY_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCORE_OVERLAY_ENTRY, ScoreOverlayEntry))
#define SCORE_OVERLAY_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCORE_OVERLAY_ENTRY, ScoreOverlayEntryClass))
#define IS_SCORE_OVERLAY_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SCORE_OVERLAY_ENTRY))
#define IS_SCORE_OVERLAY_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SCORE_OVERLAY_ENTRY))
#define SCORE_OVERLAY_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SCORE_OVERLAY_ENTRY, ScoreOverlayEntryClass))

typedef struct _ScoreOverlayEntry ScoreOverlayEntry;
typedef struct _ScoreOverlayEntryClass ScoreOverlayEntryClass;
enum  {
	SCORE_OVERLAY_0_PROPERTY,
	SCORE_OVERLAY_BOARDSIZE_PROPERTY,
	SCORE_OVERLAY_NUM_PROPERTIES
};
static GParamSpec* score_overlay_properties[SCORE_OVERLAY_NUM_PROPERTIES];

#define TYPE_HISTORY_ENTRY (history_entry_get_type ())
#define HISTORY_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HISTORY_ENTRY, HistoryEntry))
#define HISTORY_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HISTORY_ENTRY, HistoryEntryClass))
#define IS_HISTORY_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HISTORY_ENTRY))
#define IS_HISTORY_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HISTORY_ENTRY))
#define HISTORY_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HISTORY_ENTRY, HistoryEntryClass))

typedef struct _HistoryEntry HistoryEntry;
typedef struct _HistoryEntryClass HistoryEntryClass;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _ScoreOverlayEntryPrivate ScoreOverlayEntryPrivate;
enum  {
	SCORE_OVERLAY_ENTRY_0_PROPERTY,
	SCORE_OVERLAY_ENTRY_NUM_PROPERTIES
};
static GParamSpec* score_overlay_entry_properties[SCORE_OVERLAY_ENTRY_NUM_PROPERTIES];

struct _ScoreOverlay {
	GtkGrid parent_instance;
	ScoreOverlayPrivate * priv;
};

struct _ScoreOverlayClass {
	GtkGridClass parent_class;
};

struct _ScoreOverlayPrivate {
	ScoreOverlayEntry* score_0;
	ScoreOverlayEntry* score_1;
	ScoreOverlayEntry* score_2;
	ScoreOverlayEntry* score_3;
};

struct _ScoreOverlayEntry {
	GtkGrid parent_instance;
	ScoreOverlayEntryPrivate * priv;
};

struct _ScoreOverlayEntryClass {
	GtkGridClass parent_class;
};

struct _ScoreOverlayEntryPrivate {
	GtkLabel* place_label;
	GtkLabel* value_label;
};

static gint ScoreOverlay_private_offset;
static gpointer score_overlay_parent_class = NULL;
static gint ScoreOverlayEntry_private_offset;
static gpointer score_overlay_entry_parent_class = NULL;

VALA_EXTERN GType score_overlay_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ScoreOverlay, g_object_unref)
VALA_EXTERN GType score_overlay_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ScoreOverlayEntry, g_object_unref)
VALA_EXTERN GType history_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (HistoryEntry, g_object_unref)
VALA_EXTERN void score_overlay_set_score (ScoreOverlay* self,
                              guint8 puzzle_size,
                              guint position,
                              HistoryEntry* entry,
                              HistoryEntry* other_entry_0,
                              HistoryEntry* other_entry_1,
                              HistoryEntry* other_entry_2);
VALA_EXTERN void score_overlay_entry_set_place_label (ScoreOverlayEntry* self,
                                          const gchar* label);
VALA_EXTERN void score_overlay_entry_set_value_label (ScoreOverlayEntry* self,
                                          const gchar* label,
                                          gboolean bold_label);
VALA_EXTERN gchar* history_entry_get_duration_string (HistoryEntry* entry);
VALA_EXTERN void score_overlay_display_fallback_scores (ScoreOverlay* self,
                                            guint8 puzzle_size,
                                            HistoryEntry* best_score,
                                            HistoryEntry* second_score,
                                            HistoryEntry* third_score,
                                            HistoryEntry* worst_score);
VALA_EXTERN ScoreOverlay* score_overlay_new (void);
VALA_EXTERN ScoreOverlay* score_overlay_construct (GType object_type);
VALA_EXTERN void score_overlay_set_boardsize (ScoreOverlay* self,
                                  guint value);
static void score_overlay_finalize (GObject * obj);
static GType score_overlay_get_type_once (void);
static void _vala_score_overlay_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec);
VALA_EXTERN ScoreOverlayEntry* score_overlay_entry_new (void);
VALA_EXTERN ScoreOverlayEntry* score_overlay_entry_construct (GType object_type);
static void score_overlay_entry_finalize (GObject * obj);
static GType score_overlay_entry_get_type_once (void);

static inline gpointer
score_overlay_get_instance_private (ScoreOverlay* self)
{
	return G_STRUCT_MEMBER_P (self, ScoreOverlay_private_offset);
}

void
score_overlay_set_score (ScoreOverlay* self,
                         guint8 puzzle_size,
                         guint position,
                         HistoryEntry* entry,
                         HistoryEntry* other_entry_0,
                         HistoryEntry* other_entry_1,
                         HistoryEntry* other_entry_2)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	switch (position) {
		case 1:
		{
			ScoreOverlayEntry* _tmp0_;
			ScoreOverlayEntry* _tmp1_;
			gchar* _tmp2_;
			gchar* _tmp3_;
			ScoreOverlayEntry* _tmp4_;
			ScoreOverlayEntry* _tmp9_;
			ScoreOverlayEntry* _tmp14_;
			_tmp0_ = self->priv->score_0;
			score_overlay_entry_set_place_label (_tmp0_, _ ("New best time!"));
			_tmp1_ = self->priv->score_0;
			_tmp2_ = history_entry_get_duration_string (entry);
			_tmp3_ = _tmp2_;
			score_overlay_entry_set_value_label (_tmp1_, _tmp3_, TRUE);
			_g_free0 (_tmp3_);
			_tmp4_ = self->priv->score_1;
			score_overlay_entry_set_place_label (_tmp4_, _ ("Second:"));
			if (other_entry_0 != NULL) {
				ScoreOverlayEntry* _tmp5_;
				gchar* _tmp6_;
				gchar* _tmp7_;
				_tmp5_ = self->priv->score_1;
				_tmp6_ = history_entry_get_duration_string (G_TYPE_CHECK_INSTANCE_CAST (other_entry_0, TYPE_HISTORY_ENTRY, HistoryEntry));
				_tmp7_ = _tmp6_;
				score_overlay_entry_set_value_label (_tmp5_, _tmp7_, FALSE);
				_g_free0 (_tmp7_);
			} else {
				ScoreOverlayEntry* _tmp8_;
				_tmp8_ = self->priv->score_1;
				score_overlay_entry_set_value_label (_tmp8_, NULL, FALSE);
			}
			_tmp9_ = self->priv->score_2;
			score_overlay_entry_set_place_label (_tmp9_, _ ("Third:"));
			if (other_entry_1 != NULL) {
				ScoreOverlayEntry* _tmp10_;
				gchar* _tmp11_;
				gchar* _tmp12_;
				_tmp10_ = self->priv->score_2;
				_tmp11_ = history_entry_get_duration_string (G_TYPE_CHECK_INSTANCE_CAST (other_entry_1, TYPE_HISTORY_ENTRY, HistoryEntry));
				_tmp12_ = _tmp11_;
				score_overlay_entry_set_value_label (_tmp10_, _tmp12_, FALSE);
				_g_free0 (_tmp12_);
			} else {
				ScoreOverlayEntry* _tmp13_;
				_tmp13_ = self->priv->score_2;
				score_overlay_entry_set_value_label (_tmp13_, NULL, FALSE);
			}
			_tmp14_ = self->priv->score_3;
			score_overlay_entry_set_place_label (_tmp14_, _ ("Out of podium:"));
			if (other_entry_2 != NULL) {
				ScoreOverlayEntry* _tmp15_;
				gchar* _tmp16_;
				gchar* _tmp17_;
				_tmp15_ = self->priv->score_3;
				_tmp16_ = history_entry_get_duration_string (G_TYPE_CHECK_INSTANCE_CAST (other_entry_2, TYPE_HISTORY_ENTRY, HistoryEntry));
				_tmp17_ = _tmp16_;
				score_overlay_entry_set_value_label (_tmp15_, _tmp17_, FALSE);
				_g_free0 (_tmp17_);
			} else {
				ScoreOverlayEntry* _tmp18_;
				_tmp18_ = self->priv->score_3;
				score_overlay_entry_set_value_label (_tmp18_, NULL, FALSE);
			}
			break;
		}
		case 2:
		{
			ScoreOverlayEntry* _tmp19_;
			ScoreOverlayEntry* _tmp20_;
			gchar* _tmp21_;
			gchar* _tmp22_;
			ScoreOverlayEntry* _tmp23_;
			ScoreOverlayEntry* _tmp24_;
			gchar* _tmp25_;
			gchar* _tmp26_;
			ScoreOverlayEntry* _tmp27_;
			ScoreOverlayEntry* _tmp32_;
			if (other_entry_0 == NULL) {
				g_assert_not_reached ();
			}
			_tmp19_ = self->priv->score_0;
			score_overlay_entry_set_place_label (_tmp19_, _ ("Best time:"));
			_tmp20_ = self->priv->score_0;
			_tmp21_ = history_entry_get_duration_string (G_TYPE_CHECK_INSTANCE_CAST (other_entry_0, TYPE_HISTORY_ENTRY, HistoryEntry));
			_tmp22_ = _tmp21_;
			score_overlay_entry_set_value_label (_tmp20_, _tmp22_, FALSE);
			_g_free0 (_tmp22_);
			_tmp23_ = self->priv->score_1;
			score_overlay_entry_set_place_label (_tmp23_, _ ("Your time:"));
			_tmp24_ = self->priv->score_1;
			_tmp25_ = history_entry_get_duration_string (entry);
			_tmp26_ = _tmp25_;
			score_overlay_entry_set_value_label (_tmp24_, _tmp26_, TRUE);
			_g_free0 (_tmp26_);
			_tmp27_ = self->priv->score_2;
			score_overlay_entry_set_place_label (_tmp27_, _ ("Third:"));
			if (other_entry_1 != NULL) {
				ScoreOverlayEntry* _tmp28_;
				gchar* _tmp29_;
				gchar* _tmp30_;
				_tmp28_ = self->priv->score_2;
				_tmp29_ = history_entry_get_duration_string (G_TYPE_CHECK_INSTANCE_CAST (other_entry_1, TYPE_HISTORY_ENTRY, HistoryEntry));
				_tmp30_ = _tmp29_;
				score_overlay_entry_set_value_label (_tmp28_, _tmp30_, FALSE);
				_g_free0 (_tmp30_);
			} else {
				ScoreOverlayEntry* _tmp31_;
				_tmp31_ = self->priv->score_2;
				score_overlay_entry_set_value_label (_tmp31_, NULL, FALSE);
			}
			_tmp32_ = self->priv->score_3;
			score_overlay_entry_set_place_label (_tmp32_, _ ("Out of podium:"));
			if (other_entry_2 != NULL) {
				ScoreOverlayEntry* _tmp33_;
				gchar* _tmp34_;
				gchar* _tmp35_;
				_tmp33_ = self->priv->score_3;
				_tmp34_ = history_entry_get_duration_string (G_TYPE_CHECK_INSTANCE_CAST (other_entry_2, TYPE_HISTORY_ENTRY, HistoryEntry));
				_tmp35_ = _tmp34_;
				score_overlay_entry_set_value_label (_tmp33_, _tmp35_, FALSE);
				_g_free0 (_tmp35_);
			} else {
				ScoreOverlayEntry* _tmp36_;
				_tmp36_ = self->priv->score_3;
				score_overlay_entry_set_value_label (_tmp36_, NULL, FALSE);
			}
			break;
		}
		default:
		{
			gboolean _tmp37_ = FALSE;
			ScoreOverlayEntry* _tmp38_;
			ScoreOverlayEntry* _tmp39_;
			gchar* _tmp40_;
			gchar* _tmp41_;
			ScoreOverlayEntry* _tmp47_;
			gchar* _tmp48_;
			gchar* _tmp49_;
			ScoreOverlayEntry* _tmp50_;
			ScoreOverlayEntry* _tmp51_;
			gchar* _tmp52_;
			gchar* _tmp53_;
			ScoreOverlayEntry* _tmp54_;
			gchar* _tmp55_;
			gchar* _tmp56_;
			if (other_entry_0 == NULL) {
				_tmp37_ = TRUE;
			} else {
				_tmp37_ = other_entry_1 == NULL;
			}
			if (_tmp37_) {
				g_assert_not_reached ();
			}
			_tmp38_ = self->priv->score_0;
			score_overlay_entry_set_place_label (_tmp38_, _ ("Best time:"));
			_tmp39_ = self->priv->score_0;
			_tmp40_ = history_entry_get_duration_string (G_TYPE_CHECK_INSTANCE_CAST (other_entry_0, TYPE_HISTORY_ENTRY, HistoryEntry));
			_tmp41_ = _tmp40_;
			score_overlay_entry_set_value_label (_tmp39_, _tmp41_, FALSE);
			_g_free0 (_tmp41_);
			if (position == ((guint) 3)) {
				ScoreOverlayEntry* _tmp42_;
				_tmp42_ = self->priv->score_1;
				score_overlay_entry_set_place_label (_tmp42_, _ ("Second:"));
			} else {
				if (position == ((guint) 4)) {
					ScoreOverlayEntry* _tmp43_;
					_tmp43_ = self->priv->score_1;
					score_overlay_entry_set_place_label (_tmp43_, _ ("Third:"));
				} else {
					ScoreOverlayEntry* _tmp44_;
					gchar* _tmp45_;
					gchar* _tmp46_;
					_tmp44_ = self->priv->score_1;
					_tmp45_ = g_strdup_printf (_ ("Place %u:"), position - 1);
					_tmp46_ = _tmp45_;
					score_overlay_entry_set_place_label (_tmp44_, _tmp46_);
					_g_free0 (_tmp46_);
				}
			}
			_tmp47_ = self->priv->score_1;
			_tmp48_ = history_entry_get_duration_string (G_TYPE_CHECK_INSTANCE_CAST (other_entry_1, TYPE_HISTORY_ENTRY, HistoryEntry));
			_tmp49_ = _tmp48_;
			score_overlay_entry_set_value_label (_tmp47_, _tmp49_, FALSE);
			_g_free0 (_tmp49_);
			_tmp50_ = self->priv->score_2;
			score_overlay_entry_set_place_label (_tmp50_, _ ("Your time:"));
			_tmp51_ = self->priv->score_2;
			_tmp52_ = history_entry_get_duration_string (entry);
			_tmp53_ = _tmp52_;
			score_overlay_entry_set_value_label (_tmp51_, _tmp53_, TRUE);
			_g_free0 (_tmp53_);
			_tmp54_ = self->priv->score_3;
			_tmp55_ = g_strdup_printf (_ ("Place %u:"), position + 1);
			_tmp56_ = _tmp55_;
			score_overlay_entry_set_place_label (_tmp54_, _tmp56_);
			_g_free0 (_tmp56_);
			if (other_entry_2 != NULL) {
				ScoreOverlayEntry* _tmp57_;
				gchar* _tmp58_;
				gchar* _tmp59_;
				_tmp57_ = self->priv->score_3;
				_tmp58_ = history_entry_get_duration_string (G_TYPE_CHECK_INSTANCE_CAST (other_entry_2, TYPE_HISTORY_ENTRY, HistoryEntry));
				_tmp59_ = _tmp58_;
				score_overlay_entry_set_value_label (_tmp57_, _tmp59_, FALSE);
				_g_free0 (_tmp59_);
			} else {
				ScoreOverlayEntry* _tmp60_;
				_tmp60_ = self->priv->score_3;
				score_overlay_entry_set_value_label (_tmp60_, NULL, FALSE);
			}
			break;
		}
	}
}

void
score_overlay_display_fallback_scores (ScoreOverlay* self,
                                       guint8 puzzle_size,
                                       HistoryEntry* best_score,
                                       HistoryEntry* second_score,
                                       HistoryEntry* third_score,
                                       HistoryEntry* worst_score)
{
	ScoreOverlayEntry* _tmp0_;
	ScoreOverlayEntry* _tmp5_;
	ScoreOverlayEntry* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->score_0;
	score_overlay_entry_set_place_label (_tmp0_, _ ("Best time:"));
	if (best_score != NULL) {
		ScoreOverlayEntry* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp1_ = self->priv->score_0;
		_tmp2_ = history_entry_get_duration_string (G_TYPE_CHECK_INSTANCE_CAST (best_score, TYPE_HISTORY_ENTRY, HistoryEntry));
		_tmp3_ = _tmp2_;
		score_overlay_entry_set_value_label (_tmp1_, _tmp3_, FALSE);
		_g_free0 (_tmp3_);
	} else {
		ScoreOverlayEntry* _tmp4_;
		_tmp4_ = self->priv->score_0;
		score_overlay_entry_set_value_label (_tmp4_, NULL, FALSE);
	}
	_tmp5_ = self->priv->score_1;
	score_overlay_entry_set_place_label (_tmp5_, _ ("Second:"));
	if (second_score != NULL) {
		ScoreOverlayEntry* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp6_ = self->priv->score_1;
		_tmp7_ = history_entry_get_duration_string (G_TYPE_CHECK_INSTANCE_CAST (second_score, TYPE_HISTORY_ENTRY, HistoryEntry));
		_tmp8_ = _tmp7_;
		score_overlay_entry_set_value_label (_tmp6_, _tmp8_, FALSE);
		_g_free0 (_tmp8_);
	} else {
		ScoreOverlayEntry* _tmp9_;
		_tmp9_ = self->priv->score_1;
		score_overlay_entry_set_value_label (_tmp9_, NULL, FALSE);
	}
	_tmp10_ = self->priv->score_2;
	score_overlay_entry_set_place_label (_tmp10_, _ ("Third:"));
	if (third_score != NULL) {
		ScoreOverlayEntry* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		_tmp11_ = self->priv->score_2;
		_tmp12_ = history_entry_get_duration_string (G_TYPE_CHECK_INSTANCE_CAST (third_score, TYPE_HISTORY_ENTRY, HistoryEntry));
		_tmp13_ = _tmp12_;
		score_overlay_entry_set_value_label (_tmp11_, _tmp13_, FALSE);
		_g_free0 (_tmp13_);
	} else {
		ScoreOverlayEntry* _tmp14_;
		_tmp14_ = self->priv->score_2;
		score_overlay_entry_set_value_label (_tmp14_, NULL, FALSE);
	}
	if (worst_score != NULL) {
		ScoreOverlayEntry* _tmp15_;
		ScoreOverlayEntry* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		_tmp15_ = self->priv->score_3;
		score_overlay_entry_set_place_label (_tmp15_, _ ("Worst time:"));
		_tmp16_ = self->priv->score_3;
		_tmp17_ = history_entry_get_duration_string (G_TYPE_CHECK_INSTANCE_CAST (worst_score, TYPE_HISTORY_ENTRY, HistoryEntry));
		_tmp18_ = _tmp17_;
		score_overlay_entry_set_value_label (_tmp16_, _tmp18_, FALSE);
		_g_free0 (_tmp18_);
	} else {
		ScoreOverlayEntry* _tmp19_;
		ScoreOverlayEntry* _tmp20_;
		_tmp19_ = self->priv->score_3;
		score_overlay_entry_set_place_label (_tmp19_, _ ("Fourth:"));
		_tmp20_ = self->priv->score_3;
		score_overlay_entry_set_value_label (_tmp20_, NULL, FALSE);
	}
}

ScoreOverlay*
score_overlay_construct (GType object_type)
{
	ScoreOverlay * self = NULL;
	self = (ScoreOverlay*) g_object_new (object_type, NULL);
	return self;
}

ScoreOverlay*
score_overlay_new (void)
{
	return score_overlay_construct (TYPE_SCORE_OVERLAY);
}

void
score_overlay_set_boardsize (ScoreOverlay* self,
                             guint value)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	if (value < ((guint) 250)) {
		_tmp0_ = value != ((guint) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GtkStyleContext* _tmp1_;
		_tmp1_ = gtk_widget_get_style_context ((GtkWidget*) self);
		gtk_style_context_add_class (_tmp1_, "small-window");
	} else {
		GtkStyleContext* _tmp2_;
		_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) self);
		gtk_style_context_remove_class (_tmp2_, "small-window");
	}
	g_object_notify_by_pspec ((GObject *) self, score_overlay_properties[SCORE_OVERLAY_BOARDSIZE_PROPERTY]);
}

static void
score_overlay_class_init (ScoreOverlayClass * klass,
                          gpointer klass_data)
{
	score_overlay_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ScoreOverlay_private_offset);
	G_OBJECT_CLASS (klass)->set_property = _vala_score_overlay_set_property;
	G_OBJECT_CLASS (klass)->finalize = score_overlay_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SCORE_OVERLAY_BOARDSIZE_PROPERTY, score_overlay_properties[SCORE_OVERLAY_BOARDSIZE_PROPERTY] = g_param_spec_uint ("boardsize", "boardsize", "boardsize", 0, G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Tetravex/score-overlay.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "score_0", FALSE, ScoreOverlay_private_offset + G_STRUCT_OFFSET (ScoreOverlayPrivate, score_0));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "score_1", FALSE, ScoreOverlay_private_offset + G_STRUCT_OFFSET (ScoreOverlayPrivate, score_1));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "score_2", FALSE, ScoreOverlay_private_offset + G_STRUCT_OFFSET (ScoreOverlayPrivate, score_2));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "score_3", FALSE, ScoreOverlay_private_offset + G_STRUCT_OFFSET (ScoreOverlayPrivate, score_3));
}

static void
score_overlay_instance_init (ScoreOverlay * self,
                             gpointer klass)
{
	self->priv = score_overlay_get_instance_private (self);
	g_type_ensure (TYPE_SCORE_OVERLAY_ENTRY);
	g_type_ensure (TYPE_SCORE_OVERLAY_ENTRY);
	g_type_ensure (TYPE_SCORE_OVERLAY_ENTRY);
	g_type_ensure (TYPE_SCORE_OVERLAY_ENTRY);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
score_overlay_finalize (GObject * obj)
{
	ScoreOverlay * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SCORE_OVERLAY, ScoreOverlay);
	G_OBJECT_CLASS (score_overlay_parent_class)->finalize (obj);
}

static GType
score_overlay_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ScoreOverlayClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) score_overlay_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ScoreOverlay), 0, (GInstanceInitFunc) score_overlay_instance_init, NULL };
	GType score_overlay_type_id;
	score_overlay_type_id = g_type_register_static (gtk_grid_get_type (), "ScoreOverlay", &g_define_type_info, 0);
	ScoreOverlay_private_offset = g_type_add_instance_private (score_overlay_type_id, sizeof (ScoreOverlayPrivate));
	return score_overlay_type_id;
}

GType
score_overlay_get_type (void)
{
	static volatile gsize score_overlay_type_id__once = 0;
	if (g_once_init_enter (&score_overlay_type_id__once)) {
		GType score_overlay_type_id;
		score_overlay_type_id = score_overlay_get_type_once ();
		g_once_init_leave (&score_overlay_type_id__once, score_overlay_type_id);
	}
	return score_overlay_type_id__once;
}

static void
_vala_score_overlay_set_property (GObject * object,
                                  guint property_id,
                                  const GValue * value,
                                  GParamSpec * pspec)
{
	ScoreOverlay * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_SCORE_OVERLAY, ScoreOverlay);
	switch (property_id) {
		case SCORE_OVERLAY_BOARDSIZE_PROPERTY:
		score_overlay_set_boardsize (self, g_value_get_uint (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
score_overlay_entry_get_instance_private (ScoreOverlayEntry* self)
{
	return G_STRUCT_MEMBER_P (self, ScoreOverlayEntry_private_offset);
}

void
score_overlay_entry_set_place_label (ScoreOverlayEntry* self,
                                     const gchar* label)
{
	GtkLabel* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label != NULL);
	_tmp0_ = self->priv->place_label;
	gtk_label_set_label (_tmp0_, label);
}

void
score_overlay_entry_set_value_label (ScoreOverlayEntry* self,
                                     const gchar* label,
                                     gboolean bold_label)
{
	g_return_if_fail (self != NULL);
	if (label != NULL) {
		GtkLabel* _tmp0_;
		GtkLabel* _tmp1_;
		GtkStyleContext* _tmp2_;
		_tmp0_ = self->priv->value_label;
		gtk_label_set_label (_tmp0_, (const gchar*) label);
		_tmp1_ = self->priv->value_label;
		_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) _tmp1_);
		gtk_style_context_remove_class (_tmp2_, "italic-label");
	} else {
		GtkLabel* _tmp3_;
		GtkLabel* _tmp4_;
		GtkStyleContext* _tmp5_;
		_tmp3_ = self->priv->value_label;
		gtk_label_set_label (_tmp3_, _ ("Free!"));
		_tmp4_ = self->priv->value_label;
		_tmp5_ = gtk_widget_get_style_context ((GtkWidget*) _tmp4_);
		gtk_style_context_add_class (_tmp5_, "italic-label");
	}
	if (bold_label) {
		GtkLabel* _tmp6_;
		GtkStyleContext* _tmp7_;
		_tmp6_ = self->priv->value_label;
		_tmp7_ = gtk_widget_get_style_context ((GtkWidget*) _tmp6_);
		gtk_style_context_add_class (_tmp7_, "bold-label");
	} else {
		GtkLabel* _tmp8_;
		GtkStyleContext* _tmp9_;
		_tmp8_ = self->priv->value_label;
		_tmp9_ = gtk_widget_get_style_context ((GtkWidget*) _tmp8_);
		gtk_style_context_remove_class (_tmp9_, "bold-label");
	}
}

ScoreOverlayEntry*
score_overlay_entry_construct (GType object_type)
{
	ScoreOverlayEntry * self = NULL;
	self = (ScoreOverlayEntry*) g_object_new (object_type, NULL);
	return self;
}

ScoreOverlayEntry*
score_overlay_entry_new (void)
{
	return score_overlay_entry_construct (TYPE_SCORE_OVERLAY_ENTRY);
}

static void
score_overlay_entry_class_init (ScoreOverlayEntryClass * klass,
                                gpointer klass_data)
{
	score_overlay_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ScoreOverlayEntry_private_offset);
	G_OBJECT_CLASS (klass)->finalize = score_overlay_entry_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Tetravex/score-overlay-entry.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "place_label", FALSE, ScoreOverlayEntry_private_offset + G_STRUCT_OFFSET (ScoreOverlayEntryPrivate, place_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "value_label", FALSE, ScoreOverlayEntry_private_offset + G_STRUCT_OFFSET (ScoreOverlayEntryPrivate, value_label));
}

static void
score_overlay_entry_instance_init (ScoreOverlayEntry * self,
                                   gpointer klass)
{
	self->priv = score_overlay_entry_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
score_overlay_entry_finalize (GObject * obj)
{
	ScoreOverlayEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SCORE_OVERLAY_ENTRY, ScoreOverlayEntry);
	G_OBJECT_CLASS (score_overlay_entry_parent_class)->finalize (obj);
}

static GType
score_overlay_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ScoreOverlayEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) score_overlay_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ScoreOverlayEntry), 0, (GInstanceInitFunc) score_overlay_entry_instance_init, NULL };
	GType score_overlay_entry_type_id;
	score_overlay_entry_type_id = g_type_register_static (gtk_grid_get_type (), "ScoreOverlayEntry", &g_define_type_info, 0);
	ScoreOverlayEntry_private_offset = g_type_add_instance_private (score_overlay_entry_type_id, sizeof (ScoreOverlayEntryPrivate));
	return score_overlay_entry_type_id;
}

GType
score_overlay_entry_get_type (void)
{
	static volatile gsize score_overlay_entry_type_id__once = 0;
	if (g_once_init_enter (&score_overlay_entry_type_id__once)) {
		GType score_overlay_entry_type_id;
		score_overlay_entry_type_id = score_overlay_entry_get_type_once ();
		g_once_init_leave (&score_overlay_entry_type_id__once, score_overlay_entry_type_id);
	}
	return score_overlay_entry_type_id__once;
}

