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

/* This file is part of GNOME Boxes. License: LGPLv2+*/

#include <handy.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <libvirt-gobject/libvirt-gobject.h>
#include <libvirt-gconfig/libvirt-gconfig.h>
#include <glib/gi18n-lib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define BOXES_TYPE_SNAPSHOTS_PAGE (boxes_snapshots_page_get_type ())
#define BOXES_SNAPSHOTS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_SNAPSHOTS_PAGE, BoxesSnapshotsPage))
#define BOXES_SNAPSHOTS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_SNAPSHOTS_PAGE, BoxesSnapshotsPageClass))
#define BOXES_IS_SNAPSHOTS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_SNAPSHOTS_PAGE))
#define BOXES_IS_SNAPSHOTS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_SNAPSHOTS_PAGE))
#define BOXES_SNAPSHOTS_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_SNAPSHOTS_PAGE, BoxesSnapshotsPageClass))

typedef struct _BoxesSnapshotsPage BoxesSnapshotsPage;
typedef struct _BoxesSnapshotsPageClass BoxesSnapshotsPageClass;
typedef struct _BoxesSnapshotsPagePrivate BoxesSnapshotsPagePrivate;

#define BOXES_TYPE_COLLECTION_ITEM (boxes_collection_item_get_type ())
#define BOXES_COLLECTION_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItem))
#define BOXES_COLLECTION_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItemClass))
#define BOXES_IS_COLLECTION_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_COLLECTION_ITEM))
#define BOXES_IS_COLLECTION_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_COLLECTION_ITEM))
#define BOXES_COLLECTION_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItemClass))

typedef struct _BoxesCollectionItem BoxesCollectionItem;
typedef struct _BoxesCollectionItemClass BoxesCollectionItemClass;

#define BOXES_TYPE_MACHINE (boxes_machine_get_type ())
#define BOXES_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_MACHINE, BoxesMachine))
#define BOXES_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_MACHINE, BoxesMachineClass))
#define BOXES_IS_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_MACHINE))
#define BOXES_IS_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_MACHINE))
#define BOXES_MACHINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_MACHINE, BoxesMachineClass))

typedef struct _BoxesMachine BoxesMachine;
typedef struct _BoxesMachineClass BoxesMachineClass;

#define BOXES_TYPE_LIBVIRT_MACHINE (boxes_libvirt_machine_get_type ())
#define BOXES_LIBVIRT_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_LIBVIRT_MACHINE, BoxesLibvirtMachine))
#define BOXES_LIBVIRT_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_LIBVIRT_MACHINE, BoxesLibvirtMachineClass))
#define BOXES_IS_LIBVIRT_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_LIBVIRT_MACHINE))
#define BOXES_IS_LIBVIRT_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_LIBVIRT_MACHINE))
#define BOXES_LIBVIRT_MACHINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_LIBVIRT_MACHINE, BoxesLibvirtMachineClass))

typedef struct _BoxesLibvirtMachine BoxesLibvirtMachine;
typedef struct _BoxesLibvirtMachineClass BoxesLibvirtMachineClass;

#define BOXES_TYPE_TOAST_OVERLAY (boxes_toast_overlay_get_type ())
#define BOXES_TOAST_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_TOAST_OVERLAY, BoxesToastOverlay))
#define BOXES_TOAST_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_TOAST_OVERLAY, BoxesToastOverlayClass))
#define BOXES_IS_TOAST_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_TOAST_OVERLAY))
#define BOXES_IS_TOAST_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_TOAST_OVERLAY))
#define BOXES_TOAST_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_TOAST_OVERLAY, BoxesToastOverlayClass))

