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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include "planify.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 <glib-object.h>
#include <gdk/gdk.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  {
	WIDGETS_CIRCULAR_PROGRESS_BAR_0_PROPERTY,
	WIDGETS_CIRCULAR_PROGRESS_BAR_SIZE_PROPERTY,
	WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILLED_PROPERTY,
	WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILLED_PROPERTY,
	WIDGETS_CIRCULAR_PROGRESS_BAR_THICK_STYLE_PROPERTY,
	WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_CAP_PROPERTY,
	WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILL_COLOR_PROPERTY,
	WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILL_COLOR_PROPERTY,
	WIDGETS_CIRCULAR_PROGRESS_BAR_PROGRESS_FILL_COLOR_PROPERTY,
	WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_WIDTH_PROPERTY,
	WIDGETS_CIRCULAR_PROGRESS_BAR_GAP_PROPERTY,
	WIDGETS_CIRCULAR_PROGRESS_BAR_BORDER_WIDTH_PROPERTY,
	WIDGETS_CIRCULAR_PROGRESS_BAR_PERCENTAGE_PROPERTY,
	WIDGETS_CIRCULAR_PROGRESS_BAR_COLOR_PROPERTY,
	WIDGETS_CIRCULAR_PROGRESS_BAR_NUM_PROPERTIES
};
static GParamSpec* widgets_circular_progress_bar_properties[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)))

struct _WidgetsCircularProgressBarPrivate {
	gint _size;
	gint _line_width;
	gdouble _percentage;
	gdouble _animated_percentage;
	gchar* _center_fill_color;
	gchar* _radius_fill_color;
	gchar* _progress_fill_color;
	gchar* _border_color;
	gint _border_width;
	gint _gap;
	guint animation_timeout_id;
	gdouble animation_start_value;
	gdouble animation_target_value;
	gint64 animation_start_time;
	guint success_animation_id;
	gdouble success_squeeze;
	gint64 success_start_time;
	gboolean _center_filled;
	gboolean _radius_filled;
	gboolean _thick_style;
	cairo_line_cap_t _line_cap;
};

static gint WidgetsCircularProgressBar_private_offset;
static gpointer widgets_circular_progress_bar_parent_class = NULL;

static void _widgets_circular_progress_bar_draw_gtk_drawing_area_draw_func (GtkDrawingArea* drawing_area,
                                                                     cairo_t* cr,
                                                                     gint width,
                                                                     gint height,
                                                                     gpointer self);
static void __lambda104_ (WidgetsCircularProgressBar* self);
static void ___lambda104__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static gint widgets_circular_progress_bar_calculate_radius (WidgetsCircularProgressBar* self);
static void widgets_circular_progress_bar_animate_to_percentage (WidgetsCircularProgressBar* self,
                                                          gdouble target);
static gboolean __lambda105_ (WidgetsCircularProgressBar* self);
static void widgets_circular_progress_bar_start_success_animation (WidgetsCircularProgressBar* self);
static gboolean ___lambda105__gsource_func (gpointer self);
static gboolean __lambda106_ (WidgetsCircularProgressBar* self);
static gboolean ___lambda106__gsource_func (gpointer self);
static GtkSizeRequestMode widgets_circular_progress_bar_real_get_request_mode (GtkWidget* base);
static GObject * widgets_circular_progress_bar_constructor (GType type,
                                                     guint n_construct_properties,
                                                     GObjectConstructParam * construct_properties);
static void widgets_circular_progress_bar_finalize (GObject * obj);
static GType widgets_circular_progress_bar_get_type_once (void);
static void _vala_widgets_circular_progress_bar_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec);
static void _vala_widgets_circular_progress_bar_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
widgets_circular_progress_bar_get_instance_private (WidgetsCircularProgressBar* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsCircularProgressBar_private_offset);
}

static void
_widgets_circular_progress_bar_draw_gtk_drawing_area_draw_func (GtkDrawingArea* drawing_area,
                                                                cairo_t* cr,
                                                                gint width,
                                                                gint height,
                                                                gpointer self)
{
	widgets_circular_progress_bar_draw ((WidgetsCircularProgressBar*) self, drawing_area, cr, width, height);
}

static void
__lambda104_ (WidgetsCircularProgressBar* self)
{
	gtk_widget_queue_draw ((GtkWidget*) self);
}

static void
___lambda104__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda104_ ((WidgetsCircularProgressBar*) self);
}

