/* main.c generated by valac 0.16.0.2-f2187, the Vala compiler
 * generated from main.vala, do not modify */

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

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <cogl/cogl.h>
#include <clutter/clutter.h>
#include <clutter-gtk/clutter-gtk.h>
#include <stdio.h>
#include <version.h>
#include <gio/gio.h>
#include <config.h>
#include <libvirt-gobject/libvirt-gobject.h>
#include <gdk/gdk.h>

#define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block19Data Block19Data;
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
typedef struct _RunChecksData RunChecksData;

#define BOXES_TYPE_UI (boxes_ui_get_type ())
#define BOXES_UI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_UI, BoxesUI))
#define BOXES_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_UI, BoxesUIClass))
#define BOXES_IS_UI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_UI))
#define BOXES_IS_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_UI))
#define BOXES_UI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_UI, BoxesUIClass))

typedef struct _BoxesUI BoxesUI;
typedef struct _BoxesUIClass BoxesUIClass;

#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;
typedef struct _Block20Data Block20Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _BoxesUIPrivate BoxesUIPrivate;

#define BOXES_TYPE_UI_STATE (boxes_ui_state_get_type ())
typedef struct _BoxesAppPrivate BoxesAppPrivate;

#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_TOPBAR (boxes_topbar_get_type ())
#define BOXES_TOPBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_TOPBAR, BoxesTopbar))
#define BOXES_TOPBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_TOPBAR, BoxesTopbarClass))
#define BOXES_IS_TOPBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_TOPBAR))
#define BOXES_IS_TOPBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_TOPBAR))
#define BOXES_TOPBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_TOPBAR, BoxesTopbarClass))

typedef struct _BoxesTopbar BoxesTopbar;
typedef struct _BoxesTopbarClass BoxesTopbarClass;

#define BOXES_TYPE_NOTIFICATIONBAR (boxes_notificationbar_get_type ())
#define BOXES_NOTIFICATIONBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_NOTIFICATIONBAR, BoxesNotificationbar))
#define BOXES_NOTIFICATIONBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_NOTIFICATIONBAR, BoxesNotificationbarClass))
#define BOXES_IS_NOTIFICATIONBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_NOTIFICATIONBAR))
#define BOXES_IS_NOTIFICATIONBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_NOTIFICATIONBAR))
#define BOXES_NOTIFICATIONBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_NOTIFICATIONBAR, BoxesNotificationbarClass))

typedef struct _BoxesNotificationbar BoxesNotificationbar;
typedef struct _BoxesNotificationbarClass BoxesNotificationbarClass;

#define BOXES_TYPE_SIDEBAR (boxes_sidebar_get_type ())
#define BOXES_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_SIDEBAR, BoxesSidebar))
#define BOXES_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_SIDEBAR, BoxesSidebarClass))
#define BOXES_IS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_SIDEBAR))
#define BOXES_IS_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_SIDEBAR))
#define BOXES_SIDEBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_SIDEBAR, BoxesSidebarClass))

typedef struct _BoxesSidebar BoxesSidebar;
typedef struct _BoxesSidebarClass BoxesSidebarClass;

#define BOXES_TYPE_SELECTIONBAR (boxes_selectionbar_get_type ())
#define BOXES_SELECTIONBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_SELECTIONBAR, BoxesSelectionbar))
#define BOXES_SELECTIONBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_SELECTIONBAR, BoxesSelectionbarClass))
#define BOXES_IS_SELECTIONBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_SELECTIONBAR))
#define BOXES_IS_SELECTIONBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_SELECTIONBAR))
#define BOXES_SELECTIONBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_SELECTIONBAR, BoxesSelectionbarClass))

typedef struct _BoxesSelectionbar BoxesSelectionbar;
typedef struct _BoxesSelectionbarClass BoxesSelectionbarClass;

#define BOXES_TYPE_WIZARD (boxes_wizard_get_type ())
#define BOXES_WIZARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_WIZARD, BoxesWizard))
#define BOXES_WIZARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_WIZARD, BoxesWizardClass))
#define BOXES_IS_WIZARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_WIZARD))
#define BOXES_IS_WIZARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_WIZARD))
#define BOXES_WIZARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_WIZARD, BoxesWizardClass))

typedef struct _BoxesWizard BoxesWizard;
typedef struct _BoxesWizardClass BoxesWizardClass;