typedef struct _BoxesToastOverlay BoxesToastOverlay;
typedef struct _BoxesToastOverlayClass BoxesToastOverlayClass;
enum  {
	BOXES_SNAPSHOTS_PAGE_0_PROPERTY,
	BOXES_SNAPSHOTS_PAGE_NUM_PROPERTIES
};
static GParamSpec* boxes_snapshots_page_properties[BOXES_SNAPSHOTS_PAGE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define BOXES_TYPE_SNAPSHOT_LIST_ROW (boxes_snapshot_list_row_get_type ())
#define BOXES_SNAPSHOT_LIST_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_SNAPSHOT_LIST_ROW, BoxesSnapshotListRow))
#define BOXES_SNAPSHOT_LIST_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_SNAPSHOT_LIST_ROW, BoxesSnapshotListRowClass))
#define BOXES_IS_SNAPSHOT_LIST_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_SNAPSHOT_LIST_ROW))
#define BOXES_IS_SNAPSHOT_LIST_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_SNAPSHOT_LIST_ROW))
#define BOXES_SNAPSHOT_LIST_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_SNAPSHOT_LIST_ROW, BoxesSnapshotListRowClass))

typedef struct _BoxesSnapshotListRow BoxesSnapshotListRow;
typedef struct _BoxesSnapshotListRowClass BoxesSnapshotListRowClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _BoxesSnapshotsPageFetchSnapshotsData BoxesSnapshotsPageFetchSnapshotsData;

#define BOXES_TYPE_TOAST (boxes_toast_get_type ())
#define BOXES_TOAST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_TOAST, BoxesToast))
#define BOXES_TOAST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_TOAST, BoxesToastClass))
#define BOXES_IS_TOAST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_TOAST))
#define BOXES_IS_TOAST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_TOAST))
#define BOXES_TOAST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_TOAST, BoxesToastClass))

typedef struct _BoxesToast BoxesToast;
typedef struct _BoxesToastClass BoxesToastClass;
typedef struct _BoxesSnapshotListRowPrivate BoxesSnapshotListRowPrivate;
typedef enum  {
	BOXES_MACHINE_MACHINE_STATE_UNKNOWN,
	BOXES_MACHINE_MACHINE_STATE_STOPPED,
	BOXES_MACHINE_MACHINE_STATE_FORCE_STOPPED,
	BOXES_MACHINE_MACHINE_STATE_RUNNING,
	BOXES_MACHINE_MACHINE_STATE_PAUSED,
	BOXES_MACHINE_MACHINE_STATE_SAVED,
	BOXES_MACHINE_MACHINE_STATE_SLEEPING
} BoxesMachineMachineState;

#define BOXES_MACHINE_TYPE_MACHINE_STATE (boxes_machine_machine_state_get_type ())
typedef struct _BoxesSnapshotsPageCreateSnapshotData BoxesSnapshotsPageCreateSnapshotData;

struct _BoxesSnapshotsPage {
	HdyPreferencesPage parent_instance;
	BoxesSnapshotsPagePrivate * priv;
};

struct _BoxesSnapshotsPageClass {
	HdyPreferencesPageClass parent_class;
};

struct _BoxesSnapshotsPagePrivate {
	BoxesLibvirtMachine* machine;
	BoxesToastOverlay* toast_overlay;
	HdyPreferencesGroup* preferences_group;
	GtkStack* stack;
	GtkListBox* listbox;
	GtkBox* activity_page;
	GtkLabel* activity_label;
	GtkButton* add_button;
	GCancellable* fetch_snapshots_cancellable;
};

struct _BoxesSnapshotsPageFetchSnapshotsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesSnapshotsPage* self;
	BoxesLibvirtMachine* _tmp0_;
	GVirDomain* _tmp1_;
	GVirDomain* _tmp2_;
	GCancellable* _tmp3_;
	GList* snapshots;
	BoxesLibvirtMachine* _tmp4_;
	GVirDomain* _tmp5_;
	GVirDomain* _tmp6_;
	GList* _tmp7_;
	GList* _tmp8_;
	GList* snapshot_collection;
	GList* snapshot_it;
	GVirDomainSnapshot* _tmp9_;
	GVirDomainSnapshot* snapshot;
	GtkListBox* _tmp10_;
	GVirDomainSnapshot* _tmp11_;
	BoxesSnapshotListRow* _tmp12_;
	BoxesSnapshotListRow* _tmp13_;
	GError* e;
	GError* _tmp14_;
	const gchar* _tmp15_;
	GError* _inner_error0_;
};

struct _BoxesSnapshotListRow {
	HdyActionRow parent_instance;
	BoxesSnapshotListRowPrivate * priv;
	GVirDomainSnapshot* snapshot;
};

struct _BoxesSnapshotListRowClass {
	HdyActionRowClass parent_class;
};

struct _BoxesSnapshotsPageCreateSnapshotData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesSnapshotsPage* self;
	BoxesLibvirtMachine* _tmp0_;
	BoxesMachineMachineState _tmp1_;
	BoxesMachineMachineState _tmp2_;
	GVirDomainSnapshot* new_snapshot;
	BoxesLibvirtMachine* _tmp3_;
	GVirDomainSnapshot* _tmp4_;
	GtkListBox* _tmp5_;
	BoxesSnapshotListRow* _tmp6_;
	BoxesSnapshotListRow* _tmp7_;
	GError* e;
	gchar* msg;
	BoxesLibvirtMachine* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	GError* _tmp12_;
	const gchar* _tmp13_;
	BoxesToastOverlay* _tmp14_;
	const gchar* _tmp15_;
	BoxesToast* _tmp16_;
	BoxesToast* _tmp17_;
	GError* _inner_error0_;
};

static gint BoxesSnapshotsPage_private_offset;
static gpointer boxes_snapshots_page_parent_class = NULL;

VALA_EXTERN GType boxes_snapshots_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesSnapshotsPage, g_object_unref)
VALA_EXTERN GType boxes_collection_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesCollectionItem, g_object_unref)
VALA_EXTERN GType boxes_machine_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesMachine, g_object_unref)
VALA_EXTERN GType boxes_libvirt_machine_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesLibvirtMachine, g_object_unref)
VALA_EXTERN GType boxes_toast_overlay_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesToastOverlay, g_object_unref)
VALA_EXTERN void boxes_snapshots_page_setup (BoxesSnapshotsPage* self,
                                 BoxesLibvirtMachine* machine);
static gint boxes_snapshots_page_config_sort_func (BoxesSnapshotsPage* self,
                                            GtkListBoxRow* row1,
                                            GtkListBoxRow* row2);
static gint _boxes_snapshots_page_config_sort_func_gtk_list_box_sort_func (GtkListBoxRow* row1,
                                                                    GtkListBoxRow* row2,
                                                                    gpointer self);
static void __lambda86_ (BoxesSnapshotsPage* self);
static void ___lambda86__gtk_widget_destroy (GtkWidget* _sender,
                                      gpointer self);
