/* file_transmission_progress.c generated by valac 0.56.19, the Vala compiler
 * generated from file_transmission_progress.vala, do not modify */

#include <adwaita.h>
#include <glib-object.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <float.h>
#include <math.h>
#include <gsk/gsk.h>
#include <graphene-gobject.h>
#include <gdk/gdk.h>
#include <string.h>

#define DINO_UI_FILE_TRANSMISSION_PROGRESS_LINE_WIDTH 4
#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 DINO_UI_TYPE_FILE_TRANSMISSION_PROGRESS (dino_ui_file_transmission_progress_get_type ())
#define DINO_UI_FILE_TRANSMISSION_PROGRESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_FILE_TRANSMISSION_PROGRESS, DinoUiFileTransmissionProgress))
#define DINO_UI_FILE_TRANSMISSION_PROGRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_FILE_TRANSMISSION_PROGRESS, DinoUiFileTransmissionProgressClass))
#define DINO_UI_IS_FILE_TRANSMISSION_PROGRESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_FILE_TRANSMISSION_PROGRESS))
#define DINO_UI_IS_FILE_TRANSMISSION_PROGRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_FILE_TRANSMISSION_PROGRESS))
#define DINO_UI_FILE_TRANSMISSION_PROGRESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_FILE_TRANSMISSION_PROGRESS, DinoUiFileTransmissionProgressClass))

typedef struct _DinoUiFileTransmissionProgress DinoUiFileTransmissionProgress;
typedef struct _DinoUiFileTransmissionProgressClass DinoUiFileTransmissionProgressClass;
typedef struct _DinoUiFileTransmissionProgressPrivate DinoUiFileTransmissionProgressPrivate;
typedef enum  {
	DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UNKNOWN_SOURCE,
	DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOAD_NOT_STARTED,
	DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOAD_NOT_STARTED_FAILED_BEFORE,
	DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOADING,
	DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UPLOADING,
	DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UPLOAD_FAILED
} DinoUiFileTransmissionProgressState;

#define DINO_UI_FILE_TRANSMISSION_PROGRESS_TYPE_STATE (dino_ui_file_transmission_progress_state_get_type ())
enum  {
	DINO_UI_FILE_TRANSMISSION_PROGRESS_0_PROPERTY,
	DINO_UI_FILE_TRANSMISSION_PROGRESS_FILE_SIZE_PROPERTY,
	DINO_UI_FILE_TRANSMISSION_PROGRESS_TRANSFERRED_SIZE_PROPERTY,
	DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_PROPERTY,
	DINO_UI_FILE_TRANSMISSION_PROGRESS_NUM_PROPERTIES
};
static GParamSpec* dino_ui_file_transmission_progress_properties[DINO_UI_FILE_TRANSMISSION_PROGRESS_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _gsk_path_unref0(var) ((var == NULL) ? NULL : (var = (gsk_path_unref (var), NULL)))
#define __vala_GskStroke_free0(var) ((var == NULL) ? NULL : (var = (_vala_GskStroke_free (var), NULL)))
#define _gsk_path_builder_unref0(var) ((var == NULL) ? NULL : (var = (gsk_path_builder_unref (var), NULL)))

struct _DinoUiFileTransmissionProgress {
	AdwBin parent_instance;
	DinoUiFileTransmissionProgressPrivate * priv;
};

struct _DinoUiFileTransmissionProgressClass {
	AdwBinClass parent_class;
};

struct _DinoUiFileTransmissionProgressPrivate {
	gint64 _file_size;
	gint64 _transferred_size;
	DinoUiFileTransmissionProgressState _state;
	GtkButton* button;
	AdwTimedAnimation* progress_animation;
};

static gint DinoUiFileTransmissionProgress_private_offset;
static gpointer dino_ui_file_transmission_progress_parent_class = NULL;

VALA_EXTERN GType dino_ui_file_transmission_progress_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiFileTransmissionProgress, g_object_unref)
VALA_EXTERN GType dino_ui_file_transmission_progress_state_get_type (void) G_GNUC_CONST ;
static void dino_ui_file_transmission_progress_setup_animation (DinoUiFileTransmissionProgress* self);
static void _gtk_widget_queue_draw_adw_animation_target_func (gdouble value,
                                                       gpointer self);
static void dino_ui_file_transmission_progress_update_progress (DinoUiFileTransmissionProgress* self);
static void _dino_ui_file_transmission_progress_update_progress_adw_animation_done (AdwAnimation* _sender,
                                                                             gpointer self);
