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

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

#include "ft_ui.h"
#include <glib.h>
#include <float.h>
#include <math.h>
#include <gtk/gtk.h>
#include <glib-object.h>
#include <string.h>

#define FT_LOG_SCALE_BINDING_FLAGS ((G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE) | G_BINDING_BIDIRECTIONAL)
#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_LOG_SCALE_0_PROPERTY,
	FT_LOG_SCALE_VALUE_PROPERTY,
	FT_LOG_SCALE_ADJUSTMENT_PROPERTY,
	FT_LOG_SCALE_NUM_PROPERTIES
};
static GParamSpec* ft_log_scale_properties[FT_LOG_SCALE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _FtLogScalePrivate {
	gdouble _value;
	GtkAdjustment* _adjustment;
	GBinding* value_binding;
	gulong adjustment_value_changed_id;
};

static gint FtLogScale_private_offset;
static gpointer ft_log_scale_parent_class = NULL;

static gdouble ft_log_scale_round_seconds (FtLogScale* self,
                                    gdouble seconds);
static gdouble ft_log_scale_get_step_size (FtLogScale* self,
                                    gdouble seconds);
static inline gdouble ft_log_scale_func (FtLogScale* self,
                           gdouble x);
static inline gdouble ft_log_scale_func_inv (FtLogScale* self,
                               gdouble y);
static gboolean ft_log_scale_transform_from (FtLogScale* self,
                                      GBinding* binding,
                                      GValue* source_value,
                                      GValue* target_value);
static gboolean ft_log_scale_transform_to (FtLogScale* self,
                                    GBinding* binding,
                                    GValue* source_value,
                                    GValue* target_value);
static void ft_log_scale_on_adjustment_value_changed (FtLogScale* self);
static void ft_log_scale_set_value (FtLogScale* self,
                             gdouble value);
static void ft_log_scale_real_dispose (GObject* base);
static gboolean _ft_log_scale_transform_to_gbinding_transform_func (GBinding* binding,
                                                             GValue* from_value,
                                                             GValue* to_value,
                                                             gpointer self);
static gboolean _ft_log_scale_transform_from_gbinding_transform_func (GBinding* binding,
                                                               GValue* from_value,
                                                               GValue* to_value,
                                                               gpointer self);
static void _ft_log_scale_on_adjustment_value_changed_gtk_adjustment_value_changed (GtkAdjustment* _sender,
                                                                             gpointer self);
static GObject * ft_log_scale_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties);
static void ft_log_scale_finalize (GObject * obj);
static GType ft_log_scale_get_type_once (void);
static void _vala_ft_log_scale_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec);
static void _vala_ft_log_scale_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
ft_log_scale_get_instance_private (FtLogScale* self)
{
	return G_STRUCT_MEMBER_P (self, FtLogScale_private_offset);
}

FtLogScale*
ft_log_scale_construct (GType object_type)
{
	FtLogScale * self = NULL;
	self = (FtLogScale*) g_object_new (object_type, "orientation", GTK_ORIENTATION_HORIZONTAL, "digits", -1, "draw-value", FALSE, NULL);
	return self;
}

FtLogScale*
ft_log_scale_new (void)
{
	return ft_log_scale_construct (FT_TYPE_LOG_SCALE);
}

/**
         * Round seconds to 30s, 1m, 5m, 10m.
         *
         * Its intended for settings only to have a rounded number.
         */
static gdouble
ft_log_scale_round_seconds (FtLogScale* self,
                            gdouble seconds)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	if (seconds < 60.0) {
		result = 30.0 * round (seconds / 30.0);
		return result;
	}
	if (seconds < 1800.0) {
		result = 60.0 * round (seconds / 60.0);
		return result;
	}
	if (seconds < 3600.0) {
		result = 300.0 * round (seconds / 300.0);
		return result;
	}
	result = 600.0 * round (seconds / 600.0);
	return result;
}

static gdouble
ft_log_scale_get_step_size (FtLogScale* self,
                            gdouble seconds)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	if (seconds < 60.0) {
		result = 30.0;
		return result;
	}
	if (seconds < 1800.0) {
		result = 60.0;
		return result;
	}
	if (seconds < 3600.0) {
		result = 300.0;
		return result;
	}
	result = 600.0;
	return result;
}

static inline gdouble
ft_log_scale_func (FtLogScale* self,
                   gdouble x)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = exp (x) - 1.0;
	return result;
}