#define BOXES_TYPE_PROPERTIES (boxes_properties_get_type ())
#define BOXES_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_PROPERTIES, BoxesProperties))
#define BOXES_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_PROPERTIES, BoxesPropertiesClass))
#define BOXES_IS_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_PROPERTIES))
#define BOXES_IS_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_PROPERTIES))
#define BOXES_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_PROPERTIES, BoxesPropertiesClass))

typedef struct _BoxesProperties BoxesProperties;
typedef struct _BoxesPropertiesClass BoxesPropertiesClass;

#define BOXES_TYPE_DISPLAY_PAGE (boxes_display_page_get_type ())
#define BOXES_DISPLAY_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_DISPLAY_PAGE, BoxesDisplayPage))
#define BOXES_DISPLAY_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_DISPLAY_PAGE, BoxesDisplayPageClass))
#define BOXES_IS_DISPLAY_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_DISPLAY_PAGE))
#define BOXES_IS_DISPLAY_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_DISPLAY_PAGE))
#define BOXES_DISPLAY_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_DISPLAY_PAGE, BoxesDisplayPageClass))

typedef struct _BoxesDisplayPage BoxesDisplayPage;
typedef struct _BoxesDisplayPageClass BoxesDisplayPageClass;

#define BOXES_TYPE_COLLECTION (boxes_collection_get_type ())
#define BOXES_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_COLLECTION, BoxesCollection))
#define BOXES_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_COLLECTION, BoxesCollectionClass))
#define BOXES_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_COLLECTION))
#define BOXES_IS_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_COLLECTION))
#define BOXES_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_COLLECTION, BoxesCollectionClass))

typedef struct _BoxesCollection BoxesCollection;
typedef struct _BoxesCollectionClass BoxesCollectionClass;

struct _Block19Data {
	int _ref_count_;
	GMainLoop* loop;
};

struct _RunChecksData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	gboolean _tmp0_;
	gboolean cpu;
	gboolean _tmp1_;
	gboolean kvm;
	FILE* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	FILE* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
};

struct _Block20Data {
	int _ref_count_;
	BoxesApp* app;
};

typedef enum  {
	BOXES_UI_STATE_NONE,
	BOXES_UI_STATE_COLLECTION,
	BOXES_UI_STATE_CREDS,
	BOXES_UI_STATE_DISPLAY,
	BOXES_UI_STATE_SETTINGS,
	BOXES_UI_STATE_WIZARD,
	BOXES_UI_STATE_PROPERTIES
} BoxesUIState;

struct _BoxesUI {
	GObject parent_instance;
	BoxesUIPrivate * priv;
	BoxesUIState previous_ui_state;
};

struct _BoxesUIClass {
	GObjectClass parent_class;
	void (*ui_state_changed) (BoxesUI* self);
	ClutterActor* (*get_actor) (BoxesUI* self);
};

struct _BoxesApp {
	BoxesUI parent_instance;
	BoxesAppPrivate * priv;
	GtkApplicationWindow* window;
	GtkNotebook* notebook;
	GtkClutterEmbed* embed;
	ClutterStage* stage;
	ClutterState* state;
	ClutterBox* box;
	BoxesCollectionItem* current_item;
	BoxesTopbar* topbar;
	BoxesNotificationbar* notificationbar;
	BoxesSidebar* sidebar;
	BoxesSelectionbar* selectionbar;
	guint duration;
	GSettings* settings;
	BoxesWizard* wizard;
	BoxesProperties* properties;
	BoxesDisplayPage* display_page;
	BoxesCollection* collection;
	GSimpleAction* action_properties;
	GSimpleAction* action_fullscreen;
};

struct _BoxesAppClass {
	BoxesUIClass parent_class;
};


extern gboolean version;
gboolean version = FALSE;
extern gboolean fullscreen;
gboolean fullscreen = FALSE;
extern gboolean checks;
gboolean checks = FALSE;
extern gchar** uris;
extern gint uris_length1;
gchar** uris = NULL;
gint uris_length1 = 0;
static gint _uris_size_ = 0;