static void dino_ui_file_transmission_progress_on_state_changed (DinoUiFileTransmissionProgress* self);
VALA_EXTERN DinoUiFileTransmissionProgressState dino_ui_file_transmission_progress_get_state (DinoUiFileTransmissionProgress* self);
VALA_EXTERN gint64 dino_ui_file_transmission_progress_get_file_size (DinoUiFileTransmissionProgress* self);
VALA_EXTERN gint64 dino_ui_file_transmission_progress_get_transferred_size (DinoUiFileTransmissionProgress* self);
GskPath* dino_ui_file_transmission_progress_create_progress_arc (GskPath* circle,
                                                                 gfloat percentage);
static void dino_ui_file_transmission_progress_real_snapshot (GtkWidget* base,
                                                       GtkSnapshot* snapshot);
static void _vala_GskStroke_free (GskStroke* self);
static void dino_ui_file_transmission_progress_on_button_clicked (DinoUiFileTransmissionProgress* self);
static void dino_ui_file_transmission_progress_real_dispose (GObject* base);
VALA_EXTERN DinoUiFileTransmissionProgress* dino_ui_file_transmission_progress_new (void);
VALA_EXTERN DinoUiFileTransmissionProgress* dino_ui_file_transmission_progress_construct (GType object_type);
VALA_EXTERN void dino_ui_file_transmission_progress_set_file_size (DinoUiFileTransmissionProgress* self,
                                                       gint64 value);
VALA_EXTERN void dino_ui_file_transmission_progress_set_transferred_size (DinoUiFileTransmissionProgress* self,
                                                              gint64 value);
VALA_EXTERN void dino_ui_file_transmission_progress_set_state (DinoUiFileTransmissionProgress* self,
                                                   DinoUiFileTransmissionProgressState value);
static GObject * dino_ui_file_transmission_progress_constructor (GType type,
                                                          guint n_construct_properties,
                                                          GObjectConstructParam * construct_properties);
static void _dino_ui_file_transmission_progress_on_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                               gpointer self);
static void _dino_ui_file_transmission_progress_update_progress_g_object_notify (GObject* _sender,
                                                                          GParamSpec* pspec,
                                                                          gpointer self);
static void _dino_ui_file_transmission_progress_on_state_changed_g_object_notify (GObject* _sender,
                                                                           GParamSpec* pspec,
                                                                           gpointer self);
static void dino_ui_file_transmission_progress_finalize (GObject * obj);
static GType dino_ui_file_transmission_progress_get_type_once (void);
static void _vala_dino_ui_file_transmission_progress_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec);
static void _vala_dino_ui_file_transmission_progress_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_ui_file_transmission_progress_get_instance_private (DinoUiFileTransmissionProgress* self)
{
	return G_STRUCT_MEMBER_P (self, DinoUiFileTransmissionProgress_private_offset);
}

static GType
dino_ui_file_transmission_progress_state_get_type_once (void)
{
	static const GEnumValue values[] = {{DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UNKNOWN_SOURCE, "DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UNKNOWN_SOURCE", "unknown-source"}, {DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOAD_NOT_STARTED, "DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOAD_NOT_STARTED", "download-not-started"}, {DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOAD_NOT_STARTED_FAILED_BEFORE, "DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOAD_NOT_STARTED_FAILED_BEFORE", "download-not-started-failed-before"}, {DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOADING, "DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOADING", "downloading"}, {DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UPLOADING, "DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UPLOADING", "uploading"}, {DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UPLOAD_FAILED, "DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UPLOAD_FAILED", "upload-failed"}, {0, NULL, NULL}};
	GType dino_ui_file_transmission_progress_state_type_id;
	dino_ui_file_transmission_progress_state_type_id = g_enum_register_static ("DinoUiFileTransmissionProgressState", values);
	return dino_ui_file_transmission_progress_state_type_id;
}

GType
dino_ui_file_transmission_progress_state_get_type (void)
{
	static volatile gsize dino_ui_file_transmission_progress_state_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_file_transmission_progress_state_type_id__once)) {
		GType dino_ui_file_transmission_progress_state_type_id;
		dino_ui_file_transmission_progress_state_type_id = dino_ui_file_transmission_progress_state_get_type_once ();
		g_once_init_leave (&dino_ui_file_transmission_progress_state_type_id__once, dino_ui_file_transmission_progress_state_type_id);
	}
	return dino_ui_file_transmission_progress_state_type_id__once;
}

