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

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

#include <gtk/gtk.h>
#include <glib-object.h>
#include "gnome-games.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <cairo-gobject.h>
#include <float.h>
#include <math.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
#include <gdk/gdk.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_SNAPSHOTS_LIST (games_snapshots_list_get_type ())
#define GAMES_SNAPSHOTS_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_SNAPSHOTS_LIST, GamesSnapshotsList))
#define GAMES_SNAPSHOTS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_SNAPSHOTS_LIST, GamesSnapshotsListClass))
#define GAMES_IS_SNAPSHOTS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_SNAPSHOTS_LIST))
#define GAMES_IS_SNAPSHOTS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_SNAPSHOTS_LIST))
#define GAMES_SNAPSHOTS_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_SNAPSHOTS_LIST, GamesSnapshotsListClass))

typedef struct _GamesSnapshotsList GamesSnapshotsList;
typedef struct _GamesSnapshotsListClass GamesSnapshotsListClass;
typedef struct _GamesSnapshotsListPrivate GamesSnapshotsListPrivate;
enum  {
	GAMES_SNAPSHOTS_LIST_0_PROPERTY,
	GAMES_SNAPSHOTS_LIST_IS_REVEALED_PROPERTY,
	GAMES_SNAPSHOTS_LIST_RUNNER_PROPERTY,
	GAMES_SNAPSHOTS_LIST_NUM_PROPERTIES
};
static GParamSpec* games_snapshots_list_properties[GAMES_SNAPSHOTS_LIST_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GAMES_TYPE_SNAPSHOT_ROW (games_snapshot_row_get_type ())
#define GAMES_SNAPSHOT_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_SNAPSHOT_ROW, GamesSnapshotRow))
#define GAMES_SNAPSHOT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_SNAPSHOT_ROW, GamesSnapshotRowClass))
#define GAMES_IS_SNAPSHOT_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_SNAPSHOT_ROW))
#define GAMES_IS_SNAPSHOT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_SNAPSHOT_ROW))
#define GAMES_SNAPSHOT_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_SNAPSHOT_ROW, GamesSnapshotRowClass))

typedef struct _GamesSnapshotRow GamesSnapshotRow;
typedef struct _GamesSnapshotRowClass GamesSnapshotRowClass;
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	GAMES_SNAPSHOTS_LIST_HIDDEN_SIGNAL,
	GAMES_SNAPSHOTS_LIST_NUM_SIGNALS
};
static guint games_snapshots_list_signals[GAMES_SNAPSHOTS_LIST_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 _GamesSnapshotsList {
	GtkBox parent_instance;
	GamesSnapshotsListPrivate * priv;
};

struct _GamesSnapshotsListClass {
	GtkBoxClass parent_class;
};

struct _GamesSnapshotsListPrivate {
	GtkListBox* list_box;
	GtkListBoxRow* new_snapshot_row;
	GtkScrolledWindow* scrolled_window;
	GtkButton* delete_btn;
	GtkButton* rename_btn;
	GtkPopover* rename_popover;
	GtkEntry* rename_entry;
	GtkButton* rename_popover_btn;
	GtkLabel* rename_error_label;
	GamesSnapshot* selected_snapshot;
	gboolean _is_revealed;
	GamesRunner* _runner;
};

static gint GamesSnapshotsList_private_offset;
static gpointer games_snapshots_list_parent_class = NULL;

VALA_EXTERN GType games_snapshots_list_get_type (void) G_GNUC_CONST ;
static void games_snapshots_list_on_move_cursor (GamesSnapshotsList* self);
VALA_EXTERN GType games_snapshot_row_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GamesSnapshot* games_snapshot_row_get_snapshot (GamesSnapshotRow* self);
static void games_snapshots_list_select_snapshot_row (GamesSnapshotsList* self,
                                               GtkListBoxRow* row);
static void _games_snapshots_list_on_move_cursor_gtk_list_box_move_cursor (GtkListBox* _sender,
                                                                    GtkMovementStep step,
                                                                    gint count,
                                                                    gpointer self);
static void games_snapshots_list_on_row_activated (GamesSnapshotsList* self,
                                            GtkListBoxRow* activated_row);
VALA_EXTERN GamesRunner* games_snapshots_list_get_runner (GamesSnapshotsList* self);
VALA_EXTERN GamesSnapshotRow* games_snapshot_row_new (GamesSnapshot* snapshot);
VALA_EXTERN GamesSnapshotRow* games_snapshot_row_construct (GType object_type,
                                                GamesSnapshot* snapshot);
VALA_EXTERN void games_snapshot_row_reveal (GamesSnapshotRow* self);
static void _games_snapshots_list_on_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                        GtkListBoxRow* row,
                                                                        gpointer self);
static void games_snapshots_list_populate_list_box (GamesSnapshotsList* self);
static void games_snapshots_list_on_revealed_changed (GamesSnapshotsList* self);
VALA_EXTERN gboolean games_snapshots_list_get_is_revealed (GamesSnapshotsList* self);
static void _games_snapshots_list_on_revealed_changed_g_object_notify (GObject* _sender,
                                                                GParamSpec* pspec,
                                                                gpointer self);
static void games_snapshots_list_on_revealer_transition_end (GamesSnapshotsList* self);
static void _games_snapshots_list_on_revealer_transition_end_g_object_notify (GObject* _sender,
                                                                       GParamSpec* pspec,
                                                                       gpointer self);
static void games_snapshots_list_on_delete_clicked (GamesSnapshotsList* self);
static void games_snapshots_list_ensure_row_is_visible (GamesSnapshotsList* self,
                                                 GtkListBoxRow* row);
VALA_EXTERN void games_snapshot_row_remove_animated (GamesSnapshotRow* self);
static void _games_snapshots_list_on_delete_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                 gpointer self);
static void games_snapshots_list_on_rename_clicked (GamesSnapshotsList* self);
static void _games_snapshots_list_on_rename_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                 gpointer self);
static void games_snapshots_list_on_rename_entry_activated (GamesSnapshotsList* self);
static gboolean games_snapshots_list_check_rename_is_valid (GamesSnapshotsList* self);
static void games_snapshots_list_apply_rename (GamesSnapshotsList* self);
static void _games_snapshots_list_on_rename_entry_activated_gtk_entry_activate (GtkEntry* _sender,
                                                                         gpointer self);
