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

/*
 * Copyright (c) 2025 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 * Authors: Kamil Prusko <kamilprusko@gmail.com>
 */

#include "ft_ui.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <pango/pango.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <graphene-gobject.h>

#define FT_CHART_AXIS_EPSILON 0.00001
#define FT_CHART_AXIS_MAX_TICKS ((guint) 24)
#define FT_CHART_AXIS_EXTENT 0.2f
#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  {
	FT_CHART_AXIS_0_PROPERTY,
	FT_CHART_AXIS_ORIENTATION_PROPERTY,
	FT_CHART_AXIS_VALUE_FROM_PROPERTY,
	FT_CHART_AXIS_VALUE_TO_PROPERTY,
	FT_CHART_AXIS_VALUE_SPACING_PROPERTY,
	FT_CHART_AXIS_SCALE_PROPERTY,
	FT_CHART_AXIS_TEXT_OFFSET_PROPERTY,
	FT_CHART_AXIS_CONTINOUS_PROPERTY,
	FT_CHART_AXIS_ORIGIN_PROPERTY,
	FT_CHART_AXIS_NUM_PROPERTIES
};
static GParamSpec* ft_chart_axis_properties[FT_CHART_AXIS_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)))
typedef struct _Block7Data Block7Data;
enum  {
	FT_CHART_AXIS_CONFIGURED_SIGNAL,
	FT_CHART_AXIS_NUM_SIGNALS
};
static guint ft_chart_axis_signals[FT_CHART_AXIS_NUM_SIGNALS] = {0};
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _FtChartAxisPrivate {
	GtkOrientation _orientation;
	gfloat _value_from;
	gfloat _value_to;
	gfloat _value_spacing;
	gfloat _scale;
	gint _text_offset;
	gboolean _continous;
	gint _origin;
	gfloat* ticks;
	gint ticks_length1;
	gint _ticks_size_;
	PangoLayout** layouts;
	gint layouts_length1;
	gint _layouts_size_;
	FtFormatValueFunc format_value_func;
	gpointer format_value_func_target;
	GDestroyNotify format_value_func_target_destroy_notify;
};

struct _Block7Data {
	int _ref_count_;
	FtChartAxis* self;
	FtChartAxis* _self_;
	GWeakRef weak_clone;
	gulong configured_id;
	gulong destroy_id;
	gulong clone_destroy_id;
};

static gint FtChartAxis_private_offset;
static gpointer ft_chart_axis_parent_class = NULL;

static gfloat* ft_chart_axis_create_ticks (gfloat value_from,
                                    gfloat value_to,
                                    gfloat value_spacing,
                                    gint* result_length1);
static inline PangoAlignment ft_chart_axis_get_text_alignment (FtChartAxis* self);
static inline gchar* ft_chart_axis_format_value (FtChartAxis* self,
                                   gfloat value);
static void ft_chart_axis_calculate_ticks (FtChartAxis* self,
                                    gfloat value_from,
                                    gfloat value_to,
                                    gfloat value_spacing,
                                    gint available_size,
                                    gfloat** ticks,
                                    gint* ticks_length1,
                                    gint* label_width,
                                    gint* label_height);
static gfloat* _vala_array_dup2 (gfloat* self,
                          gssize length);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static gchar* __lambda7_ (Block7Data* _data7_,
                   gdouble value);
static gchar* ___lambda7__ft_format_value_func (gdouble value,
                                         gpointer self);
static void __lambda8_ (Block7Data* _data7_);
static gfloat* _vala_array_dup3 (gfloat* self,
                          gssize length);
static void ___lambda8__ft_chart_axis_configured (FtChartAxis* _sender,
                                           gpointer self);
static void __lambda9_ (Block7Data* _data7_);
static void ___lambda9__gtk_widget_destroy (GtkWidget* _sender,
                                     gpointer self);
static void __lambda10_ (Block7Data* _data7_);
static void ___lambda10__gtk_widget_destroy (GtkWidget* _sender,
                                      gpointer self);
static GtkSizeRequestMode ft_chart_axis_real_get_request_mode (GtkWidget* base);
static void ft_chart_axis_real_measure (GtkWidget* base,
                                 GtkOrientation orientation,
                                 gint for_size,
                                 gint* minimum,
                                 gint* natural,
                                 gint* minimum_baseline,
                                 gint* natural_baseline);
static void ft_chart_axis_real_size_allocate (GtkWidget* base,
                                       gint width,
                                       gint height,
                                       gint baseline);
static void ft_chart_axis_real_snapshot (GtkWidget* base,
                                  GtkSnapshot* snapshot);
static void ft_chart_axis_real_dispose (GObject* base);
static GObject * ft_chart_axis_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties);
static void ft_chart_axis_finalize (GObject * obj);
static GType ft_chart_axis_get_type_once (void);
static void _vala_ft_chart_axis_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static void _vala_ft_chart_axis_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
ft_chart_axis_get_instance_private (FtChartAxis* self)
{
	return G_STRUCT_MEMBER_P (self, FtChartAxis_private_offset);
}

FtChartAxis*
ft_chart_axis_construct (GType object_type,
                         GtkOrientation orientation,
                         FtFormatValueFunc format_value_func,
                         gpointer format_value_func_target,
                         GDestroyNotify format_value_func_target_destroy_notify)
{
	FtChartAxis * self = NULL;
	FtFormatValueFunc _tmp0_;
	gpointer _tmp0__target;
	GDestroyNotify _tmp0__target_destroy_notify;
	self = (FtChartAxis*) g_object_new (object_type, "orientation", orientation, "focusable", FALSE, NULL);
	_tmp0_ = format_value_func;
	_tmp0__target = format_value_func_target;
	_tmp0__target_destroy_notify = format_value_func_target_destroy_notify;
	format_value_func = NULL;
	format_value_func_target = NULL;
	format_value_func_target_destroy_notify = NULL;
	(self->priv->format_value_func_target_destroy_notify == NULL) ? NULL : (self->priv->format_value_func_target_destroy_notify (self->priv->format_value_func_target), NULL);
	self->priv->format_value_func = NULL;
	self->priv->format_value_func_target = NULL;
	self->priv->format_value_func_target_destroy_notify = NULL;
	self->priv->format_value_func = _tmp0_;
	self->priv->format_value_func_target = _tmp0__target;
	self->priv->format_value_func_target_destroy_notify = _tmp0__target_destroy_notify;
	(format_value_func_target_destroy_notify == NULL) ? NULL : (format_value_func_target_destroy_notify (format_value_func_target), NULL);
	format_value_func = NULL;
	format_value_func_target = NULL;
	format_value_func_target_destroy_notify = NULL;
	return self;
}

FtChartAxis*
ft_chart_axis_new (GtkOrientation orientation,
                   FtFormatValueFunc format_value_func,
                   gpointer format_value_func_target,
                   GDestroyNotify format_value_func_target_destroy_notify)
{
	return ft_chart_axis_construct (FT_TYPE_CHART_AXIS, orientation, format_value_func, format_value_func_target, format_value_func_target_destroy_notify);
}

static gfloat*
ft_chart_axis_create_ticks (gfloat value_from,
                            gfloat value_to,
                            gfloat value_spacing,
                            gint* result_length1)
{
	gint tick_from = 0;
	gint tick_to = 0;
	gint _tmp0_ = 0;
	gint tick_count = 0;
	gfloat* tick_values = NULL;
	gfloat* _tmp1_;
	gint tick_values_length1;
	gint _tick_values_size_;
	gfloat* _tmp6_;
	gint _tmp6__length1;
	gfloat _tmp7_;
	gfloat* _tmp8_;
	gint _tmp8__length1;
	gfloat* _tmp9_;
	gint _tmp9__length1;
	gfloat _tmp10_;
	gfloat* _tmp11_;
	gint _tmp11__length1;
	gfloat* result;
	_vala_return_val_if_fail (((gdouble) fabsf (value_spacing)) > FT_CHART_AXIS_EPSILON, "value_spacing.abs () > EPSILON", NULL);
	tick_from = (gint) floorf (value_from / value_spacing);
	tick_to = MAX ((gint) ceilf (value_to / value_spacing), tick_from + 1);
	if (tick_to > tick_from) {
		_tmp0_ = (tick_to - tick_from) + 1;
	} else {
		_tmp0_ = 0;
	}
	tick_count = _tmp0_;
	_tmp1_ = g_new0 (gfloat, tick_count);
	tick_values = _tmp1_;
	tick_values_length1 = tick_count;
	_tick_values_size_ = tick_values_length1;
	{
		gint index = 0;
		index = 0;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				gfloat* _tmp4_;
				gint _tmp4__length1;
				gfloat* _tmp5_;
				gint _tmp5__length1;
				if (!_tmp2_) {
					gint _tmp3_;
					_tmp3_ = index;
					index = _tmp3_ + 1;
				}
				_tmp2_ = FALSE;
				_tmp4_ = tick_values;
				_tmp4__length1 = tick_values_length1;
				if (!(index < _tmp4__length1)) {
					break;
				}
				_tmp5_ = tick_values;
				_tmp5__length1 = tick_values_length1;
				_tmp5_[index] = ((gfloat) (tick_from + index)) * value_spacing;
			}
		}
	}
	_tmp6_ = tick_values;
	_tmp6__length1 = tick_values_length1;
	_tmp7_ = _tmp6_[0];
	value_from = _tmp7_;
	_tmp8_ = tick_values;
	_tmp8__length1 = tick_values_length1;
	_tmp9_ = tick_values;
	_tmp9__length1 = tick_values_length1;
	_tmp10_ = _tmp8_[_tmp9__length1 - 1];
	value_to = _tmp10_;
	_tmp11_ = tick_values;
	_tmp11__length1 = tick_values_length1;
	if (result_length1) {
		*result_length1 = _tmp11__length1;
	}
	result = _tmp11_;
	return result;
}

