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

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

#include <gtk/gtk.h>
#include "ft_ui.h"
#include <glib-object.h>
#include <glib.h>
#include "ft_core.h"
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.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

#define FT_TYPE_CONDITION_WIDGET (ft_condition_widget_get_type ())
#define FT_CONDITION_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FT_TYPE_CONDITION_WIDGET, FtConditionWidget))
#define FT_CONDITION_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FT_TYPE_CONDITION_WIDGET, FtConditionWidgetClass))
#define FT_IS_CONDITION_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FT_TYPE_CONDITION_WIDGET))
#define FT_IS_CONDITION_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FT_TYPE_CONDITION_WIDGET))
#define FT_CONDITION_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FT_TYPE_CONDITION_WIDGET, FtConditionWidgetClass))

typedef struct _FtConditionWidget FtConditionWidget;
typedef struct _FtConditionWidgetClass FtConditionWidgetClass;
typedef struct _FtConditionWidgetPrivate FtConditionWidgetPrivate;
enum  {
	FT_CONDITION_WIDGET_0_PROPERTY,
	FT_CONDITION_WIDGET_EXPRESSION_PROPERTY,
	FT_CONDITION_WIDGET_REMOVABLE_PROPERTY,
	FT_CONDITION_WIDGET_NUM_PROPERTIES
};
static GParamSpec* ft_condition_widget_properties[FT_CONDITION_WIDGET_NUM_PROPERTIES];
#define _ft_expression_unref0(var) ((var == NULL) ? NULL : (var = (ft_expression_unref (var), NULL)))

#define FT_CONDITION_WIDGET_TYPE_FIELD_ITEM (ft_condition_widget_field_item_get_type ())
#define FT_CONDITION_WIDGET_FIELD_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FT_CONDITION_WIDGET_TYPE_FIELD_ITEM, FtConditionWidgetFieldItem))
#define FT_CONDITION_WIDGET_FIELD_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FT_CONDITION_WIDGET_TYPE_FIELD_ITEM, FtConditionWidgetFieldItemClass))
#define FT_CONDITION_WIDGET_IS_FIELD_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FT_CONDITION_WIDGET_TYPE_FIELD_ITEM))
#define FT_CONDITION_WIDGET_IS_FIELD_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FT_CONDITION_WIDGET_TYPE_FIELD_ITEM))
#define FT_CONDITION_WIDGET_FIELD_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FT_CONDITION_WIDGET_TYPE_FIELD_ITEM, FtConditionWidgetFieldItemClass))

typedef struct _FtConditionWidgetFieldItem FtConditionWidgetFieldItem;
typedef struct _FtConditionWidgetFieldItemClass FtConditionWidgetFieldItemClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _ft_value_unref0(var) ((var == NULL) ? NULL : (var = (ft_value_unref (var), NULL)))
#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
typedef struct _FtConditionGroupWidget FtConditionGroupWidget;
typedef struct _FtConditionGroupWidgetClass FtConditionGroupWidgetClass;
typedef struct _FtConditionWidgetFieldItemPrivate FtConditionWidgetFieldItemPrivate;
enum  {
	FT_CONDITION_WIDGET_FIELD_ITEM_0_PROPERTY,
	FT_CONDITION_WIDGET_FIELD_ITEM_NAME_PROPERTY,
	FT_CONDITION_WIDGET_FIELD_ITEM_LABEL_PROPERTY,
	FT_CONDITION_WIDGET_FIELD_ITEM_VARIABLE_SPEC_PROPERTY,
	FT_CONDITION_WIDGET_FIELD_ITEM_NUM_PROPERTIES
};
static GParamSpec* ft_condition_widget_field_item_properties[FT_CONDITION_WIDGET_FIELD_ITEM_NUM_PROPERTIES];
#define _ft_variable_spec_unref0(var) ((var == NULL) ? NULL : (var = (ft_variable_spec_unref (var), NULL)))
#define _gtk_expression_unref0(var) ((var == NULL) ? NULL : (var = (gtk_expression_unref (var), NULL)))
#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 _FtConditionWidget {
	GtkBox parent_instance;
	FtConditionWidgetPrivate * priv;
};

struct _FtConditionWidgetClass {
	GtkBoxClass parent_class;
};

struct _FtConditionWidgetPrivate {
	gboolean _removable;
	GtkFlowBox* fields;
	GtkDropDown* field_dropdown;
	GtkDropDown* enum_operator_dropdown;
	GtkDropDown* numerical_operator_dropdown;
	GtkDropDown* state_dropdown;
	GtkDropDown* boolean_dropdown;
	GtkSpinButton* interval_spinbutton;
	GtkDropDown* interval_unit_dropdown;
	FtComparison* _comparison;
	guint update_idle_id;
};

struct _FtConditionWidgetFieldItem {
	GObject parent_instance;
	FtConditionWidgetFieldItemPrivate * priv;
};

struct _FtConditionWidgetFieldItemClass {
	GObjectClass parent_class;
};

struct _FtConditionWidgetFieldItemPrivate {
	gchar* _name;
	gchar* _label;
	FtVariableSpec* _variable_spec;
};

static gint FtConditionWidget_private_offset;
static gpointer ft_condition_widget_parent_class = NULL;
static gint FtConditionWidgetFieldItem_private_offset;
static gpointer ft_condition_widget_field_item_parent_class = NULL;
static FtExpressionWidgetIface * ft_condition_widget_ft_expression_widget_parent_iface = NULL;

VALA_EXTERN GType ft_condition_widget_get_type (void) G_GNUC_CONST ;
static gint64 ft_condition_widget_guess_interval_unit (gint64 interval);
static GType ft_condition_widget_field_item_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static FtConditionWidgetFieldItem* ft_condition_widget_get_selected_field_item (FtConditionWidget* self);
static const gchar* ft_condition_widget_field_item_get_name (FtConditionWidgetFieldItem* self);
static FtOperator ft_condition_widget_get_selected_operator (FtConditionWidget* self);
static FtValue* ft_condition_widget_get_selected_value (FtConditionWidget* self);
static void ft_condition_widget_update_expression (FtConditionWidget* self);
static void ft_condition_widget_queue_update_expression (FtConditionWidget* self);
static gboolean __lambda70_ (FtConditionWidget* self);
static gboolean ___lambda70__gtk_tick_callback (GtkWidget* widget,
                                         GdkFrameClock* frame_clock,
                                         gpointer self);
static gboolean ft_condition_widget_select_field (FtConditionWidget* self,
                                           const gchar* name);
static gboolean ft_condition_widget_select_operator (FtConditionWidget* self,
                                              FtOperator operator);
static gboolean ft_condition_widget_select_value (FtConditionWidget* self,
                                           FtValue* value);
static void ft_condition_widget_populate (FtConditionWidget* self);
static void ft_condition_widget_update_operator_fields (FtConditionWidget* self);
static void ft_condition_widget_update_value_fields (FtConditionWidget* self);
static void ft_condition_widget_update_empty_item (FtConditionWidget* self);
static FtVariableSpec* ft_condition_widget_field_item_get_variable_spec (FtConditionWidgetFieldItem* self);
static GType* _g_type_dup (GType* self);
static gboolean _g_type_equal (const GType * s1,
                        const GType * s2);
static void ft_condition_widget_on_field_notify_selected_item (FtConditionWidget* self,
                                                        GObject* object,
                                                        GParamSpec* pspec);
static void _ft_condition_widget_on_field_notify_selected_item_g_object_notify (GObject* _sender,
                                                                         GParamSpec* pspec,
                                                                         gpointer self);
static void ft_condition_widget_on_enum_operator_notify_selected_item (FtConditionWidget* self,
                                                                GObject* object,
                                                                GParamSpec* pspec);
static void _ft_condition_widget_on_enum_operator_notify_selected_item_g_object_notify (GObject* _sender,
                                                                                 GParamSpec* pspec,
                                                                                 gpointer self);
static void ft_condition_widget_on_numerical_operator_notify_selected_item (FtConditionWidget* self,
                                                                     GObject* object,
                                                                     GParamSpec* pspec);
static void _ft_condition_widget_on_numerical_operator_notify_selected_item_g_object_notify (GObject* _sender,
                                                                                      GParamSpec* pspec,
                                                                                      gpointer self);
static void ft_condition_widget_on_state_notify_selected_item (FtConditionWidget* self,
                                                        GObject* object,
                                                        GParamSpec* pspec);
static void _ft_condition_widget_on_state_notify_selected_item_g_object_notify (GObject* _sender,
                                                                         GParamSpec* pspec,
                                                                         gpointer self);
static void ft_condition_widget_on_boolean_notify_selected_item (FtConditionWidget* self,
                                                          GObject* object,
                                                          GParamSpec* pspec);
static void _ft_condition_widget_on_boolean_notify_selected_item_g_object_notify (GObject* _sender,
                                                                           GParamSpec* pspec,
                                                                           gpointer self);
static void ft_condition_widget_on_interval_adjustment_value_changed (FtConditionWidget* self);
static void _ft_condition_widget_on_interval_adjustment_value_changed_gtk_adjustment_value_changed (GtkAdjustment* _sender,
                                                                                             gpointer self);
static void ft_condition_widget_on_interval_unit_notify_selected_item (FtConditionWidget* self,
                                                                GObject* object,
                                                                GParamSpec* pspec);
static void _ft_condition_widget_on_interval_unit_notify_selected_item_g_object_notify (GObject* _sender,
                                                                                 GParamSpec* pspec,
                                                                                 gpointer self);
static void ft_condition_widget_on_remove_button_clicked (FtConditionWidget* self,
                                                   GtkButton* button);
static void _ft_condition_widget_on_remove_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                       gpointer self);
static void ft_condition_widget_real_dispose (GObject* base);
VALA_EXTERN FtConditionWidget* ft_condition_widget_new (void);
VALA_EXTERN FtConditionWidget* ft_condition_widget_construct (GType object_type);
static FtConditionWidgetFieldItem* ft_condition_widget_field_item_new (const gchar* name,
                                                                const gchar* label);
static FtConditionWidgetFieldItem* ft_condition_widget_field_item_construct (GType object_type,
                                                                      const gchar* name,
                                                                      const gchar* label);
static void ft_condition_widget_field_item_set_name (FtConditionWidgetFieldItem* self,
                                              const gchar* value);
static const gchar* ft_condition_widget_field_item_get_label (FtConditionWidgetFieldItem* self);
static void ft_condition_widget_field_item_set_label (FtConditionWidgetFieldItem* self,
                                               const gchar* value);
