/* circular-progress-bar.c generated by valac 0.56.19, the Vala compiler
 * generated from circular-progress-bar.vala, do not modify */

#include "protonplus_core.h"
#include <glib.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <cairo-gobject.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <glib-object.h>
#include <pango/pango.h>
#include <pango/pangocairo.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

enum  {
	PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_0_PROPERTY,
	PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILLED_PROPERTY,
	PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILLED_PROPERTY,
	PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_SHOW_TEXT_PROPERTY,
	PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_FONT_PROPERTY,
	PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_CAP_PROPERTY,
	PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILL_COLOR_PROPERTY,
	PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILL_COLOR_PROPERTY,
	PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_PROGRESS_FILL_COLOR_PROPERTY,
	PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_WIDTH_PROPERTY,
	PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_FRACTION_PROPERTY,
	PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_NUM_PROPERTIES
};
static GParamSpec* proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define __vala_PangoFontDescription_free0(var) ((var == NULL) ? NULL : (var = (_vala_PangoFontDescription_free (var), NULL)))

struct _ProtonPlusWidgetsCircularProgressBarPrivate {
	gint _line_width;
	gdouble _fraction;
	gdouble _pulse_offset;
	gboolean _is_pulsing;
	gboolean _center_filled;
	gboolean _radius_filled;
	gboolean _show_text;
	gchar* _font;
	cairo_line_cap_t _line_cap;
	gchar* _center_fill_color;
	gchar* _radius_fill_color;
	gchar* _progress_fill_color;
};

static gint ProtonPlusWidgetsCircularProgressBar_private_offset;
static gpointer proton_plus_widgets_circular_progress_bar_parent_class = NULL;

static void proton_plus_widgets_circular_progress_bar_get_color_from_string (ProtonPlusWidgetsCircularProgressBar* self,
                                                                      const gchar* str,
                                                                      const gchar* fallback,
                                                                      GdkRGBA* result);
static void _proton_plus_widgets_circular_progress_bar_draw_gtk_drawing_area_draw_func (GtkDrawingArea* drawing_area,
                                                                                 cairo_t* cr,
                                                                                 gint width,
                                                                                 gint height,
                                                                                 gpointer self);
static void __lambda42_ (ProtonPlusWidgetsCircularProgressBar* self);
static void ___lambda42__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
static GtkSizeRequestMode proton_plus_widgets_circular_progress_bar_real_get_request_mode (GtkWidget* base);
static void _vala_PangoFontDescription_free (PangoFontDescription* self);
static GObject * proton_plus_widgets_circular_progress_bar_constructor (GType type,
                                                                 guint n_construct_properties,
                                                                 GObjectConstructParam * construct_properties);
static void proton_plus_widgets_circular_progress_bar_finalize (GObject * obj);
static GType proton_plus_widgets_circular_progress_bar_get_type_once (void);
static void _vala_proton_plus_widgets_circular_progress_bar_get_property (GObject * object,
                                                                   guint property_id,
                                                                   GValue * value,
                                                                   GParamSpec * pspec);
static void _vala_proton_plus_widgets_circular_progress_bar_set_property (GObject * object,
                                                                   guint property_id,
                                                                   const GValue * value,
                                                                   GParamSpec * pspec);

static inline gpointer
proton_plus_widgets_circular_progress_bar_get_instance_private (ProtonPlusWidgetsCircularProgressBar* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusWidgetsCircularProgressBar_private_offset);
}

void
proton_plus_widgets_circular_progress_bar_pulse (ProtonPlusWidgetsCircularProgressBar* self,
                                                 gdouble offset)
{
	g_return_if_fail (self != NULL);
	self->priv->_is_pulsing = TRUE;
	self->priv->_pulse_offset = self->priv->_pulse_offset + offset;
	if (self->priv->_pulse_offset > 2.0) {
		self->priv->_pulse_offset = self->priv->_pulse_offset - 2.0;
	}
	gtk_widget_queue_draw ((GtkWidget*) self);
}