static void boxes_snapshots_page_fetch_snapshots (BoxesSnapshotsPage* self,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static void boxes_snapshots_page_fetch_snapshots_finish (BoxesSnapshotsPage* self,
                                                  GAsyncResult* _res_);
static void boxes_snapshots_page_create_snapshot (BoxesSnapshotsPage* self,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static void boxes_snapshots_page_create_snapshot_finish (BoxesSnapshotsPage* self,
                                                  GAsyncResult* _res_);
static void _boxes_snapshots_page_create_snapshot_gtk_button_clicked (GtkButton* _sender,
                                                               gpointer self);
static void boxes_snapshots_page_update_snapshot_stack_page (BoxesSnapshotsPage* self);
static void boxes_snapshots_page_fetch_snapshots_data_free (gpointer _data);
static gboolean boxes_snapshots_page_fetch_snapshots_co (BoxesSnapshotsPageFetchSnapshotsData* _data_);
VALA_EXTERN GVirDomain* boxes_libvirt_machine_get_domain (BoxesLibvirtMachine* self);
static void boxes_snapshots_page_fetch_snapshots_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
VALA_EXTERN GType boxes_snapshot_list_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesSnapshotListRow, g_object_unref)
static BoxesSnapshotListRow* boxes_snapshots_page_create_snapshot_row (BoxesSnapshotsPage* self,
                                                                GVirDomainSnapshot* snapshot);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
VALA_EXTERN BoxesSnapshotListRow* boxes_snapshot_list_row_new (GVirDomainSnapshot* snapshot,
                                                   BoxesLibvirtMachine* machine);
VALA_EXTERN BoxesSnapshotListRow* boxes_snapshot_list_row_construct (GType object_type,
                                                         GVirDomainSnapshot* snapshot,
                                                         BoxesLibvirtMachine* machine);
static void boxes_snapshots_page_row_activity_changed (BoxesSnapshotsPage* self,
                                                GObject* source,
                                                GParamSpec* param_spec);
static void _boxes_snapshots_page_row_activity_changed_g_object_notify (GObject* _sender,
                                                                 GParamSpec* pspec,
                                                                 gpointer self);
VALA_EXTERN GType boxes_toast_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesToast, g_object_unref)
static void __lambda87_ (BoxesSnapshotsPage* self,
                  BoxesToast* toast);
VALA_EXTERN void boxes_toast_overlay_display_toast (BoxesToastOverlay* self,
                                        BoxesToast* toast);
static void ___lambda87__boxes_snapshot_list_row_display_toast (BoxesSnapshotListRow* _sender,
                                                         BoxesToast* toast,
                                                         gpointer self);
static void boxes_snapshots_page_select_row (BoxesSnapshotsPage* self,
                                      BoxesSnapshotListRow* selected_row);
static void _boxes_snapshots_page_select_row_boxes_snapshot_list_row_is_current (BoxesSnapshotListRow* _sender,
                                                                          gpointer self);
static void boxes_snapshots_page_create_snapshot_data_free (gpointer _data);
static gboolean boxes_snapshots_page_create_snapshot_co (BoxesSnapshotsPageCreateSnapshotData* _data_);
VALA_EXTERN GType boxes_machine_machine_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN BoxesMachineMachineState boxes_machine_get_state (BoxesMachine* self);
static void boxes_snapshots_page_set_activity (BoxesSnapshotsPage* self,
                                        const gchar* value);
VALA_EXTERN void boxes_libvirt_machine_create_snapshot (BoxesLibvirtMachine* self,
                                            const gchar* description_prefix,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
VALA_EXTERN GVirDomainSnapshot* boxes_libvirt_machine_create_snapshot_finish (BoxesLibvirtMachine* self,
                                                                  GAsyncResult* _res_,
                                                                  GError** error);
static void boxes_snapshots_page_create_snapshot_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
VALA_EXTERN const gchar* boxes_collection_item_get_name (BoxesCollectionItem* self);
VALA_EXTERN BoxesToast* boxes_toast_new (const gchar* message);
VALA_EXTERN BoxesToast* boxes_toast_construct (GType object_type,
                                   const gchar* message);
VALA_EXTERN const gchar* boxes_snapshot_list_row_get_activity_message (BoxesSnapshotListRow* self);
static void _boxes_snapshots_page_update_snapshot_stack_page_gtk_container_remove (GtkContainer* _sender,
                                                                            GtkWidget* widget,
                                                                            gpointer self);
VALA_EXTERN BoxesSnapshotsPage* boxes_snapshots_page_new (void);
VALA_EXTERN BoxesSnapshotsPage* boxes_snapshots_page_construct (GType object_type);
static void boxes_snapshots_page_finalize (GObject * obj);
static GType boxes_snapshots_page_get_type_once (void);
static void _vala_boxes_snapshots_page_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);

static inline gpointer
boxes_snapshots_page_get_instance_private (BoxesSnapshotsPage* self)
{
	return G_STRUCT_MEMBER_P (self, BoxesSnapshotsPage_private_offset);
}

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

static gint
_boxes_snapshots_page_config_sort_func_gtk_list_box_sort_func (GtkListBoxRow* row1,
                                                               GtkListBoxRow* row2,
                                                               gpointer self)
{
	gint result;
	result = boxes_snapshots_page_config_sort_func ((BoxesSnapshotsPage*) self, row1, row2);
	return result;
}

