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

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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "gnome-games.h"
#include <libmanette.h>
#include <float.h>
#include <math.h>
#include <gio/gio.h>
#include <cairo-gobject.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_COLLECTIONS_MAIN_PAGE (games_collections_main_page_get_type ())
#define GAMES_COLLECTIONS_MAIN_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_COLLECTIONS_MAIN_PAGE, GamesCollectionsMainPage))
#define GAMES_COLLECTIONS_MAIN_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_COLLECTIONS_MAIN_PAGE, GamesCollectionsMainPageClass))
#define GAMES_IS_COLLECTIONS_MAIN_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_COLLECTIONS_MAIN_PAGE))
#define GAMES_IS_COLLECTIONS_MAIN_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_COLLECTIONS_MAIN_PAGE))
#define GAMES_COLLECTIONS_MAIN_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_COLLECTIONS_MAIN_PAGE, GamesCollectionsMainPageClass))

typedef struct _GamesCollectionsMainPage GamesCollectionsMainPage;
typedef struct _GamesCollectionsMainPageClass GamesCollectionsMainPageClass;
typedef struct _GamesCollectionsMainPagePrivate GamesCollectionsMainPagePrivate;

#define GAMES_TYPE_GAMEPAD_BROWSE (games_gamepad_browse_get_type ())
#define GAMES_GAMEPAD_BROWSE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_GAMEPAD_BROWSE, GamesGamepadBrowse))
#define GAMES_GAMEPAD_BROWSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_GAMEPAD_BROWSE, GamesGamepadBrowseClass))
#define GAMES_IS_GAMEPAD_BROWSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_GAMEPAD_BROWSE))
#define GAMES_IS_GAMEPAD_BROWSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_GAMEPAD_BROWSE))
#define GAMES_GAMEPAD_BROWSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_GAMEPAD_BROWSE, GamesGamepadBrowseClass))

typedef struct _GamesGamepadBrowse GamesGamepadBrowse;
typedef struct _GamesGamepadBrowseClass GamesGamepadBrowseClass;

#define GAMES_TYPE_COLLECTION_ICON_VIEW (games_collection_icon_view_get_type ())
#define GAMES_COLLECTION_ICON_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_COLLECTION_ICON_VIEW, GamesCollectionIconView))
#define GAMES_COLLECTION_ICON_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_COLLECTION_ICON_VIEW, GamesCollectionIconViewClass))
#define GAMES_IS_COLLECTION_ICON_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_COLLECTION_ICON_VIEW))
#define GAMES_IS_COLLECTION_ICON_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_COLLECTION_ICON_VIEW))
#define GAMES_COLLECTION_ICON_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_COLLECTION_ICON_VIEW, GamesCollectionIconViewClass))

typedef struct _GamesCollectionIconView GamesCollectionIconView;
typedef struct _GamesCollectionIconViewClass GamesCollectionIconViewClass;

#define GAMES_TYPE_COLLECTION_MODEL (games_collection_model_get_type ())
#define GAMES_COLLECTION_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_COLLECTION_MODEL, GamesCollectionModel))
#define GAMES_COLLECTION_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_COLLECTION_MODEL, GamesCollectionModelClass))
#define GAMES_IS_COLLECTION_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_COLLECTION_MODEL))
#define GAMES_IS_COLLECTION_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_COLLECTION_MODEL))
#define GAMES_COLLECTION_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_COLLECTION_MODEL, GamesCollectionModelClass))