static void games_snapshots_list_on_rename_entry_text_changed (GamesSnapshotsList* self);
static void _games_snapshots_list_on_rename_entry_text_changed_g_object_notify (GObject* _sender,
                                                                         GParamSpec* pspec,
                                                                         gpointer self);
VALA_EXTERN void games_snapshot_row_set_name (GamesSnapshotRow* self,
                                  const gchar* name);
static void _games_snapshots_list_apply_rename_gtk_button_clicked (GtkButton* _sender,
                                                            gpointer self);
static void games_snapshots_list_update_header (GamesSnapshotsList* self,
                                         GtkListBoxRow* row,
                                         GtkListBoxRow* before);
static GSimpleAction* games_snapshots_list_lookup_action (GamesSnapshotsList* self,
                                                   const gchar* name);
VALA_EXTERN gboolean games_snapshots_list_on_key_press_event (GamesSnapshotsList* self,
                                                  guint keyval,
                                                  GdkModifierType state);
VALA_EXTERN GamesSnapshotsList* games_snapshots_list_new (void);
VALA_EXTERN GamesSnapshotsList* games_snapshots_list_construct (GType object_type);
VALA_EXTERN void games_snapshots_list_set_is_revealed (GamesSnapshotsList* self,
                                           gboolean value);
VALA_EXTERN void games_snapshots_list_set_runner (GamesSnapshotsList* self,
                                      GamesRunner* value);
static GObject * games_snapshots_list_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties);
static void _games_snapshots_list_update_header_gtk_list_box_update_header_func (GtkListBoxRow* row,
                                                                          GtkListBoxRow* before,
                                                                          gpointer self);
static void games_snapshots_list_finalize (GObject * obj);
static GType games_snapshots_list_get_type_once (void);
static void _vala_games_snapshots_list_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_games_snapshots_list_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_snapshots_list_get_instance_private (GamesSnapshotsList* self)
{
	return G_STRUCT_MEMBER_P (self, GamesSnapshotsList_private_offset);
}

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

static void
games_snapshots_list_on_move_cursor (GamesSnapshotsList* self)
{
	GtkListBoxRow* row = NULL;
	GtkListBox* _tmp0_;
	GtkListBoxRow* _tmp1_;
	GtkListBoxRow* _tmp2_;
	gboolean _tmp3_ = FALSE;
	GtkListBoxRow* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->list_box;
	_tmp1_ = gtk_list_box_get_selected_row (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	row = _tmp2_;
	_tmp4_ = row;
	if (_tmp4_ != NULL) {
		GtkListBoxRow* _tmp5_;
		_tmp5_ = row;
		_tmp3_ = GAMES_IS_SNAPSHOT_ROW (_tmp5_);
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		GamesSnapshotRow* snapshot_row = NULL;
		GtkListBoxRow* _tmp6_;
		GamesSnapshotRow* _tmp7_;
		GamesSnapshot* snapshot = NULL;
		GamesSnapshotRow* _tmp8_;
		GamesSnapshot* _tmp9_;
		GamesSnapshot* _tmp10_;
		GamesSnapshot* _tmp11_;
		GamesSnapshot* _tmp12_;
		GamesSnapshot* _tmp13_;
		_tmp6_ = row;
		_tmp7_ = _g_object_ref0 (GAMES_IS_SNAPSHOT_ROW (_tmp6_) ? ((GamesSnapshotRow*) _tmp6_) : NULL);
		snapshot_row = _tmp7_;
		_tmp8_ = snapshot_row;
		_tmp9_ = games_snapshot_row_get_snapshot (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = _g_object_ref0 (_tmp10_);
		snapshot = _tmp11_;
		_tmp12_ = snapshot;
		_tmp13_ = self->priv->selected_snapshot;
		if (_tmp12_ != _tmp13_) {
			GtkListBoxRow* _tmp14_;
			_tmp14_ = row;
			games_snapshots_list_select_snapshot_row (self, _tmp14_);
		}
		_g_object_unref0 (snapshot);
		_g_object_unref0 (snapshot_row);
	}
	_g_object_unref0 (row);
}

static void
_games_snapshots_list_on_move_cursor_gtk_list_box_move_cursor (GtkListBox* _sender,
                                                               GtkMovementStep step,
                                                               gint count,
                                                               gpointer self)
{
	games_snapshots_list_on_move_cursor ((GamesSnapshotsList*) self);
}

static void
games_snapshots_list_on_row_activated (GamesSnapshotsList* self,
                                       GtkListBoxRow* activated_row)
{
	GtkListBoxRow* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (activated_row != NULL);
	_tmp0_ = self->priv->new_snapshot_row;
	if (activated_row == _tmp0_) {
		GamesSnapshot* snapshot = NULL;
		GamesRunner* _tmp1_;
		GamesSnapshot* _tmp2_;
		GamesSnapshot* _tmp3_;
		_tmp1_ = self->priv->_runner;
		_tmp2_ = games_runner_try_create_snapshot (_tmp1_, FALSE);
		snapshot = _tmp2_;
		_tmp3_ = snapshot;
		if (_tmp3_ != NULL) {
			GamesSnapshotRow* snapshot_row = NULL;
			GamesSnapshot* _tmp4_;
			GamesSnapshotRow* _tmp5_;
			GtkListBox* _tmp6_;
			GamesSnapshotRow* _tmp7_;
			GamesSnapshotRow* _tmp8_;
			GamesSnapshotRow* _tmp9_;
			_tmp4_ = snapshot;
			_tmp5_ = games_snapshot_row_new (_tmp4_);
			g_object_ref_sink (_tmp5_);
			snapshot_row = _tmp5_;
			_tmp6_ = self->priv->list_box;
			_tmp7_ = snapshot_row;
			gtk_list_box_insert (_tmp6_, (GtkWidget*) _tmp7_, 1);
			_tmp8_ = snapshot_row;
			games_snapshots_list_select_snapshot_row (self, (GtkListBoxRow*) _tmp8_);
			_tmp9_ = snapshot_row;
			games_snapshot_row_reveal (_tmp9_);
			_g_object_unref0 (snapshot_row);
		} else {
			GtkListBox* _tmp10_;
			GtkListBoxRow* _tmp11_;
			_tmp10_ = self->priv->list_box;
			_tmp11_ = gtk_list_box_get_row_at_index (_tmp10_, 1);
			games_snapshots_list_select_snapshot_row (self, _tmp11_);
		}
		_g_object_unref0 (snapshot);
	} else {
		games_snapshots_list_select_snapshot_row (self, activated_row);
	}
}

static void
_games_snapshots_list_on_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                   GtkListBoxRow* row,
                                                                   gpointer self)
{
	games_snapshots_list_on_row_activated ((GamesSnapshotsList*) self, row);
}

static void
games_snapshots_list_populate_list_box (GamesSnapshotsList* self)
{
	GList* list_rows = NULL;
	GtkListBox* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	GamesRunner* _tmp7_;
	GamesSnapshot** snapshots = NULL;
	GamesRunner* _tmp8_;
	gint _tmp9_ = 0;
	GamesSnapshot** _tmp10_;
	gint snapshots_length1;
	gint _snapshots_size_;
	GamesSnapshot** _tmp11_;
	gint _tmp11__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->list_box;
	_tmp1_ = gtk_container_get_children ((GtkContainer*) _tmp0_);
	list_rows = _tmp1_;
	_tmp2_ = list_rows;
	{
		GList* row_collection = NULL;
		GList* row_it = NULL;
		row_collection = _tmp2_;
		for (row_it = row_collection; row_it != NULL; row_it = row_it->next) {
			GtkWidget* row = NULL;
			row = (GtkWidget*) row_it->data;
			{
				GtkWidget* _tmp3_;
				GtkListBoxRow* _tmp4_;
				_tmp3_ = row;
				_tmp4_ = self->priv->new_snapshot_row;
				if (_tmp3_ != G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, gtk_widget_get_type (), GtkWidget)) {
					GtkListBox* _tmp5_;
					GtkWidget* _tmp6_;
					_tmp5_ = self->priv->list_box;
					_tmp6_ = row;
					gtk_container_remove ((GtkContainer*) _tmp5_, _tmp6_);
				}
			}
		}
	}
	_tmp7_ = self->priv->_runner;
	if (_tmp7_ == NULL) {
		(list_rows == NULL) ? NULL : (list_rows = (g_list_free (list_rows), NULL));
		return;
	}
	_tmp8_ = self->priv->_runner;
	_tmp10_ = games_runner_get_snapshots (_tmp8_, &_tmp9_);
	snapshots = _tmp10_;
	snapshots_length1 = _tmp9_;
	_snapshots_size_ = snapshots_length1;
	_tmp11_ = snapshots;
	_tmp11__length1 = snapshots_length1;
	{
		GamesSnapshot** snapshot_collection = NULL;
		gint snapshot_collection_length1 = 0;
		gint _snapshot_collection_size_ = 0;
		gint snapshot_it = 0;
		snapshot_collection = _tmp11_;
		snapshot_collection_length1 = _tmp11__length1;
		for (snapshot_it = 0; snapshot_it < snapshot_collection_length1; snapshot_it = snapshot_it + 1) {
			GamesSnapshot* _tmp12_;
			GamesSnapshot* snapshot = NULL;
			_tmp12_ = _g_object_ref0 (snapshot_collection[snapshot_it]);
			snapshot = _tmp12_;
			{
				GamesSnapshotRow* list_row = NULL;
				GamesSnapshot* _tmp13_;
				GamesSnapshotRow* _tmp14_;
				GamesSnapshotRow* _tmp15_;
				GtkListBox* _tmp16_;
				GamesSnapshotRow* _tmp17_;
				_tmp13_ = snapshot;
				_tmp14_ = games_snapshot_row_new (_tmp13_);
				g_object_ref_sink (_tmp14_);
				list_row = _tmp14_;
				_tmp15_ = list_row;
				games_snapshot_row_reveal (_tmp15_);
				_tmp16_ = self->priv->list_box;
				_tmp17_ = list_row;
				gtk_container_add ((GtkContainer*) _tmp16_, (GtkWidget*) _tmp17_);
				_g_object_unref0 (list_row);
				_g_object_unref0 (snapshot);
			}
		}
	}
	snapshots = (_vala_array_free (snapshots, snapshots_length1, (GDestroyNotify) g_object_unref), NULL);
	(list_rows == NULL) ? NULL : (list_rows = (g_list_free (list_rows), NULL));
}