static void
__lambda86_ (BoxesSnapshotsPage* self)
{
	GCancellable* _tmp0_;
	_tmp0_ = self->priv->fetch_snapshots_cancellable;
	g_cancellable_cancel (_tmp0_);
}

static void
___lambda86__gtk_widget_destroy (GtkWidget* _sender,
                                 gpointer self)
{
	__lambda86_ ((BoxesSnapshotsPage*) self);
}

static void
_boxes_snapshots_page_create_snapshot_gtk_button_clicked (GtkButton* _sender,
                                                          gpointer self)
{
	boxes_snapshots_page_create_snapshot ((BoxesSnapshotsPage*) self, NULL, NULL);
}

void
boxes_snapshots_page_setup (BoxesSnapshotsPage* self,
                            BoxesLibvirtMachine* machine)
{
	BoxesLibvirtMachine* _tmp0_;
	GtkListBox* _tmp1_;
	gchar* _tmp2_;
	GtkImage* _tmp3_ = NULL;
	GtkButton* _tmp4_ = NULL;
	GtkButton* _tmp5_;
	GtkStyleContext* _tmp6_;
	GtkButton* _tmp7_;
	GtkListBox* _tmp8_;
	GtkButton* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (machine != NULL);
	_tmp0_ = _g_object_ref0 (machine);
	_g_object_unref0 (self->priv->machine);
	self->priv->machine = _tmp0_;
	_tmp1_ = self->priv->listbox;
	gtk_list_box_set_sort_func (_tmp1_, _boxes_snapshots_page_config_sort_func_gtk_list_box_sort_func, g_object_ref (self), g_object_unref);
	g_signal_connect_object ((GtkWidget*) self, "destroy", (GCallback) ___lambda86__gtk_widget_destroy, self, 0);
	boxes_snapshots_page_fetch_snapshots (self, NULL, NULL);
	_tmp2_ = g_strdup ("list-add-symbolic");
	_tmp3_ = (GtkImage*) gtk_image_new ();
	gtk_widget_set_visible ((GtkWidget*) _tmp3_, TRUE);
	g_object_set (_tmp3_, "icon-name", _tmp2_, NULL);
	_g_free0 (_tmp2_);
	g_object_ref_sink (_tmp3_);
	_tmp4_ = (GtkButton*) gtk_button_new ();
	gtk_widget_set_visible ((GtkWidget*) _tmp4_, TRUE);
	gtk_button_set_image (_tmp4_, (GtkWidget*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->add_button);
	self->priv->add_button = _tmp4_;
	_tmp5_ = self->priv->add_button;
	_tmp6_ = gtk_widget_get_style_context ((GtkWidget*) _tmp5_);
	gtk_style_context_add_class (_tmp6_, "flat");
	_tmp7_ = self->priv->add_button;
	g_signal_connect_object (_tmp7_, "clicked", (GCallback) _boxes_snapshots_page_create_snapshot_gtk_button_clicked, self, 0);
	_tmp8_ = self->priv->listbox;
	_tmp9_ = self->priv->add_button;
	gtk_container_add ((GtkContainer*) _tmp8_, (GtkWidget*) _tmp9_);
	boxes_snapshots_page_update_snapshot_stack_page (self);
}

static void
boxes_snapshots_page_fetch_snapshots_data_free (gpointer _data)
{
	BoxesSnapshotsPageFetchSnapshotsData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesSnapshotsPageFetchSnapshotsData, _data_);
}

