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

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

#include <handy.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <osinfo/osinfo.h>
#include <libvirt-gconfig/libvirt-gconfig.h>
#include <glib/gi18n-lib.h>
#include <libvirt-gobject/libvirt-gobject.h>
#include <float.h>
#include <math.h>
#include <libportal/portal.h>
#include <libportal-gtk3/portal-gtk3.h>
#include "common.h"
#include <stdio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib/gstdio.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_RESOURCES_PAGE (boxes_resources_page_get_type ())
#define BOXES_RESOURCES_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_RESOURCES_PAGE, BoxesResourcesPage))
#define BOXES_RESOURCES_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_RESOURCES_PAGE, BoxesResourcesPageClass))
#define BOXES_IS_RESOURCES_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_RESOURCES_PAGE))
#define BOXES_IS_RESOURCES_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_RESOURCES_PAGE))
#define BOXES_RESOURCES_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_RESOURCES_PAGE, BoxesResourcesPageClass))

typedef struct _BoxesResourcesPage BoxesResourcesPage;
typedef struct _BoxesResourcesPageClass BoxesResourcesPageClass;
typedef struct _BoxesResourcesPagePrivate BoxesResourcesPagePrivate;

#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_VM_NAME_ROW (boxes_vm_name_row_get_type ())
#define BOXES_VM_NAME_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_VM_NAME_ROW, BoxesVMNameRow))
#define BOXES_VM_NAME_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_VM_NAME_ROW, BoxesVMNameRowClass))
#define BOXES_IS_VM_NAME_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_VM_NAME_ROW))
#define BOXES_IS_VM_NAME_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_VM_NAME_ROW))
#define BOXES_VM_NAME_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_VM_NAME_ROW, BoxesVMNameRowClass))

typedef struct _BoxesVMNameRow BoxesVMNameRow;
typedef struct _BoxesVMNameRowClass BoxesVMNameRowClass;

#define BOXES_TYPE_MEMORY_ROW (boxes_memory_row_get_type ())
#define BOXES_MEMORY_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_MEMORY_ROW, BoxesMemoryRow))
#define BOXES_MEMORY_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_MEMORY_ROW, BoxesMemoryRowClass))
#define BOXES_IS_MEMORY_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_MEMORY_ROW))
#define BOXES_IS_MEMORY_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_MEMORY_ROW))
#define BOXES_MEMORY_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_MEMORY_ROW, BoxesMemoryRowClass))

typedef struct _BoxesMemoryRow BoxesMemoryRow;
typedef struct _BoxesMemoryRowClass BoxesMemoryRowClass;

#define BOXES_TYPE_RAM_ROW (boxes_ram_row_get_type ())
#define BOXES_RAM_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_RAM_ROW, BoxesRamRow))
#define BOXES_RAM_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_RAM_ROW, BoxesRamRowClass))
#define BOXES_IS_RAM_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_RAM_ROW))
#define BOXES_IS_RAM_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_RAM_ROW))
#define BOXES_RAM_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_RAM_ROW, BoxesRamRowClass))

typedef struct _BoxesRamRow BoxesRamRow;
typedef struct _BoxesRamRowClass BoxesRamRowClass;

#define BOXES_TYPE_STORAGE_ROW (boxes_storage_row_get_type ())
#define BOXES_STORAGE_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_STORAGE_ROW, BoxesStorageRow))
#define BOXES_STORAGE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_STORAGE_ROW, BoxesStorageRowClass))
#define BOXES_IS_STORAGE_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_STORAGE_ROW))
#define BOXES_IS_STORAGE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_STORAGE_ROW))
#define BOXES_STORAGE_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_STORAGE_ROW, BoxesStorageRowClass))

typedef struct _BoxesStorageRow BoxesStorageRow;
typedef struct _BoxesStorageRowClass BoxesStorageRowClass;
enum  {
	BOXES_RESOURCES_PAGE_0_PROPERTY,
	BOXES_RESOURCES_PAGE_NUM_PROPERTIES
};
static GParamSpec* boxes_resources_page_properties[BOXES_RESOURCES_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))
typedef struct _Block59Data Block59Data;
typedef struct _BoxesResourcesPageMarkRecommendedResourcesData BoxesResourcesPageMarkRecommendedResourcesData;
#define __vala_GVirNodeInfo_free0(var) ((var == NULL) ? NULL : (var = (_vala_GVirNodeInfo_free (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define BOXES_TYPE_APP_WINDOW (boxes_app_window_get_type ())
#define BOXES_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_APP_WINDOW, BoxesAppWindow))
#define BOXES_APP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_APP_WINDOW, BoxesAppWindowClass))
#define BOXES_IS_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_APP_WINDOW))
#define BOXES_IS_APP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_APP_WINDOW))
#define BOXES_APP_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_APP_WINDOW, BoxesAppWindowClass))

typedef struct _BoxesAppWindow BoxesAppWindow;
typedef struct _BoxesAppWindowClass BoxesAppWindowClass;

#define BOXES_TYPE_APP (boxes_app_get_type ())
#define BOXES_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_APP, BoxesApp))
#define BOXES_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_APP, BoxesAppClass))
#define BOXES_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_APP))
#define BOXES_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_APP))
#define BOXES_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_APP, BoxesAppClass))

typedef struct _BoxesApp BoxesApp;
typedef struct _BoxesAppClass BoxesAppClass;
#define __vala_XdpParent_free0(var) ((var == NULL) ? NULL : (var = (_vala_XdpParent_free (var), NULL)))
typedef struct _Block60Data Block60Data;
typedef struct _BoxesResourcesPageOnRunInBgToggledData BoxesResourcesPageOnRunInBgToggledData;
typedef struct _BoxesResourcesPageOnEditConfigurationButtonClickedData BoxesResourcesPageOnEditConfigurationButtonClickedData;
typedef struct _BoxesResourcesPageCreateSnapshotData BoxesResourcesPageCreateSnapshotData;
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))

#define BOXES_TYPE_UI (boxes_ui_get_type ())
#define BOXES_UI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_UI, BoxesUI))
#define BOXES_IS_UI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_UI))
#define BOXES_UI_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), BOXES_TYPE_UI, BoxesUIIface))

typedef struct _BoxesUI BoxesUI;
typedef struct _BoxesUIIface BoxesUIIface;
typedef enum  {
	BOXES_UI_STATE_NONE,
	BOXES_UI_STATE_COLLECTION,
	BOXES_UI_STATE_CREDS,
	BOXES_UI_STATE_DISPLAY,
	BOXES_UI_STATE_WIZARD,
	BOXES_UI_STATE_PROPERTIES,
	BOXES_UI_STATE_TROUBLESHOOT
} BoxesUIState;

#define BOXES_TYPE_UI_STATE (boxes_ui_state_get_type ())
typedef struct _BoxesCollectionItemPrivate BoxesCollectionItemPrivate;
typedef struct _BoxesMachinePrivate BoxesMachinePrivate;
typedef enum  {
	BOXES_MACHINE_CONNECT_FLAGS_NONE = 0,
	BOXES_MACHINE_CONNECT_FLAGS_IGNORE_SAVED_STATE = 1 << 0
} BoxesMachineConnectFlags;

#define BOXES_MACHINE_TYPE_CONNECT_FLAGS (boxes_machine_connect_flags_get_type ())
#define __vala_GVirDomainInfo_free0(var) ((var == NULL) ? NULL : (var = (_vala_GVirDomainInfo_free (var), NULL)))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))

#define BOXES_TYPE_DISPLAY (boxes_display_get_type ())
#define BOXES_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_DISPLAY, BoxesDisplay))
#define BOXES_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_DISPLAY, BoxesDisplayClass))
#define BOXES_IS_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_DISPLAY))
#define BOXES_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_DISPLAY))
#define BOXES_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_DISPLAY, BoxesDisplayClass))

typedef struct _BoxesDisplay BoxesDisplay;
typedef struct _BoxesDisplayClass BoxesDisplayClass;

struct _BoxesResourcesPage {
	HdyPreferencesPage parent_instance;
	BoxesResourcesPagePrivate * priv;
};

struct _BoxesResourcesPageClass {
	HdyPreferencesPageClass parent_class;
};

struct _BoxesResourcesPagePrivate {
	BoxesLibvirtMachine* machine;
	GFileMonitor* config_file_monitor;
	gchar* logs;
	BoxesVMNameRow* box_name_entry;
	HdyPreferencesGroup* address_group;
	HdyActionRow* ip_address_row;
	GtkLabel* ip_address_label;
	HdyPreferencesGroup* resources_group;
	GtkSpinButton* cpus_spin_button;
	BoxesRamRow* ram_row;
	BoxesStorageRow* storage_row;
	HdyActionRow* acceleration_3d_row;
	GtkSwitch* acceleration_3d_toggle;
	GtkSwitch* run_in_bg_toggle;
};

struct _Block59Data {
	int _ref_count_;
	BoxesResourcesPage* self;
	BoxesLibvirtMachine* machine;
};

struct _BoxesResourcesPageMarkRecommendedResourcesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesResourcesPage* self;
	OsinfoOs* os;
	BoxesLibvirtMachine* _tmp0_;
	OsinfoOs* _tmp1_;
	OsinfoOs* _tmp2_;
	gchar* architecture;
	BoxesLibvirtMachine* _tmp3_;
	GVirConfigDomain* _tmp4_;
	GVirConfigDomain* _tmp5_;
	GVirConfigDomainOs* _tmp6_;
	GVirConfigDomainOs* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	OsinfoResources* recommended_resources;
	OsinfoOs* _tmp11_;
	const gchar* _tmp12_;
	OsinfoResources* _tmp13_;
	OsinfoResources* _tmp14_;
	gchar* row_subtitle;
	gchar* _tmp15_;
	BoxesRamRow* _tmp16_;
	const gchar* _tmp17_;
	OsinfoResources* _tmp18_;
	gint64 _tmp19_;
	gint64 _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	BoxesLibvirtMachine* _tmp25_;
	GVirStorageVol* _tmp26_;
	GVirStorageVol* _tmp27_;
	BoxesStorageRow* _tmp28_;
	const gchar* _tmp29_;
	OsinfoResources* _tmp30_;
	gint64 _tmp31_;
	gint64 _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	gchar* _tmp36_;
};