static void
_gtk_widget_queue_draw_adw_animation_target_func (gdouble value,
                                                  gpointer self)
{
	gtk_widget_queue_draw ((GtkWidget*) self);
}

static void
_dino_ui_file_transmission_progress_update_progress_adw_animation_done (AdwAnimation* _sender,
                                                                        gpointer self)
{
	dino_ui_file_transmission_progress_update_progress ((DinoUiFileTransmissionProgress*) self);
}

static void
dino_ui_file_transmission_progress_setup_animation (DinoUiFileTransmissionProgress* self)
{
	AdwCallbackAnimationTarget* _tmp0_;
	AdwTimedAnimation* _tmp1_ = NULL;
	AdwTimedAnimation* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (AdwCallbackAnimationTarget*) adw_callback_animation_target_new (_gtk_widget_queue_draw_adw_animation_target_func, g_object_ref ((GtkWidget*) self), g_object_unref);
	_tmp1_ = (AdwTimedAnimation*) adw_timed_animation_new ((GtkWidget*) self, 0.0, 0.0, (guint) 250, (AdwAnimationTarget*) _tmp0_);
	adw_timed_animation_set_easing (_tmp1_, ADW_LINEAR);
	_g_object_unref0 (self->priv->progress_animation);
	self->priv->progress_animation = _tmp1_;
	_tmp2_ = self->priv->progress_animation;
	g_signal_connect_object ((AdwAnimation*) _tmp2_, "done", (GCallback) _dino_ui_file_transmission_progress_update_progress_adw_animation_done, self, 0);
}

static void
dino_ui_file_transmission_progress_on_state_changed (DinoUiFileTransmissionProgress* self)
{
	gboolean _tmp0_ = FALSE;
	DinoUiFileTransmissionProgressState _tmp1_;
	DinoUiFileTransmissionProgressState _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_state;
	if (_tmp1_ != DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UNKNOWN_SOURCE) {
		DinoUiFileTransmissionProgressState _tmp2_;
		_tmp2_ = self->priv->_state;
		_tmp0_ = _tmp2_ != DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UPLOAD_FAILED;
	} else {
		_tmp0_ = FALSE;
	}
	gtk_widget_set_sensitive ((GtkWidget*) self, _tmp0_);
	_tmp3_ = self->priv->_state;
	switch (_tmp3_) {
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UNKNOWN_SOURCE:
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOAD_NOT_STARTED:
		{
			GtkButton* _tmp4_;
			_tmp4_ = self->priv->button;
			gtk_button_set_icon_name (_tmp4_, "document-save-symbolic");
			break;
		}
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOADING:
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UPLOADING:
		{
			GtkButton* _tmp5_;
			_tmp5_ = self->priv->button;
			gtk_button_set_icon_name (_tmp5_, "small-x-symbolic");
			break;
		}
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOAD_NOT_STARTED_FAILED_BEFORE:
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UPLOAD_FAILED:
		{
			GtkButton* _tmp6_;
			_tmp6_ = self->priv->button;
			gtk_button_set_icon_name (_tmp6_, "dialog-warning-symbolic");
			break;
		}
		default:
		break;
	}
}