static void
proton_plus_widgets_circular_progress_bar_get_color_from_string (ProtonPlusWidgetsCircularProgressBar* self,
                                                                 const gchar* str,
                                                                 const gchar* fallback,
                                                                 GdkRGBA* result)
{
	GdkRGBA color = {0};
	g_return_if_fail (self != NULL);
	g_return_if_fail (str != NULL);
	memset (&color, 0, sizeof (GdkRGBA));
	if (gdk_rgba_parse (&color, str)) {
		*result = color;
		return;
	}
	if (g_strcmp0 (str, "suggested_action_bg_color") == 0) {
		gdk_rgba_parse (&color, "#3584e4");
		*result = color;
		return;
	}
	if (fallback != NULL) {
		gdk_rgba_parse (&color, fallback);
	}
	*result = color;
	return;
}

static void
_proton_plus_widgets_circular_progress_bar_draw_gtk_drawing_area_draw_func (GtkDrawingArea* drawing_area,
                                                                            cairo_t* cr,
                                                                            gint width,
                                                                            gint height,
                                                                            gpointer self)
{
	proton_plus_widgets_circular_progress_bar_draw ((ProtonPlusWidgetsCircularProgressBar*) self, drawing_area, cr, width, height);
}

static void
__lambda42_ (ProtonPlusWidgetsCircularProgressBar* self)
{
	gtk_widget_queue_draw ((GtkWidget*) self);
}

static void
___lambda42__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	__lambda42_ ((ProtonPlusWidgetsCircularProgressBar*) self);
}

ProtonPlusWidgetsCircularProgressBar*
proton_plus_widgets_circular_progress_bar_construct (GType object_type)
{
	ProtonPlusWidgetsCircularProgressBar * self = NULL;
	self = (ProtonPlusWidgetsCircularProgressBar*) g_object_new (object_type, NULL);
	gtk_drawing_area_set_draw_func ((GtkDrawingArea*) self, _proton_plus_widgets_circular_progress_bar_draw_gtk_drawing_area_draw_func, g_object_ref (self), g_object_unref);
	g_signal_connect_object ((GObject*) self, "notify", (GCallback) ___lambda42__g_object_notify, self, 0);
	return self;
}

ProtonPlusWidgetsCircularProgressBar*
proton_plus_widgets_circular_progress_bar_new (void)
{
	return proton_plus_widgets_circular_progress_bar_construct (PROTON_PLUS_WIDGETS_TYPE_CIRCULAR_PROGRESS_BAR);
}

static GtkSizeRequestMode
proton_plus_widgets_circular_progress_bar_real_get_request_mode (GtkWidget* base)
{
	ProtonPlusWidgetsCircularProgressBar * self;
	GtkSizeRequestMode result;
	self = (ProtonPlusWidgetsCircularProgressBar*) base;
	result = GTK_SIZE_REQUEST_CONSTANT_SIZE;
	return result;
}

static gchar*
double_to_string (gdouble self)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint _tmp1__length1;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* result;
	_tmp0_ = g_new0 (gchar, G_ASCII_DTOSTR_BUF_SIZE);
	_tmp1_ = _tmp0_;
	_tmp1__length1 = G_ASCII_DTOSTR_BUF_SIZE;
	_tmp2_ = g_ascii_dtostr (_tmp1_, (gint) G_ASCII_DTOSTR_BUF_SIZE, self);
	_tmp3_ = g_strdup (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp1_ = (g_free (_tmp1_), NULL);
	result = _tmp4_;
	return result;
}

static void
_vala_PangoFontDescription_free (PangoFontDescription* self)
{
	g_boxed_free (pango_font_description_get_type (), self);
}