static void ft_condition_widget_field_item_set_variable_spec (FtConditionWidgetFieldItem* self,
                                                       FtVariableSpec* value);
static void ft_condition_widget_field_item_finalize (GObject * obj);
static GType ft_condition_widget_field_item_get_type_once (void);
static void _vala_ft_condition_widget_field_item_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec);
static void _vala_ft_condition_widget_field_item_set_property (GObject * object,
                                                        guint property_id,
                                                        const GValue * value,
                                                        GParamSpec * pspec);
static GObject * ft_condition_widget_constructor (GType type,
                                           guint n_construct_properties,
                                           GObjectConstructParam * construct_properties);
static void ft_condition_widget_finalize (GObject * obj);
static GType ft_condition_widget_get_type_once (void);
static void _vala_ft_condition_widget_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_ft_condition_widget_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 const FtOperator FT_CONDITION_WIDGET_ENUM_OPERATOR_CHOICES[2] = {FT_OPERATOR_EQ, FT_OPERATOR_NOT_EQ};
static const FtOperator FT_CONDITION_WIDGET_NUMERICAL_OPERATOR_CHOICES[3] = {FT_OPERATOR_EQ, FT_OPERATOR_GT, FT_OPERATOR_LT};
static const FtState FT_CONDITION_WIDGET_STATE_CHOICES[3] = {FT_STATE_POMODORO, FT_STATE_BREAK, FT_STATE_STOPPED};
static const gboolean FT_CONDITION_WIDGET_BOOLEAN_CHOICES[2] = {TRUE, FALSE};
static const gint64 FT_CONDITION_WIDGET_INTERVAL_UNIT_CHOICES[3] = {FT_INTERVAL_MINUTE, FT_INTERVAL_SECOND, FT_INTERVAL_HOUR};

static inline gpointer
ft_condition_widget_get_instance_private (FtConditionWidget* self)
{
	return G_STRUCT_MEMBER_P (self, FtConditionWidget_private_offset);
}

static gint64
ft_condition_widget_guess_interval_unit (gint64 interval)
{
	gint64 result;
	if ((interval % FT_INTERVAL_HOUR) == ((gint64) 0)) {
		result = FT_INTERVAL_HOUR;
		return result;
	}
	if ((interval % FT_INTERVAL_MINUTE) == ((gint64) 0)) {
		result = FT_INTERVAL_MINUTE;
		return result;
	}
	result = FT_INTERVAL_SECOND;
	return result;
}

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

