/* preferences-page-platforms.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from preferences-page-platforms.vala, do not modify */

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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <handy.h>
#include <glib.h>
#include "gnome-games.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_PREFERENCES_PAGE (games_preferences_page_get_type ())
#define GAMES_PREFERENCES_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PREFERENCES_PAGE, GamesPreferencesPage))
#define GAMES_PREFERENCES_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PREFERENCES_PAGE, GamesPreferencesPageClass))
#define GAMES_IS_PREFERENCES_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PREFERENCES_PAGE))
#define GAMES_IS_PREFERENCES_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PREFERENCES_PAGE))
#define GAMES_PREFERENCES_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PREFERENCES_PAGE, GamesPreferencesPageClass))

typedef struct _GamesPreferencesPage GamesPreferencesPage;
typedef struct _GamesPreferencesPageClass GamesPreferencesPageClass;
typedef struct _GamesPreferencesPagePrivate GamesPreferencesPagePrivate;

#define GAMES_TYPE_PREFERENCES_PAGE_PLATFORMS (games_preferences_page_platforms_get_type ())
#define GAMES_PREFERENCES_PAGE_PLATFORMS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PREFERENCES_PAGE_PLATFORMS, GamesPreferencesPagePlatforms))
#define GAMES_PREFERENCES_PAGE_PLATFORMS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PREFERENCES_PAGE_PLATFORMS, GamesPreferencesPagePlatformsClass))
#define GAMES_IS_PREFERENCES_PAGE_PLATFORMS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PREFERENCES_PAGE_PLATFORMS))
#define GAMES_IS_PREFERENCES_PAGE_PLATFORMS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PREFERENCES_PAGE_PLATFORMS))
#define GAMES_PREFERENCES_PAGE_PLATFORMS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PREFERENCES_PAGE_PLATFORMS, GamesPreferencesPagePlatformsClass))

typedef struct _GamesPreferencesPagePlatforms GamesPreferencesPagePlatforms;
typedef struct _GamesPreferencesPagePlatformsClass GamesPreferencesPagePlatformsClass;
typedef struct _GamesPreferencesPagePlatformsPrivate GamesPreferencesPagePlatformsPrivate;
enum  {
	GAMES_PREFERENCES_PAGE_PLATFORMS_0_PROPERTY,
	GAMES_PREFERENCES_PAGE_PLATFORMS_NUM_PROPERTIES
};
static GParamSpec* games_preferences_page_platforms_properties[GAMES_PREFERENCES_PAGE_PLATFORMS_NUM_PROPERTIES];

#define GAMES_TYPE_PLATFORM_REGISTER (games_platform_register_get_type ())
#define GAMES_PLATFORM_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PLATFORM_REGISTER, GamesPlatformRegister))
#define GAMES_PLATFORM_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PLATFORM_REGISTER, GamesPlatformRegisterClass))
#define GAMES_IS_PLATFORM_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PLATFORM_REGISTER))
#define GAMES_IS_PLATFORM_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PLATFORM_REGISTER))
#define GAMES_PLATFORM_REGISTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PLATFORM_REGISTER, GamesPlatformRegisterClass))

typedef struct _GamesPlatformRegister GamesPlatformRegister;
typedef struct _GamesPlatformRegisterClass GamesPlatformRegisterClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GamesPreferencesPage {
	GtkBin parent_instance;
	GamesPreferencesPagePrivate * priv;
};

struct _GamesPreferencesPageClass {
	GtkBinClass parent_class;
};

struct _GamesPreferencesPagePlatforms {
	GamesPreferencesPage parent_instance;
	GamesPreferencesPagePlatformsPrivate * priv;
};

struct _GamesPreferencesPagePlatformsClass {
	GamesPreferencesPageClass parent_class;
};

struct _GamesPreferencesPagePlatformsPrivate {
	HdyPreferencesGroup* platforms_group;
};

static gint GamesPreferencesPagePlatforms_private_offset;
static gpointer games_preferences_page_platforms_parent_class = NULL;

VALA_EXTERN GType games_preferences_page_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType games_preferences_page_platforms_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GamesPreferencesPagePlatforms* games_preferences_page_platforms_new (void);
VALA_EXTERN GamesPreferencesPagePlatforms* games_preferences_page_platforms_construct (GType object_type);
VALA_EXTERN GamesPreferencesPage* games_preferences_page_new (void);
VALA_EXTERN GamesPreferencesPage* games_preferences_page_construct (GType object_type);
static GObject * games_preferences_page_platforms_constructor (GType type,
                                                        guint n_construct_properties,
                                                        GObjectConstructParam * construct_properties);
VALA_EXTERN GType games_platform_register_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GamesPlatformRegister* games_platform_register_get_register (void);
VALA_EXTERN GList* games_platform_register_get_all_platforms (GamesPlatformRegister* self);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static void games_preferences_page_platforms_finalize (GObject * obj);
static GType games_preferences_page_platforms_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
games_preferences_page_platforms_get_instance_private (GamesPreferencesPagePlatforms* self)
{
	return G_STRUCT_MEMBER_P (self, GamesPreferencesPagePlatforms_private_offset);
}