static void
dino_ui_file_transmission_progress_update_progress (DinoUiFileTransmissionProgress* self)
{
	gboolean _tmp0_ = FALSE;
	gint64 _tmp1_;
	gdouble next_value = 0.0;
	gint64 _tmp3_;
	gint64 _tmp4_;
	gboolean _tmp5_ = FALSE;
	AdwTimedAnimation* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_file_size;
	if (_tmp1_ == ((gint64) 0)) {
		_tmp0_ = TRUE;
	} else {
		AdwTimedAnimation* _tmp2_;
		_tmp2_ = self->priv->progress_animation;
		_tmp0_ = _tmp2_ == NULL;
	}
	if (_tmp0_) {
		return;
	}
	_tmp3_ = self->priv->_transferred_size;
	_tmp4_ = self->priv->_file_size;
	next_value = CLAMP (((gdouble) _tmp3_) / ((gdouble) _tmp4_), (gdouble) 0, (gdouble) 1);
	_tmp6_ = self->priv->progress_animation;
	if (_tmp6_ != NULL) {
		AdwTimedAnimation* _tmp7_;
		gdouble _tmp8_;
		gdouble _tmp9_;
		_tmp7_ = self->priv->progress_animation;
		_tmp8_ = adw_timed_animation_get_value_to (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp5_ = _tmp9_ != next_value;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		AdwTimedAnimation* _tmp10_;
		AdwTimedAnimation* _tmp11_;
		gdouble _tmp12_;
		gdouble _tmp13_;
		AdwTimedAnimation* _tmp14_;
		AdwTimedAnimation* _tmp15_;
		AdwTimedAnimation* _tmp16_;
		_tmp10_ = self->priv->progress_animation;
		_tmp11_ = self->priv->progress_animation;
		_tmp12_ = adw_animation_get_value ((AdwAnimation*) _tmp11_);
		_tmp13_ = _tmp12_;
		adw_timed_animation_set_value_from (_tmp10_, _tmp13_);
		_tmp14_ = self->priv->progress_animation;
		adw_timed_animation_set_value_to (_tmp14_, next_value);
		_tmp15_ = self->priv->progress_animation;
		adw_animation_reset ((AdwAnimation*) _tmp15_);
		_tmp16_ = self->priv->progress_animation;
		adw_animation_play ((AdwAnimation*) _tmp16_);
	}
}

static void
_vala_GskStroke_free (GskStroke* self)
{
	g_boxed_free (gsk_stroke_get_type (), self);
}

static void
dino_ui_file_transmission_progress_real_snapshot (GtkWidget* base,
                                                  GtkSnapshot* snapshot)
{
	DinoUiFileTransmissionProgress * self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	DinoUiFileTransmissionProgressState _tmp2_;
	self = (DinoUiFileTransmissionProgress*) base;
	g_return_if_fail (snapshot != NULL);
	GTK_WIDGET_CLASS (dino_ui_file_transmission_progress_parent_class)->snapshot ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_bin_get_type (), AdwBin), snapshot);
	_tmp2_ = self->priv->_state;
	if (_tmp2_ == DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOADING) {
		_tmp1_ = TRUE;
	} else {
		DinoUiFileTransmissionProgressState _tmp3_;
		_tmp3_ = self->priv->_state;
		_tmp1_ = _tmp3_ == DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UPLOADING;
	}
	if (_tmp1_) {
		AdwTimedAnimation* _tmp4_;
		gdouble _tmp5_;
		gdouble _tmp6_;
		_tmp4_ = self->priv->progress_animation;
		_tmp5_ = adw_animation_get_value ((AdwAnimation*) _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = _tmp6_ > 0.01;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gfloat radius = 0.0F;
		gfloat line_width = 0.0F;
		graphene_point_t _tmp7_ = {0};
		GdkRGBA fg_color = {0};
		GdkRGBA _tmp8_ = {0};
		GtkStyleContext* _tmp9_;
		GdkRGBA _tmp10_ = {0};
		GskPathBuilder* builder = NULL;
		GskPathBuilder* _tmp11_;
		GskPathBuilder* _tmp12_;
		graphene_point_t _tmp13_ = {0};
		GskPath* circle_path = NULL;
		GskPathBuilder* _tmp14_;
		GskPath* _tmp15_;
		GskStroke* stroke = NULL;
		GskStroke* _tmp16_;
		GskStroke* _tmp17_;
		GskPath* arc_path = NULL;
		GskPath* _tmp18_;
		AdwTimedAnimation* _tmp19_;
		gdouble _tmp20_;
		gdouble _tmp21_;
		GskPath* _tmp22_;
		GskPath* _tmp23_;
		GskStroke* _tmp24_;
		GdkRGBA _tmp25_;
		radius = MAX ((gfloat) (MIN (gtk_widget_get_width ((GtkWidget*) self), gtk_widget_get_height ((GtkWidget*) self)) / 2), (gfloat) 1);
		line_width = (gfloat) DINO_UI_FILE_TRANSMISSION_PROGRESS_LINE_WIDTH;
		_tmp7_.x = (gfloat) (gtk_widget_get_width ((GtkWidget*) self) / 2);
		_tmp7_.y = (gfloat) (gtk_widget_get_height ((GtkWidget*) self) / 2);
		gtk_snapshot_translate (snapshot, &_tmp7_);
		gtk_widget_get_color ((GtkWidget*) self, &_tmp8_);
		fg_color = _tmp8_;
		_tmp9_ = gtk_widget_get_style_context ((GtkWidget*) self);
		gtk_style_context_lookup_color (_tmp9_, "accent_color", &_tmp10_);
		fg_color = _tmp10_;
		_tmp11_ = gsk_path_builder_new ();
		builder = _tmp11_;
		_tmp12_ = builder;
		_tmp13_.x = (gfloat) 0;
		_tmp13_.y = (gfloat) 0;
		gsk_path_builder_add_circle (_tmp12_, &_tmp13_, radius - (line_width / 2));
		_tmp14_ = builder;
		_tmp15_ = gsk_path_builder_to_path (_tmp14_);
		circle_path = _tmp15_;
		_tmp16_ = gsk_stroke_new (line_width);
		stroke = _tmp16_;
		_tmp17_ = stroke;
		gsk_stroke_set_line_cap (_tmp17_, GSK_LINE_CAP_ROUND);
		_tmp18_ = circle_path;
		_tmp19_ = self->priv->progress_animation;
		_tmp20_ = adw_animation_get_value ((AdwAnimation*) _tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = dino_ui_file_transmission_progress_create_progress_arc (_tmp18_, (gfloat) _tmp21_);
		arc_path = _tmp22_;
		_tmp23_ = arc_path;
		_tmp24_ = stroke;
		_tmp25_ = fg_color;
		gtk_snapshot_append_stroke (snapshot, _tmp23_, _tmp24_, &_tmp25_);
		_gsk_path_unref0 (arc_path);
		__vala_GskStroke_free0 (stroke);
		_gsk_path_unref0 (circle_path);
		_gsk_path_builder_unref0 (builder);
	}
}

static void
dino_ui_file_transmission_progress_on_button_clicked (DinoUiFileTransmissionProgress* self)
{
	DinoUiFileTransmissionProgressState _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_state;
	switch (_tmp0_) {
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UNKNOWN_SOURCE:
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UPLOAD_FAILED:
		{
			break;
		}
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOAD_NOT_STARTED_FAILED_BEFORE:
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOAD_NOT_STARTED:
		{
			gtk_widget_activate_action ((GtkWidget*) self, "file.download", NULL, NULL);
			break;
		}
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_DOWNLOADING:
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_UPLOADING:
		{
			gtk_widget_activate_action ((GtkWidget*) self, "file.cancel", NULL, NULL);
			break;
		}
		default:
		break;
	}
}

static void
dino_ui_file_transmission_progress_real_dispose (GObject* base)
{
	DinoUiFileTransmissionProgress * self;
	self = (DinoUiFileTransmissionProgress*) base;
	_g_object_unref0 (self->priv->progress_animation);
	self->priv->progress_animation = NULL;
	G_OBJECT_CLASS (dino_ui_file_transmission_progress_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_bin_get_type (), AdwBin));
}