static FtConditionWidgetFieldItem*
ft_condition_widget_get_selected_field_item (FtConditionWidget* self)
{
	FtConditionWidgetFieldItem* field_item = NULL;
	GtkDropDown* _tmp0_;
	GObject* _tmp1_;
	GObject* _tmp2_;
	FtConditionWidgetFieldItem* _tmp3_;
	FtConditionWidgetFieldItem* _tmp4_ = NULL;
	gboolean _tmp5_ = FALSE;
	FtConditionWidgetFieldItem* _tmp6_;
	FtConditionWidgetFieldItem* _tmp11_;
	FtConditionWidgetFieldItem* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->field_dropdown;
	_tmp1_ = gtk_drop_down_get_selected_item (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (FT_CONDITION_WIDGET_IS_FIELD_ITEM (_tmp2_) ? ((FtConditionWidgetFieldItem*) _tmp2_) : NULL);
	field_item = _tmp3_;
	_tmp6_ = field_item;
	if (_tmp6_ != NULL) {
		FtConditionWidgetFieldItem* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		_tmp7_ = field_item;
		_tmp8_ = ft_condition_widget_field_item_get_name (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp5_ = g_strcmp0 (_tmp9_, "") != 0;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		FtConditionWidgetFieldItem* _tmp10_;
		_tmp10_ = field_item;
		_tmp4_ = _tmp10_;
	} else {
		_tmp4_ = NULL;
	}
	_tmp11_ = _g_object_ref0 (_tmp4_);
	result = _tmp11_;
	_g_object_unref0 (field_item);
	return result;
}

static FtOperator
ft_condition_widget_get_selected_operator (FtConditionWidget* self)
{
	GtkDropDown* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkDropDown* _tmp7_;
	GtkWidget* _tmp8_;
	GtkWidget* _tmp9_;
	FtOperator result;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->enum_operator_dropdown;
	_tmp1_ = gtk_widget_get_parent ((GtkWidget*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		guint index = 0U;
		GtkDropDown* _tmp3_;
		guint _tmp4_;
		guint _tmp5_;
		FtOperator _tmp6_;
		_tmp3_ = self->priv->enum_operator_dropdown;
		_tmp4_ = gtk_drop_down_get_selected (_tmp3_);
		_tmp5_ = _tmp4_;
		index = _tmp5_;
		_vala_assert (index < ((guint) G_N_ELEMENTS (FT_CONDITION_WIDGET_ENUM_OPERATOR_CHOICES)), "index < ENUM_OPERATOR_CHOICES.length");
		_tmp6_ = FT_CONDITION_WIDGET_ENUM_OPERATOR_CHOICES[index];
		result = _tmp6_;
		return result;
	}
	_tmp7_ = self->priv->numerical_operator_dropdown;
	_tmp8_ = gtk_widget_get_parent ((GtkWidget*) _tmp7_);
	_tmp9_ = _tmp8_;
	if (_tmp9_ != NULL) {
		guint index = 0U;
		GtkDropDown* _tmp10_;
		guint _tmp11_;
		guint _tmp12_;
		FtOperator _tmp13_;
		_tmp10_ = self->priv->numerical_operator_dropdown;
		_tmp11_ = gtk_drop_down_get_selected (_tmp10_);
		_tmp12_ = _tmp11_;
		index = _tmp12_;
		_vala_assert (index < ((guint) G_N_ELEMENTS (FT_CONDITION_WIDGET_NUMERICAL_OPERATOR_CHOICES)), "index < NUMERICAL_OPERATOR_CHOICES.length");
		_tmp13_ = FT_CONDITION_WIDGET_NUMERICAL_OPERATOR_CHOICES[index];
		result = _tmp13_;
		return result;
	}
	result = FT_OPERATOR_EQ;
	return result;
}

static FtValue*
ft_condition_widget_get_selected_value (FtConditionWidget* self)
{
	GtkDropDown* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkDropDown* _tmp8_;
	GtkWidget* _tmp9_;
	GtkWidget* _tmp10_;
	GtkSpinButton* _tmp16_;
	GtkWidget* _tmp17_;
	GtkWidget* _tmp18_;
	FtValue* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->state_dropdown;
	_tmp1_ = gtk_widget_get_parent ((GtkWidget*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		guint index = 0U;
		GtkDropDown* _tmp3_;
		guint _tmp4_;
		guint _tmp5_;
		FtState _tmp6_;
		FtStateValue* _tmp7_;
		_tmp3_ = self->priv->state_dropdown;
		_tmp4_ = gtk_drop_down_get_selected (_tmp3_);
		_tmp5_ = _tmp4_;
		index = _tmp5_;
		_vala_assert (index < ((guint) G_N_ELEMENTS (FT_CONDITION_WIDGET_STATE_CHOICES)), "index < STATE_CHOICES.length");
		_tmp6_ = FT_CONDITION_WIDGET_STATE_CHOICES[index];
		_tmp7_ = ft_state_value_new (_tmp6_);
		result = (FtValue*) _tmp7_;
		return result;
	}
	_tmp8_ = self->priv->boolean_dropdown;
	_tmp9_ = gtk_widget_get_parent ((GtkWidget*) _tmp8_);
	_tmp10_ = _tmp9_;
	if (_tmp10_ != NULL) {
		guint index = 0U;
		GtkDropDown* _tmp11_;
		guint _tmp12_;
		guint _tmp13_;
		gboolean _tmp14_;
		FtBooleanValue* _tmp15_;
		_tmp11_ = self->priv->boolean_dropdown;
		_tmp12_ = gtk_drop_down_get_selected (_tmp11_);
		_tmp13_ = _tmp12_;
		index = _tmp13_;
		_vala_assert (index < ((guint) G_N_ELEMENTS (FT_CONDITION_WIDGET_BOOLEAN_CHOICES)), "index < BOOLEAN_CHOICES.length");
		_tmp14_ = FT_CONDITION_WIDGET_BOOLEAN_CHOICES[index];
		_tmp15_ = ft_boolean_value_new (_tmp14_);
		result = (FtValue*) _tmp15_;
		return result;
	}
	_tmp16_ = self->priv->interval_spinbutton;
	_tmp17_ = gtk_widget_get_parent ((GtkWidget*) _tmp16_);
	_tmp18_ = _tmp17_;
	if (_tmp18_ != NULL) {
		guint index = 0U;
		GtkDropDown* _tmp19_;
		guint _tmp20_;
		guint _tmp21_;
		gint64 interval = 0LL;
		GtkSpinButton* _tmp22_;
		gdouble _tmp23_;
		gdouble _tmp24_;
		gint64 _tmp25_;
		FtIntervalValue* _tmp26_;
		_tmp19_ = self->priv->interval_unit_dropdown;
		_tmp20_ = gtk_drop_down_get_selected (_tmp19_);
		_tmp21_ = _tmp20_;
		index = _tmp21_;
		_vala_assert (index < ((guint) G_N_ELEMENTS (FT_CONDITION_WIDGET_INTERVAL_UNIT_CHOICES)), "index < INTERVAL_UNIT_CHOICES.length");
		_tmp22_ = self->priv->interval_spinbutton;
		_tmp23_ = gtk_spin_button_get_value (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp25_ = FT_CONDITION_WIDGET_INTERVAL_UNIT_CHOICES[index];
		interval = ft_interval_from_value ((gint) _tmp24_, _tmp25_);
		_tmp26_ = ft_interval_value_new (interval);
		result = (FtValue*) _tmp26_;
		return result;
	}
	result = NULL;
	return result;
}

static void
ft_condition_widget_update_expression (FtConditionWidget* self)
{
	FtConditionWidgetFieldItem* selected_field_item = NULL;
	FtConditionWidgetFieldItem* _tmp0_;
	FtOperator selected_operator = 0;
	FtValue* selected_value = NULL;
	FtValue* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	FtConditionWidgetFieldItem* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = ft_condition_widget_get_selected_field_item (self);
	selected_field_item = _tmp0_;
	selected_operator = ft_condition_widget_get_selected_operator (self);
	_tmp1_ = ft_condition_widget_get_selected_value (self);
	selected_value = _tmp1_;
	if (self->priv->update_idle_id != ((guint) 0)) {
		gtk_widget_remove_tick_callback ((GtkWidget*) self, self->priv->update_idle_id);
		self->priv->update_idle_id = (guint) 0;
	}
	_tmp4_ = selected_field_item;
	if (_tmp4_ != NULL) {
		FtConditionWidgetFieldItem* _tmp5_ = NULL;
		FtConditionWidgetFieldItem* _tmp6_;
		const gchar* _tmp7_ = NULL;
		_tmp6_ = selected_field_item;
		_tmp5_ = _tmp6_;
		_tmp7_ = NULL;
		if (_tmp5_ != NULL) {
			const gchar* _tmp8_;
			const gchar* _tmp9_;
			_tmp8_ = ft_condition_widget_field_item_get_name (_tmp5_);
			_tmp9_ = _tmp8_;
			_tmp7_ = _tmp9_;
		}
		_tmp3_ = _tmp7_ != NULL;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		FtValue* _tmp10_;
		_tmp10_ = selected_value;
		_tmp2_ = _tmp10_ != NULL;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		FtConditionWidgetFieldItem* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		FtVariable* _tmp14_;
		FtVariable* _tmp15_;
		FtValue* _tmp16_;
		FtConstant* _tmp17_;
		FtConstant* _tmp18_;
		FtComparison* _tmp19_;
		_tmp11_ = selected_field_item;
		_tmp12_ = ft_condition_widget_field_item_get_name (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = ft_variable_new (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = selected_value;
		_tmp17_ = ft_constant_new (_tmp16_);
		_tmp18_ = _tmp17_;
		_tmp19_ = ft_comparison_new ((FtExpression*) _tmp15_, selected_operator, (FtExpression*) _tmp18_);
		_ft_expression_unref0 (self->priv->_comparison);
		self->priv->_comparison = _tmp19_;
		_ft_expression_unref0 (_tmp18_);
		_ft_expression_unref0 (_tmp15_);
	} else {
		_ft_expression_unref0 (self->priv->_comparison);
		self->priv->_comparison = NULL;
	}
	g_object_notify ((GObject*) self, "expression");
	_ft_value_unref0 (selected_value);
	_g_object_unref0 (selected_field_item);
}

static gboolean
__lambda70_ (FtConditionWidget* self)
{
	gboolean result;
	self->priv->update_idle_id = (guint) 0;
	ft_condition_widget_update_expression (self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda70__gtk_tick_callback (GtkWidget* widget,
                                GdkFrameClock* frame_clock,
                                gpointer self)
{
	gboolean result;
	result = __lambda70_ ((FtConditionWidget*) self);
	return result;
}

static void
ft_condition_widget_queue_update_expression (FtConditionWidget* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->update_idle_id != ((guint) 0)) {
		return;
	}
	self->priv->update_idle_id = gtk_widget_add_tick_callback ((GtkWidget*) self, ___lambda70__gtk_tick_callback, g_object_ref (self), g_object_unref);
}

static gboolean
ft_condition_widget_select_field (FtConditionWidget* self,
                                  const gchar* name)
{
	GListModel* fields_list = NULL;
	GtkDropDown* _tmp0_;
	GListModel* _tmp1_;
	GListModel* _tmp2_;
	GListModel* _tmp3_;
	guint n_items = 0U;
	GListModel* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (name != NULL, FALSE);
	_tmp0_ = self->priv->field_dropdown;
	_tmp1_ = gtk_drop_down_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	fields_list = _tmp3_;
	_tmp4_ = fields_list;
	n_items = g_list_model_get_n_items (_tmp4_);
	{
		gint position = 0;
		position = 0;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				FtConditionWidgetFieldItem* item = NULL;
				GListModel* _tmp7_;
				GObject* _tmp8_;
				FtConditionWidgetFieldItem* _tmp9_;
				const gchar* _tmp10_;
				const gchar* _tmp11_;
				if (!_tmp5_) {
					gint _tmp6_;
					_tmp6_ = position;
					position = _tmp6_ + 1;
				}
				_tmp5_ = FALSE;
				if (!(((guint) position) < n_items)) {
					break;
				}
				_tmp7_ = fields_list;
				_tmp8_ = g_list_model_get_item (_tmp7_, (guint) position);
				item = G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, FT_CONDITION_WIDGET_TYPE_FIELD_ITEM, FtConditionWidgetFieldItem);
				_tmp9_ = item;
				_tmp10_ = ft_condition_widget_field_item_get_name (_tmp9_);
				_tmp11_ = _tmp10_;
				if (g_strcmp0 (_tmp11_, name) == 0) {
					GtkDropDown* _tmp12_;
					_tmp12_ = self->priv->field_dropdown;
					gtk_drop_down_set_selected (_tmp12_, (guint) position);
					result = TRUE;
					_g_object_unref0 (item);
					_g_object_unref0 (fields_list);
					return result;
				}
				_g_object_unref0 (item);
			}
		}
	}
	result = FALSE;
	_g_object_unref0 (fields_list);
	return result;
}

static gboolean
ft_condition_widget_select_operator (FtConditionWidget* self,
                                     FtOperator operator)
{
	GtkDropDown* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkDropDown* _tmp7_;
	GtkWidget* _tmp8_;
	GtkWidget* _tmp9_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->enum_operator_dropdown;
	_tmp1_ = gtk_widget_get_parent ((GtkWidget*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		{
			gint index = 0;
			index = 0;
			{
				gboolean _tmp3_ = FALSE;
				_tmp3_ = TRUE;
				while (TRUE) {
					FtOperator _tmp5_;
					if (!_tmp3_) {
						gint _tmp4_;
						_tmp4_ = index;
						index = _tmp4_ + 1;
					}
					_tmp3_ = FALSE;
					if (!(index < G_N_ELEMENTS (FT_CONDITION_WIDGET_ENUM_OPERATOR_CHOICES))) {
						break;
					}
					_tmp5_ = FT_CONDITION_WIDGET_ENUM_OPERATOR_CHOICES[index];
					if (_tmp5_ == operator) {
						GtkDropDown* _tmp6_;
						_tmp6_ = self->priv->enum_operator_dropdown;
						gtk_drop_down_set_selected (_tmp6_, (guint) index);
						result = TRUE;
						return result;
					}
				}
			}
		}
	}
	_tmp7_ = self->priv->numerical_operator_dropdown;
	_tmp8_ = gtk_widget_get_parent ((GtkWidget*) _tmp7_);
	_tmp9_ = _tmp8_;
	if (_tmp9_ != NULL) {
		{
			gint index = 0;
			index = 0;
			{
				gboolean _tmp10_ = FALSE;
				_tmp10_ = TRUE;
				while (TRUE) {
					FtOperator _tmp12_;
					if (!_tmp10_) {
						gint _tmp11_;
						_tmp11_ = index;
						index = _tmp11_ + 1;
					}
					_tmp10_ = FALSE;
					if (!(index < G_N_ELEMENTS (FT_CONDITION_WIDGET_NUMERICAL_OPERATOR_CHOICES))) {
						break;
					}
					_tmp12_ = FT_CONDITION_WIDGET_NUMERICAL_OPERATOR_CHOICES[index];
					if (_tmp12_ == operator) {
						GtkDropDown* _tmp13_;
						_tmp13_ = self->priv->numerical_operator_dropdown;
						gtk_drop_down_set_selected (_tmp13_, (guint) index);
						result = TRUE;
						return result;
					}
				}
			}
		}
	}
	result = FALSE;
	return result;
}

static gboolean
ft_condition_widget_select_value (FtConditionWidget* self,
                                  FtValue* value)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (G_TYPE_CHECK_INSTANCE_TYPE (value, FT_TYPE_STATE_VALUE)) {
		FtState state_value = 0;
		state_value = G_TYPE_CHECK_INSTANCE_CAST (value, FT_TYPE_STATE_VALUE, FtStateValue)->data;
		{
			gint index = 0;
			index = 0;
			{
				gboolean _tmp0_ = FALSE;
				_tmp0_ = TRUE;
				while (TRUE) {
					FtState _tmp2_;
					if (!_tmp0_) {
						gint _tmp1_;
						_tmp1_ = index;
						index = _tmp1_ + 1;
					}
					_tmp0_ = FALSE;
					if (!(index < G_N_ELEMENTS (FT_CONDITION_WIDGET_STATE_CHOICES))) {
						break;
					}
					_tmp2_ = FT_CONDITION_WIDGET_STATE_CHOICES[index];
					if (_tmp2_ == state_value) {
						GtkDropDown* _tmp3_;
						_tmp3_ = self->priv->state_dropdown;
						gtk_drop_down_set_selected (_tmp3_, (guint) index);
						result = TRUE;
						return result;
					}
				}
			}
		}
		g_assert_not_reached ();
	}
	if (G_TYPE_CHECK_INSTANCE_TYPE (value, FT_TYPE_BOOLEAN_VALUE)) {
		gboolean boolean_value = FALSE;
		boolean_value = G_TYPE_CHECK_INSTANCE_CAST (value, FT_TYPE_BOOLEAN_VALUE, FtBooleanValue)->data;
		{
			gint index = 0;
			index = 0;
			{
				gboolean _tmp4_ = FALSE;
				_tmp4_ = TRUE;
				while (TRUE) {
					gboolean _tmp6_;
					if (!_tmp4_) {
						gint _tmp5_;
						_tmp5_ = index;
						index = _tmp5_ + 1;
					}
					_tmp4_ = FALSE;
					if (!(index < G_N_ELEMENTS (FT_CONDITION_WIDGET_BOOLEAN_CHOICES))) {
						break;
					}
					_tmp6_ = FT_CONDITION_WIDGET_BOOLEAN_CHOICES[index];
					if (_tmp6_ == boolean_value) {
						GtkDropDown* _tmp7_;
						_tmp7_ = self->priv->boolean_dropdown;
						gtk_drop_down_set_selected (_tmp7_, (guint) index);
						result = TRUE;
						return result;
					}
				}
			}
		}
		g_assert_not_reached ();
	}
	if (G_TYPE_CHECK_INSTANCE_TYPE (value, FT_TYPE_INTERVAL_VALUE)) {
		gint64 interval_value = 0LL;
		gint64 interval_unit = 0LL;
		interval_value = G_TYPE_CHECK_INSTANCE_CAST (value, FT_TYPE_INTERVAL_VALUE, FtIntervalValue)->data;
		interval_unit = ft_condition_widget_guess_interval_unit (interval_value);
		interval_value /= interval_unit;
		{
			gint index = 0;
			index = 0;
			{
				gboolean _tmp8_ = FALSE;
				_tmp8_ = TRUE;
				while (TRUE) {
					gint64 _tmp10_;
					if (!_tmp8_) {
						gint _tmp9_;
						_tmp9_ = index;
						index = _tmp9_ + 1;
					}
					_tmp8_ = FALSE;
					if (!(index < G_N_ELEMENTS (FT_CONDITION_WIDGET_INTERVAL_UNIT_CHOICES))) {
						break;
					}
					_tmp10_ = FT_CONDITION_WIDGET_INTERVAL_UNIT_CHOICES[index];
					if (_tmp10_ == interval_unit) {
						GtkSpinButton* _tmp11_;
						GtkDropDown* _tmp12_;
						_tmp11_ = self->priv->interval_spinbutton;
						gtk_spin_button_set_value (_tmp11_, (gdouble) interval_value);
						_tmp12_ = self->priv->interval_unit_dropdown;
						gtk_drop_down_set_selected (_tmp12_, (guint) index);
						result = TRUE;
						return result;
					}
				}
			}
		}
		g_assert_not_reached ();
	}
	result = FALSE;
	return result;
}

static gpointer
_ft_expression_ref0 (gpointer self)
{
	return self ? ft_expression_ref (self) : NULL;
}

static void
ft_condition_widget_populate (FtConditionWidget* self)
{
	FtComparison* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_comparison;
	if (_tmp0_ != NULL) {
		FtVariable* argument_lhs = NULL;
		FtComparison* _tmp1_;
		FtExpression* _tmp2_;
		FtVariable* _tmp3_;
		FtConstant* argument_rhs = NULL;
		FtComparison* _tmp4_;
		FtExpression* _tmp5_;
		FtConstant* _tmp6_;
		FtVariable* _tmp7_ = NULL;
		FtVariable* _tmp8_;
		const gchar* _tmp9_ = NULL;
		FtComparison* _tmp11_;
		FtConstant* _tmp12_ = NULL;
		FtConstant* _tmp13_;
		FtValue* _tmp14_ = NULL;
		_tmp1_ = self->priv->_comparison;
		_tmp2_ = _tmp1_->argument_lhs;
		_tmp3_ = _ft_expression_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, FT_TYPE_VARIABLE) ? ((FtVariable*) _tmp2_) : NULL);
		argument_lhs = _tmp3_;
		_tmp4_ = self->priv->_comparison;
		_tmp5_ = _tmp4_->argument_rhs;
		_tmp6_ = _ft_expression_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, FT_TYPE_CONSTANT) ? ((FtConstant*) _tmp5_) : NULL);
		argument_rhs = _tmp6_;
		_tmp8_ = argument_lhs;
		_tmp7_ = _tmp8_;
		_tmp9_ = NULL;
		if (_tmp7_ != NULL) {
			const gchar* _tmp10_;
			_tmp10_ = _tmp7_->name;
			_tmp9_ = _tmp10_;
		}
		ft_condition_widget_select_field (self, _tmp9_);
		_tmp11_ = self->priv->_comparison;
		ft_condition_widget_select_operator (self, _tmp11_->operator);
		_tmp13_ = argument_rhs;
		_tmp12_ = _tmp13_;
		_tmp14_ = NULL;
		if (_tmp12_ != NULL) {
			FtValue* _tmp15_;
			_tmp15_ = _tmp12_->value;
			_tmp14_ = _tmp15_;
		}
		ft_condition_widget_select_value (self, _tmp14_);
		ft_condition_widget_update_operator_fields (self);
		ft_condition_widget_update_value_fields (self);
		_ft_expression_unref0 (argument_rhs);
		_ft_expression_unref0 (argument_lhs);
	}
}

static void
ft_condition_widget_update_empty_item (FtConditionWidget* self)
{
	FtConditionWidgetFieldItem* selected_field_item = NULL;
	FtConditionWidgetFieldItem* _tmp0_;
	gboolean _tmp1_ = FALSE;
	FtConditionWidgetFieldItem* _tmp2_;
	GListStore* model = NULL;
	GtkDropDown* _tmp6_;
	GListModel* _tmp7_;
	GListModel* _tmp8_;
	GListStore* _tmp9_;
	FtConditionWidgetFieldItem* first_item = NULL;
	GListStore* _tmp10_;
	GObject* _tmp11_;
	FtConditionWidgetFieldItem* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = ft_condition_widget_get_selected_field_item (self);
	selected_field_item = _tmp0_;
	_tmp2_ = selected_field_item;
	if (_tmp2_ == NULL) {
		_tmp1_ = TRUE;
	} else {
		FtConditionWidgetFieldItem* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp3_ = selected_field_item;
		_tmp4_ = ft_condition_widget_field_item_get_name (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp1_ = g_strcmp0 (_tmp5_, "") == 0;
	}
	if (_tmp1_) {
		_g_object_unref0 (selected_field_item);
		return;
	}
	_tmp6_ = self->priv->field_dropdown;
	_tmp7_ = gtk_drop_down_get_model (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, g_list_store_get_type (), GListStore));
	model = _tmp9_;
	_tmp10_ = model;
	_tmp11_ = g_list_model_get_item ((GListModel*) _tmp10_, (guint) 0);
	first_item = G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, FT_CONDITION_WIDGET_TYPE_FIELD_ITEM, FtConditionWidgetFieldItem);
	_tmp12_ = first_item;
	_tmp13_ = ft_condition_widget_field_item_get_name (_tmp12_);
	_tmp14_ = _tmp13_;
	if (g_strcmp0 (_tmp14_, "") == 0) {
		GListStore* _tmp15_;
		_tmp15_ = model;
		g_list_store_remove (_tmp15_, (guint) 0);
	}
	_g_object_unref0 (first_item);
	_g_object_unref0 (model);
	_g_object_unref0 (selected_field_item);
}

