/* spice-display.c generated by valac 0.17.5.2-8558, the Vala compiler
 * generated from spice-display.vala, do not modify */

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

#include <glib.h>
#include <glib-object.h>
#include <libcommon.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <stdlib.h>
#include <string.h>
#include <spice-client.h>
#include <spice-widget.h>
#include <glib/gi18n-lib.h>


#define BOXES_TYPE_IPROPERTIES_PROVIDER (boxes_iproperties_provider_get_type ())
#define BOXES_IPROPERTIES_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_IPROPERTIES_PROVIDER, BoxesIPropertiesProvider))
#define BOXES_IS_IPROPERTIES_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_IPROPERTIES_PROVIDER))
#define BOXES_IPROPERTIES_PROVIDER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), BOXES_TYPE_IPROPERTIES_PROVIDER, BoxesIPropertiesProviderIface))

typedef struct _BoxesIPropertiesProvider BoxesIPropertiesProvider;
typedef struct _BoxesIPropertiesProviderIface BoxesIPropertiesProviderIface;

#define BOXES_TYPE_PROPERTIES_PAGE (boxes_properties_page_get_type ())

#define BOXES_TYPE_PROPERTY (boxes_property_get_type ())
#define BOXES_PROPERTY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_PROPERTY, BoxesProperty))
#define BOXES_PROPERTY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_PROPERTY, BoxesPropertyClass))
#define BOXES_IS_PROPERTY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_PROPERTY))
#define BOXES_IS_PROPERTY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_PROPERTY))
#define BOXES_PROPERTY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_PROPERTY, BoxesPropertyClass))

typedef struct _BoxesProperty BoxesProperty;
typedef struct _BoxesPropertyClass BoxesPropertyClass;

#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;
typedef struct _BoxesDisplayPrivate BoxesDisplayPrivate;

#define BOXES_TYPE_SPICE_DISPLAY (boxes_spice_display_get_type ())
#define BOXES_SPICE_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_SPICE_DISPLAY, BoxesSpiceDisplay))
#define BOXES_SPICE_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_SPICE_DISPLAY, BoxesSpiceDisplayClass))
#define BOXES_IS_SPICE_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_SPICE_DISPLAY))
#define BOXES_IS_SPICE_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_SPICE_DISPLAY))
#define BOXES_SPICE_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_SPICE_DISPLAY, BoxesSpiceDisplayClass))

typedef struct _BoxesSpiceDisplay BoxesSpiceDisplay;
typedef struct _BoxesSpiceDisplayClass BoxesSpiceDisplayClass;
typedef struct _BoxesSpiceDisplayPrivate BoxesSpiceDisplayPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_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_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;

#define BOXES_TYPE_UI_STATE (boxes_ui_state_get_type ())
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block33Data Block33Data;
typedef struct _Block34Data Block34Data;
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))

typedef enum  {
	BOXES_PROPERTIES_PAGE_LOGIN,
	BOXES_PROPERTIES_PAGE_SYSTEM,
	BOXES_PROPERTIES_PAGE_DISPLAY,
	BOXES_PROPERTIES_PAGE_DEVICES,
	BOXES_PROPERTIES_PAGE_LAST
} BoxesPropertiesPage;

struct _BoxesIPropertiesProviderIface {
	GTypeInterface parent_iface;
	GList* (*get_properties) (BoxesIPropertiesProvider* self, BoxesPropertiesPage page);
};

struct _BoxesDisplay {
	BoxesDisplayProperties parent_instance;
	BoxesDisplayPrivate * priv;
	GHashTable* displays;
};

struct _BoxesDisplayClass {
	BoxesDisplayPropertiesClass parent_class;
	GtkWidget* (*get_display) (BoxesDisplay* self, gint n, GError** error);
	GdkPixbuf* (*get_pixbuf) (BoxesDisplay* self, gint n, GError** error);
	void (*set_enable_inputs) (BoxesDisplay* self, GtkWidget* widget, gboolean enable);
	void (*connect_it) (BoxesDisplay* self);
	void (*disconnect_it) (BoxesDisplay* self);
	GList* (*get_properties) (BoxesDisplay* self, BoxesPropertiesPage page);
	const gchar* (*get_protocol) (BoxesDisplay* self);
	gchar* (*get_uri) (BoxesDisplay* self);
};

struct _BoxesSpiceDisplay {
	BoxesDisplay parent_instance;
	BoxesSpiceDisplayPrivate * priv;
};

struct _BoxesSpiceDisplayClass {
	BoxesDisplayClass parent_class;
};

struct _BoxesSpiceDisplayPrivate {
	SpiceSession* session;
	SpiceGtkSession* gtk_session;
	SpiceAudio* audio;
	gulong channel_new_id;
	gulong channel_destroy_id;
	BoxesDisplayPropertiesSavedProperty* display_saved_properties;
	gint display_saved_properties_length1;
	gint _display_saved_properties_size_;
	BoxesDisplayPropertiesSavedProperty* gtk_session_saved_properties;
	gint gtk_session_saved_properties_length1;
	gint _gtk_session_saved_properties_size_;
	gboolean _resize_guest;
};

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 _Block33Data {
	int _ref_count_;
	BoxesSpiceDisplay * self;
	SpiceMainChannel* main;
};

struct _Block34Data {
	int _ref_count_;
	BoxesSpiceDisplay * self;
	SpiceDisplay* display;
};


static gpointer boxes_spice_display_parent_class = NULL;
extern BoxesApp* boxes_app_app;
static BoxesIPropertiesProviderIface* boxes_spice_display_boxes_iproperties_provider_parent_iface = NULL;

