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

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

#include <handy.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "common.h"
#include <glib/gi18n-lib.h>

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

#define BOXES_TYPE_DEVICES_PAGE (boxes_devices_page_get_type ())
#define BOXES_DEVICES_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_DEVICES_PAGE, BoxesDevicesPage))
#define BOXES_DEVICES_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_DEVICES_PAGE, BoxesDevicesPageClass))
#define BOXES_IS_DEVICES_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_DEVICES_PAGE))
#define BOXES_IS_DEVICES_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_DEVICES_PAGE))
#define BOXES_DEVICES_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_DEVICES_PAGE, BoxesDevicesPageClass))

typedef struct _BoxesDevicesPage BoxesDevicesPage;
typedef struct _BoxesDevicesPageClass BoxesDevicesPageClass;
typedef struct _BoxesDevicesPagePrivate BoxesDevicesPagePrivate;

#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_SHARED_FOLDERS_WIDGET (boxes_shared_folders_widget_get_type ())
#define BOXES_SHARED_FOLDERS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_SHARED_FOLDERS_WIDGET, BoxesSharedFoldersWidget))
#define BOXES_SHARED_FOLDERS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_SHARED_FOLDERS_WIDGET, BoxesSharedFoldersWidgetClass))
#define BOXES_IS_SHARED_FOLDERS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_SHARED_FOLDERS_WIDGET))
#define BOXES_IS_SHARED_FOLDERS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_SHARED_FOLDERS_WIDGET))
#define BOXES_SHARED_FOLDERS_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_SHARED_FOLDERS_WIDGET, BoxesSharedFoldersWidgetClass))

typedef struct _BoxesSharedFoldersWidget BoxesSharedFoldersWidget;
typedef struct _BoxesSharedFoldersWidgetClass BoxesSharedFoldersWidgetClass;

#define BOXES_TYPE_CDROM_ROW (boxes_cdrom_row_get_type ())
#define BOXES_CDROM_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_CDROM_ROW, BoxesCdromRow))
#define BOXES_CDROM_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_CDROM_ROW, BoxesCdromRowClass))
#define BOXES_IS_CDROM_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_CDROM_ROW))
#define BOXES_IS_CDROM_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_CDROM_ROW))
#define BOXES_CDROM_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_CDROM_ROW, BoxesCdromRowClass))

typedef struct _BoxesCdromRow BoxesCdromRow;
typedef struct _BoxesCdromRowClass BoxesCdromRowClass;
enum  {
	BOXES_DEVICES_PAGE_0_PROPERTY,
	BOXES_DEVICES_PAGE_NUM_PROPERTIES
};
static GParamSpec* boxes_devices_page_properties[BOXES_DEVICES_PAGE_NUM_PROPERTIES];
#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_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 _g_free0(var) (var = (g_free (var), 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;

#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;

#define BOXES_TYPE_USB_DEVICE (boxes_usb_device_get_type ())
#define BOXES_USB_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_USB_DEVICE, BoxesUsbDevice))
#define BOXES_USB_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_USB_DEVICE, BoxesUsbDeviceClass))
#define BOXES_IS_USB_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_USB_DEVICE))
#define BOXES_IS_USB_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_USB_DEVICE))
#define BOXES_USB_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_USB_DEVICE, BoxesUsbDeviceClass))

typedef struct _BoxesUsbDevice BoxesUsbDevice;
typedef struct _BoxesUsbDeviceClass BoxesUsbDeviceClass;

#define BOXES_TYPE_DEVICE_LIST_ROW (boxes_device_list_row_get_type ())
#define BOXES_DEVICE_LIST_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_DEVICE_LIST_ROW, BoxesDeviceListRow))
#define BOXES_DEVICE_LIST_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_DEVICE_LIST_ROW, BoxesDeviceListRowClass))
#define BOXES_IS_DEVICE_LIST_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_DEVICE_LIST_ROW))
#define BOXES_IS_DEVICE_LIST_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_DEVICE_LIST_ROW))
#define BOXES_DEVICE_LIST_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_DEVICE_LIST_ROW, BoxesDeviceListRowClass))

typedef struct _BoxesDeviceListRow BoxesDeviceListRow;
typedef struct _BoxesDeviceListRowClass BoxesDeviceListRowClass;