static inline PangoAlignment
ft_chart_axis_get_text_alignment (FtChartAxis* self)
{
	PangoAlignment result;
	g_return_val_if_fail (self != NULL, 0);
	switch (self->priv->_orientation) {
		case GTK_ORIENTATION_HORIZONTAL:
		{
			result = PANGO_ALIGN_CENTER;
			return result;
		}
		case GTK_ORIENTATION_VERTICAL:
		{
			result = PANGO_ALIGN_RIGHT;
			return result;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
}

static inline gchar*
ft_chart_axis_format_value (FtChartAxis* self,
                            gfloat value)
{
	gchar* _tmp0_ = NULL;
	FtFormatValueFunc _tmp1_;
	gpointer _tmp1__target;
	gchar* _tmp5_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = self->priv->format_value_func;
	_tmp1__target = self->priv->format_value_func_target;
	if (_tmp1_ != NULL) {
		FtFormatValueFunc _tmp2_;
		gpointer _tmp2__target;
		gchar* _tmp3_;
		_tmp2_ = self->priv->format_value_func;
		_tmp2__target = self->priv->format_value_func_target;
		_tmp3_ = _tmp2_ ((gdouble) value, _tmp2__target);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp3_;
	} else {
		gchar* _tmp4_;
		_tmp4_ = g_strdup_printf ("%g", value);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp4_;
	}
	_tmp5_ = _tmp0_;
	_tmp0_ = NULL;
	result = _tmp5_;
	_g_free0 (_tmp0_);
	return result;
}

/**
         * Determine optimal ticks to display on an axis
         */
static void
ft_chart_axis_calculate_ticks (FtChartAxis* self,
                               gfloat value_from,
                               gfloat value_to,
                               gfloat value_spacing,
                               gint available_size,
                               gfloat** ticks,
                               gint* ticks_length1,
                               gint* label_width,
                               gint* label_height)
{
	gfloat* _vala_ticks = NULL;
	gint _vala_ticks_length1 = 0;
	gint _vala_label_width = 0;
	gint _vala_label_height = 0;
	gfloat* tick_values = NULL;
	gint tick_values_length1 = 0;
	gint _tick_values_size_ = 0;
	gfloat origin_value = 0.0F;
	gint origin_index = 0;
	gfloat* _tmp6_;
	gint _tmp6__length1;
	gfloat _tmp7_;
	PangoContext* context = NULL;
	PangoContext* _tmp8_;
	PangoLayout* layout = NULL;
	PangoContext* _tmp9_;
	PangoLayout* _tmp10_;
	PangoLayout* _tmp11_;
	gint* label_sizes = NULL;
	gfloat* _tmp12_;
	gint _tmp12__length1;
	gint* _tmp13_;
	gint label_sizes_length1;
	gint label_sizes_length2;
	gint min_stride = 0;
	gfloat* _tmp19_;
	gint _tmp19__length1;
	gint max_stride = 0;
	gfloat* _tmp20_;
	gint _tmp20__length1;
	gint best_stride = 0;
	gint best_offset = 0;
	gint best_tick_count = 0;
	gint best_label_width = 0;
	gint best_label_height = 0;
	gfloat best_score = 0.0F;
	g_return_if_fail (self != NULL);
	if (self->priv->_continous) {
		gfloat value_from_extended = 0.0F;
		gfloat value_to_extended = 0.0F;
		gboolean _tmp0_ = FALSE;
		gboolean _tmp1_ = FALSE;
		gint _tmp2_ = 0;
		gfloat* _tmp3_;
		value_from_extended = value_from - ((value_to - value_from) * FT_CHART_AXIS_EXTENT);
		value_to_extended = value_to + ((value_to - value_from) * FT_CHART_AXIS_EXTENT);
		if (value_from >= 0.0f) {
			_tmp0_ = value_from_extended < 0.0f;
		} else {
			_tmp0_ = FALSE;
		}
		if (_tmp0_) {
			value_from_extended = value_from;
		}
		if (value_to <= 0.0f) {
			_tmp1_ = value_to_extended > 0.0f;
		} else {
			_tmp1_ = FALSE;
		}
		if (_tmp1_) {
			value_to_extended = value_to;
		}
		_tmp3_ = ft_chart_axis_create_ticks (value_from_extended, value_to_extended, value_spacing, &_tmp2_);
		tick_values = (g_free (tick_values), NULL);
		tick_values = _tmp3_;
		tick_values_length1 = _tmp2_;
		_tick_values_size_ = tick_values_length1;
	} else {
		gint _tmp4_ = 0;
		gfloat* _tmp5_;
		_tmp5_ = ft_chart_axis_create_ticks (value_from, value_to, value_spacing, &_tmp4_);
		tick_values = (g_free (tick_values), NULL);
		tick_values = _tmp5_;
		tick_values_length1 = _tmp4_;
		_tick_values_size_ = tick_values_length1;
	}
	origin_value = 0.0f;
	_tmp6_ = tick_values;
	_tmp6__length1 = tick_values_length1;
	_tmp7_ = _tmp6_[0];
	origin_index = (gint) roundf ((origin_value - _tmp7_) / value_spacing);
	_tmp8_ = gtk_widget_create_pango_context ((GtkWidget*) self);
	context = _tmp8_;
	_tmp9_ = context;
	_tmp10_ = pango_layout_new (_tmp9_);
	layout = _tmp10_;
	_tmp11_ = layout;
	pango_layout_set_width (_tmp11_, -1);
	_tmp12_ = tick_values;
	_tmp12__length1 = tick_values_length1;
	_tmp13_ = g_new0 (gint, _tmp12__length1 * 2);
	label_sizes = _tmp13_;
	label_sizes_length1 = _tmp12__length1;
	label_sizes_length2 = 2;
	{
		gint tick_index = 0;
		tick_index = 0;
		{
			gboolean _tmp14_ = FALSE;
			_tmp14_ = TRUE;
			while (TRUE) {
				gfloat* _tmp16_;
				gint _tmp16__length1;
				gint* _tmp17_;
				gint _tmp17__length1;
				gint _tmp17__length2;
				gint* _tmp18_;
				gint _tmp18__length1;
				gint _tmp18__length2;
				if (!_tmp14_) {
					gint _tmp15_;
					_tmp15_ = tick_index;
					tick_index = _tmp15_ + 1;
				}
				_tmp14_ = FALSE;
				_tmp16_ = tick_values;
				_tmp16__length1 = tick_values_length1;
				if (!(tick_index < _tmp16__length1)) {
					break;
				}
				_tmp17_ = label_sizes;
				_tmp17__length1 = label_sizes_length1;
				_tmp17__length2 = label_sizes_length2;
				_tmp17_[(tick_index * _tmp17__length2) + 0] = -1;
				_tmp18_ = label_sizes;
				_tmp18__length1 = label_sizes_length1;
				_tmp18__length2 = label_sizes_length2;
				_tmp18_[(tick_index * _tmp18__length2) + 1] = -1;
			}
		}
	}
	_tmp19_ = tick_values;
	_tmp19__length1 = tick_values_length1;
	min_stride = MAX (_tmp19__length1 / ((gint) FT_CHART_AXIS_MAX_TICKS), 1);
	_tmp20_ = tick_values;
	_tmp20__length1 = tick_values_length1;
	max_stride = MAX (_tmp20__length1 / 2, 1);
	best_stride = 0;
	best_offset = 0;
	best_tick_count = 0;
	best_label_width = 0;
	best_label_height = 0;
	best_score = 0.0f;
	{
		gint candidate_stride = 0;
		candidate_stride = max_stride;
		{
			gboolean _tmp21_ = FALSE;
			_tmp21_ = TRUE;
			while (TRUE) {
				gint tick_index_from = 0;
				gint tick_index_to = 0;
				gfloat* _tmp23_;
				gint _tmp23__length1;
				gint candidate_offset = 0;
				gint candidate_tick_count = 0;
				gint candidate_label_width = 0;
				gint candidate_label_height = 0;
				gint _tmp49_ = 0;
				gint candidate_label_size = 0;
				gint _tmp50_ = 0;
				gint candidate_spacing = 0;
				gint candidate_size = 0;
				gfloat candidate_score = 0.0F;
				if (!_tmp21_) {
					gint _tmp22_;
					_tmp22_ = candidate_stride;
					candidate_stride = _tmp22_ - 1;
				}
				_tmp21_ = FALSE;
				if (!(candidate_stride >= min_stride)) {
					break;
				}
				tick_index_from = origin_index - (candidate_stride * ((gint) roundf ((value_from - origin_value) / (value_spacing * ((gfloat) candidate_stride)))));
				tick_index_to = origin_index + (candidate_stride * ((gint) roundf ((value_to - origin_value) / (value_spacing * ((gfloat) candidate_stride)))));
				if (tick_index_from < 0) {
					tick_index_from = 0;
				}
				_tmp23_ = tick_values;
				_tmp23__length1 = tick_values_length1;
				if (tick_index_to > (_tmp23__length1 - 1)) {
					gfloat* _tmp24_;
					gint _tmp24__length1;
					_tmp24_ = tick_values;
					_tmp24__length1 = tick_values_length1;
					tick_index_to = _tmp24__length1 - 1;
				}
				if (tick_index_to == tick_index_from) {
					gfloat* _tmp25_;
					gint _tmp25__length1;
					_tmp25_ = tick_values;
					_tmp25__length1 = tick_values_length1;
					if ((tick_index_to + candidate_stride) >= (_tmp25__length1 - 1)) {
						tick_index_to += candidate_stride;
					} else {
						if ((tick_index_from - candidate_stride) >= 0) {
							tick_index_from -= candidate_stride;
						}
					}
				}
				candidate_offset = tick_index_from;
				candidate_tick_count = ((tick_index_to - tick_index_from) / candidate_stride) + 1;
				if (candidate_tick_count < 2) {
					continue;
				}
				candidate_label_width = 0;
				candidate_label_height = 0;
				{
					gint tick_index = 0;
					tick_index = tick_index_from;
					{
						gboolean _tmp26_ = FALSE;
						_tmp26_ = TRUE;
						while (TRUE) {
							gboolean _tmp27_ = FALSE;
							gint* _tmp28_;
							gint _tmp28__length1;
							gint _tmp28__length2;
							gint _tmp29_;
							gint* _tmp45_;
							gint _tmp45__length1;
							gint _tmp45__length2;
							gint _tmp46_;
							gint* _tmp47_;
							gint _tmp47__length1;
							gint _tmp47__length2;
							gint _tmp48_;
							if (!_tmp26_) {
								tick_index += candidate_stride;
							}
							_tmp26_ = FALSE;
							if (!(tick_index <= tick_index_to)) {
								break;
							}
							_tmp28_ = label_sizes;
							_tmp28__length1 = label_sizes_length1;
							_tmp28__length2 = label_sizes_length2;
							_tmp29_ = _tmp28_[(tick_index * _tmp28__length2) + 0];
							if (_tmp29_ < 0) {
								_tmp27_ = TRUE;
							} else {
								gint* _tmp30_;
								gint _tmp30__length1;
								gint _tmp30__length2;
								gint _tmp31_;
								_tmp30_ = label_sizes;
								_tmp30__length1 = label_sizes_length1;
								_tmp30__length2 = label_sizes_length2;
								_tmp31_ = _tmp30_[(tick_index * _tmp30__length2) + 1];
								_tmp27_ = _tmp31_ < 0;
							}
							if (_tmp27_) {
								gchar* tick_label = NULL;
								gfloat* _tmp32_;
								gint _tmp32__length1;
								gfloat _tmp33_;
								gchar* _tmp34_;
								PangoLayout* _tmp35_;
								const gchar* _tmp36_;
								const gchar* _tmp37_;
								gint _tmp38_;
								gint _tmp39_;
								PangoLayout* _tmp40_;
								gint* _tmp41_;
								gint _tmp41__length1;
								gint _tmp41__length2;
								gint* _tmp42_;
								gint _tmp42__length1;
								gint _tmp42__length2;
								gint _tmp43_ = 0;
								gint _tmp44_ = 0;
								_tmp32_ = tick_values;
								_tmp32__length1 = tick_values_length1;
								_tmp33_ = _tmp32_[tick_index];
								_tmp34_ = ft_chart_axis_format_value (self, _tmp33_);
								tick_label = _tmp34_;
								_tmp35_ = layout;
								_tmp36_ = tick_label;
								_tmp37_ = tick_label;
								_tmp38_ = strlen (_tmp37_);
								_tmp39_ = _tmp38_;
								pango_layout_set_text (_tmp35_, _tmp36_, _tmp39_);
								_tmp40_ = layout;
								_tmp41_ = label_sizes;
								_tmp41__length1 = label_sizes_length1;
								_tmp41__length2 = label_sizes_length2;
								_tmp42_ = label_sizes;
								_tmp42__length1 = label_sizes_length1;
								_tmp42__length2 = label_sizes_length2;
								pango_layout_get_pixel_size (_tmp40_, &_tmp43_, &_tmp44_);
								_tmp41_[(tick_index * _tmp41__length2) + 0] = _tmp43_;
								_tmp42_[(tick_index * _tmp42__length2) + 1] = _tmp44_;
								_g_free0 (tick_label);
							}
							_tmp45_ = label_sizes;
							_tmp45__length1 = label_sizes_length1;
							_tmp45__length2 = label_sizes_length2;
							_tmp46_ = _tmp45_[(tick_index * _tmp45__length2) + 0];
							candidate_label_width = MAX (_tmp46_, candidate_label_width);
							_tmp47_ = label_sizes;
							_tmp47__length1 = label_sizes_length1;
							_tmp47__length2 = label_sizes_length2;
							_tmp48_ = _tmp47_[(tick_index * _tmp47__length2) + 1];
							candidate_label_height = MAX (_tmp48_, candidate_label_height);
						}
					}
				}
				if (self->priv->_orientation == GTK_ORIENTATION_HORIZONTAL) {
					_tmp49_ = candidate_label_width;
				} else {
					_tmp49_ = candidate_label_height;
				}
				candidate_label_size = _tmp49_;
				if (self->priv->_orientation == GTK_ORIENTATION_HORIZONTAL) {
					_tmp50_ = candidate_label_size;
				} else {
					_tmp50_ = candidate_label_size * 2;
				}
				candidate_spacing = _tmp50_;
				candidate_size = ((candidate_label_size + candidate_spacing) * (candidate_tick_count - 1)) + candidate_label_size;
				if (candidate_size > available_size) {
					if (best_stride == 0) {
						continue;
					} else {
						break;
					}
				}
				candidate_score = ((gfloat) candidate_tick_count) * ((gfloat) candidate_size);
				if (candidate_score >= best_score) {
					best_stride = candidate_stride;
					best_offset = candidate_offset;
					best_tick_count = candidate_tick_count;
					best_label_width = candidate_label_width;
					best_label_height = candidate_label_height;
					best_score = candidate_score;
				}
			}
		}
	}
	if (best_tick_count >= 2) {
		gfloat* _tmp51_;
		_tmp51_ = g_new0 (gfloat, best_tick_count);
		_vala_ticks = (g_free (_vala_ticks), NULL);
		_vala_ticks = _tmp51_;
		_vala_ticks_length1 = best_tick_count;
		_vala_label_width = best_label_width;
		_vala_label_height = best_label_height;
		{
			gint tick_index = 0;
			tick_index = 0;
			{
				gboolean _tmp52_ = FALSE;
				_tmp52_ = TRUE;
				while (TRUE) {
					gfloat* _tmp54_;
					gint _tmp54__length1;
					gfloat* _tmp55_;
					gint _tmp55__length1;
					gfloat* _tmp56_;
					gint _tmp56__length1;
					gfloat _tmp57_;
					if (!_tmp52_) {
						gint _tmp53_;
						_tmp53_ = tick_index;
						tick_index = _tmp53_ + 1;
					}
					_tmp52_ = FALSE;
					_tmp54_ = _vala_ticks;
					_tmp54__length1 = _vala_ticks_length1;
					if (!(tick_index < _tmp54__length1)) {
						break;
					}
					_tmp55_ = _vala_ticks;
					_tmp55__length1 = _vala_ticks_length1;
					_tmp56_ = tick_values;
					_tmp56__length1 = tick_values_length1;
					_tmp57_ = _tmp56_[(tick_index * best_stride) + best_offset];
					_tmp55_[tick_index] += _tmp57_;
				}
			}
		}
	} else {
		gfloat* _tmp58_;
		gfloat* _tmp59_;
		gint _tmp59__length1;
		gfloat* _tmp60_;
		gint _tmp60__length1;
		gfloat* _tmp61_;
		gint _tmp61__length1;
		gfloat _tmp62_;
		g_warning ("chart-axis.vala:342: Could not determine axis ticks for range %f to %f" \
" and spacing %f", (gdouble) value_from, (gdouble) value_to, (gdouble) value_spacing);
		_tmp58_ = g_new0 (gfloat, 2);
		_vala_ticks = (g_free (_vala_ticks), NULL);
		_vala_ticks = _tmp58_;
		_vala_ticks_length1 = 2;
		_vala_label_width = 0;
		_vala_label_height = 0;
		_tmp59_ = _vala_ticks;
		_tmp59__length1 = _vala_ticks_length1;
		_tmp59_[0] = (roundf ((value_from - origin_value) / value_spacing) * value_spacing) + origin_value;
		_tmp60_ = _vala_ticks;
		_tmp60__length1 = _vala_ticks_length1;
		_tmp61_ = _vala_ticks;
		_tmp61__length1 = _vala_ticks_length1;
		_tmp62_ = _tmp61_[0];
		_tmp60_[1] = _tmp62_ + value_spacing;
		{
			gint tick_index = 0;
			tick_index = 0;
			{
				gboolean _tmp63_ = FALSE;
				_tmp63_ = TRUE;
				while (TRUE) {
					gfloat* _tmp65_;
					gint _tmp65__length1;
					gchar* tick_label = NULL;
					gfloat* _tmp66_;
					gint _tmp66__length1;
					gfloat _tmp67_;
					gchar* _tmp68_;
					gint tmp_label_width = 0;
					gint tmp_label_height = 0;
					PangoLayout* _tmp69_;
					const gchar* _tmp70_;
					const gchar* _tmp71_;
					gint _tmp72_;
					gint _tmp73_;
					PangoLayout* _tmp74_;
					gint _tmp75_ = 0;
					gint _tmp76_ = 0;
					if (!_tmp63_) {
						gint _tmp64_;
						_tmp64_ = tick_index;
						tick_index = _tmp64_ + 1;
					}
					_tmp63_ = FALSE;
					_tmp65_ = _vala_ticks;
					_tmp65__length1 = _vala_ticks_length1;
					if (!(tick_index < _tmp65__length1)) {
						break;
					}
					_tmp66_ = _vala_ticks;
					_tmp66__length1 = _vala_ticks_length1;
					_tmp67_ = _tmp66_[tick_index];
					_tmp68_ = ft_chart_axis_format_value (self, _tmp67_);
					tick_label = _tmp68_;
					tmp_label_width = 0;
					tmp_label_height = 0;
					_tmp69_ = layout;
					_tmp70_ = tick_label;
					_tmp71_ = tick_label;
					_tmp72_ = strlen (_tmp71_);
					_tmp73_ = _tmp72_;
					pango_layout_set_text (_tmp69_, _tmp70_, _tmp73_);
					_tmp74_ = layout;
					pango_layout_get_pixel_size (_tmp74_, &_tmp75_, &_tmp76_);
					tmp_label_width = _tmp75_;
					tmp_label_height = _tmp76_;
					_vala_label_width = MAX (_vala_label_width, tmp_label_width);
					_vala_label_height = MAX (_vala_label_height, tmp_label_height);
					_g_free0 (tick_label);
				}
			}
		}
	}
	label_sizes = (g_free (label_sizes), NULL);
	_g_object_unref0 (layout);
	_g_object_unref0 (context);
	tick_values = (g_free (tick_values), NULL);
	if (ticks) {
		*ticks = _vala_ticks;
	} else {
		_vala_ticks = (g_free (_vala_ticks), NULL);
	}
	if (ticks_length1) {
		*ticks_length1 = _vala_ticks_length1;
	}
	if (label_width) {
		*label_width = _vala_label_width;
	}
	if (label_height) {
		*label_height = _vala_label_height;
	}
}

void
ft_chart_axis_set_format_value_func (FtChartAxis* self,
                                     FtFormatValueFunc func,
                                     gpointer func_target,
                                     GDestroyNotify func_target_destroy_notify)
{
	FtFormatValueFunc _tmp0_;
	gpointer _tmp0__target;
	GDestroyNotify _tmp0__target_destroy_notify;
	g_return_if_fail (self != NULL);
	_tmp0_ = func;
	_tmp0__target = func_target;
	_tmp0__target_destroy_notify = func_target_destroy_notify;
	func = NULL;
	func_target = NULL;
	func_target_destroy_notify = NULL;
	(self->priv->format_value_func_target_destroy_notify == NULL) ? NULL : (self->priv->format_value_func_target_destroy_notify (self->priv->format_value_func_target), NULL);
	self->priv->format_value_func = NULL;
	self->priv->format_value_func_target = NULL;
	self->priv->format_value_func_target_destroy_notify = NULL;
	self->priv->format_value_func = _tmp0_;
	self->priv->format_value_func_target = _tmp0__target;
	self->priv->format_value_func_target_destroy_notify = _tmp0__target_destroy_notify;
	gtk_widget_queue_resize ((GtkWidget*) self);
	(func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
	func = NULL;
	func_target = NULL;
	func_target_destroy_notify = NULL;
}

/**
         * Determine displayed value range calculate ticks.
         */
void
ft_chart_axis_configure (FtChartAxis* self,
                         gfloat value_from,
                         gfloat value_to,
                         gfloat value_spacing,
                         gint available_size)
{
	gfloat* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	gfloat* _tmp4_;
	gint _tmp4__length1;
	gfloat _tmp5_;
	gfloat* _tmp6_;
	gint _tmp6__length1;
	gfloat* _tmp7_;
	gint _tmp7__length1;
	gfloat _tmp8_;
	g_return_if_fail (self != NULL);
	ft_chart_axis_calculate_ticks (self, value_from, value_to, value_spacing, available_size, &_tmp0_, &_tmp1_, &_tmp2_, &_tmp3_);
	self->priv->ticks = (g_free (self->priv->ticks), NULL);
	self->priv->ticks = _tmp0_;
	self->priv->ticks_length1 = _tmp1_;
	self->priv->_ticks_size_ = self->priv->ticks_length1;
	self->label_width = _tmp2_;
	self->label_height = _tmp3_;
	_tmp4_ = self->priv->ticks;
	_tmp4__length1 = self->priv->ticks_length1;
	_tmp5_ = _tmp4_[0];
	self->priv->_value_from = MIN (_tmp5_, value_from);
	_tmp6_ = self->priv->ticks;
	_tmp6__length1 = self->priv->ticks_length1;
	_tmp7_ = self->priv->ticks;
	_tmp7__length1 = self->priv->ticks_length1;
	_tmp8_ = _tmp6_[_tmp7__length1 - 1];
	self->priv->_value_to = MAX (_tmp8_, value_to);
	g_signal_emit (self, ft_chart_axis_signals[FT_CHART_AXIS_CONFIGURED_SIGNAL], 0);
	gtk_widget_queue_resize ((GtkWidget*) self);
}

static gfloat*
_vala_array_dup2 (gfloat* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (gfloat));
	}
	return NULL;
}

gfloat*
ft_chart_axis_get_ticks (FtChartAxis* self,
                         gint* result_length1)
{
	gfloat* _tmp0_;
	gint _tmp0__length1;
	gfloat* _tmp1_;
	gint _tmp1__length1;
	gfloat* _tmp2_;
	gint _tmp2__length1;
	gfloat* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->ticks;
	_tmp0__length1 = self->priv->ticks_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup2 (_tmp0_, _tmp0__length1) : _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static Block7Data*
block7_data_ref (Block7Data* _data7_)
{
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}

static void
block7_data_unref (void * _userdata_)
{
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		FtChartAxis* self;
		self = _data7_->self;
		g_weak_ref_clear (&_data7_->weak_clone);
		_g_object_unref0 (self);
		g_slice_free (Block7Data, _data7_);
	}
}

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 gchar*
__lambda7_ (Block7Data* _data7_,
            gdouble value)
{
	FtChartAxis* self;
	gchar* _tmp0_ = NULL;
	FtFormatValueFunc _tmp1_;
	gpointer _tmp1__target;
	gchar* _tmp5_;
	gchar* result;
	self = _data7_->self;
	_tmp1_ = _data7_->_self_->priv->format_value_func;
	_tmp1__target = _data7_->_self_->priv->format_value_func_target;
	if (_tmp1_ != NULL) {
		FtFormatValueFunc _tmp2_;
		gpointer _tmp2__target;
		gchar* _tmp3_;
		_tmp2_ = _data7_->_self_->priv->format_value_func;
		_tmp2__target = _data7_->_self_->priv->format_value_func_target;
		_tmp3_ = _tmp2_ (value, _tmp2__target);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp3_;
	} else {
		gchar* _tmp4_;
		_tmp4_ = double_to_string (value);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp4_;
	}
	_tmp5_ = _tmp0_;
	_tmp0_ = NULL;
	result = _tmp5_;
	_g_free0 (_tmp0_);
	return result;
}

static gchar*
___lambda7__ft_format_value_func (gdouble value,
                                  gpointer self)
{
	gchar* result;
	result = __lambda7_ (self, value);
	return result;
}

static gfloat*
_vala_array_dup3 (gfloat* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (gfloat));
	}
	return NULL;
}