WidgetsCircularProgressBar*
widgets_circular_progress_bar_construct (GType object_type,
                                         gint size)
{
	WidgetsCircularProgressBar * self = NULL;
	self = (WidgetsCircularProgressBar*) g_object_new (object_type, "size", size, "height-request", size, "width-request", size, "halign", GTK_ALIGN_CENTER, "valign", GTK_ALIGN_CENTER, NULL);
	gtk_drawing_area_set_draw_func ((GtkDrawingArea*) self, _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) ___lambda104__g_object_notify, self, 0);
	return self;
}

WidgetsCircularProgressBar*
widgets_circular_progress_bar_new (gint size)
{
	return widgets_circular_progress_bar_construct (WIDGETS_TYPE_CIRCULAR_PROGRESS_BAR, size);
}

static gint
widgets_circular_progress_bar_calculate_radius (WidgetsCircularProgressBar* self)
{
	gint base_size = 0;
	gint _tmp0_;
	gint _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = self->priv->_size;
	_tmp1_ = self->priv->_size;
	base_size = MIN (_tmp0_, _tmp1_);
	result = (((base_size / 2) - self->priv->_border_width) - self->priv->_gap) - 1;
	return result;
}

static gboolean
__lambda105_ (WidgetsCircularProgressBar* self)
{
	gdouble elapsed = 0.0;
	gdouble duration = 0.0;
	gdouble progress = 0.0;
	gboolean result;
	elapsed = (g_get_monotonic_time () - self->priv->animation_start_time) / 1000.0;
	duration = 500.0;
	if (elapsed >= duration) {
		self->priv->_animated_percentage = self->priv->animation_target_value;
		gtk_widget_queue_draw ((GtkWidget*) self);
		self->priv->animation_timeout_id = (guint) 0;
		if (self->priv->animation_target_value >= 1.0) {
			widgets_circular_progress_bar_start_success_animation (self);
		}
		result = FALSE;
		return result;
	}
	progress = elapsed / duration;
	progress = 1.0 - pow (1.0 - progress, 3.0);
	self->priv->_animated_percentage = self->priv->animation_start_value + ((self->priv->animation_target_value - self->priv->animation_start_value) * progress);
	gtk_widget_queue_draw ((GtkWidget*) self);
	result = TRUE;
	return result;
}

static gboolean
___lambda105__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda105_ ((WidgetsCircularProgressBar*) self);
	return result;
}

static void
widgets_circular_progress_bar_animate_to_percentage (WidgetsCircularProgressBar* self,
                                                     gdouble target)
{
	g_return_if_fail (self != NULL);
	if (self->priv->animation_timeout_id != ((guint) 0)) {
		g_source_remove (self->priv->animation_timeout_id);
	}
	self->priv->animation_start_value = self->priv->_animated_percentage;
	self->priv->animation_target_value = target;
	self->priv->animation_start_time = g_get_monotonic_time ();
	self->priv->animation_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 16, ___lambda105__gsource_func, g_object_ref (self), g_object_unref);
}

static gboolean
__lambda106_ (WidgetsCircularProgressBar* self)
{
	gdouble elapsed = 0.0;
	gdouble duration = 0.0;
	gdouble progress = 0.0;
	gdouble t = 0.0;
	gboolean result;
	elapsed = (g_get_monotonic_time () - self->priv->success_start_time) / 1000.0;
	duration = 350.0;
	if (elapsed >= duration) {
		self->priv->success_squeeze = 0.0;
		gtk_widget_queue_draw ((GtkWidget*) self);
		self->priv->success_animation_id = (guint) 0;
		result = FALSE;
		return result;
	}
	progress = elapsed / duration;
	t = progress;
	if (t < 0.5) {
		self->priv->success_squeeze = t * 2.0;
	} else {
		gdouble bounce_t = 0.0;
		gdouble bounce = 0.0;
		bounce_t = (t - 0.5) * 2.0;
		bounce = (pow ((gdouble) 2, -10 * bounce_t) * sin (((bounce_t - 0.075) * (2 * G_PI)) / 0.3)) + 1;
		self->priv->success_squeeze = 1.0 - (bounce_t * bounce);
	}
	gtk_widget_queue_draw ((GtkWidget*) self);
	result = TRUE;
	return result;
}

static gboolean
___lambda106__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda106_ ((WidgetsCircularProgressBar*) self);
	return result;
}