GType boxes_properties_page_get_type (void) G_GNUC_CONST;
GType boxes_property_get_type (void) G_GNUC_CONST;
GType boxes_iproperties_provider_get_type (void) G_GNUC_CONST;
GType boxes_display_get_type (void) G_GNUC_CONST;
GType boxes_spice_display_get_type (void) G_GNUC_CONST;
#define BOXES_SPICE_DISPLAY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BOXES_TYPE_SPICE_DISPLAY, BoxesSpiceDisplayPrivate))
enum  {
	BOXES_SPICE_DISPLAY_DUMMY_PROPERTY,
	BOXES_SPICE_DISPLAY_PROTOCOL,
	BOXES_SPICE_DISPLAY_URI,
	BOXES_SPICE_DISPLAY_RESIZE_GUEST
};
static void _vala_BoxesDisplayPropertiesSavedProperty_array_free (BoxesDisplayPropertiesSavedProperty* array, gint array_length);
static void boxes_spice_display_ui_state_changed (BoxesSpiceDisplay* self);
GType boxes_ui_get_type (void) G_GNUC_CONST;
GType boxes_app_get_type (void) G_GNUC_CONST;
GType boxes_ui_state_get_type (void) G_GNUC_CONST;
BoxesUIState boxes_ui_get_ui_state (BoxesUI* self);
GtkWidget* boxes_display_get_display (BoxesDisplay* self, gint n, GError** error);
gboolean boxes_spice_display_get_resize_guest (BoxesSpiceDisplay* self);
BoxesSpiceDisplay* boxes_spice_display_new (BoxesDisplayConfig* config, const gchar* host, gint port);
BoxesSpiceDisplay* boxes_spice_display_construct (GType object_type, BoxesDisplayConfig* config, const gchar* host, gint port);
BoxesDisplay* boxes_display_construct (GType object_type);
BoxesSpiceDisplay* boxes_spice_display_new_with_uri (BoxesDisplayConfig* config, const gchar* uri);
BoxesSpiceDisplay* boxes_spice_display_construct_with_uri (GType object_type, BoxesDisplayConfig* config, const gchar* uri);
static GtkWidget* boxes_spice_display_real_get_display (BoxesDisplay* base, gint n, GError** error);
static void ___lambda57_ (BoxesSpiceDisplay* self, gint status);
void boxes_display_set_mouse_grabbed (BoxesDisplay* self, gboolean value);
static void ____lambda57__spice_display_mouse_grab (SpiceDisplay* _sender, gint grabbed, gpointer self);
static void boxes_spice_display_real_set_enable_inputs (BoxesDisplay* base, GtkWidget* widget, gboolean enable);
static GdkPixbuf* boxes_spice_display_real_get_pixbuf (BoxesDisplay* base, gint n, GError** error);
static void boxes_spice_display_real_connect_it (BoxesDisplay* base);
static void ___lambda58_ (BoxesSpiceDisplay* self, SpiceChannel* channel);
static Block33Data* block33_data_ref (Block33Data* _data33_);
static void block33_data_unref (void * _userdata_);
static void boxes_spice_display_main_event (BoxesSpiceDisplay* self, SpiceChannelEvent event);
static void _boxes_spice_display_main_event_spice_channel_channel_event (SpiceChannel* _sender, SpiceChannelEvent event, gpointer self);
static void ___lambda59_ (Block33Data* _data33_);
void boxes_display_set_can_grab_mouse (BoxesDisplay* self, gboolean value);
static void ____lambda59__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static Block34Data* block34_data_ref (Block34Data* _data34_);
static void block34_data_unref (void * _userdata_);
static void ____lambda60_ (Block34Data* _data34_);
static void _____lambda60__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void ____lambda58__spice_session_channel_new (SpiceSession* _sender, SpiceChannel* channel, gpointer self);
static void ___lambda61_ (BoxesSpiceDisplay* self, SpiceChannel* channel);
static void ____lambda61__spice_session_channel_destroy (SpiceSession* _sender, SpiceChannel* channel, gpointer self);
const gchar* boxes_display_get_password (BoxesDisplay* self);
static void boxes_spice_display_real_disconnect_it (BoxesDisplay* base);
void boxes_display_set_need_password (BoxesDisplay* self, gboolean value);
static GList* boxes_spice_display_real_get_properties (BoxesIPropertiesProvider* base, BoxesPropertiesPage page);
BoxesProperty* boxes_iproperties_provider_add_property (BoxesIPropertiesProvider* self, GList** list, const gchar* name, GtkWidget* widget);
static void _g_object_unref0_ (gpointer var);
static void _g_list_free__g_object_unref0_ (GList* self);
void boxes_spice_display_set_resize_guest (BoxesSpiceDisplay* self, gboolean value);
static GObject * boxes_spice_display_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _boxes_spice_display___lambda62_ (BoxesSpiceDisplay* self);
static void __boxes_spice_display___lambda62__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void _boxes_spice_display_ui_state_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void boxes_spice_display_finalize (GObject* obj);
const gchar* boxes_display_get_protocol (BoxesDisplay* self);
gchar* boxes_display_get_uri (BoxesDisplay* self);
static void _vala_boxes_spice_display_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_boxes_spice_display_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static void _vala_BoxesDisplayPropertiesSavedProperty_array_free (BoxesDisplayPropertiesSavedProperty* array, gint array_length) {
	if (array != NULL) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			boxes_display_properties_saved_property_destroy (&array[i]);
		}
	}
	g_free (array);
}