static GType*
_g_type_dup (GType* self)
{
	GType* dup;
	dup = g_new0 (GType, 1);
	memcpy (dup, self, sizeof (GType));
	return dup;
}

static gpointer
__g_type_dup0 (gpointer self)
{
	return self ? _g_type_dup (self) : NULL;
}

static gboolean
_g_type_equal (const GType * s1,
               const GType * s2)
{
	if (s1 == s2) {
		return TRUE;
	}
	if (s1 == NULL) {
		return FALSE;
	}
	if (s2 == NULL) {
		return FALSE;
	}
	return (*s1) == (*s2);
}

static void
ft_condition_widget_update_operator_fields (FtConditionWidget* self)
{
	FtConditionWidgetFieldItem* selected_field_item = NULL;
	FtConditionWidgetFieldItem* _tmp0_;
	FtOperator selected_operator = 0;
	GType* _tmp1_ = NULL;
	FtConditionWidgetFieldItem* _tmp2_;
	GType* value_type = NULL;
	GType* _tmp10_;
	GtkDropDown* _tmp11_;
	GtkWidget* _tmp12_;
	GtkWidget* _tmp13_;
	GtkDropDown* _tmp16_;
	GtkWidget* _tmp17_;
	GtkWidget* _tmp18_;
	GType* _tmp21_;
	GType _tmp22_;
	GType* _tmp25_;
	GType _tmp26_;
	g_return_if_fail (self != NULL);
	_tmp0_ = ft_condition_widget_get_selected_field_item (self);
	selected_field_item = _tmp0_;
	selected_operator = ft_condition_widget_get_selected_operator (self);
	_tmp2_ = selected_field_item;
	if (_tmp2_ != NULL) {
		GType* _tmp3_ = NULL;
		FtConditionWidgetFieldItem* _tmp4_;
		FtVariableSpec* _tmp5_;
		FtVariableSpec* _tmp6_;
		GType* _tmp7_;
		GType* _tmp8_;
		_tmp4_ = selected_field_item;
		_tmp5_ = ft_condition_widget_field_item_get_variable_spec (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = __g_type_dup0 (&_tmp6_->value_type);
		_tmp3_ = _tmp7_;
		_tmp8_ = _tmp3_;
		_tmp3_ = NULL;
		_g_free0 (_tmp1_);
		_tmp1_ = _tmp8_;
		_g_free0 (_tmp3_);
	} else {
		GType* _tmp9_;
		_tmp9_ = __g_type_dup0 ((GType*) NULL);
		_g_free0 (_tmp1_);
		_tmp1_ = _tmp9_;
	}
	_tmp10_ = _tmp1_;
	_tmp1_ = NULL;
	value_type = _tmp10_;
	_tmp11_ = self->priv->enum_operator_dropdown;
	_tmp12_ = gtk_widget_get_parent ((GtkWidget*) _tmp11_);
	_tmp13_ = _tmp12_;
	if (_tmp13_ != NULL) {
		GtkFlowBox* _tmp14_;
		GtkDropDown* _tmp15_;
		_tmp14_ = self->priv->fields;
		_tmp15_ = self->priv->enum_operator_dropdown;
		gtk_flow_box_remove (_tmp14_, (GtkWidget*) _tmp15_);
	}
	_tmp16_ = self->priv->numerical_operator_dropdown;
	_tmp17_ = gtk_widget_get_parent ((GtkWidget*) _tmp16_);
	_tmp18_ = _tmp17_;
	if (_tmp18_ != NULL) {
		GtkFlowBox* _tmp19_;
		GtkDropDown* _tmp20_;
		_tmp19_ = self->priv->fields;
		_tmp20_ = self->priv->numerical_operator_dropdown;
		gtk_flow_box_remove (_tmp19_, (GtkWidget*) _tmp20_);
	}
	_tmp21_ = value_type;
	_tmp22_ = FT_TYPE_STATE_VALUE;
	if (_g_type_equal (_tmp21_, &_tmp22_) == TRUE) {
		GtkFlowBox* _tmp23_;
		GtkDropDown* _tmp24_;
		_tmp23_ = self->priv->fields;
		_tmp24_ = self->priv->enum_operator_dropdown;
		gtk_flow_box_insert (_tmp23_, (GtkWidget*) _tmp24_, 1);
	}
	_tmp25_ = value_type;
	_tmp26_ = FT_TYPE_INTERVAL_VALUE;
	if (_g_type_equal (_tmp25_, &_tmp26_) == TRUE) {
		GtkFlowBox* _tmp27_;
		GtkDropDown* _tmp28_;
		_tmp27_ = self->priv->fields;
		_tmp28_ = self->priv->numerical_operator_dropdown;
		gtk_flow_box_insert (_tmp27_, (GtkWidget*) _tmp28_, 1);
	}
	if (!ft_condition_widget_select_operator (self, selected_operator)) {
		GtkDropDown* _tmp29_;
		GtkDropDown* _tmp30_;
		_tmp29_ = self->priv->enum_operator_dropdown;
		gtk_drop_down_set_selected (_tmp29_, (guint) 0);
		_tmp30_ = self->priv->numerical_operator_dropdown;
		gtk_drop_down_set_selected (_tmp30_, (guint) 0);
	}
	ft_condition_widget_queue_update_expression (self);
	_g_free0 (value_type);
	_g_free0 (_tmp1_);
	_g_object_unref0 (selected_field_item);
}

static void
ft_condition_widget_update_value_fields (FtConditionWidget* self)
{
	FtConditionWidgetFieldItem* selected_field_item = NULL;
	FtConditionWidgetFieldItem* _tmp0_;
	FtValue* selected_value = NULL;
	FtValue* _tmp1_;
	GType* _tmp2_ = NULL;
	FtConditionWidgetFieldItem* _tmp3_;
	GType* value_type = NULL;
	GType* _tmp11_;
	GtkDropDown* _tmp12_;
	GtkWidget* _tmp13_;
	GtkWidget* _tmp14_;
	GtkDropDown* _tmp17_;
	GtkWidget* _tmp18_;
	GtkWidget* _tmp19_;
	GtkSpinButton* _tmp22_;
	GtkWidget* _tmp23_;
	GtkWidget* _tmp24_;
	GtkDropDown* _tmp27_;
	GtkWidget* _tmp28_;
	GtkWidget* _tmp29_;
	GType* _tmp32_;
	GType _tmp33_;
	GType* _tmp36_;
	GType _tmp37_;
	GType* _tmp40_;
	GType _tmp41_;
	FtValue* _tmp46_;
	g_return_if_fail (self != NULL);
	_tmp0_ = ft_condition_widget_get_selected_field_item (self);
	selected_field_item = _tmp0_;
	_tmp1_ = ft_condition_widget_get_selected_value (self);
	selected_value = _tmp1_;
	_tmp3_ = selected_field_item;
	if (_tmp3_ != NULL) {
		GType* _tmp4_ = NULL;
		FtConditionWidgetFieldItem* _tmp5_;
		FtVariableSpec* _tmp6_;
		FtVariableSpec* _tmp7_;
		GType* _tmp8_;
		GType* _tmp9_;
		_tmp5_ = selected_field_item;
		_tmp6_ = ft_condition_widget_field_item_get_variable_spec (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = __g_type_dup0 (&_tmp7_->value_type);
		_tmp4_ = _tmp8_;
		_tmp9_ = _tmp4_;
		_tmp4_ = NULL;
		_g_free0 (_tmp2_);
		_tmp2_ = _tmp9_;
		_g_free0 (_tmp4_);
	} else {
		GType* _tmp10_;
		_tmp10_ = __g_type_dup0 ((GType*) NULL);
		_g_free0 (_tmp2_);
		_tmp2_ = _tmp10_;
	}
	_tmp11_ = _tmp2_;
	_tmp2_ = NULL;
	value_type = _tmp11_;
	_tmp12_ = self->priv->state_dropdown;
	_tmp13_ = gtk_widget_get_parent ((GtkWidget*) _tmp12_);
	_tmp14_ = _tmp13_;
	if (_tmp14_ != NULL) {
		GtkFlowBox* _tmp15_;
		GtkDropDown* _tmp16_;
		_tmp15_ = self->priv->fields;
		_tmp16_ = self->priv->state_dropdown;
		gtk_flow_box_remove (_tmp15_, (GtkWidget*) _tmp16_);
	}
	_tmp17_ = self->priv->boolean_dropdown;
	_tmp18_ = gtk_widget_get_parent ((GtkWidget*) _tmp17_);
	_tmp19_ = _tmp18_;
	if (_tmp19_ != NULL) {
		GtkFlowBox* _tmp20_;
		GtkDropDown* _tmp21_;
		_tmp20_ = self->priv->fields;
		_tmp21_ = self->priv->boolean_dropdown;
		gtk_flow_box_remove (_tmp20_, (GtkWidget*) _tmp21_);
	}
	_tmp22_ = self->priv->interval_spinbutton;
	_tmp23_ = gtk_widget_get_parent ((GtkWidget*) _tmp22_);
	_tmp24_ = _tmp23_;
	if (_tmp24_ != NULL) {
		GtkFlowBox* _tmp25_;
		GtkSpinButton* _tmp26_;
		_tmp25_ = self->priv->fields;
		_tmp26_ = self->priv->interval_spinbutton;
		gtk_flow_box_remove (_tmp25_, (GtkWidget*) _tmp26_);
	}
	_tmp27_ = self->priv->interval_unit_dropdown;
	_tmp28_ = gtk_widget_get_parent ((GtkWidget*) _tmp27_);
	_tmp29_ = _tmp28_;
	if (_tmp29_ != NULL) {
		GtkFlowBox* _tmp30_;
		GtkDropDown* _tmp31_;
		_tmp30_ = self->priv->fields;
		_tmp31_ = self->priv->interval_unit_dropdown;
		gtk_flow_box_remove (_tmp30_, (GtkWidget*) _tmp31_);
	}
	_tmp32_ = value_type;
	_tmp33_ = FT_TYPE_STATE_VALUE;
	if (_g_type_equal (_tmp32_, &_tmp33_) == TRUE) {
		GtkFlowBox* _tmp34_;
		GtkDropDown* _tmp35_;
		_tmp34_ = self->priv->fields;
		_tmp35_ = self->priv->state_dropdown;
		gtk_flow_box_append (_tmp34_, (GtkWidget*) _tmp35_);
	}
	_tmp36_ = value_type;
	_tmp37_ = FT_TYPE_BOOLEAN_VALUE;
	if (_g_type_equal (_tmp36_, &_tmp37_) == TRUE) {
		GtkFlowBox* _tmp38_;
		GtkDropDown* _tmp39_;
		_tmp38_ = self->priv->fields;
		_tmp39_ = self->priv->boolean_dropdown;
		gtk_flow_box_append (_tmp38_, (GtkWidget*) _tmp39_);
	}
	_tmp40_ = value_type;
	_tmp41_ = FT_TYPE_INTERVAL_VALUE;
	if (_g_type_equal (_tmp40_, &_tmp41_) == TRUE) {
		GtkFlowBox* _tmp42_;
		GtkSpinButton* _tmp43_;
		GtkFlowBox* _tmp44_;
		GtkDropDown* _tmp45_;
		_tmp42_ = self->priv->fields;
		_tmp43_ = self->priv->interval_spinbutton;
		gtk_flow_box_append (_tmp42_, (GtkWidget*) _tmp43_);
		_tmp44_ = self->priv->fields;
		_tmp45_ = self->priv->interval_unit_dropdown;
		gtk_flow_box_append (_tmp44_, (GtkWidget*) _tmp45_);
	}
	_tmp46_ = selected_value;
	if (!ft_condition_widget_select_value (self, _tmp46_)) {
		GtkDropDown* _tmp47_;
		GtkDropDown* _tmp48_;
		_tmp47_ = self->priv->state_dropdown;
		gtk_drop_down_set_selected (_tmp47_, (guint) 0);
		_tmp48_ = self->priv->boolean_dropdown;
		gtk_drop_down_set_selected (_tmp48_, (guint) 0);
	}
	ft_condition_widget_queue_update_expression (self);
	_g_free0 (value_type);
	_g_free0 (_tmp2_);
	_ft_value_unref0 (selected_value);
	_g_object_unref0 (selected_field_item);
}

static void
ft_condition_widget_on_field_notify_selected_item (FtConditionWidget* self,
                                                   GObject* object,
                                                   GParamSpec* pspec)
{
	GtkDropDown* _tmp0_;
	GListModel* _tmp1_;
	GListModel* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (pspec != NULL);
	_tmp0_ = self->priv->field_dropdown;
	_tmp1_ = gtk_drop_down_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		return;
	}
	ft_condition_widget_update_empty_item (self);
	ft_condition_widget_update_operator_fields (self);
	ft_condition_widget_update_value_fields (self);
}

static void
_ft_condition_widget_on_field_notify_selected_item_g_object_notify (GObject* _sender,
                                                                    GParamSpec* pspec,
                                                                    gpointer self)
{
	ft_condition_widget_on_field_notify_selected_item ((FtConditionWidget*) self, _sender, pspec);
}

static void
ft_condition_widget_on_enum_operator_notify_selected_item (FtConditionWidget* self,
                                                           GObject* object,
                                                           GParamSpec* pspec)
{
	GtkDropDown* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (pspec != NULL);
	_tmp0_ = self->priv->enum_operator_dropdown;
	_tmp1_ = gtk_widget_get_parent ((GtkWidget*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		return;
	}
	ft_condition_widget_queue_update_expression (self);
}

static void
_ft_condition_widget_on_enum_operator_notify_selected_item_g_object_notify (GObject* _sender,
                                                                            GParamSpec* pspec,
                                                                            gpointer self)
{
	ft_condition_widget_on_enum_operator_notify_selected_item ((FtConditionWidget*) self, _sender, pspec);
}

static void
ft_condition_widget_on_numerical_operator_notify_selected_item (FtConditionWidget* self,
                                                                GObject* object,
                                                                GParamSpec* pspec)
{
	GtkDropDown* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (pspec != NULL);
	_tmp0_ = self->priv->numerical_operator_dropdown;
	_tmp1_ = gtk_widget_get_parent ((GtkWidget*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		return;
	}
	ft_condition_widget_queue_update_expression (self);
}

static void
_ft_condition_widget_on_numerical_operator_notify_selected_item_g_object_notify (GObject* _sender,
                                                                                 GParamSpec* pspec,
                                                                                 gpointer self)
{
	ft_condition_widget_on_numerical_operator_notify_selected_item ((FtConditionWidget*) self, _sender, pspec);
}

static void
ft_condition_widget_on_state_notify_selected_item (FtConditionWidget* self,
                                                   GObject* object,
                                                   GParamSpec* pspec)
{
	GtkDropDown* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (pspec != NULL);
	_tmp0_ = self->priv->state_dropdown;
	_tmp1_ = gtk_widget_get_parent ((GtkWidget*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		return;
	}
	ft_condition_widget_queue_update_expression (self);
}

static void
_ft_condition_widget_on_state_notify_selected_item_g_object_notify (GObject* _sender,
                                                                    GParamSpec* pspec,
                                                                    gpointer self)
{
	ft_condition_widget_on_state_notify_selected_item ((FtConditionWidget*) self, _sender, pspec);
}

static void
ft_condition_widget_on_boolean_notify_selected_item (FtConditionWidget* self,
                                                     GObject* object,
                                                     GParamSpec* pspec)
{
	GtkDropDown* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (pspec != NULL);
	_tmp0_ = self->priv->boolean_dropdown;
	_tmp1_ = gtk_widget_get_parent ((GtkWidget*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		return;
	}
	ft_condition_widget_queue_update_expression (self);
}

static void
_ft_condition_widget_on_boolean_notify_selected_item_g_object_notify (GObject* _sender,
                                                                      GParamSpec* pspec,
                                                                      gpointer self)
{
	ft_condition_widget_on_boolean_notify_selected_item ((FtConditionWidget*) self, _sender, pspec);
}

static void
ft_condition_widget_on_interval_adjustment_value_changed (FtConditionWidget* self)
{
	GtkSpinButton* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->interval_spinbutton;
	_tmp1_ = gtk_widget_get_parent ((GtkWidget*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		return;
	}
	ft_condition_widget_queue_update_expression (self);
}

static void
_ft_condition_widget_on_interval_adjustment_value_changed_gtk_adjustment_value_changed (GtkAdjustment* _sender,
                                                                                        gpointer self)
{
	ft_condition_widget_on_interval_adjustment_value_changed ((FtConditionWidget*) self);
}

static void
ft_condition_widget_on_interval_unit_notify_selected_item (FtConditionWidget* self,
                                                           GObject* object,
                                                           GParamSpec* pspec)
{
	GtkDropDown* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (pspec != NULL);
	_tmp0_ = self->priv->interval_unit_dropdown;
	_tmp1_ = gtk_widget_get_parent ((GtkWidget*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		return;
	}
	ft_condition_widget_queue_update_expression (self);
}

static void
_ft_condition_widget_on_interval_unit_notify_selected_item_g_object_notify (GObject* _sender,
                                                                            GParamSpec* pspec,
                                                                            gpointer self)
{
	ft_condition_widget_on_interval_unit_notify_selected_item ((FtConditionWidget*) self, _sender, pspec);
}

static void
ft_condition_widget_on_remove_button_clicked (FtConditionWidget* self,
                                              GtkButton* button)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	g_signal_emit_by_name ((FtExpressionWidget*) self, "request-remove");
}

static void
_ft_condition_widget_on_remove_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                  gpointer self)
{
	ft_condition_widget_on_remove_button_clicked ((FtConditionWidget*) self, _sender);
}

static void
ft_condition_widget_real_dispose (GObject* base)
{
	FtConditionWidget * self;
	GtkWidget* fields[7] = {0};
	GtkDropDown* _tmp0_;
	GtkWidget* _tmp1_;
	GtkDropDown* _tmp2_;
	GtkWidget* _tmp3_;
	GtkDropDown* _tmp4_;
	GtkWidget* _tmp5_;
	GtkDropDown* _tmp6_;
	GtkWidget* _tmp7_;
	GtkDropDown* _tmp8_;
	GtkWidget* _tmp9_;
	GtkSpinButton* _tmp10_;
	GtkWidget* _tmp11_;
	GtkDropDown* _tmp12_;
	GtkWidget* _tmp13_;
	GtkWidget* _tmp14_[7] = {0};
	GtkFlowBox* _tmp17_;
	self = (FtConditionWidget*) base;
	_tmp0_ = self->priv->field_dropdown;
	_tmp1_ = _g_object_ref0 ((GtkWidget*) _tmp0_);
	_tmp2_ = self->priv->enum_operator_dropdown;
	_tmp3_ = _g_object_ref0 ((GtkWidget*) _tmp2_);
	_tmp4_ = self->priv->numerical_operator_dropdown;
	_tmp5_ = _g_object_ref0 ((GtkWidget*) _tmp4_);
	_tmp6_ = self->priv->state_dropdown;
	_tmp7_ = _g_object_ref0 ((GtkWidget*) _tmp6_);
	_tmp8_ = self->priv->boolean_dropdown;
	_tmp9_ = _g_object_ref0 ((GtkWidget*) _tmp8_);
	_tmp10_ = self->priv->interval_spinbutton;
	_tmp11_ = _g_object_ref0 ((GtkWidget*) _tmp10_);
	_tmp12_ = self->priv->interval_unit_dropdown;
	_tmp13_ = _g_object_ref0 ((GtkWidget*) _tmp12_);
	_tmp14_[0] = _tmp1_;
	_tmp14_[1] = _tmp3_;
	_tmp14_[2] = _tmp5_;
	_tmp14_[3] = _tmp7_;
	_tmp14_[4] = _tmp9_;
	_tmp14_[5] = _tmp11_;
	_tmp14_[6] = _tmp13_;
	memcpy (fields, _tmp14_, 7 * sizeof (GtkWidget*));
	{
		GtkWidget** field_collection = NULL;
		gint field_collection_length1 = 0;
		gint _field_collection_size_ = 0;
		gint field_it = 0;
		field_collection = fields;
		field_collection_length1 = 7;
		for (field_it = 0; field_it < field_collection_length1; field_it = field_it + 1) {
			GtkWidget* _tmp15_;
			GtkWidget* field = NULL;
			_tmp15_ = _g_object_ref0 (field_collection[field_it]);
			field = _tmp15_;
			{
				GtkWidget* _tmp16_;
				_tmp16_ = field;
				g_object_unref ((GObject*) _tmp16_);
				_g_object_unref0 (field);
			}
		}
	}
	if (self->priv->update_idle_id != ((guint) 0)) {
		gtk_widget_remove_tick_callback ((GtkWidget*) self, self->priv->update_idle_id);
		self->priv->update_idle_id = (guint) 0;
	}
	_tmp17_ = self->priv->fields;
	gtk_flow_box_remove_all (_tmp17_);
	_ft_expression_unref0 (self->priv->_comparison);
	self->priv->_comparison = NULL;
	gtk_widget_dispose_template ((GtkWidget*) self, FT_TYPE_CONDITION_GROUP_WIDGET);
	G_OBJECT_CLASS (ft_condition_widget_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_box_get_type (), GtkBox));
	_vala_array_destroy (fields, 7, (GDestroyNotify) g_object_unref);
}

FtConditionWidget*
ft_condition_widget_construct (GType object_type)
{
	FtConditionWidget * self = NULL;
	self = (FtConditionWidget*) g_object_new (object_type, NULL);
	return self;
}

FtConditionWidget*
ft_condition_widget_new (void)
{
	return ft_condition_widget_construct (FT_TYPE_CONDITION_WIDGET);
}

static FtExpression*
ft_condition_widget_real_get_expression (FtExpressionWidget* base)
{
	FtExpression* result;
	FtConditionWidget* self;
	FtComparison* _tmp0_;
	self = (FtConditionWidget*) base;
	_tmp0_ = self->priv->_comparison;
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, FT_TYPE_EXPRESSION, FtExpression);
	return result;
}

static void
ft_condition_widget_real_set_expression (FtExpressionWidget* base,
                                         FtExpression* value)
{
	FtConditionWidget* self;
	FtComparison* comparison = NULL;
	FtComparison* _tmp0_;
	gboolean _tmp1_ = FALSE;
	FtComparison* _tmp4_;
	FtComparison* _tmp5_;
	FtComparison* _tmp6_;
	FtComparison* _tmp7_;
	self = (FtConditionWidget*) base;
	_tmp0_ = _ft_expression_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (value, FT_TYPE_COMPARISON) ? ((FtComparison*) value) : NULL);
	comparison = _tmp0_;
	if (value != NULL) {
		FtComparison* _tmp2_;
		_tmp2_ = comparison;
		_tmp1_ = _tmp2_ == NULL;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		FtComparison* _tmp3_;
		_tmp3_ = ft_comparison_new_is_true (value);
		_ft_expression_unref0 (comparison);
		comparison = _tmp3_;
	}
	_tmp4_ = self->priv->_comparison;
	_tmp5_ = comparison;
	if (_tmp4_ == _tmp5_) {
		_ft_expression_unref0 (comparison);
		return;
	}
	_tmp6_ = comparison;
	_tmp7_ = _ft_expression_ref0 (_tmp6_);
	_ft_expression_unref0 (self->priv->_comparison);
	self->priv->_comparison = _tmp7_;
	ft_condition_widget_populate (self);
	g_object_notify ((GObject*) self, "expression");
	_ft_expression_unref0 (comparison);
}

static gboolean
ft_condition_widget_real_get_removable (FtExpressionWidget* base)
{
	gboolean result;
	FtConditionWidget* self;
	self = (FtConditionWidget*) base;
	result = self->priv->_removable;
	return result;
}

static void
ft_condition_widget_real_set_removable (FtExpressionWidget* base,
                                        gboolean value)
{
	FtConditionWidget* self;
	gboolean old_value;
	self = (FtConditionWidget*) base;
	old_value = ft_condition_widget_real_get_removable (base);
	if (old_value != value) {
		self->priv->_removable = value;
		g_object_notify_by_pspec ((GObject *) self, ft_condition_widget_properties[FT_CONDITION_WIDGET_REMOVABLE_PROPERTY]);
	}
}

static inline gpointer
ft_condition_widget_field_item_get_instance_private (FtConditionWidgetFieldItem* self)
{
	return G_STRUCT_MEMBER_P (self, FtConditionWidgetFieldItem_private_offset);
}

static FtConditionWidgetFieldItem*
ft_condition_widget_field_item_construct (GType object_type,
                                          const gchar* name,
                                          const gchar* label)
{
	FtConditionWidgetFieldItem * self = NULL;
	FtVariableSpec* _tmp0_;
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (label != NULL, NULL);
	_tmp0_ = ft_find_variable (name);
	self = (FtConditionWidgetFieldItem*) g_object_new (object_type, "name", name, "label", label, "variable-spec", _tmp0_, NULL);
	return self;
}

static FtConditionWidgetFieldItem*
ft_condition_widget_field_item_new (const gchar* name,
                                    const gchar* label)
{
	return ft_condition_widget_field_item_construct (FT_CONDITION_WIDGET_TYPE_FIELD_ITEM, name, label);
}

static const gchar*
ft_condition_widget_field_item_get_name (FtConditionWidgetFieldItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_name;
	result = _tmp0_;
	return result;
}

static void
ft_condition_widget_field_item_set_name (FtConditionWidgetFieldItem* self,
                                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_condition_widget_field_item_get_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_name);
		self->priv->_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_condition_widget_field_item_properties[FT_CONDITION_WIDGET_FIELD_ITEM_NAME_PROPERTY]);
	}
}