static void
boxes_snapshots_page_fetch_snapshots (BoxesSnapshotsPage* self,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	BoxesSnapshotsPageFetchSnapshotsData* _data_;
	BoxesSnapshotsPage* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (BoxesSnapshotsPageFetchSnapshotsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_snapshots_page_fetch_snapshots_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	boxes_snapshots_page_fetch_snapshots_co (_data_);
}

static void
boxes_snapshots_page_fetch_snapshots_finish (BoxesSnapshotsPage* self,
                                             GAsyncResult* _res_)
{
	BoxesSnapshotsPageFetchSnapshotsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
boxes_snapshots_page_fetch_snapshots_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	BoxesSnapshotsPageFetchSnapshotsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_snapshots_page_fetch_snapshots_co (_data_);
}

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

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

static gboolean
boxes_snapshots_page_fetch_snapshots_co (BoxesSnapshotsPageFetchSnapshotsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->machine;
		_data_->_tmp1_ = boxes_libvirt_machine_get_domain (_data_->_tmp0_);
		_data_->_tmp2_ = _data_->_tmp1_;
		_data_->_tmp3_ = _data_->self->priv->fetch_snapshots_cancellable;
		_data_->_state_ = 1;
		gvir_domain_fetch_snapshots_async (_data_->_tmp2_, (guint) GVIR_DOMAIN_SNAPSHOT_LIST_ALL, _data_->_tmp3_, boxes_snapshots_page_fetch_snapshots_ready, _data_);
		return FALSE;
		_state_1:
		gvir_domain_fetch_snapshots_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp4_ = _data_->self->priv->machine;
		_data_->_tmp5_ = boxes_libvirt_machine_get_domain (_data_->_tmp4_);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp7_ = gvir_domain_get_snapshots (_data_->_tmp6_);
		_data_->snapshots = _data_->_tmp7_;
		_data_->_tmp8_ = _data_->snapshots;
		{
			_data_->snapshot_collection = _data_->_tmp8_;
			for (_data_->snapshot_it = _data_->snapshot_collection; _data_->snapshot_it != NULL; _data_->snapshot_it = _data_->snapshot_it->next) {
				_data_->_tmp9_ = _g_object_ref0 ((GVirDomainSnapshot*) _data_->snapshot_it->data);
				_data_->snapshot = _data_->_tmp9_;
				{
					_data_->_tmp10_ = _data_->self->priv->listbox;
					_data_->_tmp11_ = _data_->snapshot;
					_data_->_tmp12_ = boxes_snapshots_page_create_snapshot_row (_data_->self, _data_->_tmp11_);
					_data_->_tmp13_ = _data_->_tmp12_;
					gtk_container_add ((GtkContainer*) _data_->_tmp10_, (GtkWidget*) _data_->_tmp13_);
					_g_object_unref0 (_data_->_tmp13_);
					_g_object_unref0 (_data_->snapshot);
				}
			}
		}
		(_data_->snapshots == NULL) ? NULL : (_data_->snapshots = (_g_list_free__g_object_unref0_ (_data_->snapshots), NULL));
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp14_ = _data_->e;
		_data_->_tmp15_ = _data_->_tmp14_->message;
		g_warning ("snapshots-page.vala:68: Could not fetch snapshots: %s", _data_->_tmp15_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
_boxes_snapshots_page_row_activity_changed_g_object_notify (GObject* _sender,
                                                            GParamSpec* pspec,
                                                            gpointer self)
{
	boxes_snapshots_page_row_activity_changed ((BoxesSnapshotsPage*) self, _sender, pspec);
}

static void
__lambda87_ (BoxesSnapshotsPage* self,
             BoxesToast* toast)
{
	BoxesToastOverlay* _tmp0_;
	g_return_if_fail (toast != NULL);
	_tmp0_ = self->priv->toast_overlay;
	boxes_toast_overlay_display_toast (_tmp0_, toast);
}

static void
___lambda87__boxes_snapshot_list_row_display_toast (BoxesSnapshotListRow* _sender,
                                                    BoxesToast* toast,
                                                    gpointer self)
{
	__lambda87_ ((BoxesSnapshotsPage*) self, toast);
}

static void
_boxes_snapshots_page_select_row_boxes_snapshot_list_row_is_current (BoxesSnapshotListRow* _sender,
                                                                     gpointer self)
{
	boxes_snapshots_page_select_row ((BoxesSnapshotsPage*) self, _sender);
}

static BoxesSnapshotListRow*
boxes_snapshots_page_create_snapshot_row (BoxesSnapshotsPage* self,
                                          GVirDomainSnapshot* snapshot)
{
	BoxesSnapshotListRow* row = NULL;
	BoxesLibvirtMachine* _tmp0_;
	BoxesSnapshotListRow* _tmp1_;
	GError* _inner_error0_ = NULL;
	BoxesSnapshotListRow* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (snapshot != NULL, NULL);
	_tmp0_ = self->priv->machine;
	_tmp1_ = boxes_snapshot_list_row_new (snapshot, _tmp0_);
	g_object_ref_sink (_tmp1_);
	row = _tmp1_;
	g_signal_connect_object ((GObject*) row, "notify::activity-message", (GCallback) _boxes_snapshots_page_row_activity_changed_g_object_notify, self, 0);
	g_signal_connect_object (row, "display-toast", (GCallback) ___lambda87__boxes_snapshot_list_row_display_toast, self, 0);
	g_signal_connect_object (row, "is-current", (GCallback) _boxes_snapshots_page_select_row_boxes_snapshot_list_row_is_current, self, 0);
	{
		gboolean is_current = FALSE;
		gboolean _tmp2_ = FALSE;
		gboolean _tmp3_ = FALSE;
		gboolean _tmp4_;
		is_current = FALSE;
		_tmp4_ = gvir_domain_snapshot_get_is_current (snapshot, (guint) 0, &_tmp3_, &_inner_error0_);
		is_current = _tmp3_;
		_tmp2_ = _tmp4_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_tmp2_) {
			gtk_list_box_row_set_selectable ((GtkListBoxRow*) row, is_current);
			if (is_current) {
				boxes_snapshots_page_select_row (self, row);
			}
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		const gchar* _tmp5_;
		GError* _tmp6_;
		const gchar* _tmp7_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp5_ = gvir_domain_snapshot_get_name (snapshot);
		_tmp6_ = _error_;
		_tmp7_ = _tmp6_->message;
		g_warning ("snapshots-page.vala:88: Failed to determine whether '%s' is the curren" \
"t snapshot: %s", _tmp5_, _tmp7_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (row);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	result = row;
	return result;
}

static void
boxes_snapshots_page_select_row (BoxesSnapshotsPage* self,
                                 BoxesSnapshotListRow* selected_row)
{
	GtkListBox* _tmp0_;
	GList* _tmp1_;
	GtkListBox* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (selected_row != NULL);
	_tmp0_ = self->priv->listbox;
	_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;
			{
				GtkWidget* _tmp2_;
				_tmp2_ = child;
				if (BOXES_IS_SNAPSHOT_LIST_ROW (_tmp2_)) {
					BoxesSnapshotListRow* row = NULL;
					GtkWidget* _tmp3_;
					BoxesSnapshotListRow* _tmp4_;
					BoxesSnapshotListRow* _tmp5_;
					_tmp3_ = child;
					_tmp4_ = _g_object_ref0 (BOXES_IS_SNAPSHOT_LIST_ROW (_tmp3_) ? ((BoxesSnapshotListRow*) _tmp3_) : NULL);
					row = _tmp4_;
					_tmp5_ = row;
					gtk_list_box_row_set_selectable ((GtkListBoxRow*) _tmp5_, FALSE);
					_g_object_unref0 (row);
				}
			}
		}
		(child_collection == NULL) ? NULL : (child_collection = (g_list_free (child_collection), NULL));
	}
	gtk_list_box_row_set_selectable ((GtkListBoxRow*) selected_row, TRUE);
	_tmp6_ = self->priv->listbox;
	gtk_list_box_select_row (_tmp6_, (GtkListBoxRow*) selected_row);
}

static gint
boxes_snapshots_page_config_sort_func (BoxesSnapshotsPage* self,
                                       GtkListBoxRow* row1,
                                       GtkListBoxRow* row2)
{
	GtkWidget* _tmp0_;
	GtkButton* _tmp1_;
	GtkWidget* _tmp2_;
	GtkButton* _tmp3_;
	gint _tmp16_ = -1;
	GError* _inner_error0_ = NULL;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (row1 != NULL, 0);
	g_return_val_if_fail (row2 != NULL, 0);
	_tmp0_ = gtk_bin_get_child ((GtkBin*) row1);
	_tmp1_ = self->priv->add_button;
	if (_tmp0_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_widget_get_type (), GtkWidget)) {
		result = 1;
		return result;
	}
	_tmp2_ = gtk_bin_get_child ((GtkBin*) row2);
	_tmp3_ = self->priv->add_button;
	if (_tmp2_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, gtk_widget_get_type (), GtkWidget)) {
		result = 1;
		return result;
	}
	{
		BoxesSnapshotListRow* snapshot_row1 = NULL;
		BoxesSnapshotListRow* _tmp4_;
		BoxesSnapshotListRow* snapshot_row2 = NULL;
		BoxesSnapshotListRow* _tmp5_;
		GVirConfigDomainSnapshot* conf1 = NULL;
		BoxesSnapshotListRow* _tmp6_;
		GVirDomainSnapshot* _tmp7_;
		GVirConfigDomainSnapshot* _tmp8_;
		GVirConfigDomainSnapshot* conf2 = NULL;
		BoxesSnapshotListRow* _tmp9_;
		GVirDomainSnapshot* _tmp10_;
		GVirConfigDomainSnapshot* _tmp11_;
		GVirConfigDomainSnapshot* _tmp12_;
		GVirConfigDomainSnapshot* _tmp13_;
		_tmp4_ = _g_object_ref0 (BOXES_IS_SNAPSHOT_LIST_ROW (row1) ? ((BoxesSnapshotListRow*) row1) : NULL);
		snapshot_row1 = _tmp4_;
		_tmp5_ = _g_object_ref0 (BOXES_IS_SNAPSHOT_LIST_ROW (row2) ? ((BoxesSnapshotListRow*) row2) : NULL);
		snapshot_row2 = _tmp5_;
		_tmp6_ = snapshot_row1;
		_tmp7_ = _tmp6_->snapshot;
		_tmp8_ = gvir_domain_snapshot_get_config (_tmp7_, (guint) 0, &_inner_error0_);
		conf1 = _tmp8_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (snapshot_row2);
			_g_object_unref0 (snapshot_row1);
			goto __catch0_g_error;
		}
		_tmp9_ = snapshot_row2;
		_tmp10_ = _tmp9_->snapshot;
		_tmp11_ = gvir_domain_snapshot_get_config (_tmp10_, (guint) 0, &_inner_error0_);
		conf2 = _tmp11_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (conf1);
			_g_object_unref0 (snapshot_row2);
			_g_object_unref0 (snapshot_row1);
			goto __catch0_g_error;
		}
		_tmp12_ = conf1;
		_tmp13_ = conf2;
		if (gvir_config_domain_snapshot_get_creation_time (_tmp12_) < gvir_config_domain_snapshot_get_creation_time (_tmp13_)) {
			result = -1;
			_g_object_unref0 (conf2);
			_g_object_unref0 (conf1);
			_g_object_unref0 (snapshot_row2);
			_g_object_unref0 (snapshot_row1);
			return result;
		} else {
			result = 1;
			_g_object_unref0 (conf2);
			_g_object_unref0 (conf1);
			_g_object_unref0 (snapshot_row2);
			_g_object_unref0 (snapshot_row1);
			return result;
		}
		_g_object_unref0 (conf2);
		_g_object_unref0 (conf1);
		_g_object_unref0 (snapshot_row2);
		_g_object_unref0 (snapshot_row1);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp14_;
		const gchar* _tmp15_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp14_ = e;
		_tmp15_ = _tmp14_->message;
		g_warning ("snapshots-page.vala:125: Failed to fetch snapshot config: %s", _tmp15_);
		result = 0;
		_g_error_free0 (e);
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return _tmp16_;
}