static void boxes_spice_display_ui_state_changed (BoxesSpiceDisplay* self) {
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	{
		gboolean _tmp0_ = FALSE;
		BoxesApp* _tmp1_;
		BoxesUIState _tmp2_;
		BoxesUIState _tmp3_;
		gboolean _tmp7_;
		_tmp1_ = boxes_app_app;
		_tmp2_ = boxes_ui_get_ui_state ((BoxesUI*) _tmp1_);
		_tmp3_ = _tmp2_;
		if (_tmp3_ == BOXES_UI_STATE_PROPERTIES) {
			_tmp0_ = TRUE;
		} else {
			BoxesApp* _tmp4_;
			BoxesUIState _tmp5_;
			BoxesUIState _tmp6_;
			_tmp4_ = boxes_app_app;
			_tmp5_ = boxes_ui_get_ui_state ((BoxesUI*) _tmp4_);
			_tmp6_ = _tmp5_;
			_tmp0_ = _tmp6_ == BOXES_UI_STATE_DISPLAY;
		}
		_tmp7_ = _tmp0_;
		if (_tmp7_) {
			GtkWidget* _tmp8_ = NULL;
			GtkWidget* _tmp9_;
			SpiceDisplay* display;
			gboolean _tmp10_ = FALSE;
			BoxesApp* _tmp11_;
			BoxesUIState _tmp12_;
			BoxesUIState _tmp13_;
			SpiceDisplay* _tmp15_;
			gboolean _tmp16_;
			_tmp8_ = boxes_display_get_display ((BoxesDisplay*) self, 0, &_inner_error_);
			_tmp9_ = _tmp8_;
			if (_inner_error_ != NULL) {
				if (_inner_error_->domain == BOXES_ERROR) {
					goto __catch49_boxes_error;
				}
				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;
			}
			display = G_TYPE_CHECK_INSTANCE_TYPE (_tmp9_, spice_display_get_type ()) ? ((SpiceDisplay*) _tmp9_) : NULL;
			_tmp11_ = boxes_app_app;
			_tmp12_ = boxes_ui_get_ui_state ((BoxesUI*) _tmp11_);
			_tmp13_ = _tmp12_;
			if (_tmp13_ == BOXES_UI_STATE_DISPLAY) {
				gboolean _tmp14_;
				_tmp14_ = self->priv->_resize_guest;
				_tmp10_ = _tmp14_;
			} else {
				_tmp10_ = FALSE;
			}
			_tmp15_ = display;
			_tmp16_ = _tmp10_;
			g_object_set (_tmp15_, "resize-guest", _tmp16_, NULL);
			_g_object_unref0 (display);
		}
	}
	goto __finally49;
	__catch49_boxes_error:
	{
		GError* _error_ = NULL;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		_g_error_free0 (_error_);
	}
	__finally49:
	if (_inner_error_ != 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;
	}
}


BoxesSpiceDisplay* boxes_spice_display_construct (GType object_type, BoxesDisplayConfig* config, const gchar* host, gint port) {
	BoxesSpiceDisplay * self = NULL;
	BoxesDisplayConfig* _tmp0_;
	SpiceSession* _tmp1_;
	gint _tmp2_;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_;
	SpiceSession* _tmp5_;
	const gchar* _tmp6_;
	g_return_val_if_fail (config != NULL, NULL);
	g_return_val_if_fail (host != NULL, NULL);
	self = (BoxesSpiceDisplay*) boxes_display_construct (object_type);
	_tmp0_ = config;
	boxes_display_properties_set_config ((BoxesDisplayProperties*) self, _tmp0_);
	_tmp1_ = self->priv->session;
	_tmp2_ = port;
	_tmp3_ = g_strdup_printf ("%i", _tmp2_);
	_tmp4_ = _tmp3_;
	g_object_set (_tmp1_, "port", _tmp4_, NULL);
	_g_free0 (_tmp4_);
	_tmp5_ = self->priv->session;
	_tmp6_ = host;
	g_object_set (_tmp5_, "host", _tmp6_, NULL);
	return self;
}


BoxesSpiceDisplay* boxes_spice_display_new (BoxesDisplayConfig* config, const gchar* host, gint port) {
	return boxes_spice_display_construct (BOXES_TYPE_SPICE_DISPLAY, config, host, port);
}


BoxesSpiceDisplay* boxes_spice_display_construct_with_uri (GType object_type, BoxesDisplayConfig* config, const gchar* uri) {
	BoxesSpiceDisplay * self = NULL;
	BoxesDisplayConfig* _tmp0_;
	SpiceSession* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (config != NULL, NULL);
	g_return_val_if_fail (uri != NULL, NULL);
	self = (BoxesSpiceDisplay*) boxes_display_construct (object_type);
	_tmp0_ = config;
	boxes_display_properties_set_config ((BoxesDisplayProperties*) self, _tmp0_);
	_tmp1_ = self->priv->session;
	_tmp2_ = uri;
	g_object_set (_tmp1_, "uri", _tmp2_, NULL);
	return self;
}


BoxesSpiceDisplay* boxes_spice_display_new_with_uri (BoxesDisplayConfig* config, const gchar* uri) {
	return boxes_spice_display_construct_with_uri (BOXES_TYPE_SPICE_DISPLAY, config, uri);
}


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


static void ___lambda57_ (BoxesSpiceDisplay* self, gint status) {
	gint _tmp0_;
	_tmp0_ = status;
	boxes_display_set_mouse_grabbed ((BoxesDisplay*) self, _tmp0_ != 0);
}


static void ____lambda57__spice_display_mouse_grab (SpiceDisplay* _sender, gint grabbed, gpointer self) {
	___lambda57_ (self, grabbed);
}