static void
widgets_circular_progress_bar_start_success_animation (WidgetsCircularProgressBar* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->success_animation_id != ((guint) 0)) {
		g_source_remove (self->priv->success_animation_id);
	}
	self->priv->success_start_time = g_get_monotonic_time ();
	self->priv->success_animation_id = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 16, ___lambda106__gsource_func, g_object_ref (self), g_object_unref);
}

static GtkSizeRequestMode
widgets_circular_progress_bar_real_get_request_mode (GtkWidget* base)
{
	WidgetsCircularProgressBar * self;
	GtkSizeRequestMode result;
	self = (WidgetsCircularProgressBar*) base;
	result = GTK_SIZE_REQUEST_CONSTANT_SIZE;
	return result;
}

void
widgets_circular_progress_bar_draw (WidgetsCircularProgressBar* self,
                                    GtkDrawingArea* da,
                                    cairo_t* cr,
                                    gint width,
                                    gint height)
{
	gint delta = 0;
	GdkRGBA color = {0};
	gint center_x = 0;
	gint center_y = 0;
	gint radius = 0;
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (da != NULL);
	g_return_if_fail (cr != NULL);
	cairo_save (cr);
	memset (&color, 0, sizeof (GdkRGBA));
	center_x = gtk_widget_get_width ((GtkWidget*) self) / 2;
	center_y = gtk_widget_get_height ((GtkWidget*) self) / 2;
	radius = widgets_circular_progress_bar_calculate_radius (self);
	_tmp0_ = self->priv->_thick_style;
	if (_tmp0_) {
		gdouble ring_width = 0.0;
		gdouble ring_radius = 0.0;
		gboolean _tmp1_ = FALSE;
		const gchar* _tmp2_;
		GdkRGBA _tmp3_;
		ring_width = radius * 0.3;
		ring_radius = radius - (ring_width / 2);
		if (self->priv->_animated_percentage >= 1.0) {
			_tmp1_ = self->priv->success_squeeze > ((gdouble) 0);
		} else {
			_tmp1_ = FALSE;
		}
		if (_tmp1_) {
			ring_radius = ring_radius * (1.0 - (self->priv->success_squeeze * 0.3));
		}
		cairo_set_line_width (cr, ring_width);
		cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
		cairo_arc (cr, (gdouble) center_x, (gdouble) center_y, ring_radius, (gdouble) 0, 2 * G_PI);
		_tmp2_ = self->priv->_radius_fill_color;
		gdk_rgba_parse (&color, _tmp2_);
		_tmp3_ = color;
		gdk_cairo_set_source_rgba (cr, &_tmp3_);
		cairo_stroke (cr);
		if (self->priv->_animated_percentage > ((gdouble) 0)) {
			const gchar* _tmp4_;
			GdkRGBA _tmp5_;
			cairo_arc (cr, (gdouble) center_x, (gdouble) center_y, ring_radius, (-G_PI) / 2, ((-G_PI) / 2) + ((self->priv->_animated_percentage * 2) * G_PI));
			_tmp4_ = self->priv->_progress_fill_color;
			gdk_rgba_parse (&color, _tmp4_);
			_tmp5_ = color;
			gdk_cairo_set_source_rgba (cr, &_tmp5_);
			cairo_stroke (cr);
		}
	} else {
		gdouble border_radius = 0.0;
		gboolean _tmp6_ = FALSE;
		const gchar* _tmp7_;
		GdkRGBA _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		cairo_line_cap_t _tmp13_;
		gint _tmp14_;
		gint _tmp15_;
		gboolean _tmp16_;
		gboolean _tmp20_;
		border_radius = (gdouble) ((radius + self->priv->_gap) + (self->priv->_border_width / 2));
		if (self->priv->_animated_percentage >= 1.0) {
			_tmp6_ = self->priv->success_squeeze > ((gdouble) 0);
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			border_radius = border_radius * (1.0 - (self->priv->success_squeeze * 0.25));
		}
		cairo_arc (cr, (gdouble) center_x, (gdouble) center_y, border_radius, (gdouble) 0, 2 * G_PI);
		_tmp7_ = self->priv->_border_color;
		gdk_rgba_parse (&color, _tmp7_);
		_tmp8_ = color;
		gdk_cairo_set_source_rgba (cr, &_tmp8_);
		cairo_set_line_width (cr, (gdouble) self->priv->_border_width);
		cairo_stroke (cr);
		_tmp9_ = widgets_circular_progress_bar_get_line_width (self);
		_tmp10_ = _tmp9_;
		if ((radius - _tmp10_) < 0) {
			delta = 0;
			widgets_circular_progress_bar_set_line_width (self, radius);
		} else {
			gint _tmp11_;
			gint _tmp12_;
			_tmp11_ = widgets_circular_progress_bar_get_line_width (self);
			_tmp12_ = _tmp11_;
			delta = radius - (_tmp12_ / 2);
		}
		_tmp13_ = self->priv->_line_cap;
		cairo_set_line_cap (cr, _tmp13_);
		_tmp14_ = widgets_circular_progress_bar_get_line_width (self);
		_tmp15_ = _tmp14_;
		cairo_set_line_width (cr, (gdouble) _tmp15_);
		_tmp16_ = self->priv->_center_filled;
		if (_tmp16_ == TRUE) {
			const gchar* _tmp17_;
			const gchar* _tmp18_;
			GdkRGBA _tmp19_;
			cairo_arc (cr, (gdouble) center_x, (gdouble) center_y, (gdouble) delta, (gdouble) 0, 2 * G_PI);
			_tmp17_ = widgets_circular_progress_bar_get_center_fill_color (self);
			_tmp18_ = _tmp17_;
			gdk_rgba_parse (&color, _tmp18_);
			_tmp19_ = color;
			gdk_cairo_set_source_rgba (cr, &_tmp19_);
			cairo_fill (cr);
		}
		_tmp20_ = self->priv->_radius_filled;
		if (_tmp20_ == TRUE) {
			const gchar* _tmp21_;
			const gchar* _tmp22_;
			GdkRGBA _tmp23_;
			cairo_arc (cr, (gdouble) center_x, (gdouble) center_y, (gdouble) delta, (gdouble) 0, 2 * G_PI);
			_tmp21_ = widgets_circular_progress_bar_get_radius_fill_color (self);
			_tmp22_ = _tmp21_;
			gdk_rgba_parse (&color, _tmp22_);
			_tmp23_ = color;
			gdk_cairo_set_source_rgba (cr, &_tmp23_);
			cairo_stroke (cr);
		}
		if (self->priv->_animated_percentage > ((gdouble) 0)) {
			const gchar* _tmp24_;
			const gchar* _tmp25_;
			GdkRGBA _tmp26_;
			gint _tmp27_;
			gint _tmp28_;
			_tmp24_ = widgets_circular_progress_bar_get_progress_fill_color (self);
			_tmp25_ = _tmp24_;
			gdk_rgba_parse (&color, _tmp25_);
			_tmp26_ = color;
			gdk_cairo_set_source_rgba (cr, &_tmp26_);
			_tmp27_ = widgets_circular_progress_bar_get_line_width (self);
			_tmp28_ = _tmp27_;
			if (_tmp28_ == 0) {
				cairo_move_to (cr, (gdouble) center_x, (gdouble) center_y);
				cairo_arc (cr, (gdouble) center_x, (gdouble) center_y, (gdouble) (delta + 1), 1.5 * G_PI, (1.5 + (self->priv->_animated_percentage * 2)) * G_PI);
				cairo_fill (cr);
			} else {
				cairo_arc (cr, (gdouble) center_x, (gdouble) center_y, (gdouble) delta, 1.5 * G_PI, (1.5 + (self->priv->_animated_percentage * 2)) * G_PI);
				cairo_stroke (cr);
			}
		}
	}
}