static void
boxes_snapshots_page_create_snapshot_data_free (gpointer _data)
{
	BoxesSnapshotsPageCreateSnapshotData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesSnapshotsPageCreateSnapshotData, _data_);
}

static void
boxes_snapshots_page_create_snapshot (BoxesSnapshotsPage* self,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	BoxesSnapshotsPageCreateSnapshotData* _data_;
	BoxesSnapshotsPage* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (BoxesSnapshotsPageCreateSnapshotData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_snapshots_page_create_snapshot_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	boxes_snapshots_page_create_snapshot_co (_data_);
}

static void
boxes_snapshots_page_create_snapshot_finish (BoxesSnapshotsPage* self,
                                             GAsyncResult* _res_)
{
	BoxesSnapshotsPageCreateSnapshotData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
boxes_snapshots_page_create_snapshot_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	BoxesSnapshotsPageCreateSnapshotData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_snapshots_page_create_snapshot_co (_data_);
}

static gboolean
boxes_snapshots_page_create_snapshot_co (BoxesSnapshotsPageCreateSnapshotData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->machine;
	_data_->_tmp1_ = boxes_machine_get_state ((BoxesMachine*) _data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (_data_->_tmp2_ == BOXES_MACHINE_MACHINE_STATE_RUNNING) {
		boxes_snapshots_page_set_activity (_data_->self, _ ("Creating new snapshot…"));
	}
	{
		_data_->_tmp3_ = _data_->self->priv->machine;
		_data_->_state_ = 1;
		boxes_libvirt_machine_create_snapshot (_data_->_tmp3_, "", boxes_snapshots_page_create_snapshot_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp4_ = boxes_libvirt_machine_create_snapshot_finish (_data_->_tmp3_, _data_->_res_, &_data_->_inner_error0_);
		_data_->new_snapshot = _data_->_tmp4_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp5_ = _data_->self->priv->listbox;
		_data_->_tmp6_ = boxes_snapshots_page_create_snapshot_row (_data_->self, _data_->new_snapshot);
		_data_->_tmp7_ = _data_->_tmp6_;
		gtk_container_add ((GtkContainer*) _data_->_tmp5_, (GtkWidget*) _data_->_tmp7_);
		_g_object_unref0 (_data_->_tmp7_);
		_g_object_unref0 (_data_->new_snapshot);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp8_ = _data_->self->priv->machine;
		_data_->_tmp9_ = boxes_collection_item_get_name ((BoxesCollectionItem*) _data_->_tmp8_);
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp11_ = g_strdup_printf (_ ("Failed to create snapshot of %s"), _data_->_tmp10_);
		_data_->msg = _data_->_tmp11_;
		_data_->_tmp12_ = _data_->e;
		_data_->_tmp13_ = _data_->_tmp12_->message;
		g_warning ("snapshots-page.vala:140: %s", _data_->_tmp13_);
		_data_->_tmp14_ = _data_->self->priv->toast_overlay;
		_data_->_tmp15_ = _data_->msg;
		_data_->_tmp16_ = boxes_toast_new (_data_->_tmp15_);
		g_object_ref_sink (_data_->_tmp16_);
		_data_->_tmp17_ = _data_->_tmp16_;
		boxes_toast_overlay_display_toast (_data_->_tmp14_, _data_->_tmp17_);
		_g_object_unref0 (_data_->_tmp17_);
		_g_free0 (_data_->msg);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	boxes_snapshots_page_set_activity (_data_->self, NULL);
	boxes_snapshots_page_update_snapshot_stack_page (_data_->self);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
boxes_snapshots_page_row_activity_changed (BoxesSnapshotsPage* self,
                                           GObject* source,
                                           GParamSpec* param_spec)
{
	BoxesSnapshotListRow* row = NULL;
	BoxesSnapshotListRow* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	g_return_if_fail (param_spec != NULL);
	_tmp0_ = _g_object_ref0 (BOXES_IS_SNAPSHOT_LIST_ROW (source) ? ((BoxesSnapshotListRow*) source) : NULL);
	row = _tmp0_;
	_tmp1_ = boxes_snapshot_list_row_get_activity_message (row);
	_tmp2_ = _tmp1_;
	boxes_snapshots_page_set_activity (self, _tmp2_);
	_g_object_unref0 (row);
}

static void
boxes_snapshots_page_update_snapshot_stack_page (BoxesSnapshotsPage* self)
{
	guint num_rows = 0U;
	GtkListBox* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	guint _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->listbox;
	_tmp1_ = gtk_container_get_children ((GtkContainer*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_list_length (_tmp2_);
	(_tmp2_ == NULL) ? NULL : (_tmp2_ = (g_list_free (_tmp2_), NULL));
	num_rows = _tmp3_;
	if (num_rows > ((guint) 1)) {
		HdyPreferencesGroup* _tmp4_;
		_tmp4_ = self->priv->preferences_group;
		hdy_preferences_group_set_description (_tmp4_, _ ("Revert to a previous state of your box."));
	} else {
		HdyPreferencesGroup* _tmp5_;
		_tmp5_ = self->priv->preferences_group;
		hdy_preferences_group_set_description (_tmp5_, _ ("Use the button below to create your first snapshot."));
	}
}

static void
_boxes_snapshots_page_update_snapshot_stack_page_gtk_container_remove (GtkContainer* _sender,
                                                                       GtkWidget* widget,
                                                                       gpointer self)
{
	boxes_snapshots_page_update_snapshot_stack_page ((BoxesSnapshotsPage*) self);
}

BoxesSnapshotsPage*
boxes_snapshots_page_construct (GType object_type)
{
	BoxesSnapshotsPage * self = NULL;
	self = (BoxesSnapshotsPage*) g_object_new (object_type, NULL);
	return self;
}

BoxesSnapshotsPage*
boxes_snapshots_page_new (void)
{
	return boxes_snapshots_page_construct (BOXES_TYPE_SNAPSHOTS_PAGE);
}

static void
boxes_snapshots_page_set_activity (BoxesSnapshotsPage* self,
                                   const gchar* value)
{
	g_return_if_fail (self != NULL);
	if (value == NULL) {
		GtkStack* _tmp0_;
		GtkListBox* _tmp1_;
		_tmp0_ = self->priv->stack;
		_tmp1_ = self->priv->listbox;
		gtk_stack_set_visible_child (_tmp0_, (GtkWidget*) _tmp1_);
	} else {
		GtkLabel* _tmp2_;
		GtkStack* _tmp3_;
		GtkBox* _tmp4_;
		_tmp2_ = self->priv->activity_label;
		gtk_label_set_label (_tmp2_, value);
		_tmp3_ = self->priv->stack;
		_tmp4_ = self->priv->activity_page;
		gtk_stack_set_visible_child (_tmp3_, (GtkWidget*) _tmp4_);
	}
}

static void
boxes_snapshots_page_class_init (BoxesSnapshotsPageClass * klass,
                                 gpointer klass_data)
{
	boxes_snapshots_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BoxesSnapshotsPage_private_offset);
	G_OBJECT_CLASS (klass)->set_property = _vala_boxes_snapshots_page_set_property;
	G_OBJECT_CLASS (klass)->finalize = boxes_snapshots_page_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Boxes/ui/preferences/snapshots-page.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "toast_overlay", FALSE, BoxesSnapshotsPage_private_offset + G_STRUCT_OFFSET (BoxesSnapshotsPagePrivate, toast_overlay));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "preferences_group", FALSE, BoxesSnapshotsPage_private_offset + G_STRUCT_OFFSET (BoxesSnapshotsPagePrivate, preferences_group));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "stack", FALSE, BoxesSnapshotsPage_private_offset + G_STRUCT_OFFSET (BoxesSnapshotsPagePrivate, stack));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "listbox", FALSE, BoxesSnapshotsPage_private_offset + G_STRUCT_OFFSET (BoxesSnapshotsPagePrivate, listbox));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "activity_page", FALSE, BoxesSnapshotsPage_private_offset + G_STRUCT_OFFSET (BoxesSnapshotsPagePrivate, activity_page));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "activity_label", FALSE, BoxesSnapshotsPage_private_offset + G_STRUCT_OFFSET (BoxesSnapshotsPagePrivate, activity_label));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "update_snapshot_stack_page", G_CALLBACK(_boxes_snapshots_page_update_snapshot_stack_page_gtk_container_remove));
}