typedef struct _GamesCollectionModel GamesCollectionModel;
typedef struct _GamesCollectionModelClass GamesCollectionModelClass;
enum  {
	GAMES_COLLECTIONS_MAIN_PAGE_0_PROPERTY,
	GAMES_COLLECTIONS_MAIN_PAGE_IS_ACTIVE_PROPERTY,
	GAMES_COLLECTIONS_MAIN_PAGE_COLLECTION_MODEL_PROPERTY,
	GAMES_COLLECTIONS_MAIN_PAGE_IS_SELECTION_MODE_PROPERTY,
	GAMES_COLLECTIONS_MAIN_PAGE_IS_SEARCH_MODE_PROPERTY,
	GAMES_COLLECTIONS_MAIN_PAGE_IS_SEARCH_EMPTY_PROPERTY,
	GAMES_COLLECTIONS_MAIN_PAGE_NUM_PROPERTIES
};
static GParamSpec* games_collections_main_page_properties[GAMES_COLLECTIONS_MAIN_PAGE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _Block26Data Block26Data;

#define GAMES_TYPE_COLLECTION (games_collection_get_type ())
#define GAMES_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_COLLECTION, GamesCollection))
#define GAMES_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_COLLECTION))
#define GAMES_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_COLLECTION, GamesCollectionIface))

typedef struct _GamesCollection GamesCollection;
typedef struct _GamesCollectionIface GamesCollectionIface;

#define GAMES_TYPE_GAME_MODEL (games_game_model_get_type ())
#define GAMES_GAME_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_GAME_MODEL, GamesGameModel))
#define GAMES_GAME_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_GAME_MODEL, GamesGameModelClass))
#define GAMES_IS_GAME_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_GAME_MODEL))
#define GAMES_IS_GAME_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_GAME_MODEL))
#define GAMES_GAME_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_GAME_MODEL, GamesGameModelClass))

typedef struct _GamesGameModel GamesGameModel;
typedef struct _GamesGameModelClass GamesGameModelClass;
typedef enum  {
	GAMES_COLLECTION_TYPE_AUTO,
	GAMES_COLLECTION_TYPE_USER,
	GAMES_COLLECTION_TYPE_PLACEHOLDER
} GamesCollectionType;

#define GAMES_TYPE_COLLECTION_TYPE (games_collection_type_get_type ())

#define GAMES_TYPE_USER_COLLECTION (games_user_collection_get_type ())
#define GAMES_USER_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_USER_COLLECTION, GamesUserCollection))
#define GAMES_USER_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_USER_COLLECTION, GamesUserCollectionClass))
#define GAMES_IS_USER_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_USER_COLLECTION))
#define GAMES_IS_USER_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_USER_COLLECTION))
#define GAMES_USER_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_USER_COLLECTION, GamesUserCollectionClass))

typedef struct _GamesUserCollection GamesUserCollection;
typedef struct _GamesUserCollectionClass GamesUserCollectionClass;
enum  {
	GAMES_COLLECTIONS_MAIN_PAGE_COLLECTION_ACTIVATED_SIGNAL,
	GAMES_COLLECTIONS_MAIN_PAGE_SELECTED_ITEMS_CHANGED_SIGNAL,
	GAMES_COLLECTIONS_MAIN_PAGE_GAMEPAD_ACCEPTED_SIGNAL,
	GAMES_COLLECTIONS_MAIN_PAGE_NUM_SIGNALS
};
static guint games_collections_main_page_signals[GAMES_COLLECTIONS_MAIN_PAGE_NUM_SIGNALS] = {0};
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _GamesCollectionsMainPage {
	GtkBin parent_instance;
	GamesCollectionsMainPagePrivate * priv;
};

struct _GamesCollectionsMainPageClass {
	GtkBinClass parent_class;
};

struct _GamesCollectionsMainPagePrivate {
	GtkFlowBox* flow_box;
	GamesGamepadBrowse* gamepad_browse;
	GtkScrolledWindow* scrolled_window;
	gchar** filtering_terms;
	gint filtering_terms_length1;
	gint _filtering_terms_size_;
	GBinding* window_active_binding;
	GHashTable* selected_collections;
	gboolean _is_active;
	GamesCollectionModel* _collection_model;
	gboolean _is_selection_mode;
	gboolean _is_search_mode;
	gboolean _is_search_empty;
};

struct _Block26Data {
	int _ref_count_;
	GamesCollectionsMainPage* self;
	GamesCollectionIconView* collection_icon_view;
};

struct _GamesCollectionIface {
	GTypeInterface parent_iface;
	void (*load) (GamesCollection* self);
	gchar* (*get_id) (GamesCollection* self);
	gboolean (*get_hide_stars) (GamesCollection* self);
	GamesGameModel* (*get_game_model) (GamesCollection* self);
	GamesCollectionType (*get_collection_type) (GamesCollection* self);
	void (*add_games) (GamesCollection* self, GamesGame** games, gint games_length1);
	void (*remove_games) (GamesCollection* self, GamesGame** games, gint games_length1);
	void (*on_game_added) (GamesCollection* self, GamesGame* game);
	void (*on_game_removed) (GamesCollection* self, GamesGame* game);
	void (*on_game_replaced) (GamesCollection* self, GamesGame* game, GamesGame* prev_game);
	gboolean (*get_is_empty) (GamesCollection* self);
	const gchar* (*get_title) (GamesCollection* self);
};

static gint GamesCollectionsMainPage_private_offset;
static gpointer games_collections_main_page_parent_class = NULL;

VALA_EXTERN GType games_collections_main_page_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType games_gamepad_browse_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType games_collection_icon_view_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType games_collection_model_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gboolean games_collections_main_page_has_collection_selected (GamesCollectionsMainPage* self);
VALA_EXTERN gboolean games_collections_main_page_select_default_collection (GamesCollectionsMainPage* self,
                                                                GtkDirectionType direction);
static GtkWidget* games_collections_main_page_add_collection (GamesCollectionsMainPage* self,
                                                       GObject* item);
static Block26Data* block26_data_ref (Block26Data* _data26_);
static void block26_data_unref (void * _userdata_);
VALA_EXTERN GType games_game_model_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType games_collection_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType games_collection_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GamesCollectionIconView* games_collection_icon_view_new (GamesCollection* collection);
VALA_EXTERN GamesCollectionIconView* games_collection_icon_view_construct (GType object_type,
                                                               GamesCollection* collection);
VALA_EXTERN GType games_user_collection_get_type (void) G_GNUC_CONST ;
static void ___lambda24_ (Block26Data* _data26_);
VALA_EXTERN GamesCollection* games_collection_icon_view_get_collection (GamesCollectionIconView* self);
VALA_EXTERN gboolean games_collection_icon_view_get_checked (GamesCollectionIconView* self);
static void ____lambda24__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
VALA_EXTERN void games_collections_main_page_select_none (GamesCollectionsMainPage* self);
VALA_EXTERN void games_collection_icon_view_set_checked (GamesCollectionIconView* self,
                                             gboolean value);
VALA_EXTERN void games_collections_main_page_select_all (GamesCollectionsMainPage* self);
VALA_EXTERN gboolean games_collections_main_page_get_is_search_mode (GamesCollectionsMainPage* self);
static gboolean games_collections_main_page_filter_collection (GamesCollectionsMainPage* self,
                                                        GamesCollection* collection);
VALA_EXTERN GamesUserCollection** games_collections_main_page_get_selected_collections (GamesCollectionsMainPage* self,
                                                                            gint* result_length1);
static void _vala_array_add39 (GamesUserCollection** * array,
                        gint* length,
                        gint* size,
                        GamesUserCollection* value);
VALA_EXTERN gboolean games_collections_main_page_gamepad_button_press_event (GamesCollectionsMainPage* self,
                                                                 ManetteEvent* event);
VALA_EXTERN gboolean games_gamepad_browse_gamepad_button_press_event (GamesGamepadBrowse* self,
                                                          ManetteEvent* event);
VALA_EXTERN gboolean games_collections_main_page_gamepad_button_release_event (GamesCollectionsMainPage* self,
                                                                   ManetteEvent* event);
VALA_EXTERN gboolean games_gamepad_browse_gamepad_button_release_event (GamesGamepadBrowse* self,
                                                            ManetteEvent* event);
VALA_EXTERN gboolean games_collections_main_page_gamepad_absolute_axis_event (GamesCollectionsMainPage* self,
                                                                  ManetteEvent* event);
VALA_EXTERN gboolean games_gamepad_browse_gamepad_absolute_axis_event (GamesGamepadBrowse* self,
                                                           ManetteEvent* event);
VALA_EXTERN void games_collections_main_page_reset_scroll_position (GamesCollectionsMainPage* self);
VALA_EXTERN void games_collections_main_page_invalidate_filter (GamesCollectionsMainPage* self);
VALA_EXTERN void games_collections_main_page_invalidate_sort (GamesCollectionsMainPage* self);
VALA_EXTERN GamesCollectionModel* games_collections_main_page_get_collection_model (GamesCollectionsMainPage* self);
VALA_EXTERN void games_collection_model_invalidate_sort (GamesCollectionModel* self);
VALA_EXTERN void games_collections_main_page_set_filter (GamesCollectionsMainPage* self,
                                             gchar** filtering_terms,
                                             gint filtering_terms_length1);
static gchar** _vala_array_dup19 (gchar** self,
                           gssize length);
static void games_collections_main_page_update_search_empty (GamesCollectionsMainPage* self);
VALA_EXTERN void games_collections_main_page_set_is_search_empty (GamesCollectionsMainPage* self,
                                                      gboolean value);
VALA_EXTERN GamesCollectionType games_collection_get_collection_type (GamesCollection* self);
VALA_EXTERN gboolean games_collection_get_is_empty (GamesCollection* self);
VALA_EXTERN gboolean games_collection_matches_search_terms (GamesCollection* self,
                                                gchar** search_terms,
                                                gint search_terms_length1);
static gboolean games_collections_main_page_collection_filter_func (GamesCollectionsMainPage* self,
                                                             GtkFlowBoxChild* child);
static void games_collections_main_page_on_search_mode_changed (GamesCollectionsMainPage* self);
static void _games_collections_main_page_on_search_mode_changed_g_object_notify (GObject* _sender,
                                                                          GParamSpec* pspec,
                                                                          gpointer self);
VALA_EXTERN void games_collections_main_page_on_map (GamesCollectionsMainPage* self);
VALA_EXTERN void games_collections_main_page_set_is_active (GamesCollectionsMainPage* self,
                                                gboolean value);
static void _games_collections_main_page_on_map_gtk_widget_map (GtkWidget* _sender,
                                                         gpointer self);
VALA_EXTERN void games_collections_main_page_on_unmap (GamesCollectionsMainPage* self);
static void _games_collections_main_page_on_unmap_gtk_widget_unmap (GtkWidget* _sender,
                                                             gpointer self);
static gboolean games_collections_main_page_on_gamepad_browse (GamesCollectionsMainPage* self,
                                                        GtkDirectionType direction);
static gboolean _games_collections_main_page_on_gamepad_browse_games_gamepad_browse_browse (GamesGamepadBrowse* _sender,
                                                                                     GtkDirectionType direction,
                                                                                     gpointer self);
static gboolean games_collections_main_page_on_gamepad_accept (GamesCollectionsMainPage* self);
static gboolean _games_collections_main_page_on_gamepad_accept_games_gamepad_browse_accept (GamesGamepadBrowse* _sender,
                                                                                     gpointer self);
static void games_collections_main_page_on_child_activated (GamesCollectionsMainPage* self,
                                                     GtkFlowBoxChild* child);
VALA_EXTERN gboolean games_collections_main_page_get_is_selection_mode (GamesCollectionsMainPage* self);
static void _games_collections_main_page_on_child_activated_gtk_flow_box_child_activated (GtkFlowBox* _sender,
                                                                                   GtkFlowBoxChild* child,
                                                                                   gpointer self);
static void games_collections_main_page_on_size_allocate (GamesCollectionsMainPage* self,
                                                   GtkAllocation* allocation);
static void _games_collections_main_page_on_size_allocate_gtk_widget_size_allocate (GtkWidget* _sender,
                                                                             GtkAllocation* allocation,
                                                                             gpointer self);
VALA_EXTERN GamesCollectionsMainPage* games_collections_main_page_new (void);
VALA_EXTERN GamesCollectionsMainPage* games_collections_main_page_construct (GType object_type);
VALA_EXTERN gboolean games_collections_main_page_get_is_active (GamesCollectionsMainPage* self);
VALA_EXTERN void games_gamepad_browse_cancel_cursor_movement (GamesGamepadBrowse* self);
VALA_EXTERN void games_collections_main_page_set_collection_model (GamesCollectionsMainPage* self,
                                                       GamesCollectionModel* value);
static GtkWidget* _games_collections_main_page_add_collection_gtk_flow_box_create_widget_func (gpointer item,
                                                                                        gpointer self);
static gboolean _games_collections_main_page_collection_filter_func_gtk_flow_box_filter_func (GtkFlowBoxChild* child,
                                                                                       gpointer self);
VALA_EXTERN void games_collections_main_page_set_is_selection_mode (GamesCollectionsMainPage* self,
                                                        gboolean value);
VALA_EXTERN void games_collections_main_page_set_is_search_mode (GamesCollectionsMainPage* self,
                                                     gboolean value);
VALA_EXTERN gboolean games_collections_main_page_get_is_search_empty (GamesCollectionsMainPage* self);
static GObject * games_collections_main_page_constructor (GType type,
                                                   guint n_construct_properties,
                                                   GObjectConstructParam * construct_properties);
VALA_EXTERN guint games_collection_icon_view_hash (GamesCollectionIconView* key);
static guint _games_collection_icon_view_hash_ghash_func (gconstpointer key);
VALA_EXTERN gboolean games_collection_icon_view_equal (GamesCollectionIconView* a,
                                           GamesCollectionIconView* b);
static gboolean _games_collection_icon_view_equal_gequal_func (gconstpointer a,
                                                        gconstpointer b);
static void _g_object_unref0_ (gpointer var);
static void games_collections_main_page_finalize (GObject * obj);
static GType games_collections_main_page_get_type_once (void);
static void _vala_games_collections_main_page_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec);
static void _vala_games_collections_main_page_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
games_collections_main_page_get_instance_private (GamesCollectionsMainPage* self)
{
	return G_STRUCT_MEMBER_P (self, GamesCollectionsMainPage_private_offset);
}