static const gchar*
ft_condition_widget_field_item_get_label (FtConditionWidgetFieldItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_label;
	result = _tmp0_;
	return result;
}

static void
ft_condition_widget_field_item_set_label (FtConditionWidgetFieldItem* self,
                                          const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_condition_widget_field_item_get_label (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_label);
		self->priv->_label = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_condition_widget_field_item_properties[FT_CONDITION_WIDGET_FIELD_ITEM_LABEL_PROPERTY]);
	}
}

static FtVariableSpec*
ft_condition_widget_field_item_get_variable_spec (FtConditionWidgetFieldItem* self)
{
	FtVariableSpec* result;
	FtVariableSpec* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_variable_spec;
	result = _tmp0_;
	return result;
}

static gpointer
_ft_variable_spec_ref0 (gpointer self)
{
	return self ? ft_variable_spec_ref (self) : NULL;
}

static void
ft_condition_widget_field_item_set_variable_spec (FtConditionWidgetFieldItem* self,
                                                  FtVariableSpec* value)
{
	FtVariableSpec* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_condition_widget_field_item_get_variable_spec (self);
	if (old_value != value) {
		FtVariableSpec* _tmp0_;
		_tmp0_ = _ft_variable_spec_ref0 (value);
		_ft_variable_spec_unref0 (self->priv->_variable_spec);
		self->priv->_variable_spec = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_condition_widget_field_item_properties[FT_CONDITION_WIDGET_FIELD_ITEM_VARIABLE_SPEC_PROPERTY]);
	}
}

