/* transfer-popover.c generated by valac 0.39.5, the Vala compiler
 * generated from transfer-popover.vala, do not modify */

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

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <spice-client.h>
#include <float.h>
#include <math.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>


#define BOXES_TYPE_TRANSFER_POPOVER (boxes_transfer_popover_get_type ())
#define BOXES_TRANSFER_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_TRANSFER_POPOVER, BoxesTransferPopover))
#define BOXES_TRANSFER_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_TRANSFER_POPOVER, BoxesTransferPopoverClass))
#define BOXES_IS_TRANSFER_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_TRANSFER_POPOVER))
#define BOXES_IS_TRANSFER_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_TRANSFER_POPOVER))
#define BOXES_TRANSFER_POPOVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_TRANSFER_POPOVER, BoxesTransferPopoverClass))

typedef struct _BoxesTransferPopover BoxesTransferPopover;
typedef struct _BoxesTransferPopoverClass BoxesTransferPopoverClass;
typedef struct _BoxesTransferPopoverPrivate BoxesTransferPopoverPrivate;

#define BOXES_TYPE_DISPLAY_TOOLBAR (boxes_display_toolbar_get_type ())
#define BOXES_DISPLAY_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_DISPLAY_TOOLBAR, BoxesDisplayToolbar))
#define BOXES_DISPLAY_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_DISPLAY_TOOLBAR, BoxesDisplayToolbarClass))
#define BOXES_IS_DISPLAY_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_DISPLAY_TOOLBAR))
#define BOXES_IS_DISPLAY_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_DISPLAY_TOOLBAR))
#define BOXES_DISPLAY_TOOLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_DISPLAY_TOOLBAR, BoxesDisplayToolbarClass))

typedef struct _BoxesDisplayToolbar BoxesDisplayToolbar;
typedef struct _BoxesDisplayToolbarClass BoxesDisplayToolbarClass;
enum  {
	BOXES_TRANSFER_POPOVER_0_PROPERTY,
	BOXES_TRANSFER_POPOVER_PROGRESS_PROPERTY,
	BOXES_TRANSFER_POPOVER_NUM_PROPERTIES
};
static GParamSpec* boxes_transfer_popover_properties[BOXES_TRANSFER_POPOVER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))

#define BOXES_TYPE_TRANSFER_INFO_ROW (boxes_transfer_info_row_get_type ())
#define BOXES_TRANSFER_INFO_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_TRANSFER_INFO_ROW, BoxesTransferInfoRow))
#define BOXES_TRANSFER_INFO_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_TRANSFER_INFO_ROW, BoxesTransferInfoRowClass))
#define BOXES_IS_TRANSFER_INFO_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_TRANSFER_INFO_ROW))
#define BOXES_IS_TRANSFER_INFO_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_TRANSFER_INFO_ROW))
#define BOXES_TRANSFER_INFO_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_TRANSFER_INFO_ROW, BoxesTransferInfoRowClass))

typedef struct _BoxesTransferInfoRow BoxesTransferInfoRow;
typedef struct _BoxesTransferInfoRowClass BoxesTransferInfoRowClass;
typedef struct _Block106Data Block106Data;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))
typedef struct _BoxesDisplayToolbarPrivate BoxesDisplayToolbarPrivate;
enum  {
	BOXES_TRANSFER_POPOVER_ALL_FINISHED_SIGNAL,
	BOXES_TRANSFER_POPOVER_NUM_SIGNALS
};
static guint boxes_transfer_popover_signals[BOXES_TRANSFER_POPOVER_NUM_SIGNALS] = {0};

struct _BoxesTransferPopover {
	GtkPopover parent_instance;
	BoxesTransferPopoverPrivate * priv;
	GtkBox* transfers_container;
	GList* spice_tasks;
};

struct _BoxesTransferPopoverClass {
	GtkPopoverClass parent_class;
};

struct _BoxesTransferPopoverPrivate {
	gdouble _progress;
	gulong total_bytes_id;
	BoxesDisplayToolbar* display_toolbar;
};