DinoUiFileTransmissionProgress*
dino_ui_file_transmission_progress_construct (GType object_type)
{
	DinoUiFileTransmissionProgress * self = NULL;
	self = (DinoUiFileTransmissionProgress*) g_object_new (object_type, NULL);
	return self;
}

DinoUiFileTransmissionProgress*
dino_ui_file_transmission_progress_new (void)
{
	return dino_ui_file_transmission_progress_construct (DINO_UI_TYPE_FILE_TRANSMISSION_PROGRESS);
}

gint64
dino_ui_file_transmission_progress_get_file_size (DinoUiFileTransmissionProgress* self)
{
	gint64 result;
	g_return_val_if_fail (self != NULL, -1LL);
	result = self->priv->_file_size;
	return result;
}

void
dino_ui_file_transmission_progress_set_file_size (DinoUiFileTransmissionProgress* self,
                                                  gint64 value)
{
	gint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_ui_file_transmission_progress_get_file_size (self);
	if (old_value != value) {
		self->priv->_file_size = value;
		g_object_notify_by_pspec ((GObject *) self, dino_ui_file_transmission_progress_properties[DINO_UI_FILE_TRANSMISSION_PROGRESS_FILE_SIZE_PROPERTY]);
	}
}

gint64
dino_ui_file_transmission_progress_get_transferred_size (DinoUiFileTransmissionProgress* self)
{
	gint64 result;
	g_return_val_if_fail (self != NULL, -1LL);
	result = self->priv->_transferred_size;
	return result;
}