struct _BoxesDevicesPage {
	HdyPreferencesPage parent_instance;
	BoxesDevicesPagePrivate * priv;
};

struct _BoxesDevicesPageClass {
	HdyPreferencesPageClass parent_class;
};

struct _BoxesDevicesPagePrivate {
	BoxesLibvirtMachine* machine;
	GtkListBox* listbox;
	BoxesSharedFoldersWidget* shared_folders_widget;
	BoxesCdromRow* cdrom_row;
};

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 BoxesDevicesPage_private_offset;
static gpointer boxes_devices_page_parent_class = NULL;

VALA_EXTERN GType boxes_devices_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesDevicesPage, 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_shared_folders_widget_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesSharedFoldersWidget, g_object_unref)
VALA_EXTERN GType boxes_cdrom_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesCdromRow, g_object_unref)
VALA_EXTERN void boxes_devices_page_setup (BoxesDevicesPage* self,
                               BoxesLibvirtMachine* machine);
static void boxes_devices_page_setup_usb_devices_list (BoxesDevicesPage* self);
VALA_EXTERN void boxes_cdrom_row_setup (BoxesCdromRow* self,
                            BoxesLibvirtMachine* machine);
VALA_EXTERN void boxes_shared_folders_widget_setup (BoxesSharedFoldersWidget* self,
                                        const gchar* machine_uuid);
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 ;
VALA_EXTERN gboolean boxes_app_is_running_in_flatpak (void);
VALA_EXTERN gboolean boxes_machine_get_is_running (BoxesMachine* 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 GType boxes_spice_display_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesSpiceDisplay, g_object_unref)
VALA_EXTERN GListStore* boxes_spice_display_get_usb_devices_model (BoxesSpiceDisplay* self);
static GtkWidget* boxes_devices_page_add_usb_device_row (BoxesDevicesPage* self,
                                                  GObject* item);
static GtkWidget* _boxes_devices_page_add_usb_device_row_gtk_list_box_create_widget_func (GObject* item,
                                                                                   gpointer self);
VALA_EXTERN GType boxes_usb_device_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesUsbDevice, g_object_unref)
VALA_EXTERN BoxesDeviceListRow* boxes_device_list_row_new (BoxesUsbDevice* device);
VALA_EXTERN BoxesDeviceListRow* boxes_device_list_row_construct (GType object_type,
                                                     BoxesUsbDevice* device);
VALA_EXTERN GType boxes_device_list_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesDeviceListRow, g_object_unref)
VALA_EXTERN BoxesDevicesPage* boxes_devices_page_new (void);
VALA_EXTERN BoxesDevicesPage* boxes_devices_page_construct (GType object_type);
static void boxes_devices_page_finalize (GObject * obj);
static GType boxes_devices_page_get_type_once (void);

static inline gpointer
boxes_devices_page_get_instance_private (BoxesDevicesPage* self)
{
	return G_STRUCT_MEMBER_P (self, BoxesDevicesPage_private_offset);
}

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