gboolean
games_collections_main_page_has_collection_selected (GamesCollectionsMainPage* self)
{
	GtkFlowBox* _tmp0_;
	GList* _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->flow_box;
	_tmp1_ = gtk_flow_box_get_selected_children (_tmp0_);
	{
		GList* child_collection = NULL;
		GList* child_it = NULL;
		child_collection = _tmp1_;
		for (child_it = child_collection; child_it != NULL; child_it = child_it->next) {
			GtkFlowBoxChild* child = NULL;
			child = (GtkFlowBoxChild*) child_it->data;
			{
				GtkFlowBoxChild* _tmp2_;
				_tmp2_ = child;
				if (gtk_widget_get_mapped ((GtkWidget*) _tmp2_)) {
					result = TRUE;
					(child_collection == NULL) ? NULL : (child_collection = (g_list_free (child_collection), NULL));
					return result;
				}
			}
		}
		(child_collection == NULL) ? NULL : (child_collection = (g_list_free (child_collection), NULL));
	}
	result = FALSE;
	return result;
}

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

gboolean
games_collections_main_page_select_default_collection (GamesCollectionsMainPage* self,
                                                       GtkDirectionType direction)
{
	GtkFlowBoxChild* child = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GtkFlowBox* _tmp2_;
				GtkFlowBoxChild* _tmp3_;
				GtkFlowBoxChild* _tmp4_;
				GtkFlowBoxChild* _tmp5_;
				GtkFlowBoxChild* _tmp6_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->flow_box;
				_tmp3_ = gtk_flow_box_get_child_at_index (_tmp2_, i);
				_tmp4_ = _g_object_ref0 (_tmp3_);
				_g_object_unref0 (child);
				child = _tmp4_;
				_tmp5_ = child;
				if (!(_tmp5_ != NULL)) {
					break;
				}
				_tmp6_ = child;
				if (gtk_widget_get_mapped ((GtkWidget*) _tmp6_)) {
					GtkFlowBox* _tmp7_;
					GtkFlowBoxChild* _tmp8_;
					GtkFlowBoxChild* _tmp9_;
					gboolean _tmp10_ = FALSE;
					_tmp7_ = self->priv->flow_box;
					_tmp8_ = child;
					gtk_flow_box_select_child (_tmp7_, _tmp8_);
					_tmp9_ = child;
					g_signal_emit_by_name ((GtkWidget*) _tmp9_, "focus", direction, &_tmp10_);
					result = TRUE;
					_g_object_unref0 (child);
					return result;
				}
			}
		}
	}
	result = FALSE;
	_g_object_unref0 (child);
	return result;
}

static Block26Data*
block26_data_ref (Block26Data* _data26_)
{
	g_atomic_int_inc (&_data26_->_ref_count_);
	return _data26_;
}

static void
block26_data_unref (void * _userdata_)
{
	Block26Data* _data26_;
	_data26_ = (Block26Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data26_->_ref_count_)) {
		GamesCollectionsMainPage* self;
		self = _data26_->self;
		_g_object_unref0 (_data26_->collection_icon_view);
		_g_object_unref0 (self);
		g_slice_free (Block26Data, _data26_);
	}
}

static void
___lambda24_ (Block26Data* _data26_)
{
	GamesCollectionsMainPage* self;
	GamesCollectionIconView* _tmp0_;
	GamesCollection* _tmp1_;
	GamesCollection* _tmp2_;
	GamesCollectionIconView* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	self = _data26_->self;
	_tmp0_ = _data26_->collection_icon_view;
	_tmp1_ = games_collection_icon_view_get_collection (_tmp0_);
	_tmp2_ = _tmp1_;
	_vala_assert (GAMES_IS_USER_COLLECTION (_tmp2_), "collection_icon_view.collection is UserCollection");
	_tmp3_ = _data26_->collection_icon_view;
	_tmp4_ = games_collection_icon_view_get_checked (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_) {
		GHashTable* _tmp6_;
		GamesCollectionIconView* _tmp7_;
		GamesCollectionIconView* _tmp8_;
		_tmp6_ = self->priv->selected_collections;
		_tmp7_ = _data26_->collection_icon_view;
		_tmp8_ = _g_object_ref0 (_tmp7_);
		g_hash_table_add (_tmp6_, _tmp8_);
	} else {
		GHashTable* _tmp9_;
		GamesCollectionIconView* _tmp10_;
		_tmp9_ = self->priv->selected_collections;
		_tmp10_ = _data26_->collection_icon_view;
		g_hash_table_remove (_tmp9_, _tmp10_);
	}
	g_signal_emit (self, games_collections_main_page_signals[GAMES_COLLECTIONS_MAIN_PAGE_SELECTED_ITEMS_CHANGED_SIGNAL], 0);
}

static void
____lambda24__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	___lambda24_ (self);
}