void
proton_plus_widgets_circular_progress_bar_draw (ProtonPlusWidgetsCircularProgressBar* self,
                                                GtkDrawingArea* da,
                                                cairo_t* cr,
                                                gint width,
                                                gint height)
{
	gint w = 0;
	gint h = 0;
	gint delta = 0;
	GdkRGBA color = {0};
	PangoLayout* layout = NULL;
	PangoFontDescription* desc = NULL;
	gint center_x = 0;
	gint center_y = 0;
	gint radius = 0;
	gint _tmp0_;
	gint _tmp1_;
	cairo_line_cap_t _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp11_;
	gboolean _tmp29_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (da != NULL);
	g_return_if_fail (cr != NULL);
	cairo_save (cr);
	center_x = width / 2;
	center_y = height / 2;
	radius = MIN (width / 2, height / 2) - 1;
	_tmp0_ = proton_plus_widgets_circular_progress_bar_get_line_width (self);
	_tmp1_ = _tmp0_;
	if ((radius - _tmp1_) < 0) {
		delta = 0;
	} else {
		gint _tmp2_;
		gint _tmp3_;
		_tmp2_ = proton_plus_widgets_circular_progress_bar_get_line_width (self);
		_tmp3_ = _tmp2_;
		delta = radius - (_tmp3_ / 2);
	}
	_tmp4_ = self->priv->_line_cap;
	cairo_set_line_cap (cr, _tmp4_);
	_tmp5_ = proton_plus_widgets_circular_progress_bar_get_line_width (self);
	_tmp6_ = _tmp5_;
	cairo_set_line_width (cr, (gdouble) _tmp6_);
	_tmp7_ = self->priv->_center_filled;
	if (_tmp7_) {
		const gchar* _tmp8_;
		GdkRGBA _tmp9_ = {0};
		GdkRGBA _tmp10_;
		cairo_arc (cr, (gdouble) center_x, (gdouble) center_y, (gdouble) delta, (gdouble) 0, 2 * G_PI);
		_tmp8_ = self->priv->_center_fill_color;
		proton_plus_widgets_circular_progress_bar_get_color_from_string (self, _tmp8_, "rgba(0, 0, 0, 0)", &_tmp9_);
		color = _tmp9_;
		_tmp10_ = color;
		gdk_cairo_set_source_rgba (cr, &_tmp10_);
		cairo_fill (cr);
	}
	_tmp11_ = self->priv->_radius_filled;
	if (_tmp11_) {
		const gchar* _tmp12_;
		GdkRGBA _tmp13_ = {0};
		GdkRGBA _tmp14_;
		cairo_arc (cr, (gdouble) center_x, (gdouble) center_y, (gdouble) delta, (gdouble) 0, 2 * G_PI);
		_tmp12_ = self->priv->_radius_fill_color;
		proton_plus_widgets_circular_progress_bar_get_color_from_string (self, _tmp12_, "rgba(0, 0, 0, 0.1)", &_tmp13_);
		color = _tmp13_;
		_tmp14_ = color;
		gdk_cairo_set_source_rgba (cr, &_tmp14_);
		cairo_stroke (cr);
	}
	if (self->priv->_is_pulsing) {
		const gchar* _tmp15_;
		GdkRGBA _tmp16_ = {0};
		GdkRGBA _tmp17_;
		_tmp15_ = self->priv->_progress_fill_color;
		proton_plus_widgets_circular_progress_bar_get_color_from_string (self, _tmp15_, "#3584e4", &_tmp16_);
		color = _tmp16_;
		_tmp17_ = color;
		gdk_cairo_set_source_rgba (cr, &_tmp17_);
		cairo_arc (cr, (gdouble) center_x, (gdouble) center_y, (gdouble) delta, (1.5 + self->priv->_pulse_offset) * G_PI, ((1.5 + self->priv->_pulse_offset) + 0.5) * G_PI);
		cairo_stroke (cr);
	} else {
		gdouble _tmp18_;
		gdouble _tmp19_;
		_tmp18_ = proton_plus_widgets_circular_progress_bar_get_fraction (self);
		_tmp19_ = _tmp18_;
		if (_tmp19_ > ((gdouble) 0)) {
			const gchar* _tmp20_;
			GdkRGBA _tmp21_ = {0};
			GdkRGBA _tmp22_;
			gint _tmp23_;
			gint _tmp24_;
			_tmp20_ = self->priv->_progress_fill_color;
			proton_plus_widgets_circular_progress_bar_get_color_from_string (self, _tmp20_, "#3584e4", &_tmp21_);
			color = _tmp21_;
			_tmp22_ = color;
			gdk_cairo_set_source_rgba (cr, &_tmp22_);
			_tmp23_ = proton_plus_widgets_circular_progress_bar_get_line_width (self);
			_tmp24_ = _tmp23_;
			if (_tmp24_ == 0) {
				gdouble _tmp25_;
				gdouble _tmp26_;
				cairo_move_to (cr, (gdouble) center_x, (gdouble) center_y);
				_tmp25_ = proton_plus_widgets_circular_progress_bar_get_fraction (self);
				_tmp26_ = _tmp25_;
				cairo_arc (cr, (gdouble) center_x, (gdouble) center_y, (gdouble) (delta + 1), 1.5 * G_PI, (1.5 + (_tmp26_ * 2)) * G_PI);
				cairo_fill (cr);
			} else {
				gdouble _tmp27_;
				gdouble _tmp28_;
				_tmp27_ = proton_plus_widgets_circular_progress_bar_get_fraction (self);
				_tmp28_ = _tmp27_;
				cairo_arc (cr, (gdouble) center_x, (gdouble) center_y, (gdouble) delta, 1.5 * G_PI, (1.5 + (_tmp28_ * 2)) * G_PI);
				cairo_stroke (cr);
			}
		}
	}
	_tmp29_ = self->priv->_show_text;
	if (_tmp29_) {
		GdkRGBA _tmp30_ = {0};
		GdkRGBA _tmp31_;
		PangoLayout* _tmp32_;
		PangoLayout* _tmp33_;
		gdouble _tmp34_;
		gdouble _tmp35_;
		gchar* _tmp36_;
		gchar* _tmp37_;
		const gchar* _tmp38_;
		gchar* _tmp39_;
		gchar* _tmp40_;
		gchar* _tmp41_;
		gchar* _tmp42_;
		gchar* _tmp43_;
		gchar* _tmp44_;
		PangoFontDescription* _tmp45_;
		PangoLayout* _tmp46_;
		PangoFontDescription* _tmp47_;
		PangoLayout* _tmp48_;
		PangoLayout* _tmp49_;
		gint _tmp50_ = 0;
		gint _tmp51_ = 0;
		PangoLayout* _tmp52_;
		gtk_widget_get_color ((GtkWidget*) self, &_tmp30_);
		color = _tmp30_;
		_tmp31_ = color;
		gdk_cairo_set_source_rgba (cr, &_tmp31_);
		_tmp32_ = pango_cairo_create_layout (cr);
		_g_object_unref0 (layout);
		layout = _tmp32_;
		_tmp33_ = layout;
		_tmp34_ = proton_plus_widgets_circular_progress_bar_get_fraction (self);
		_tmp35_ = _tmp34_;
		_tmp36_ = g_strdup_printf ("%d", (gint) (_tmp35_ * 100.0));
		_tmp37_ = _tmp36_;
		pango_layout_set_text (_tmp33_, _tmp37_, -1);
		_g_free0 (_tmp37_);
		_tmp38_ = self->priv->_font;
		_tmp39_ = g_strconcat (_tmp38_, " ", NULL);
		_tmp40_ = _tmp39_;
		_tmp41_ = double_to_string (radius * 0.7);
		_tmp42_ = _tmp41_;
		_tmp43_ = g_strconcat (_tmp40_, _tmp42_, NULL);
		_tmp44_ = _tmp43_;
		_tmp45_ = pango_font_description_from_string (_tmp44_);
		__vala_PangoFontDescription_free0 (desc);
		desc = _tmp45_;
		_g_free0 (_tmp44_);
		_g_free0 (_tmp42_);
		_g_free0 (_tmp40_);
		_tmp46_ = layout;
		_tmp47_ = desc;
		pango_layout_set_font_description (_tmp46_, _tmp47_);
		_tmp48_ = layout;
		pango_cairo_update_layout (cr, _tmp48_);
		_tmp49_ = layout;
		pango_layout_get_size (_tmp49_, &_tmp50_, &_tmp51_);
		w = _tmp50_;
		h = _tmp51_;
		cairo_move_to (cr, (gdouble) (center_x - ((w / PANGO_SCALE) / 2)), (gdouble) (center_y - ((h / PANGO_SCALE) / 2)));
		_tmp52_ = layout;
		pango_cairo_show_layout (cr, _tmp52_);
	}
	cairo_restore (cr);
	__vala_PangoFontDescription_free0 (desc);
	_g_object_unref0 (layout);
}