gint
widgets_circular_progress_bar_get_size (WidgetsCircularProgressBar* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_size;
	return result;
}

static void
widgets_circular_progress_bar_set_size (WidgetsCircularProgressBar* self,
                                        gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_circular_progress_bar_get_size (self);
	if (old_value != value) {
		self->priv->_size = value;
		g_object_notify_by_pspec ((GObject *) self, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_SIZE_PROPERTY]);
	}
}

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

void
widgets_circular_progress_bar_set_center_filled (WidgetsCircularProgressBar* self,
                                                 gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_circular_progress_bar_get_center_filled (self);
	if (old_value != value) {
		self->priv->_center_filled = value;
		g_object_notify_by_pspec ((GObject *) self, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILLED_PROPERTY]);
	}
}

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

void
widgets_circular_progress_bar_set_radius_filled (WidgetsCircularProgressBar* self,
                                                 gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_circular_progress_bar_get_radius_filled (self);
	if (old_value != value) {
		self->priv->_radius_filled = value;
		g_object_notify_by_pspec ((GObject *) self, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILLED_PROPERTY]);
	}
}

gboolean
widgets_circular_progress_bar_get_thick_style (WidgetsCircularProgressBar* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_thick_style;
	return result;
}

void
widgets_circular_progress_bar_set_thick_style (WidgetsCircularProgressBar* self,
                                               gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_circular_progress_bar_get_thick_style (self);
	if (old_value != value) {
		self->priv->_thick_style = value;
		g_object_notify_by_pspec ((GObject *) self, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_THICK_STYLE_PROPERTY]);
	}
}

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