static void
boxes_snapshots_page_instance_init (BoxesSnapshotsPage * self,
                                    gpointer klass)
{
	GCancellable* _tmp0_;
	self->priv = boxes_snapshots_page_get_instance_private (self);
	_tmp0_ = g_cancellable_new ();
	self->priv->fetch_snapshots_cancellable = _tmp0_;
	g_type_ensure (BOXES_TYPE_TOAST_OVERLAY);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
boxes_snapshots_page_finalize (GObject * obj)
{
	BoxesSnapshotsPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_SNAPSHOTS_PAGE, BoxesSnapshotsPage);
	_g_object_unref0 (self->priv->machine);
	_g_object_unref0 (self->priv->add_button);
	_g_object_unref0 (self->priv->fetch_snapshots_cancellable);
	G_OBJECT_CLASS (boxes_snapshots_page_parent_class)->finalize (obj);
}

static GType
boxes_snapshots_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BoxesSnapshotsPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_snapshots_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesSnapshotsPage), 0, (GInstanceInitFunc) boxes_snapshots_page_instance_init, NULL };
	GType boxes_snapshots_page_type_id;
	boxes_snapshots_page_type_id = g_type_register_static (hdy_preferences_page_get_type (), "BoxesSnapshotsPage", &g_define_type_info, 0);
	BoxesSnapshotsPage_private_offset = g_type_add_instance_private (boxes_snapshots_page_type_id, sizeof (BoxesSnapshotsPagePrivate));
	return boxes_snapshots_page_type_id;
}

GType
boxes_snapshots_page_get_type (void)
{
	static volatile gsize boxes_snapshots_page_type_id__once = 0;
	if (g_once_init_enter (&boxes_snapshots_page_type_id__once)) {
		GType boxes_snapshots_page_type_id;
		boxes_snapshots_page_type_id = boxes_snapshots_page_get_type_once ();
		g_once_init_leave (&boxes_snapshots_page_type_id__once, boxes_snapshots_page_type_id);
	}
	return boxes_snapshots_page_type_id__once;
}

static void
_vala_boxes_snapshots_page_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	BoxesSnapshotsPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_SNAPSHOTS_PAGE, BoxesSnapshotsPage);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