static void
__lambda8_ (Block7Data* _data7_)
{
	FtChartAxis* self;
	FtChartAxis* _clone = NULL;
	GObject* _tmp0_;
	FtChartAxis* _tmp1_;
	self = _data7_->self;
	_tmp0_ = g_weak_ref_get (&_data7_->weak_clone);
	_clone = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, FT_TYPE_CHART_AXIS, FtChartAxis);
	_tmp1_ = _clone;
	if (_tmp1_ != NULL) {
		FtChartAxis* _tmp2_;
		FtChartAxis* _tmp3_;
		FtChartAxis* _tmp4_;
		FtChartAxis* _tmp5_;
		gfloat* _tmp6_;
		gint _tmp6__length1;
		gfloat* _tmp7_;
		gint _tmp7__length1;
		_tmp2_ = _clone;
		_tmp2_->priv->_value_to = _data7_->_self_->priv->_value_to;
		_tmp3_ = _clone;
		_tmp3_->label_width = _data7_->_self_->label_width;
		_tmp4_ = _clone;
		_tmp4_->label_height = _data7_->_self_->label_height;
		_tmp5_ = _clone;
		_tmp6_ = _data7_->_self_->priv->ticks;
		_tmp6__length1 = _data7_->_self_->priv->ticks_length1;
		_tmp7_ = (_tmp6_ != NULL) ? _vala_array_dup3 (_tmp6_, _tmp6__length1) : _tmp6_;
		_tmp7__length1 = _tmp6__length1;
		_tmp5_->priv->ticks = (g_free (_tmp5_->priv->ticks), NULL);
		_tmp5_->priv->ticks = _tmp7_;
		_tmp5_->priv->ticks_length1 = _tmp7__length1;
		_tmp5_->priv->_ticks_size_ = _tmp5_->priv->ticks_length1;
	}
	_g_object_unref0 (_clone);
}