static GtkWidget* boxes_spice_display_real_get_display (BoxesDisplay* base, gint n, GError** error) {
	BoxesSpiceDisplay * self;
	GtkWidget* result = NULL;
	GHashTable* _tmp0_;
	gint _tmp1_;
	gconstpointer _tmp2_ = NULL;
	SpiceDisplay* _tmp3_;
	SpiceDisplay* display;
	SpiceDisplay* _tmp4_;
	GError * _inner_error_ = NULL;
	self = (BoxesSpiceDisplay*) base;
	_tmp0_ = ((BoxesDisplay*) self)->displays;
	_tmp1_ = n;
	_tmp2_ = g_hash_table_lookup (_tmp0_, (gpointer) ((gintptr) _tmp1_));
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE ((GtkWidget*) _tmp2_, spice_display_get_type ()) ? ((SpiceDisplay*) ((GtkWidget*) _tmp2_)) : NULL);
	display = _tmp3_;
	_tmp4_ = display;
	if (_tmp4_ == NULL) {
		SpiceSession* _tmp5_;
		gint _tmp6_;
		SpiceDisplay* _tmp7_;
		SpiceDisplay* _tmp8_;
		SpiceDisplay* _tmp10_;
		BoxesDisplayPropertiesSavedProperty* _tmp11_;
		gint _tmp11__length1;
		SpiceDisplay* _tmp12_;
		SpiceDisplay* _tmp13_;
		GObjectClass* _tmp14_ = NULL;
		GParamSpec* _tmp15_ = NULL;
		GHashTable* _tmp17_;
		gint _tmp18_;
		SpiceDisplay* _tmp19_;
		GtkWidget* _tmp20_;
		_tmp5_ = self->priv->session;
		_tmp6_ = n;
		_tmp7_ = spice_display_new (_tmp5_, _tmp6_);
		g_object_ref_sink (_tmp7_);
		_g_object_unref0 (display);
		display = _tmp7_;
		_tmp8_ = display;
		if (_tmp8_ == NULL) {
			GError* _tmp9_;
			_tmp9_ = g_error_new_literal (BOXES_ERROR, BOXES_ERROR_INVALID, "invalid display");
			_inner_error_ = _tmp9_;
			if (_inner_error_->domain == BOXES_ERROR) {
				g_propagate_error (error, _inner_error_);
				_g_object_unref0 (display);
				return NULL;
			} else {
				_g_object_unref0 (display);
				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 NULL;
			}
		}
		_tmp10_ = display;
		g_signal_connect_object (_tmp10_, "mouse-grab", (GCallback) ____lambda57__spice_display_mouse_grab, self, 0);
		_tmp11_ = self->priv->display_saved_properties;
		_tmp11__length1 = self->priv->display_saved_properties_length1;
		boxes_display_properties_sync_config_with_display ((BoxesDisplayProperties*) self, (GObject*) self, _tmp11_, _tmp11__length1);
		_tmp12_ = display;
		g_object_set (_tmp12_, "scaling", TRUE, NULL);
		_tmp13_ = display;
		_tmp14_ = G_OBJECT_GET_CLASS ((GObject*) _tmp13_);
		_tmp15_ = g_object_class_find_property (_tmp14_, "only-downscale");
		if (_tmp15_ != NULL) {
			SpiceDisplay* _tmp16_;
			_tmp16_ = display;
			g_object_set ((GObject*) _tmp16_, "only-downscale", TRUE, NULL);
		}
		_tmp17_ = ((BoxesDisplay*) self)->displays;
		_tmp18_ = n;
		_tmp19_ = display;
		_tmp20_ = _g_object_ref0 ((GtkWidget*) _tmp19_);
		g_hash_table_replace (_tmp17_, (gpointer) ((gintptr) _tmp18_), _tmp20_);
	}
	result = (GtkWidget*) display;
	return result;
}


static void boxes_spice_display_real_set_enable_inputs (BoxesDisplay* base, GtkWidget* widget, gboolean enable) {
	BoxesSpiceDisplay * self;
	GtkWidget* _tmp0_;
	gboolean _tmp1_;
	self = (BoxesSpiceDisplay*) base;
	g_return_if_fail (widget != NULL);
	_tmp0_ = widget;
	_tmp1_ = enable;
	g_object_set (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, spice_display_get_type ()) ? ((SpiceDisplay*) _tmp0_) : NULL, "disable-inputs", !_tmp1_, NULL);
}


static GdkPixbuf* boxes_spice_display_real_get_pixbuf (BoxesDisplay* base, gint n, GError** error) {
	BoxesSpiceDisplay * self;
	GdkPixbuf* result = NULL;
	gint _tmp0_;
	GtkWidget* _tmp1_ = NULL;
	GtkWidget* _tmp2_;
	SpiceDisplay* display;
	SpiceDisplay* _tmp3_;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_;
	SpiceDisplay* _tmp6_;
	GdkPixbuf* _tmp7_ = NULL;
	GError * _inner_error_ = NULL;
	self = (BoxesSpiceDisplay*) base;
	_tmp0_ = n;
	_tmp1_ = boxes_display_get_display ((BoxesDisplay*) self, _tmp0_, &_inner_error_);
	_tmp2_ = _tmp1_;
	if (_inner_error_ != NULL) {
		if (_inner_error_->domain == BOXES_ERROR) {
			g_propagate_error (error, _inner_error_);
			return NULL;
		} else {
			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 NULL;
		}
	}
	display = G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, spice_display_get_type ()) ? ((SpiceDisplay*) _tmp2_) : NULL;
	_tmp3_ = display;
	g_object_get (_tmp3_, "ready", &_tmp4_, NULL);
	_tmp5_ = _tmp4_;
	if (!_tmp5_) {
		result = NULL;
		_g_object_unref0 (display);
		return result;
	}
	_tmp6_ = display;
	_tmp7_ = spice_display_get_pixbuf (_tmp6_);
	result = _tmp7_;
	_g_object_unref0 (display);
	return result;
}


static Block33Data* block33_data_ref (Block33Data* _data33_) {
	g_atomic_int_inc (&_data33_->_ref_count_);
	return _data33_;
}


static void block33_data_unref (void * _userdata_) {
	Block33Data* _data33_;
	_data33_ = (Block33Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data33_->_ref_count_)) {
		BoxesSpiceDisplay * self;
		self = _data33_->self;
		_g_object_unref0 (_data33_->main);
		_g_object_unref0 (self);
		g_slice_free (Block33Data, _data33_);
	}
}


static void _boxes_spice_display_main_event_spice_channel_channel_event (SpiceChannel* _sender, SpiceChannelEvent event, gpointer self) {
	boxes_spice_display_main_event (self, event);
}


static void ___lambda59_ (Block33Data* _data33_) {
	BoxesSpiceDisplay * self;
	SpiceMainChannel* _tmp0_;
	gint _tmp1_ = 0;
	gint _tmp2_;
	self = _data33_->self;
	_tmp0_ = _data33_->main;
	g_object_get (_tmp0_, "mouse-mode", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	boxes_display_set_can_grab_mouse ((BoxesDisplay*) self, _tmp2_ != 2);
}


static void ____lambda59__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	___lambda59_ (self);
}


static Block34Data* block34_data_ref (Block34Data* _data34_) {
	g_atomic_int_inc (&_data34_->_ref_count_);
	return _data34_;
}


static void block34_data_unref (void * _userdata_) {
	Block34Data* _data34_;
	_data34_ = (Block34Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data34_->_ref_count_)) {
		BoxesSpiceDisplay * self;
		self = _data34_->self;
		_g_object_unref0 (_data34_->display);
		_g_object_unref0 (self);
		g_slice_free (Block34Data, _data34_);
	}
}