void parse_args (gchar*** args, int* args_length1);
static Block19Data* block19_data_ref (Block19Data* _data19_);
static void block19_data_unref (void * _userdata_);
void run_checks (GAsyncReadyCallback _callback_, gpointer _user_data_);
void run_checks_finish (GAsyncResult* _res_);
static void ___lambda128_ (Block19Data* _data19_, GObject* obj, GAsyncResult* res);
static void ____lambda128__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
static void run_checks_data_free (gpointer _data);
static gboolean run_checks_co (RunChecksData* _data_);
void boxes_check_cpu_vt_capability (GAsyncReadyCallback _callback_, gpointer _user_data_);
gboolean boxes_check_cpu_vt_capability_finish (GAsyncResult* _res_);
static void run_checks_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void boxes_check_module_kvm_loaded (GAsyncReadyCallback _callback_, gpointer _user_data_);
gboolean boxes_check_module_kvm_loaded_finish (GAsyncResult* _res_);
gchar* boxes_yes_no (gboolean value);
gint _vala_main (gchar** args, int args_length1);
GType boxes_ui_get_type (void) G_GNUC_CONST;
GType boxes_app_get_type (void) G_GNUC_CONST;
static Block20Data* block20_data_ref (Block20Data* _data20_);
static void block20_data_unref (void * _userdata_);
gchar* boxes_get_style (const gchar* file_name);
BoxesApp* boxes_app_new (void);
BoxesApp* boxes_app_construct (GType object_type);
static void __lambda129_ (Block20Data* _data20_, gboolean first_time);
GType boxes_ui_state_get_type (void) G_GNUC_CONST;
GType boxes_collection_item_get_type (void) G_GNUC_CONST;
GType boxes_topbar_get_type (void) G_GNUC_CONST;
GType boxes_notificationbar_get_type (void) G_GNUC_CONST;
GType boxes_sidebar_get_type (void) G_GNUC_CONST;
GType boxes_selectionbar_get_type (void) G_GNUC_CONST;
GType boxes_wizard_get_type (void) G_GNUC_CONST;
GType boxes_properties_get_type (void) G_GNUC_CONST;
GType boxes_display_page_get_type (void) G_GNUC_CONST;
GType boxes_collection_get_type (void) G_GNUC_CONST;
void boxes_wizard_open_with_uri (BoxesWizard* self, const gchar* uri, gboolean skip_review_for_live);
gboolean boxes_app_open (BoxesApp* self, const gchar* name);
void boxes_ui_set_ui_state (BoxesUI* self, BoxesUIState value);
void boxes_app_set_fullscreen (BoxesApp* self, gboolean value);
static void ___lambda129__boxes_app_ready (BoxesApp* _sender, gboolean first_time, gpointer self);
gint boxes_app_run (BoxesApp* self);

const GOptionEntry options[5] = {{"version", (gchar) 0, 0, G_OPTION_ARG_NONE, &version, "Display version number", NULL}, {"full-screen", 'f', 0, G_OPTION_ARG_NONE, &fullscreen, "Open in full screen", NULL}, {"checks", (gchar) 0, 0, G_OPTION_ARG_NONE, &checks, "Check virtualization capabilities", NULL}, {"", (gchar) 0, 0, G_OPTION_ARG_STRING_ARRAY, &uris, "URI to display, broker or installer media", NULL}, {NULL}};

static Block19Data* block19_data_ref (Block19Data* _data19_) {
	g_atomic_int_inc (&_data19_->_ref_count_);
	return _data19_;
}


static void block19_data_unref (void * _userdata_) {
	Block19Data* _data19_;
	_data19_ = (Block19Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data19_->_ref_count_)) {
		_g_main_loop_unref0 (_data19_->loop);
		g_slice_free (Block19Data, _data19_);
	}
}


static void ___lambda128_ (Block19Data* _data19_, GObject* obj, GAsyncResult* res) {
	GAsyncResult* _tmp0_;
	GMainLoop* _tmp1_;
	g_return_if_fail (res != NULL);
	_tmp0_ = res;
	run_checks_finish (_tmp0_);
	_tmp1_ = _data19_->loop;
	g_main_loop_quit (_tmp1_);
}


static void ____lambda128__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	___lambda128_ (self, source_object, res);
	block19_data_unref (self);
}