static void
ft_condition_widget_field_item_class_init (FtConditionWidgetFieldItemClass * klass,
                                           gpointer klass_data)
{
	ft_condition_widget_field_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtConditionWidgetFieldItem_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_condition_widget_field_item_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_condition_widget_field_item_set_property;
	G_OBJECT_CLASS (klass)->finalize = ft_condition_widget_field_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CONDITION_WIDGET_FIELD_ITEM_NAME_PROPERTY, ft_condition_widget_field_item_properties[FT_CONDITION_WIDGET_FIELD_ITEM_NAME_PROPERTY] = g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CONDITION_WIDGET_FIELD_ITEM_LABEL_PROPERTY, ft_condition_widget_field_item_properties[FT_CONDITION_WIDGET_FIELD_ITEM_LABEL_PROPERTY] = g_param_spec_string ("label", "label", "label", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CONDITION_WIDGET_FIELD_ITEM_VARIABLE_SPEC_PROPERTY, ft_condition_widget_field_item_properties[FT_CONDITION_WIDGET_FIELD_ITEM_VARIABLE_SPEC_PROPERTY] = ft_param_spec_variable_spec ("variable-spec", "variable-spec", "variable-spec", FT_TYPE_VARIABLE_SPEC, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
ft_condition_widget_field_item_instance_init (FtConditionWidgetFieldItem * self,
                                              gpointer klass)
{
	self->priv = ft_condition_widget_field_item_get_instance_private (self);
}

static void
ft_condition_widget_field_item_finalize (GObject * obj)
{
	FtConditionWidgetFieldItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_CONDITION_WIDGET_TYPE_FIELD_ITEM, FtConditionWidgetFieldItem);
	_g_free0 (self->priv->_name);
	_g_free0 (self->priv->_label);
	_ft_variable_spec_unref0 (self->priv->_variable_spec);
	G_OBJECT_CLASS (ft_condition_widget_field_item_parent_class)->finalize (obj);
}

static GType
ft_condition_widget_field_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtConditionWidgetFieldItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_condition_widget_field_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtConditionWidgetFieldItem), 0, (GInstanceInitFunc) ft_condition_widget_field_item_instance_init, NULL };
	GType ft_condition_widget_field_item_type_id;
	ft_condition_widget_field_item_type_id = g_type_register_static (G_TYPE_OBJECT, "FtConditionWidgetFieldItem", &g_define_type_info, 0);
	FtConditionWidgetFieldItem_private_offset = g_type_add_instance_private (ft_condition_widget_field_item_type_id, sizeof (FtConditionWidgetFieldItemPrivate));
	return ft_condition_widget_field_item_type_id;
}