void
boxes_devices_page_setup (BoxesDevicesPage* self,
                          BoxesLibvirtMachine* machine)
{
	BoxesLibvirtMachine* _tmp0_;
	BoxesCdromRow* _tmp1_;
	BoxesSharedFoldersWidget* _tmp2_;
	BoxesBoxConfig* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (machine != NULL);
	_tmp0_ = _g_object_ref0 (machine);
	_g_object_unref0 (self->priv->machine);
	self->priv->machine = _tmp0_;
	boxes_devices_page_setup_usb_devices_list (self);
	_tmp1_ = self->priv->cdrom_row;
	boxes_cdrom_row_setup (_tmp1_, machine);
	_tmp2_ = self->priv->shared_folders_widget;
	_tmp3_ = ((BoxesMachine*) machine)->config;
	_tmp4_ = boxes_box_config_get_uuid (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	boxes_shared_folders_widget_setup (_tmp2_, _tmp6_);
	_g_free0 (_tmp6_);
}

static GtkWidget*
_boxes_devices_page_add_usb_device_row_gtk_list_box_create_widget_func (GObject* item,
                                                                        gpointer self)
{
	GtkWidget* result;
	result = boxes_devices_page_add_usb_device_row ((BoxesDevicesPage*) self, item);
	return result;
}

static void
boxes_devices_page_setup_usb_devices_list (BoxesDevicesPage* self)
{
	BoxesLibvirtMachine* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp13_ = FALSE;
	BoxesLibvirtMachine* _tmp14_;
	BoxesDisplay* _tmp15_;
	BoxesDisplay* _tmp16_;
	BoxesSpiceDisplay* spice_display = NULL;
	BoxesLibvirtMachine* _tmp17_;
	BoxesDisplay* _tmp18_;
	BoxesDisplay* _tmp19_;
	BoxesSpiceDisplay* _tmp20_;
	GListStore* model = NULL;
	BoxesSpiceDisplay* _tmp21_;
	GListStore* _tmp22_;
	GtkListBox* _tmp23_;
	GListStore* _tmp24_;
	g_return_if_fail (self != NULL);
	if (boxes_app_is_running_in_flatpak ()) {
		GtkLabel* msg = NULL;
		GtkLabel* _tmp0_ = NULL;
		GtkLabel* _tmp1_;
		GtkStyleContext* _tmp2_;
		GtkListBox* _tmp3_;
		GtkLabel* _tmp4_;
		_tmp0_ = (GtkLabel*) gtk_label_new (_ ("The Flatpak version of GNOME Boxes does not support USB redirection."));
		gtk_widget_set_visible ((GtkWidget*) _tmp0_, TRUE);
		g_object_set ((GtkWidget*) _tmp0_, "margin", 10, NULL);
		g_object_set (_tmp0_, "wrap", TRUE, NULL);
		g_object_ref_sink (_tmp0_);
		msg = _tmp0_;
		_tmp1_ = msg;
		_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) _tmp1_);
		gtk_style_context_add_class (_tmp2_, "dim-label");
		_tmp3_ = self->priv->listbox;
		_tmp4_ = msg;
		gtk_container_add ((GtkContainer*) _tmp3_, (GtkWidget*) _tmp4_);
		_g_object_unref0 (msg);
		return;
	}
	_tmp5_ = self->priv->machine;
	_tmp6_ = boxes_machine_get_is_running ((BoxesMachine*) _tmp5_);
	_tmp7_ = _tmp6_;
	if (!_tmp7_) {
		GtkLabel* msg = NULL;
		GtkLabel* _tmp8_ = NULL;
		GtkLabel* _tmp9_;
		GtkStyleContext* _tmp10_;
		GtkListBox* _tmp11_;
		GtkLabel* _tmp12_;
		_tmp8_ = (GtkLabel*) gtk_label_new (_ ("Turn on your box to see the USB devices available for redirection."));
		gtk_widget_set_visible ((GtkWidget*) _tmp8_, TRUE);
		g_object_set ((GtkWidget*) _tmp8_, "margin", 10, NULL);
		g_object_ref_sink (_tmp8_);
		msg = _tmp8_;
		_tmp9_ = msg;
		_tmp10_ = gtk_widget_get_style_context ((GtkWidget*) _tmp9_);
		gtk_style_context_add_class (_tmp10_, "dim-label");
		_tmp11_ = self->priv->listbox;
		_tmp12_ = msg;
		gtk_container_add ((GtkContainer*) _tmp11_, (GtkWidget*) _tmp12_);
		_g_object_unref0 (msg);
		return;
	}
	_tmp14_ = self->priv->machine;
	_tmp15_ = boxes_machine_get_display ((BoxesMachine*) _tmp14_);
	_tmp16_ = _tmp15_;
	if (!BOXES_IS_SPICE_DISPLAY (_tmp16_)) {
		_tmp13_ = TRUE;
	} else {
		_tmp13_ = boxes_app_is_running_in_flatpak ();
	}
	if (_tmp13_) {
		return;
	}
	_tmp17_ = self->priv->machine;
	_tmp18_ = boxes_machine_get_display ((BoxesMachine*) _tmp17_);
	_tmp19_ = _tmp18_;
	_tmp20_ = _g_object_ref0 (BOXES_IS_SPICE_DISPLAY (_tmp19_) ? ((BoxesSpiceDisplay*) _tmp19_) : NULL);
	spice_display = _tmp20_;
	_tmp21_ = spice_display;
	_tmp22_ = boxes_spice_display_get_usb_devices_model (_tmp21_);
	model = _tmp22_;
	_tmp23_ = self->priv->listbox;
	_tmp24_ = model;
	gtk_list_box_bind_model (_tmp23_, (GListModel*) _tmp24_, _boxes_devices_page_add_usb_device_row_gtk_list_box_create_widget_func, g_object_ref (self), g_object_unref);
	_g_object_unref0 (model);
	_g_object_unref0 (spice_display);
}