static void
games_snapshots_list_on_revealed_changed (GamesSnapshotsList* self)
{
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_is_revealed;
	if (_tmp0_) {
		GamesRunner* _tmp1_;
		_tmp1_ = self->priv->_runner;
		games_runner_pause (_tmp1_);
		games_snapshots_list_populate_list_box (self);
		games_snapshots_list_select_snapshot_row (self, NULL);
	}
}

static void
_games_snapshots_list_on_revealed_changed_g_object_notify (GObject* _sender,
                                                           GParamSpec* pspec,
                                                           gpointer self)
{
	games_snapshots_list_on_revealed_changed ((GamesSnapshotsList*) self);
}

static void
games_snapshots_list_on_revealer_transition_end (GamesSnapshotsList* self)
{
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_is_revealed;
	if (!_tmp0_) {
		g_signal_emit (self, games_snapshots_list_signals[GAMES_SNAPSHOTS_LIST_HIDDEN_SIGNAL], 0);
	}
}

static void
_games_snapshots_list_on_revealer_transition_end_g_object_notify (GObject* _sender,
                                                                  GParamSpec* pspec,
                                                                  gpointer self)
{
	games_snapshots_list_on_revealer_transition_end ((GamesSnapshotsList*) self);
}

static void
games_snapshots_list_on_delete_clicked (GamesSnapshotsList* self)
{
	GtkListBoxRow* selected_row = NULL;
	GtkListBox* _tmp0_;
	GtkListBoxRow* _tmp1_;
	GtkListBoxRow* _tmp2_;
	gint selected_row_index = 0;
	GtkListBoxRow* _tmp3_;
	GamesSnapshotRow* snapshot_row = NULL;
	GtkListBoxRow* _tmp4_;
	GamesSnapshotRow* _tmp5_;
	GamesSnapshot* snapshot = NULL;
	GamesSnapshotRow* _tmp6_;
	GamesSnapshot* _tmp7_;
	GamesSnapshot* _tmp8_;
	GamesSnapshot* _tmp9_;
	GtkListBoxRow* _tmp10_;
	GamesRunner* _tmp11_;
	GamesSnapshot* _tmp12_;
	gint next_row_index = 0;
	GtkListBoxRow* new_selected_row = NULL;
	GtkListBox* _tmp13_;
	GtkListBoxRow* _tmp14_;
	GtkListBoxRow* _tmp15_;
	GtkListBoxRow* _tmp25_;
	gboolean _tmp37_ = FALSE;
	GtkListBoxRow* _tmp38_;
	GamesSnapshotRow* _tmp43_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->list_box;
	_tmp1_ = gtk_list_box_get_selected_row (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	selected_row = _tmp2_;
	_tmp3_ = selected_row;
	selected_row_index = gtk_list_box_row_get_index (_tmp3_);
	_tmp4_ = selected_row;
	_tmp5_ = _g_object_ref0 (GAMES_IS_SNAPSHOT_ROW (_tmp4_) ? ((GamesSnapshotRow*) _tmp4_) : NULL);
	snapshot_row = _tmp5_;
	_tmp6_ = snapshot_row;
	_tmp7_ = games_snapshot_row_get_snapshot (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _g_object_ref0 (_tmp8_);
	snapshot = _tmp9_;
	_tmp10_ = selected_row;
	games_snapshots_list_ensure_row_is_visible (self, _tmp10_);
	_tmp11_ = self->priv->_runner;
	_tmp12_ = snapshot;
	games_runner_delete_snapshot (_tmp11_, _tmp12_);
	next_row_index = selected_row_index + 1;
	_tmp13_ = self->priv->list_box;
	_tmp14_ = gtk_list_box_get_row_at_index (_tmp13_, next_row_index);
	_tmp15_ = _g_object_ref0 (_tmp14_);
	new_selected_row = _tmp15_;
	while (TRUE) {
		gboolean _tmp16_ = FALSE;
		GtkListBoxRow* _tmp17_;
		gint _tmp21_;
		GtkListBox* _tmp22_;
		GtkListBoxRow* _tmp23_;
		GtkListBoxRow* _tmp24_;
		_tmp17_ = new_selected_row;
		if (_tmp17_ != NULL) {
			GtkListBoxRow* _tmp18_;
			gboolean _tmp19_;
			gboolean _tmp20_;
			_tmp18_ = new_selected_row;
			_tmp19_ = gtk_list_box_row_get_selectable (_tmp18_);
			_tmp20_ = _tmp19_;
			_tmp16_ = !_tmp20_;
		} else {
			_tmp16_ = FALSE;
		}
		if (!_tmp16_) {
			break;
		}
		_tmp21_ = next_row_index;
		next_row_index = _tmp21_ + 1;
		_tmp22_ = self->priv->list_box;
		_tmp23_ = gtk_list_box_get_row_at_index (_tmp22_, next_row_index);
		_tmp24_ = _g_object_ref0 (_tmp23_);
		_g_object_unref0 (new_selected_row);
		new_selected_row = _tmp24_;
	}
	_tmp25_ = new_selected_row;
	if (_tmp25_ == NULL) {
		gint prev_row_index = 0;
		GtkListBox* _tmp26_;
		GtkListBoxRow* _tmp27_;
		GtkListBoxRow* _tmp28_;
		prev_row_index = selected_row_index - 1;
		_tmp26_ = self->priv->list_box;
		_tmp27_ = gtk_list_box_get_row_at_index (_tmp26_, prev_row_index);
		_tmp28_ = _g_object_ref0 (_tmp27_);
		_g_object_unref0 (new_selected_row);
		new_selected_row = _tmp28_;
		while (TRUE) {
			gboolean _tmp29_ = FALSE;
			gint _tmp33_;
			GtkListBox* _tmp34_;
			GtkListBoxRow* _tmp35_;
			GtkListBoxRow* _tmp36_;
			if (prev_row_index > 1) {
				GtkListBoxRow* _tmp30_;
				gboolean _tmp31_;
				gboolean _tmp32_;
				_tmp30_ = new_selected_row;
				_tmp31_ = gtk_list_box_row_get_selectable (_tmp30_);
				_tmp32_ = _tmp31_;
				_tmp29_ = !_tmp32_;
			} else {
				_tmp29_ = FALSE;
			}
			if (!_tmp29_) {
				break;
			}
			_tmp33_ = prev_row_index;
			prev_row_index = _tmp33_ - 1;
			_tmp34_ = self->priv->list_box;
			_tmp35_ = gtk_list_box_get_row_at_index (_tmp34_, prev_row_index);
			_tmp36_ = _g_object_ref0 (_tmp35_);
			_g_object_unref0 (new_selected_row);
			new_selected_row = _tmp36_;
		}
	}
	_tmp38_ = new_selected_row;
	if (_tmp38_ != NULL) {
		GtkListBoxRow* _tmp39_;
		gboolean _tmp40_;
		gboolean _tmp41_;
		_tmp39_ = new_selected_row;
		_tmp40_ = gtk_list_box_row_get_selectable (_tmp39_);
		_tmp41_ = _tmp40_;
		_tmp37_ = _tmp41_;
	} else {
		_tmp37_ = FALSE;
	}
	if (_tmp37_) {
		GtkListBoxRow* _tmp42_;
		_tmp42_ = new_selected_row;
		games_snapshots_list_select_snapshot_row (self, _tmp42_);
	} else {
		games_snapshots_list_select_snapshot_row (self, NULL);
	}
	_tmp43_ = snapshot_row;
	games_snapshot_row_remove_animated (_tmp43_);
	_g_object_unref0 (new_selected_row);
	_g_object_unref0 (snapshot);
	_g_object_unref0 (snapshot_row);
	_g_object_unref0 (selected_row);
}

static void
_games_snapshots_list_on_delete_clicked_gtk_button_clicked (GtkButton* _sender,
                                                            gpointer self)
{
	games_snapshots_list_on_delete_clicked ((GamesSnapshotsList*) self);
}

static void
games_snapshots_list_on_rename_clicked (GamesSnapshotsList* self)
{
	GtkListBoxRow* selected_row = NULL;
	GtkListBox* _tmp0_;
	GtkListBoxRow* _tmp1_;
	GtkListBoxRow* _tmp2_;
	GtkEntry* _tmp3_;
	GamesSnapshot* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	GtkPopover* _tmp7_;
	GtkPopover* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->list_box;
	_tmp1_ = gtk_list_box_get_selected_row (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	selected_row = _tmp2_;
	games_snapshots_list_ensure_row_is_visible (self, selected_row);
	_tmp3_ = self->priv->rename_entry;
	_tmp4_ = self->priv->selected_snapshot;
	_tmp5_ = games_snapshot_get_name (_tmp4_);
	_tmp6_ = _tmp5_;
	gtk_entry_set_text (_tmp3_, _tmp6_);
	_tmp7_ = self->priv->rename_popover;
	gtk_popover_set_relative_to (_tmp7_, (GtkWidget*) selected_row);
	_tmp8_ = self->priv->rename_popover;
	gtk_popover_popup (_tmp8_);
	_g_object_unref0 (selected_row);
}

static void
_games_snapshots_list_on_rename_clicked_gtk_button_clicked (GtkButton* _sender,
                                                            gpointer self)
{
	games_snapshots_list_on_rename_clicked ((GamesSnapshotsList*) self);
}

static void
games_snapshots_list_ensure_row_is_visible (GamesSnapshotsList* self,
                                            GtkListBoxRow* row)
{
	GtkAllocation allocation = {0};
	GtkAllocation _tmp0_ = {0};
	gint y = 0;
	GtkAllocation _tmp1_;
	gint height = 0;
	GtkAllocation _tmp2_;
	GtkScrolledWindow* _tmp3_;
	GtkScrolledWindow* _tmp4_;
	GtkAdjustment* _tmp5_;
	GtkAdjustment* _tmp6_;
	GtkScrolledWindow* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (row != NULL);
	gtk_widget_get_allocation ((GtkWidget*) row, &_tmp0_);
	allocation = _tmp0_;
	_tmp1_ = allocation;
	y = _tmp1_.y;
	_tmp2_ = allocation;
	height = _tmp2_.height;
	_tmp3_ = self->priv->scrolled_window;
	gtk_scrolled_window_set_kinetic_scrolling (_tmp3_, FALSE);
	_tmp4_ = self->priv->scrolled_window;
	_tmp5_ = gtk_scrolled_window_get_vadjustment (_tmp4_);
	_tmp6_ = _tmp5_;
	gtk_adjustment_clamp_page (_tmp6_, (gdouble) y, (gdouble) (y + height));
	_tmp7_ = self->priv->scrolled_window;
	gtk_scrolled_window_set_kinetic_scrolling (_tmp7_, TRUE);
}

static void
games_snapshots_list_on_rename_entry_activated (GamesSnapshotsList* self)
{
	g_return_if_fail (self != NULL);
	if (games_snapshots_list_check_rename_is_valid (self)) {
		games_snapshots_list_apply_rename (self);
	}
}

static void
_games_snapshots_list_on_rename_entry_activated_gtk_entry_activate (GtkEntry* _sender,
                                                                    gpointer self)
{
	games_snapshots_list_on_rename_entry_activated ((GamesSnapshotsList*) self);
}

static void
games_snapshots_list_on_rename_entry_text_changed (GamesSnapshotsList* self)
{
	g_return_if_fail (self != NULL);
	games_snapshots_list_check_rename_is_valid (self);
}

static void
_games_snapshots_list_on_rename_entry_text_changed_g_object_notify (GObject* _sender,
                                                                    GParamSpec* pspec,
                                                                    gpointer self)
{
	games_snapshots_list_on_rename_entry_text_changed ((GamesSnapshotsList*) self);
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static gboolean
games_snapshots_list_check_rename_is_valid (GamesSnapshotsList* self)
{
	gchar* entry_text = NULL;
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	const gchar* _tmp5_;
	GtkListBox* _tmp11_;
	GList* _tmp12_;
	GtkEntry* _tmp31_;
	GtkStyleContext* _tmp32_;
	GtkButton* _tmp33_;
	GtkLabel* _tmp34_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->rename_entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_strip (_tmp2_);
	entry_text = _tmp3_;
	_tmp5_ = entry_text;
	if (g_strcmp0 (_tmp5_, _ ("Autosave")) == 0) {
		_tmp4_ = TRUE;
	} else {
		const gchar* _tmp6_;
		_tmp6_ = entry_text;
		_tmp4_ = g_strcmp0 (_tmp6_, "") == 0;
	}
	if (_tmp4_) {
		GtkEntry* _tmp7_;
		GtkStyleContext* _tmp8_;
		GtkButton* _tmp9_;
		GtkLabel* _tmp10_;
		_tmp7_ = self->priv->rename_entry;
		_tmp8_ = gtk_widget_get_style_context ((GtkWidget*) _tmp7_);
		gtk_style_context_add_class (_tmp8_, "error");
		_tmp9_ = self->priv->rename_popover_btn;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp9_, FALSE);
		_tmp10_ = self->priv->rename_error_label;
		gtk_label_set_label (_tmp10_, _ ("Invalid name"));
		result = FALSE;
		_g_free0 (entry_text);
		return result;
	}
	_tmp11_ = self->priv->list_box;
	_tmp12_ = gtk_container_get_children ((GtkContainer*) _tmp11_);
	{
		GList* list_child_collection = NULL;
		GList* list_child_it = NULL;
		list_child_collection = _tmp12_;
		for (list_child_it = list_child_collection; list_child_it != NULL; list_child_it = list_child_it->next) {
			GtkWidget* list_child = NULL;
			list_child = (GtkWidget*) list_child_it->data;
			{
				GtkWidget* _tmp13_;
				GamesSnapshotRow* snapshot_row = NULL;
				GtkWidget* _tmp14_;
				GamesSnapshotRow* _tmp15_;
				GamesSnapshot* snapshot = NULL;
				GamesSnapshotRow* _tmp16_;
				GamesSnapshot* _tmp17_;
				GamesSnapshot* _tmp18_;
				GamesSnapshot* _tmp19_;
				GamesSnapshot* _tmp20_;
				gboolean _tmp21_;
				gboolean _tmp22_;
				GamesSnapshot* _tmp23_;
				const gchar* _tmp24_;
				const gchar* _tmp25_;
				const gchar* _tmp26_;
				_tmp13_ = list_child;
				if (!GAMES_IS_SNAPSHOT_ROW (_tmp13_)) {
					continue;
				}
				_tmp14_ = list_child;
				_tmp15_ = _g_object_ref0 (GAMES_IS_SNAPSHOT_ROW (_tmp14_) ? ((GamesSnapshotRow*) _tmp14_) : NULL);
				snapshot_row = _tmp15_;
				_tmp16_ = snapshot_row;
				_tmp17_ = games_snapshot_row_get_snapshot (_tmp16_);
				_tmp18_ = _tmp17_;
				_tmp19_ = _g_object_ref0 (_tmp18_);
				snapshot = _tmp19_;
				_tmp20_ = snapshot;
				_tmp21_ = games_snapshot_get_is_automatic (_tmp20_);
				_tmp22_ = _tmp21_;
				if (_tmp22_) {
					_g_object_unref0 (snapshot);
					_g_object_unref0 (snapshot_row);
					continue;
				}
				_tmp23_ = snapshot;
				_tmp24_ = games_snapshot_get_name (_tmp23_);
				_tmp25_ = _tmp24_;
				_tmp26_ = entry_text;
				if (g_strcmp0 (_tmp25_, _tmp26_) == 0) {
					GtkEntry* _tmp27_;
					GtkStyleContext* _tmp28_;
					GtkButton* _tmp29_;
					GtkLabel* _tmp30_;
					_tmp27_ = self->priv->rename_entry;
					_tmp28_ = gtk_widget_get_style_context ((GtkWidget*) _tmp27_);
					gtk_style_context_add_class (_tmp28_, "error");
					_tmp29_ = self->priv->rename_popover_btn;
					gtk_widget_set_sensitive ((GtkWidget*) _tmp29_, FALSE);
					_tmp30_ = self->priv->rename_error_label;
					gtk_label_set_label (_tmp30_, _ ("A snapshot with this name already exists"));
					result = FALSE;
					_g_object_unref0 (snapshot);
					_g_object_unref0 (snapshot_row);
					(list_child_collection == NULL) ? NULL : (list_child_collection = (g_list_free (list_child_collection), NULL));
					_g_free0 (entry_text);
					return result;
				}
				_g_object_unref0 (snapshot);
				_g_object_unref0 (snapshot_row);
			}
		}
		(list_child_collection == NULL) ? NULL : (list_child_collection = (g_list_free (list_child_collection), NULL));
	}
	_tmp31_ = self->priv->rename_entry;
	_tmp32_ = gtk_widget_get_style_context ((GtkWidget*) _tmp31_);
	gtk_style_context_remove_class (_tmp32_, "error");
	_tmp33_ = self->priv->rename_popover_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp33_, TRUE);
	_tmp34_ = self->priv->rename_error_label;
	gtk_label_set_label (_tmp34_, "");
	result = TRUE;
	_g_free0 (entry_text);
	return result;
}

static void
games_snapshots_list_apply_rename (GamesSnapshotsList* self)
{
	GtkListBoxRow* selected_row = NULL;
	GtkListBox* _tmp0_;
	GtkListBoxRow* _tmp1_;
	GtkListBoxRow* _tmp2_;
	GamesSnapshotRow* snapshot_row = NULL;
	GamesSnapshotRow* _tmp3_;
	GtkEntry* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GtkPopover* _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->list_box;
	_tmp1_ = gtk_list_box_get_selected_row (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	selected_row = _tmp2_;
	_tmp3_ = _g_object_ref0 (GAMES_IS_SNAPSHOT_ROW (selected_row) ? ((GamesSnapshotRow*) selected_row) : NULL);
	snapshot_row = _tmp3_;
	_tmp4_ = self->priv->rename_entry;
	_tmp5_ = gtk_entry_get_text (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = string_strip (_tmp6_);
	_tmp8_ = _tmp7_;
	games_snapshot_row_set_name (snapshot_row, _tmp8_);
	_g_free0 (_tmp8_);
	_tmp9_ = self->priv->rename_popover;
	gtk_popover_popdown (_tmp9_);
	_g_object_unref0 (snapshot_row);
	_g_object_unref0 (selected_row);
}

static void
_games_snapshots_list_apply_rename_gtk_button_clicked (GtkButton* _sender,
                                                       gpointer self)
{
	games_snapshots_list_apply_rename ((GamesSnapshotsList*) self);
}

static void
games_snapshots_list_update_header (GamesSnapshotsList* self,
                                    GtkListBoxRow* row,
                                    GtkListBoxRow* before)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (row != NULL);
	if (before != NULL) {
		GtkWidget* _tmp1_;
		_tmp1_ = gtk_list_box_row_get_header (row);
		_tmp0_ = _tmp1_ == NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GtkSeparator* separator = NULL;
		GtkSeparator* _tmp2_;
		GtkSeparator* _tmp3_;
		_tmp2_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
		g_object_ref_sink (_tmp2_);
		separator = _tmp2_;
		_tmp3_ = separator;
		gtk_list_box_row_set_header (row, (GtkWidget*) _tmp3_);
		_g_object_unref0 (separator);
	}
}

static GSimpleAction*
games_snapshots_list_lookup_action (GamesSnapshotsList* self,
                                    const gchar* name)
{
	GActionMap* group = NULL;
	GActionGroup* _tmp0_;
	GActionMap* _tmp1_;
	GAction* action = NULL;
	GAction* _tmp2_;
	GAction* _tmp3_;
	GSimpleAction* _tmp4_;
	GSimpleAction* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = gtk_widget_get_action_group ((GtkWidget*) self, "display");
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, g_action_map_get_type ()) ? ((GActionMap*) _tmp0_) : NULL);
	group = _tmp1_;
	_vala_assert (group != NULL, "group != null");
	_tmp2_ = g_action_map_lookup_action (group, name);
	_tmp3_ = _g_object_ref0 (_tmp2_);
	action = _tmp3_;
	_vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (action, g_simple_action_get_type ()), "action is SimpleAction");
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (action, g_simple_action_get_type ()) ? ((GSimpleAction*) action) : NULL);
	result = _tmp4_;
	_g_object_unref0 (action);
	_g_object_unref0 (group);
	return result;
}