struct _Block106Data {
	int _ref_count_;
	BoxesTransferPopover* self;
	BoxesTransferInfoRow* row;
	SpiceFileTransferTask* transfer_task;
};

struct _BoxesDisplayToolbar {
	GtkHeaderBar parent_instance;
	BoxesDisplayToolbarPrivate * priv;
	GtkButton* transfers_button;
};

struct _BoxesDisplayToolbarClass {
	GtkHeaderBarClass parent_class;
};


static gpointer boxes_transfer_popover_parent_class = NULL;

GType boxes_transfer_popover_get_type (void) G_GNUC_CONST;
GType boxes_display_toolbar_get_type (void) G_GNUC_CONST;
#define BOXES_TRANSFER_POPOVER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BOXES_TYPE_TRANSFER_POPOVER, BoxesTransferPopoverPrivate))
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
#define BOXES_TRANSFER_POPOVER_remove_id_timeout ((guint) 5000)
BoxesTransferPopover* boxes_transfer_popover_new (BoxesDisplayToolbar* toolbar);
BoxesTransferPopover* boxes_transfer_popover_construct (GType object_type,
                                                        BoxesDisplayToolbar* toolbar);
void boxes_transfer_popover_add_transfer (BoxesTransferPopover* self,
                                          GObject* transfer_task);
void boxes_transfer_popover_add_spice_transfer (BoxesTransferPopover* self,
                                                SpiceFileTransferTask* transfer_task);
GType boxes_transfer_info_row_get_type (void) G_GNUC_CONST;
static Block106Data* block106_data_ref (Block106Data* _data106_);
static void block106_data_unref (void * _userdata_);
BoxesTransferInfoRow* boxes_transfer_info_row_new (const gchar* name);
BoxesTransferInfoRow* boxes_transfer_info_row_construct (GType object_type,
                                                         const gchar* name);
static void __lambda79_ (Block106Data* _data106_,
                  GObject* t,
                  GParamSpec* p);
void boxes_transfer_info_row_set_total_bytes (BoxesTransferInfoRow* self,
                                              guint64 value);
static void ___lambda79__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
static void __lambda80_ (Block106Data* _data106_,
                  GObject* t,
                  GParamSpec* p);
void boxes_transfer_info_row_set_progress (BoxesTransferInfoRow* self,
                                           gdouble value);
void boxes_transfer_popover_set_progress (BoxesTransferPopover* self,
                                          gdouble value);
static void ___lambda80__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
static void __lambda81_ (Block106Data* _data106_,
                  SpiceFileTransferTask* transfer_task,
                  GError* _error_);
void boxes_transfer_info_row_finalize_transfer (BoxesTransferInfoRow* self);
static gboolean ___lambda82_ (BoxesTransferPopover* self);
static gboolean ____lambda82__gsource_func (gpointer self);
static void ___lambda81__spice_file_transfer_task_finished (SpiceFileTransferTask* _sender,
                                                     GError* object,
                                                     gpointer self);
static void __lambda83_ (Block106Data* _data106_);
static gboolean ___lambda84_ (BoxesTransferPopover* self);
static gboolean ____lambda84__gsource_func (gpointer self);
static void ___lambda83__boxes_transfer_info_row_finished (BoxesTransferInfoRow* _sender,
                                                    gpointer self);
void boxes_transfer_popover_clean_up (BoxesTransferPopover* self);
void boxes_display_toolbar_set_progress (BoxesDisplayToolbar* self,
                                         gdouble value);
gdouble boxes_transfer_popover_get_progress (BoxesTransferPopover* self);
static void boxes_transfer_popover_finalize (GObject * obj);
static void _vala_boxes_transfer_popover_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec);
static void _vala_boxes_transfer_popover_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec);


static void
_g_object_unref0_ (gpointer var)
{
#line 10 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
#line 174 "transfer-popover.c"
}


static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
#line 10 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
#line 183 "transfer-popover.c"
}


static gpointer
_g_object_ref0 (gpointer self)
{
#line 18 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	return self ? g_object_ref (self) : NULL;
#line 192 "transfer-popover.c"
}