static void
___lambda8__ft_chart_axis_configured (FtChartAxis* _sender,
                                      gpointer self)
{
	__lambda8_ (self);
}

static void
__lambda9_ (Block7Data* _data7_)
{
	FtChartAxis* self;
	FtChartAxis* _clone = NULL;
	GObject* _tmp0_;
	FtChartAxis* _tmp1_;
	gboolean _tmp3_ = FALSE;
	FtChartAxis* _tmp4_;
	self = _data7_->self;
	_tmp0_ = g_weak_ref_get (&_data7_->weak_clone);
	_clone = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, FT_TYPE_CHART_AXIS, FtChartAxis);
	_tmp1_ = _clone;
	if (_tmp1_ != NULL) {
		FtChartAxis* _tmp2_;
		_tmp2_ = _clone;
		ft_chart_axis_set_format_value_func (_tmp2_, NULL, NULL, NULL);
	}
	_tmp4_ = _clone;
	if (_tmp4_ != NULL) {
		_tmp3_ = _data7_->clone_destroy_id != ((gulong) 0);
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		FtChartAxis* _tmp5_;
		_tmp5_ = _clone;
		g_signal_handler_disconnect ((GObject*) _tmp5_, _data7_->clone_destroy_id);
		_data7_->clone_destroy_id = (gulong) 0;
	}
	if (_data7_->configured_id != ((gulong) 0)) {
		g_signal_handler_disconnect ((GObject*) _data7_->_self_, _data7_->configured_id);
		_data7_->configured_id = (gulong) 0;
	}
	if (_data7_->destroy_id != ((gulong) 0)) {
		g_signal_handler_disconnect ((GObject*) _data7_->_self_, _data7_->destroy_id);
		_data7_->destroy_id = (gulong) 0;
	}
	_g_object_unref0 (_clone);
}