static GtkWidget*
games_collections_main_page_add_collection (GamesCollectionsMainPage* self,
                                            GObject* item)
{
	Block26Data* _data26_;
	GamesCollectionIconView* _tmp0_;
	GamesCollectionIconView* _tmp4_;
	GtkWidget* _tmp5_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_data26_ = g_slice_new0 (Block26Data);
	_data26_->_ref_count_ = 1;
	_data26_->self = g_object_ref (self);
	_tmp0_ = games_collection_icon_view_new (GAMES_IS_COLLECTION (item) ? ((GamesCollection*) item) : NULL);
	g_object_ref_sink (_tmp0_);
	_data26_->collection_icon_view = _tmp0_;
	if (GAMES_IS_USER_COLLECTION (item)) {
		GamesCollectionIconView* _tmp1_;
		GamesCollectionIconView* _tmp2_;
		_tmp1_ = _data26_->collection_icon_view;
		g_object_bind_property_with_closures ((GObject*) self, "is-selection-mode", (GObject*) _tmp1_, "is-selection-mode", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp2_ = _data26_->collection_icon_view;
		g_signal_connect_data ((GObject*) _tmp2_, "notify::checked", (GCallback) ____lambda24__g_object_notify, block26_data_ref (_data26_), (GClosureNotify) block26_data_unref, 0);
	} else {
		GamesCollectionIconView* _tmp3_;
		_tmp3_ = _data26_->collection_icon_view;
		g_object_bind_property_with_closures ((GObject*) self, "is-selection-mode", (GObject*) _tmp3_, "sensitive", G_BINDING_INVERT_BOOLEAN, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	}
	_tmp4_ = _data26_->collection_icon_view;
	_tmp5_ = _g_object_ref0 ((GtkWidget*) _tmp4_);
	result = _tmp5_;
	block26_data_unref (_data26_);
	_data26_ = NULL;
	return result;
}

void
games_collections_main_page_select_none (GamesCollectionsMainPage* self)
{
	GHashTable* _tmp0_;
	GList* _tmp1_;
	GHashTable* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->selected_collections;
	_tmp1_ = g_hash_table_get_values (_tmp0_);
	{
		GList* icon_view_collection = NULL;
		GList* icon_view_it = NULL;
		icon_view_collection = _tmp1_;
		for (icon_view_it = icon_view_collection; icon_view_it != NULL; icon_view_it = icon_view_it->next) {
			GamesCollectionIconView* icon_view = NULL;
			icon_view = (GamesCollectionIconView*) icon_view_it->data;
			{
				GamesCollectionIconView* _tmp2_;
				_tmp2_ = icon_view;
				games_collection_icon_view_set_checked (_tmp2_, FALSE);
			}
		}
		(icon_view_collection == NULL) ? NULL : (icon_view_collection = (g_list_free (icon_view_collection), NULL));
	}
	_tmp3_ = self->priv->selected_collections;
	g_hash_table_remove_all (_tmp3_);
	g_signal_emit (self, games_collections_main_page_signals[GAMES_COLLECTIONS_MAIN_PAGE_SELECTED_ITEMS_CHANGED_SIGNAL], 0);
}

void
games_collections_main_page_select_all (GamesCollectionsMainPage* self)
{
	GtkFlowBox* _tmp0_;
	GList* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->flow_box;
	_tmp1_ = gtk_container_get_children ((GtkContainer*) _tmp0_);
	{
		GList* child_collection = NULL;
		GList* child_it = NULL;
		child_collection = _tmp1_;
		for (child_it = child_collection; child_it != NULL; child_it = child_it->next) {
			GtkWidget* child = NULL;
			child = (GtkWidget*) child_it->data;
			{
				GamesCollectionIconView* collection_icon_view = NULL;
				GtkWidget* _tmp2_;
				GamesCollectionIconView* _tmp3_;
				gboolean _tmp4_;
				_tmp2_ = child;
				_tmp3_ = _g_object_ref0 (GAMES_IS_COLLECTION_ICON_VIEW (_tmp2_) ? ((GamesCollectionIconView*) _tmp2_) : NULL);
				collection_icon_view = _tmp3_;
				_tmp4_ = self->priv->_is_search_mode;
				if (_tmp4_) {
					gboolean _tmp5_ = FALSE;
					gchar** _tmp6_;
					gint _tmp6__length1;
					GamesCollectionIconView* _tmp10_;
					_tmp6_ = self->priv->filtering_terms;
					_tmp6__length1 = self->priv->filtering_terms_length1;
					if (_tmp6_ == NULL) {
						_tmp5_ = TRUE;
					} else {
						GamesCollectionIconView* _tmp7_;
						GamesCollection* _tmp8_;
						GamesCollection* _tmp9_;
						_tmp7_ = collection_icon_view;
						_tmp8_ = games_collection_icon_view_get_collection (_tmp7_);
						_tmp9_ = _tmp8_;
						_tmp5_ = games_collections_main_page_filter_collection (self, _tmp9_);
					}
					_tmp10_ = collection_icon_view;
					games_collection_icon_view_set_checked (_tmp10_, _tmp5_);
				} else {
					GamesCollectionIconView* _tmp11_;
					GamesCollectionIconView* _tmp12_;
					GamesCollection* _tmp13_;
					GamesCollection* _tmp14_;
					_tmp11_ = collection_icon_view;
					_tmp12_ = collection_icon_view;
					_tmp13_ = games_collection_icon_view_get_collection (_tmp12_);
					_tmp14_ = _tmp13_;
					games_collection_icon_view_set_checked (_tmp11_, GAMES_IS_USER_COLLECTION (_tmp14_));
				}
				_g_object_unref0 (collection_icon_view);
			}
		}
		(child_collection == NULL) ? NULL : (child_collection = (g_list_free (child_collection), NULL));
	}
	g_signal_emit (self, games_collections_main_page_signals[GAMES_COLLECTIONS_MAIN_PAGE_SELECTED_ITEMS_CHANGED_SIGNAL], 0);
}

static void
_vala_array_add39 (GamesUserCollection** * array,
                   gint* length,
                   gint* size,
                   GamesUserCollection* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GamesUserCollection*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

GamesUserCollection**
games_collections_main_page_get_selected_collections (GamesCollectionsMainPage* self,
                                                      gint* result_length1)
{
	GamesUserCollection** collections = NULL;
	GamesUserCollection** _tmp0_;
	gint collections_length1;
	gint _collections_size_;
	GHashTable* _tmp1_;
	GList* _tmp2_;
	GamesUserCollection** _tmp7_;
	gint _tmp7__length1;
	GamesUserCollection** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_new0 (GamesUserCollection*, 0 + 1);
	collections = _tmp0_;
	collections_length1 = 0;
	_collections_size_ = collections_length1;
	_tmp1_ = self->priv->selected_collections;
	_tmp2_ = g_hash_table_get_values (_tmp1_);
	{
		GList* collection_icon_view_collection = NULL;
		GList* collection_icon_view_it = NULL;
		collection_icon_view_collection = _tmp2_;
		for (collection_icon_view_it = collection_icon_view_collection; collection_icon_view_it != NULL; collection_icon_view_it = collection_icon_view_it->next) {
			GamesCollectionIconView* collection_icon_view = NULL;
			collection_icon_view = (GamesCollectionIconView*) collection_icon_view_it->data;
			{
				GamesCollectionIconView* _tmp3_;
				GamesCollection* _tmp4_;
				GamesCollection* _tmp5_;
				GamesUserCollection* _tmp6_;
				_tmp3_ = collection_icon_view;
				_tmp4_ = games_collection_icon_view_get_collection (_tmp3_);
				_tmp5_ = _tmp4_;
				_tmp6_ = _g_object_ref0 (GAMES_IS_USER_COLLECTION (_tmp5_) ? ((GamesUserCollection*) _tmp5_) : NULL);
				_vala_array_add39 (&collections, &collections_length1, &_collections_size_, _tmp6_);
			}
		}
		(collection_icon_view_collection == NULL) ? NULL : (collection_icon_view_collection = (g_list_free (collection_icon_view_collection), NULL));
	}
	_tmp7_ = collections;
	_tmp7__length1 = collections_length1;
	if (result_length1) {
		*result_length1 = _tmp7__length1;
	}
	result = _tmp7_;
	return result;
}

gboolean
games_collections_main_page_gamepad_button_press_event (GamesCollectionsMainPage* self,
                                                        ManetteEvent* event)
{
	GamesGamepadBrowse* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	if (!gtk_widget_get_mapped ((GtkWidget*) self)) {
		result = FALSE;
		return result;
	}
	_tmp0_ = self->priv->gamepad_browse;
	result = games_gamepad_browse_gamepad_button_press_event (_tmp0_, event);
	return result;
}

gboolean
games_collections_main_page_gamepad_button_release_event (GamesCollectionsMainPage* self,
                                                          ManetteEvent* event)
{
	GamesGamepadBrowse* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	if (!gtk_widget_get_mapped ((GtkWidget*) self)) {
		result = FALSE;
		return result;
	}
	_tmp0_ = self->priv->gamepad_browse;
	result = games_gamepad_browse_gamepad_button_release_event (_tmp0_, event);
	return result;
}

gboolean
games_collections_main_page_gamepad_absolute_axis_event (GamesCollectionsMainPage* self,
                                                         ManetteEvent* event)
{
	GamesGamepadBrowse* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	if (!gtk_widget_get_mapped ((GtkWidget*) self)) {
		result = FALSE;
		return result;
	}
	_tmp0_ = self->priv->gamepad_browse;
	result = games_gamepad_browse_gamepad_absolute_axis_event (_tmp0_, event);
	return result;
}

void
games_collections_main_page_reset_scroll_position (GamesCollectionsMainPage* self)
{
	GtkAdjustment* adjustment = NULL;
	GtkScrolledWindow* _tmp0_;
	GtkAdjustment* _tmp1_;
	GtkAdjustment* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->scrolled_window;
	_tmp1_ = gtk_scrolled_window_get_vadjustment (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	adjustment = _tmp2_;
	gtk_adjustment_set_value (adjustment, (gdouble) 0);
	_g_object_unref0 (adjustment);
}

void
games_collections_main_page_invalidate_filter (GamesCollectionsMainPage* self)
{
	GtkFlowBox* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->flow_box;
	gtk_flow_box_invalidate_filter (_tmp0_);
}

void
games_collections_main_page_invalidate_sort (GamesCollectionsMainPage* self)
{
	GamesCollectionModel* _tmp0_;
	GamesCollectionModel* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = games_collections_main_page_get_collection_model (self);
	_tmp1_ = _tmp0_;
	games_collection_model_invalidate_sort (_tmp1_);
}

static gchar**
_vala_array_dup19 (gchar** self,
                   gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

void
games_collections_main_page_set_filter (GamesCollectionsMainPage* self,
                                        gchar** filtering_terms,
                                        gint filtering_terms_length1)
{
	gchar** _tmp0_;
	gint _tmp0__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = (filtering_terms != NULL) ? _vala_array_dup19 (filtering_terms, filtering_terms_length1) : filtering_terms;
	_tmp0__length1 = filtering_terms_length1;
	self->priv->filtering_terms = (_vala_array_free (self->priv->filtering_terms, self->priv->filtering_terms_length1, (GDestroyNotify) g_free), NULL);
	self->priv->filtering_terms = _tmp0_;
	self->priv->filtering_terms_length1 = _tmp0__length1;
	self->priv->_filtering_terms_size_ = self->priv->filtering_terms_length1;
	games_collections_main_page_invalidate_filter (self);
	games_collections_main_page_update_search_empty (self);
}

static void
games_collections_main_page_update_search_empty (GamesCollectionsMainPage* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_is_search_mode;
	if (!_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		gchar** _tmp2_;
		gint _tmp2__length1;
		_tmp2_ = self->priv->filtering_terms;
		_tmp2__length1 = self->priv->filtering_terms_length1;
		_tmp0_ = _tmp2_ == NULL;
	}
	if (_tmp0_) {
		games_collections_main_page_set_is_search_empty (self, FALSE);
		return;
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				GamesCollectionModel* _tmp5_;
				GamesCollectionModel* _tmp6_;
				GamesCollection* collection = NULL;
				GamesCollectionModel* _tmp7_;
				GamesCollectionModel* _tmp8_;
				GObject* _tmp9_;
				GamesCollection* _tmp10_;
				GamesCollectionType type = 0;
				GamesCollection* _tmp11_;
				gboolean _tmp12_ = FALSE;
				GamesCollection* _tmp17_;
				gchar** _tmp18_;
				gint _tmp18__length1;
				if (!_tmp3_) {
					gint _tmp4_;
					_tmp4_ = i;
					i = _tmp4_ + 1;
				}
				_tmp3_ = FALSE;
				_tmp5_ = games_collections_main_page_get_collection_model (self);
				_tmp6_ = _tmp5_;
				if (!(((guint) i) < g_list_model_get_n_items ((GListModel*) _tmp6_))) {
					break;
				}
				_tmp7_ = games_collections_main_page_get_collection_model (self);
				_tmp8_ = _tmp7_;
				_tmp9_ = g_list_model_get_item ((GListModel*) _tmp8_, (guint) i);
				_tmp10_ = GAMES_IS_COLLECTION (_tmp9_) ? ((GamesCollection*) _tmp9_) : NULL;
				if (_tmp10_ == NULL) {
					_g_object_unref0 (_tmp9_);
				}
				collection = _tmp10_;
				_tmp11_ = collection;
				type = games_collection_get_collection_type (_tmp11_);
				if (type == GAMES_COLLECTION_TYPE_PLACEHOLDER) {
					_tmp12_ = TRUE;
				} else {
					gboolean _tmp13_ = FALSE;
					if (type == GAMES_COLLECTION_TYPE_AUTO) {
						GamesCollection* _tmp14_;
						gboolean _tmp15_;
						gboolean _tmp16_;
						_tmp14_ = collection;
						_tmp15_ = games_collection_get_is_empty (_tmp14_);
						_tmp16_ = _tmp15_;
						_tmp13_ = _tmp16_;
					} else {
						_tmp13_ = FALSE;
					}
					_tmp12_ = _tmp13_;
				}
				if (_tmp12_) {
					_g_object_unref0 (collection);
					continue;
				}
				_tmp17_ = collection;
				_tmp18_ = self->priv->filtering_terms;
				_tmp18__length1 = self->priv->filtering_terms_length1;
				if (games_collection_matches_search_terms (_tmp17_, _tmp18_, (gint) _tmp18__length1)) {
					games_collections_main_page_set_is_search_empty (self, FALSE);
					_g_object_unref0 (collection);
					return;
				}
				_g_object_unref0 (collection);
			}
		}
	}
	games_collections_main_page_set_is_search_empty (self, TRUE);
}

static gboolean
games_collections_main_page_filter_collection (GamesCollectionsMainPage* self,
                                               GamesCollection* collection)
{
	gchar** _tmp0_;
	gint _tmp0__length1;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (collection != NULL, FALSE);
	_tmp0_ = self->priv->filtering_terms;
	_tmp0__length1 = self->priv->filtering_terms_length1;
	result = games_collection_matches_search_terms (collection, _tmp0_, (gint) _tmp0__length1);
	return result;
}

static gboolean
games_collections_main_page_collection_filter_func (GamesCollectionsMainPage* self,
                                                    GtkFlowBoxChild* child)
{
	GamesCollectionIconView* collection_icon_view = NULL;
	GamesCollectionIconView* _tmp0_;
	GamesCollectionIconView* _tmp1_;
	GamesCollection* collection = NULL;
	GamesCollectionIconView* _tmp2_;
	GamesCollection* _tmp3_;
	GamesCollection* _tmp4_;
	GamesCollection* _tmp5_;
	GamesCollectionType type = 0;
	GamesCollection* _tmp6_;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_;
	gboolean _tmp16_ = FALSE;
	GamesCollectionIconView* _tmp17_;
	GamesCollection* _tmp18_;
	GamesCollection* _tmp19_;
	gboolean _tmp20_;
	gboolean _tmp21_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (child != NULL, FALSE);
	_tmp0_ = _g_object_ref0 (GAMES_IS_COLLECTION_ICON_VIEW (child) ? ((GamesCollectionIconView*) child) : NULL);
	collection_icon_view = _tmp0_;
	_tmp1_ = collection_icon_view;
	if (_tmp1_ == NULL) {
		result = FALSE;
		_g_object_unref0 (collection_icon_view);
		return result;
	}
	_tmp2_ = collection_icon_view;
	_tmp3_ = games_collection_icon_view_get_collection (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	collection = _tmp5_;
	_tmp6_ = collection;
	type = games_collection_get_collection_type (_tmp6_);
	_tmp8_ = self->priv->_is_search_mode;
	if (_tmp8_) {
		gchar** _tmp9_;
		gint _tmp9__length1;
		_tmp9_ = self->priv->filtering_terms;
		_tmp9__length1 = self->priv->filtering_terms_length1;
		_tmp7_ = _tmp9__length1 != 0;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		switch (type) {
			case GAMES_COLLECTION_TYPE_AUTO:
			{
				gboolean _tmp10_ = FALSE;
				GamesCollection* _tmp11_;
				gboolean _tmp12_;
				gboolean _tmp13_;
				_tmp11_ = collection;
				_tmp12_ = games_collection_get_is_empty (_tmp11_);
				_tmp13_ = _tmp12_;
				if (!_tmp13_) {
					GamesCollection* _tmp14_;
					_tmp14_ = collection;
					_tmp10_ = games_collections_main_page_filter_collection (self, _tmp14_);
				} else {
					_tmp10_ = FALSE;
				}
				result = _tmp10_;
				_g_object_unref0 (collection);
				_g_object_unref0 (collection_icon_view);
				return result;
			}
			case GAMES_COLLECTION_TYPE_USER:
			{
				GamesCollection* _tmp15_;
				_tmp15_ = collection;
				result = games_collections_main_page_filter_collection (self, _tmp15_);
				_g_object_unref0 (collection);
				_g_object_unref0 (collection_icon_view);
				return result;
			}
			case GAMES_COLLECTION_TYPE_PLACEHOLDER:
			{
				result = FALSE;
				_g_object_unref0 (collection);
				_g_object_unref0 (collection_icon_view);
				return result;
			}
			default:
			break;
		}
	}
	_tmp17_ = collection_icon_view;
	_tmp18_ = games_collection_icon_view_get_collection (_tmp17_);
	_tmp19_ = _tmp18_;
	_tmp20_ = games_collection_get_is_empty (_tmp19_);
	_tmp21_ = _tmp20_;
	if (!_tmp21_) {
		_tmp16_ = TRUE;
	} else {
		_tmp16_ = type != GAMES_COLLECTION_TYPE_AUTO;
	}
	result = _tmp16_;
	_g_object_unref0 (collection);
	_g_object_unref0 (collection_icon_view);
	return result;
}

static void
games_collections_main_page_on_search_mode_changed (GamesCollectionsMainPage* self)
{
	g_return_if_fail (self != NULL);
	games_collections_main_page_update_search_empty (self);
	games_collections_main_page_invalidate_filter (self);
}

static void
_games_collections_main_page_on_search_mode_changed_g_object_notify (GObject* _sender,
                                                                     GParamSpec* pspec,
                                                                     gpointer self)
{
	games_collections_main_page_on_search_mode_changed ((GamesCollectionsMainPage*) self);
}

void
games_collections_main_page_on_map (GamesCollectionsMainPage* self)
{
	GtkWidget* window = NULL;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkWidget* _tmp3_;
	GBinding* _tmp4_;
	GBinding* _tmp5_;
	g_return_if_fail (self != NULL);
	_g_object_unref0 (self->priv->window_active_binding);
	self->priv->window_active_binding = NULL;
	games_collections_main_page_set_is_active (self, FALSE);
	_tmp0_ = gtk_widget_get_ancestor ((GtkWidget*) self, gtk_window_get_type ());
	_tmp1_ = _g_object_ref0 (_tmp0_);
	window = _tmp1_;
	_tmp2_ = window;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (window);
		return;
	}
	_tmp3_ = window;
	_tmp4_ = g_object_bind_property_with_closures ((GObject*) _tmp3_, "is-active", (GObject*) self, "is-active", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp5_ = _g_object_ref0 (_tmp4_);
	_g_object_unref0 (self->priv->window_active_binding);
	self->priv->window_active_binding = _tmp5_;
	_g_object_unref0 (window);
}

static void
_games_collections_main_page_on_map_gtk_widget_map (GtkWidget* _sender,
                                                    gpointer self)
{
	games_collections_main_page_on_map ((GamesCollectionsMainPage*) self);
}

void
games_collections_main_page_on_unmap (GamesCollectionsMainPage* self)
{
	g_return_if_fail (self != NULL);
	_g_object_unref0 (self->priv->window_active_binding);
	self->priv->window_active_binding = NULL;
	games_collections_main_page_set_is_active (self, FALSE);
}

static void
_games_collections_main_page_on_unmap_gtk_widget_unmap (GtkWidget* _sender,
                                                        gpointer self)
{
	games_collections_main_page_on_unmap ((GamesCollectionsMainPage*) self);
}

static gboolean
games_collections_main_page_on_gamepad_browse (GamesCollectionsMainPage* self,
                                               GtkDirectionType direction)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (!games_collections_main_page_has_collection_selected (self)) {
		result = games_collections_main_page_select_default_collection (self, direction);
		return result;
	}
	switch (direction) {
		case GTK_DIR_UP:
		{
			GtkFlowBox* _tmp0_;
			gboolean _tmp1_ = FALSE;
			_tmp0_ = self->priv->flow_box;
			g_signal_emit_by_name (_tmp0_, "move-cursor", GTK_MOVEMENT_DISPLAY_LINES, -1, &_tmp1_);
			result = _tmp1_;
			return result;
		}
		case GTK_DIR_DOWN:
		{
			GtkFlowBox* _tmp2_;
			gboolean _tmp3_ = FALSE;
			_tmp2_ = self->priv->flow_box;
			g_signal_emit_by_name (_tmp2_, "move-cursor", GTK_MOVEMENT_DISPLAY_LINES, 1, &_tmp3_);
			result = _tmp3_;
			return result;
		}
		case GTK_DIR_LEFT:
		{
			GtkFlowBox* _tmp4_;
			gboolean _tmp5_ = FALSE;
			_tmp4_ = self->priv->flow_box;
			g_signal_emit_by_name (_tmp4_, "move-cursor", GTK_MOVEMENT_VISUAL_POSITIONS, -1, &_tmp5_);
			result = _tmp5_;
			return result;
		}
		case GTK_DIR_RIGHT:
		{
			GtkFlowBox* _tmp6_;
			gboolean _tmp7_ = FALSE;
			_tmp6_ = self->priv->flow_box;
			g_signal_emit_by_name (_tmp6_, "move-cursor", GTK_MOVEMENT_VISUAL_POSITIONS, 1, &_tmp7_);
			result = _tmp7_;
			return result;
		}
		default:
		{
			result = FALSE;
			return result;
		}
	}
}

static gboolean
_games_collections_main_page_on_gamepad_browse_games_gamepad_browse_browse (GamesGamepadBrowse* _sender,
                                                                            GtkDirectionType direction,
                                                                            gpointer self)
{
	gboolean result;
	result = games_collections_main_page_on_gamepad_browse ((GamesCollectionsMainPage*) self, direction);
	return result;
}

static gboolean
games_collections_main_page_on_gamepad_accept (GamesCollectionsMainPage* self)
{
	GtkFlowBox* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->flow_box;
	g_signal_emit_by_name (_tmp0_, "activate-cursor-child");
	g_signal_emit (self, games_collections_main_page_signals[GAMES_COLLECTIONS_MAIN_PAGE_GAMEPAD_ACCEPTED_SIGNAL], 0);
	result = TRUE;
	return result;
}

static gboolean
_games_collections_main_page_on_gamepad_accept_games_gamepad_browse_accept (GamesGamepadBrowse* _sender,
                                                                            gpointer self)
{
	gboolean result;
	result = games_collections_main_page_on_gamepad_accept ((GamesCollectionsMainPage*) self);
	return result;
}

static void
games_collections_main_page_on_child_activated (GamesCollectionsMainPage* self,
                                                GtkFlowBoxChild* child)
{
	GamesCollectionIconView* collection_icon_view = NULL;
	GamesCollectionIconView* _tmp0_;
	gboolean _tmp1_;
	GamesCollectionIconView* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (child != NULL);
	_tmp0_ = _g_object_ref0 (GAMES_IS_COLLECTION_ICON_VIEW (child) ? ((GamesCollectionIconView*) child) : NULL);
	collection_icon_view = _tmp0_;
	_tmp1_ = self->priv->_is_selection_mode;
	if (_tmp1_) {
		GamesCollectionIconView* _tmp2_;
		GamesCollectionIconView* _tmp3_;
		gboolean _tmp4_;
		gboolean _tmp5_;
		_tmp2_ = collection_icon_view;
		_tmp3_ = collection_icon_view;
		_tmp4_ = games_collection_icon_view_get_checked (_tmp3_);
		_tmp5_ = _tmp4_;
		games_collection_icon_view_set_checked (_tmp2_, !_tmp5_);
		_g_object_unref0 (collection_icon_view);
		return;
	}
	_tmp6_ = collection_icon_view;
	if (_tmp6_ != NULL) {
		GamesCollectionIconView* _tmp7_;
		GamesCollection* _tmp8_;
		GamesCollection* _tmp9_;
		_tmp7_ = collection_icon_view;
		_tmp8_ = games_collection_icon_view_get_collection (_tmp7_);
		_tmp9_ = _tmp8_;
		g_signal_emit (self, games_collections_main_page_signals[GAMES_COLLECTIONS_MAIN_PAGE_COLLECTION_ACTIVATED_SIGNAL], 0, _tmp9_);
	}
	_g_object_unref0 (collection_icon_view);
}

static void
_games_collections_main_page_on_child_activated_gtk_flow_box_child_activated (GtkFlowBox* _sender,
                                                                              GtkFlowBoxChild* child,
                                                                              gpointer self)
{
	games_collections_main_page_on_child_activated ((GamesCollectionsMainPage*) self, child);
}

static void
games_collections_main_page_on_size_allocate (GamesCollectionsMainPage* self,
                                              GtkAllocation* allocation)
{
	GtkAllocation _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (allocation != NULL);
	_tmp0_ = *allocation;
	if (_tmp0_.width < 960) {
		GtkStyleContext* _tmp1_;
		_tmp1_ = gtk_widget_get_style_context ((GtkWidget*) self);
		gtk_style_context_remove_class (_tmp1_, "large");
	} else {
		GtkStyleContext* _tmp2_;
		_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) self);
		gtk_style_context_add_class (_tmp2_, "large");
	}
}

static void
_games_collections_main_page_on_size_allocate_gtk_widget_size_allocate (GtkWidget* _sender,
                                                                        GtkAllocation* allocation,
                                                                        gpointer self)
{
	games_collections_main_page_on_size_allocate ((GamesCollectionsMainPage*) self, allocation);
}

GamesCollectionsMainPage*
games_collections_main_page_construct (GType object_type)
{
	GamesCollectionsMainPage * self = NULL;
	self = (GamesCollectionsMainPage*) g_object_new (object_type, NULL);
	return self;
}

GamesCollectionsMainPage*
games_collections_main_page_new (void)
{
	return games_collections_main_page_construct (GAMES_TYPE_COLLECTIONS_MAIN_PAGE);
}

gboolean
games_collections_main_page_get_is_active (GamesCollectionsMainPage* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_active;
	return result;
}

void
games_collections_main_page_set_is_active (GamesCollectionsMainPage* self,
                                           gboolean value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_is_active == value) {
		return;
	}
	self->priv->_is_active = value;
	if (!self->priv->_is_active) {
		GamesGamepadBrowse* _tmp0_;
		_tmp0_ = self->priv->gamepad_browse;
		games_gamepad_browse_cancel_cursor_movement (_tmp0_);
	}
	g_object_notify_by_pspec ((GObject *) self, games_collections_main_page_properties[GAMES_COLLECTIONS_MAIN_PAGE_IS_ACTIVE_PROPERTY]);
}