BoxesTransferPopover*
boxes_transfer_popover_construct (GType object_type,
                                  BoxesDisplayToolbar* toolbar)
{
	BoxesTransferPopover * self = NULL;
	BoxesDisplayToolbar* _tmp0_;
#line 17 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_return_val_if_fail (toolbar != NULL, NULL);
#line 17 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	self = (BoxesTransferPopover*) g_object_new (object_type, NULL);
#line 18 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp0_ = _g_object_ref0 (toolbar);
#line 18 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_g_object_unref0 (self->priv->display_toolbar);
#line 18 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	self->priv->display_toolbar = _tmp0_;
#line 17 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	return self;
#line 214 "transfer-popover.c"
}


BoxesTransferPopover*
boxes_transfer_popover_new (BoxesDisplayToolbar* toolbar)
{
#line 17 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	return boxes_transfer_popover_construct (BOXES_TYPE_TRANSFER_POPOVER, toolbar);
#line 223 "transfer-popover.c"
}


void
boxes_transfer_popover_add_transfer (BoxesTransferPopover* self,
                                     GObject* transfer_task)
{
#line 21 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_return_if_fail (self != NULL);
#line 21 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_return_if_fail (transfer_task != NULL);
#line 22 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	if (G_TYPE_CHECK_INSTANCE_TYPE (transfer_task, spice_file_transfer_task_get_type ())) {
#line 237 "transfer-popover.c"
		SpiceFileTransferTask* spice_transfer_task = NULL;
		SpiceFileTransferTask* _tmp0_;
		SpiceFileTransferTask* _tmp1_;
#line 23 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (transfer_task, spice_file_transfer_task_get_type ()) ? ((SpiceFileTransferTask*) transfer_task) : NULL);
#line 23 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		spice_transfer_task = _tmp0_;
#line 25 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		_tmp1_ = spice_transfer_task;
#line 25 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		boxes_transfer_popover_add_spice_transfer (self, _tmp1_);
#line 22 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		_g_object_unref0 (spice_transfer_task);
#line 251 "transfer-popover.c"
	} else {
#line 27 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		g_warning ("transfer-popover.vala:27: File transfer of unsupported type.");
#line 255 "transfer-popover.c"
	}
}


static Block106Data*
block106_data_ref (Block106Data* _data106_)
{
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_atomic_int_inc (&_data106_->_ref_count_);
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	return _data106_;
#line 267 "transfer-popover.c"
}


static void
block106_data_unref (void * _userdata_)
{
	Block106Data* _data106_;
	_data106_ = (Block106Data*) _userdata_;
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	if (g_atomic_int_dec_and_test (&_data106_->_ref_count_)) {
#line 278 "transfer-popover.c"
		BoxesTransferPopover* self;
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		self = _data106_->self;
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		_g_object_unref0 (_data106_->row);
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		_g_object_unref0 (_data106_->transfer_task);
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		_g_object_unref0 (self);
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		g_slice_free (Block106Data, _data106_);
#line 290 "transfer-popover.c"
	}
}


static void
__lambda79_ (Block106Data* _data106_,
             GObject* t,
             GParamSpec* p)
{
	BoxesTransferPopover* self;
	guint64 _tmp0_;
	guint64 _tmp1_;
	gulong _tmp2_;
#line 37 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	self = _data106_->self;
#line 37 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_return_if_fail (t != NULL);
#line 37 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_return_if_fail (p != NULL);
#line 38 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp0_ = spice_file_transfer_task_get_total_bytes (_data106_->transfer_task);
#line 38 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp1_ = _tmp0_;
#line 38 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	boxes_transfer_info_row_set_total_bytes (_data106_->row, _tmp1_);
#line 40 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp2_ = self->priv->total_bytes_id;
#line 40 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_signal_handler_disconnect ((GObject*) _data106_->transfer_task, _tmp2_);
#line 320 "transfer-popover.c"
}


static void
___lambda79__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
#line 37 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	__lambda79_ (self, _sender, pspec);
#line 331 "transfer-popover.c"
}