static inline gdouble
ft_log_scale_func_inv (FtLogScale* self,
                       gdouble y)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = log (y + 1.0);
	return result;
}

/**
         * Convert inner adjustment to destination values (seconds).
         */
static gboolean
ft_log_scale_transform_from (FtLogScale* self,
                             GBinding* binding,
                             GValue* source_value,
                             GValue* target_value)
{
	gdouble seconds_lower = 0.0;
	GtkAdjustment* _tmp0_;
	gdouble _tmp1_;
	gdouble _tmp2_;
	gdouble seconds_upper = 0.0;
	GtkAdjustment* _tmp3_;
	gdouble _tmp4_;
	gdouble _tmp5_;
	gdouble base_upper = 0.0;
	GtkAdjustment* _tmp6_;
	GtkAdjustment* _tmp7_;
	gdouble _tmp8_;
	gdouble _tmp9_;
	gdouble base_value = 0.0;
	gdouble t = 0.0;
	gdouble seconds = 0.0;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (binding != NULL, FALSE);
	g_return_val_if_fail (source_value != NULL, FALSE);
	g_return_val_if_fail (target_value != NULL, FALSE);
	_tmp0_ = self->priv->_adjustment;
	_tmp1_ = gtk_adjustment_get_lower (_tmp0_);
	_tmp2_ = _tmp1_;
	seconds_lower = _tmp2_;
	_tmp3_ = self->priv->_adjustment;
	_tmp4_ = gtk_adjustment_get_upper (_tmp3_);
	_tmp5_ = _tmp4_;
	seconds_upper = _tmp5_;
	_tmp6_ = gtk_range_get_adjustment ((GtkRange*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_scale_get_type (), GtkScale));
	_tmp7_ = _tmp6_;
	_tmp8_ = gtk_adjustment_get_upper (_tmp7_);
	_tmp9_ = _tmp8_;
	base_upper = _tmp9_;
	base_value = g_value_get_double (source_value);
	t = ft_log_scale_func (self, base_value) / ft_log_scale_func (self, base_upper);
	seconds = (t * (seconds_upper - seconds_lower)) + seconds_lower;
	g_value_set_double (target_value, ft_log_scale_round_seconds (self, seconds));
	result = TRUE;
	return result;
}

/**
         * Convert outer adjustment (seconds) to inner adjustment.
         */
static gboolean
ft_log_scale_transform_to (FtLogScale* self,
                           GBinding* binding,
                           GValue* source_value,
                           GValue* target_value)
{
	gdouble seconds_lower = 0.0;
	GtkAdjustment* _tmp0_;
	gdouble _tmp1_;
	gdouble _tmp2_;
	gdouble seconds_upper = 0.0;
	GtkAdjustment* _tmp3_;
	gdouble _tmp4_;
	gdouble _tmp5_;
	gdouble base_upper = 0.0;
	GtkAdjustment* _tmp6_;
	GtkAdjustment* _tmp7_;
	gdouble _tmp8_;
	gdouble _tmp9_;
	gdouble seconds = 0.0;
	gdouble t = 0.0;
	gdouble base_value = 0.0;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (binding != NULL, FALSE);
	g_return_val_if_fail (source_value != NULL, FALSE);
	g_return_val_if_fail (target_value != NULL, FALSE);
	_tmp0_ = self->priv->_adjustment;
	_tmp1_ = gtk_adjustment_get_lower (_tmp0_);
	_tmp2_ = _tmp1_;
	seconds_lower = _tmp2_;
	_tmp3_ = self->priv->_adjustment;
	_tmp4_ = gtk_adjustment_get_upper (_tmp3_);
	_tmp5_ = _tmp4_;
	seconds_upper = _tmp5_;
	_tmp6_ = gtk_range_get_adjustment ((GtkRange*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_scale_get_type (), GtkScale));
	_tmp7_ = _tmp6_;
	_tmp8_ = gtk_adjustment_get_upper (_tmp7_);
	_tmp9_ = _tmp8_;
	base_upper = _tmp9_;
	seconds = g_value_get_double (source_value);
	t = (seconds - seconds_lower) / (seconds_upper - seconds_lower);
	base_value = ft_log_scale_func_inv (self, t * ft_log_scale_func (self, base_upper));
	g_value_set_double (target_value, base_value);
	result = TRUE;
	return result;
}