static void
games_snapshots_list_select_snapshot_row (GamesSnapshotsList* self,
                                          GtkListBoxRow* row)
{
	GtkListBox* _tmp0_;
	GtkButton* _tmp19_;
	GamesSnapshot* _tmp20_;
	gboolean _tmp21_ = FALSE;
	GamesSnapshot* _tmp22_;
	GtkButton* _tmp26_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->list_box;
	gtk_list_box_select_row (_tmp0_, row);
	if (row == NULL) {
		GamesRunner* _tmp1_;
		GSimpleAction* _tmp2_;
		GSimpleAction* _tmp3_;
		_tmp1_ = self->priv->_runner;
		games_runner_preview_current_state (_tmp1_);
		_g_object_unref0 (self->priv->selected_snapshot);
		self->priv->selected_snapshot = NULL;
		_tmp2_ = games_snapshots_list_lookup_action (self, "load-snapshot");
		_tmp3_ = _tmp2_;
		g_simple_action_set_enabled (_tmp3_, FALSE);
		_g_object_unref0 (_tmp3_);
	} else {
		GamesSnapshotRow* snapshot_row = NULL;
		GamesSnapshotRow* _tmp4_;
		GamesSnapshot* snapshot = NULL;
		GamesSnapshotRow* _tmp5_;
		GamesSnapshot* _tmp6_;
		GamesSnapshot* _tmp7_;
		GamesSnapshot* _tmp8_;
		GamesSnapshot* _tmp9_;
		GamesSnapshot* _tmp10_;
		GamesRunner* _tmp13_;
		GamesSnapshot* _tmp14_;
		GamesSnapshot* _tmp15_;
		GamesSnapshot* _tmp16_;
		GSimpleAction* _tmp17_;
		GSimpleAction* _tmp18_;
		gtk_widget_grab_focus ((GtkWidget*) row);
		if (!GAMES_IS_SNAPSHOT_ROW (row)) {
			return;
		}
		_tmp4_ = _g_object_ref0 (GAMES_IS_SNAPSHOT_ROW (row) ? ((GamesSnapshotRow*) row) : NULL);
		snapshot_row = _tmp4_;
		_tmp5_ = snapshot_row;
		_tmp6_ = games_snapshot_row_get_snapshot (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = _g_object_ref0 (_tmp7_);
		snapshot = _tmp8_;
		_tmp9_ = snapshot;
		_tmp10_ = self->priv->selected_snapshot;
		if (_tmp9_ == _tmp10_) {
			GSimpleAction* _tmp11_;
			GSimpleAction* _tmp12_;
			_tmp11_ = games_snapshots_list_lookup_action (self, "load-snapshot");
			_tmp12_ = _tmp11_;
			g_signal_emit_by_name (_tmp12_, "activate", NULL);
			_g_object_unref0 (_tmp12_);
			_g_object_unref0 (snapshot);
			_g_object_unref0 (snapshot_row);
			return;
		}
		_tmp13_ = self->priv->_runner;
		_tmp14_ = snapshot;
		games_runner_preview_snapshot (_tmp13_, _tmp14_);
		_tmp15_ = snapshot;
		_tmp16_ = _g_object_ref0 (_tmp15_);
		_g_object_unref0 (self->priv->selected_snapshot);
		self->priv->selected_snapshot = _tmp16_;
		_tmp17_ = games_snapshots_list_lookup_action (self, "load-snapshot");
		_tmp18_ = _tmp17_;
		g_simple_action_set_enabled (_tmp18_, TRUE);
		_g_object_unref0 (_tmp18_);
		_g_object_unref0 (snapshot);
		_g_object_unref0 (snapshot_row);
	}
	_tmp19_ = self->priv->delete_btn;
	_tmp20_ = self->priv->selected_snapshot;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp19_, _tmp20_ != NULL);
	_tmp22_ = self->priv->selected_snapshot;
	if (_tmp22_ != NULL) {
		GamesSnapshot* _tmp23_;
		gboolean _tmp24_;
		gboolean _tmp25_;
		_tmp23_ = self->priv->selected_snapshot;
		_tmp24_ = games_snapshot_get_is_automatic (_tmp23_);
		_tmp25_ = _tmp24_;
		_tmp21_ = !_tmp25_;
	} else {
		_tmp21_ = FALSE;
	}
	_tmp26_ = self->priv->rename_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp26_, _tmp21_);
}