gboolean
proton_plus_widgets_circular_progress_bar_get_center_filled (ProtonPlusWidgetsCircularProgressBar* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_center_filled;
	return result;
}

void
proton_plus_widgets_circular_progress_bar_set_center_filled (ProtonPlusWidgetsCircularProgressBar* self,
                                                             gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_widgets_circular_progress_bar_get_center_filled (self);
	if (old_value != value) {
		self->priv->_center_filled = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILLED_PROPERTY]);
	}
}

gboolean
proton_plus_widgets_circular_progress_bar_get_radius_filled (ProtonPlusWidgetsCircularProgressBar* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_radius_filled;
	return result;
}

void
proton_plus_widgets_circular_progress_bar_set_radius_filled (ProtonPlusWidgetsCircularProgressBar* self,
                                                             gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_widgets_circular_progress_bar_get_radius_filled (self);
	if (old_value != value) {
		self->priv->_radius_filled = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILLED_PROPERTY]);
	}
}

gboolean
proton_plus_widgets_circular_progress_bar_get_show_text (ProtonPlusWidgetsCircularProgressBar* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_show_text;
	return result;
}

void
proton_plus_widgets_circular_progress_bar_set_show_text (ProtonPlusWidgetsCircularProgressBar* self,
                                                         gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_widgets_circular_progress_bar_get_show_text (self);
	if (old_value != value) {
		self->priv->_show_text = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_SHOW_TEXT_PROPERTY]);
	}
}