void
widgets_circular_progress_bar_set_line_cap (WidgetsCircularProgressBar* self,
                                            cairo_line_cap_t value)
{
	cairo_line_cap_t old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_circular_progress_bar_get_line_cap (self);
	if (old_value != value) {
		self->priv->_line_cap = value;
		g_object_notify_by_pspec ((GObject *) self, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_CAP_PROPERTY]);
	}
}

const gchar*
widgets_circular_progress_bar_get_center_fill_color (WidgetsCircularProgressBar* 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
widgets_circular_progress_bar_set_center_fill_color (WidgetsCircularProgressBar* self,
                                                     const gchar* value)
{
	GdkRGBA color = {0};
	g_return_if_fail (self != NULL);
	memset (&color, 0, sizeof (GdkRGBA));
	if (gdk_rgba_parse (&color, value)) {
		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, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILL_COLOR_PROPERTY]);
}

const gchar*
widgets_circular_progress_bar_get_radius_fill_color (WidgetsCircularProgressBar* 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
widgets_circular_progress_bar_set_radius_fill_color (WidgetsCircularProgressBar* self,
                                                     const gchar* value)
{
	GdkRGBA color = {0};
	g_return_if_fail (self != NULL);
	memset (&color, 0, sizeof (GdkRGBA));
	if (gdk_rgba_parse (&color, value)) {
		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, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILL_COLOR_PROPERTY]);
}

const gchar*
widgets_circular_progress_bar_get_progress_fill_color (WidgetsCircularProgressBar* 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
widgets_circular_progress_bar_set_progress_fill_color (WidgetsCircularProgressBar* self,
                                                       const gchar* value)
{
	GdkRGBA color = {0};
	g_return_if_fail (self != NULL);
	memset (&color, 0, sizeof (GdkRGBA));
	if (gdk_rgba_parse (&color, value)) {
		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, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_PROGRESS_FILL_COLOR_PROPERTY]);
}

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

void
widgets_circular_progress_bar_set_line_width (WidgetsCircularProgressBar* self,
                                              gint value)
{
	g_return_if_fail (self != NULL);
	if (value < 0) {
		self->priv->_line_width = 0;
	} else {
		if (value > widgets_circular_progress_bar_calculate_radius (self)) {
			self->priv->_line_width = widgets_circular_progress_bar_calculate_radius (self);
		} else {
			self->priv->_line_width = value;
		}
	}
	g_object_notify_by_pspec ((GObject *) self, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_WIDTH_PROPERTY]);
}

gint
widgets_circular_progress_bar_get_gap (WidgetsCircularProgressBar* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_gap;
	return result;
}

void
widgets_circular_progress_bar_set_gap (WidgetsCircularProgressBar* self,
                                       gint value)
{
	g_return_if_fail (self != NULL);
	if (value < 0) {
		self->priv->_gap = 0;
	} else {
		self->priv->_gap = value;
	}
	gtk_widget_queue_draw ((GtkWidget*) self);
	g_object_notify_by_pspec ((GObject *) self, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_GAP_PROPERTY]);
}

gint
widgets_circular_progress_bar_get_border_width (WidgetsCircularProgressBar* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_border_width;
	return result;
}

void
widgets_circular_progress_bar_set_border_width (WidgetsCircularProgressBar* self,
                                                gint value)
{
	g_return_if_fail (self != NULL);
	if (value < 0) {
		self->priv->_border_width = 0;
	} else {
		self->priv->_border_width = value;
	}
	gtk_widget_queue_draw ((GtkWidget*) self);
	g_object_notify_by_pspec ((GObject *) self, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_BORDER_WIDTH_PROPERTY]);
}