static void
___lambda9__gtk_widget_destroy (GtkWidget* _sender,
                                gpointer self)
{
	__lambda9_ (self);
}

static void
__lambda10_ (Block7Data* _data7_)
{
	FtChartAxis* self;
	FtChartAxis* _clone = NULL;
	GObject* _tmp0_;
	FtChartAxis* _tmp1_;
	gboolean _tmp3_ = FALSE;
	FtChartAxis* _tmp4_;
	self = _data7_->self;
	_tmp0_ = g_weak_ref_get (&_data7_->weak_clone);
	_clone = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, FT_TYPE_CHART_AXIS, FtChartAxis);
	_tmp1_ = _clone;
	if (_tmp1_ != NULL) {
		FtChartAxis* _tmp2_;
		_tmp2_ = _clone;
		ft_chart_axis_set_format_value_func (_tmp2_, NULL, NULL, NULL);
	}
	_tmp4_ = _clone;
	if (_tmp4_ != NULL) {
		_tmp3_ = _data7_->clone_destroy_id != ((gulong) 0);
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		FtChartAxis* _tmp5_;
		_tmp5_ = _clone;
		g_signal_handler_disconnect ((GObject*) _tmp5_, _data7_->clone_destroy_id);
		_data7_->clone_destroy_id = (gulong) 0;
	}
	if (_data7_->configured_id != ((gulong) 0)) {
		g_signal_handler_disconnect ((GObject*) _data7_->_self_, _data7_->configured_id);
		_data7_->configured_id = (gulong) 0;
	}
	if (_data7_->destroy_id != ((gulong) 0)) {
		g_signal_handler_disconnect ((GObject*) _data7_->_self_, _data7_->destroy_id);
		_data7_->destroy_id = (gulong) 0;
	}
	_g_object_unref0 (_clone);
}

static void
___lambda10__gtk_widget_destroy (GtkWidget* _sender,
                                 gpointer self)
{
	__lambda10_ (self);
}