static void ____lambda60_ (Block34Data* _data34_) {
	BoxesSpiceDisplay * self;
	SpiceDisplay* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_;
	self = _data34_->self;
	_tmp0_ = _data34_->display;
	g_object_get (_tmp0_, "ready", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		SpiceDisplay* _tmp3_;
		gint _tmp4_ = 0;
		gint _tmp5_;
		_tmp3_ = _data34_->display;
		g_object_get (_tmp3_, "channel-id", &_tmp4_, NULL);
		_tmp5_ = _tmp4_;
		g_signal_emit_by_name ((BoxesDisplay*) self, "show", _tmp5_);
	} else {
		SpiceDisplay* _tmp6_;
		gint _tmp7_ = 0;
		gint _tmp8_;
		_tmp6_ = _data34_->display;
		g_object_get (_tmp6_, "channel-id", &_tmp7_, NULL);
		_tmp8_ = _tmp7_;
		g_signal_emit_by_name ((BoxesDisplay*) self, "hide", _tmp8_);
	}
}


static void _____lambda60__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	____lambda60_ (self);
}


static void ___lambda58_ (BoxesSpiceDisplay* self, SpiceChannel* channel) {
	SpiceChannel* _tmp0_;
	gint _tmp1_ = 0;
	gint _tmp2_;
	gint id;
	SpiceChannel* _tmp3_;
	SpiceChannel* _tmp11_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (channel != NULL);
	_tmp0_ = channel;
	g_object_get (_tmp0_, "channel-id", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	id = _tmp2_;
	_tmp3_ = channel;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, spice_main_channel_get_type ())) {
		Block33Data* _data33_;
		SpiceChannel* _tmp4_;
		SpiceMainChannel* _tmp5_;
		SpiceMainChannel* _tmp6_;
		SpiceMainChannel* _tmp7_;
		SpiceMainChannel* _tmp8_;
		gint _tmp9_ = 0;
		gint _tmp10_;
		_data33_ = g_slice_new0 (Block33Data);
		_data33_->_ref_count_ = 1;
		_data33_->self = g_object_ref (self);
		_tmp4_ = channel;
		_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, spice_main_channel_get_type ()) ? ((SpiceMainChannel*) _tmp4_) : NULL);
		_data33_->main = _tmp5_;
		_tmp6_ = _data33_->main;
		g_signal_connect_object ((SpiceChannel*) _tmp6_, "channel-event", (GCallback) _boxes_spice_display_main_event_spice_channel_channel_event, self, 0);
		_tmp7_ = _data33_->main;
		g_signal_connect_data ((GObject*) _tmp7_, "notify::mouse-mode", (GCallback) ____lambda59__g_object_notify, block33_data_ref (_data33_), (GClosureNotify) block33_data_unref, 0);
		_tmp8_ = _data33_->main;
		g_object_get (_tmp8_, "mouse-mode", &_tmp9_, NULL);
		_tmp10_ = _tmp9_;
		boxes_display_set_can_grab_mouse ((BoxesDisplay*) self, _tmp10_ != 2);
		block33_data_unref (_data33_);
		_data33_ = NULL;
	}
	_tmp11_ = channel;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp11_, spice_display_channel_get_type ())) {
		gint _tmp12_;
		_tmp12_ = id;
		if (_tmp12_ != 0) {
			return;
		}
		boxes_display_properties_access_start ((BoxesDisplayProperties*) self);
		{
			Block34Data* _data34_;
			gint _tmp13_;
			GtkWidget* _tmp14_ = NULL;
			GtkWidget* _tmp15_;
			SpiceDisplay* _tmp16_;
			_data34_ = g_slice_new0 (Block34Data);
			_data34_->_ref_count_ = 1;
			_data34_->self = g_object_ref (self);
			_tmp13_ = id;
			_tmp14_ = boxes_display_get_display ((BoxesDisplay*) self, _tmp13_, &_inner_error_);
			_tmp15_ = _tmp14_;
			if (_inner_error_ != NULL) {
				block34_data_unref (_data34_);
				_data34_ = NULL;
				if (_inner_error_->domain == BOXES_ERROR) {
					goto __catch50_boxes_error;
				}
				block34_data_unref (_data34_);
				_data34_ = NULL;
				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;
			}
			_data34_->display = G_TYPE_CHECK_INSTANCE_TYPE (_tmp15_, spice_display_get_type ()) ? ((SpiceDisplay*) _tmp15_) : NULL;
			_tmp16_ = _data34_->display;
			g_signal_connect_data ((GObject*) _tmp16_, "notify::ready", (GCallback) _____lambda60__g_object_notify, block34_data_ref (_data34_), (GClosureNotify) block34_data_unref, 0);
			block34_data_unref (_data34_);
			_data34_ = NULL;
		}
		goto __finally50;
		__catch50_boxes_error:
		{
			GError* _error_ = NULL;
			GError* _tmp17_;
			const gchar* _tmp18_;
			_error_ = _inner_error_;
			_inner_error_ = NULL;
			_tmp17_ = _error_;
			_tmp18_ = _tmp17_->message;
			g_warning ("spice-display.vala:130: %s", _tmp18_);
			_g_error_free0 (_error_);
		}
		__finally50:
		if (_inner_error_ != 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;
		}
	}
}


static void ____lambda58__spice_session_channel_new (SpiceSession* _sender, SpiceChannel* channel, gpointer self) {
	___lambda58_ (self, channel);
}


static void ___lambda61_ (BoxesSpiceDisplay* self, SpiceChannel* channel) {
	SpiceChannel* _tmp0_;
	g_return_if_fail (channel != NULL);
	_tmp0_ = channel;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, spice_display_channel_get_type ())) {
		SpiceChannel* _tmp1_;
		SpiceDisplayChannel* _tmp2_;
		SpiceDisplayChannel* display;
		SpiceDisplayChannel* _tmp3_;
		gint _tmp4_ = 0;
		gint _tmp5_;
		_tmp1_ = channel;
		_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, spice_display_channel_get_type ()) ? ((SpiceDisplayChannel*) _tmp1_) : NULL);
		display = _tmp2_;
		_tmp3_ = display;
		g_object_get ((SpiceChannel*) _tmp3_, "channel-id", &_tmp4_, NULL);
		_tmp5_ = _tmp4_;
		g_signal_emit_by_name ((BoxesDisplay*) self, "hide", _tmp5_);
		boxes_display_properties_access_finish ((BoxesDisplayProperties*) self);
		_g_object_unref0 (display);
	}
}