gboolean
games_snapshots_list_on_key_press_event (GamesSnapshotsList* self,
                                         guint keyval,
                                         GdkModifierType state)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (keyval == GDK_KEY_Delete) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = keyval == GDK_KEY_KP_Delete;
	}
	if (_tmp0_) {
		games_snapshots_list_on_delete_clicked (self);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

GamesSnapshotsList*
games_snapshots_list_construct (GType object_type)
{
	GamesSnapshotsList * self = NULL;
	self = (GamesSnapshotsList*) g_object_new (object_type, NULL);
	return self;
}

GamesSnapshotsList*
games_snapshots_list_new (void)
{
	return games_snapshots_list_construct (GAMES_TYPE_SNAPSHOTS_LIST);
}

gboolean
games_snapshots_list_get_is_revealed (GamesSnapshotsList* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_revealed;
	return result;
}

void
games_snapshots_list_set_is_revealed (GamesSnapshotsList* self,
                                      gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = games_snapshots_list_get_is_revealed (self);
	if (old_value != value) {
		self->priv->_is_revealed = value;
		g_object_notify_by_pspec ((GObject *) self, games_snapshots_list_properties[GAMES_SNAPSHOTS_LIST_IS_REVEALED_PROPERTY]);
	}
}

GamesRunner*
games_snapshots_list_get_runner (GamesSnapshotsList* self)
{
	GamesRunner* result;
	GamesRunner* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_runner;
	result = _tmp0_;
	return result;
}

void
games_snapshots_list_set_runner (GamesSnapshotsList* self,
                                 GamesRunner* value)
{
	GamesRunner* old_value;
	g_return_if_fail (self != NULL);
	old_value = games_snapshots_list_get_runner (self);
	if (old_value != value) {
		GamesRunner* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_runner);
		self->priv->_runner = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, games_snapshots_list_properties[GAMES_SNAPSHOTS_LIST_RUNNER_PROPERTY]);
	}
}