const gchar*
proton_plus_widgets_circular_progress_bar_get_font (ProtonPlusWidgetsCircularProgressBar* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_font;
	result = _tmp0_;
	return result;
}

void
proton_plus_widgets_circular_progress_bar_set_font (ProtonPlusWidgetsCircularProgressBar* self,
                                                    const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_widgets_circular_progress_bar_get_font (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_font);
		self->priv->_font = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_FONT_PROPERTY]);
	}
}

cairo_line_cap_t
proton_plus_widgets_circular_progress_bar_get_line_cap (ProtonPlusWidgetsCircularProgressBar* self)
{
	cairo_line_cap_t result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_line_cap;
	return result;
}

void
proton_plus_widgets_circular_progress_bar_set_line_cap (ProtonPlusWidgetsCircularProgressBar* self,
                                                        cairo_line_cap_t value)
{
	cairo_line_cap_t old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_widgets_circular_progress_bar_get_line_cap (self);
	if (old_value != value) {
		self->priv->_line_cap = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_CAP_PROPERTY]);
	}
}

const gchar*
proton_plus_widgets_circular_progress_bar_get_center_fill_color (ProtonPlusWidgetsCircularProgressBar* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_center_fill_color;
	result = _tmp0_;
	return result;
}

void
proton_plus_widgets_circular_progress_bar_set_center_fill_color (ProtonPlusWidgetsCircularProgressBar* self,
                                                                 const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_widgets_circular_progress_bar_get_center_fill_color (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_center_fill_color);
		self->priv->_center_fill_color = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILL_COLOR_PROPERTY]);
	}
}

const gchar*
proton_plus_widgets_circular_progress_bar_get_radius_fill_color (ProtonPlusWidgetsCircularProgressBar* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_radius_fill_color;
	result = _tmp0_;
	return result;
}