FtChartAxis*
ft_chart_axis_detach (FtChartAxis* self)
{
	Block7Data* _data7_;
	FtChartAxis* clone = NULL;
	GObject* _tmp0_;
	GObject* _tmp1_;
	guint initial_ref_count = 0U;
	gulong _tmp2_;
	gulong _tmp3_;
	gulong _tmp4_;
	FtChartAxis* result;
	g_return_val_if_fail (self != NULL, NULL);
	_data7_ = g_slice_new0 (Block7Data);
	_data7_->_ref_count_ = 1;
	_data7_->self = g_object_ref (self);
	_tmp0_ = g_object_new (FT_TYPE_CHART_AXIS, "orientation", self->priv->_orientation, NULL);
	_tmp1_ = G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_;
	clone = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, FT_TYPE_CHART_AXIS, FtChartAxis);
	initial_ref_count = ((GObject*) self)->ref_count;
	_data7_->_self_ = self;
	g_weak_ref_init (&_data7_->weak_clone, (GObject*) clone);
	_data7_->configured_id = (gulong) 0;
	_data7_->destroy_id = (gulong) 0;
	_data7_->clone_destroy_id = (gulong) 0;
	ft_chart_axis_set_format_value_func (clone, ___lambda7__ft_format_value_func, block7_data_ref (_data7_), block7_data_unref);
	g_object_bind_property_with_closures ((GObject*) self, "scale", (GObject*) clone, "scale", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	g_object_bind_property_with_closures ((GObject*) self, "text-offset", (GObject*) clone, "text-offset", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	g_object_bind_property_with_closures ((GObject*) self, "origin", (GObject*) clone, "origin", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp2_ = g_signal_connect_data (self, "configured", (GCallback) ___lambda8__ft_chart_axis_configured, block7_data_ref (_data7_), (GClosureNotify) block7_data_unref, 0);
	_data7_->configured_id = _tmp2_;
	_tmp3_ = g_signal_connect_data ((GtkWidget*) self, "destroy", (GCallback) ___lambda9__gtk_widget_destroy, block7_data_ref (_data7_), (GClosureNotify) block7_data_unref, 0);
	_data7_->destroy_id = _tmp3_;
	_tmp4_ = g_signal_connect_data ((GtkWidget*) clone, "destroy", (GCallback) ___lambda10__gtk_widget_destroy, block7_data_ref (_data7_), (GClosureNotify) block7_data_unref, 0);
	_data7_->clone_destroy_id = _tmp4_;
	gtk_widget_set_visible ((GtkWidget*) self, FALSE);
	_vala_assert (((GObject*) self)->ref_count == initial_ref_count, "this.ref_count == initial_ref_count");
	result = clone;
	block7_data_unref (_data7_);
	_data7_ = NULL;
	return result;
}

inline gboolean
ft_chart_axis_is_detached (FtChartAxis* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = gtk_widget_get_visible ((GtkWidget*) self);
	_tmp1_ = _tmp0_;
	result = !_tmp1_;
	return result;
}

static GtkSizeRequestMode
ft_chart_axis_real_get_request_mode (GtkWidget* base)
{
	FtChartAxis * self;
	GtkSizeRequestMode result;
	self = (FtChartAxis*) base;
	result = GTK_SIZE_REQUEST_CONSTANT_SIZE;
	return result;
}

static void
ft_chart_axis_real_measure (GtkWidget* base,
                            GtkOrientation orientation,
                            gint for_size,
                            gint* minimum,
                            gint* natural,
                            gint* minimum_baseline,
                            gint* natural_baseline)
{
	FtChartAxis * self;
	gint _vala_minimum = 0;
	gint _vala_natural = 0;
	gint _vala_minimum_baseline = 0;
	gint _vala_natural_baseline = 0;
	gint _tmp0_ = 0;
	gint label_size = 0;
	gint _tmp1_ = 0;
	self = (FtChartAxis*) base;
	if (orientation == GTK_ORIENTATION_HORIZONTAL) {
		_tmp0_ = self->label_width;
	} else {
		_tmp0_ = self->label_height;
	}
	label_size = _tmp0_;
	if (self->priv->_orientation == orientation) {
		gint _tmp2_;
		gint _tmp3_;
		_tmp2_ = ft_chart_axis_get_origin (self);
		_tmp3_ = _tmp2_;
		_tmp1_ = (label_size / 2) + _tmp3_;
	} else {
		gint _tmp4_;
		gint _tmp5_;
		_tmp4_ = ft_chart_axis_get_text_offset (self);
		_tmp5_ = _tmp4_;
		_tmp1_ = label_size + _tmp5_;
	}
	_vala_natural = _tmp1_;
	_vala_minimum = _vala_natural;
	_vala_minimum_baseline = -1;
	_vala_natural_baseline = -1;
	if (minimum) {
		*minimum = _vala_minimum;
	}
	if (natural) {
		*natural = _vala_natural;
	}
	if (minimum_baseline) {
		*minimum_baseline = _vala_minimum_baseline;
	}
	if (natural_baseline) {
		*natural_baseline = _vala_natural_baseline;
	}
}

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

static void
ft_chart_axis_real_size_allocate (GtkWidget* base,
                                  gint width,
                                  gint height,
                                  gint baseline)
{
	FtChartAxis * self;
	PangoContext* context = NULL;
	PangoContext* _tmp0_;
	PangoAlignment text_alignment = 0;
	gfloat* _tmp1_;
	gint _tmp1__length1;
	PangoLayout** _tmp2_;
	self = (FtChartAxis*) base;
	_tmp0_ = gtk_widget_create_pango_context ((GtkWidget*) self);
	context = _tmp0_;
	text_alignment = ft_chart_axis_get_text_alignment (self);
	_tmp1_ = self->priv->ticks;
	_tmp1__length1 = self->priv->ticks_length1;
	_tmp2_ = g_new0 (PangoLayout*, _tmp1__length1 + 1);
	self->priv->layouts = (_vala_array_free (self->priv->layouts, self->priv->layouts_length1, (GDestroyNotify) g_object_unref), NULL);
	self->priv->layouts = _tmp2_;
	self->priv->layouts_length1 = _tmp1__length1;
	self->priv->_layouts_size_ = self->priv->layouts_length1;
	{
		gint tick_index = 0;
		tick_index = 0;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				gfloat* _tmp5_;
				gint _tmp5__length1;
				gfloat tick_value = 0.0F;
				gfloat* _tmp6_;
				gint _tmp6__length1;
				gfloat _tmp7_;
				gchar* tick_label = NULL;
				gchar* _tmp8_;
				PangoLayout* layout = NULL;
				PangoContext* _tmp9_;
				PangoLayout* _tmp10_;
				PangoLayout* _tmp11_;
				PangoLayout* _tmp12_;
				PangoLayout* _tmp13_;
				PangoLayout* _tmp14_;
				PangoLayout* _tmp15_;
				const gchar* _tmp16_;
				const gchar* _tmp17_;
				gint _tmp18_;
				gint _tmp19_;
				PangoLayout** _tmp20_;
				gint _tmp20__length1;
				PangoLayout* _tmp21_;
				PangoLayout* _tmp22_;
				if (!_tmp3_) {
					gint _tmp4_;
					_tmp4_ = tick_index;
					tick_index = _tmp4_ + 1;
				}
				_tmp3_ = FALSE;
				_tmp5_ = self->priv->ticks;
				_tmp5__length1 = self->priv->ticks_length1;
				if (!(tick_index < _tmp5__length1)) {
					break;
				}
				_tmp6_ = self->priv->ticks;
				_tmp6__length1 = self->priv->ticks_length1;
				_tmp7_ = _tmp6_[tick_index];
				tick_value = _tmp7_;
				_tmp8_ = ft_chart_axis_format_value (self, tick_value);
				tick_label = _tmp8_;
				_tmp9_ = context;
				_tmp10_ = pango_layout_new (_tmp9_);
				layout = _tmp10_;
				_tmp11_ = layout;
				pango_layout_set_width (_tmp11_, self->label_width * PANGO_SCALE);
				_tmp12_ = layout;
				pango_layout_set_alignment (_tmp12_, text_alignment);
				_tmp13_ = layout;
				pango_layout_set_ellipsize (_tmp13_, PANGO_ELLIPSIZE_NONE);
				_tmp14_ = layout;
				pango_layout_set_wrap (_tmp14_, PANGO_WRAP_WORD);
				_tmp15_ = layout;
				_tmp16_ = tick_label;
				_tmp17_ = tick_label;
				_tmp18_ = strlen (_tmp17_);
				_tmp19_ = _tmp18_;
				pango_layout_set_text (_tmp15_, _tmp16_, _tmp19_);
				_tmp20_ = self->priv->layouts;
				_tmp20__length1 = self->priv->layouts_length1;
				_tmp21_ = layout;
				_tmp22_ = _g_object_ref0 (_tmp21_);
				_g_object_unref0 (_tmp20_[tick_index]);
				_tmp20_[tick_index] = _tmp22_;
				_g_object_unref0 (layout);
				_g_free0 (tick_label);
			}
		}
	}
	_g_object_unref0 (context);
}