GamesPreferencesPagePlatforms*
games_preferences_page_platforms_construct (GType object_type)
{
	GamesPreferencesPagePlatforms * self = NULL;
	self = (GamesPreferencesPagePlatforms*) games_preferences_page_construct (object_type);
	return self;
}

GamesPreferencesPagePlatforms*
games_preferences_page_platforms_new (void)
{
	return games_preferences_page_platforms_construct (GAMES_TYPE_PREFERENCES_PAGE_PLATFORMS);
}

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

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

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static GObject *
games_preferences_page_platforms_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GamesPreferencesPagePlatforms * self;
	GamesPlatformRegister* _register_ = NULL;
	GamesPlatformRegister* _tmp0_;
	GList* platforms = NULL;
	GamesPlatformRegister* _tmp1_;
	GList* _tmp2_;
	GList* _tmp3_;
	parent_class = G_OBJECT_CLASS (games_preferences_page_platforms_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_PREFERENCES_PAGE_PLATFORMS, GamesPreferencesPagePlatforms);
	_tmp0_ = games_platform_register_get_register ();
	_register_ = _tmp0_;
	_tmp1_ = _register_;
	_tmp2_ = games_platform_register_get_all_platforms (_tmp1_);
	platforms = _tmp2_;
	_tmp3_ = platforms;
	{
		GList* platform_collection = NULL;
		GList* platform_it = NULL;
		platform_collection = _tmp3_;
		for (platform_it = platform_collection; platform_it != NULL; platform_it = platform_it->next) {
			GamesPlatform* _tmp4_;
			GamesPlatform* platform = NULL;
			_tmp4_ = _g_object_ref0 ((GamesPlatform*) platform_it->data);
			platform = _tmp4_;
			{
				GtkListBoxRow* row = NULL;
				GamesPlatform* _tmp5_;
				GtkListBoxRow* _tmp6_;
				GtkListBoxRow* _tmp7_;
				HdyPreferencesGroup* _tmp8_;
				GtkListBoxRow* _tmp9_;
				_tmp5_ = platform;
				_tmp6_ = games_platform_get_row (_tmp5_);
				row = _tmp6_;
				_tmp7_ = row;
				gtk_widget_show ((GtkWidget*) _tmp7_);
				_tmp8_ = self->priv->platforms_group;
				_tmp9_ = row;
				gtk_container_add ((GtkContainer*) _tmp8_, (GtkWidget*) _tmp9_);
				_g_object_unref0 (row);
				_g_object_unref0 (platform);
			}
		}
	}
	(platforms == NULL) ? NULL : (platforms = (_g_list_free__g_object_unref0_ (platforms), NULL));
	_g_object_unref0 (_register_);
	return obj;
}

static void
games_preferences_page_platforms_class_init (GamesPreferencesPagePlatformsClass * klass,
                                             gpointer klass_data)
{
	games_preferences_page_platforms_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesPreferencesPagePlatforms_private_offset);
	G_OBJECT_CLASS (klass)->constructor = games_preferences_page_platforms_constructor;
	G_OBJECT_CLASS (klass)->finalize = games_preferences_page_platforms_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Games/preferences/preferences-page-platforms.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "platforms_group", FALSE, GamesPreferencesPagePlatforms_private_offset + G_STRUCT_OFFSET (GamesPreferencesPagePlatformsPrivate, platforms_group));
}

static void
games_preferences_page_platforms_instance_init (GamesPreferencesPagePlatforms * self,
                                                gpointer klass)
{
	self->priv = games_preferences_page_platforms_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
games_preferences_page_platforms_finalize (GObject * obj)
{
	GamesPreferencesPagePlatforms * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_PREFERENCES_PAGE_PLATFORMS, GamesPreferencesPagePlatforms);
	G_OBJECT_CLASS (games_preferences_page_platforms_parent_class)->finalize (obj);
}

static GType
games_preferences_page_platforms_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesPreferencesPagePlatformsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_preferences_page_platforms_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesPreferencesPagePlatforms), 0, (GInstanceInitFunc) games_preferences_page_platforms_instance_init, NULL };
	GType games_preferences_page_platforms_type_id;
	games_preferences_page_platforms_type_id = g_type_register_static (GAMES_TYPE_PREFERENCES_PAGE, "GamesPreferencesPagePlatforms", &g_define_type_info, 0);
	GamesPreferencesPagePlatforms_private_offset = g_type_add_instance_private (games_preferences_page_platforms_type_id, sizeof (GamesPreferencesPagePlatformsPrivate));
	return games_preferences_page_platforms_type_id;
}

GType
games_preferences_page_platforms_get_type (void)
{
	static volatile gsize games_preferences_page_platforms_type_id__once = 0;
	if (g_once_init_enter (&games_preferences_page_platforms_type_id__once)) {
		GType games_preferences_page_platforms_type_id;
		games_preferences_page_platforms_type_id = games_preferences_page_platforms_get_type_once ();
		g_once_init_leave (&games_preferences_page_platforms_type_id__once, games_preferences_page_platforms_type_id);
	}
	return games_preferences_page_platforms_type_id__once;
}

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;
}