struct _Block60Data {
	int _ref_count_;
	BoxesResourcesPage* self;
	GtkMessageDialog* message_dialog;
};

struct _BoxesResourcesPageOnRunInBgToggledData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesResourcesPage* self;
	BoxesLibvirtMachine* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GtkSwitch* _tmp3_;
	XdpPortal* portal;
	XdpPortal* _tmp4_;
	BoxesAppWindow* window;
	BoxesApp* _tmp5_;
	BoxesAppWindow* _tmp6_;
	BoxesAppWindow* _tmp7_;
	BoxesAppWindow* _tmp8_;
	XdpParent* parent;
	BoxesAppWindow* _tmp9_;
	XdpParent* _tmp10_;
	gchar* reason;
	gchar* _tmp11_;
	gpointer cancellable;
	XdpPortal* _tmp12_;
	XdpParent* _tmp13_;
	const gchar* _tmp14_;
	GPtrArray* _tmp15_;
	gpointer _tmp16_;
	GError* _error_;
	Block60Data* _data60_;
	GError* _tmp17_;
	const gchar* _tmp18_;
	BoxesLibvirtMachine* _tmp19_;
	gchar* msg;
	gchar* _tmp20_;
	BoxesApp* _tmp21_;
	BoxesAppWindow* _tmp22_;
	BoxesAppWindow* _tmp23_;
	const gchar* _tmp24_;
	GtkMessageDialog* _tmp25_;
	GtkMessageDialog* _tmp26_;
	GtkMessageDialog* _tmp27_;
	GtkMessageDialog* _tmp28_;
	GError* _inner_error0_;
};

struct _BoxesResourcesPageOnEditConfigurationButtonClickedData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesResourcesPage* self;
	GtkMessageDialog* message_dialog;
	GtkWidget* _tmp0_;
	GtkMessageDialog* _tmp1_;
};

struct _BoxesResourcesPageCreateSnapshotData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesResourcesPage* self;
	GtkDialog* message_dialog;
	gint response;
	BoxesLibvirtMachine* _tmp0_;
	GVirDomainSnapshot* _tmp1_;
	GVirDomainSnapshot* _tmp2_;
	GError* _error_;
	GError* _tmp3_;
	const gchar* _tmp4_;
	GError* _inner_error0_;
};

struct _BoxesUIIface {
	GTypeInterface parent_iface;
	BoxesUIState (*get_previous_ui_state) (BoxesUI* self);
	void (*set_previous_ui_state) (BoxesUI* self, BoxesUIState value);
	BoxesUIState (*get_ui_state) (BoxesUI* self);
	void (*set_ui_state) (BoxesUI* self, BoxesUIState value);
};

struct _BoxesCollectionItem {
	GObject parent_instance;
	BoxesCollectionItemPrivate * priv;
};

struct _BoxesCollectionItemClass {
	GObjectClass parent_class;
	gint (*compare) (BoxesCollectionItem* self, BoxesCollectionItem* other);
};

struct _BoxesMachine {
	BoxesCollectionItem parent_instance;
	BoxesMachinePrivate * priv;
	BoxesCollectionSource* source;
	BoxesBoxConfig* config;
	gboolean stay_on_display;
};

struct _BoxesMachineClass {
	BoxesCollectionItemClass parent_class;
	void (*save_real) (BoxesMachine* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*save_real_finish) (BoxesMachine* self, GAsyncResult* _res_, GError** error);
	void (*take_screenshot) (BoxesMachine* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	GdkPixbuf* (*take_screenshot_finish) (BoxesMachine* self, GAsyncResult* _res_, GError** error);
	void (*connect_display) (BoxesMachine* self, BoxesMachineConnectFlags flags, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*connect_display_finish) (BoxesMachine* self, GAsyncResult* _res_, GError** error);
	void (*restart) (BoxesMachine* self);
	void (*clone) (BoxesMachine* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*clone_finish) (BoxesMachine* self, GAsyncResult* _res_);
	void (*disconnect_display) (BoxesMachine* self);
	void (*update_status) (BoxesMachine* self);
	void (*delete) (BoxesMachine* self, gboolean by_user);
	gboolean (*get_suspend_at_exit) (BoxesMachine* self);
	gboolean (*get_can_save) (BoxesMachine* self);
	gboolean (*get_can_restart) (BoxesMachine* self);
	gboolean (*get_can_clone) (BoxesMachine* self);
	gboolean (*get_should_autosave) (BoxesMachine* self);
	gboolean (*get_is_local) (BoxesMachine* self);
};

static gint BoxesResourcesPage_private_offset;
static gpointer boxes_resources_page_parent_class = NULL;
VALA_EXTERN BoxesApp* boxes_app_app;

VALA_EXTERN GType boxes_resources_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesResourcesPage, 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_vm_name_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesVMNameRow, g_object_unref)
VALA_EXTERN GType boxes_memory_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesMemoryRow, g_object_unref)
VALA_EXTERN GType boxes_ram_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesRamRow, g_object_unref)
VALA_EXTERN GType boxes_storage_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesStorageRow, g_object_unref)
VALA_EXTERN void boxes_resources_page_setup (BoxesResourcesPage* self,
                                 BoxesLibvirtMachine* machine);
static Block59Data* block59_data_ref (Block59Data* _data59_);
static void block59_data_unref (void * _userdata_);
static void boxes_resources_page_setup_address_group (BoxesResourcesPage* self);
static void boxes_resources_page_bind_widget_property (BoxesResourcesPage* self,
                                                GtkWidget* widget,
                                                const gchar* widget_property,
                                                const gchar* machine_property);
static void boxes_resources_page_on_run_in_bg_toggled (BoxesResourcesPage* self,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static void boxes_resources_page_on_run_in_bg_toggled_finish (BoxesResourcesPage* self,
                                                       GAsyncResult* _res_);
static void boxes_resources_page_mark_recommended_resources (BoxesResourcesPage* self,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
static void boxes_resources_page_mark_recommended_resources_finish (BoxesResourcesPage* self,
                                                             GAsyncResult* _res_);
VALA_EXTERN void boxes_libvirt_machine_supports_accel3d (BoxesLibvirtMachine* self,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
VALA_EXTERN gboolean boxes_libvirt_machine_supports_accel3d_finish (BoxesLibvirtMachine* self,
                                                        GAsyncResult* _res_);
static void __lambda71_ (Block59Data* _data59_,
                  GObject* source,
                  GAsyncResult* _result_);
static void ___lambda71__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
VALA_EXTERN guint64 boxes_libvirt_machine_get_ram (BoxesLibvirtMachine* self);
VALA_EXTERN void boxes_memory_row_set_memory (BoxesMemoryRow* self,
                                  guint64 value);
VALA_EXTERN void boxes_storage_row_setup (BoxesStorageRow* self,
                              BoxesLibvirtMachine* machine);
static void boxes_resources_page_setup_cpu_row (BoxesResourcesPage* self);
static void boxes_resources_page_on_machine_state_changed (BoxesResourcesPage* self);
static void _boxes_resources_page_on_machine_state_changed_g_object_notify (GObject* _sender,
                                                                     GParamSpec* pspec,
                                                                     gpointer self);
VALA_EXTERN gchar* boxes_libvirt_machine_get_ip_address (BoxesLibvirtMachine* self);
static void boxes_resources_page_mark_recommended_resources_data_free (gpointer _data);
static gboolean boxes_resources_page_mark_recommended_resources_co (BoxesResourcesPageMarkRecommendedResourcesData* _data_);
VALA_EXTERN void boxes_libvirt_machine_get_os (BoxesLibvirtMachine* self,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN OsinfoOs* boxes_libvirt_machine_get_os_finish (BoxesLibvirtMachine* self,
                                               GAsyncResult* _res_);
static void boxes_resources_page_mark_recommended_resources_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_);
VALA_EXTERN GVirConfigDomain* boxes_libvirt_machine_get_domain_config (BoxesLibvirtMachine* self);
VALA_EXTERN OsinfoResources* boxes_os_database_get_recommended_resources_for_os (OsinfoOs* os,
                                                                     const gchar* architecture);
VALA_EXTERN GVirStorageVol* boxes_libvirt_machine_get_storage_volume (BoxesLibvirtMachine* self);
VALA_EXTERN GVirConnection* boxes_libvirt_machine_get_connection (BoxesLibvirtMachine* self);
static void _vala_GVirNodeInfo_free (GVirNodeInfo* self);
static void boxes_resources_page_on_cpu_spin_button_changed (BoxesResourcesPage* self);
static void _boxes_resources_page_on_cpu_spin_button_changed_gtk_spin_button_value_changed (GtkSpinButton* _sender,
                                                                                     gpointer self);
VALA_EXTERN GVirDomain* boxes_libvirt_machine_get_domain (BoxesLibvirtMachine* self);
VALA_EXTERN const gchar* boxes_collection_item_get_name (BoxesCollectionItem* self);
static void boxes_resources_page_on_run_in_bg_toggled_data_free (gpointer _data);
static gboolean boxes_resources_page_on_run_in_bg_toggled_co (BoxesResourcesPageOnRunInBgToggledData* _data_);
VALA_EXTERN gboolean boxes_libvirt_machine_get_run_in_bg (BoxesLibvirtMachine* self);
VALA_EXTERN gboolean boxes_app_is_running_in_flatpak (void);
VALA_EXTERN GType boxes_app_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesAppWindow, g_object_unref)
VALA_EXTERN GType boxes_app_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesApp, g_object_unref)
VALA_EXTERN BoxesAppWindow* boxes_app_get_main_window (BoxesApp* self);
static void boxes_resources_page_on_run_in_bg_toggled_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
static void _vala_XdpParent_free (XdpParent* self);
static Block60Data* block60_data_ref (Block60Data* _data60_);
static void block60_data_unref (void * _userdata_);
VALA_EXTERN void boxes_libvirt_machine_set_run_in_bg (BoxesLibvirtMachine* self,
                                          gboolean value);
static void ___lambda70_ (Block60Data* _data60_,
                   GtkDialog* dialog,
                   gint response);
VALA_EXTERN void boxes_open_permission_settings (void);
static void ____lambda70__gtk_dialog_response (GtkDialog* _sender,
                                        gint response_id,
                                        gpointer self);
static void _boxes_resources_page_on_run_in_bg_toggled_gtk_switch_activate (GtkSwitch* _sender,
                                                                     gpointer self);
VALA_EXTERN void boxes_resources_page_show_logs (BoxesResourcesPage* self);
static gchar* boxes_resources_page_collect_logs (BoxesResourcesPage* self,
                                          BoxesLibvirtMachine* machine);
static void _boxes_resources_page_show_logs_gtk_button_clicked (GtkButton* _sender,
                                                         gpointer self);
static void boxes_resources_page_on_edit_configuration_button_clicked_data_free (gpointer _data);
static void boxes_resources_page_on_edit_configuration_button_clicked (BoxesResourcesPage* self,
                                                                GAsyncReadyCallback _callback_,
                                                                gpointer _user_data_);
static void boxes_resources_page_on_edit_configuration_button_clicked_finish (BoxesResourcesPage* self,
                                                                       GAsyncResult* _res_);
static gboolean boxes_resources_page_on_edit_configuration_button_clicked_co (BoxesResourcesPageOnEditConfigurationButtonClickedData* _data_);
static void boxes_resources_page_create_snapshot (BoxesResourcesPage* self,
                                           GtkDialog* message_dialog,
                                           gint response,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static void boxes_resources_page_create_snapshot_finish (BoxesResourcesPage* self,
                                                  GAsyncResult* _res_);
static void _boxes_resources_page_create_snapshot_gtk_dialog_response (GtkDialog* _sender,
                                                                gint response_id,
                                                                gpointer self);
static void _boxes_resources_page_on_edit_configuration_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                    gpointer self);
static void boxes_resources_page_create_snapshot_data_free (gpointer _data);
static gboolean boxes_resources_page_create_snapshot_co (BoxesResourcesPageCreateSnapshotData* _data_);
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_resources_page_create_snapshot_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
static void boxes_resources_page_open_config_file (BoxesResourcesPage* self);
static void boxes_resources_page_on_domain_configuration_edited (BoxesResourcesPage* self,
                                                          GFile* file,
                                                          GFile* other_file,
                                                          GFileMonitorEvent event_type);
static void _boxes_resources_page_on_domain_configuration_edited_g_file_monitor_changed (GFileMonitor* _sender,
                                                                                  GFile* file,
                                                                                  GFile* other_file,
                                                                                  GFileMonitorEvent event_type,
                                                                                  gpointer self);
VALA_EXTERN gboolean boxes_machine_get_is_running (BoxesMachine* self);
VALA_EXTERN GType boxes_ui_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType boxes_ui_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesUI, g_object_unref)
VALA_EXTERN GType boxes_machine_connect_flags_get_type (void) G_GNUC_CONST ;
static void _vala_GVirDomainInfo_free (GVirDomainInfo* self);
VALA_EXTERN GType boxes_display_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesDisplay, g_object_unref)
VALA_EXTERN BoxesDisplay* boxes_machine_get_display (BoxesMachine* self);
VALA_EXTERN void boxes_display_collect_logs (BoxesDisplay* self,
                                 GString* builder);