gdouble
widgets_circular_progress_bar_get_percentage (WidgetsCircularProgressBar* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_percentage;
	return result;
}

void
widgets_circular_progress_bar_set_percentage (WidgetsCircularProgressBar* self,
                                              gdouble value)
{
	gdouble new_value = 0.0;
	g_return_if_fail (self != NULL);
	new_value = value;
	if (new_value > 1.0) {
		new_value = 1.0;
	} else {
		if (new_value < 0.0) {
			new_value = 0.0;
		}
	}
	if (self->priv->_percentage != new_value) {
		widgets_circular_progress_bar_animate_to_percentage (self, new_value);
		self->priv->_percentage = new_value;
	}
	g_object_notify_by_pspec ((GObject *) self, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_PERCENTAGE_PROPERTY]);
}

void
widgets_circular_progress_bar_set_color (WidgetsCircularProgressBar* self,
                                         const gchar* value)
{
	gchar* base_color = NULL;
	Util* _tmp0_;
	Util* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gboolean _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = util_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = util_get_color (_tmp1_, value);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	base_color = _tmp3_;
	_tmp4_ = base_color;
	_tmp5_ = g_strdup (_tmp4_);
	_g_free0 (self->priv->_progress_fill_color);
	self->priv->_progress_fill_color = _tmp5_;
	_tmp6_ = base_color;
	_tmp7_ = g_strdup (_tmp6_);
	_g_free0 (self->priv->_border_color);
	self->priv->_border_color = _tmp7_;
	_tmp8_ = self->priv->_thick_style;
	if (_tmp8_) {
		GdkRGBA rgba = {0};
		const gchar* _tmp9_;
		gchar* _tmp10_;
		memset (&rgba, 0, sizeof (GdkRGBA));
		_tmp9_ = base_color;
		gdk_rgba_parse (&rgba, _tmp9_);
		rgba.alpha = 0.3f;
		_tmp10_ = gdk_rgba_to_string (&rgba);
		_g_free0 (self->priv->_radius_fill_color);
		self->priv->_radius_fill_color = _tmp10_;
	}
	gtk_widget_queue_draw ((GtkWidget*) self);
	_g_free0 (base_color);
	g_object_notify_by_pspec ((GObject *) self, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_COLOR_PROPERTY]);
}

static GObject *
widgets_circular_progress_bar_constructor (GType type,
                                           guint n_construct_properties,
                                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsCircularProgressBar * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	parent_class = G_OBJECT_CLASS (widgets_circular_progress_bar_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_CIRCULAR_PROGRESS_BAR, WidgetsCircularProgressBar);
	self->priv->_line_width = 0;
	self->priv->_percentage = (gdouble) 0;
	self->priv->_animated_percentage = (gdouble) 0;
	_tmp0_ = g_strdup ("#adadad");
	_g_free0 (self->priv->_center_fill_color);
	self->priv->_center_fill_color = _tmp0_;
	_tmp1_ = g_strdup ("#d3d3d3");
	_g_free0 (self->priv->_radius_fill_color);
	self->priv->_radius_fill_color = _tmp1_;
	_tmp2_ = g_strdup ("#4a90d9");
	_g_free0 (self->priv->_progress_fill_color);
	self->priv->_progress_fill_color = _tmp2_;
	_tmp3_ = g_strdup ("#4a90d9");
	_g_free0 (self->priv->_border_color);
	self->priv->_border_color = _tmp3_;
	self->priv->_border_width = 2;
	self->priv->_gap = 3;
	return obj;
}