void
proton_plus_widgets_circular_progress_bar_set_radius_fill_color (ProtonPlusWidgetsCircularProgressBar* self,
                                                                 const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_widgets_circular_progress_bar_get_radius_fill_color (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_radius_fill_color);
		self->priv->_radius_fill_color = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILL_COLOR_PROPERTY]);
	}
}

const gchar*
proton_plus_widgets_circular_progress_bar_get_progress_fill_color (ProtonPlusWidgetsCircularProgressBar* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_progress_fill_color;
	result = _tmp0_;
	return result;
}

void
proton_plus_widgets_circular_progress_bar_set_progress_fill_color (ProtonPlusWidgetsCircularProgressBar* self,
                                                                   const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_widgets_circular_progress_bar_get_progress_fill_color (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_progress_fill_color);
		self->priv->_progress_fill_color = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_PROGRESS_FILL_COLOR_PROPERTY]);
	}
}

gint
proton_plus_widgets_circular_progress_bar_get_line_width (ProtonPlusWidgetsCircularProgressBar* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_line_width;
	return result;
}

void
proton_plus_widgets_circular_progress_bar_set_line_width (ProtonPlusWidgetsCircularProgressBar* self,
                                                          gint value)
{
	g_return_if_fail (self != NULL);
	if (value < 0) {
		self->priv->_line_width = 0;
	} else {
		self->priv->_line_width = value;
	}
	g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_WIDTH_PROPERTY]);
}

gdouble
proton_plus_widgets_circular_progress_bar_get_fraction (ProtonPlusWidgetsCircularProgressBar* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_fraction;
	return result;
}

void
proton_plus_widgets_circular_progress_bar_set_fraction (ProtonPlusWidgetsCircularProgressBar* self,
                                                        gdouble value)
{
	g_return_if_fail (self != NULL);
	self->priv->_is_pulsing = FALSE;
	if (value > 1.0) {
		self->priv->_fraction = 1.0;
	} else {
		if (value < 0.0) {
			self->priv->_fraction = 0.0;
		} else {
			self->priv->_fraction = value;
		}
	}
	g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_FRACTION_PROPERTY]);
}

static GObject *
proton_plus_widgets_circular_progress_bar_constructor (GType type,
                                                       guint n_construct_properties,
                                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ProtonPlusWidgetsCircularProgressBar * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	parent_class = G_OBJECT_CLASS (proton_plus_widgets_circular_progress_bar_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_TYPE_CIRCULAR_PROGRESS_BAR, ProtonPlusWidgetsCircularProgressBar);
	self->priv->_line_width = 4;
	self->priv->_fraction = (gdouble) 0;
	_tmp0_ = g_strdup ("rgba(0, 0, 0, 0)");
	_g_free0 (self->priv->_center_fill_color);
	self->priv->_center_fill_color = _tmp0_;
	_tmp1_ = g_strdup ("rgba(0, 0, 0, 0.1)");
	_g_free0 (self->priv->_radius_fill_color);
	self->priv->_radius_fill_color = _tmp1_;
	_tmp2_ = g_strdup ("suggested_action_bg_color");
	_g_free0 (self->priv->_progress_fill_color);
	self->priv->_progress_fill_color = _tmp2_;
	return obj;
}