static void
_games_snapshots_list_update_header_gtk_list_box_update_header_func (GtkListBoxRow* row,
                                                                     GtkListBoxRow* before,
                                                                     gpointer self)
{
	games_snapshots_list_update_header ((GamesSnapshotsList*) self, row, before);
}

static GObject *
games_snapshots_list_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GamesSnapshotsList * self;
	GtkListBox* _tmp0_;
	parent_class = G_OBJECT_CLASS (games_snapshots_list_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_SNAPSHOTS_LIST, GamesSnapshotsList);
	_tmp0_ = self->priv->list_box;
	gtk_list_box_set_header_func (_tmp0_, _games_snapshots_list_update_header_gtk_list_box_update_header_func, g_object_ref (self), g_object_unref);
	return obj;
}

static void
games_snapshots_list_class_init (GamesSnapshotsListClass * klass,
                                 gpointer klass_data)
{
	games_snapshots_list_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesSnapshotsList_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_games_snapshots_list_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_snapshots_list_set_property;
	G_OBJECT_CLASS (klass)->constructor = games_snapshots_list_constructor;
	G_OBJECT_CLASS (klass)->finalize = games_snapshots_list_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_SNAPSHOTS_LIST_IS_REVEALED_PROPERTY, games_snapshots_list_properties[GAMES_SNAPSHOTS_LIST_IS_REVEALED_PROPERTY] = g_param_spec_boolean ("is-revealed", "is-revealed", "is-revealed", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_SNAPSHOTS_LIST_RUNNER_PROPERTY, games_snapshots_list_properties[GAMES_SNAPSHOTS_LIST_RUNNER_PROPERTY] = g_param_spec_object ("runner", "runner", "runner", GAMES_TYPE_RUNNER, 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/snapshots-list.ui");
	games_snapshots_list_signals[GAMES_SNAPSHOTS_LIST_HIDDEN_SIGNAL] = g_signal_new ("hidden", GAMES_TYPE_SNAPSHOTS_LIST, 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), "list_box", FALSE, GamesSnapshotsList_private_offset + G_STRUCT_OFFSET (GamesSnapshotsListPrivate, list_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "new_snapshot_row", FALSE, GamesSnapshotsList_private_offset + G_STRUCT_OFFSET (GamesSnapshotsListPrivate, new_snapshot_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "scrolled_window", FALSE, GamesSnapshotsList_private_offset + G_STRUCT_OFFSET (GamesSnapshotsListPrivate, scrolled_window));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "delete_btn", FALSE, GamesSnapshotsList_private_offset + G_STRUCT_OFFSET (GamesSnapshotsListPrivate, delete_btn));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "rename_btn", FALSE, GamesSnapshotsList_private_offset + G_STRUCT_OFFSET (GamesSnapshotsListPrivate, rename_btn));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "rename_popover", FALSE, GamesSnapshotsList_private_offset + G_STRUCT_OFFSET (GamesSnapshotsListPrivate, rename_popover));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "rename_entry", FALSE, GamesSnapshotsList_private_offset + G_STRUCT_OFFSET (GamesSnapshotsListPrivate, rename_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "rename_popover_btn", FALSE, GamesSnapshotsList_private_offset + G_STRUCT_OFFSET (GamesSnapshotsListPrivate, rename_popover_btn));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "rename_error_label", FALSE, GamesSnapshotsList_private_offset + G_STRUCT_OFFSET (GamesSnapshotsListPrivate, rename_error_label));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_move_cursor", G_CALLBACK(_games_snapshots_list_on_move_cursor_gtk_list_box_move_cursor));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_row_activated", G_CALLBACK(_games_snapshots_list_on_row_activated_gtk_list_box_row_activated));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_revealed_changed", G_CALLBACK(_games_snapshots_list_on_revealed_changed_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_revealer_transition_end", G_CALLBACK(_games_snapshots_list_on_revealer_transition_end_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_delete_clicked", G_CALLBACK(_games_snapshots_list_on_delete_clicked_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_rename_clicked", G_CALLBACK(_games_snapshots_list_on_rename_clicked_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_rename_entry_activated", G_CALLBACK(_games_snapshots_list_on_rename_entry_activated_gtk_entry_activate));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_rename_entry_text_changed", G_CALLBACK(_games_snapshots_list_on_rename_entry_text_changed_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "apply_rename", G_CALLBACK(_games_snapshots_list_apply_rename_gtk_button_clicked));
}

static void
games_snapshots_list_instance_init (GamesSnapshotsList * self,
                                    gpointer klass)
{
	self->priv = games_snapshots_list_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
games_snapshots_list_finalize (GObject * obj)
{
	GamesSnapshotsList * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_SNAPSHOTS_LIST, GamesSnapshotsList);
	_g_object_unref0 (self->priv->selected_snapshot);
	_g_object_unref0 (self->priv->_runner);
	G_OBJECT_CLASS (games_snapshots_list_parent_class)->finalize (obj);
}

static GType
games_snapshots_list_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesSnapshotsListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_snapshots_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesSnapshotsList), 0, (GInstanceInitFunc) games_snapshots_list_instance_init, NULL };
	GType games_snapshots_list_type_id;
	games_snapshots_list_type_id = g_type_register_static (gtk_box_get_type (), "GamesSnapshotsList", &g_define_type_info, 0);
	GamesSnapshotsList_private_offset = g_type_add_instance_private (games_snapshots_list_type_id, sizeof (GamesSnapshotsListPrivate));
	return games_snapshots_list_type_id;
}