static void
widgets_circular_progress_bar_class_init (WidgetsCircularProgressBarClass * klass,
                                          gpointer klass_data)
{
	widgets_circular_progress_bar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsCircularProgressBar_private_offset);
	((GtkWidgetClass *) klass)->get_request_mode = (GtkSizeRequestMode (*) (GtkWidget*)) widgets_circular_progress_bar_real_get_request_mode;
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_circular_progress_bar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_circular_progress_bar_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_circular_progress_bar_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_circular_progress_bar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CIRCULAR_PROGRESS_BAR_SIZE_PROPERTY, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_SIZE_PROPERTY] = g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILLED_PROPERTY, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILLED_PROPERTY] = g_param_spec_boolean ("center-filled", "Center Fill", "Center Fill toggle", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILLED_PROPERTY, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILLED_PROPERTY] = g_param_spec_boolean ("radius-filled", "Radius Fill", "Radius Fill toggle", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CIRCULAR_PROGRESS_BAR_THICK_STYLE_PROPERTY, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_THICK_STYLE_PROPERTY] = g_param_spec_boolean ("thick-style", "Thick Style", "Use thick circular style", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_CAP_PROPERTY, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_CAP_PROPERTY] = g_param_spec_enum ("line-cap", "Line Cap", "Line Cap for stroke as in Cairo.LineCap", cairo_gobject_line_cap_get_type (), CAIRO_LINE_CAP_BUTT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILL_COLOR_PROPERTY, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILL_COLOR_PROPERTY] = g_param_spec_string ("center-fill-color", "Inside circle fill color", "Center pad fill color (Check Gdk.RGBA parse method)", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILL_COLOR_PROPERTY, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILL_COLOR_PROPERTY] = g_param_spec_string ("radius-fill-color", "Circular radius fill color", "The circular pad fill color (Check GdkRGBA parse method)", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CIRCULAR_PROGRESS_BAR_PROGRESS_FILL_COLOR_PROPERTY, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_PROGRESS_FILL_COLOR_PROPERTY] = g_param_spec_string ("progress-fill-color", "Progress fill color", "Progress line color (Check GdkRGBA parse method)", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_WIDTH_PROPERTY, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_WIDTH_PROPERTY] = g_param_spec_int ("line-width", "Circle width", "The circle radius 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), WIDGETS_CIRCULAR_PROGRESS_BAR_GAP_PROPERTY, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_GAP_PROPERTY] = g_param_spec_int ("gap", "Gap", "Gap between border and progress circle", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CIRCULAR_PROGRESS_BAR_BORDER_WIDTH_PROPERTY, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_BORDER_WIDTH_PROPERTY] = g_param_spec_int ("border-width", "Border Width", "Width of the outer border", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CIRCULAR_PROGRESS_BAR_PERCENTAGE_PROPERTY, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_PERCENTAGE_PROPERTY] = g_param_spec_double ("percentage", "Percentage/Value", "The percentage value [0.0 ... 1.0]", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CIRCULAR_PROGRESS_BAR_COLOR_PROPERTY, widgets_circular_progress_bar_properties[WIDGETS_CIRCULAR_PROGRESS_BAR_COLOR_PROPERTY] = g_param_spec_string ("color", "color", "color", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
}

static void
widgets_circular_progress_bar_instance_init (WidgetsCircularProgressBar * self,
                                             gpointer klass)
{
	self->priv = widgets_circular_progress_bar_get_instance_private (self);
	self->priv->animation_timeout_id = (guint) 0;
	self->priv->success_animation_id = (guint) 0;
	self->priv->success_squeeze = 0.0;
	self->priv->_center_filled = FALSE;
	self->priv->_radius_filled = FALSE;
	self->priv->_thick_style = FALSE;
	self->priv->_line_cap = CAIRO_LINE_CAP_BUTT;
}

static void
widgets_circular_progress_bar_finalize (GObject * obj)
{
	WidgetsCircularProgressBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_CIRCULAR_PROGRESS_BAR, WidgetsCircularProgressBar);
	g_debug ("CircularProgressBar.vala:278: Destroying - Widgets.CircularProgressBar" \
"\n");
	_g_free0 (self->priv->_center_fill_color);
	_g_free0 (self->priv->_radius_fill_color);
	_g_free0 (self->priv->_progress_fill_color);
	_g_free0 (self->priv->_border_color);
	G_OBJECT_CLASS (widgets_circular_progress_bar_parent_class)->finalize (obj);
}

static GType
widgets_circular_progress_bar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsCircularProgressBarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_circular_progress_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsCircularProgressBar), 0, (GInstanceInitFunc) widgets_circular_progress_bar_instance_init, NULL };
	GType widgets_circular_progress_bar_type_id;
	widgets_circular_progress_bar_type_id = g_type_register_static (gtk_drawing_area_get_type (), "WidgetsCircularProgressBar", &g_define_type_info, 0);
	WidgetsCircularProgressBar_private_offset = g_type_add_instance_private (widgets_circular_progress_bar_type_id, sizeof (WidgetsCircularProgressBarPrivate));
	return widgets_circular_progress_bar_type_id;
}