static void
ft_log_scale_on_adjustment_value_changed (FtLogScale* self)
{
	GtkAdjustment* _tmp0_;
	gdouble new_value = 0.0;
	GtkAdjustment* _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp3_;
	gdouble _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_adjustment;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->_adjustment;
	_tmp2_ = gtk_adjustment_get_value (_tmp1_);
	_tmp3_ = _tmp2_;
	new_value = _tmp3_;
	_tmp4_ = self->priv->_value;
	if (_tmp4_ == new_value) {
		return;
	}
	ft_log_scale_set_value (self, new_value);
}

void
ft_log_scale_step_forward (FtLogScale* self)
{
	GtkAdjustment* _tmp0_;
	gdouble new_value = 0.0;
	GtkAdjustment* _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp3_;
	GtkAdjustment* _tmp4_;
	GtkAdjustment* _tmp5_;
	gdouble _tmp6_;
	gdouble _tmp7_;
	GtkAdjustment* _tmp8_;
	gdouble _tmp9_;
	gdouble _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_adjustment;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->_adjustment;
	_tmp2_ = gtk_adjustment_get_value (_tmp1_);
	_tmp3_ = _tmp2_;
	new_value = _tmp3_;
	new_value += ft_log_scale_get_step_size (self, new_value + 1.0);
	_tmp4_ = self->priv->_adjustment;
	_tmp5_ = self->priv->_adjustment;
	_tmp6_ = gtk_adjustment_get_lower (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = self->priv->_adjustment;
	_tmp9_ = gtk_adjustment_get_upper (_tmp8_);
	_tmp10_ = _tmp9_;
	gtk_adjustment_set_value (_tmp4_, CLAMP (new_value, _tmp7_, _tmp10_));
}

void
ft_log_scale_step_backward (FtLogScale* self)
{
	GtkAdjustment* _tmp0_;
	gdouble new_value = 0.0;
	GtkAdjustment* _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp3_;
	GtkAdjustment* _tmp4_;
	GtkAdjustment* _tmp5_;
	gdouble _tmp6_;
	gdouble _tmp7_;
	GtkAdjustment* _tmp8_;
	gdouble _tmp9_;
	gdouble _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_adjustment;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->_adjustment;
	_tmp2_ = gtk_adjustment_get_value (_tmp1_);
	_tmp3_ = _tmp2_;
	new_value = _tmp3_;
	new_value -= ft_log_scale_get_step_size (self, new_value - 1.0);
	_tmp4_ = self->priv->_adjustment;
	_tmp5_ = self->priv->_adjustment;
	_tmp6_ = gtk_adjustment_get_lower (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = self->priv->_adjustment;
	_tmp9_ = gtk_adjustment_get_upper (_tmp8_);
	_tmp10_ = _tmp9_;
	gtk_adjustment_set_value (_tmp4_, CLAMP (new_value, _tmp7_, _tmp10_));
}

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

static void
ft_log_scale_real_dispose (GObject* base)
{
	FtLogScale * self;
	gboolean _tmp0_ = FALSE;
	GtkAdjustment* _tmp1_;
	GBinding* _tmp3_;
	self = (FtLogScale*) base;
	_tmp1_ = self->priv->_adjustment;
	if (_tmp1_ != NULL) {
		_tmp0_ = self->priv->adjustment_value_changed_id != ((gulong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GtkAdjustment* _tmp2_;
		_tmp2_ = self->priv->_adjustment;
		g_signal_handler_disconnect ((GObject*) _tmp2_, self->priv->adjustment_value_changed_id);
		self->priv->adjustment_value_changed_id = (gulong) 0;
	}
	_tmp3_ = self->priv->value_binding;
	if (_tmp3_ != NULL) {
		GBinding* _tmp4_;
		GBinding* _tmp5_;
		_tmp4_ = self->priv->value_binding;
		_tmp5_ = _g_object_ref0 (_tmp4_);
		g_binding_unbind (_tmp5_);
	}
	G_OBJECT_CLASS (ft_log_scale_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_scale_get_type (), GtkScale));
	_g_object_unref0 (self->priv->_adjustment);
	self->priv->_adjustment = NULL;
}

gdouble
ft_log_scale_get_value (FtLogScale* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_value;
	return result;
}

static void
ft_log_scale_set_value (FtLogScale* self,
                        gdouble value)
{
	gdouble old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_log_scale_get_value (self);
	if (old_value != value) {
		self->priv->_value = value;
		g_object_notify_by_pspec ((GObject *) self, ft_log_scale_properties[FT_LOG_SCALE_VALUE_PROPERTY]);
	}
}

GtkAdjustment*
ft_log_scale_get_adjustment (FtLogScale* self)
{
	GtkAdjustment* result;
	GtkAdjustment* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_adjustment;
	result = _tmp0_;
	return result;
}

static gboolean
_ft_log_scale_transform_to_gbinding_transform_func (GBinding* binding,
                                                    GValue* from_value,
                                                    GValue* to_value,
                                                    gpointer self)
{
	gboolean result;
	result = ft_log_scale_transform_to ((FtLogScale*) self, binding, from_value, to_value);
	return result;
}

static gboolean
_ft_log_scale_transform_from_gbinding_transform_func (GBinding* binding,
                                                      GValue* from_value,
                                                      GValue* to_value,
                                                      gpointer self)
{
	gboolean result;
	result = ft_log_scale_transform_from ((FtLogScale*) self, binding, from_value, to_value);
	return result;
}

static void
_ft_log_scale_on_adjustment_value_changed_gtk_adjustment_value_changed (GtkAdjustment* _sender,
                                                                        gpointer self)
{
	ft_log_scale_on_adjustment_value_changed ((FtLogScale*) self);
}

void
ft_log_scale_set_adjustment (FtLogScale* self,
                             GtkAdjustment* value)
{
	gboolean _tmp0_ = FALSE;
	GtkAdjustment* _tmp1_;
	GBinding* _tmp3_;
	GtkAdjustment* _tmp6_;
	GtkAdjustment* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_adjustment;
	if (_tmp1_ != NULL) {
		_tmp0_ = self->priv->adjustment_value_changed_id != ((gulong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GtkAdjustment* _tmp2_;
		_tmp2_ = self->priv->_adjustment;
		g_signal_handler_disconnect ((GObject*) _tmp2_, self->priv->adjustment_value_changed_id);
		self->priv->adjustment_value_changed_id = (gulong) 0;
	}
	_tmp3_ = self->priv->value_binding;
	if (_tmp3_ != NULL) {
		GBinding* _tmp4_;
		GBinding* _tmp5_;
		_tmp4_ = self->priv->value_binding;
		_tmp5_ = _g_object_ref0 (_tmp4_);
		g_binding_unbind (_tmp5_);
		self->priv->value_binding = NULL;
	}
	_tmp6_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_adjustment);
	self->priv->_adjustment = _tmp6_;
	_tmp7_ = self->priv->_adjustment;
	if (_tmp7_ != NULL) {
		GtkAdjustment* _tmp8_;
		GtkAdjustment* _tmp9_;
		GtkAdjustment* _tmp10_;
		GBinding* _tmp11_;
		GtkAdjustment* _tmp12_;
		gdouble _tmp13_;
		gdouble _tmp14_;
		GtkAdjustment* _tmp15_;
		gulong _tmp16_;
		_tmp8_ = self->priv->_adjustment;
		_tmp9_ = gtk_range_get_adjustment ((GtkRange*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_scale_get_type (), GtkScale));
		_tmp10_ = _tmp9_;
		_tmp11_ = g_object_bind_property_with_closures ((GObject*) _tmp8_, "value", (GObject*) _tmp10_, "value", FT_LOG_SCALE_BINDING_FLAGS, (GClosure*) ((_ft_log_scale_transform_to_gbinding_transform_func == NULL) ? NULL : g_cclosure_new ((GCallback) _ft_log_scale_transform_to_gbinding_transform_func, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((_ft_log_scale_transform_from_gbinding_transform_func == NULL) ? NULL : g_cclosure_new ((GCallback) _ft_log_scale_transform_from_gbinding_transform_func, g_object_ref (self), (GClosureNotify) g_object_unref)));
		self->priv->value_binding = _tmp11_;
		_tmp12_ = self->priv->_adjustment;
		_tmp13_ = gtk_adjustment_get_value (_tmp12_);
		_tmp14_ = _tmp13_;
		ft_log_scale_set_value (self, _tmp14_);
		_tmp15_ = self->priv->_adjustment;
		_tmp16_ = g_signal_connect_object (_tmp15_, "value-changed", (GCallback) _ft_log_scale_on_adjustment_value_changed_gtk_adjustment_value_changed, self, 0);
		self->priv->adjustment_value_changed_id = _tmp16_;
	}
	g_object_notify_by_pspec ((GObject *) self, ft_log_scale_properties[FT_LOG_SCALE_ADJUSTMENT_PROPERTY]);
}

static GObject *
ft_log_scale_constructor (GType type,
                          guint n_construct_properties,
                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FtLogScale * self;
	GtkAdjustment* _tmp0_;
	GtkAdjustment* _tmp1_;
	parent_class = G_OBJECT_CLASS (ft_log_scale_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_LOG_SCALE, FtLogScale);
	_tmp0_ = gtk_adjustment_new (0.0, 0.0, 2.0, 0.0, 0.0, 0.0);
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	gtk_range_set_adjustment ((GtkRange*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_scale_get_type (), GtkScale), _tmp1_);
	_g_object_unref0 (_tmp1_);
	return obj;
}

static void
ft_log_scale_class_init (FtLogScaleClass * klass,
                         gpointer klass_data)
{
	ft_log_scale_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtLogScale_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) ft_log_scale_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_log_scale_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_log_scale_set_property;
	G_OBJECT_CLASS (klass)->constructor = ft_log_scale_constructor;
	G_OBJECT_CLASS (klass)->finalize = ft_log_scale_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_LOG_SCALE_VALUE_PROPERTY, ft_log_scale_properties[FT_LOG_SCALE_VALUE_PROPERTY] = g_param_spec_double ("value", "value", "value", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_LOG_SCALE_ADJUSTMENT_PROPERTY, ft_log_scale_properties[FT_LOG_SCALE_ADJUSTMENT_PROPERTY] = g_param_spec_object ("adjustment", "adjustment", "adjustment", gtk_adjustment_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
ft_log_scale_instance_init (FtLogScale * self,
                            gpointer klass)
{
	self->priv = ft_log_scale_get_instance_private (self);
	self->priv->adjustment_value_changed_id = (gulong) 0;
}

static void
ft_log_scale_finalize (GObject * obj)
{
	FtLogScale * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_LOG_SCALE, FtLogScale);
	_g_object_unref0 (self->priv->_adjustment);
	G_OBJECT_CLASS (ft_log_scale_parent_class)->finalize (obj);
}

static GType
ft_log_scale_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtLogScaleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_log_scale_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtLogScale), 0, (GInstanceInitFunc) ft_log_scale_instance_init, NULL };
	GType ft_log_scale_type_id;
	ft_log_scale_type_id = g_type_register_static (gtk_scale_get_type (), "FtLogScale", &g_define_type_info, 0);
	FtLogScale_private_offset = g_type_add_instance_private (ft_log_scale_type_id, sizeof (FtLogScalePrivate));
	return ft_log_scale_type_id;
}

GType
ft_log_scale_get_type (void)
{
	static volatile gsize ft_log_scale_type_id__once = 0;
	if (g_once_init_enter (&ft_log_scale_type_id__once)) {
		GType ft_log_scale_type_id;
		ft_log_scale_type_id = ft_log_scale_get_type_once ();
		g_once_init_leave (&ft_log_scale_type_id__once, ft_log_scale_type_id);
	}
	return ft_log_scale_type_id__once;
}

static void
_vala_ft_log_scale_get_property (GObject * object,
                                 guint property_id,
                                 GValue * value,
                                 GParamSpec * pspec)
{
	FtLogScale * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_LOG_SCALE, FtLogScale);
	switch (property_id) {
		case FT_LOG_SCALE_VALUE_PROPERTY:
		g_value_set_double (value, ft_log_scale_get_value (self));
		break;
		case FT_LOG_SCALE_ADJUSTMENT_PROPERTY:
		g_value_set_object (value, ft_log_scale_get_adjustment (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_log_scale_set_property (GObject * object,
                                 guint property_id,
                                 const GValue * value,
                                 GParamSpec * pspec)
{
	FtLogScale * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_LOG_SCALE, FtLogScale);
	switch (property_id) {
		case FT_LOG_SCALE_VALUE_PROPERTY:
		ft_log_scale_set_value (self, g_value_get_double (value));
		break;
		case FT_LOG_SCALE_ADJUSTMENT_PROPERTY:
		ft_log_scale_set_adjustment (self, g_value_get_object (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;
}