static void ____lambda61__spice_session_channel_destroy (SpiceSession* _sender, SpiceChannel* channel, gpointer self) {
	___lambda61_ (self, channel);
}


static void boxes_spice_display_real_connect_it (BoxesDisplay* base) {
	BoxesSpiceDisplay * self;
	gulong _tmp0_;
	gulong _tmp3_;
	SpiceSession* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	SpiceSession* _tmp9_;
	self = (BoxesSpiceDisplay*) base;
	_tmp0_ = self->priv->channel_new_id;
	if (_tmp0_ == ((gulong) 0)) {
		SpiceSession* _tmp1_;
		gulong _tmp2_ = 0UL;
		_tmp1_ = self->priv->session;
		_tmp2_ = g_signal_connect_object (_tmp1_, "channel-new", (GCallback) ____lambda58__spice_session_channel_new, self, 0);
		self->priv->channel_new_id = _tmp2_;
	}
	_tmp3_ = self->priv->channel_destroy_id;
	if (_tmp3_ == ((gulong) 0)) {
		SpiceSession* _tmp4_;
		gulong _tmp5_ = 0UL;
		_tmp4_ = self->priv->session;
		_tmp5_ = g_signal_connect_object (_tmp4_, "channel-destroy", (GCallback) ____lambda61__spice_session_channel_destroy, self, 0);
		self->priv->channel_destroy_id = _tmp5_;
	}
	_tmp6_ = self->priv->session;
	_tmp7_ = boxes_display_get_password ((BoxesDisplay*) self);
	_tmp8_ = _tmp7_;
	g_object_set (_tmp6_, "password", _tmp8_, NULL);
	_tmp9_ = self->priv->session;
	spice_session_connect (_tmp9_);
}


static void boxes_spice_display_real_disconnect_it (BoxesDisplay* base) {
	BoxesSpiceDisplay * self;
	SpiceSession* _tmp0_;
	self = (BoxesSpiceDisplay*) base;
	_tmp0_ = self->priv->session;
	spice_session_disconnect (_tmp0_);
}


static void boxes_spice_display_main_event (BoxesSpiceDisplay* self, SpiceChannelEvent event) {
	SpiceChannelEvent _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = event;
	switch (_tmp0_) {
		case SPICE_CHANNEL_CLOSED:
		{
			g_signal_emit_by_name ((BoxesDisplay*) self, "disconnected");
			break;
		}
		case SPICE_CHANNEL_ERROR_AUTH:
		{
			boxes_display_set_need_password ((BoxesDisplay*) self, TRUE);
			break;
		}
		default:
		{
			break;
		}
	}
}


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


static void _g_list_free__g_object_unref0_ (GList* self) {
	g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
	g_list_free (self);
}


static GList* boxes_spice_display_real_get_properties (BoxesIPropertiesProvider* base, BoxesPropertiesPage page) {
	BoxesSpiceDisplay * self;
	GList* result = NULL;
	GList* list;
	BoxesPropertiesPage _tmp0_;
	self = (BoxesSpiceDisplay*) base;
	list = NULL;
	_tmp0_ = page;
	switch (_tmp0_) {
		case BOXES_PROPERTIES_PAGE_DISPLAY:
		{
			GtkSwitch* _tmp1_;
			GtkSwitch* toggle;
			SpiceGtkSession* _tmp2_;
			GtkSwitch* _tmp3_;
			GtkSwitch* _tmp4_;
			const gchar* _tmp5_ = NULL;
			GtkSwitch* _tmp6_;
			BoxesProperty* _tmp7_ = NULL;
			BoxesProperty* _tmp8_;
			GtkSwitch* _tmp9_;
			GtkSwitch* _tmp10_;
			GtkSwitch* _tmp11_;
			const gchar* _tmp12_ = NULL;
			GtkSwitch* _tmp13_;
			BoxesProperty* _tmp14_ = NULL;
			BoxesProperty* _tmp15_;
			_tmp1_ = (GtkSwitch*) gtk_switch_new ();
			g_object_ref_sink (_tmp1_);
			toggle = _tmp1_;
			_tmp2_ = self->priv->gtk_session;
			_tmp3_ = toggle;
			g_object_bind_property_with_closures ((GObject*) _tmp2_, "auto-clipboard", (GObject*) _tmp3_, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)));
			_tmp4_ = toggle;
			gtk_widget_set_halign ((GtkWidget*) _tmp4_, GTK_ALIGN_START);
			_tmp5_ = _ ("Share clipboard");
			_tmp6_ = toggle;
			_tmp7_ = boxes_iproperties_provider_add_property ((BoxesIPropertiesProvider*) self, &list, _tmp5_, (GtkWidget*) _tmp6_);
			_tmp8_ = _tmp7_;
			_g_object_unref0 (_tmp8_);
			_tmp9_ = (GtkSwitch*) gtk_switch_new ();
			g_object_ref_sink (_tmp9_);
			_g_object_unref0 (toggle);
			toggle = _tmp9_;
			_tmp10_ = toggle;
			g_object_bind_property_with_closures ((GObject*) self, "resize-guest", (GObject*) _tmp10_, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)));
			_tmp11_ = toggle;
			gtk_widget_set_halign ((GtkWidget*) _tmp11_, GTK_ALIGN_START);
			_tmp12_ = _ ("Resize guest");
			_tmp13_ = toggle;
			_tmp14_ = boxes_iproperties_provider_add_property ((BoxesIPropertiesProvider*) self, &list, _tmp12_, (GtkWidget*) _tmp13_);
			_tmp15_ = _tmp14_;
			_g_object_unref0 (_tmp15_);
			_g_object_unref0 (toggle);
			break;
		}
		case BOXES_PROPERTIES_PAGE_DEVICES:
		{
			GtkSwitch* _tmp16_;
			GtkSwitch* toggle;
			SpiceGtkSession* _tmp17_;
			GtkSwitch* _tmp18_;
			GtkSwitch* _tmp19_;
			const gchar* _tmp20_ = NULL;
			GtkSwitch* _tmp21_;
			BoxesProperty* _tmp22_ = NULL;
			BoxesProperty* _tmp23_;
			_tmp16_ = (GtkSwitch*) gtk_switch_new ();
			g_object_ref_sink (_tmp16_);
			toggle = _tmp16_;
			_tmp17_ = self->priv->gtk_session;
			_tmp18_ = toggle;
			g_object_bind_property_with_closures ((GObject*) _tmp17_, "auto-usbredir", (GObject*) _tmp18_, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)));
			_tmp19_ = toggle;
			gtk_widget_set_halign ((GtkWidget*) _tmp19_, GTK_ALIGN_START);
			_tmp20_ = _ ("USB redirection");
			_tmp21_ = toggle;
			_tmp22_ = boxes_iproperties_provider_add_property ((BoxesIPropertiesProvider*) self, &list, _tmp20_, (GtkWidget*) _tmp21_);
			_tmp23_ = _tmp22_;
			_g_object_unref0 (_tmp23_);
			_g_object_unref0 (toggle);
			break;
		}
		default:
		break;
	}
	result = list;
	return result;
}