void parse_args (gchar*** args, int* args_length1) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_;
	gchar* parameter_string;
	const gchar* _tmp2_;
	GOptionContext* _tmp3_;
	GOptionContext* opt_context;
	GOptionContext* _tmp4_;
	GOptionContext* _tmp5_;
	GOptionContext* _tmp6_;
	GOptionContext* _tmp7_;
	GOptionGroup* _tmp8_ = NULL;
	GOptionContext* _tmp9_;
	GOptionGroup* _tmp10_ = NULL;
	GOptionContext* _tmp11_;
	GOptionGroup* _tmp12_ = NULL;
	GOptionContext* _tmp13_;
	GOptionGroup* _tmp14_ = NULL;
	gboolean _tmp22_;
	gboolean _tmp24_;
	GError * _inner_error_ = NULL;
	_tmp0_ = _ ("- A simple application to access remote or virtual machines");
	_tmp1_ = g_strdup (_tmp0_);
	parameter_string = _tmp1_;
	_tmp2_ = parameter_string;
	_tmp3_ = g_option_context_new (_tmp2_);
	opt_context = _tmp3_;
	_tmp4_ = opt_context;
	g_option_context_set_help_enabled (_tmp4_, TRUE);
	_tmp5_ = opt_context;
	g_option_context_set_ignore_unknown_options (_tmp5_, TRUE);
	_tmp6_ = opt_context;
	g_option_context_add_main_entries (_tmp6_, options, NULL);
	_tmp7_ = opt_context;
	_tmp8_ = gtk_get_option_group (TRUE);
	g_option_context_add_group (_tmp7_, _tmp8_);
	_tmp9_ = opt_context;
	_tmp10_ = cogl_get_option_group ();
	g_option_context_add_group (_tmp9_, _tmp10_);
	_tmp11_ = opt_context;
	_tmp12_ = clutter_get_option_group_without_init ();
	g_option_context_add_group (_tmp11_, _tmp12_);
	_tmp13_ = opt_context;
	_tmp14_ = gtk_clutter_get_option_group ();
	g_option_context_add_group (_tmp13_, _tmp14_);
	{
		GOptionContext* _tmp15_;
		_tmp15_ = opt_context;
		g_option_context_parse (_tmp15_, args_length1, args, &_inner_error_);
		if (_inner_error_ != NULL) {
			if (g_error_matches (_inner_error_, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE)) {
				goto __catch39_g_option_error_bad_value;
			}
			if (_inner_error_->domain == G_OPTION_ERROR) {
				goto __catch39_g_option_error;
			}
			_g_option_context_free0 (opt_context);
			_g_free0 (parameter_string);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	goto __finally39;
	__catch39_g_option_error_bad_value:
	{
		GError* err = NULL;
		FILE* _tmp16_;
		GOptionContext* _tmp17_;
		gchar* _tmp18_ = NULL;
		gchar* _tmp19_;
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp16_ = stdout;
		_tmp17_ = opt_context;
		_tmp18_ = g_option_context_get_help (_tmp17_, TRUE, NULL);
		_tmp19_ = _tmp18_;
		fprintf (_tmp16_, "%s", _tmp19_);
		_g_free0 (_tmp19_);
		exit (1);
		_g_error_free0 (err);
	}
	goto __finally39;
	__catch39_g_option_error:
	{
		GError* _error_ = NULL;
		GError* _tmp20_;
		const gchar* _tmp21_;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		_tmp20_ = _error_;
		_tmp21_ = _tmp20_->message;
		g_warning ("main.vala:37: %s", _tmp21_);
		_g_error_free0 (_error_);
	}
	__finally39:
	if (_inner_error_ != NULL) {
		_g_option_context_free0 (opt_context);
		_g_free0 (parameter_string);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp22_ = version;
	if (_tmp22_) {
		FILE* _tmp23_;
		_tmp23_ = stdout;
		fprintf (_tmp23_, "%s\n", BUILD_VERSION);
		exit (0);
	}
	_tmp24_ = checks;
	if (_tmp24_) {
		Block19Data* _data19_;
		GMainLoop* _tmp25_;
		GMainLoop* _tmp26_;
		_data19_ = g_slice_new0 (Block19Data);
		_data19_->_ref_count_ = 1;
		_tmp25_ = g_main_loop_new (NULL, FALSE);
		_data19_->loop = _tmp25_;
		run_checks (____lambda128__gasync_ready_callback, block19_data_ref (_data19_));
		_tmp26_ = _data19_->loop;
		g_main_loop_run (_tmp26_);
		exit (0);
		block19_data_unref (_data19_);
		_data19_ = NULL;
	}
	_g_option_context_free0 (opt_context);
	_g_free0 (parameter_string);
}


static void run_checks_data_free (gpointer _data) {
	RunChecksData* _data_;
	_data_ = _data;
	g_slice_free (RunChecksData, _data_);
}


void run_checks (GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RunChecksData* _data_;
	_data_ = g_slice_new0 (RunChecksData);
	_data_->_async_result = g_simple_async_result_new (g_object_newv (G_TYPE_OBJECT, 0, NULL), _callback_, _user_data_, run_checks);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, run_checks_data_free);
	run_checks_co (_data_);
}


void run_checks_finish (GAsyncResult* _res_) {
	RunChecksData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void run_checks_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RunChecksData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	run_checks_co (_data_);
}


static gboolean run_checks_co (RunChecksData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	boxes_check_cpu_vt_capability (run_checks_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = FALSE;
	_data_->_tmp0_ = boxes_check_cpu_vt_capability_finish (_data_->_res_);
	_data_->cpu = _data_->_tmp0_;
	_data_->_state_ = 2;
	boxes_check_module_kvm_loaded (run_checks_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp1_ = FALSE;
	_data_->_tmp1_ = boxes_check_module_kvm_loaded_finish (_data_->_res_);
	_data_->kvm = _data_->_tmp1_;
	_data_->_tmp2_ = stdout;
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = boxes_yes_no (_data_->cpu);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = g_strdup_printf ("The CPU is capable of virtualization: %s\n", _data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	fprintf (_data_->_tmp2_, "%s", _data_->_tmp6_);
	_g_free0 (_data_->_tmp6_);
	_g_free0 (_data_->_tmp4_);
	_data_->_tmp7_ = stdout;
	_data_->_tmp8_ = NULL;
	_data_->_tmp8_ = boxes_yes_no (_data_->kvm);
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp10_ = NULL;
	_data_->_tmp10_ = g_strdup_printf ("The KVM module is loaded: %s\n", _data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	fprintf (_data_->_tmp7_, "%s", _data_->_tmp11_);
	_g_free0 (_data_->_tmp11_);
	_g_free0 (_data_->_tmp9_);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static Block20Data* block20_data_ref (Block20Data* _data20_) {
	g_atomic_int_inc (&_data20_->_ref_count_);
	return _data20_;
}


static void block20_data_unref (void * _userdata_) {
	Block20Data* _data20_;
	_data20_ = (Block20Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data20_->_ref_count_)) {
		_g_object_unref0 (_data20_->app);
		g_slice_free (Block20Data, _data20_);
	}
}


static void __lambda129_ (Block20Data* _data20_, gboolean first_time) {
	gchar** _tmp0_;
	gint _tmp0__length1;
	gboolean _tmp19_;
	_tmp0_ = uris;
	_tmp0__length1 = uris_length1;
	if (_tmp0_ != NULL) {
		gchar** _tmp1_;
		gint _tmp1__length1;
		const gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* arg;
		const gchar* _tmp4_;
		GFile* _tmp5_ = NULL;
		GFile* file;
		gboolean _tmp6_ = FALSE;
		GFile* _tmp7_;
		gboolean _tmp8_ = FALSE;
		gboolean _tmp12_;
		_tmp1_ = uris;
		_tmp1__length1 = uris_length1;
		_tmp2_ = _tmp1_[0];
		_tmp3_ = g_strdup (_tmp2_);
		arg = _tmp3_;
		_tmp4_ = arg;
		_tmp5_ = g_file_new_for_commandline_arg (_tmp4_);
		file = _tmp5_;
		_tmp7_ = file;
		_tmp8_ = g_file_query_exists (_tmp7_, NULL);
		if (_tmp8_) {
			_tmp6_ = TRUE;
		} else {
			const gchar* _tmp9_;
			gchar* _tmp10_ = NULL;
			gchar* _tmp11_;
			_tmp9_ = arg;
			_tmp10_ = g_uri_parse_scheme (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp6_ = _tmp11_ != NULL;
			_g_free0 (_tmp11_);
		}
		_tmp12_ = _tmp6_;
		if (_tmp12_) {
			BoxesWizard* _tmp13_;
			GFile* _tmp14_;
			gchar* _tmp15_ = NULL;
			gchar* _tmp16_;
			_tmp13_ = _data20_->app->wizard;
			_tmp14_ = file;
			_tmp15_ = g_file_get_uri (_tmp14_);
			_tmp16_ = _tmp15_;
			boxes_wizard_open_with_uri (_tmp13_, _tmp16_, TRUE);
			_g_free0 (_tmp16_);
		} else {
			const gchar* _tmp17_;
			_tmp17_ = arg;
			boxes_app_open (_data20_->app, _tmp17_);
		}
		_g_object_unref0 (file);
		_g_free0 (arg);
	} else {
		gboolean _tmp18_;
		_tmp18_ = first_time;
		if (_tmp18_) {
			boxes_ui_set_ui_state ((BoxesUI*) _data20_->app, BOXES_UI_STATE_WIZARD);
		}
	}
	_tmp19_ = fullscreen;
	boxes_app_set_fullscreen (_data20_->app, _tmp19_);
}


static void ___lambda129__boxes_app_ready (BoxesApp* _sender, gboolean first_time, gpointer self) {
	__lambda129_ (self, first_time);
}


gint _vala_main (gchar** args, int args_length1) {
	gint result = 0;
	Block20Data* _data20_;
	const gchar* _tmp0_ = NULL;
	GtkSettings* _tmp2_ = NULL;
	GtkCssProvider* _tmp3_;
	GtkCssProvider* provider;
	BoxesApp* _tmp8_;
	gint _tmp9_ = 0;
	GError * _inner_error_ = NULL;
	_data20_ = g_slice_new0 (Block20Data);
	_data20_->_ref_count_ = 1;
	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	_tmp0_ = _ ("Boxes");
	g_set_application_name (_tmp0_);
	parse_args (&args, &args_length1);
	{
		gvir_init_object_check (&args_length1, &args, &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch40_g_error;
		}
	}
	goto __finally40;
	__catch40_g_error:
	{
		GError* err = NULL;
		const gchar* _tmp1_;
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp1_ = err->message;
		g_error ("main.vala:76: %s", _tmp1_);
		_g_error_free0 (err);
	}
	__finally40:
	if (_inner_error_ != NULL) {
		block20_data_unref (_data20_);
		_data20_ = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return 0;
	}
	gtk_window_set_default_icon_name ("gnome-boxes");
	_tmp2_ = gtk_settings_get_default ();
	g_object_set (_tmp2_, "gtk-application-prefer-dark-theme", TRUE, NULL);
	_tmp3_ = gtk_css_provider_new ();
	provider = _tmp3_;
	{
		gchar* _tmp4_ = NULL;
		gchar* sheet;
		GdkScreen* _tmp5_ = NULL;
		_tmp4_ = boxes_get_style ("gtk-style.css");
		sheet = _tmp4_;
		gtk_css_provider_load_from_path (provider, sheet, &_inner_error_);
		if (_inner_error_ != NULL) {
			_g_free0 (sheet);
			goto __catch41_g_error;
		}
		_tmp5_ = gdk_screen_get_default ();
		gtk_style_context_add_provider_for_screen (_tmp5_, (GtkStyleProvider*) provider, (guint) 600);
		_g_free0 (sheet);
	}
	goto __finally41;
	__catch41_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp6_;
		const gchar* _tmp7_;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		_tmp6_ = _error_;
		_tmp7_ = _tmp6_->message;
		g_warning ("main.vala:89: %s", _tmp7_);
		_g_error_free0 (_error_);
	}
	__finally41:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (provider);
		block20_data_unref (_data20_);
		_data20_ = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return 0;
	}
	_tmp8_ = boxes_app_new ();
	_data20_->app = _tmp8_;
	g_signal_connect_data (_data20_->app, "ready", (GCallback) ___lambda129__boxes_app_ready, block20_data_ref (_data20_), (GClosureNotify) block20_data_unref, 0);
	_tmp9_ = boxes_app_run (_data20_->app);
	result = _tmp9_;
	_g_object_unref0 (provider);
	block20_data_unref (_data20_);
	_data20_ = NULL;
	return result;
}


int main (int argc, char ** argv) {
	g_type_init ();
	return _vala_main (argv, argc);
}



