/* screen-layout-switcher.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from screen-layout-switcher.vala, do not modify */

/* This file is part of GNOME Games. License: GPL-3.0+.*/

#include "gnome-games.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.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

#define GAMES_TYPE_SCREEN_LAYOUT_ITEM (games_screen_layout_item_get_type ())
#define GAMES_SCREEN_LAYOUT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_SCREEN_LAYOUT_ITEM, GamesScreenLayoutItem))
#define GAMES_SCREEN_LAYOUT_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_SCREEN_LAYOUT_ITEM, GamesScreenLayoutItemClass))
#define GAMES_IS_SCREEN_LAYOUT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_SCREEN_LAYOUT_ITEM))
#define GAMES_IS_SCREEN_LAYOUT_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_SCREEN_LAYOUT_ITEM))
#define GAMES_SCREEN_LAYOUT_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_SCREEN_LAYOUT_ITEM, GamesScreenLayoutItemClass))

typedef struct _GamesScreenLayoutItem GamesScreenLayoutItem;
typedef struct _GamesScreenLayoutItemClass GamesScreenLayoutItemClass;
enum  {
	GAMES_SCREEN_LAYOUT_SWITCHER_0_PROPERTY,
	GAMES_SCREEN_LAYOUT_SWITCHER_SCREEN_LAYOUT_PROPERTY,
	GAMES_SCREEN_LAYOUT_SWITCHER_VIEW_BOTTOM_SCREEN_PROPERTY,
	GAMES_SCREEN_LAYOUT_SWITCHER_BLOCK_AUTOHIDE_PROPERTY,
	GAMES_SCREEN_LAYOUT_SWITCHER_NUM_PROPERTIES
};
static GParamSpec* games_screen_layout_switcher_properties[GAMES_SCREEN_LAYOUT_SWITCHER_NUM_PROPERTIES];
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GamesScreenLayoutSwitcherPrivate {
	GtkRevealer* change_screen_revealer;
	GtkImage* change_screen_image;
	GtkMenuButton* layout_button;
	GtkImage* layout_image;
	GtkPopover* layout_popover;
	GtkListBox* list_box;
	GHashTable* items;
	GamesScreenLayout _screen_layout;
	gboolean _view_bottom_screen;
	gboolean is_menu_open;
};

static gint GamesScreenLayoutSwitcher_private_offset;
static gpointer games_screen_layout_switcher_parent_class = NULL;
static GamesHeaderBarWidgetIface * games_screen_layout_switcher_games_header_bar_widget_parent_iface = NULL;

VALA_EXTERN GType games_screen_layout_item_get_type (void) G_GNUC_CONST ;
static void games_screen_layout_switcher_real_constructed (GObject* base);
static void _g_object_unref0_ (gpointer var);
VALA_EXTERN GamesScreenLayoutItem* games_screen_layout_item_new (GamesScreenLayout layout);
VALA_EXTERN GamesScreenLayoutItem* games_screen_layout_item_construct (GType object_type,
                                                           GamesScreenLayout layout);
static void games_screen_layout_switcher_update_ui (GamesScreenLayoutSwitcher* self);
static void _games_screen_layout_switcher_update_ui_g_object_notify (GObject* _sender,
                                                              GParamSpec* pspec,
                                                              gpointer self);
static void games_screen_layout_switcher_on_menu_state_changed (GamesScreenLayoutSwitcher* self);
static void _games_screen_layout_switcher_on_menu_state_changed_g_object_notify (GObject* _sender,
                                                                          GParamSpec* pspec,
                                                                          gpointer self);
VALA_EXTERN GamesScreenLayout games_screen_layout_item_get_layout (GamesScreenLayoutItem* self);
VALA_EXTERN void games_screen_layout_item_set_selected (GamesScreenLayoutItem* self,
                                            gboolean value);
static void _games_screen_layout_switcher_update_ui_gtk_widget_show (GtkWidget* _sender,
                                                              gpointer self);
static void games_screen_layout_switcher_on_screen_changed (GamesScreenLayoutSwitcher* self);
static void _games_screen_layout_switcher_on_screen_changed_gtk_button_clicked (GtkButton* _sender,
                                                                         gpointer self);
static void games_screen_layout_switcher_on_row_activated (GamesScreenLayoutSwitcher* self,
                                                    GtkListBoxRow* row);
static void _games_screen_layout_switcher_on_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                                GtkListBoxRow* row,
                                                                                gpointer self);