GamesCollectionModel*
games_collections_main_page_get_collection_model (GamesCollectionsMainPage* self)
{
	GamesCollectionModel* result;
	GamesCollectionModel* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_collection_model;
	result = _tmp0_;
	return result;
}

static GtkWidget*
_games_collections_main_page_add_collection_gtk_flow_box_create_widget_func (gpointer item,
                                                                             gpointer self)
{
	GtkWidget* result;
	result = games_collections_main_page_add_collection ((GamesCollectionsMainPage*) self, item);
	return result;
}

static gboolean
_games_collections_main_page_collection_filter_func_gtk_flow_box_filter_func (GtkFlowBoxChild* child,
                                                                              gpointer self)
{
	gboolean result;
	result = games_collections_main_page_collection_filter_func ((GamesCollectionsMainPage*) self, child);
	return result;
}

void
games_collections_main_page_set_collection_model (GamesCollectionsMainPage* self,
                                                  GamesCollectionModel* value)
{
	GamesCollectionModel* _tmp0_;
	GtkFlowBox* _tmp1_;
	GamesCollectionModel* _tmp2_;
	GamesCollectionModel* _tmp3_;
	GtkFlowBox* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_collection_model);
	self->priv->_collection_model = _tmp0_;
	_tmp1_ = self->priv->flow_box;
	_tmp2_ = games_collections_main_page_get_collection_model (self);
	_tmp3_ = _tmp2_;
	gtk_flow_box_bind_model (_tmp1_, (GListModel*) _tmp3_, _games_collections_main_page_add_collection_gtk_flow_box_create_widget_func, g_object_ref (self), g_object_unref);
	_tmp4_ = self->priv->flow_box;
	gtk_flow_box_set_filter_func (_tmp4_, _games_collections_main_page_collection_filter_func_gtk_flow_box_filter_func, g_object_ref (self), g_object_unref);
	g_object_notify_by_pspec ((GObject *) self, games_collections_main_page_properties[GAMES_COLLECTIONS_MAIN_PAGE_COLLECTION_MODEL_PROPERTY]);
}