void
dino_ui_file_transmission_progress_set_transferred_size (DinoUiFileTransmissionProgress* self,
                                                         gint64 value)
{
	gint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_ui_file_transmission_progress_get_transferred_size (self);
	if (old_value != value) {
		self->priv->_transferred_size = value;
		g_object_notify_by_pspec ((GObject *) self, dino_ui_file_transmission_progress_properties[DINO_UI_FILE_TRANSMISSION_PROGRESS_TRANSFERRED_SIZE_PROPERTY]);
	}
}

DinoUiFileTransmissionProgressState
dino_ui_file_transmission_progress_get_state (DinoUiFileTransmissionProgress* self)
{
	DinoUiFileTransmissionProgressState result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_state;
	return result;
}

void
dino_ui_file_transmission_progress_set_state (DinoUiFileTransmissionProgress* self,
                                              DinoUiFileTransmissionProgressState value)
{
	DinoUiFileTransmissionProgressState old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_ui_file_transmission_progress_get_state (self);
	if (old_value != value) {
		self->priv->_state = value;
		g_object_notify_by_pspec ((GObject *) self, dino_ui_file_transmission_progress_properties[DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_PROPERTY]);
	}
}

static void
_dino_ui_file_transmission_progress_on_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                          gpointer self)
{
	dino_ui_file_transmission_progress_on_button_clicked ((DinoUiFileTransmissionProgress*) self);
}

static void
_dino_ui_file_transmission_progress_update_progress_g_object_notify (GObject* _sender,
                                                                     GParamSpec* pspec,
                                                                     gpointer self)
{
	dino_ui_file_transmission_progress_update_progress ((DinoUiFileTransmissionProgress*) self);
}

static void
_dino_ui_file_transmission_progress_on_state_changed_g_object_notify (GObject* _sender,
                                                                      GParamSpec* pspec,
                                                                      gpointer self)
{
	dino_ui_file_transmission_progress_on_state_changed ((DinoUiFileTransmissionProgress*) self);
}

static GObject *
dino_ui_file_transmission_progress_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DinoUiFileTransmissionProgress * self;
	GtkButton* _tmp0_;
	GtkButton* _tmp1_;
	GtkButton* _tmp2_;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	GtkButton* _tmp5_;
	GtkButton* _tmp6_;
	parent_class = G_OBJECT_CLASS (dino_ui_file_transmission_progress_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_FILE_TRANSMISSION_PROGRESS, DinoUiFileTransmissionProgress);
	gtk_widget_add_css_class ((GtkWidget*) self, "circular-osd");
	_tmp0_ = self->priv->button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp0_, "circular");
	_tmp1_ = self->priv->button;
	_tmp2_ = self->priv->button;
	_tmp3_ = self->priv->button;
	_tmp4_ = self->priv->button;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp4_, DINO_UI_FILE_TRANSMISSION_PROGRESS_LINE_WIDTH);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp3_, DINO_UI_FILE_TRANSMISSION_PROGRESS_LINE_WIDTH);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp2_, DINO_UI_FILE_TRANSMISSION_PROGRESS_LINE_WIDTH);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp1_, DINO_UI_FILE_TRANSMISSION_PROGRESS_LINE_WIDTH);
	_tmp5_ = self->priv->button;
	adw_bin_set_child ((AdwBin*) self, (GtkWidget*) _tmp5_);
	_tmp6_ = self->priv->button;
	g_signal_connect_object (_tmp6_, "clicked", (GCallback) _dino_ui_file_transmission_progress_on_button_clicked_gtk_button_clicked, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::transferred-size", (GCallback) _dino_ui_file_transmission_progress_update_progress_g_object_notify, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::state", (GCallback) _dino_ui_file_transmission_progress_on_state_changed_g_object_notify, self, 0);
	dino_ui_file_transmission_progress_on_state_changed (self);
	dino_ui_file_transmission_progress_setup_animation (self);
	return obj;
}