VALA_EXTERN BoxesResourcesPage* boxes_resources_page_new (void);
VALA_EXTERN BoxesResourcesPage* boxes_resources_page_construct (GType object_type);
static void boxes_resources_page_finalize (GObject * obj);
static GType boxes_resources_page_get_type_once (void);

static inline gpointer
boxes_resources_page_get_instance_private (BoxesResourcesPage* self)
{
	return G_STRUCT_MEMBER_P (self, BoxesResourcesPage_private_offset);
}

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

static Block59Data*
block59_data_ref (Block59Data* _data59_)
{
	g_atomic_int_inc (&_data59_->_ref_count_);
	return _data59_;
}

static void
block59_data_unref (void * _userdata_)
{
	Block59Data* _data59_;
	_data59_ = (Block59Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data59_->_ref_count_)) {
		BoxesResourcesPage* self;
		self = _data59_->self;
		_g_object_unref0 (_data59_->machine);
		_g_object_unref0 (self);
		g_slice_free (Block59Data, _data59_);
	}
}

static void
__lambda71_ (Block59Data* _data59_,
             GObject* source,
             GAsyncResult* _result_)
{
	BoxesResourcesPage* self;
	HdyActionRow* _tmp0_;
	HdyActionRow* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	self = _data59_->self;
	g_return_if_fail (_result_ != NULL);
	_tmp0_ = self->priv->acceleration_3d_row;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, boxes_libvirt_machine_supports_accel3d_finish (_data59_->machine, _result_));
	_tmp1_ = self->priv->acceleration_3d_row;
	_tmp2_ = gtk_widget_get_visible ((GtkWidget*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		GtkSwitch* _tmp4_;
		_tmp4_ = self->priv->acceleration_3d_toggle;
		boxes_resources_page_bind_widget_property (self, (GtkWidget*) _tmp4_, "active", "acceleration-3d");
	}
}

static void
___lambda71__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda71_ (self, source_object, res);
	block59_data_unref (self);
}

static void
_boxes_resources_page_on_machine_state_changed_g_object_notify (GObject* _sender,
                                                                GParamSpec* pspec,
                                                                gpointer self)
{
	boxes_resources_page_on_machine_state_changed ((BoxesResourcesPage*) self);
}

void
boxes_resources_page_setup (BoxesResourcesPage* self,
                            BoxesLibvirtMachine* machine)
{
	Block59Data* _data59_;
	BoxesLibvirtMachine* _tmp0_;
	BoxesLibvirtMachine* _tmp1_;
	BoxesVMNameRow* _tmp2_;
	GtkSwitch* _tmp3_;
	BoxesRamRow* _tmp4_;
	guint64 _tmp5_;
	guint64 _tmp6_;
	BoxesRamRow* _tmp7_;
	BoxesStorageRow* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (machine != NULL);
	_data59_ = g_slice_new0 (Block59Data);
	_data59_->_ref_count_ = 1;
	_data59_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (machine);
	_g_object_unref0 (_data59_->machine);
	_data59_->machine = _tmp0_;
	_tmp1_ = _g_object_ref0 (_data59_->machine);
	_g_object_unref0 (self->priv->machine);
	self->priv->machine = _tmp1_;
	boxes_resources_page_setup_address_group (self);
	_tmp2_ = self->priv->box_name_entry;
	boxes_resources_page_bind_widget_property (self, (GtkWidget*) _tmp2_, "text", "title");
	_tmp3_ = self->priv->run_in_bg_toggle;
	boxes_resources_page_bind_widget_property (self, (GtkWidget*) _tmp3_, "active", "run-in-bg");
	boxes_resources_page_on_run_in_bg_toggled (self, NULL, NULL);
	boxes_resources_page_mark_recommended_resources (self, NULL, NULL);
	boxes_libvirt_machine_supports_accel3d (_data59_->machine, ___lambda71__gasync_ready_callback, block59_data_ref (_data59_));
	_tmp4_ = self->priv->ram_row;
	_tmp5_ = boxes_libvirt_machine_get_ram (_data59_->machine);
	_tmp6_ = _tmp5_;
	boxes_memory_row_set_memory ((BoxesMemoryRow*) _tmp4_, _tmp6_);
	_tmp7_ = self->priv->ram_row;
	boxes_resources_page_bind_widget_property (self, (GtkWidget*) _tmp7_, "memory", "ram");
	_tmp8_ = self->priv->storage_row;
	boxes_storage_row_setup (_tmp8_, _data59_->machine);
	boxes_resources_page_setup_cpu_row (self);
	g_signal_connect_object ((GObject*) _data59_->machine, "notify::is-running", (GCallback) _boxes_resources_page_on_machine_state_changed_g_object_notify, self, 0);
	boxes_resources_page_on_machine_state_changed (self);
	block59_data_unref (_data59_);
	_data59_ = NULL;
}

static void
boxes_resources_page_setup_address_group (BoxesResourcesPage* self)
{
	gchar* address = NULL;
	BoxesLibvirtMachine* _tmp0_;
	gchar* _tmp1_;
	HdyPreferencesGroup* _tmp2_;
	HdyActionRow* _tmp3_;
	GtkLabel* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->machine;
	_tmp1_ = boxes_libvirt_machine_get_ip_address (_tmp0_);
	address = _tmp1_;
	_tmp2_ = self->priv->address_group;
	_tmp3_ = self->priv->ip_address_row;
	gtk_widget_set_visible ((GtkWidget*) _tmp3_, address != NULL);
	gtk_widget_set_visible ((GtkWidget*) _tmp2_, address != NULL);
	_tmp4_ = self->priv->ip_address_label;
	gtk_label_set_label (_tmp4_, address);
	_g_free0 (address);
}

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