static void
ft_chart_axis_real_snapshot (GtkWidget* base,
                             GtkSnapshot* snapshot)
{
	FtChartAxis * self;
	gint tick_count = 0;
	gfloat* _tmp0_;
	gint _tmp0__length1;
	PangoLayout** _tmp1_;
	gint _tmp1__length1;
	gfloat* _tmp2_;
	gint _tmp2__length1;
	PangoLayout** _tmp3_;
	gint _tmp3__length1;
	GdkRGBA color = {0};
	GdkRGBA _tmp6_ = {0};
	gfloat _tmp7_ = 0.0F;
	gfloat scale = 0.0F;
	self = (FtChartAxis*) base;
	g_return_if_fail (snapshot != NULL);
	_tmp0_ = self->priv->ticks;
	_tmp0__length1 = self->priv->ticks_length1;
	_tmp1_ = self->priv->layouts;
	_tmp1__length1 = self->priv->layouts_length1;
	tick_count = MIN (_tmp0__length1, _tmp1__length1);
	_tmp2_ = self->priv->ticks;
	_tmp2__length1 = self->priv->ticks_length1;
	_tmp3_ = self->priv->layouts;
	_tmp3__length1 = self->priv->layouts_length1;
	if (_tmp2__length1 != _tmp3__length1) {
		PangoLayout** _tmp4_;
		gint _tmp4__length1;
		gfloat* _tmp5_;
		gint _tmp5__length1;
		_tmp4_ = self->priv->layouts;
		_tmp4__length1 = self->priv->layouts_length1;
		_tmp5_ = self->priv->ticks;
		_tmp5__length1 = self->priv->ticks_length1;
		g_warning ("chart-axis.vala:565: Number of layouts (%d) does not match the number " \
"of ticks (%d)", _tmp4__length1, _tmp5__length1);
	}
	gtk_widget_get_color ((GtkWidget*) self, &_tmp6_);
	color = _tmp6_;
	if (self->priv->_orientation == GTK_ORIENTATION_HORIZONTAL) {
		_tmp7_ = self->priv->_scale;
	} else {
		_tmp7_ = -self->priv->_scale;
	}
	scale = _tmp7_;
	{
		gint tick_index = 0;
		tick_index = 0;
		{
			gboolean _tmp8_ = FALSE;
			_tmp8_ = TRUE;
			while (TRUE) {
				gfloat tick_value = 0.0F;
				gfloat* _tmp10_;
				gint _tmp10__length1;
				gfloat _tmp11_;
				PangoLayout* layout = NULL;
				PangoLayout** _tmp12_;
				gint _tmp12__length1;
				PangoLayout* _tmp13_;
				gfloat layout_position = 0.0F;
				gfloat layout_offset = 0.0F;
				gfloat layout_width = 0.0F;
				gfloat layout_height = 0.0F;
				graphene_point_t layout_origin = {0};
				graphene_point_t _tmp16_;
				PangoLayout* _tmp17_;
				GdkRGBA _tmp18_;
				if (!_tmp8_) {
					gint _tmp9_;
					_tmp9_ = tick_index;
					tick_index = _tmp9_ + 1;
				}
				_tmp8_ = FALSE;
				if (!(tick_index < tick_count)) {
					break;
				}
				_tmp10_ = self->priv->ticks;
				_tmp10__length1 = self->priv->ticks_length1;
				_tmp11_ = _tmp10_[tick_index];
				tick_value = _tmp11_;
				_tmp12_ = self->priv->layouts;
				_tmp12__length1 = self->priv->layouts_length1;
				_tmp13_ = _tmp12_[tick_index];
				layout = _tmp13_;
				layout_position = ((gfloat) self->priv->_origin) + (tick_value * scale);
				layout_offset = (gfloat) self->priv->_text_offset;
				layout_width = (gfloat) self->label_width;
				layout_height = (gfloat) self->label_height;
				switch (self->priv->_orientation) {
					case GTK_ORIENTATION_HORIZONTAL:
					{
						graphene_point_t _tmp14_ = {0};
						memset (&_tmp14_, 0, sizeof (graphene_point_t));
						_tmp14_.x = layout_position - (layout_width / 2.0f);
						_tmp14_.y = layout_offset;
						layout_origin = _tmp14_;
						break;
					}
					case GTK_ORIENTATION_VERTICAL:
					{
						graphene_point_t _tmp15_ = {0};
						memset (&_tmp15_, 0, sizeof (graphene_point_t));
						_tmp15_.x = (((gfloat) gtk_widget_get_width ((GtkWidget*) self)) - layout_offset) - layout_width;
						_tmp15_.y = layout_position - (layout_height / 2.0f);
						layout_origin = _tmp15_;
						break;
					}
					default:
					{
						g_assert_not_reached ();
					}
				}
				gtk_snapshot_save (snapshot);
				_tmp16_ = layout_origin;
				gtk_snapshot_translate (snapshot, &_tmp16_);
				_tmp17_ = layout;
				_tmp18_ = color;
				gtk_snapshot_append_layout (snapshot, _tmp17_, &_tmp18_);
				gtk_snapshot_restore (snapshot);
			}
		}
	}
}

static void
ft_chart_axis_real_dispose (GObject* base)
{
	FtChartAxis * self;
	self = (FtChartAxis*) base;
	self->priv->ticks = (g_free (self->priv->ticks), NULL);
	self->priv->ticks = NULL;
	self->priv->ticks_length1 = 0;
	self->priv->_ticks_size_ = self->priv->ticks_length1;
	self->priv->layouts = (_vala_array_free (self->priv->layouts, self->priv->layouts_length1, (GDestroyNotify) g_object_unref), NULL);
	self->priv->layouts = NULL;
	self->priv->layouts_length1 = 0;
	self->priv->_layouts_size_ = self->priv->layouts_length1;
	(self->priv->format_value_func_target_destroy_notify == NULL) ? NULL : (self->priv->format_value_func_target_destroy_notify (self->priv->format_value_func_target), NULL);
	self->priv->format_value_func = NULL;
	self->priv->format_value_func_target = NULL;
	self->priv->format_value_func_target_destroy_notify = NULL;
	self->priv->format_value_func = NULL;
	self->priv->format_value_func_target = NULL;
	self->priv->format_value_func_target_destroy_notify = NULL;
	G_OBJECT_CLASS (ft_chart_axis_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
}

GtkOrientation
ft_chart_axis_get_orientation (FtChartAxis* self)
{
	GtkOrientation result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_orientation;
	return result;
}

static void
ft_chart_axis_set_orientation (FtChartAxis* self,
                               GtkOrientation value)
{
	g_return_if_fail (self != NULL);
	self->priv->_orientation = value;
	g_object_notify_by_pspec ((GObject *) self, ft_chart_axis_properties[FT_CHART_AXIS_ORIENTATION_PROPERTY]);
}

gfloat
ft_chart_axis_get_value_from (FtChartAxis* self)
{
	gfloat result;
	g_return_val_if_fail (self != NULL, -1.0F);
	result = self->priv->_value_from;
	return result;
}

gfloat
ft_chart_axis_get_value_to (FtChartAxis* self)
{
	gfloat result;
	g_return_val_if_fail (self != NULL, -1.0F);
	result = self->priv->_value_to;
	return result;
}

gfloat
ft_chart_axis_get_value_spacing (FtChartAxis* self)
{
	gfloat result;
	g_return_val_if_fail (self != NULL, -1.0F);
	result = self->priv->_value_spacing;
	return result;
}

gfloat
ft_chart_axis_get_scale (FtChartAxis* self)
{
	gfloat result;
	g_return_val_if_fail (self != NULL, -1.0F);
	result = self->priv->_scale;
	return result;
}

void
ft_chart_axis_set_scale (FtChartAxis* self,
                         gfloat value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_scale != value) {
		self->priv->_scale = value;
	}
	g_object_notify_by_pspec ((GObject *) self, ft_chart_axis_properties[FT_CHART_AXIS_SCALE_PROPERTY]);
}

gint
ft_chart_axis_get_text_offset (FtChartAxis* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_text_offset;
	return result;
}

void
ft_chart_axis_set_text_offset (FtChartAxis* self,
                               gint value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_text_offset != value) {
		self->priv->_text_offset = value;
	}
	g_object_notify_by_pspec ((GObject *) self, ft_chart_axis_properties[FT_CHART_AXIS_TEXT_OFFSET_PROPERTY]);
}

gboolean
ft_chart_axis_get_continous (FtChartAxis* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_continous;
	return result;
}

void
ft_chart_axis_set_continous (FtChartAxis* self,
                             gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_continous = value;
	gtk_widget_queue_resize ((GtkWidget*) self);
	g_object_notify_by_pspec ((GObject *) self, ft_chart_axis_properties[FT_CHART_AXIS_CONTINOUS_PROPERTY]);
}

gint
ft_chart_axis_get_origin (FtChartAxis* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_origin;
	return result;
}

void
ft_chart_axis_set_origin (FtChartAxis* self,
                          gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_origin = value;
	gtk_widget_queue_resize ((GtkWidget*) self);
	g_object_notify_by_pspec ((GObject *) self, ft_chart_axis_properties[FT_CHART_AXIS_ORIGIN_PROPERTY]);
}

static GObject *
ft_chart_axis_constructor (GType type,
                           guint n_construct_properties,
                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FtChartAxis * self;
	PangoLayout** _tmp0_;
	parent_class = G_OBJECT_CLASS (ft_chart_axis_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_CHART_AXIS, FtChartAxis);
	_tmp0_ = g_new0 (PangoLayout*, 0 + 1);
	self->priv->layouts = (_vala_array_free (self->priv->layouts, self->priv->layouts_length1, (GDestroyNotify) g_object_unref), NULL);
	self->priv->layouts = _tmp0_;
	self->priv->layouts_length1 = 0;
	self->priv->_layouts_size_ = self->priv->layouts_length1;
	return obj;
}