static const gchar* boxes_spice_display_real_get_protocol (BoxesDisplay* base) {
	const gchar* result;
	BoxesSpiceDisplay* self;
	self = (BoxesSpiceDisplay*) base;
	result = "SPICE";
	return result;
}


static gchar* boxes_spice_display_real_get_uri (BoxesDisplay* base) {
	gchar* result;
	BoxesSpiceDisplay* self;
	SpiceSession* _tmp0_;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_;
	self = (BoxesSpiceDisplay*) base;
	_tmp0_ = self->priv->session;
	g_object_get (_tmp0_, "uri", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}


gboolean boxes_spice_display_get_resize_guest (BoxesSpiceDisplay* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_resize_guest;
	result = _tmp0_;
	return result;
}


void boxes_spice_display_set_resize_guest (BoxesSpiceDisplay* self, gboolean value) {
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_resize_guest = _tmp0_;
	g_object_notify ((GObject *) self, "resize-guest");
}


static void _boxes_spice_display___lambda62_ (BoxesSpiceDisplay* self) {
	SpiceGtkSession* _tmp0_;
	BoxesDisplayPropertiesSavedProperty* _tmp1_;
	gint _tmp1__length1;
	_tmp0_ = self->priv->gtk_session;
	_tmp1_ = self->priv->gtk_session_saved_properties;
	_tmp1__length1 = self->priv->gtk_session_saved_properties_length1;
	boxes_display_properties_sync_config_with_display ((BoxesDisplayProperties*) self, (GObject*) _tmp0_, _tmp1_, _tmp1__length1);
}


static void __boxes_spice_display___lambda62__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	_boxes_spice_display___lambda62_ (self);
}


static void _boxes_spice_display_ui_state_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	boxes_spice_display_ui_state_changed (self);
}


static GObject * boxes_spice_display_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	BoxesSpiceDisplay * self;
	gchar* _tmp0_;
	GValue _tmp1_ = {0};
	BoxesDisplayPropertiesSavedProperty _tmp2_ = {0};
	BoxesDisplayPropertiesSavedProperty* _tmp3_ = NULL;
	gchar* _tmp4_;
	GValue _tmp5_ = {0};
	BoxesDisplayPropertiesSavedProperty _tmp6_ = {0};
	gchar* _tmp7_;
	GValue _tmp8_ = {0};
	BoxesDisplayPropertiesSavedProperty _tmp9_ = {0};
	BoxesDisplayPropertiesSavedProperty* _tmp10_ = NULL;
	SpiceSession* _tmp11_;
	SpiceSession* _tmp12_;
	SpiceAudio* _tmp13_ = NULL;
	SpiceSession* _tmp14_;
	SpiceGtkSession* _tmp15_ = NULL;
	BoxesApp* _tmp16_;
	parent_class = G_OBJECT_CLASS (boxes_spice_display_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_SPICE_DISPLAY, BoxesSpiceDisplay);
	_tmp0_ = g_strdup ("resize-guest");
	g_value_init (&_tmp1_, G_TYPE_BOOLEAN);
	g_value_set_boolean (&_tmp1_, TRUE);
	memset (&_tmp2_, 0, sizeof (BoxesDisplayPropertiesSavedProperty));
	_g_free0 (_tmp2_.name);
	_tmp2_.name = _tmp0_;
	G_IS_VALUE (&_tmp2_.default_value) ? (g_value_unset (&_tmp2_.default_value), NULL) : NULL;
	_tmp2_.default_value = _tmp1_;
	_tmp3_ = g_new0 (BoxesDisplayPropertiesSavedProperty, 1);
	_tmp3_[0] = _tmp2_;
	self->priv->display_saved_properties = (_vala_BoxesDisplayPropertiesSavedProperty_array_free (self->priv->display_saved_properties, self->priv->display_saved_properties_length1), NULL);
	self->priv->display_saved_properties = _tmp3_;
	self->priv->display_saved_properties_length1 = 1;
	self->priv->_display_saved_properties_size_ = self->priv->display_saved_properties_length1;
	_tmp4_ = g_strdup ("auto-clipboard");
	g_value_init (&_tmp5_, G_TYPE_BOOLEAN);
	g_value_set_boolean (&_tmp5_, TRUE);
	memset (&_tmp6_, 0, sizeof (BoxesDisplayPropertiesSavedProperty));
	_g_free0 (_tmp6_.name);
	_tmp6_.name = _tmp4_;
	G_IS_VALUE (&_tmp6_.default_value) ? (g_value_unset (&_tmp6_.default_value), NULL) : NULL;
	_tmp6_.default_value = _tmp5_;
	_tmp7_ = g_strdup ("auto-usbredir");
	g_value_init (&_tmp8_, G_TYPE_BOOLEAN);
	g_value_set_boolean (&_tmp8_, FALSE);
	memset (&_tmp9_, 0, sizeof (BoxesDisplayPropertiesSavedProperty));
	_g_free0 (_tmp9_.name);
	_tmp9_.name = _tmp7_;
	G_IS_VALUE (&_tmp9_.default_value) ? (g_value_unset (&_tmp9_.default_value), NULL) : NULL;
	_tmp9_.default_value = _tmp8_;
	_tmp10_ = g_new0 (BoxesDisplayPropertiesSavedProperty, 2);
	_tmp10_[0] = _tmp6_;
	_tmp10_[1] = _tmp9_;
	self->priv->gtk_session_saved_properties = (_vala_BoxesDisplayPropertiesSavedProperty_array_free (self->priv->gtk_session_saved_properties, self->priv->gtk_session_saved_properties_length1), NULL);
	self->priv->gtk_session_saved_properties = _tmp10_;
	self->priv->gtk_session_saved_properties_length1 = 2;
	self->priv->_gtk_session_saved_properties_size_ = self->priv->gtk_session_saved_properties_length1;
	boxes_display_set_need_password ((BoxesDisplay*) self, FALSE);
	_tmp11_ = spice_session_new ();
	_g_object_unref0 (self->priv->session);
	self->priv->session = _tmp11_;
	_tmp12_ = self->priv->session;
	_tmp13_ = spice_audio_get (_tmp12_, NULL);
	self->priv->audio = _tmp13_;
	_tmp14_ = self->priv->session;
	_tmp15_ = spice_gtk_session_get (_tmp14_);
	self->priv->gtk_session = _tmp15_;
	g_signal_connect_object ((GObject*) self, "notify::config", (GCallback) __boxes_spice_display___lambda62__g_object_notify, self, 0);
	_tmp16_ = boxes_app_app;
	g_signal_connect_object ((GObject*) _tmp16_, "notify::ui-state", (GCallback) _boxes_spice_display_ui_state_changed_g_object_notify, self, 0);
	return obj;
}