gboolean
games_collections_main_page_get_is_selection_mode (GamesCollectionsMainPage* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_selection_mode;
	return result;
}

void
games_collections_main_page_set_is_selection_mode (GamesCollectionsMainPage* self,
                                                   gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = games_collections_main_page_get_is_selection_mode (self);
	if (old_value != value) {
		self->priv->_is_selection_mode = value;
		g_object_notify_by_pspec ((GObject *) self, games_collections_main_page_properties[GAMES_COLLECTIONS_MAIN_PAGE_IS_SELECTION_MODE_PROPERTY]);
	}
}

gboolean
games_collections_main_page_get_is_search_mode (GamesCollectionsMainPage* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_search_mode;
	return result;
}

void
games_collections_main_page_set_is_search_mode (GamesCollectionsMainPage* self,
                                                gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = games_collections_main_page_get_is_search_mode (self);
	if (old_value != value) {
		self->priv->_is_search_mode = value;
		g_object_notify_by_pspec ((GObject *) self, games_collections_main_page_properties[GAMES_COLLECTIONS_MAIN_PAGE_IS_SEARCH_MODE_PROPERTY]);
	}
}

gboolean
games_collections_main_page_get_is_search_empty (GamesCollectionsMainPage* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_search_empty;
	return result;
}

void
games_collections_main_page_set_is_search_empty (GamesCollectionsMainPage* self,
                                                 gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = games_collections_main_page_get_is_search_empty (self);
	if (old_value != value) {
		self->priv->_is_search_empty = value;
		g_object_notify_by_pspec ((GObject *) self, games_collections_main_page_properties[GAMES_COLLECTIONS_MAIN_PAGE_IS_SEARCH_EMPTY_PROPERTY]);
	}
}