static void
ft_chart_axis_class_init (FtChartAxisClass * klass,
                          gpointer klass_data)
{
	ft_chart_axis_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtChartAxis_private_offset);
	((GtkWidgetClass *) klass)->get_request_mode = (GtkSizeRequestMode (*) (GtkWidget*)) ft_chart_axis_real_get_request_mode;
	((GtkWidgetClass *) klass)->measure = (void (*) (GtkWidget*, GtkOrientation, gint, gint*, gint*, gint*, gint*)) ft_chart_axis_real_measure;
	((GtkWidgetClass *) klass)->size_allocate = (void (*) (GtkWidget*, gint, gint, gint)) ft_chart_axis_real_size_allocate;
	((GtkWidgetClass *) klass)->snapshot = (void (*) (GtkWidget*, GtkSnapshot*)) ft_chart_axis_real_snapshot;
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) ft_chart_axis_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_chart_axis_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_chart_axis_set_property;
	G_OBJECT_CLASS (klass)->constructor = ft_chart_axis_constructor;
	G_OBJECT_CLASS (klass)->finalize = ft_chart_axis_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CHART_AXIS_ORIENTATION_PROPERTY, ft_chart_axis_properties[FT_CHART_AXIS_ORIENTATION_PROPERTY] = g_param_spec_enum ("orientation", "orientation", "orientation", gtk_orientation_get_type (), 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CHART_AXIS_VALUE_FROM_PROPERTY, ft_chart_axis_properties[FT_CHART_AXIS_VALUE_FROM_PROPERTY] = g_param_spec_float ("value-from", "value-from", "value-from", -G_MAXFLOAT, G_MAXFLOAT, 0.0F, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CHART_AXIS_VALUE_TO_PROPERTY, ft_chart_axis_properties[FT_CHART_AXIS_VALUE_TO_PROPERTY] = g_param_spec_float ("value-to", "value-to", "value-to", -G_MAXFLOAT, G_MAXFLOAT, 0.0F, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CHART_AXIS_VALUE_SPACING_PROPERTY, ft_chart_axis_properties[FT_CHART_AXIS_VALUE_SPACING_PROPERTY] = g_param_spec_float ("value-spacing", "value-spacing", "value-spacing", -G_MAXFLOAT, G_MAXFLOAT, 0.0F, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CHART_AXIS_SCALE_PROPERTY, ft_chart_axis_properties[FT_CHART_AXIS_SCALE_PROPERTY] = g_param_spec_float ("scale", "scale", "scale", -G_MAXFLOAT, G_MAXFLOAT, 0.0F, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CHART_AXIS_TEXT_OFFSET_PROPERTY, ft_chart_axis_properties[FT_CHART_AXIS_TEXT_OFFSET_PROPERTY] = g_param_spec_int ("text-offset", "text-offset", "text-offset", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CHART_AXIS_CONTINOUS_PROPERTY, ft_chart_axis_properties[FT_CHART_AXIS_CONTINOUS_PROPERTY] = g_param_spec_boolean ("continous", "continous", "continous", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CHART_AXIS_ORIGIN_PROPERTY, ft_chart_axis_properties[FT_CHART_AXIS_ORIGIN_PROPERTY] = g_param_spec_int ("origin", "origin", "origin", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	ft_chart_axis_signals[FT_CHART_AXIS_CONFIGURED_SIGNAL] = g_signal_new ("configured", FT_TYPE_CHART_AXIS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (klass), "chartaxis");
}

static void
ft_chart_axis_instance_init (FtChartAxis * self,
                             gpointer klass)
{
	self->priv = ft_chart_axis_get_instance_private (self);
	self->priv->_orientation = GTK_ORIENTATION_HORIZONTAL;
	self->priv->_value_from = 0.0f;
	self->priv->_value_to = 1.0f;
	self->priv->_value_spacing = 1.0f;
	self->priv->_scale = 1.0f;
	self->priv->_text_offset = 0;
	self->priv->_continous = TRUE;
	self->priv->_origin = 0;
	self->priv->ticks = NULL;
	self->priv->ticks_length1 = 0;
	self->priv->_ticks_size_ = self->priv->ticks_length1;
	self->priv->layouts = NULL;
	self->priv->layouts_length1 = 0;
	self->priv->_layouts_size_ = self->priv->layouts_length1;
	self->priv->format_value_func = NULL;
	self->priv->format_value_func_target = NULL;
	self->priv->format_value_func_target_destroy_notify = NULL;
}

static void
ft_chart_axis_finalize (GObject * obj)
{
	FtChartAxis * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_CHART_AXIS, FtChartAxis);
	self->priv->ticks = (g_free (self->priv->ticks), NULL);
	self->priv->layouts = (_vala_array_free (self->priv->layouts, self->priv->layouts_length1, (GDestroyNotify) g_object_unref), NULL);
	(self->priv->format_value_func_target_destroy_notify == NULL) ? NULL : (self->priv->format_value_func_target_destroy_notify (self->priv->format_value_func_target), NULL);
	self->priv->format_value_func = NULL;
	self->priv->format_value_func_target = NULL;
	self->priv->format_value_func_target_destroy_notify = NULL;
	G_OBJECT_CLASS (ft_chart_axis_parent_class)->finalize (obj);
}

static GType
ft_chart_axis_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtChartAxisClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_chart_axis_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtChartAxis), 0, (GInstanceInitFunc) ft_chart_axis_instance_init, NULL };
	GType ft_chart_axis_type_id;
	ft_chart_axis_type_id = g_type_register_static (gtk_widget_get_type (), "FtChartAxis", &g_define_type_info, 0);
	FtChartAxis_private_offset = g_type_add_instance_private (ft_chart_axis_type_id, sizeof (FtChartAxisPrivate));
	return ft_chart_axis_type_id;
}

GType
ft_chart_axis_get_type (void)
{
	static volatile gsize ft_chart_axis_type_id__once = 0;
	if (g_once_init_enter (&ft_chart_axis_type_id__once)) {
		GType ft_chart_axis_type_id;
		ft_chart_axis_type_id = ft_chart_axis_get_type_once ();
		g_once_init_leave (&ft_chart_axis_type_id__once, ft_chart_axis_type_id);
	}
	return ft_chart_axis_type_id__once;
}

static void
_vala_ft_chart_axis_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	FtChartAxis * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_CHART_AXIS, FtChartAxis);
	switch (property_id) {
		case FT_CHART_AXIS_ORIENTATION_PROPERTY:
		g_value_set_enum (value, ft_chart_axis_get_orientation (self));
		break;
		case FT_CHART_AXIS_VALUE_FROM_PROPERTY:
		g_value_set_float (value, ft_chart_axis_get_value_from (self));
		break;
		case FT_CHART_AXIS_VALUE_TO_PROPERTY:
		g_value_set_float (value, ft_chart_axis_get_value_to (self));
		break;
		case FT_CHART_AXIS_VALUE_SPACING_PROPERTY:
		g_value_set_float (value, ft_chart_axis_get_value_spacing (self));
		break;
		case FT_CHART_AXIS_SCALE_PROPERTY:
		g_value_set_float (value, ft_chart_axis_get_scale (self));
		break;
		case FT_CHART_AXIS_TEXT_OFFSET_PROPERTY:
		g_value_set_int (value, ft_chart_axis_get_text_offset (self));
		break;
		case FT_CHART_AXIS_CONTINOUS_PROPERTY:
		g_value_set_boolean (value, ft_chart_axis_get_continous (self));
		break;
		case FT_CHART_AXIS_ORIGIN_PROPERTY:
		g_value_set_int (value, ft_chart_axis_get_origin (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_chart_axis_set_property (GObject * object,
                                  guint property_id,
                                  const GValue * value,
                                  GParamSpec * pspec)
{
	FtChartAxis * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_CHART_AXIS, FtChartAxis);
	switch (property_id) {
		case FT_CHART_AXIS_ORIENTATION_PROPERTY:
		ft_chart_axis_set_orientation (self, g_value_get_enum (value));
		break;
		case FT_CHART_AXIS_SCALE_PROPERTY:
		ft_chart_axis_set_scale (self, g_value_get_float (value));
		break;
		case FT_CHART_AXIS_TEXT_OFFSET_PROPERTY:
		ft_chart_axis_set_text_offset (self, g_value_get_int (value));
		break;
		case FT_CHART_AXIS_CONTINOUS_PROPERTY:
		ft_chart_axis_set_continous (self, g_value_get_boolean (value));
		break;
		case FT_CHART_AXIS_ORIGIN_PROPERTY:
		ft_chart_axis_set_origin (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

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