static void boxes_spice_display_class_init (BoxesSpiceDisplayClass * klass) {
	boxes_spice_display_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (BoxesSpiceDisplayPrivate));
	BOXES_DISPLAY_CLASS (klass)->get_display = boxes_spice_display_real_get_display;
	BOXES_DISPLAY_CLASS (klass)->set_enable_inputs = boxes_spice_display_real_set_enable_inputs;
	BOXES_DISPLAY_CLASS (klass)->get_pixbuf = boxes_spice_display_real_get_pixbuf;
	BOXES_DISPLAY_CLASS (klass)->connect_it = boxes_spice_display_real_connect_it;
	BOXES_DISPLAY_CLASS (klass)->disconnect_it = boxes_spice_display_real_disconnect_it;
	BOXES_DISPLAY_CLASS (klass)->get_properties = boxes_spice_display_real_get_properties;
	BOXES_DISPLAY_CLASS (klass)->get_protocol = boxes_spice_display_real_get_protocol;
	BOXES_DISPLAY_CLASS (klass)->get_uri = boxes_spice_display_real_get_uri;
	G_OBJECT_CLASS (klass)->get_property = _vala_boxes_spice_display_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_boxes_spice_display_set_property;
	G_OBJECT_CLASS (klass)->constructor = boxes_spice_display_constructor;
	G_OBJECT_CLASS (klass)->finalize = boxes_spice_display_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_SPICE_DISPLAY_PROTOCOL, g_param_spec_string ("protocol", "protocol", "protocol", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_SPICE_DISPLAY_URI, g_param_spec_string ("uri", "uri", "uri", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_SPICE_DISPLAY_RESIZE_GUEST, g_param_spec_boolean ("resize-guest", "resize-guest", "resize-guest", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void boxes_spice_display_boxes_iproperties_provider_interface_init (BoxesIPropertiesProviderIface * iface) {
	boxes_spice_display_boxes_iproperties_provider_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_properties = (GList* (*)(BoxesIPropertiesProvider*, BoxesPropertiesPage)) boxes_spice_display_real_get_properties;
}


static void boxes_spice_display_instance_init (BoxesSpiceDisplay * self) {
	self->priv = BOXES_SPICE_DISPLAY_GET_PRIVATE (self);
}


static void boxes_spice_display_finalize (GObject* obj) {
	BoxesSpiceDisplay * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_SPICE_DISPLAY, BoxesSpiceDisplay);
	_g_object_unref0 (self->priv->session);
	self->priv->display_saved_properties = (_vala_BoxesDisplayPropertiesSavedProperty_array_free (self->priv->display_saved_properties, self->priv->display_saved_properties_length1), NULL);
	self->priv->gtk_session_saved_properties = (_vala_BoxesDisplayPropertiesSavedProperty_array_free (self->priv->gtk_session_saved_properties, self->priv->gtk_session_saved_properties_length1), NULL);
	G_OBJECT_CLASS (boxes_spice_display_parent_class)->finalize (obj);
}


GType boxes_spice_display_get_type (void) {
	static volatile gsize boxes_spice_display_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_spice_display_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BoxesSpiceDisplayClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_spice_display_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesSpiceDisplay), 0, (GInstanceInitFunc) boxes_spice_display_instance_init, NULL };
		static const GInterfaceInfo boxes_iproperties_provider_info = { (GInterfaceInitFunc) boxes_spice_display_boxes_iproperties_provider_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType boxes_spice_display_type_id;
		boxes_spice_display_type_id = g_type_register_static (BOXES_TYPE_DISPLAY, "BoxesSpiceDisplay", &g_define_type_info, 0);
		g_type_add_interface_static (boxes_spice_display_type_id, BOXES_TYPE_IPROPERTIES_PROVIDER, &boxes_iproperties_provider_info);
		g_once_init_leave (&boxes_spice_display_type_id__volatile, boxes_spice_display_type_id);
	}
	return boxes_spice_display_type_id__volatile;
}


static void _vala_boxes_spice_display_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	BoxesSpiceDisplay * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_SPICE_DISPLAY, BoxesSpiceDisplay);
	switch (property_id) {
		case BOXES_SPICE_DISPLAY_PROTOCOL:
		g_value_set_string (value, boxes_display_get_protocol ((BoxesDisplay*) self));
		break;
		case BOXES_SPICE_DISPLAY_URI:
		g_value_take_string (value, boxes_display_get_uri ((BoxesDisplay*) self));
		break;
		case BOXES_SPICE_DISPLAY_RESIZE_GUEST:
		g_value_set_boolean (value, boxes_spice_display_get_resize_guest (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_boxes_spice_display_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	BoxesSpiceDisplay * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_SPICE_DISPLAY, BoxesSpiceDisplay);
	switch (property_id) {
		case BOXES_SPICE_DISPLAY_RESIZE_GUEST:
		boxes_spice_display_set_resize_guest (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