GType
widgets_circular_progress_bar_get_type (void)
{
	static volatile gsize widgets_circular_progress_bar_type_id__once = 0;
	if (g_once_init_enter (&widgets_circular_progress_bar_type_id__once)) {
		GType widgets_circular_progress_bar_type_id;
		widgets_circular_progress_bar_type_id = widgets_circular_progress_bar_get_type_once ();
		g_once_init_leave (&widgets_circular_progress_bar_type_id__once, widgets_circular_progress_bar_type_id);
	}
	return widgets_circular_progress_bar_type_id__once;
}

static void
_vala_widgets_circular_progress_bar_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec)
{
	WidgetsCircularProgressBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_CIRCULAR_PROGRESS_BAR, WidgetsCircularProgressBar);
	switch (property_id) {
		case WIDGETS_CIRCULAR_PROGRESS_BAR_SIZE_PROPERTY:
		g_value_set_int (value, widgets_circular_progress_bar_get_size (self));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILLED_PROPERTY:
		g_value_set_boolean (value, widgets_circular_progress_bar_get_center_filled (self));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILLED_PROPERTY:
		g_value_set_boolean (value, widgets_circular_progress_bar_get_radius_filled (self));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_THICK_STYLE_PROPERTY:
		g_value_set_boolean (value, widgets_circular_progress_bar_get_thick_style (self));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_CAP_PROPERTY:
		g_value_set_enum (value, widgets_circular_progress_bar_get_line_cap (self));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILL_COLOR_PROPERTY:
		g_value_set_string (value, widgets_circular_progress_bar_get_center_fill_color (self));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILL_COLOR_PROPERTY:
		g_value_set_string (value, widgets_circular_progress_bar_get_radius_fill_color (self));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_PROGRESS_FILL_COLOR_PROPERTY:
		g_value_set_string (value, widgets_circular_progress_bar_get_progress_fill_color (self));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_WIDTH_PROPERTY:
		g_value_set_int (value, widgets_circular_progress_bar_get_line_width (self));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_GAP_PROPERTY:
		g_value_set_int (value, widgets_circular_progress_bar_get_gap (self));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_BORDER_WIDTH_PROPERTY:
		g_value_set_int (value, widgets_circular_progress_bar_get_border_width (self));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_PERCENTAGE_PROPERTY:
		g_value_set_double (value, widgets_circular_progress_bar_get_percentage (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_circular_progress_bar_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec)
{
	WidgetsCircularProgressBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_CIRCULAR_PROGRESS_BAR, WidgetsCircularProgressBar);
	switch (property_id) {
		case WIDGETS_CIRCULAR_PROGRESS_BAR_SIZE_PROPERTY:
		widgets_circular_progress_bar_set_size (self, g_value_get_int (value));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILLED_PROPERTY:
		widgets_circular_progress_bar_set_center_filled (self, g_value_get_boolean (value));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILLED_PROPERTY:
		widgets_circular_progress_bar_set_radius_filled (self, g_value_get_boolean (value));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_THICK_STYLE_PROPERTY:
		widgets_circular_progress_bar_set_thick_style (self, g_value_get_boolean (value));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_CAP_PROPERTY:
		widgets_circular_progress_bar_set_line_cap (self, g_value_get_enum (value));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_CENTER_FILL_COLOR_PROPERTY:
		widgets_circular_progress_bar_set_center_fill_color (self, g_value_get_string (value));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_RADIUS_FILL_COLOR_PROPERTY:
		widgets_circular_progress_bar_set_radius_fill_color (self, g_value_get_string (value));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_PROGRESS_FILL_COLOR_PROPERTY:
		widgets_circular_progress_bar_set_progress_fill_color (self, g_value_get_string (value));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_LINE_WIDTH_PROPERTY:
		widgets_circular_progress_bar_set_line_width (self, g_value_get_int (value));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_GAP_PROPERTY:
		widgets_circular_progress_bar_set_gap (self, g_value_get_int (value));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_BORDER_WIDTH_PROPERTY:
		widgets_circular_progress_bar_set_border_width (self, g_value_get_int (value));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_PERCENTAGE_PROPERTY:
		widgets_circular_progress_bar_set_percentage (self, g_value_get_double (value));
		break;
		case WIDGETS_CIRCULAR_PROGRESS_BAR_COLOR_PROPERTY:
		widgets_circular_progress_bar_set_color (self, g_value_get_string (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;
}