static void
boxes_resources_page_mark_recommended_resources (BoxesResourcesPage* self,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_)
{
	BoxesResourcesPageMarkRecommendedResourcesData* _data_;
	BoxesResourcesPage* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (BoxesResourcesPageMarkRecommendedResourcesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_resources_page_mark_recommended_resources_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	boxes_resources_page_mark_recommended_resources_co (_data_);
}

static void
boxes_resources_page_mark_recommended_resources_finish (BoxesResourcesPage* self,
                                                        GAsyncResult* _res_)
{
	BoxesResourcesPageMarkRecommendedResourcesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
boxes_resources_page_mark_recommended_resources_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_)
{
	BoxesResourcesPageMarkRecommendedResourcesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_resources_page_mark_recommended_resources_co (_data_);
}

static gboolean
boxes_resources_page_mark_recommended_resources_co (BoxesResourcesPageMarkRecommendedResourcesData* _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_->_state_ = 1;
	boxes_libvirt_machine_get_os (_data_->_tmp0_, boxes_resources_page_mark_recommended_resources_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp1_ = boxes_libvirt_machine_get_os_finish (_data_->_tmp0_, _data_->_res_);
	_data_->os = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->os;
	if (_data_->_tmp2_ == NULL) {
		_g_object_unref0 (_data_->os);
		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;
	}
	_data_->_tmp3_ = _data_->self->priv->machine;
	_data_->_tmp4_ = boxes_libvirt_machine_get_domain_config (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = gvir_config_domain_get_os (_data_->_tmp5_);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = gvir_config_domain_os_get_arch (_data_->_tmp7_);
	_data_->_tmp9_ = g_strdup (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_g_object_unref0 (_data_->_tmp7_);
	_data_->architecture = _data_->_tmp10_;
	_data_->_tmp11_ = _data_->os;
	_data_->_tmp12_ = _data_->architecture;
	_data_->_tmp13_ = boxes_os_database_get_recommended_resources_for_os (_data_->_tmp11_, _data_->_tmp12_);
	_data_->recommended_resources = _data_->_tmp13_;
	_data_->_tmp14_ = _data_->recommended_resources;
	if (_data_->_tmp14_ != NULL) {
		_data_->_tmp15_ = g_strdup (_ ("Recommended %s."));
		_data_->row_subtitle = _data_->_tmp15_;
		_data_->_tmp16_ = _data_->self->priv->ram_row;
		_data_->_tmp17_ = _data_->row_subtitle;
		_data_->_tmp18_ = _data_->recommended_resources;
		_data_->_tmp19_ = osinfo_resources_get_ram (_data_->_tmp18_);
		_data_->_tmp20_ = _data_->_tmp19_;
		_data_->_tmp21_ = g_format_size_full ((guint64) _data_->_tmp20_, G_FORMAT_SIZE_IEC_UNITS);
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_tmp23_ = g_strdup_printf (_data_->_tmp17_, _data_->_tmp22_);
		_data_->_tmp24_ = _data_->_tmp23_;
		hdy_action_row_set_subtitle ((HdyActionRow*) _data_->_tmp16_, _data_->_tmp24_);
		_g_free0 (_data_->_tmp24_);
		_g_free0 (_data_->_tmp22_);
		_data_->_tmp25_ = _data_->self->priv->machine;
		_data_->_tmp26_ = boxes_libvirt_machine_get_storage_volume (_data_->_tmp25_);
		_data_->_tmp27_ = _data_->_tmp26_;
		if (_data_->_tmp27_ != NULL) {
			_data_->_tmp28_ = _data_->self->priv->storage_row;
			_data_->_tmp29_ = _data_->row_subtitle;
			_data_->_tmp30_ = _data_->recommended_resources;
			_data_->_tmp31_ = osinfo_resources_get_storage (_data_->_tmp30_);
			_data_->_tmp32_ = _data_->_tmp31_;
			_data_->_tmp33_ = g_format_size_full ((guint64) _data_->_tmp32_, G_FORMAT_SIZE_IEC_UNITS);
			_data_->_tmp34_ = _data_->_tmp33_;
			_data_->_tmp35_ = g_strdup_printf (_data_->_tmp29_, _data_->_tmp34_);
			_data_->_tmp36_ = _data_->_tmp35_;
			hdy_action_row_set_subtitle ((HdyActionRow*) _data_->_tmp28_, _data_->_tmp36_);
			_g_free0 (_data_->_tmp36_);
			_g_free0 (_data_->_tmp34_);
		}
		_g_free0 (_data_->row_subtitle);
	}
	_g_object_unref0 (_data_->recommended_resources);
	_g_free0 (_data_->architecture);
	_g_object_unref0 (_data_->os);
	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
_vala_GVirNodeInfo_free (GVirNodeInfo* self)
{
	g_boxed_free (gvir_node_info_get_type (), self);
}

static void
_boxes_resources_page_on_cpu_spin_button_changed_gtk_spin_button_value_changed (GtkSpinButton* _sender,
                                                                                gpointer self)
{
	boxes_resources_page_on_cpu_spin_button_changed ((BoxesResourcesPage*) self);
}

static void
boxes_resources_page_setup_cpu_row (BoxesResourcesPage* self)
{
	GtkSpinButton* _tmp12_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		GVirNodeInfo* host_topology = NULL;
		BoxesLibvirtMachine* _tmp0_;
		GVirConnection* _tmp1_;
		GVirConnection* _tmp2_;
		GVirNodeInfo* _tmp3_;
		guint host_vcpus = 0U;
		guint64 cpus = 0ULL;
		BoxesLibvirtMachine* _tmp4_;
		GVirConfigDomain* _tmp5_;
		GVirConfigDomain* _tmp6_;
		GtkSpinButton* _tmp7_;
		GtkSpinButton* _tmp8_;
		GtkSpinButton* _tmp9_;
		_tmp0_ = self->priv->machine;
		_tmp1_ = boxes_libvirt_machine_get_connection (_tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = gvir_connection_get_node_info (_tmp2_, &_inner_error0_);
		host_topology = _tmp3_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		host_vcpus = (host_topology->cores * host_topology->sockets) * host_topology->threads;
		_tmp4_ = self->priv->machine;
		_tmp5_ = boxes_libvirt_machine_get_domain_config (_tmp4_);
		_tmp6_ = _tmp5_;
		cpus = gvir_config_domain_get_vcpus (_tmp6_);
		_tmp7_ = self->priv->cpus_spin_button;
		gtk_spin_button_set_range (_tmp7_, (gdouble) 1, (gdouble) host_vcpus);
		_tmp8_ = self->priv->cpus_spin_button;
		gtk_spin_button_set_increments (_tmp8_, (gdouble) 1, (gdouble) host_vcpus);
		_tmp9_ = self->priv->cpus_spin_button;
		gtk_spin_button_set_value (_tmp9_, (gdouble) cpus);
		__vala_GVirNodeInfo_free0 (host_topology);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp10_;
		const gchar* _tmp11_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp10_ = _error_;
		_tmp11_ = _tmp10_->message;
		g_warning ("resources-page.vala:102: Failed to obtain virtual resources for machin" \
"e: %s", _tmp11_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
	_tmp12_ = self->priv->cpus_spin_button;
	g_signal_connect_object (_tmp12_, "value-changed", (GCallback) _boxes_resources_page_on_cpu_spin_button_changed_gtk_spin_button_value_changed, self, 0);
}

static void
boxes_resources_page_on_cpu_spin_button_changed (BoxesResourcesPage* self)
{
	guint cores = 0U;
	GtkSpinButton* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->cpus_spin_button;
	cores = (guint) gtk_spin_button_get_value_as_int (_tmp0_);
	{
		BoxesLibvirtMachine* _tmp1_;
		GVirConfigDomain* _tmp2_;
		GVirConfigDomain* _tmp3_;
		GVirConfigDomain* config = NULL;
		BoxesLibvirtMachine* _tmp4_;
		GVirDomain* _tmp5_;
		GVirDomain* _tmp6_;
		GVirConfigDomain* _tmp7_;
		GVirConfigDomain* _tmp8_;
		GVirConfigDomain* _tmp9_;
		GObjectClass* _tmp10_;
		GParamSpec* _tmp11_;
		GVirConfigCapabilitiesCpuTopology* guest_topology = NULL;
		GVirConfigCapabilitiesCpuTopology* _tmp13_;
		GVirConfigCapabilitiesCpuTopology* _tmp14_;
		GVirConfigCapabilitiesCpuTopology* _tmp15_;
		GVirConfigCapabilitiesCpuTopology* _tmp16_;
		GVirConfigDomainCpu* cpu = NULL;
		BoxesLibvirtMachine* _tmp17_;
		GVirConfigDomain* _tmp18_;
		GVirConfigDomain* _tmp19_;
		GVirConfigDomainCpu* _tmp20_;
		GVirConfigDomainCpu* _tmp21_;
		GVirConfigCapabilitiesCpuTopology* _tmp22_;
		GVirConfigDomain* _tmp23_;
		GVirConfigDomainCpu* _tmp24_;
		BoxesLibvirtMachine* _tmp25_;
		GVirDomain* _tmp26_;
		GVirDomain* _tmp27_;
		GVirConfigDomain* _tmp28_;
		_tmp1_ = self->priv->machine;
		_tmp2_ = boxes_libvirt_machine_get_domain_config (_tmp1_);
		_tmp3_ = _tmp2_;
		if (gvir_config_domain_get_vcpus (_tmp3_) == ((guint64) cores)) {
			return;
		}
		_tmp4_ = self->priv->machine;
		_tmp5_ = boxes_libvirt_machine_get_domain (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = gvir_domain_get_config (_tmp6_, (guint) GVIR_DOMAIN_XML_INACTIVE, &_inner_error0_);
		config = _tmp7_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp8_ = config;
		gvir_config_domain_set_vcpus (_tmp8_, (guint64) cores);
		_tmp9_ = config;
		_tmp10_ = G_OBJECT_GET_CLASS ((GObject*) _tmp9_);
		_tmp11_ = g_object_class_find_property (_tmp10_, "current-vcpus");
		if (_tmp11_ != NULL) {
			GVirConfigDomain* _tmp12_;
			_tmp12_ = config;
			g_object_set ((GObject*) _tmp12_, "current-vcpus", cores, NULL);
		}
		_tmp13_ = gvir_config_capabilities_cpu_topology_new ();
		guest_topology = _tmp13_;
		_tmp14_ = guest_topology;
		gvir_config_capabilities_cpu_topology_set_cores (_tmp14_, (guint64) cores);
		_tmp15_ = guest_topology;
		gvir_config_capabilities_cpu_topology_set_sockets (_tmp15_, (guint64) 1);
		_tmp16_ = guest_topology;
		gvir_config_capabilities_cpu_topology_set_threads (_tmp16_, (guint64) 1);
		_tmp17_ = self->priv->machine;
		_tmp18_ = boxes_libvirt_machine_get_domain_config (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = gvir_config_domain_get_cpu (_tmp19_);
		cpu = _tmp20_;
		_tmp21_ = cpu;
		_tmp22_ = guest_topology;
		gvir_config_capabilities_cpu_set_topology ((GVirConfigCapabilitiesCpu*) _tmp21_, _tmp22_);
		_tmp23_ = config;
		_tmp24_ = cpu;
		gvir_config_domain_set_cpu (_tmp23_, _tmp24_);
		_tmp25_ = self->priv->machine;
		_tmp26_ = boxes_libvirt_machine_get_domain (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = config;
		gvir_domain_set_config (_tmp27_, _tmp28_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (cpu);
			_g_object_unref0 (guest_topology);
			_g_object_unref0 (config);
			goto __catch0_g_error;
		}
		g_debug ("resources-page.vala:131: vCPUS changed to %u", cores);
		_g_object_unref0 (cpu);
		_g_object_unref0 (guest_topology);
		_g_object_unref0 (config);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		BoxesLibvirtMachine* _tmp29_;
		const gchar* _tmp30_;
		const gchar* _tmp31_;
		GError* _tmp32_;
		const gchar* _tmp33_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp29_ = self->priv->machine;
		_tmp30_ = boxes_collection_item_get_name ((BoxesCollectionItem*) _tmp29_);
		_tmp31_ = _tmp30_;
		_tmp32_ = _error_;
		_tmp33_ = _tmp32_->message;
		g_debug ("resources-page.vala:135: Failed to set the number of vCPUS for '%s': %" \
"s", _tmp31_, _tmp33_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
}

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

static void
boxes_resources_page_on_run_in_bg_toggled (BoxesResourcesPage* self,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	BoxesResourcesPageOnRunInBgToggledData* _data_;
	BoxesResourcesPage* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (BoxesResourcesPageOnRunInBgToggledData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_resources_page_on_run_in_bg_toggled_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	boxes_resources_page_on_run_in_bg_toggled_co (_data_);
}

static void
boxes_resources_page_on_run_in_bg_toggled_finish (BoxesResourcesPage* self,
                                                  GAsyncResult* _res_)
{
	BoxesResourcesPageOnRunInBgToggledData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
boxes_resources_page_on_run_in_bg_toggled_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_)
{
	BoxesResourcesPageOnRunInBgToggledData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_resources_page_on_run_in_bg_toggled_co (_data_);
}

static void
_vala_XdpParent_free (XdpParent* self)
{
	g_boxed_free (xdp_parent_get_type (), self);
}

static Block60Data*
block60_data_ref (Block60Data* _data60_)
{
	g_atomic_int_inc (&_data60_->_ref_count_);
	return _data60_;
}

static void
block60_data_unref (void * _userdata_)
{
	Block60Data* _data60_;
	_data60_ = (Block60Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data60_->_ref_count_)) {
		BoxesResourcesPage* self;
		self = _data60_->self;
		_g_object_unref0 (_data60_->message_dialog);
		_g_object_unref0 (self);
		g_slice_free (Block60Data, _data60_);
	}
}

static void
___lambda70_ (Block60Data* _data60_,
              GtkDialog* dialog,
              gint response)
{
	BoxesResourcesPage* self;
	GtkMessageDialog* _tmp0_;
	self = _data60_->self;
	g_return_if_fail (dialog != NULL);
	if (response == ((gint) GTK_RESPONSE_YES)) {
		boxes_open_permission_settings ();
	}
	_tmp0_ = _data60_->message_dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp0_);
}

static void
____lambda70__gtk_dialog_response (GtkDialog* _sender,
                                   gint response_id,
                                   gpointer self)
{
	___lambda70_ (self, _sender, response_id);
}

static gboolean
boxes_resources_page_on_run_in_bg_toggled_co (BoxesResourcesPageOnRunInBgToggledData* _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_run_in_bg (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (!_data_->_tmp2_) {
		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;
	}
	if (!boxes_app_is_running_in_flatpak ()) {
		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;
	}
	_data_->_tmp3_ = _data_->self->priv->run_in_bg_toggle;
	if (!gtk_switch_get_active (_data_->_tmp3_)) {
		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;
	}
	{
		_data_->_tmp4_ = xdp_portal_initable_new (&_data_->_inner_error0_);
		_data_->portal = _data_->_tmp4_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp5_ = boxes_app_app;
		_data_->_tmp6_ = boxes_app_get_main_window (_data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp8_ = _g_object_ref0 (_data_->_tmp7_);
		_data_->window = _data_->_tmp8_;
		_data_->_tmp9_ = _data_->window;
		_data_->_tmp10_ = xdp_parent_new_gtk ((GtkWindow*) _data_->_tmp9_);
		_data_->parent = _data_->_tmp10_;
		_data_->_tmp11_ = g_strdup (_ ("Boxes wants to run VM in background"));
		_data_->reason = _data_->_tmp11_;
		_data_->cancellable = NULL;
		_data_->_tmp12_ = _data_->portal;
		_data_->_tmp13_ = _data_->parent;
		_data_->_tmp14_ = _data_->reason;
		_data_->_tmp15_ = g_ptr_array_new_full ((guint) 0, NULL);
		_data_->_tmp16_ = _data_->cancellable;
		_data_->_state_ = 1;
		xdp_portal_request_background (_data_->_tmp12_, _data_->_tmp13_, _data_->_tmp14_, _data_->_tmp15_, XDP_BACKGROUND_FLAG_NONE, _data_->_tmp16_, boxes_resources_page_on_run_in_bg_toggled_ready, _data_);
		return FALSE;
		_state_1:
		xdp_portal_request_background_finish (_data_->_tmp12_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->reason);
			__vala_XdpParent_free0 (_data_->parent);
			_g_object_unref0 (_data_->window);
			_g_object_unref0 (_data_->portal);
			goto __catch0_g_error;
		}
		_g_free0 (_data_->reason);
		__vala_XdpParent_free0 (_data_->parent);
		_g_object_unref0 (_data_->window);
		_g_object_unref0 (_data_->portal);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_data60_ = g_slice_new0 (Block60Data);
		_data_->_data60_->_ref_count_ = 1;
		_data_->_data60_->self = g_object_ref (_data_->self);
		_data_->_tmp17_ = _data_->_error_;
		_data_->_tmp18_ = _data_->_tmp17_->message;
		g_warning ("resources-page.vala:158: Failed to request to run in background: %s", _data_->_tmp18_);
		_data_->_tmp19_ = _data_->self->priv->machine;
		boxes_libvirt_machine_set_run_in_bg (_data_->_tmp19_, FALSE);
		_data_->_tmp20_ = g_strdup (_ ("Boxes is not authorized to run in background"));
		_data_->msg = _data_->_tmp20_;
		_data_->_tmp21_ = boxes_app_app;
		_data_->_tmp22_ = boxes_app_get_main_window (_data_->_tmp21_);
		_data_->_tmp23_ = _data_->_tmp22_;
		_data_->_tmp24_ = _data_->msg;
		_data_->_tmp25_ = (GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) _data_->_tmp23_, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", _data_->_tmp24_);
		g_object_ref_sink (_data_->_tmp25_);
		_data_->_data60_->message_dialog = _data_->_tmp25_;
		_data_->_tmp26_ = _data_->_data60_->message_dialog;
		gtk_message_dialog_format_secondary_text (_data_->_tmp26_, "%s", _ ("Do you want to open Settings to manage application permissions?"));
		_data_->_tmp27_ = _data_->_data60_->message_dialog;
		gtk_widget_show_all ((GtkWidget*) _data_->_tmp27_);
		_data_->_tmp28_ = _data_->_data60_->message_dialog;
		g_signal_connect_data ((GtkDialog*) _data_->_tmp28_, "response", (GCallback) ____lambda70__gtk_dialog_response, block60_data_ref (_data_->_data60_), (GClosureNotify) block60_data_unref, 0);
		_g_free0 (_data_->msg);
		_g_error_free0 (_data_->_error_);
		block60_data_unref (_data_->_data60_);
		_data_->_data60_ = NULL;
	}
	__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_resources_page_on_run_in_bg_toggled_gtk_switch_activate (GtkSwitch* _sender,
                                                                gpointer self)
{
	boxes_resources_page_on_run_in_bg_toggled ((BoxesResourcesPage*) self, NULL, NULL);
}

static guint8*
string_get_data (const gchar* self,
                 gint* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res;
	_tmp2__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

void
boxes_resources_page_show_logs (BoxesResourcesPage* self)
{
	const gchar* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->logs;
	if (_tmp0_ == NULL) {
		BoxesLibvirtMachine* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = self->priv->machine;
		_tmp2_ = boxes_resources_page_collect_logs (self, _tmp1_);
		_g_free0 (self->priv->logs);
		self->priv->logs = _tmp2_;
	}
	{
		gchar* filename = NULL;
		BoxesLibvirtMachine* _tmp3_;
		GVirDomain* _tmp4_;
		GVirDomain* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		GFile* file = NULL;
		const gchar* _tmp11_;
		GFile* _tmp12_;
		GFileOutputStream* os = NULL;
		GFile* _tmp13_;
		GFileOutputStream* _tmp14_;
		GFileOutputStream* _tmp15_;
		const gchar* _tmp16_;
		guint8* _tmp17_;
		gint _tmp17__length1;
		gint _tmp18_ = 0;
		guint8* _tmp19_;
		gint _tmp19__length1;
		GFile* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		GFile* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		FILE* _tmp26_;
		const gchar* _tmp27_;
		gchar* _tmp28_;
		gchar* _tmp29_;
		_tmp3_ = self->priv->machine;
		_tmp4_ = boxes_libvirt_machine_get_domain (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = gvir_domain_get_name (_tmp5_);
		_tmp7_ = g_strconcat (_tmp6_, ".logs", NULL);
		_tmp8_ = _tmp7_;
		_tmp9_ = boxes_get_cache ("logs", _tmp8_);
		_tmp10_ = _tmp9_;
		_g_free0 (_tmp8_);
		filename = _tmp10_;
		_tmp11_ = filename;
		_tmp12_ = g_file_new_for_path (_tmp11_);
		file = _tmp12_;
		_tmp13_ = file;
		_tmp14_ = g_file_replace (_tmp13_, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, &_inner_error0_);
		os = _tmp14_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (file);
			_g_free0 (filename);
			goto __catch0_g_error;
		}
		_tmp15_ = os;
		_tmp16_ = self->priv->logs;
		_tmp17_ = string_get_data (_tmp16_, &_tmp18_);
		_tmp17__length1 = _tmp18_;
		_tmp19_ = _tmp17_;
		_tmp19__length1 = _tmp17__length1;
		g_output_stream_write ((GOutputStream*) _tmp15_, _tmp19_, (gsize) _tmp19__length1, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (os);
			_g_object_unref0 (file);
			_g_free0 (filename);
			goto __catch0_g_error;
		}
		_tmp20_ = file;
		_tmp21_ = g_file_get_uri (_tmp20_);
		_tmp22_ = _tmp21_;
		g_app_info_launch_default_for_uri (_tmp22_, NULL, &_inner_error0_);
		_g_free0 (_tmp22_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (os);
			_g_object_unref0 (file);
			_g_free0 (filename);
			goto __catch0_g_error;
		}
		_tmp23_ = file;
		_tmp24_ = g_file_get_uri (_tmp23_);
		_tmp25_ = _tmp24_;
		g_debug ("resources-page.vala:192: Showing vm configuration at %s", _tmp25_);
		_g_free0 (_tmp25_);
		_tmp26_ = stdout;
		_tmp27_ = self->priv->logs;
		_tmp28_ = g_strconcat (_tmp27_, "\n", NULL);
		_tmp29_ = _tmp28_;
		fprintf (_tmp26_, "%s", _tmp29_);
		_g_free0 (_tmp29_);
		_g_object_unref0 (os);
		_g_object_unref0 (file);
		_g_free0 (filename);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp30_;
		const gchar* _tmp31_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp30_ = _error_;
		_tmp31_ = _tmp30_->message;
		g_warning ("resources-page.vala:195: Failed to collect machine logs: %s", _tmp31_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
}

static void
_boxes_resources_page_show_logs_gtk_button_clicked (GtkButton* _sender,
                                                    gpointer self)
{
	boxes_resources_page_show_logs ((BoxesResourcesPage*) self);
}

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

static void
boxes_resources_page_on_edit_configuration_button_clicked (BoxesResourcesPage* self,
                                                           GAsyncReadyCallback _callback_,
                                                           gpointer _user_data_)
{
	BoxesResourcesPageOnEditConfigurationButtonClickedData* _data_;
	BoxesResourcesPage* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (BoxesResourcesPageOnEditConfigurationButtonClickedData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_resources_page_on_edit_configuration_button_clicked_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	boxes_resources_page_on_edit_configuration_button_clicked_co (_data_);
}

static void
boxes_resources_page_on_edit_configuration_button_clicked_finish (BoxesResourcesPage* self,
                                                                  GAsyncResult* _res_)
{
	BoxesResourcesPageOnEditConfigurationButtonClickedData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
_boxes_resources_page_create_snapshot_gtk_dialog_response (GtkDialog* _sender,
                                                           gint response_id,
                                                           gpointer self)
{
	boxes_resources_page_create_snapshot ((BoxesResourcesPage*) self, _sender, response_id, NULL, NULL);
}

static gboolean
boxes_resources_page_on_edit_configuration_button_clicked_co (BoxesResourcesPageOnEditConfigurationButtonClickedData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gtk_widget_get_toplevel ((GtkWidget*) _data_->self);
	_data_->_tmp1_ = (GtkMessageDialog*) gtk_message_dialog_new (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp0_, gtk_window_get_type ()) ? ((GtkWindow*) _data_->_tmp0_) : NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", _ ("Editing your box configuration can cause issues to the operating syste" \
"m of your box. Would you like to create a snapshot to recover from you" \
"r changes?"));
	g_object_ref_sink (_data_->_tmp1_);
	_data_->message_dialog = _data_->_tmp1_;
	gtk_widget_show_all ((GtkWidget*) _data_->message_dialog);
	g_signal_connect_object ((GtkDialog*) _data_->message_dialog, "response", (GCallback) _boxes_resources_page_create_snapshot_gtk_dialog_response, _data_->self, 0);
	_g_object_unref0 (_data_->message_dialog);
	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_resources_page_on_edit_configuration_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                               gpointer self)
{
	boxes_resources_page_on_edit_configuration_button_clicked ((BoxesResourcesPage*) self, NULL, NULL);
}

static void
boxes_resources_page_create_snapshot_data_free (gpointer _data)
{
	BoxesResourcesPageCreateSnapshotData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->message_dialog);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesResourcesPageCreateSnapshotData, _data_);
}

static void
boxes_resources_page_create_snapshot (BoxesResourcesPage* self,
                                      GtkDialog* message_dialog,
                                      gint response,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	BoxesResourcesPageCreateSnapshotData* _data_;
	BoxesResourcesPage* _tmp0_;
	GtkDialog* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message_dialog != NULL);
	_data_ = g_slice_new0 (BoxesResourcesPageCreateSnapshotData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_resources_page_create_snapshot_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (message_dialog);
	_g_object_unref0 (_data_->message_dialog);
	_data_->message_dialog = _tmp1_;
	_data_->response = response;
	boxes_resources_page_create_snapshot_co (_data_);
}

static void
boxes_resources_page_create_snapshot_finish (BoxesResourcesPage* self,
                                             GAsyncResult* _res_)
{
	BoxesResourcesPageCreateSnapshotData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
boxes_resources_page_create_snapshot_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	BoxesResourcesPageCreateSnapshotData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_resources_page_create_snapshot_co (_data_);
}

static gboolean
boxes_resources_page_create_snapshot_co (BoxesResourcesPageCreateSnapshotData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->response == ((gint) GTK_RESPONSE_YES)) {
		g_debug ("resources-page.vala:212: Creating snapshot...");
		{
			_data_->_tmp0_ = _data_->self->priv->machine;
			_data_->_state_ = 1;
			boxes_libvirt_machine_create_snapshot (_data_->_tmp0_, "", boxes_resources_page_create_snapshot_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp1_ = boxes_libvirt_machine_create_snapshot_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp2_ = _data_->_tmp1_;
			_g_object_unref0 (_data_->_tmp2_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		goto __finally0;
		__catch0_g_error:
		{
			_data_->_error_ = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			_data_->_tmp3_ = _data_->_error_;
			_data_->_tmp4_ = _data_->_tmp3_->message;
			g_warning ("resources-page.vala:218: Failed to create snapshot: %s", _data_->_tmp4_);
			_g_error_free0 (_data_->_error_);
		}
		__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;
		}
	}
	gtk_widget_destroy ((GtkWidget*) _data_->message_dialog);
	boxes_resources_page_open_config_file (_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_resources_page_on_domain_configuration_edited_g_file_monitor_changed (GFileMonitor* _sender,
                                                                             GFile* file,
                                                                             GFile* other_file,
                                                                             GFileMonitorEvent event_type,
                                                                             gpointer self)
{
	boxes_resources_page_on_domain_configuration_edited ((BoxesResourcesPage*) self, file, other_file, event_type);
}

static void
boxes_resources_page_open_config_file (BoxesResourcesPage* self)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		gchar* domain_xml = NULL;
		BoxesLibvirtMachine* _tmp0_;
		GVirConfigDomain* _tmp1_;
		GVirConfigDomain* _tmp2_;
		gchar* _tmp3_;
		GFile* file = NULL;
		const gchar* _tmp4_;
		BoxesLibvirtMachine* _tmp5_;
		GVirDomain* _tmp6_;
		GVirDomain* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		GFile* _tmp15_;
		GFile* _tmp16_;
		GFileOutputStream* os = NULL;
		GFile* _tmp17_;
		GFileOutputStream* _tmp18_;
		GFileOutputStream* _tmp19_;
		const gchar* _tmp20_;
		guint8* _tmp21_;
		gint _tmp21__length1;
		gint _tmp22_ = 0;
		guint8* _tmp23_;
		gint _tmp23__length1;
		GFileMonitor* _tmp24_ = NULL;
		GFile* _tmp25_;
		GFileMonitor* _tmp26_;
		GFileMonitor* _tmp27_;
		GFileMonitor* _tmp28_;
		GFile* _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		_tmp0_ = self->priv->machine;
		_tmp1_ = boxes_libvirt_machine_get_domain_config (_tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = gvir_config_object_to_xml ((GVirConfigObject*) _tmp2_);
		domain_xml = _tmp3_;
		_tmp4_ = g_get_home_dir ();
		_tmp5_ = self->priv->machine;
		_tmp6_ = boxes_libvirt_machine_get_domain (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = gvir_domain_get_name (_tmp7_);
		_tmp9_ = g_strconcat (".", _tmp8_, NULL);
		_tmp10_ = _tmp9_;
		_tmp11_ = g_strconcat (_tmp10_, ".draft.txt", NULL);
		_tmp12_ = _tmp11_;
		_tmp13_ = g_build_filename (_tmp4_, _tmp12_, NULL);
		_tmp14_ = _tmp13_;
		_tmp15_ = g_file_new_for_path (_tmp14_);
		_tmp16_ = _tmp15_;
		_g_free0 (_tmp14_);
		_g_free0 (_tmp12_);
		_g_free0 (_tmp10_);
		file = _tmp16_;
		_tmp17_ = file;
		_tmp18_ = g_file_replace (_tmp17_, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, &_inner_error0_);
		os = _tmp18_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (file);
			_g_free0 (domain_xml);
			goto __catch0_g_error;
		}
		_tmp19_ = os;
		_tmp20_ = domain_xml;
		_tmp21_ = string_get_data (_tmp20_, &_tmp22_);
		_tmp21__length1 = _tmp22_;
		_tmp23_ = _tmp21_;
		_tmp23__length1 = _tmp21__length1;
		g_output_stream_write ((GOutputStream*) _tmp19_, _tmp23_, (gsize) _tmp23__length1, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (os);
			_g_object_unref0 (file);
			_g_free0 (domain_xml);
			goto __catch0_g_error;
		}
		_tmp25_ = file;
		_tmp26_ = g_file_monitor_file (_tmp25_, G_FILE_MONITOR_NONE, NULL, &_inner_error0_);
		_tmp24_ = _tmp26_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (os);
			_g_object_unref0 (file);
			_g_free0 (domain_xml);
			goto __catch0_g_error;
		}
		_tmp27_ = _tmp24_;
		_tmp24_ = NULL;
		_g_object_unref0 (self->priv->config_file_monitor);
		self->priv->config_file_monitor = _tmp27_;
		_tmp28_ = self->priv->config_file_monitor;
		g_signal_connect_object (_tmp28_, "changed", (GCallback) _boxes_resources_page_on_domain_configuration_edited_g_file_monitor_changed, self, 0);
		_tmp29_ = file;
		_tmp30_ = g_file_get_uri (_tmp29_);
		_tmp31_ = _tmp30_;
		g_app_info_launch_default_for_uri (_tmp31_, NULL, &_inner_error0_);
		_g_free0 (_tmp31_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (_tmp24_);
			_g_object_unref0 (os);
			_g_object_unref0 (file);
			_g_free0 (domain_xml);
			goto __catch0_g_error;
		}
		_g_object_unref0 (_tmp24_);
		_g_object_unref0 (os);
		_g_object_unref0 (file);
		_g_free0 (domain_xml);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp32_;
		const gchar* _tmp33_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp32_ = _error_;
		_tmp33_ = _tmp32_->message;
		g_warning ("resources-page.vala:239: Failed to edit VM configuration: %s", _tmp33_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
}

static gchar*
g_date_time_to_string (GDateTime* self)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_date_time_format (self, "%FT%H:%M:%S%z");
	result = _tmp0_;
	return result;
}

static void
boxes_resources_page_on_domain_configuration_edited (BoxesResourcesPage* self,
                                                     GFile* file,
                                                     GFile* other_file,
                                                     GFileMonitorEvent event_type)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file != NULL);
	if (event_type != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT) {
		return;
	}
	{
		guint8* contents = NULL;
		gint contents_length1 = 0;
		gint _contents_size_ = 0;
		gchar* etag_out = NULL;
		guint8* _tmp0_ = NULL;
		gsize _tmp1_ = 0;
		gchar* _tmp2_ = NULL;
		GVirConfigDomain* new_config = NULL;
		guint8* _tmp3_;
		gint _tmp3__length1;
		GVirConfigDomain* _tmp4_;
		gchar* edited_tag = NULL;
		GDateTime* _tmp5_;
		GDateTime* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		GVirConfigDomain* _tmp11_;
		const gchar* _tmp12_;
		BoxesLibvirtMachine* _tmp13_;
		GVirDomain* _tmp14_;
		GVirDomain* _tmp15_;
		GVirConfigDomain* _tmp16_;
		BoxesLibvirtMachine* _tmp17_;
		GVirDomain* _tmp18_;
		GVirDomain* _tmp19_;
		const gchar* _tmp20_;
		g_file_load_contents (file, NULL, &_tmp0_, &_tmp1_, &_tmp2_, &_inner_error0_);
		contents = (g_free (contents), NULL);
		contents = _tmp0_;
		contents_length1 = _tmp1_;
		_contents_size_ = contents_length1;
		_g_free0 (etag_out);
		etag_out = _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (etag_out);
			contents = (g_free (contents), NULL);
			goto __catch0_g_error;
		}
		_tmp3_ = contents;
		_tmp3__length1 = contents_length1;
		_tmp4_ = gvir_config_domain_new_from_xml ((const gchar*) _tmp3_, &_inner_error0_);
		new_config = _tmp4_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (etag_out);
			contents = (g_free (contents), NULL);
			goto __catch0_g_error;
		}
		_tmp5_ = g_date_time_new_now_local ();
		_tmp6_ = _tmp5_;
		_tmp7_ = g_date_time_to_string (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_strdup_printf ("<edited>%s</edited>", _tmp8_);
		_tmp10_ = _tmp9_;
		_g_free0 (_tmp8_);
		_g_date_time_unref0 (_tmp6_);
		edited_tag = _tmp10_;
		_tmp11_ = new_config;
		_tmp12_ = edited_tag;
		gvir_config_domain_set_custom_xml (_tmp11_, _tmp12_, "edited", "https://wiki.gnome.org/Apps/Boxes/edited", &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (edited_tag);
			_g_object_unref0 (new_config);
			_g_free0 (etag_out);
			contents = (g_free (contents), NULL);
			goto __catch0_g_error;
		}
		_tmp13_ = self->priv->machine;
		_tmp14_ = boxes_libvirt_machine_get_domain (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = new_config;
		gvir_domain_set_config (_tmp15_, _tmp16_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (edited_tag);
			_g_object_unref0 (new_config);
			_g_free0 (etag_out);
			contents = (g_free (contents), NULL);
			goto __catch0_g_error;
		}
		_tmp17_ = self->priv->machine;
		_tmp18_ = boxes_libvirt_machine_get_domain (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = gvir_domain_get_name (_tmp19_);
		g_debug ("resources-page.vala:262: Overriding configuration for %s", _tmp20_);
		_g_free0 (edited_tag);
		_g_object_unref0 (new_config);
		_g_free0 (etag_out);
		contents = (g_free (contents), NULL);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp21_;
		const gchar* _tmp22_;
		GtkMessageDialog* message_dialog = NULL;
		BoxesApp* _tmp23_;
		BoxesAppWindow* _tmp24_;
		BoxesAppWindow* _tmp25_;
		GError* _tmp26_;
		const gchar* _tmp27_;
		GtkMessageDialog* _tmp28_;
		GtkMessageDialog* _tmp29_;
		GtkMessageDialog* _tmp30_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp21_ = _error_;
		_tmp22_ = _tmp21_->message;
		g_warning ("resources-page.vala:264: Failed to load new domain configuration: %s", _tmp22_);
		_tmp23_ = boxes_app_app;
		_tmp24_ = boxes_app_get_main_window (_tmp23_);
		_tmp25_ = _tmp24_;
		_tmp26_ = _error_;
		_tmp27_ = _tmp26_->message;
		_tmp28_ = (GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) _tmp25_, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _ ("Failed to save domain configuration: %s"), _tmp27_);
		g_object_ref_sink (_tmp28_);
		message_dialog = _tmp28_;
		_tmp29_ = message_dialog;
		gtk_dialog_run ((GtkDialog*) _tmp29_);
		_tmp30_ = message_dialog;
		gtk_widget_destroy ((GtkWidget*) _tmp30_);
		_g_object_unref0 (message_dialog);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
}

static void
boxes_resources_page_on_machine_state_changed (BoxesResourcesPage* self)
{
	BoxesLibvirtMachine* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->machine;
	_tmp1_ = boxes_machine_get_is_running ((BoxesMachine*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		HdyPreferencesGroup* _tmp3_;
		_tmp3_ = self->priv->resources_group;
		hdy_preferences_group_set_description (_tmp3_, _ ("Changes to the settings below take effect after you restart your box."));
	} else {
		HdyPreferencesGroup* _tmp4_;
		_tmp4_ = self->priv->resources_group;
		hdy_preferences_group_set_description (_tmp4_, NULL);
	}
}

static void
boxes_resources_page_bind_widget_property (BoxesResourcesPage* self,
                                           GtkWidget* widget,
                                           const gchar* widget_property,
                                           const gchar* machine_property)
{
	BoxesLibvirtMachine* _tmp0_;
	GValue value = {0};
	BoxesLibvirtMachine* _tmp1_;
	GObjectClass* _tmp2_;
	GParamSpec* _tmp3_;
	GValue _tmp4_ = {0};
	BoxesLibvirtMachine* _tmp5_;
	GValue _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	g_return_if_fail (widget_property != NULL);
	g_return_if_fail (machine_property != NULL);
	_tmp0_ = self->priv->machine;
	g_object_bind_property_with_closures ((GObject*) _tmp0_, machine_property, (GObject*) widget, widget_property, G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp1_ = self->priv->machine;
	_tmp2_ = G_OBJECT_GET_CLASS ((GObject*) _tmp1_);
	_tmp3_ = g_object_class_find_property (_tmp2_, machine_property);
	g_value_init (&_tmp4_, _tmp3_->value_type);
	value = _tmp4_;
	_tmp5_ = self->priv->machine;
	g_object_get_property ((GObject*) _tmp5_, machine_property, &value);
	_tmp6_ = value;
	g_object_set_property ((GObject*) widget, widget_property, &_tmp6_);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
}

static void
_vala_GVirDomainInfo_free (GVirDomainInfo* self)
{
	g_boxed_free (gvir_domain_info_get_type (), self);
}

static gchar*
boxes_resources_page_collect_logs (BoxesResourcesPage* self,
                                   BoxesLibvirtMachine* machine)
{
	GString* builder = NULL;
	GString* _tmp0_;
	GString* _tmp1_;
	BoxesCollectionSource* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GString* _tmp6_;
	GVirDomain* _tmp7_;
	GVirDomain* _tmp8_;
	const gchar* _tmp9_;
	GString* _tmp10_;
	GVirDomain* _tmp11_;
	GVirDomain* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_ = NULL;
	GVirDomain* _tmp15_;
	GVirDomain* _tmp16_;
	GString* _tmp17_;
	BoxesDisplay* _tmp35_;
	BoxesDisplay* _tmp36_;
	GString* _tmp62_;
	const gchar* _tmp63_;
	gchar* _tmp64_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (machine != NULL, NULL);
	_tmp0_ = g_string_new ("");
	builder = _tmp0_;
	_tmp1_ = builder;
	_tmp2_ = ((BoxesMachine*) machine)->source;
	_tmp3_ = boxes_collection_source_get_uri (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_;
	g_string_append_printf (_tmp1_, "Broker URL: %s\n", _tmp5_);
	_g_free0 (_tmp5_);
	_tmp6_ = builder;
	_tmp7_ = boxes_libvirt_machine_get_domain (machine);
	_tmp8_ = _tmp7_;
	_tmp9_ = gvir_domain_get_name (_tmp8_);
	g_string_append_printf (_tmp6_, "Domain: %s\n", _tmp9_);
	_tmp10_ = builder;
	_tmp11_ = boxes_libvirt_machine_get_domain (machine);
	_tmp12_ = _tmp11_;
	_tmp13_ = gvir_domain_get_uuid (_tmp12_);
	g_string_append_printf (_tmp10_, "UUID: %s\n", _tmp13_);
	_tmp15_ = boxes_libvirt_machine_get_domain (machine);
	_tmp16_ = _tmp15_;
	if (gvir_domain_get_persistent (_tmp16_)) {
		_tmp14_ = "yes";
	} else {
		_tmp14_ = "no";
	}
	_tmp17_ = builder;
	g_string_append_printf (_tmp17_, "Persistent: %s\n", _tmp14_);
	{
		GVirDomainInfo* info = NULL;
		GVirDomain* _tmp18_;
		GVirDomain* _tmp19_;
		GVirDomainInfo* _tmp20_;
		GString* _tmp21_;
		GVirDomainInfo* _tmp22_;
		GString* _tmp23_;
		GVirDomainInfo* _tmp24_;
		GVirNodeInfo* _tmp25_ = NULL;
		GVirConnection* _tmp26_;
		GVirConnection* _tmp27_;
		GVirNodeInfo* _tmp28_;
		GString* _tmp29_;
		GString* _tmp30_;
		GVirDomainInfo* _tmp31_;
		GString* _tmp32_;
		GVirDomainInfo* _tmp33_;
		GEnumValue* _tmp34_;
		_tmp18_ = boxes_libvirt_machine_get_domain (machine);
		_tmp19_ = _tmp18_;
		_tmp20_ = gvir_domain_get_info (_tmp19_, &_inner_error0_);
		info = _tmp20_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp21_ = builder;
		_tmp22_ = info;
		g_string_append_printf (_tmp21_, "Cpu time: %" G_GINT64_MODIFIER "d\n", _tmp22_->cpuTime);
		_tmp23_ = builder;
		_tmp24_ = info;
		g_string_append_printf (_tmp23_, "Memory: %" G_GINT64_MODIFIER "d KiB\n", _tmp24_->memory);
		_tmp26_ = boxes_libvirt_machine_get_connection (machine);
		_tmp27_ = _tmp26_;
		_tmp28_ = gvir_connection_get_node_info (_tmp27_, &_inner_error0_);
		_tmp25_ = _tmp28_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			__vala_GVirDomainInfo_free0 (info);
			goto __catch0_g_error;
		}
		_tmp29_ = builder;
		g_string_append_printf (_tmp29_, "Max memory: %" G_GINT64_MODIFIER "d KiB\n", _tmp25_->memory);
		_tmp30_ = builder;
		_tmp31_ = info;
		g_string_append_printf (_tmp30_, "CPUs: %d\n", (gint) _tmp31_->nrVirtCpu);
		_tmp32_ = builder;
		_tmp33_ = info;
		_tmp34_ = g_enum_get_value (g_type_class_ref (gvir_domain_state_get_type ()), _tmp33_->state);
		g_string_append_printf (_tmp32_, "State: %s\n", (_tmp34_ != NULL) ? _tmp34_->value_name : NULL);
		__vala_GVirNodeInfo_free0 (_tmp25_);
		__vala_GVirDomainInfo_free0 (info);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_string_free0 (builder);
		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;
	}
	_tmp35_ = boxes_machine_get_display ((BoxesMachine*) machine);
	_tmp36_ = _tmp35_;
	if (_tmp36_ != NULL) {
		BoxesDisplay* _tmp37_;
		BoxesDisplay* _tmp38_;
		GString* _tmp39_;
		_tmp37_ = boxes_machine_get_display ((BoxesMachine*) machine);
		_tmp38_ = _tmp37_;
		_tmp39_ = builder;
		boxes_display_collect_logs (_tmp38_, _tmp39_);
	}
	{
		GVirConfigDomain* conf = NULL;
		GVirDomain* _tmp40_;
		GVirDomain* _tmp41_;
		GVirConfigDomain* _tmp42_;
		GString* _tmp43_;
		GString* _tmp44_;
		GString* _tmp45_;
		gchar* _tmp46_;
		gchar* _tmp47_;
		GString* _tmp48_;
		_tmp40_ = boxes_libvirt_machine_get_domain (machine);
		_tmp41_ = _tmp40_;
		_tmp42_ = gvir_domain_get_config (_tmp41_, (guint) GVIR_DOMAIN_XML_NONE, &_inner_error0_);
		conf = _tmp42_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch1_g_error;
		}
		_tmp43_ = builder;
		g_string_append_printf (_tmp43_, "\nDomain config:\n");
		_tmp44_ = builder;
		g_string_append_printf (_tmp44_, "------------------------------------------------------------\n");
		_tmp45_ = builder;
		_tmp46_ = gvir_config_object_to_xml ((GVirConfigObject*) conf);
		_tmp47_ = _tmp46_;
		g_string_append (_tmp45_, _tmp47_);
		_g_free0 (_tmp47_);
		_tmp48_ = builder;
		g_string_append_printf (_tmp48_, "%s", "\n" "------------------------------------------------------------\n");
		_g_object_unref0 (conf);
	}
	goto __finally1;
	__catch1_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally1:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_string_free0 (builder);
		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;
	}
	{
		gchar* logfile = NULL;
		const gchar* _tmp49_;
		GVirDomain* _tmp50_;
		GVirDomain* _tmp51_;
		const gchar* _tmp52_;
		gchar* _tmp53_;
		gchar* _tmp54_;
		gchar* _tmp55_;
		gchar* _tmp56_;
		gchar* data = NULL;
		gchar* _tmp57_ = NULL;
		GString* _tmp58_;
		GString* _tmp59_;
		GString* _tmp60_;
		GString* _tmp61_;
		_tmp49_ = g_get_user_cache_dir ();
		_tmp50_ = boxes_libvirt_machine_get_domain (machine);
		_tmp51_ = _tmp50_;
		_tmp52_ = gvir_domain_get_name (_tmp51_);
		_tmp53_ = g_strconcat (_tmp52_, ".log", NULL);
		_tmp54_ = _tmp53_;
		_tmp55_ = g_build_filename (_tmp49_, "libvirt/qemu/log", _tmp54_, NULL);
		_tmp56_ = _tmp55_;
		_g_free0 (_tmp54_);
		logfile = _tmp56_;
		g_file_get_contents (logfile, &_tmp57_, NULL, &_inner_error0_);
		_g_free0 (data);
		data = _tmp57_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (data);
			_g_free0 (logfile);
			goto __catch2_g_error;
		}
		_tmp58_ = builder;
		g_string_append_printf (_tmp58_, "\nQEMU log:\n");
		_tmp59_ = builder;
		g_string_append_printf (_tmp59_, "------------------------------------------------------------\n");
		_tmp60_ = builder;
		g_string_append (_tmp60_, data);
		_tmp61_ = builder;
		g_string_append_printf (_tmp61_, "------------------------------------------------------------\n");
		_g_free0 (data);
		_g_free0 (logfile);
	}
	goto __finally2;
	__catch2_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally2:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_string_free0 (builder);
		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;
	}
	_tmp62_ = builder;
	_tmp63_ = _tmp62_->str;
	_tmp64_ = g_strdup (_tmp63_);
	result = _tmp64_;
	_g_string_free0 (builder);
	return result;
}

BoxesResourcesPage*
boxes_resources_page_construct (GType object_type)
{
	BoxesResourcesPage * self = NULL;
	self = (BoxesResourcesPage*) g_object_new (object_type, NULL);
	return self;
}

BoxesResourcesPage*
boxes_resources_page_new (void)
{
	return boxes_resources_page_construct (BOXES_TYPE_RESOURCES_PAGE);
}

static void
boxes_resources_page_class_init (BoxesResourcesPageClass * klass,
                                 gpointer klass_data)
{
	boxes_resources_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BoxesResourcesPage_private_offset);
	G_OBJECT_CLASS (klass)->finalize = boxes_resources_page_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Boxes/ui/preferences/resources-page.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "box_name_entry", FALSE, BoxesResourcesPage_private_offset + G_STRUCT_OFFSET (BoxesResourcesPagePrivate, box_name_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "address_group", FALSE, BoxesResourcesPage_private_offset + G_STRUCT_OFFSET (BoxesResourcesPagePrivate, address_group));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "ip_address_row", FALSE, BoxesResourcesPage_private_offset + G_STRUCT_OFFSET (BoxesResourcesPagePrivate, ip_address_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "ip_address_label", FALSE, BoxesResourcesPage_private_offset + G_STRUCT_OFFSET (BoxesResourcesPagePrivate, ip_address_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "resources_group", FALSE, BoxesResourcesPage_private_offset + G_STRUCT_OFFSET (BoxesResourcesPagePrivate, resources_group));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "cpus_spin_button", FALSE, BoxesResourcesPage_private_offset + G_STRUCT_OFFSET (BoxesResourcesPagePrivate, cpus_spin_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "ram_row", FALSE, BoxesResourcesPage_private_offset + G_STRUCT_OFFSET (BoxesResourcesPagePrivate, ram_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "storage_row", FALSE, BoxesResourcesPage_private_offset + G_STRUCT_OFFSET (BoxesResourcesPagePrivate, storage_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "acceleration_3d_row", FALSE, BoxesResourcesPage_private_offset + G_STRUCT_OFFSET (BoxesResourcesPagePrivate, acceleration_3d_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "acceleration_3d_toggle", FALSE, BoxesResourcesPage_private_offset + G_STRUCT_OFFSET (BoxesResourcesPagePrivate, acceleration_3d_toggle));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "run_in_bg_toggle", FALSE, BoxesResourcesPage_private_offset + G_STRUCT_OFFSET (BoxesResourcesPagePrivate, run_in_bg_toggle));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_run_in_bg_toggled", G_CALLBACK(_boxes_resources_page_on_run_in_bg_toggled_gtk_switch_activate));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "show_logs", G_CALLBACK(_boxes_resources_page_show_logs_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_edit_configuration_button_clicked", G_CALLBACK(_boxes_resources_page_on_edit_configuration_button_clicked_gtk_button_clicked));
}

static void
boxes_resources_page_instance_init (BoxesResourcesPage * self,
                                    gpointer klass)
{
	self->priv = boxes_resources_page_get_instance_private (self);
	g_type_ensure (BOXES_TYPE_VM_NAME_ROW);
	g_type_ensure (BOXES_TYPE_RAM_ROW);
	g_type_ensure (BOXES_TYPE_STORAGE_ROW);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
boxes_resources_page_finalize (GObject * obj)
{
	BoxesResourcesPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_RESOURCES_PAGE, BoxesResourcesPage);
	_g_object_unref0 (self->priv->machine);
	_g_object_unref0 (self->priv->config_file_monitor);
	_g_free0 (self->priv->logs);
	G_OBJECT_CLASS (boxes_resources_page_parent_class)->finalize (obj);
}

static GType
boxes_resources_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BoxesResourcesPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_resources_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesResourcesPage), 0, (GInstanceInitFunc) boxes_resources_page_instance_init, NULL };
	GType boxes_resources_page_type_id;
	boxes_resources_page_type_id = g_type_register_static (hdy_preferences_page_get_type (), "BoxesResourcesPage", &g_define_type_info, 0);
	BoxesResourcesPage_private_offset = g_type_add_instance_private (boxes_resources_page_type_id, sizeof (BoxesResourcesPagePrivate));
	return boxes_resources_page_type_id;
}

GType
boxes_resources_page_get_type (void)
{
	static volatile gsize boxes_resources_page_type_id__once = 0;
	if (g_once_init_enter (&boxes_resources_page_type_id__once)) {
		GType boxes_resources_page_type_id;
		boxes_resources_page_type_id = boxes_resources_page_get_type_once ();
		g_once_init_leave (&boxes_resources_page_type_id__once, boxes_resources_page_type_id);
	}
	return boxes_resources_page_type_id__once;
}