static void games_screen_layout_switcher_finalize (GObject * obj);
static GType games_screen_layout_switcher_get_type_once (void);
static void _vala_games_screen_layout_switcher_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec);
static void _vala_games_screen_layout_switcher_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
games_screen_layout_switcher_get_instance_private (GamesScreenLayoutSwitcher* self)
{
	return G_STRUCT_MEMBER_P (self, GamesScreenLayoutSwitcher_private_offset);
}

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

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

static void
_games_screen_layout_switcher_update_ui_g_object_notify (GObject* _sender,
                                                         GParamSpec* pspec,
                                                         gpointer self)
{
	games_screen_layout_switcher_update_ui ((GamesScreenLayoutSwitcher*) self);
}

static void
games_screen_layout_switcher_real_constructed (GObject* base)
{
	GamesScreenLayoutSwitcher * self;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	gint _tmp3_ = 0;
	GamesScreenLayout* _tmp4_;
	self = (GamesScreenLayoutSwitcher*) base;
	_tmp0_ = g_direct_hash;
	_tmp1_ = g_direct_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, NULL, _g_object_unref0_);
	_g_hash_table_unref0 (self->priv->items);
	self->priv->items = _tmp2_;
	_tmp4_ = games_screen_layout_get_layouts (&_tmp3_);
	{
		GamesScreenLayout* layout_collection = NULL;
		gint layout_collection_length1 = 0;
		gint _layout_collection_size_ = 0;
		gint layout_it = 0;
		layout_collection = _tmp4_;
		layout_collection_length1 = _tmp3_;
		for (layout_it = 0; layout_it < layout_collection_length1; layout_it = layout_it + 1) {
			GamesScreenLayout layout = 0;
			layout = layout_collection[layout_it];
			{
				GamesScreenLayoutItem* item = NULL;
				GamesScreenLayoutItem* _tmp5_;
				GHashTable* _tmp6_;
				GamesScreenLayoutItem* _tmp7_;
				GamesScreenLayoutItem* _tmp8_;
				GtkListBox* _tmp9_;
				GamesScreenLayoutItem* _tmp10_;
				_tmp5_ = games_screen_layout_item_new (layout);
				g_object_ref_sink (_tmp5_);
				item = _tmp5_;
				_tmp6_ = self->priv->items;
				_tmp7_ = item;
				_tmp8_ = _g_object_ref0 (_tmp7_);
				g_hash_table_insert (_tmp6_, (gpointer) ((gintptr) layout), _tmp8_);
				_tmp9_ = self->priv->list_box;
				_tmp10_ = item;
				gtk_container_add ((GtkContainer*) _tmp9_, (GtkWidget*) _tmp10_);
				_g_object_unref0 (item);
			}
		}
		layout_collection = (g_free (layout_collection), NULL);
	}
	games_screen_layout_switcher_update_ui (self);
	g_signal_connect_object ((GObject*) self, "notify::screen-layout", (GCallback) _games_screen_layout_switcher_update_ui_g_object_notify, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::view-bottom-screen", (GCallback) _games_screen_layout_switcher_update_ui_g_object_notify, self, 0);
	G_OBJECT_CLASS (games_screen_layout_switcher_parent_class)->constructed ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_box_get_type (), GtkBox));
}

static void
games_screen_layout_switcher_on_menu_state_changed (GamesScreenLayoutSwitcher* self)
{
	GtkMenuButton* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->layout_button;
	_tmp1_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp0_);
	_tmp2_ = _tmp1_;
	self->priv->is_menu_open = _tmp2_;
	g_object_notify ((GObject*) self, "block-autohide");
}

static void
_games_screen_layout_switcher_on_menu_state_changed_g_object_notify (GObject* _sender,
                                                                     GParamSpec* pspec,
                                                                     gpointer self)
{
	games_screen_layout_switcher_on_menu_state_changed ((GamesScreenLayoutSwitcher*) self);
}