static GtkWidget*
boxes_devices_page_add_usb_device_row (BoxesDevicesPage* self,
                                       GObject* item)
{
	BoxesUsbDevice* device = NULL;
	BoxesUsbDevice* _tmp0_;
	BoxesDeviceListRow* _tmp1_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = _g_object_ref0 (BOXES_IS_USB_DEVICE (item) ? ((BoxesUsbDevice*) item) : NULL);
	device = _tmp0_;
	_tmp1_ = boxes_device_list_row_new (device);
	g_object_ref_sink (_tmp1_);
	result = (GtkWidget*) _tmp1_;
	_g_object_unref0 (device);
	return result;
}

BoxesDevicesPage*
boxes_devices_page_construct (GType object_type)
{
	BoxesDevicesPage * self = NULL;
	self = (BoxesDevicesPage*) g_object_new (object_type, NULL);
	return self;
}

BoxesDevicesPage*
boxes_devices_page_new (void)
{
	return boxes_devices_page_construct (BOXES_TYPE_DEVICES_PAGE);
}

static void
boxes_devices_page_class_init (BoxesDevicesPageClass * klass,
                               gpointer klass_data)
{
	boxes_devices_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BoxesDevicesPage_private_offset);
	G_OBJECT_CLASS (klass)->finalize = boxes_devices_page_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Boxes/ui/preferences/devices-page.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "listbox", FALSE, BoxesDevicesPage_private_offset + G_STRUCT_OFFSET (BoxesDevicesPagePrivate, listbox));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "shared_folders_widget", FALSE, BoxesDevicesPage_private_offset + G_STRUCT_OFFSET (BoxesDevicesPagePrivate, shared_folders_widget));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "cdrom_row", FALSE, BoxesDevicesPage_private_offset + G_STRUCT_OFFSET (BoxesDevicesPagePrivate, cdrom_row));
}

static void
boxes_devices_page_instance_init (BoxesDevicesPage * self,
                                  gpointer klass)
{
	self->priv = boxes_devices_page_get_instance_private (self);
	g_type_ensure (BOXES_TYPE_SHARED_FOLDERS_WIDGET);
	g_type_ensure (BOXES_TYPE_CDROM_ROW);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
boxes_devices_page_finalize (GObject * obj)
{
	BoxesDevicesPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_DEVICES_PAGE, BoxesDevicesPage);
	_g_object_unref0 (self->priv->machine);
	G_OBJECT_CLASS (boxes_devices_page_parent_class)->finalize (obj);
}

static GType
boxes_devices_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BoxesDevicesPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_devices_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesDevicesPage), 0, (GInstanceInitFunc) boxes_devices_page_instance_init, NULL };
	GType boxes_devices_page_type_id;
	boxes_devices_page_type_id = g_type_register_static (hdy_preferences_page_get_type (), "BoxesDevicesPage", &g_define_type_info, 0);
	BoxesDevicesPage_private_offset = g_type_add_instance_private (boxes_devices_page_type_id, sizeof (BoxesDevicesPagePrivate));
	return boxes_devices_page_type_id;
}

GType
boxes_devices_page_get_type (void)
{
	static volatile gsize boxes_devices_page_type_id__once = 0;
	if (g_once_init_enter (&boxes_devices_page_type_id__once)) {
		GType boxes_devices_page_type_id;
		boxes_devices_page_type_id = boxes_devices_page_get_type_once ();
		g_once_init_leave (&boxes_devices_page_type_id__once, boxes_devices_page_type_id);
	}
	return boxes_devices_page_type_id__once;
}