static void
__lambda80_ (Block106Data* _data106_,
             GObject* t,
             GParamSpec* p)
{
	BoxesTransferPopover* self;
	gdouble _tmp0_;
	gdouble _tmp1_;
	gdouble total = 0.0;
	gdouble transferred = 0.0;
	GList* _tmp2_;
	gdouble _tmp8_;
	gdouble _tmp9_;
#line 43 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	self = _data106_->self;
#line 43 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_return_if_fail (t != NULL);
#line 43 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_return_if_fail (p != NULL);
#line 44 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp0_ = spice_file_transfer_task_get_progress (_data106_->transfer_task);
#line 44 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp1_ = _tmp0_;
#line 44 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	boxes_transfer_info_row_set_progress (_data106_->row, _tmp1_);
#line 46 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	total = (gdouble) 0;
#line 47 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	transferred = (gdouble) 0;
#line 48 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp2_ = self->spice_tasks;
#line 366 "transfer-popover.c"
	{
		GList* task_collection = NULL;
		GList* task_it = NULL;
#line 48 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		task_collection = _tmp2_;
#line 48 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		for (task_it = task_collection; task_it != NULL; task_it = task_it->next) {
#line 374 "transfer-popover.c"
			SpiceFileTransferTask* _tmp3_;
			SpiceFileTransferTask* task = NULL;
#line 48 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
			_tmp3_ = _g_object_ref0 ((SpiceFileTransferTask*) task_it->data);
#line 48 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
			task = _tmp3_;
#line 381 "transfer-popover.c"
			{
				gdouble _tmp4_;
				SpiceFileTransferTask* _tmp5_;
				gdouble _tmp6_;
				SpiceFileTransferTask* _tmp7_;
#line 49 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
				_tmp4_ = total;
#line 49 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
				_tmp5_ = task;
#line 49 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
				total = _tmp4_ + spice_file_transfer_task_get_total_bytes (_tmp5_);
#line 50 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
				_tmp6_ = transferred;
#line 50 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
				_tmp7_ = task;
#line 50 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
				transferred = _tmp6_ + spice_file_transfer_task_get_transferred_bytes (_tmp7_);
#line 48 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
				_g_object_unref0 (task);
#line 401 "transfer-popover.c"
			}
		}
	}
#line 53 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp8_ = transferred;
#line 53 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp9_ = total;
#line 53 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	boxes_transfer_popover_set_progress (self, _tmp8_ / _tmp9_);
#line 411 "transfer-popover.c"
}


static void
___lambda80__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
#line 43 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	__lambda80_ (self, _sender, pspec);
#line 422 "transfer-popover.c"
}


static gboolean
___lambda82_ (BoxesTransferPopover* self)
{
	gboolean result = FALSE;
#line 64 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_signal_emit (self, boxes_transfer_popover_signals[BOXES_TRANSFER_POPOVER_ALL_FINISHED_SIGNAL], 0);
#line 66 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	result = FALSE;
#line 66 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	return result;
#line 436 "transfer-popover.c"
}


static gboolean
____lambda82__gsource_func (gpointer self)
{
	gboolean result;
	result = ___lambda82_ ((BoxesTransferPopover*) self);
#line 63 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	return result;
#line 447 "transfer-popover.c"
}


static void
__lambda81_ (Block106Data* _data106_,
             SpiceFileTransferTask* transfer_task,
             GError* _error_)
{
	BoxesTransferPopover* self;
	GList* _tmp1_;
#line 55 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	self = _data106_->self;
#line 55 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_return_if_fail (transfer_task != NULL);
#line 56 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	if (_error_ != NULL) {
#line 464 "transfer-popover.c"
		const gchar* _tmp0_;
#line 57 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		_tmp0_ = _error_->message;
#line 57 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		g_warning ("transfer-popover.vala:57: %s", _tmp0_);
#line 470 "transfer-popover.c"
	}
#line 59 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	boxes_transfer_info_row_finalize_transfer (_data106_->row);
#line 60 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	self->spice_tasks = g_list_remove (self->spice_tasks, transfer_task);
#line 62 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp1_ = self->spice_tasks;
#line 62 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	if (g_list_length (_tmp1_) == ((guint) 0)) {
#line 63 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		g_timeout_add_full (G_PRIORITY_DEFAULT, BOXES_TRANSFER_POPOVER_remove_id_timeout, ____lambda82__gsource_func, g_object_ref (self), g_object_unref);
#line 482 "transfer-popover.c"
	}
}