static void
games_screen_layout_switcher_update_ui (GamesScreenLayoutSwitcher* self)
{
	GtkImage* _tmp0_;
	GamesScreenLayout _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GHashTable* _tmp4_;
	GList* _tmp5_;
	GamesScreenLayoutItem* item = NULL;
	GHashTable* _tmp11_;
	GamesScreenLayout _tmp12_;
	gconstpointer _tmp13_;
	GamesScreenLayoutItem* _tmp14_;
	GtkListBox* _tmp15_;
	GamesScreenLayoutItem* _tmp16_;
	GtkRevealer* _tmp17_;
	GamesScreenLayout _tmp18_;
	const gchar* _tmp19_ = NULL;
	gboolean _tmp20_;
	GtkImage* _tmp21_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->layout_image;
	_tmp1_ = self->priv->_screen_layout;
	_tmp2_ = games_screen_layout_get_icon (_tmp1_);
	_tmp3_ = _tmp2_;
	g_object_set (_tmp0_, "icon-name", _tmp3_, NULL);
	_g_free0 (_tmp3_);
	_tmp4_ = self->priv->items;
	_tmp5_ = g_hash_table_get_values (_tmp4_);
	{
		GList* item_collection = NULL;
		GList* item_it = NULL;
		item_collection = _tmp5_;
		for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
			GamesScreenLayoutItem* item = NULL;
			item = (GamesScreenLayoutItem*) item_it->data;
			{
				GamesScreenLayoutItem* _tmp6_;
				GamesScreenLayoutItem* _tmp7_;
				GamesScreenLayout _tmp8_;
				GamesScreenLayout _tmp9_;
				GamesScreenLayout _tmp10_;
				_tmp6_ = item;
				_tmp7_ = item;
				_tmp8_ = games_screen_layout_item_get_layout (_tmp7_);
				_tmp9_ = _tmp8_;
				_tmp10_ = self->priv->_screen_layout;
				games_screen_layout_item_set_selected (_tmp6_, _tmp9_ == _tmp10_);
			}
		}
		(item_collection == NULL) ? NULL : (item_collection = (g_list_free (item_collection), NULL));
	}
	_tmp11_ = self->priv->items;
	_tmp12_ = self->priv->_screen_layout;
	_tmp13_ = g_hash_table_lookup (_tmp11_, (gpointer) ((gintptr) _tmp12_));
	_tmp14_ = _g_object_ref0 ((GamesScreenLayoutItem*) _tmp13_);
	item = _tmp14_;
	_tmp15_ = self->priv->list_box;
	_tmp16_ = item;
	gtk_list_box_select_row (_tmp15_, (GtkListBoxRow*) _tmp16_);
	_tmp17_ = self->priv->change_screen_revealer;
	_tmp18_ = self->priv->_screen_layout;
	gtk_revealer_set_reveal_child (_tmp17_, _tmp18_ == GAMES_SCREEN_LAYOUT_QUICK_SWITCH);
	_tmp20_ = self->priv->_view_bottom_screen;
	if (_tmp20_) {
		_tmp19_ = "view-top-screen-symbolic";
	} else {
		_tmp19_ = "view-bottom-screen-symbolic";
	}
	_tmp21_ = self->priv->change_screen_image;
	g_object_set (_tmp21_, "icon-name", _tmp19_, NULL);
	_g_object_unref0 (item);
}

static void
_games_screen_layout_switcher_update_ui_gtk_widget_show (GtkWidget* _sender,
                                                         gpointer self)
{
	games_screen_layout_switcher_update_ui ((GamesScreenLayoutSwitcher*) self);
}

static void
games_screen_layout_switcher_on_screen_changed (GamesScreenLayoutSwitcher* self)
{
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_view_bottom_screen;
	games_screen_layout_switcher_set_view_bottom_screen (self, !_tmp0_);
}

static void
_games_screen_layout_switcher_on_screen_changed_gtk_button_clicked (GtkButton* _sender,
                                                                    gpointer self)
{
	games_screen_layout_switcher_on_screen_changed ((GamesScreenLayoutSwitcher*) self);
}

static void
games_screen_layout_switcher_on_row_activated (GamesScreenLayoutSwitcher* self,
                                               GtkListBoxRow* row)
{
	GamesScreenLayoutItem* layout_item = NULL;
	GamesScreenLayoutItem* _tmp0_;
	GamesScreenLayout _tmp1_;
	GamesScreenLayout _tmp2_;
	GtkPopover* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (row != NULL);
	_tmp0_ = _g_object_ref0 (GAMES_IS_SCREEN_LAYOUT_ITEM (row) ? ((GamesScreenLayoutItem*) row) : NULL);
	layout_item = _tmp0_;
	_tmp1_ = games_screen_layout_item_get_layout (layout_item);
	_tmp2_ = _tmp1_;
	games_screen_layout_switcher_set_screen_layout (self, _tmp2_);
	_tmp3_ = self->priv->layout_popover;
	gtk_popover_popdown (_tmp3_);
	_g_object_unref0 (layout_item);
}

static void
_games_screen_layout_switcher_on_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                           GtkListBoxRow* row,
                                                                           gpointer self)
{
	games_screen_layout_switcher_on_row_activated ((GamesScreenLayoutSwitcher*) self, row);
}

GamesScreenLayoutSwitcher*
games_screen_layout_switcher_construct (GType object_type)
{
	GamesScreenLayoutSwitcher * self = NULL;
	self = (GamesScreenLayoutSwitcher*) g_object_new (object_type, NULL);
	return self;
}