static void
proton_plus_widgets_circular_progress_bar_class_init (ProtonPlusWidgetsCircularProgressBarClass * klass,
                                                      gpointer klass_data)
{
	proton_plus_widgets_circular_progress_bar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusWidgetsCircularProgressBar_private_offset);
	((GtkWidgetClass *) klass)->get_request_mode = (GtkSizeRequestMode (*) (GtkWidget*)) proton_plus_widgets_circular_progress_bar_real_get_request_mode;
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_widgets_circular_progress_bar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_widgets_circular_progress_bar_set_property;
	G_OBJECT_CLASS (klass)->constructor = proton_plus_widgets_circular_progress_bar_constructor;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_widgets_circular_progress_bar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILLED_PROPERTY, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILLED_PROPERTY] = g_param_spec_boolean ("center-filled", "center-filled", "center-filled", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILLED_PROPERTY, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILLED_PROPERTY] = g_param_spec_boolean ("radius-filled", "radius-filled", "radius-filled", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_SHOW_TEXT_PROPERTY, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_SHOW_TEXT_PROPERTY] = g_param_spec_boolean ("show-text", "show-text", "show-text", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_FONT_PROPERTY, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_FONT_PROPERTY] = g_param_spec_string ("font", "font", "font", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_CAP_PROPERTY, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_CAP_PROPERTY] = g_param_spec_enum ("line-cap", "line-cap", "line-cap", cairo_gobject_line_cap_get_type (), CAIRO_LINE_CAP_ROUND, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILL_COLOR_PROPERTY, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILL_COLOR_PROPERTY] = g_param_spec_string ("center-fill-color", "center-fill-color", "center-fill-color", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILL_COLOR_PROPERTY, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILL_COLOR_PROPERTY] = g_param_spec_string ("radius-fill-color", "radius-fill-color", "radius-fill-color", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_PROGRESS_FILL_COLOR_PROPERTY, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_PROGRESS_FILL_COLOR_PROPERTY] = g_param_spec_string ("progress-fill-color", "progress-fill-color", "progress-fill-color", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_WIDTH_PROPERTY, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_WIDTH_PROPERTY] = g_param_spec_int ("line-width", "line-width", "line-width", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_FRACTION_PROPERTY, proton_plus_widgets_circular_progress_bar_properties[PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_FRACTION_PROPERTY] = g_param_spec_double ("fraction", "fraction", "fraction", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
proton_plus_widgets_circular_progress_bar_instance_init (ProtonPlusWidgetsCircularProgressBar * self,
                                                         gpointer klass)
{
	gchar* _tmp0_;
	self->priv = proton_plus_widgets_circular_progress_bar_get_instance_private (self);
	self->priv->_pulse_offset = (gdouble) 0;
	self->priv->_is_pulsing = FALSE;
	self->priv->_center_filled = FALSE;
	self->priv->_radius_filled = TRUE;
	self->priv->_show_text = FALSE;
	_tmp0_ = g_strdup ("Sans");
	self->priv->_font = _tmp0_;
	self->priv->_line_cap = CAIRO_LINE_CAP_ROUND;
}

static void
proton_plus_widgets_circular_progress_bar_finalize (GObject * obj)
{
	ProtonPlusWidgetsCircularProgressBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_TYPE_CIRCULAR_PROGRESS_BAR, ProtonPlusWidgetsCircularProgressBar);
	_g_free0 (self->priv->_font);
	_g_free0 (self->priv->_center_fill_color);
	_g_free0 (self->priv->_radius_fill_color);
	_g_free0 (self->priv->_progress_fill_color);
	G_OBJECT_CLASS (proton_plus_widgets_circular_progress_bar_parent_class)->finalize (obj);
}

static GType
proton_plus_widgets_circular_progress_bar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusWidgetsCircularProgressBarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_widgets_circular_progress_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusWidgetsCircularProgressBar), 0, (GInstanceInitFunc) proton_plus_widgets_circular_progress_bar_instance_init, NULL };
	GType proton_plus_widgets_circular_progress_bar_type_id;
	proton_plus_widgets_circular_progress_bar_type_id = g_type_register_static (gtk_drawing_area_get_type (), "ProtonPlusWidgetsCircularProgressBar", &g_define_type_info, 0);
	ProtonPlusWidgetsCircularProgressBar_private_offset = g_type_add_instance_private (proton_plus_widgets_circular_progress_bar_type_id, sizeof (ProtonPlusWidgetsCircularProgressBarPrivate));
	return proton_plus_widgets_circular_progress_bar_type_id;
}