static void
dino_ui_file_transmission_progress_class_init (DinoUiFileTransmissionProgressClass * klass,
                                               gpointer klass_data)
{
	dino_ui_file_transmission_progress_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoUiFileTransmissionProgress_private_offset);
	((GtkWidgetClass *) klass)->snapshot = (void (*) (GtkWidget*, GtkSnapshot*)) dino_ui_file_transmission_progress_real_snapshot;
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) dino_ui_file_transmission_progress_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_ui_file_transmission_progress_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dino_ui_file_transmission_progress_set_property;
	G_OBJECT_CLASS (klass)->constructor = dino_ui_file_transmission_progress_constructor;
	G_OBJECT_CLASS (klass)->finalize = dino_ui_file_transmission_progress_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_FILE_TRANSMISSION_PROGRESS_FILE_SIZE_PROPERTY, dino_ui_file_transmission_progress_properties[DINO_UI_FILE_TRANSMISSION_PROGRESS_FILE_SIZE_PROPERTY] = g_param_spec_int64 ("file-size", "file-size", "file-size", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_FILE_TRANSMISSION_PROGRESS_TRANSFERRED_SIZE_PROPERTY, dino_ui_file_transmission_progress_properties[DINO_UI_FILE_TRANSMISSION_PROGRESS_TRANSFERRED_SIZE_PROPERTY] = g_param_spec_int64 ("transferred-size", "transferred-size", "transferred-size", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_PROPERTY, dino_ui_file_transmission_progress_properties[DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_PROPERTY] = g_param_spec_enum ("state", "state", "state", DINO_UI_FILE_TRANSMISSION_PROGRESS_TYPE_STATE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
dino_ui_file_transmission_progress_instance_init (DinoUiFileTransmissionProgress * self,
                                                  gpointer klass)
{
	GtkButton* _tmp0_;
	self->priv = dino_ui_file_transmission_progress_get_instance_private (self);
	_tmp0_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp0_);
	self->priv->button = _tmp0_;
}

static void
dino_ui_file_transmission_progress_finalize (GObject * obj)
{
	DinoUiFileTransmissionProgress * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_FILE_TRANSMISSION_PROGRESS, DinoUiFileTransmissionProgress);
	_g_object_unref0 (self->priv->button);
	_g_object_unref0 (self->priv->progress_animation);
	G_OBJECT_CLASS (dino_ui_file_transmission_progress_parent_class)->finalize (obj);
}

static GType
dino_ui_file_transmission_progress_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiFileTransmissionProgressClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_file_transmission_progress_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiFileTransmissionProgress), 0, (GInstanceInitFunc) dino_ui_file_transmission_progress_instance_init, NULL };
	GType dino_ui_file_transmission_progress_type_id;
	dino_ui_file_transmission_progress_type_id = g_type_register_static (adw_bin_get_type (), "DinoUiFileTransmissionProgress", &g_define_type_info, 0);
	DinoUiFileTransmissionProgress_private_offset = g_type_add_instance_private (dino_ui_file_transmission_progress_type_id, sizeof (DinoUiFileTransmissionProgressPrivate));
	return dino_ui_file_transmission_progress_type_id;
}

GType
dino_ui_file_transmission_progress_get_type (void)
{
	static volatile gsize dino_ui_file_transmission_progress_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_file_transmission_progress_type_id__once)) {
		GType dino_ui_file_transmission_progress_type_id;
		dino_ui_file_transmission_progress_type_id = dino_ui_file_transmission_progress_get_type_once ();
		g_once_init_leave (&dino_ui_file_transmission_progress_type_id__once, dino_ui_file_transmission_progress_type_id);
	}
	return dino_ui_file_transmission_progress_type_id__once;
}

static void
_vala_dino_ui_file_transmission_progress_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec)
{
	DinoUiFileTransmissionProgress * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_FILE_TRANSMISSION_PROGRESS, DinoUiFileTransmissionProgress);
	switch (property_id) {
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_FILE_SIZE_PROPERTY:
		g_value_set_int64 (value, dino_ui_file_transmission_progress_get_file_size (self));
		break;
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_TRANSFERRED_SIZE_PROPERTY:
		g_value_set_int64 (value, dino_ui_file_transmission_progress_get_transferred_size (self));
		break;
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_PROPERTY:
		g_value_set_enum (value, dino_ui_file_transmission_progress_get_state (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dino_ui_file_transmission_progress_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec)
{
	DinoUiFileTransmissionProgress * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_FILE_TRANSMISSION_PROGRESS, DinoUiFileTransmissionProgress);
	switch (property_id) {
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_FILE_SIZE_PROPERTY:
		dino_ui_file_transmission_progress_set_file_size (self, g_value_get_int64 (value));
		break;
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_TRANSFERRED_SIZE_PROPERTY:
		dino_ui_file_transmission_progress_set_transferred_size (self, g_value_get_int64 (value));
		break;
		case DINO_UI_FILE_TRANSMISSION_PROGRESS_STATE_PROPERTY:
		dino_ui_file_transmission_progress_set_state (self, g_value_get_enum (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