GamesScreenLayoutSwitcher*
games_screen_layout_switcher_new (void)
{
	return games_screen_layout_switcher_construct (GAMES_TYPE_SCREEN_LAYOUT_SWITCHER);
}

GamesScreenLayout
games_screen_layout_switcher_get_screen_layout (GamesScreenLayoutSwitcher* self)
{
	GamesScreenLayout result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_screen_layout;
	return result;
}

void
games_screen_layout_switcher_set_screen_layout (GamesScreenLayoutSwitcher* self,
                                                GamesScreenLayout value)
{
	GamesScreenLayout old_value;
	g_return_if_fail (self != NULL);
	old_value = games_screen_layout_switcher_get_screen_layout (self);
	if (old_value != value) {
		self->priv->_screen_layout = value;
		g_object_notify_by_pspec ((GObject *) self, games_screen_layout_switcher_properties[GAMES_SCREEN_LAYOUT_SWITCHER_SCREEN_LAYOUT_PROPERTY]);
	}
}

gboolean
games_screen_layout_switcher_get_view_bottom_screen (GamesScreenLayoutSwitcher* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_view_bottom_screen;
	return result;
}

void
games_screen_layout_switcher_set_view_bottom_screen (GamesScreenLayoutSwitcher* self,
                                                     gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = games_screen_layout_switcher_get_view_bottom_screen (self);
	if (old_value != value) {
		self->priv->_view_bottom_screen = value;
		g_object_notify_by_pspec ((GObject *) self, games_screen_layout_switcher_properties[GAMES_SCREEN_LAYOUT_SWITCHER_VIEW_BOTTOM_SCREEN_PROPERTY]);
	}
}

static gboolean
games_screen_layout_switcher_real_get_block_autohide (GamesHeaderBarWidget* base)
{
	gboolean result;
	GamesScreenLayoutSwitcher* self;
	self = (GamesScreenLayoutSwitcher*) base;
	result = self->priv->is_menu_open;
	return result;
}

static void
games_screen_layout_switcher_class_init (GamesScreenLayoutSwitcherClass * klass,
                                         gpointer klass_data)
{
	games_screen_layout_switcher_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesScreenLayoutSwitcher_private_offset);
	((GObjectClass *) klass)->constructed = (void (*) (GObject*)) games_screen_layout_switcher_real_constructed;
	G_OBJECT_CLASS (klass)->get_property = _vala_games_screen_layout_switcher_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_screen_layout_switcher_set_property;
	G_OBJECT_CLASS (klass)->finalize = games_screen_layout_switcher_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_SCREEN_LAYOUT_SWITCHER_SCREEN_LAYOUT_PROPERTY, games_screen_layout_switcher_properties[GAMES_SCREEN_LAYOUT_SWITCHER_SCREEN_LAYOUT_PROPERTY] = g_param_spec_enum ("screen-layout", "screen-layout", "screen-layout", GAMES_TYPE_SCREEN_LAYOUT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_SCREEN_LAYOUT_SWITCHER_VIEW_BOTTOM_SCREEN_PROPERTY, games_screen_layout_switcher_properties[GAMES_SCREEN_LAYOUT_SWITCHER_VIEW_BOTTOM_SCREEN_PROPERTY] = g_param_spec_boolean ("view-bottom-screen", "view-bottom-screen", "view-bottom-screen", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_SCREEN_LAYOUT_SWITCHER_BLOCK_AUTOHIDE_PROPERTY, games_screen_layout_switcher_properties[GAMES_SCREEN_LAYOUT_SWITCHER_BLOCK_AUTOHIDE_PROPERTY] = g_param_spec_boolean ("block-autohide", "block-autohide", "block-autohide", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Games/screen-layout/screen-layout-switcher.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "change_screen_revealer", FALSE, GamesScreenLayoutSwitcher_private_offset + G_STRUCT_OFFSET (GamesScreenLayoutSwitcherPrivate, change_screen_revealer));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "change_screen_image", FALSE, GamesScreenLayoutSwitcher_private_offset + G_STRUCT_OFFSET (GamesScreenLayoutSwitcherPrivate, change_screen_image));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "layout_button", FALSE, GamesScreenLayoutSwitcher_private_offset + G_STRUCT_OFFSET (GamesScreenLayoutSwitcherPrivate, layout_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "layout_image", FALSE, GamesScreenLayoutSwitcher_private_offset + G_STRUCT_OFFSET (GamesScreenLayoutSwitcherPrivate, layout_image));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "layout_popover", FALSE, GamesScreenLayoutSwitcher_private_offset + G_STRUCT_OFFSET (GamesScreenLayoutSwitcherPrivate, layout_popover));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "list_box", FALSE, GamesScreenLayoutSwitcher_private_offset + G_STRUCT_OFFSET (GamesScreenLayoutSwitcherPrivate, list_box));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_menu_state_changed", G_CALLBACK(_games_screen_layout_switcher_on_menu_state_changed_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "update_ui", G_CALLBACK(_games_screen_layout_switcher_update_ui_gtk_widget_show));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_screen_changed", G_CALLBACK(_games_screen_layout_switcher_on_screen_changed_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_row_activated", G_CALLBACK(_games_screen_layout_switcher_on_row_activated_gtk_list_box_row_activated));
}