GType
proton_plus_widgets_circular_progress_bar_get_type (void)
{
	static volatile gsize proton_plus_widgets_circular_progress_bar_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_widgets_circular_progress_bar_type_id__once)) {
		GType proton_plus_widgets_circular_progress_bar_type_id;
		proton_plus_widgets_circular_progress_bar_type_id = proton_plus_widgets_circular_progress_bar_get_type_once ();
		g_once_init_leave (&proton_plus_widgets_circular_progress_bar_type_id__once, proton_plus_widgets_circular_progress_bar_type_id);
	}
	return proton_plus_widgets_circular_progress_bar_type_id__once;
}

static void
_vala_proton_plus_widgets_circular_progress_bar_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec)
{
	ProtonPlusWidgetsCircularProgressBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_WIDGETS_TYPE_CIRCULAR_PROGRESS_BAR, ProtonPlusWidgetsCircularProgressBar);
	switch (property_id) {
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILLED_PROPERTY:
		g_value_set_boolean (value, proton_plus_widgets_circular_progress_bar_get_center_filled (self));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILLED_PROPERTY:
		g_value_set_boolean (value, proton_plus_widgets_circular_progress_bar_get_radius_filled (self));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_SHOW_TEXT_PROPERTY:
		g_value_set_boolean (value, proton_plus_widgets_circular_progress_bar_get_show_text (self));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_FONT_PROPERTY:
		g_value_set_string (value, proton_plus_widgets_circular_progress_bar_get_font (self));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_CAP_PROPERTY:
		g_value_set_enum (value, proton_plus_widgets_circular_progress_bar_get_line_cap (self));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILL_COLOR_PROPERTY:
		g_value_set_string (value, proton_plus_widgets_circular_progress_bar_get_center_fill_color (self));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILL_COLOR_PROPERTY:
		g_value_set_string (value, proton_plus_widgets_circular_progress_bar_get_radius_fill_color (self));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_PROGRESS_FILL_COLOR_PROPERTY:
		g_value_set_string (value, proton_plus_widgets_circular_progress_bar_get_progress_fill_color (self));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_WIDTH_PROPERTY:
		g_value_set_int (value, proton_plus_widgets_circular_progress_bar_get_line_width (self));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_FRACTION_PROPERTY:
		g_value_set_double (value, proton_plus_widgets_circular_progress_bar_get_fraction (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_widgets_circular_progress_bar_set_property (GObject * object,
                                                              guint property_id,
                                                              const GValue * value,
                                                              GParamSpec * pspec)
{
	ProtonPlusWidgetsCircularProgressBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_WIDGETS_TYPE_CIRCULAR_PROGRESS_BAR, ProtonPlusWidgetsCircularProgressBar);
	switch (property_id) {
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILLED_PROPERTY:
		proton_plus_widgets_circular_progress_bar_set_center_filled (self, g_value_get_boolean (value));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILLED_PROPERTY:
		proton_plus_widgets_circular_progress_bar_set_radius_filled (self, g_value_get_boolean (value));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_SHOW_TEXT_PROPERTY:
		proton_plus_widgets_circular_progress_bar_set_show_text (self, g_value_get_boolean (value));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_FONT_PROPERTY:
		proton_plus_widgets_circular_progress_bar_set_font (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_CAP_PROPERTY:
		proton_plus_widgets_circular_progress_bar_set_line_cap (self, g_value_get_enum (value));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILL_COLOR_PROPERTY:
		proton_plus_widgets_circular_progress_bar_set_center_fill_color (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILL_COLOR_PROPERTY:
		proton_plus_widgets_circular_progress_bar_set_radius_fill_color (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_PROGRESS_FILL_COLOR_PROPERTY:
		proton_plus_widgets_circular_progress_bar_set_progress_fill_color (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_WIDTH_PROPERTY:
		proton_plus_widgets_circular_progress_bar_set_line_width (self, g_value_get_int (value));
		break;
		case PROTON_PLUS_WIDGETS_CIRCULAR_PROGRESS_BAR_FRACTION_PROPERTY:
		proton_plus_widgets_circular_progress_bar_set_fraction (self, g_value_get_double (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