static void
___lambda81__spice_file_transfer_task_finished (SpiceFileTransferTask* _sender,
                                                GError* object,
                                                gpointer self)
{
#line 55 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	__lambda81_ (self, _sender, object);
#line 494 "transfer-popover.c"
}


static gboolean
___lambda84_ (BoxesTransferPopover* self)
{
	gboolean result = FALSE;
#line 76 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_signal_emit (self, boxes_transfer_popover_signals[BOXES_TRANSFER_POPOVER_ALL_FINISHED_SIGNAL], 0);
#line 78 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	result = FALSE;
#line 78 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	return result;
#line 508 "transfer-popover.c"
}


static gboolean
____lambda84__gsource_func (gpointer self)
{
	gboolean result;
	result = ___lambda84_ ((BoxesTransferPopover*) self);
#line 75 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	return result;
#line 519 "transfer-popover.c"
}


static void
__lambda83_ (Block106Data* _data106_)
{
	BoxesTransferPopover* self;
	GList* _tmp0_;
#line 71 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	self = _data106_->self;
#line 72 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	self->spice_tasks = g_list_remove (self->spice_tasks, _data106_->transfer_task);
#line 74 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp0_ = self->spice_tasks;
#line 74 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	if (g_list_length (_tmp0_) == ((guint) 0)) {
#line 75 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		g_timeout_add_full (G_PRIORITY_DEFAULT, BOXES_TRANSFER_POPOVER_remove_id_timeout, ____lambda84__gsource_func, g_object_ref (self), g_object_unref);
#line 538 "transfer-popover.c"
	}
}


static void
___lambda83__boxes_transfer_info_row_finished (BoxesTransferInfoRow* _sender,
                                               gpointer self)
{
#line 71 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	__lambda83_ (self);
#line 549 "transfer-popover.c"
}


void
boxes_transfer_popover_add_spice_transfer (BoxesTransferPopover* self,
                                           SpiceFileTransferTask* transfer_task)
{
	Block106Data* _data106_;
	SpiceFileTransferTask* _tmp0_;
	SpiceFileTransferTask* _tmp1_;
	GFile* _tmp2_;
	GFile* _tmp3_;
	GFile* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	BoxesTransferInfoRow* _tmp7_;
	BoxesTransferInfoRow* _tmp8_;
	gulong _tmp9_;
	GtkBox* _tmp10_;
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_return_if_fail (self != NULL);
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_return_if_fail (transfer_task != NULL);
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_data106_ = g_slice_new0 (Block106Data);
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_data106_->_ref_count_ = 1;
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_data106_->self = g_object_ref (self);
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp0_ = _g_object_ref0 (transfer_task);
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_g_object_unref0 (_data106_->transfer_task);
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_data106_->transfer_task = _tmp0_;
#line 32 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp1_ = _g_object_ref0 (_data106_->transfer_task);
#line 32 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	self->spice_tasks = g_list_append (self->spice_tasks, _tmp1_);
#line 34 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_object_get (_data106_->transfer_task, "file", &_tmp2_, NULL);
#line 34 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp3_ = _tmp2_;
#line 34 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp4_ = _tmp3_;
#line 34 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp5_ = g_file_get_basename (_tmp4_);
#line 34 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp6_ = _tmp5_;
#line 34 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp7_ = boxes_transfer_info_row_new (_tmp6_);
#line 34 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_object_ref_sink (_tmp7_);
#line 34 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp8_ = _tmp7_;
#line 34 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_g_free0 (_tmp6_);
#line 34 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_g_object_unref0 (_tmp4_);
#line 34 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_data106_->row = _tmp8_;
#line 35 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_object_bind_property_with_closures ((GObject*) _data106_->transfer_task, "transferred-bytes", (GObject*) _data106_->row, "transferred-bytes", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
#line 37 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp9_ = g_signal_connect_data ((GObject*) _data106_->transfer_task, "notify::total-bytes", (GCallback) ___lambda79__g_object_notify, block106_data_ref (_data106_), (GClosureNotify) block106_data_unref, 0);
#line 37 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	self->priv->total_bytes_id = _tmp9_;
#line 43 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_signal_connect_data ((GObject*) _data106_->transfer_task, "notify::progress", (GCallback) ___lambda80__g_object_notify, block106_data_ref (_data106_), (GClosureNotify) block106_data_unref, 0);
#line 55 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_signal_connect_data (_data106_->transfer_task, "finished", (GCallback) ___lambda81__spice_file_transfer_task_finished, block106_data_ref (_data106_), (GClosureNotify) block106_data_unref, 0);
#line 71 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_signal_connect_data (_data106_->row, "finished", (GCallback) ___lambda83__boxes_transfer_info_row_finished, block106_data_ref (_data106_), (GClosureNotify) block106_data_unref, 0);
#line 83 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp10_ = self->transfers_container;
#line 83 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	gtk_box_pack_start (_tmp10_, (GtkWidget*) _data106_->row, TRUE, TRUE, (guint) 0);
#line 84 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	gtk_widget_show ((GtkWidget*) _data106_->row);
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	block106_data_unref (_data106_);
#line 31 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_data106_ = NULL;
#line 633 "transfer-popover.c"
}