static GType
ft_condition_widget_field_item_get_type (void)
{
	static volatile gsize ft_condition_widget_field_item_type_id__once = 0;
	if (g_once_init_enter (&ft_condition_widget_field_item_type_id__once)) {
		GType ft_condition_widget_field_item_type_id;
		ft_condition_widget_field_item_type_id = ft_condition_widget_field_item_get_type_once ();
		g_once_init_leave (&ft_condition_widget_field_item_type_id__once, ft_condition_widget_field_item_type_id);
	}
	return ft_condition_widget_field_item_type_id__once;
}

static void
_vala_ft_condition_widget_field_item_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec)
{
	FtConditionWidgetFieldItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_CONDITION_WIDGET_TYPE_FIELD_ITEM, FtConditionWidgetFieldItem);
	switch (property_id) {
		case FT_CONDITION_WIDGET_FIELD_ITEM_NAME_PROPERTY:
		g_value_set_string (value, ft_condition_widget_field_item_get_name (self));
		break;
		case FT_CONDITION_WIDGET_FIELD_ITEM_LABEL_PROPERTY:
		g_value_set_string (value, ft_condition_widget_field_item_get_label (self));
		break;
		case FT_CONDITION_WIDGET_FIELD_ITEM_VARIABLE_SPEC_PROPERTY:
		ft_value_set_variable_spec (value, ft_condition_widget_field_item_get_variable_spec (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_condition_widget_field_item_set_property (GObject * object,
                                                   guint property_id,
                                                   const GValue * value,
                                                   GParamSpec * pspec)
{
	FtConditionWidgetFieldItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_CONDITION_WIDGET_TYPE_FIELD_ITEM, FtConditionWidgetFieldItem);
	switch (property_id) {
		case FT_CONDITION_WIDGET_FIELD_ITEM_NAME_PROPERTY:
		ft_condition_widget_field_item_set_name (self, g_value_get_string (value));
		break;
		case FT_CONDITION_WIDGET_FIELD_ITEM_LABEL_PROPERTY:
		ft_condition_widget_field_item_set_label (self, g_value_get_string (value));
		break;
		case FT_CONDITION_WIDGET_FIELD_ITEM_VARIABLE_SPEC_PROPERTY:
		ft_condition_widget_field_item_set_variable_spec (self, ft_value_get_variable_spec (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static GObject *
ft_condition_widget_constructor (GType type,
                                 guint n_construct_properties,
                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FtConditionWidget * self;
	GListStore* fields_list = NULL;
	GListStore* _tmp0_;
	GListStore* _tmp1_;
	FtConditionWidgetFieldItem* _tmp2_;
	FtConditionWidgetFieldItem* _tmp3_;
	FtConditionWidgetFieldItem* _tmp4_;
	FtConditionWidgetFieldItem* _tmp5_;
	FtConditionWidgetFieldItem* _tmp6_;
	FtConditionWidgetFieldItem* _tmp7_;
	FtConditionWidgetFieldItem* _tmp8_;
	GObject** _tmp9_;
	GObject** _tmp10_;
	gint _tmp10__length1;
	GtkDropDown* _tmp11_;
	GtkPropertyExpression* _tmp12_;
	GtkPropertyExpression* _tmp13_;
	GtkDropDown* _tmp14_;
	GListStore* _tmp15_;
	GtkWidget** fields = NULL;
	GtkDropDown* _tmp16_;
	GtkWidget* _tmp17_;
	GtkDropDown* _tmp18_;
	GtkWidget* _tmp19_;
	GtkDropDown* _tmp20_;
	GtkWidget* _tmp21_;
	GtkDropDown* _tmp22_;
	GtkWidget* _tmp23_;
	GtkDropDown* _tmp24_;
	GtkWidget* _tmp25_;
	GtkSpinButton* _tmp26_;
	GtkWidget* _tmp27_;
	GtkDropDown* _tmp28_;
	GtkWidget* _tmp29_;
	GtkWidget** _tmp30_;
	gint fields_length1;
	gint _fields_size_;
	GtkWidget** _tmp31_;
	gint _tmp31__length1;
	GtkFlowBox* _tmp34_;
	GtkFlowBox* _tmp35_;
	GtkDropDown* _tmp36_;
	parent_class = G_OBJECT_CLASS (ft_condition_widget_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_CONDITION_WIDGET, FtConditionWidget);
	_tmp0_ = g_list_store_new (FT_CONDITION_WIDGET_TYPE_FIELD_ITEM);
	fields_list = _tmp0_;
	_tmp1_ = fields_list;
	_tmp2_ = ft_condition_widget_field_item_new ("", _ ("Select Field…"));
	_tmp3_ = ft_condition_widget_field_item_new ("state", _ ("State"));
	_tmp4_ = ft_condition_widget_field_item_new ("is-started", _ ("Started"));
	_tmp5_ = ft_condition_widget_field_item_new ("is-paused", _ ("Paused"));
	_tmp6_ = ft_condition_widget_field_item_new ("is-running", _ ("Running"));
	_tmp7_ = ft_condition_widget_field_item_new ("is-finished", _ ("Finished"));
	_tmp8_ = ft_condition_widget_field_item_new ("duration", _ ("Duration"));
	_tmp9_ = g_new0 (GObject*, 7 + 1);
	_tmp9_[0] = (GObject*) _tmp2_;
	_tmp9_[1] = (GObject*) _tmp3_;
	_tmp9_[2] = (GObject*) _tmp4_;
	_tmp9_[3] = (GObject*) _tmp5_;
	_tmp9_[4] = (GObject*) _tmp6_;
	_tmp9_[5] = (GObject*) _tmp7_;
	_tmp9_[6] = (GObject*) _tmp8_;
	_tmp10_ = _tmp9_;
	_tmp10__length1 = 7;
	g_list_store_splice (_tmp1_, (guint) 0, (guint) 0, _tmp10_, (guint) 7);
	_tmp10_ = (_vala_array_free (_tmp10_, _tmp10__length1, (GDestroyNotify) g_object_unref), NULL);
	_tmp11_ = self->priv->field_dropdown;
	_tmp12_ = (GtkPropertyExpression*) gtk_property_expression_new (FT_CONDITION_WIDGET_TYPE_FIELD_ITEM, NULL, "label");
	_tmp13_ = _tmp12_;
	gtk_drop_down_set_expression (_tmp11_, (GtkExpression*) _tmp13_);
	_gtk_expression_unref0 (_tmp13_);
	_tmp14_ = self->priv->field_dropdown;
	_tmp15_ = fields_list;
	gtk_drop_down_set_model (_tmp14_, (GListModel*) _tmp15_);
	ft_condition_widget_update_operator_fields (self);
	ft_condition_widget_update_value_fields (self);
	_tmp16_ = self->priv->field_dropdown;
	_tmp17_ = _g_object_ref0 ((GtkWidget*) _tmp16_);
	_tmp18_ = self->priv->enum_operator_dropdown;
	_tmp19_ = _g_object_ref0 ((GtkWidget*) _tmp18_);
	_tmp20_ = self->priv->numerical_operator_dropdown;
	_tmp21_ = _g_object_ref0 ((GtkWidget*) _tmp20_);
	_tmp22_ = self->priv->state_dropdown;
	_tmp23_ = _g_object_ref0 ((GtkWidget*) _tmp22_);
	_tmp24_ = self->priv->boolean_dropdown;
	_tmp25_ = _g_object_ref0 ((GtkWidget*) _tmp24_);
	_tmp26_ = self->priv->interval_spinbutton;
	_tmp27_ = _g_object_ref0 ((GtkWidget*) _tmp26_);
	_tmp28_ = self->priv->interval_unit_dropdown;
	_tmp29_ = _g_object_ref0 ((GtkWidget*) _tmp28_);
	_tmp30_ = g_new0 (GtkWidget*, 7 + 1);
	_tmp30_[0] = _tmp17_;
	_tmp30_[1] = _tmp19_;
	_tmp30_[2] = _tmp21_;
	_tmp30_[3] = _tmp23_;
	_tmp30_[4] = _tmp25_;
	_tmp30_[5] = _tmp27_;
	_tmp30_[6] = _tmp29_;
	fields = _tmp30_;
	fields_length1 = 7;
	_fields_size_ = fields_length1;
	_tmp31_ = fields;
	_tmp31__length1 = fields_length1;
	{
		GtkWidget** field_collection = NULL;
		gint field_collection_length1 = 0;
		gint _field_collection_size_ = 0;
		gint field_it = 0;
		field_collection = _tmp31_;
		field_collection_length1 = _tmp31__length1;
		for (field_it = 0; field_it < field_collection_length1; field_it = field_it + 1) {
			GtkWidget* _tmp32_;
			GtkWidget* field = NULL;
			_tmp32_ = _g_object_ref0 (field_collection[field_it]);
			field = _tmp32_;
			{
				GtkWidget* _tmp33_;
				_tmp33_ = field;
				g_object_ref ((GObject*) _tmp33_);
				_g_object_unref0 (field);
			}
		}
	}
	_tmp34_ = self->priv->fields;
	gtk_flow_box_remove_all (_tmp34_);
	_tmp35_ = self->priv->fields;
	_tmp36_ = self->priv->field_dropdown;
	gtk_flow_box_append (_tmp35_, (GtkWidget*) _tmp36_);
	fields = (_vala_array_free (fields, fields_length1, (GDestroyNotify) g_object_unref), NULL);
	_g_object_unref0 (fields_list);
	return obj;
}

static void
ft_condition_widget_class_init (FtConditionWidgetClass * klass,
                                gpointer klass_data)
{
	ft_condition_widget_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtConditionWidget_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) ft_condition_widget_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_condition_widget_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_condition_widget_set_property;
	G_OBJECT_CLASS (klass)->constructor = ft_condition_widget_constructor;
	G_OBJECT_CLASS (klass)->finalize = ft_condition_widget_finalize;
	/**
	         * This widget can only represent `Comparison` expressions at the moment. It's possible
	         * to extend it to handle more types of expressions, like using variables directly.
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CONDITION_WIDGET_EXPRESSION_PROPERTY, ft_condition_widget_properties[FT_CONDITION_WIDGET_EXPRESSION_PROPERTY] = ft_param_spec_expression ("expression", "expression", "expression", FT_TYPE_EXPRESSION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CONDITION_WIDGET_REMOVABLE_PROPERTY, ft_condition_widget_properties[FT_CONDITION_WIDGET_REMOVABLE_PROPERTY] = g_param_spec_boolean ("removable", "removable", "removable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/io/github/focustimerhq/FocusTimer/ui/preferences/automation/action/condition-widget.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "fields", FALSE, FtConditionWidget_private_offset + G_STRUCT_OFFSET (FtConditionWidgetPrivate, fields));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "field_dropdown", FALSE, FtConditionWidget_private_offset + G_STRUCT_OFFSET (FtConditionWidgetPrivate, field_dropdown));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "enum_operator_dropdown", FALSE, FtConditionWidget_private_offset + G_STRUCT_OFFSET (FtConditionWidgetPrivate, enum_operator_dropdown));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "numerical_operator_dropdown", FALSE, FtConditionWidget_private_offset + G_STRUCT_OFFSET (FtConditionWidgetPrivate, numerical_operator_dropdown));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "state_dropdown", FALSE, FtConditionWidget_private_offset + G_STRUCT_OFFSET (FtConditionWidgetPrivate, state_dropdown));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "boolean_dropdown", FALSE, FtConditionWidget_private_offset + G_STRUCT_OFFSET (FtConditionWidgetPrivate, boolean_dropdown));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "interval_spinbutton", FALSE, FtConditionWidget_private_offset + G_STRUCT_OFFSET (FtConditionWidgetPrivate, interval_spinbutton));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "interval_unit_dropdown", FALSE, FtConditionWidget_private_offset + G_STRUCT_OFFSET (FtConditionWidgetPrivate, interval_unit_dropdown));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_field_notify_selected_item", G_CALLBACK(_ft_condition_widget_on_field_notify_selected_item_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_enum_operator_notify_selected_item", G_CALLBACK(_ft_condition_widget_on_enum_operator_notify_selected_item_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_numerical_operator_notify_selected_item", G_CALLBACK(_ft_condition_widget_on_numerical_operator_notify_selected_item_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_state_notify_selected_item", G_CALLBACK(_ft_condition_widget_on_state_notify_selected_item_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_boolean_notify_selected_item", G_CALLBACK(_ft_condition_widget_on_boolean_notify_selected_item_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_interval_adjustment_value_changed", G_CALLBACK(_ft_condition_widget_on_interval_adjustment_value_changed_gtk_adjustment_value_changed));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_interval_unit_notify_selected_item", G_CALLBACK(_ft_condition_widget_on_interval_unit_notify_selected_item_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_remove_button_clicked", G_CALLBACK(_ft_condition_widget_on_remove_button_clicked_gtk_button_clicked));
	gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (klass), "condition");
}

static void
ft_condition_widget_ft_expression_widget_interface_init (FtExpressionWidgetIface * iface,
                                                         gpointer iface_data)
{
	ft_condition_widget_ft_expression_widget_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_expression = ft_condition_widget_real_get_expression;
	iface->set_expression = ft_condition_widget_real_set_expression;
	iface->get_removable = ft_condition_widget_real_get_removable;
	iface->set_removable = ft_condition_widget_real_set_removable;
}

static void
ft_condition_widget_instance_init (FtConditionWidget * self,
                                   gpointer klass)
{
	self->priv = ft_condition_widget_get_instance_private (self);
	self->priv->_removable = FALSE;
	self->priv->_comparison = NULL;
	self->priv->update_idle_id = (guint) 0;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
ft_condition_widget_finalize (GObject * obj)
{
	FtConditionWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_CONDITION_WIDGET, FtConditionWidget);
	_ft_expression_unref0 (self->priv->_comparison);
	G_OBJECT_CLASS (ft_condition_widget_parent_class)->finalize (obj);
}

static GType
ft_condition_widget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtConditionWidgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_condition_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtConditionWidget), 0, (GInstanceInitFunc) ft_condition_widget_instance_init, NULL };
	static const GInterfaceInfo ft_expression_widget_info = { (GInterfaceInitFunc) ft_condition_widget_ft_expression_widget_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType ft_condition_widget_type_id;
	ft_condition_widget_type_id = g_type_register_static (gtk_box_get_type (), "FtConditionWidget", &g_define_type_info, 0);
	g_type_add_interface_static (ft_condition_widget_type_id, FT_TYPE_EXPRESSION_WIDGET, &ft_expression_widget_info);
	FtConditionWidget_private_offset = g_type_add_instance_private (ft_condition_widget_type_id, sizeof (FtConditionWidgetPrivate));
	return ft_condition_widget_type_id;
}

GType
ft_condition_widget_get_type (void)
{
	static volatile gsize ft_condition_widget_type_id__once = 0;
	if (g_once_init_enter (&ft_condition_widget_type_id__once)) {
		GType ft_condition_widget_type_id;
		ft_condition_widget_type_id = ft_condition_widget_get_type_once ();
		g_once_init_leave (&ft_condition_widget_type_id__once, ft_condition_widget_type_id);
	}
	return ft_condition_widget_type_id__once;
}

static void
_vala_ft_condition_widget_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	FtConditionWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_CONDITION_WIDGET, FtConditionWidget);
	switch (property_id) {
		case FT_CONDITION_WIDGET_EXPRESSION_PROPERTY:
		ft_value_set_expression (value, ft_expression_widget_get_expression ((FtExpressionWidget*) self));
		break;
		case FT_CONDITION_WIDGET_REMOVABLE_PROPERTY:
		g_value_set_boolean (value, ft_expression_widget_get_removable ((FtExpressionWidget*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_condition_widget_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	FtConditionWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_CONDITION_WIDGET, FtConditionWidget);
	switch (property_id) {
		case FT_CONDITION_WIDGET_EXPRESSION_PROPERTY:
		ft_expression_widget_set_expression ((FtExpressionWidget*) self, ft_value_get_expression (value));
		break;
		case FT_CONDITION_WIDGET_REMOVABLE_PROPERTY:
		ft_expression_widget_set_removable ((FtExpressionWidget*) self, g_value_get_boolean (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;
}