GType
games_snapshots_list_get_type (void)
{
	static volatile gsize games_snapshots_list_type_id__once = 0;
	if (g_once_init_enter (&games_snapshots_list_type_id__once)) {
		GType games_snapshots_list_type_id;
		games_snapshots_list_type_id = games_snapshots_list_get_type_once ();
		g_once_init_leave (&games_snapshots_list_type_id__once, games_snapshots_list_type_id);
	}
	return games_snapshots_list_type_id__once;
}

static void
_vala_games_snapshots_list_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	GamesSnapshotsList * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_SNAPSHOTS_LIST, GamesSnapshotsList);
	switch (property_id) {
		case GAMES_SNAPSHOTS_LIST_IS_REVEALED_PROPERTY:
		g_value_set_boolean (value, games_snapshots_list_get_is_revealed (self));
		break;
		case GAMES_SNAPSHOTS_LIST_RUNNER_PROPERTY:
		g_value_set_object (value, games_snapshots_list_get_runner (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_games_snapshots_list_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	GamesSnapshotsList * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_SNAPSHOTS_LIST, GamesSnapshotsList);
	switch (property_id) {
		case GAMES_SNAPSHOTS_LIST_IS_REVEALED_PROPERTY:
		games_snapshots_list_set_is_revealed (self, g_value_get_boolean (value));
		break;
		case GAMES_SNAPSHOTS_LIST_RUNNER_PROPERTY:
		games_snapshots_list_set_runner (self, g_value_get_object (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;
}