static void
games_screen_layout_switcher_games_header_bar_widget_interface_init (GamesHeaderBarWidgetIface * iface,
                                                                     gpointer iface_data)
{
	games_screen_layout_switcher_games_header_bar_widget_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_block_autohide = games_screen_layout_switcher_real_get_block_autohide;
}

static void
games_screen_layout_switcher_instance_init (GamesScreenLayoutSwitcher * self,
                                            gpointer klass)
{
	self->priv = games_screen_layout_switcher_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
games_screen_layout_switcher_finalize (GObject * obj)
{
	GamesScreenLayoutSwitcher * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_SCREEN_LAYOUT_SWITCHER, GamesScreenLayoutSwitcher);
	_g_hash_table_unref0 (self->priv->items);
	G_OBJECT_CLASS (games_screen_layout_switcher_parent_class)->finalize (obj);
}

static GType
games_screen_layout_switcher_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesScreenLayoutSwitcherClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_screen_layout_switcher_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesScreenLayoutSwitcher), 0, (GInstanceInitFunc) games_screen_layout_switcher_instance_init, NULL };
	static const GInterfaceInfo games_header_bar_widget_info = { (GInterfaceInitFunc) games_screen_layout_switcher_games_header_bar_widget_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType games_screen_layout_switcher_type_id;
	games_screen_layout_switcher_type_id = g_type_register_static (gtk_box_get_type (), "GamesScreenLayoutSwitcher", &g_define_type_info, 0);
	g_type_add_interface_static (games_screen_layout_switcher_type_id, GAMES_TYPE_HEADER_BAR_WIDGET, &games_header_bar_widget_info);
	GamesScreenLayoutSwitcher_private_offset = g_type_add_instance_private (games_screen_layout_switcher_type_id, sizeof (GamesScreenLayoutSwitcherPrivate));
	return games_screen_layout_switcher_type_id;
}

GType
games_screen_layout_switcher_get_type (void)
{
	static volatile gsize games_screen_layout_switcher_type_id__once = 0;
	if (g_once_init_enter (&games_screen_layout_switcher_type_id__once)) {
		GType games_screen_layout_switcher_type_id;
		games_screen_layout_switcher_type_id = games_screen_layout_switcher_get_type_once ();
		g_once_init_leave (&games_screen_layout_switcher_type_id__once, games_screen_layout_switcher_type_id);
	}
	return games_screen_layout_switcher_type_id__once;
}

static void
_vala_games_screen_layout_switcher_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec)
{
	GamesScreenLayoutSwitcher * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_SCREEN_LAYOUT_SWITCHER, GamesScreenLayoutSwitcher);
	switch (property_id) {
		case GAMES_SCREEN_LAYOUT_SWITCHER_SCREEN_LAYOUT_PROPERTY:
		g_value_set_enum (value, games_screen_layout_switcher_get_screen_layout (self));
		break;
		case GAMES_SCREEN_LAYOUT_SWITCHER_VIEW_BOTTOM_SCREEN_PROPERTY:
		g_value_set_boolean (value, games_screen_layout_switcher_get_view_bottom_screen (self));
		break;
		case GAMES_SCREEN_LAYOUT_SWITCHER_BLOCK_AUTOHIDE_PROPERTY:
		g_value_set_boolean (value, games_header_bar_widget_get_block_autohide ((GamesHeaderBarWidget*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_games_screen_layout_switcher_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec)
{
	GamesScreenLayoutSwitcher * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_SCREEN_LAYOUT_SWITCHER, GamesScreenLayoutSwitcher);
	switch (property_id) {
		case GAMES_SCREEN_LAYOUT_SWITCHER_SCREEN_LAYOUT_PROPERTY:
		games_screen_layout_switcher_set_screen_layout (self, g_value_get_enum (value));
		break;
		case GAMES_SCREEN_LAYOUT_SWITCHER_VIEW_BOTTOM_SCREEN_PROPERTY:
		games_screen_layout_switcher_set_view_bottom_screen (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