void
boxes_transfer_popover_clean_up (BoxesTransferPopover* self)
{
	GtkBox* _tmp0_;
	GList* _tmp1_;
	BoxesDisplayToolbar* _tmp4_;
	BoxesDisplayToolbar* _tmp5_;
	GtkButton* _tmp6_;
#line 87 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_return_if_fail (self != NULL);
#line 88 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp0_ = self->transfers_container;
#line 88 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp1_ = gtk_container_get_children ((GtkContainer*) _tmp0_);
#line 651 "transfer-popover.c"
	{
		GList* row_collection = NULL;
		GList* row_it = NULL;
#line 88 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		row_collection = _tmp1_;
#line 88 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		for (row_it = row_collection; row_it != NULL; row_it = row_it->next) {
#line 659 "transfer-popover.c"
			GtkWidget* row = NULL;
#line 88 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
			row = (GtkWidget*) row_it->data;
#line 663 "transfer-popover.c"
			{
				GtkBox* _tmp2_;
				GtkWidget* _tmp3_;
#line 89 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
				_tmp2_ = self->transfers_container;
#line 89 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
				_tmp3_ = row;
#line 89 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
				gtk_container_remove ((GtkContainer*) _tmp2_, _tmp3_);
#line 673 "transfer-popover.c"
			}
		}
#line 88 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		_g_list_free0 (row_collection);
#line 678 "transfer-popover.c"
	}
#line 92 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	gtk_popover_popdown ((GtkPopover*) self);
#line 93 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp4_ = self->priv->display_toolbar;
#line 93 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	boxes_display_toolbar_set_progress (_tmp4_, (gdouble) 0);
#line 94 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp5_ = self->priv->display_toolbar;
#line 94 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp6_ = _tmp5_->transfers_button;
#line 94 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	gtk_widget_hide ((GtkWidget*) _tmp6_);
#line 692 "transfer-popover.c"
}


gdouble
boxes_transfer_popover_get_progress (BoxesTransferPopover* self)
{
	gdouble result;
	gdouble _tmp0_;
#line 11 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_return_val_if_fail (self != NULL, 0.0);
#line 11 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_tmp0_ = self->priv->_progress;
#line 11 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	result = _tmp0_;
#line 11 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	return result;
#line 709 "transfer-popover.c"
}


void
boxes_transfer_popover_set_progress (BoxesTransferPopover* self,
                                     gdouble value)
{
#line 11 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_return_if_fail (self != NULL);
#line 11 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	if (boxes_transfer_popover_get_progress (self) != value) {
#line 11 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		self->priv->_progress = value;
#line 11 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		g_object_notify_by_pspec ((GObject *) self, boxes_transfer_popover_properties[BOXES_TRANSFER_POPOVER_PROGRESS_PROPERTY]);
#line 725 "transfer-popover.c"
	}
}