static guint
_games_collection_icon_view_hash_ghash_func (gconstpointer key)
{
	guint result;
	result = games_collection_icon_view_hash ((GamesCollectionIconView*) key);
	return result;
}

static gboolean
_games_collection_icon_view_equal_gequal_func (gconstpointer a,
                                               gconstpointer b)
{
	gboolean result;
	result = games_collection_icon_view_equal ((GamesCollectionIconView*) a, (GamesCollectionIconView*) b);
	return result;
}

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

static GObject *
games_collections_main_page_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GamesCollectionsMainPage * self;
	GtkFlowBox* _tmp0_;
	GHashTable* _tmp1_;
	parent_class = G_OBJECT_CLASS (games_collections_main_page_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_COLLECTIONS_MAIN_PAGE, GamesCollectionsMainPage);
	_tmp0_ = self->priv->flow_box;
	gtk_flow_box_set_max_children_per_line (_tmp0_, G_MAXUINT);
	_tmp1_ = g_hash_table_new_full (_games_collection_icon_view_hash_ghash_func, _games_collection_icon_view_equal_gequal_func, NULL, _g_object_unref0_);
	_g_hash_table_unref0 (self->priv->selected_collections);
	self->priv->selected_collections = _tmp1_;
	return obj;
}

static void
games_collections_main_page_class_init (GamesCollectionsMainPageClass * klass,
                                        gpointer klass_data)
{
	games_collections_main_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesCollectionsMainPage_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_games_collections_main_page_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_collections_main_page_set_property;
	G_OBJECT_CLASS (klass)->constructor = games_collections_main_page_constructor;
	G_OBJECT_CLASS (klass)->finalize = games_collections_main_page_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_COLLECTIONS_MAIN_PAGE_IS_ACTIVE_PROPERTY, games_collections_main_page_properties[GAMES_COLLECTIONS_MAIN_PAGE_IS_ACTIVE_PROPERTY] = g_param_spec_boolean ("is-active", "is-active", "is-active", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_COLLECTIONS_MAIN_PAGE_COLLECTION_MODEL_PROPERTY, games_collections_main_page_properties[GAMES_COLLECTIONS_MAIN_PAGE_COLLECTION_MODEL_PROPERTY] = g_param_spec_object ("collection-model", "collection-model", "collection-model", GAMES_TYPE_COLLECTION_MODEL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_COLLECTIONS_MAIN_PAGE_IS_SELECTION_MODE_PROPERTY, games_collections_main_page_properties[GAMES_COLLECTIONS_MAIN_PAGE_IS_SELECTION_MODE_PROPERTY] = g_param_spec_boolean ("is-selection-mode", "is-selection-mode", "is-selection-mode", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_COLLECTIONS_MAIN_PAGE_IS_SEARCH_MODE_PROPERTY, games_collections_main_page_properties[GAMES_COLLECTIONS_MAIN_PAGE_IS_SEARCH_MODE_PROPERTY] = g_param_spec_boolean ("is-search-mode", "is-search-mode", "is-search-mode", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_COLLECTIONS_MAIN_PAGE_IS_SEARCH_EMPTY_PROPERTY, games_collections_main_page_properties[GAMES_COLLECTIONS_MAIN_PAGE_IS_SEARCH_EMPTY_PROPERTY] = g_param_spec_boolean ("is-search-empty", "is-search-empty", "is-search-empty", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Games/ui/collections-main-page.ui");
	games_collections_main_page_signals[GAMES_COLLECTIONS_MAIN_PAGE_COLLECTION_ACTIVATED_SIGNAL] = g_signal_new ("collection-activated", GAMES_TYPE_COLLECTIONS_MAIN_PAGE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GAMES_TYPE_COLLECTION);
	games_collections_main_page_signals[GAMES_COLLECTIONS_MAIN_PAGE_SELECTED_ITEMS_CHANGED_SIGNAL] = g_signal_new ("selected-items-changed", GAMES_TYPE_COLLECTIONS_MAIN_PAGE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	games_collections_main_page_signals[GAMES_COLLECTIONS_MAIN_PAGE_GAMEPAD_ACCEPTED_SIGNAL] = g_signal_new ("gamepad-accepted", GAMES_TYPE_COLLECTIONS_MAIN_PAGE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "flow_box", FALSE, GamesCollectionsMainPage_private_offset + G_STRUCT_OFFSET (GamesCollectionsMainPagePrivate, flow_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "gamepad_browse", FALSE, GamesCollectionsMainPage_private_offset + G_STRUCT_OFFSET (GamesCollectionsMainPagePrivate, gamepad_browse));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "scrolled_window", FALSE, GamesCollectionsMainPage_private_offset + G_STRUCT_OFFSET (GamesCollectionsMainPagePrivate, scrolled_window));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_search_mode_changed", G_CALLBACK(_games_collections_main_page_on_search_mode_changed_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_map", G_CALLBACK(_games_collections_main_page_on_map_gtk_widget_map));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_unmap", G_CALLBACK(_games_collections_main_page_on_unmap_gtk_widget_unmap));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_gamepad_browse", G_CALLBACK(_games_collections_main_page_on_gamepad_browse_games_gamepad_browse_browse));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_gamepad_accept", G_CALLBACK(_games_collections_main_page_on_gamepad_accept_games_gamepad_browse_accept));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_child_activated", G_CALLBACK(_games_collections_main_page_on_child_activated_gtk_flow_box_child_activated));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_size_allocate", G_CALLBACK(_games_collections_main_page_on_size_allocate_gtk_widget_size_allocate));
	gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (klass), "gamescollectionsmainpage");
}

static void
games_collections_main_page_instance_init (GamesCollectionsMainPage * self,
                                           gpointer klass)
{
	self->priv = games_collections_main_page_get_instance_private (self);
	g_type_ensure (GAMES_TYPE_GAMEPAD_BROWSE);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
games_collections_main_page_finalize (GObject * obj)
{
	GamesCollectionsMainPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_COLLECTIONS_MAIN_PAGE, GamesCollectionsMainPage);
	self->priv->filtering_terms = (_vala_array_free (self->priv->filtering_terms, self->priv->filtering_terms_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (self->priv->window_active_binding);
	_g_hash_table_unref0 (self->priv->selected_collections);
	_g_object_unref0 (self->priv->_collection_model);
	G_OBJECT_CLASS (games_collections_main_page_parent_class)->finalize (obj);
}

static GType
games_collections_main_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesCollectionsMainPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_collections_main_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesCollectionsMainPage), 0, (GInstanceInitFunc) games_collections_main_page_instance_init, NULL };
	GType games_collections_main_page_type_id;
	games_collections_main_page_type_id = g_type_register_static (gtk_bin_get_type (), "GamesCollectionsMainPage", &g_define_type_info, 0);
	GamesCollectionsMainPage_private_offset = g_type_add_instance_private (games_collections_main_page_type_id, sizeof (GamesCollectionsMainPagePrivate));
	return games_collections_main_page_type_id;
}

GType
games_collections_main_page_get_type (void)
{
	static volatile gsize games_collections_main_page_type_id__once = 0;
	if (g_once_init_enter (&games_collections_main_page_type_id__once)) {
		GType games_collections_main_page_type_id;
		games_collections_main_page_type_id = games_collections_main_page_get_type_once ();
		g_once_init_leave (&games_collections_main_page_type_id__once, games_collections_main_page_type_id);
	}
	return games_collections_main_page_type_id__once;
}

static void
_vala_games_collections_main_page_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec)
{
	GamesCollectionsMainPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_COLLECTIONS_MAIN_PAGE, GamesCollectionsMainPage);
	switch (property_id) {
		case GAMES_COLLECTIONS_MAIN_PAGE_IS_ACTIVE_PROPERTY:
		g_value_set_boolean (value, games_collections_main_page_get_is_active (self));
		break;
		case GAMES_COLLECTIONS_MAIN_PAGE_COLLECTION_MODEL_PROPERTY:
		g_value_set_object (value, games_collections_main_page_get_collection_model (self));
		break;
		case GAMES_COLLECTIONS_MAIN_PAGE_IS_SELECTION_MODE_PROPERTY:
		g_value_set_boolean (value, games_collections_main_page_get_is_selection_mode (self));
		break;
		case GAMES_COLLECTIONS_MAIN_PAGE_IS_SEARCH_MODE_PROPERTY:
		g_value_set_boolean (value, games_collections_main_page_get_is_search_mode (self));
		break;
		case GAMES_COLLECTIONS_MAIN_PAGE_IS_SEARCH_EMPTY_PROPERTY:
		g_value_set_boolean (value, games_collections_main_page_get_is_search_empty (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_games_collections_main_page_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec)
{
	GamesCollectionsMainPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_COLLECTIONS_MAIN_PAGE, GamesCollectionsMainPage);
	switch (property_id) {
		case GAMES_COLLECTIONS_MAIN_PAGE_IS_ACTIVE_PROPERTY:
		games_collections_main_page_set_is_active (self, g_value_get_boolean (value));
		break;
		case GAMES_COLLECTIONS_MAIN_PAGE_COLLECTION_MODEL_PROPERTY:
		games_collections_main_page_set_collection_model (self, g_value_get_object (value));
		break;
		case GAMES_COLLECTIONS_MAIN_PAGE_IS_SELECTION_MODE_PROPERTY:
		games_collections_main_page_set_is_selection_mode (self, g_value_get_boolean (value));
		break;
		case GAMES_COLLECTIONS_MAIN_PAGE_IS_SEARCH_MODE_PROPERTY:
		games_collections_main_page_set_is_search_mode (self, g_value_get_boolean (value));
		break;
		case GAMES_COLLECTIONS_MAIN_PAGE_IS_SEARCH_EMPTY_PROPERTY:
		games_collections_main_page_set_is_search_empty (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

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