static void
boxes_transfer_popover_class_init (BoxesTransferPopoverClass * klass)
{
	gint BoxesTransferPopover_private_offset;
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	boxes_transfer_popover_parent_class = g_type_class_peek_parent (klass);
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_type_class_add_private (klass, sizeof (BoxesTransferPopoverPrivate));
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_boxes_transfer_popover_get_property;
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	G_OBJECT_CLASS (klass)->set_property = _vala_boxes_transfer_popover_set_property;
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	G_OBJECT_CLASS (klass)->finalize = boxes_transfer_popover_finalize;
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_TRANSFER_POPOVER_PROGRESS_PROPERTY, boxes_transfer_popover_properties[BOXES_TRANSFER_POPOVER_PROGRESS_PROPERTY] = g_param_spec_double ("progress", "progress", "progress", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	BoxesTransferPopover_private_offset = g_type_class_get_instance_private_offset (klass);
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Boxes/ui/transfer-popover.ui");
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	boxes_transfer_popover_signals[BOXES_TRANSFER_POPOVER_ALL_FINISHED_SIGNAL] = g_signal_new ("all-finished", BOXES_TYPE_TRANSFER_POPOVER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "transfers_container", FALSE, G_STRUCT_OFFSET (BoxesTransferPopover, transfers_container));
#line 754 "transfer-popover.c"
}


static void
boxes_transfer_popover_instance_init (BoxesTransferPopover * self)
{
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	self->priv = BOXES_TRANSFER_POPOVER_GET_PRIVATE (self);
#line 14 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	self->priv->total_bytes_id = (gulong) 0;
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	gtk_widget_init_template (GTK_WIDGET (self));
#line 767 "transfer-popover.c"
}


static void
boxes_transfer_popover_finalize (GObject * obj)
{
	BoxesTransferPopover * self;
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_TRANSFER_POPOVER, BoxesTransferPopover);
#line 7 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_g_object_unref0 (self->transfers_container);
#line 10 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	__g_list_free__g_object_unref0_0 (self->spice_tasks);
#line 15 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	_g_object_unref0 (self->priv->display_toolbar);
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	G_OBJECT_CLASS (boxes_transfer_popover_parent_class)->finalize (obj);
#line 785 "transfer-popover.c"
}


GType
boxes_transfer_popover_get_type (void)
{
	static volatile gsize boxes_transfer_popover_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_transfer_popover_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BoxesTransferPopoverClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_transfer_popover_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesTransferPopover), 0, (GInstanceInitFunc) boxes_transfer_popover_instance_init, NULL };
		GType boxes_transfer_popover_type_id;
		boxes_transfer_popover_type_id = g_type_register_static (gtk_popover_get_type (), "BoxesTransferPopover", &g_define_type_info, 0);
		g_once_init_leave (&boxes_transfer_popover_type_id__volatile, boxes_transfer_popover_type_id);
	}
	return boxes_transfer_popover_type_id__volatile;
}


static void
_vala_boxes_transfer_popover_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec)
{
	BoxesTransferPopover * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_TRANSFER_POPOVER, BoxesTransferPopover);
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	switch (property_id) {
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		case BOXES_TRANSFER_POPOVER_PROGRESS_PROPERTY:
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		g_value_set_double (value, boxes_transfer_popover_get_progress (self));
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		break;
#line 819 "transfer-popover.c"
		default:
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		break;
#line 825 "transfer-popover.c"
	}
}


static void
_vala_boxes_transfer_popover_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec)
{
	BoxesTransferPopover * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_TRANSFER_POPOVER, BoxesTransferPopover);
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
	switch (property_id) {
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		case BOXES_TRANSFER_POPOVER_PROGRESS_PROPERTY:
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		boxes_transfer_popover_set_progress (self, g_value_get_double (value));
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		break;
#line 846 "transfer-popover.c"
		default:
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 5 "/home/fborges/checkout/gnome-boxes/src/transfer-popover.vala"
		break;
#line 852 "transfer-popover.c"
	}
}



