/* condition-group-widget.c generated by valac 0.56.19, the Vala compiler
 * generated from condition-group-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 "ft_ui.h"
#include <glib.h>
#include <gtk/gtk.h>
#include "ft_core.h"
#include <glib-object.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>
#include <gsk/gsk.h>
#include <graphene-gobject.h>
#include <cairo-gobject.h>

#define FT_CONDITION_GROUP_WIDGET_BRACKET_WIDTH 24
#define FT_CONDITION_GROUP_WIDGET_MIN_BRACKET_HEIGHT 20
#define FT_CONDITION_GROUP_WIDGET_MIN_WIDTH 300
#define FT_CONDITION_GROUP_WIDGET_NAT_WIDTH 300
#define FT_CONDITION_GROUP_WIDGET_PADDING 0
#define FT_CONDITION_GROUP_WIDGET_INDENT 60
#define FT_CONDITION_GROUP_WIDGET_SPACING 6
#define FT_CONDITION_GROUP_WIDGET_LINE_WIDTH 2.0f
#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_EXPRESSION_WIDGET_REQUEST_REMOVE_SIGNAL,
	FT_EXPRESSION_WIDGET_NUM_SIGNALS
};
static guint ft_expression_widget_signals[FT_EXPRESSION_WIDGET_NUM_SIGNALS] = {0};
typedef struct _FtConditionGroupWidget FtConditionGroupWidget;
typedef struct _FtConditionGroupWidgetClass FtConditionGroupWidgetClass;
typedef struct _FtConditionGroupWidgetPrivate FtConditionGroupWidgetPrivate;
typedef struct _FtGizmo FtGizmo;
typedef struct _FtGizmoClass FtGizmoClass;
enum  {
	FT_CONDITION_GROUP_WIDGET_0_PROPERTY,
	FT_CONDITION_GROUP_WIDGET_EXPRESSION_PROPERTY,
	FT_CONDITION_GROUP_WIDGET_OPERATOR_PROPERTY,
	FT_CONDITION_GROUP_WIDGET_REMOVABLE_PROPERTY,
	FT_CONDITION_GROUP_WIDGET_IS_NESTED_PROPERTY,
	FT_CONDITION_GROUP_WIDGET_NUM_PROPERTIES
};
static GParamSpec* ft_condition_group_widget_properties[FT_CONDITION_GROUP_WIDGET_NUM_PROPERTIES];
#define _ft_expression_unref0(var) ((var == NULL) ? NULL : (var = (ft_expression_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#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 _Block23Data Block23Data;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block24Data Block24Data;
typedef struct _Block25Data Block25Data;
typedef struct _Block26Data Block26Data;
#define _gsk_path_unref0(var) ((var == NULL) ? NULL : (var = (gsk_path_unref (var), NULL)))
#define __vala_GskStroke_free0(var) ((var == NULL) ? NULL : (var = (_vala_GskStroke_free (var), NULL)))
#define _gsk_path_builder_unref0(var) ((var == NULL) ? NULL : (var = (gsk_path_builder_unref (var), NULL)))

struct _FtConditionGroupWidget {
	GtkWidget parent_instance;
	FtConditionGroupWidgetPrivate * priv;
};

struct _FtConditionGroupWidgetClass {
	GtkWidgetClass parent_class;
};

struct _FtConditionGroupWidgetPrivate {
	gboolean _is_nested;
	GtkButton* operator_button;
	GtkBox* arguments_box;
	GtkBox* buttons_box;
	FtOperation* _operation;
	FtOperator _operator;
	gboolean _removable;
	FtGizmo* top_bracket;
	FtGizmo* bottom_bracket;
};

struct _Block23Data {
	int _ref_count_;
	FtConditionGroupWidget* self;
	GHashTable* existing_arguments;
};

struct _Block24Data {
	int _ref_count_;
	FtConditionGroupWidget* self;
	gint arguments_count;
};

struct _Block25Data {
	int _ref_count_;
	FtConditionGroupWidget* self;
	gint arguments_count;
	FtExpressionWidget* first_argument;
};

struct _Block26Data {
	int _ref_count_;
	FtConditionGroupWidget* self;
	FtExpression** arguments;
	gint arguments_length1;
	gint _arguments_size_;
};

static gint FtConditionGroupWidget_private_offset;
static gpointer ft_condition_group_widget_parent_class = NULL;
static FtExpressionWidgetIface * ft_condition_group_widget_ft_expression_widget_parent_iface = NULL;

static GType ft_expression_widget_get_type_once (void);
static FtConditionGroupWidget* ft_condition_group_widget_from_gizmo (FtGizmo* gizmo);
static void ft_condition_group_widget_measure_bracket_child_cb (FtGizmo* gizmo,
                                                         GtkOrientation orientation,
                                                         gint for_size,
                                                         gint* minimum,
                                                         gint* natural,
                                                         gint* minimum_baseline,
                                                         gint* natural_baseline);
static void ft_condition_group_widget_measure_bracket_child (FtConditionGroupWidget* self,
                                                      FtGizmo* gizmo,
                                                      GtkOrientation orientation,
                                                      gint for_size,
                                                      gint* minimum,
                                                      gint* natural,
                                                      gint* minimum_baseline,
                                                      gint* natural_baseline);
static void ft_condition_group_widget_snapshot_top_bracket_cb (FtGizmo* gizmo,
                                                        GtkSnapshot* snapshot);
static void ft_condition_group_widget_snapshot_top_bracket (FtConditionGroupWidget* self,
                                                     FtGizmo* gizmo,
                                                     GtkSnapshot* snapshot);
static void ft_condition_group_widget_snapshot_bottom_bracket_cb (FtGizmo* gizmo,
                                                           GtkSnapshot* snapshot);
static void ft_condition_group_widget_snapshot_bottom_bracket (FtConditionGroupWidget* self,
                                                        FtGizmo* gizmo,
                                                        GtkSnapshot* snapshot);
static FtExpressionWidget* ft_condition_group_widget_create_condition (FtConditionGroupWidget* self,
                                                                FtExpression* expression);
VALA_EXTERN GType ft_condition_widget_get_type (void) G_GNUC_CONST ;
VALA_EXTERN FtConditionWidget* ft_condition_widget_new (void);
VALA_EXTERN FtConditionWidget* ft_condition_widget_construct (GType object_type);
static void ft_condition_group_widget_on_argument_notify_expression (FtConditionGroupWidget* self,
                                                              GObject* object,
                                                              GParamSpec* pspec);
static void _ft_condition_group_widget_on_argument_notify_expression_g_object_notify (GObject* _sender,
                                                                               GParamSpec* pspec,
                                                                               gpointer self);
static void ft_condition_group_widget_on_argument_request_remove (FtConditionGroupWidget* self,
                                                           FtExpressionWidget* argument);
static void _ft_condition_group_widget_on_argument_request_remove_ft_expression_widget_request_remove (FtExpressionWidget* _sender,
                                                                                                gpointer self);
static FtExpressionWidget* ft_condition_group_widget_create_condition_group (FtConditionGroupWidget* self,
                                                                      FtExpression* expression);
static void ft_condition_group_widget_populate (FtConditionGroupWidget* self);
static Block23Data* block23_data_ref (Block23Data* _data23_);
static void block23_data_unref (void * _userdata_);
static void _g_free0_ (gpointer var);
static void _g_object_unref0_ (gpointer var);
static void ft_condition_group_widget_foreach_argument (FtConditionGroupWidget* self,
                                                 GFunc func,
                                                 gpointer func_target);
static void __lambda74_ (Block23Data* _data23_,
                  FtExpressionWidget* argument);
static void ___lambda74__gfunc (gconstpointer data,
                         gpointer self);
static void ft_condition_group_widget_update_remove_buttons (FtConditionGroupWidget* self);
static void ft_condition_group_widget_update_operator_label (FtConditionGroupWidget* self);
static gboolean ft_condition_group_widget_is_empty (FtConditionGroupWidget* self);
static Block24Data* block24_data_ref (Block24Data* _data24_);
static void block24_data_unref (void * _userdata_);
static void __lambda72_ (Block24Data* _data24_,
                  FtExpressionWidget* argument);
static void ___lambda72__gfunc (gconstpointer data,
                         gpointer self);
static Block25Data* block25_data_ref (Block25Data* _data25_);
static void block25_data_unref (void * _userdata_);
static void __lambda73_ (Block25Data* _data25_,
                  FtExpressionWidget* argument);
static void ___lambda73__gfunc (gconstpointer data,
                         gpointer self);
static void ft_condition_group_widget_update_expression (FtConditionGroupWidget* self);
static Block26Data* block26_data_ref (Block26Data* _data26_);
static void block26_data_unref (void * _userdata_);
static void __lambda71_ (Block26Data* _data26_,
                  FtExpressionWidget* argument);
static void _vala_array_add3 (FtExpression** * array,
                       gint* length,
                       gint* size,
                       FtExpression* value);
static void ___lambda71__gfunc (gconstpointer data,
                         gpointer self);
static FtExpression** _vala_array_dup4 (FtExpression** self,
                                 gssize length);
static void ft_condition_group_widget_snapshot_bracket (FtConditionGroupWidget* self,
                                                 FtGizmo* gizmo,
                                                 GtkSnapshot* snapshot,
                                                 gboolean is_top);
static void _vala_GskStroke_free (GskStroke* self);
static void ft_condition_group_widget_on_operator_button_clicked (FtConditionGroupWidget* self,
                                                           GtkButton* button);
static void _ft_condition_group_widget_on_operator_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                               gpointer self);
static void ft_condition_group_widget_on_add_condition_button_clicked (FtConditionGroupWidget* self,
                                                                GtkButton* button);
static void _ft_condition_group_widget_on_add_condition_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                    gpointer self);
static void ft_condition_group_widget_on_add_condition_group_button_clicked (FtConditionGroupWidget* self,
                                                                      GtkButton* button);
static void _ft_condition_group_widget_on_add_condition_group_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                          gpointer self);
static void ft_condition_group_widget_calculate_height_for_width (FtConditionGroupWidget* self,
                                                           gint avaliable_width,
                                                           gint* minimum_height,
                                                           gint* natural_height);
static GtkSizeRequestMode ft_condition_group_widget_real_get_request_mode (GtkWidget* base);
static void ft_condition_group_widget_real_measure (GtkWidget* base,
                                             GtkOrientation orientation,
                                             gint for_size,
                                             gint* minimum,
                                             gint* natural,
                                             gint* minimum_baseline,
                                             gint* natural_baseline);
static void ft_condition_group_widget_real_size_allocate (GtkWidget* base,
                                                   gint width,
                                                   gint height,
                                                   gint baseline);
static void ft_condition_group_widget_real_dispose (GObject* base);
static GObject * ft_condition_group_widget_constructor (GType type,
                                                 guint n_construct_properties,
                                                 GObjectConstructParam * construct_properties);
static void _ft_condition_group_widget_measure_bracket_child_cb_ft_gizmo_measure_func (FtGizmo* gizmo,
                                                                                GtkOrientation orientation,
                                                                                gint for_size,
                                                                                gint* minimum,
                                                                                gint* natural,
                                                                                gint* minimum_baseline,
                                                                                gint* natural_baseline,
                                                                                gpointer self);
static void _ft_condition_group_widget_snapshot_top_bracket_cb_ft_gizmo_snapshot_func (FtGizmo* gizmo,
                                                                                GtkSnapshot* snapshot,
                                                                                gpointer self);
static void _ft_condition_group_widget_snapshot_bottom_bracket_cb_ft_gizmo_snapshot_func (FtGizmo* gizmo,
                                                                                   GtkSnapshot* snapshot,
                                                                                   gpointer self);
static void ft_condition_group_widget_finalize (GObject * obj);
static GType ft_condition_group_widget_get_type_once (void);
static void _vala_ft_condition_group_widget_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec);
static void _vala_ft_condition_group_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);

FtExpression*
ft_expression_widget_get_expression (FtExpressionWidget* self)
{
	FtExpressionWidgetIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = FT_EXPRESSION_WIDGET_GET_INTERFACE (self);
	if (_iface_->get_expression) {
		return _iface_->get_expression (self);
	}
	return NULL;
}

void
ft_expression_widget_set_expression (FtExpressionWidget* self,
                                     FtExpression* value)
{
	FtExpressionWidgetIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = FT_EXPRESSION_WIDGET_GET_INTERFACE (self);
	if (_iface_->set_expression) {
		_iface_->set_expression (self, value);
	}
}

gboolean
ft_expression_widget_get_removable (FtExpressionWidget* self)
{
	FtExpressionWidgetIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = FT_EXPRESSION_WIDGET_GET_INTERFACE (self);
	if (_iface_->get_removable) {
		return _iface_->get_removable (self);
	}
	return FALSE;
}

void
ft_expression_widget_set_removable (FtExpressionWidget* self,
                                    gboolean value)
{
	FtExpressionWidgetIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = FT_EXPRESSION_WIDGET_GET_INTERFACE (self);
	if (_iface_->set_removable) {
		_iface_->set_removable (self, value);
	}
}

static void
ft_expression_widget_default_init (FtExpressionWidgetIface * iface,
                                   gpointer iface_data)
{
	g_object_interface_install_property (iface, ft_param_spec_expression ("expression", "expression", "expression", FT_TYPE_EXPRESSION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_interface_install_property (iface, g_param_spec_boolean ("removable", "removable", "removable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	ft_expression_widget_signals[FT_EXPRESSION_WIDGET_REQUEST_REMOVE_SIGNAL] = g_signal_new ("request-remove", FT_TYPE_EXPRESSION_WIDGET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static GType
ft_expression_widget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtExpressionWidgetIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_expression_widget_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType ft_expression_widget_type_id;
	ft_expression_widget_type_id = g_type_register_static (G_TYPE_INTERFACE, "FtExpressionWidget", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (ft_expression_widget_type_id, gtk_widget_get_type ());
	return ft_expression_widget_type_id;
}

GType
ft_expression_widget_get_type (void)
{
	static volatile gsize ft_expression_widget_type_id__once = 0;
	if (g_once_init_enter (&ft_expression_widget_type_id__once)) {
		GType ft_expression_widget_type_id;
		ft_expression_widget_type_id = ft_expression_widget_get_type_once ();
		g_once_init_leave (&ft_expression_widget_type_id__once, ft_expression_widget_type_id);
	}
	return ft_expression_widget_type_id__once;
}

static inline gpointer
ft_condition_group_widget_get_instance_private (FtConditionGroupWidget* self)
{
	return G_STRUCT_MEMBER_P (self, FtConditionGroupWidget_private_offset);
}

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

static FtConditionGroupWidget*
ft_condition_group_widget_from_gizmo (FtGizmo* gizmo)
{
	GtkWidget* widget = NULL;
	GtkWidget* _tmp0_;
	FtConditionGroupWidget* result;
	g_return_val_if_fail (gizmo != NULL, NULL);
	_tmp0_ = _g_object_ref0 ((GtkWidget*) gizmo);
	widget = _tmp0_;
	while (TRUE) {
		GtkWidget* _tmp1_;
		FtConditionGroupWidget* group = NULL;
		GtkWidget* _tmp2_;
		FtConditionGroupWidget* _tmp3_;
		FtConditionGroupWidget* _tmp4_;
		GtkWidget* _tmp5_;
		GtkWidget* _tmp6_;
		GtkWidget* _tmp7_;
		_tmp1_ = widget;
		if (!(_tmp1_ != NULL)) {
			break;
		}
		_tmp2_ = widget;
		_tmp3_ = _g_object_ref0 (FT_IS_CONDITION_GROUP_WIDGET (_tmp2_) ? ((FtConditionGroupWidget*) _tmp2_) : NULL);
		group = _tmp3_;
		_tmp4_ = group;
		if (_tmp4_ != NULL) {
			result = group;
			_g_object_unref0 (widget);
			return result;
		}
		_tmp5_ = widget;
		_tmp6_ = gtk_widget_get_parent (_tmp5_);
		_tmp7_ = _g_object_ref0 (_tmp6_);
		_g_object_unref0 (widget);
		widget = _tmp7_;
		_g_object_unref0 (group);
	}
	result = NULL;
	_g_object_unref0 (widget);
	return result;
}

static void
ft_condition_group_widget_measure_bracket_child_cb (FtGizmo* gizmo,
                                                    GtkOrientation orientation,
                                                    gint for_size,
                                                    gint* minimum,
                                                    gint* natural,
                                                    gint* minimum_baseline,
                                                    gint* natural_baseline)
{
	gint _vala_minimum = 0;
	gint _vala_natural = 0;
	gint _vala_minimum_baseline = 0;
	gint _vala_natural_baseline = 0;
	FtConditionGroupWidget* _self_ = NULL;
	FtConditionGroupWidget* _tmp0_;
	FtConditionGroupWidget* _tmp1_;
	g_return_if_fail (gizmo != NULL);
	_tmp0_ = ft_condition_group_widget_from_gizmo (gizmo);
	_self_ = _tmp0_;
	_tmp1_ = _self_;
	if (_tmp1_ != NULL) {
		FtConditionGroupWidget* _tmp2_;
		gint _tmp3_ = 0;
		gint _tmp4_ = 0;
		gint _tmp5_ = 0;
		gint _tmp6_ = 0;
		_tmp2_ = _self_;
		ft_condition_group_widget_measure_bracket_child (_tmp2_, gizmo, orientation, for_size, &_tmp3_, &_tmp4_, &_tmp5_, &_tmp6_);
		_vala_minimum = _tmp3_;
		_vala_natural = _tmp4_;
		_vala_minimum_baseline = _tmp5_;
		_vala_natural_baseline = _tmp6_;
	} else {
		_vala_minimum = 0;
		_vala_natural = 0;
		_vala_minimum_baseline = -1;
		_vala_natural_baseline = -1;
	}
	_g_object_unref0 (_self_);
	if (minimum) {
		*minimum = _vala_minimum;
	}
	if (natural) {
		*natural = _vala_natural;
	}
	if (minimum_baseline) {
		*minimum_baseline = _vala_minimum_baseline;
	}
	if (natural_baseline) {
		*natural_baseline = _vala_natural_baseline;
	}
}

static void
ft_condition_group_widget_snapshot_top_bracket_cb (FtGizmo* gizmo,
                                                   GtkSnapshot* snapshot)
{
	FtConditionGroupWidget* _self_ = NULL;
	FtConditionGroupWidget* _tmp0_;
	FtConditionGroupWidget* _tmp1_;
	g_return_if_fail (gizmo != NULL);
	g_return_if_fail (snapshot != NULL);
	_tmp0_ = ft_condition_group_widget_from_gizmo (gizmo);
	_self_ = _tmp0_;
	_tmp1_ = _self_;
	if (_tmp1_ != NULL) {
		FtConditionGroupWidget* _tmp2_;
		_tmp2_ = _self_;
		ft_condition_group_widget_snapshot_top_bracket (_tmp2_, gizmo, snapshot);
	}
	_g_object_unref0 (_self_);
}

static void
ft_condition_group_widget_snapshot_bottom_bracket_cb (FtGizmo* gizmo,
                                                      GtkSnapshot* snapshot)
{
	FtConditionGroupWidget* _self_ = NULL;
	FtConditionGroupWidget* _tmp0_;
	FtConditionGroupWidget* _tmp1_;
	g_return_if_fail (gizmo != NULL);
	g_return_if_fail (snapshot != NULL);
	_tmp0_ = ft_condition_group_widget_from_gizmo (gizmo);
	_self_ = _tmp0_;
	_tmp1_ = _self_;
	if (_tmp1_ != NULL) {
		FtConditionGroupWidget* _tmp2_;
		_tmp2_ = _self_;
		ft_condition_group_widget_snapshot_bottom_bracket (_tmp2_, gizmo, snapshot);
	}
	_g_object_unref0 (_self_);
}

static void
_ft_condition_group_widget_on_argument_notify_expression_g_object_notify (GObject* _sender,
                                                                          GParamSpec* pspec,
                                                                          gpointer self)
{
	ft_condition_group_widget_on_argument_notify_expression ((FtConditionGroupWidget*) self, _sender, pspec);
}

static void
_ft_condition_group_widget_on_argument_request_remove_ft_expression_widget_request_remove (FtExpressionWidget* _sender,
                                                                                           gpointer self)
{
	ft_condition_group_widget_on_argument_request_remove ((FtConditionGroupWidget*) self, _sender);
}

static FtExpressionWidget*
ft_condition_group_widget_create_condition (FtConditionGroupWidget* self,
                                            FtExpression* expression)
{
	FtConditionWidget* child = NULL;
	FtConditionWidget* _tmp0_;
	FtExpressionWidget* _tmp1_;
	FtExpressionWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = ft_condition_widget_new ();
	g_object_ref_sink (_tmp0_);
	child = _tmp0_;
	ft_expression_widget_set_removable ((FtExpressionWidget*) child, TRUE);
	ft_expression_widget_set_expression ((FtExpressionWidget*) child, expression);
	g_signal_connect_object ((GObject*) child, "notify::expression", (GCallback) _ft_condition_group_widget_on_argument_notify_expression_g_object_notify, self, 0);
	g_signal_connect_object ((FtExpressionWidget*) child, "request-remove", (GCallback) _ft_condition_group_widget_on_argument_request_remove_ft_expression_widget_request_remove, self, 0);
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (child, FT_TYPE_EXPRESSION_WIDGET, FtExpressionWidget));
	result = _tmp1_;
	_g_object_unref0 (child);
	return result;
}

static FtExpressionWidget*
ft_condition_group_widget_create_condition_group (FtConditionGroupWidget* self,
                                                  FtExpression* expression)
{
	FtConditionGroupWidget* child = NULL;
	FtConditionGroupWidget* _tmp0_;
	FtOperator _tmp1_ = 0;
	FtOperator _tmp2_;
	FtOperator _tmp3_;
	FtConditionGroupWidget* _tmp4_;
	FtConditionGroupWidget* _tmp5_;
	FtConditionGroupWidget* _tmp6_;
	FtConditionGroupWidget* _tmp7_;
	FtConditionGroupWidget* _tmp8_;
	FtExpressionWidget* _tmp9_;
	FtExpressionWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = ft_condition_group_widget_new ();
	g_object_ref_sink (_tmp0_);
	child = _tmp0_;
	_tmp2_ = ft_condition_group_widget_get_operator (self);
	_tmp3_ = _tmp2_;
	if (_tmp3_ != FT_OPERATOR_AND) {
		_tmp1_ = FT_OPERATOR_AND;
	} else {
		_tmp1_ = FT_OPERATOR_OR;
	}
	_tmp4_ = child;
	ft_condition_group_widget_set_operator (_tmp4_, _tmp1_);
	_tmp5_ = child;
	ft_expression_widget_set_removable ((FtExpressionWidget*) _tmp5_, TRUE);
	_tmp6_ = child;
	ft_condition_group_widget_set_is_nested (_tmp6_, TRUE);
	_tmp7_ = child;
	g_signal_connect_object ((FtExpressionWidget*) _tmp7_, "request-remove", (GCallback) _ft_condition_group_widget_on_argument_request_remove_ft_expression_widget_request_remove, self, 0);
	_tmp8_ = child;
	_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, FT_TYPE_EXPRESSION_WIDGET, FtExpressionWidget));
	result = _tmp9_;
	_g_object_unref0 (child);
	return result;
}

static Block23Data*
block23_data_ref (Block23Data* _data23_)
{
	g_atomic_int_inc (&_data23_->_ref_count_);
	return _data23_;
}

static void
block23_data_unref (void * _userdata_)
{
	Block23Data* _data23_;
	_data23_ = (Block23Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data23_->_ref_count_)) {
		FtConditionGroupWidget* self;
		self = _data23_->self;
		_g_hash_table_unref0 (_data23_->existing_arguments);
		_g_object_unref0 (self);
		g_slice_free (Block23Data, _data23_);
	}
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static void
__lambda74_ (Block23Data* _data23_,
             FtExpressionWidget* argument)
{
	FtConditionGroupWidget* self;
	gchar* _tmp0_ = NULL;
	FtExpression* _tmp1_;
	FtExpression* _tmp2_;
	gchar* argument_key = NULL;
	gchar* _tmp9_;
	GHashTable* _tmp10_;
	gchar* _tmp11_;
	FtExpressionWidget* _tmp12_;
	GtkBox* _tmp13_;
	self = _data23_->self;
	g_return_if_fail (argument != NULL);
	_tmp1_ = ft_expression_widget_get_expression (argument);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		FtExpression* _tmp3_;
		FtExpression* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp3_ = ft_expression_widget_get_expression (argument);
		_tmp4_ = _tmp3_;
		_tmp5_ = ft_expression_to_string (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = ft_ensure_string (_tmp6_);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp7_;
		_g_free0 (_tmp6_);
	} else {
		gchar* _tmp8_;
		_tmp8_ = g_strdup ("");
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp8_;
	}
	_tmp9_ = _tmp0_;
	_tmp0_ = NULL;
	argument_key = _tmp9_;
	_tmp10_ = _data23_->existing_arguments;
	_tmp11_ = g_strdup (argument_key);
	_tmp12_ = _g_object_ref0 (argument);
	g_hash_table_insert (_tmp10_, _tmp11_, _tmp12_);
	_tmp13_ = self->priv->arguments_box;
	gtk_box_remove (_tmp13_, (GtkWidget*) argument);
	_g_free0 (argument_key);
	_g_free0 (_tmp0_);
}

static void
___lambda74__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda74_ (self, (FtExpressionWidget*) data);
}

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

static void
ft_condition_group_widget_populate (FtConditionGroupWidget* self)
{
	Block23Data* _data23_;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	gint _tmp3_ = 0;
	FtOperation* _tmp4_;
	gint arguments_count = 0;
	g_return_if_fail (self != NULL);
	_data23_ = g_slice_new0 (Block23Data);
	_data23_->_ref_count_ = 1;
	_data23_->self = g_object_ref (self);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_object_unref0_);
	_data23_->existing_arguments = _tmp2_;
	ft_condition_group_widget_foreach_argument (self, ___lambda74__gfunc, _data23_);
	_tmp4_ = self->priv->_operation;
	if (_tmp4_ != NULL) {
		FtOperation* _tmp5_;
		FtExpression** _tmp6_;
		gint _tmp6__length1;
		_tmp5_ = self->priv->_operation;
		_tmp6_ = _tmp5_->arguments;
		_tmp6__length1 = _tmp5_->arguments_length1;
		_tmp3_ = _tmp6__length1;
	} else {
		_tmp3_ = 0;
	}
	arguments_count = _tmp3_;
	if (arguments_count == 0) {
		FtExpressionWidget* argument = NULL;
		GHashTable* _tmp7_;
		gconstpointer _tmp8_;
		FtExpressionWidget* _tmp9_;
		FtExpressionWidget* _tmp10_;
		GtkBox* _tmp12_;
		FtExpressionWidget* _tmp13_;
		_tmp7_ = _data23_->existing_arguments;
		_tmp8_ = g_hash_table_lookup (_tmp7_, "");
		_tmp9_ = _g_object_ref0 ((FtExpressionWidget*) _tmp8_);
		argument = _tmp9_;
		_tmp10_ = argument;
		if (_tmp10_ == NULL) {
			FtExpressionWidget* _tmp11_;
			_tmp11_ = ft_condition_group_widget_create_condition (self, NULL);
			_g_object_unref0 (argument);
			argument = _tmp11_;
		}
		_tmp12_ = self->priv->arguments_box;
		_tmp13_ = argument;
		gtk_box_prepend (_tmp12_, (GtkWidget*) _tmp13_);
		_g_object_unref0 (argument);
	} else {
		{
			gint index = 0;
			index = 0;
			{
				gboolean _tmp14_ = FALSE;
				_tmp14_ = TRUE;
				while (TRUE) {
					FtExpression* argument_expression = NULL;
					FtOperation* _tmp16_;
					FtExpression** _tmp17_;
					gint _tmp17__length1;
					FtExpression* _tmp18_;
					FtExpression* _tmp19_;
					FtExpression* _tmp20_ = NULL;
					FtExpression* _tmp21_;
					gchar* _tmp22_ = NULL;
					gchar* argument_key = NULL;
					gchar* _tmp24_;
					FtExpressionWidget* argument = NULL;
					GHashTable* _tmp25_;
					const gchar* _tmp26_;
					gconstpointer _tmp27_;
					FtExpressionWidget* _tmp28_;
					FtOperation* operation = NULL;
					FtExpression* _tmp29_;
					FtOperation* _tmp30_;
					gboolean _tmp31_ = FALSE;
					FtOperation* _tmp32_;
					gboolean is_condition_group = FALSE;
					FtExpressionWidget* _tmp34_;
					GtkBox* _tmp43_;
					FtExpressionWidget* _tmp44_;
					GtkBox* _tmp45_;
					GtkWidget* _tmp46_;
					if (!_tmp14_) {
						gint _tmp15_;
						_tmp15_ = index;
						index = _tmp15_ + 1;
					}
					_tmp14_ = FALSE;
					if (!(index < arguments_count)) {
						break;
					}
					_tmp16_ = self->priv->_operation;
					_tmp17_ = _tmp16_->arguments;
					_tmp17__length1 = _tmp16_->arguments_length1;
					_tmp18_ = _tmp17_[index];
					_tmp19_ = _ft_expression_ref0 (_tmp18_);
					argument_expression = _tmp19_;
					_tmp21_ = argument_expression;
					_tmp20_ = _tmp21_;
					_tmp22_ = NULL;
					if (_tmp20_ != NULL) {
						gchar* _tmp23_;
						_tmp23_ = ft_expression_to_string (_tmp20_);
						_g_free0 (_tmp22_);
						_tmp22_ = _tmp23_;
					}
					_tmp24_ = ft_ensure_string (_tmp22_);
					argument_key = _tmp24_;
					_tmp25_ = _data23_->existing_arguments;
					_tmp26_ = argument_key;
					_tmp27_ = g_hash_table_lookup (_tmp25_, _tmp26_);
					_tmp28_ = _g_object_ref0 ((FtExpressionWidget*) _tmp27_);
					argument = _tmp28_;
					_tmp29_ = argument_expression;
					_tmp30_ = _ft_expression_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp29_, FT_TYPE_OPERATION) ? ((FtOperation*) _tmp29_) : NULL);
					operation = _tmp30_;
					_tmp32_ = operation;
					if (_tmp32_ != NULL) {
						FtOperation* _tmp33_;
						_tmp33_ = operation;
						_tmp31_ = ft_operator_get_category (_tmp33_->operator) == FT_OPERATOR_CATEGORY_LOGICAL;
					} else {
						_tmp31_ = FALSE;
					}
					is_condition_group = _tmp31_;
					_tmp34_ = argument;
					if (_tmp34_ == NULL) {
						FtExpressionWidget* _tmp35_ = NULL;
						FtExpressionWidget* _tmp40_;
						if (is_condition_group) {
							FtExpression* _tmp36_;
							FtExpressionWidget* _tmp37_;
							_tmp36_ = argument_expression;
							_tmp37_ = ft_condition_group_widget_create_condition_group (self, _tmp36_);
							_g_object_unref0 (_tmp35_);
							_tmp35_ = _tmp37_;
						} else {
							FtExpression* _tmp38_;
							FtExpressionWidget* _tmp39_;
							_tmp38_ = argument_expression;
							_tmp39_ = ft_condition_group_widget_create_condition (self, _tmp38_);
							_g_object_unref0 (_tmp35_);
							_tmp35_ = _tmp39_;
						}
						_tmp40_ = _tmp35_;
						_tmp35_ = NULL;
						_g_object_unref0 (argument);
						argument = _tmp40_;
						_g_object_unref0 (_tmp35_);
					} else {
						GHashTable* _tmp41_;
						const gchar* _tmp42_;
						_tmp41_ = _data23_->existing_arguments;
						_tmp42_ = argument_key;
						g_hash_table_remove (_tmp41_, _tmp42_);
					}
					_tmp43_ = self->priv->arguments_box;
					_tmp44_ = argument;
					_tmp45_ = self->priv->buttons_box;
					_tmp46_ = gtk_widget_get_prev_sibling ((GtkWidget*) _tmp45_);
					gtk_box_insert_child_after (_tmp43_, (GtkWidget*) _tmp44_, _tmp46_);
					_ft_expression_unref0 (operation);
					_g_object_unref0 (argument);
					_g_free0 (argument_key);
					_g_free0 (_tmp22_);
					_ft_expression_unref0 (argument_expression);
				}
			}
		}
	}
	ft_condition_group_widget_update_remove_buttons (self);
	ft_condition_group_widget_update_operator_label (self);
	block23_data_unref (_data23_);
	_data23_ = NULL;
}

static void
ft_condition_group_widget_foreach_argument (FtConditionGroupWidget* self,
                                            GFunc func,
                                            gpointer func_target)
{
	GtkWidget* child = NULL;
	GtkBox* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->arguments_box;
	_tmp1_ = gtk_widget_get_first_child ((GtkWidget*) _tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	child = _tmp2_;
	while (TRUE) {
		GtkWidget* _tmp3_;
		FtExpressionWidget* argument = NULL;
		GtkWidget* _tmp4_;
		FtExpressionWidget* _tmp5_;
		GtkWidget* next_sibling = NULL;
		GtkWidget* _tmp6_;
		GtkWidget* _tmp7_;
		GtkWidget* _tmp8_;
		FtExpressionWidget* _tmp9_;
		GtkWidget* _tmp11_;
		GtkWidget* _tmp12_;
		_tmp3_ = child;
		if (!(_tmp3_ != NULL)) {
			break;
		}
		_tmp4_ = child;
		_tmp5_ = _g_object_ref0 (FT_IS_EXPRESSION_WIDGET (_tmp4_) ? ((FtExpressionWidget*) _tmp4_) : NULL);
		argument = _tmp5_;
		_tmp6_ = child;
		_tmp7_ = gtk_widget_get_next_sibling (_tmp6_);
		_tmp8_ = _g_object_ref0 (_tmp7_);
		next_sibling = _tmp8_;
		_tmp9_ = argument;
		if (_tmp9_ != NULL) {
			FtExpressionWidget* _tmp10_;
			_tmp10_ = argument;
			func (_tmp10_, func_target);
		}
		_tmp11_ = next_sibling;
		_tmp12_ = _g_object_ref0 (_tmp11_);
		_g_object_unref0 (child);
		child = _tmp12_;
		_g_object_unref0 (next_sibling);
		_g_object_unref0 (argument);
	}
	_g_object_unref0 (child);
}

static Block24Data*
block24_data_ref (Block24Data* _data24_)
{
	g_atomic_int_inc (&_data24_->_ref_count_);
	return _data24_;
}

static void
block24_data_unref (void * _userdata_)
{
	Block24Data* _data24_;
	_data24_ = (Block24Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data24_->_ref_count_)) {
		FtConditionGroupWidget* self;
		self = _data24_->self;
		_g_object_unref0 (self);
		g_slice_free (Block24Data, _data24_);
	}
}

static void
__lambda72_ (Block24Data* _data24_,
             FtExpressionWidget* argument)
{
	FtConditionGroupWidget* self;
	gint _tmp0_;
	self = _data24_->self;
	g_return_if_fail (argument != NULL);
	_tmp0_ = _data24_->arguments_count;
	_data24_->arguments_count = _tmp0_ + 1;
}

static void
___lambda72__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda72_ (self, (FtExpressionWidget*) data);
}

static gboolean
ft_condition_group_widget_is_empty (FtConditionGroupWidget* self)
{
	Block24Data* _data24_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_data24_ = g_slice_new0 (Block24Data);
	_data24_->_ref_count_ = 1;
	_data24_->self = g_object_ref (self);
	_data24_->arguments_count = 0;
	ft_condition_group_widget_foreach_argument (self, ___lambda72__gfunc, _data24_);
	result = _data24_->arguments_count == 0;
	block24_data_unref (_data24_);
	_data24_ = NULL;
	return result;
}

static Block25Data*
block25_data_ref (Block25Data* _data25_)
{
	g_atomic_int_inc (&_data25_->_ref_count_);
	return _data25_;
}

static void
block25_data_unref (void * _userdata_)
{
	Block25Data* _data25_;
	_data25_ = (Block25Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data25_->_ref_count_)) {
		FtConditionGroupWidget* self;
		self = _data25_->self;
		_g_object_unref0 (self);
		g_slice_free (Block25Data, _data25_);
	}
}

static void
__lambda73_ (Block25Data* _data25_,
             FtExpressionWidget* argument)
{
	FtConditionGroupWidget* self;
	gint _tmp0_;
	self = _data25_->self;
	g_return_if_fail (argument != NULL);
	_tmp0_ = _data25_->arguments_count;
	_data25_->arguments_count = _tmp0_ + 1;
	if (_data25_->arguments_count == 1) {
		_data25_->first_argument = argument;
	} else {
		ft_expression_widget_set_removable (argument, TRUE);
	}
}

static void
___lambda73__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda73_ (self, (FtExpressionWidget*) data);
}

static void
ft_condition_group_widget_update_remove_buttons (FtConditionGroupWidget* self)
{
	Block25Data* _data25_;
	FtExpressionWidget* _tmp0_;
	g_return_if_fail (self != NULL);
	_data25_ = g_slice_new0 (Block25Data);
	_data25_->_ref_count_ = 1;
	_data25_->self = g_object_ref (self);
	_data25_->arguments_count = 0;
	_data25_->first_argument = NULL;
	ft_condition_group_widget_foreach_argument (self, ___lambda73__gfunc, _data25_);
	_tmp0_ = _data25_->first_argument;
	if (_tmp0_ != NULL) {
		gboolean _tmp1_ = FALSE;
		gboolean _tmp2_ = FALSE;
		gboolean _tmp3_;
		gboolean _tmp4_;
		FtExpressionWidget* _tmp6_;
		_tmp3_ = ft_expression_widget_get_removable ((FtExpressionWidget*) self);
		_tmp4_ = _tmp3_;
		if (_tmp4_) {
			_tmp2_ = TRUE;
		} else {
			gboolean _tmp5_;
			_tmp5_ = self->priv->_is_nested;
			_tmp2_ = _tmp5_;
		}
		if (_tmp2_) {
			_tmp1_ = TRUE;
		} else {
			_tmp1_ = _data25_->arguments_count > 1;
		}
		_tmp6_ = _data25_->first_argument;
		ft_expression_widget_set_removable (_tmp6_, _tmp1_);
	}
	block25_data_unref (_data25_);
	_data25_ = NULL;
}

static void
ft_condition_group_widget_update_operator_label (FtConditionGroupWidget* self)
{
	const gchar* _tmp0_ = NULL;
	FtOperator _tmp1_;
	FtOperator _tmp2_;
	GtkButton* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp1_ = ft_condition_group_widget_get_operator (self);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == FT_OPERATOR_AND) {
		_tmp0_ = _ ("AND");
	} else {
		_tmp0_ = _ ("OR");
	}
	_tmp3_ = self->priv->operator_button;
	gtk_button_set_label (_tmp3_, _tmp0_);
}

static Block26Data*
block26_data_ref (Block26Data* _data26_)
{
	g_atomic_int_inc (&_data26_->_ref_count_);
	return _data26_;
}

static void
block26_data_unref (void * _userdata_)
{
	Block26Data* _data26_;
	_data26_ = (Block26Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data26_->_ref_count_)) {
		FtConditionGroupWidget* self;
		self = _data26_->self;
		_data26_->arguments = (_vala_array_free (_data26_->arguments, _data26_->arguments_length1, (GDestroyNotify) ft_expression_unref), NULL);
		_g_object_unref0 (self);
		g_slice_free (Block26Data, _data26_);
	}
}

static void
_vala_array_add3 (FtExpression** * array,
                  gint* length,
                  gint* size,
                  FtExpression* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (FtExpression*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
__lambda71_ (Block26Data* _data26_,
             FtExpressionWidget* argument)
{
	FtConditionGroupWidget* self;
	FtExpression* argument_expression = NULL;
	FtExpression* _tmp0_;
	FtExpression* _tmp1_;
	FtExpression* _tmp2_;
	FtExpression* _tmp3_;
	self = _data26_->self;
	g_return_if_fail (argument != NULL);
	_tmp0_ = ft_expression_widget_get_expression (argument);
	_tmp1_ = _tmp0_;
	_tmp2_ = _ft_expression_ref0 (_tmp1_);
	argument_expression = _tmp2_;
	_tmp3_ = argument_expression;
	if (_tmp3_ != NULL) {
		FtExpression* _tmp4_;
		FtExpression* _tmp5_;
		_tmp4_ = argument_expression;
		_tmp5_ = _ft_expression_ref0 (_tmp4_);
		_vala_array_add3 (&_data26_->arguments, &_data26_->arguments_length1, &_data26_->_arguments_size_, _tmp5_);
	}
	_ft_expression_unref0 (argument_expression);
}

static void
___lambda71__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda71_ (self, (FtExpressionWidget*) data);
}

static FtExpression**
_vala_array_dup4 (FtExpression** self,
                  gssize length)
{
	if (length >= 0) {
		FtExpression** result;
		gssize i;
		result = g_new0 (FtExpression*, length + 1);
		for (i = 0; i < length; i++) {
			FtExpression* _tmp0_;
			_tmp0_ = _ft_expression_ref0 (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static void
ft_condition_group_widget_update_expression (FtConditionGroupWidget* self)
{
	Block26Data* _data26_;
	FtExpression** _tmp0_;
	FtOperation* _tmp1_ = NULL;
	FtExpression** _tmp2_;
	gint _tmp2__length1;
	FtOperation* _tmp8_;
	g_return_if_fail (self != NULL);
	_data26_ = g_slice_new0 (Block26Data);
	_data26_->_ref_count_ = 1;
	_data26_->self = g_object_ref (self);
	_tmp0_ = g_new0 (FtExpression*, 0 + 1);
	_data26_->arguments = _tmp0_;
	_data26_->arguments_length1 = 0;
	_data26_->_arguments_size_ = _data26_->arguments_length1;
	ft_condition_group_widget_foreach_argument (self, ___lambda71__gfunc, _data26_);
	_tmp2_ = _data26_->arguments;
	_tmp2__length1 = _data26_->arguments_length1;
	if (_tmp2__length1 > 0) {
		FtOperator _tmp3_;
		FtOperator _tmp4_;
		FtExpression** _tmp5_;
		gint _tmp5__length1;
		FtExpression** _tmp6_;
		gint _tmp6__length1;
		FtOperation* _tmp7_;
		_tmp3_ = ft_condition_group_widget_get_operator (self);
		_tmp4_ = _tmp3_;
		_tmp5_ = _data26_->arguments;
		_tmp5__length1 = _data26_->arguments_length1;
		_tmp6_ = (_tmp5_ != NULL) ? _vala_array_dup4 (_tmp5_, _tmp5__length1) : _tmp5_;
		_tmp6__length1 = _tmp5__length1;
		_tmp7_ = ft_operation_new_with_argv (_tmp4_, _tmp6_, _tmp6__length1);
		_ft_expression_unref0 (_tmp1_);
		_tmp1_ = _tmp7_;
	} else {
		_ft_expression_unref0 (_tmp1_);
		_tmp1_ = NULL;
	}
	_tmp8_ = _tmp1_;
	_tmp1_ = NULL;
	_ft_expression_unref0 (self->priv->_operation);
	self->priv->_operation = _tmp8_;
	g_object_notify ((GObject*) self, "expression");
	_ft_expression_unref0 (_tmp1_);
	block26_data_unref (_data26_);
	_data26_ = NULL;
}

static void
ft_condition_group_widget_measure_bracket_child (FtConditionGroupWidget* self,
                                                 FtGizmo* gizmo,
                                                 GtkOrientation orientation,
                                                 gint for_size,
                                                 gint* minimum,
                                                 gint* natural,
                                                 gint* minimum_baseline,
                                                 gint* natural_baseline)
{
	gint _vala_minimum = 0;
	gint _vala_natural = 0;
	gint _vala_minimum_baseline = 0;
	gint _vala_natural_baseline = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (gizmo != NULL);
	_vala_minimum = FT_CONDITION_GROUP_WIDGET_MIN_BRACKET_HEIGHT;
	_vala_natural = FT_CONDITION_GROUP_WIDGET_MIN_BRACKET_HEIGHT;
	_vala_minimum_baseline = 0;
	_vala_natural_baseline = 0;
	if (minimum) {
		*minimum = _vala_minimum;
	}
	if (natural) {
		*natural = _vala_natural;
	}
	if (minimum_baseline) {
		*minimum_baseline = _vala_minimum_baseline;
	}
	if (natural_baseline) {
		*natural_baseline = _vala_natural_baseline;
	}
}

static void
_vala_GskStroke_free (GskStroke* self)
{
	g_boxed_free (gsk_stroke_get_type (), self);
}

static void
ft_condition_group_widget_snapshot_bracket (FtConditionGroupWidget* self,
                                            FtGizmo* gizmo,
                                            GtkSnapshot* snapshot,
                                            gboolean is_top)
{
	gfloat width = 0.0F;
	gfloat height = 0.0F;
	gfloat border_radius = 0.0F;
	gfloat padding = 0.0F;
	gfloat x = 0.0F;
	gfloat y = 0.0F;
	GdkRGBA color = {0};
	GdkRGBA _tmp0_ = {0};
	GskPathBuilder* path_builder = NULL;
	GskPathBuilder* _tmp1_;
	GskPathBuilder* _tmp2_;
	GskPathBuilder* _tmp3_;
	GskPathBuilder* _tmp4_;
	GskPathBuilder* _tmp5_;
	GskStroke* stroke = NULL;
	GskStroke* _tmp6_;
	GskStroke* _tmp7_;
	GskPathBuilder* _tmp9_;
	GskPath* _tmp10_;
	GskPath* _tmp11_;
	GskStroke* _tmp12_;
	GdkRGBA _tmp13_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (gizmo != NULL);
	g_return_if_fail (snapshot != NULL);
	width = (gfloat) gtk_widget_get_width ((GtkWidget*) gizmo);
	height = (gfloat) gtk_widget_get_height ((GtkWidget*) gizmo);
	border_radius = 8.0f;
	padding = FT_CONDITION_GROUP_WIDGET_LINE_WIDTH / 2.0f;
	x = width / 2.0f;
	y = border_radius + padding;
	gtk_widget_get_color ((GtkWidget*) gizmo, &_tmp0_);
	color = _tmp0_;
	color.alpha = color.alpha * 0.2f;
	_tmp1_ = gsk_path_builder_new ();
	path_builder = _tmp1_;
	_tmp2_ = path_builder;
	gsk_path_builder_move_to (_tmp2_, x, height - padding);
	_tmp3_ = path_builder;
	gsk_path_builder_line_to (_tmp3_, x, y + border_radius);
	_tmp4_ = path_builder;
	gsk_path_builder_quad_to (_tmp4_, x, y, x + border_radius, y);
	_tmp5_ = path_builder;
	gsk_path_builder_line_to (_tmp5_, width - padding, y);
	_tmp6_ = gsk_stroke_new (FT_CONDITION_GROUP_WIDGET_LINE_WIDTH);
	stroke = _tmp6_;
	_tmp7_ = stroke;
	gsk_stroke_set_line_cap (_tmp7_, GSK_LINE_CAP_ROUND);
	if (!is_top) {
		graphene_point_t _tmp8_ = {0};
		_tmp8_.x = 0.0f;
		_tmp8_.y = height;
		gtk_snapshot_translate (snapshot, &_tmp8_);
		gtk_snapshot_scale (snapshot, 1.0f, -1.0f);
	}
	_tmp9_ = path_builder;
	_tmp10_ = gsk_path_builder_to_path (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = stroke;
	_tmp13_ = color;
	gtk_snapshot_append_stroke (snapshot, _tmp11_, _tmp12_, &_tmp13_);
	_gsk_path_unref0 (_tmp11_);
	__vala_GskStroke_free0 (stroke);
	_gsk_path_builder_unref0 (path_builder);
}

static void
ft_condition_group_widget_snapshot_top_bracket (FtConditionGroupWidget* self,
                                                FtGizmo* gizmo,
                                                GtkSnapshot* snapshot)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (gizmo != NULL);
	g_return_if_fail (snapshot != NULL);
	ft_condition_group_widget_snapshot_bracket (self, gizmo, snapshot, TRUE);
}

static void
ft_condition_group_widget_snapshot_bottom_bracket (FtConditionGroupWidget* self,
                                                   FtGizmo* gizmo,
                                                   GtkSnapshot* snapshot)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (gizmo != NULL);
	g_return_if_fail (snapshot != NULL);
	ft_condition_group_widget_snapshot_bracket (self, gizmo, snapshot, FALSE);
}

static void
ft_condition_group_widget_on_argument_notify_expression (FtConditionGroupWidget* self,
                                                         GObject* object,
                                                         GParamSpec* pspec)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (pspec != NULL);
	ft_condition_group_widget_update_expression (self);
}

static void
ft_condition_group_widget_on_argument_request_remove (FtConditionGroupWidget* self,
                                                      FtExpressionWidget* argument)
{
	GtkBox* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (argument != NULL);
	_tmp0_ = self->priv->arguments_box;
	gtk_box_remove (_tmp0_, G_TYPE_CHECK_INSTANCE_CAST (argument, gtk_widget_get_type (), GtkWidget));
	if (!ft_condition_group_widget_is_empty (self)) {
		ft_condition_group_widget_update_remove_buttons (self);
		ft_condition_group_widget_update_expression (self);
	} else {
		gboolean _tmp1_;
		_tmp1_ = self->priv->_is_nested;
		if (_tmp1_) {
			g_signal_emit ((FtExpressionWidget*) self, ft_expression_widget_signals[FT_EXPRESSION_WIDGET_REQUEST_REMOVE_SIGNAL], 0);
		} else {
			FtOperation* _tmp2_;
			gboolean _tmp3_;
			gboolean _tmp4_;
			_tmp2_ = self->priv->_operation;
			if (_tmp2_ != NULL) {
				ft_expression_widget_set_expression ((FtExpressionWidget*) self, NULL);
			} else {
				ft_condition_group_widget_populate (self);
			}
			_tmp3_ = ft_expression_widget_get_removable ((FtExpressionWidget*) self);
			_tmp4_ = _tmp3_;
			if (_tmp4_) {
				g_signal_emit ((FtExpressionWidget*) self, ft_expression_widget_signals[FT_EXPRESSION_WIDGET_REQUEST_REMOVE_SIGNAL], 0);
			}
		}
	}
}

static void
ft_condition_group_widget_on_operator_button_clicked (FtConditionGroupWidget* self,
                                                      GtkButton* button)
{
	FtOperator _tmp0_ = 0;
	FtOperator _tmp1_;
	FtOperator _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp1_ = ft_condition_group_widget_get_operator (self);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == FT_OPERATOR_AND) {
		_tmp0_ = FT_OPERATOR_OR;
	} else {
		_tmp0_ = FT_OPERATOR_AND;
	}
	ft_condition_group_widget_set_operator (self, _tmp0_);
}

static void
_ft_condition_group_widget_on_operator_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                          gpointer self)
{
	ft_condition_group_widget_on_operator_button_clicked ((FtConditionGroupWidget*) self, _sender);
}

static void
ft_condition_group_widget_on_add_condition_button_clicked (FtConditionGroupWidget* self,
                                                           GtkButton* button)
{
	FtExpressionWidget* argument = NULL;
	FtExpressionWidget* _tmp0_;
	GtkWidget* sibling = NULL;
	GtkBox* _tmp1_;
	GtkWidget* _tmp2_;
	GtkWidget* _tmp3_;
	GtkBox* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = ft_condition_group_widget_create_condition (self, NULL);
	argument = _tmp0_;
	_tmp1_ = self->priv->buttons_box;
	_tmp2_ = gtk_widget_get_prev_sibling ((GtkWidget*) _tmp1_);
	_tmp3_ = _g_object_ref0 (_tmp2_);
	sibling = _tmp3_;
	_tmp4_ = self->priv->arguments_box;
	gtk_box_insert_child_after (_tmp4_, (GtkWidget*) argument, sibling);
	ft_condition_group_widget_update_remove_buttons (self);
	_g_object_unref0 (sibling);
	_g_object_unref0 (argument);
}

static void
_ft_condition_group_widget_on_add_condition_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                               gpointer self)
{
	ft_condition_group_widget_on_add_condition_button_clicked ((FtConditionGroupWidget*) self, _sender);
}

static void
ft_condition_group_widget_on_add_condition_group_button_clicked (FtConditionGroupWidget* self,
                                                                 GtkButton* button)
{
	FtExpressionWidget* argument = NULL;
	FtExpressionWidget* _tmp0_;
	GtkWidget* sibling = NULL;
	GtkBox* _tmp1_;
	GtkWidget* _tmp2_;
	GtkWidget* _tmp3_;
	GtkBox* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = ft_condition_group_widget_create_condition_group (self, NULL);
	argument = _tmp0_;
	_tmp1_ = self->priv->buttons_box;
	_tmp2_ = gtk_widget_get_prev_sibling ((GtkWidget*) _tmp1_);
	_tmp3_ = _g_object_ref0 (_tmp2_);
	sibling = _tmp3_;
	_tmp4_ = self->priv->arguments_box;
	gtk_box_insert_child_after (_tmp4_, (GtkWidget*) argument, sibling);
	ft_condition_group_widget_update_remove_buttons (self);
	_g_object_unref0 (sibling);
	_g_object_unref0 (argument);
}

static void
_ft_condition_group_widget_on_add_condition_group_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                     gpointer self)
{
	ft_condition_group_widget_on_add_condition_group_button_clicked ((FtConditionGroupWidget*) self, _sender);
}

static void
ft_condition_group_widget_calculate_height_for_width (FtConditionGroupWidget* self,
                                                      gint avaliable_width,
                                                      gint* minimum_height,
                                                      gint* natural_height)
{
	gint _vala_minimum_height = 0;
	gint _vala_natural_height = 0;
	gint tmp_minimum_height = 0;
	gint tmp_natural_height = 0;
	GtkButton* _tmp0_;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	g_return_if_fail (self != NULL);
	tmp_minimum_height = 0;
	tmp_natural_height = 0;
	_tmp0_ = self->priv->operator_button;
	gtk_widget_measure ((GtkWidget*) _tmp0_, GTK_ORIENTATION_VERTICAL, FT_CONDITION_GROUP_WIDGET_INDENT, &_tmp1_, &_tmp2_, NULL, NULL);
	tmp_minimum_height = _tmp1_;
	tmp_natural_height = _tmp2_;
	_vala_minimum_height = tmp_minimum_height + (2 * FT_CONDITION_GROUP_WIDGET_MIN_BRACKET_HEIGHT);
	_vala_natural_height = tmp_natural_height + (2 * FT_CONDITION_GROUP_WIDGET_MIN_BRACKET_HEIGHT);
	if (avaliable_width >= 0) {
		GtkBox* _tmp3_;
		gint _tmp4_ = 0;
		gint _tmp5_ = 0;
		_tmp3_ = self->priv->arguments_box;
		gtk_widget_measure ((GtkWidget*) _tmp3_, GTK_ORIENTATION_VERTICAL, (avaliable_width - FT_CONDITION_GROUP_WIDGET_INDENT) - FT_CONDITION_GROUP_WIDGET_SPACING, &_tmp4_, &_tmp5_, NULL, NULL);
		tmp_minimum_height = _tmp4_;
		tmp_natural_height = _tmp5_;
		_vala_minimum_height = MAX (_vala_minimum_height, tmp_minimum_height);
		_vala_natural_height = MAX (_vala_natural_height, tmp_natural_height);
	} else {
		GtkBox* _tmp6_;
		gint _tmp7_ = 0;
		GtkBox* _tmp8_;
		gint _tmp9_ = 0;
		_tmp6_ = self->priv->arguments_box;
		gtk_widget_measure ((GtkWidget*) _tmp6_, GTK_ORIENTATION_VERTICAL, (FT_CONDITION_GROUP_WIDGET_MIN_WIDTH - FT_CONDITION_GROUP_WIDGET_INDENT) - FT_CONDITION_GROUP_WIDGET_SPACING, &_tmp7_, NULL, NULL, NULL);
		tmp_minimum_height = _tmp7_;
		_tmp8_ = self->priv->arguments_box;
		gtk_widget_measure ((GtkWidget*) _tmp8_, GTK_ORIENTATION_VERTICAL, -1, NULL, &_tmp9_, NULL, NULL);
		tmp_natural_height = _tmp9_;
		_vala_minimum_height = MAX (_vala_minimum_height, tmp_minimum_height);
		_vala_natural_height = MAX (_vala_natural_height, tmp_natural_height);
	}
	if (minimum_height) {
		*minimum_height = _vala_minimum_height;
	}
	if (natural_height) {
		*natural_height = _vala_natural_height;
	}
}

static GtkSizeRequestMode
ft_condition_group_widget_real_get_request_mode (GtkWidget* base)
{
	FtConditionGroupWidget * self;
	GtkSizeRequestMode result;
	self = (FtConditionGroupWidget*) base;
	result = GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
	return result;
}

static void
ft_condition_group_widget_real_measure (GtkWidget* base,
                                        GtkOrientation orientation,
                                        gint for_size,
                                        gint* minimum,
                                        gint* natural,
                                        gint* minimum_baseline,
                                        gint* natural_baseline)
{
	FtConditionGroupWidget * self;
	gint _vala_minimum = 0;
	gint _vala_natural = 0;
	gint _vala_minimum_baseline = 0;
	gint _vala_natural_baseline = 0;
	self = (FtConditionGroupWidget*) base;
	if (orientation == GTK_ORIENTATION_HORIZONTAL) {
		gint _tmp0_ = 0;
		_vala_minimum = FT_CONDITION_GROUP_WIDGET_MIN_WIDTH;
		if (for_size != -1) {
			_tmp0_ = MAX (for_size, FT_CONDITION_GROUP_WIDGET_MIN_WIDTH);
		} else {
			_tmp0_ = FT_CONDITION_GROUP_WIDGET_MIN_WIDTH;
		}
		_vala_natural = _tmp0_;
	} else {
		gint _tmp1_ = 0;
		gint _tmp2_ = 0;
		ft_condition_group_widget_calculate_height_for_width (self, for_size, &_tmp1_, &_tmp2_);
		_vala_minimum = _tmp1_;
		_vala_natural = _tmp2_;
	}
	if (_vala_natural < _vala_minimum) {
		_vala_natural = _vala_minimum;
	}
	_vala_minimum_baseline = -1;
	_vala_natural_baseline = -1;
	if (minimum) {
		*minimum = _vala_minimum;
	}
	if (natural) {
		*natural = _vala_natural;
	}
	if (minimum_baseline) {
		*minimum_baseline = _vala_minimum_baseline;
	}
	if (natural_baseline) {
		*natural_baseline = _vala_natural_baseline;
	}
}

static void
ft_condition_group_widget_real_size_allocate (GtkWidget* base,
                                              gint width,
                                              gint height,
                                              gint baseline)
{
	FtConditionGroupWidget * self;
	GtkAllocation operator_allocation = {0};
	GtkAllocation _tmp0_ = {0};
	GtkButton* _tmp1_;
	GtkAllocation _tmp2_;
	gint _tmp3_ = 0;
	GtkAllocation top_bracket_allocation = {0};
	GtkAllocation _tmp4_;
	GtkAllocation _tmp5_ = {0};
	GtkAllocation bottom_bracket_allocation = {0};
	GtkAllocation _tmp6_;
	GtkAllocation _tmp7_;
	GtkAllocation _tmp8_;
	GtkAllocation _tmp9_;
	GtkAllocation _tmp10_ = {0};
	GtkAllocation arguments_allocation = {0};
	GtkAllocation _tmp11_ = {0};
	GtkBox* _tmp12_;
	GtkAllocation _tmp13_;
	gint _tmp14_ = 0;
	GtkAllocation _tmp15_;
	GtkAllocation _tmp16_;
	GtkAllocation _tmp17_;
	GtkAllocation _tmp18_;
	GtkAllocation _tmp19_;
	FtGizmo* _tmp20_;
	GtkAllocation _tmp21_;
	GtkButton* _tmp22_;
	GtkAllocation _tmp23_;
	FtGizmo* _tmp24_;
	GtkAllocation _tmp25_;
	GtkBox* _tmp26_;
	GtkAllocation _tmp27_;
	self = (FtConditionGroupWidget*) base;
	memset (&_tmp0_, 0, sizeof (GtkAllocation));
	_tmp0_.width = FT_CONDITION_GROUP_WIDGET_INDENT;
	operator_allocation = _tmp0_;
	_tmp1_ = self->priv->operator_button;
	_tmp2_ = operator_allocation;
	gtk_widget_measure ((GtkWidget*) _tmp1_, GTK_ORIENTATION_VERTICAL, _tmp2_.width, NULL, &_tmp3_, NULL, NULL);
	operator_allocation.height = _tmp3_;
	_tmp4_ = operator_allocation;
	memset (&_tmp5_, 0, sizeof (GtkAllocation));
	_tmp5_.x = (FT_CONDITION_GROUP_WIDGET_INDENT - FT_CONDITION_GROUP_WIDGET_BRACKET_WIDTH) / 2;
	_tmp5_.y = 0;
	_tmp5_.width = FT_CONDITION_GROUP_WIDGET_BRACKET_WIDTH;
	_tmp5_.height = ((height - _tmp4_.height) - FT_CONDITION_GROUP_WIDGET_SPACING) / 2;
	top_bracket_allocation = _tmp5_;
	_tmp6_ = top_bracket_allocation;
	_tmp7_ = top_bracket_allocation;
	_tmp8_ = top_bracket_allocation;
	_tmp9_ = top_bracket_allocation;
	memset (&_tmp10_, 0, sizeof (GtkAllocation));
	_tmp10_.x = _tmp6_.x;
	_tmp10_.y = height - _tmp7_.height;
	_tmp10_.width = _tmp8_.width;
	_tmp10_.height = _tmp9_.height;
	bottom_bracket_allocation = _tmp10_;
	memset (&_tmp11_, 0, sizeof (GtkAllocation));
	_tmp11_.width = (width - FT_CONDITION_GROUP_WIDGET_INDENT) - FT_CONDITION_GROUP_WIDGET_SPACING;
	_tmp11_.height = height;
	arguments_allocation = _tmp11_;
	_tmp12_ = self->priv->arguments_box;
	_tmp13_ = arguments_allocation;
	gtk_widget_measure ((GtkWidget*) _tmp12_, GTK_ORIENTATION_VERTICAL, _tmp13_.width, NULL, &_tmp14_, NULL, NULL);
	arguments_allocation.height = _tmp14_;
	_tmp15_ = operator_allocation;
	operator_allocation.x = FT_CONDITION_GROUP_WIDGET_INDENT - _tmp15_.width;
	_tmp16_ = operator_allocation;
	_tmp17_ = operator_allocation;
	arguments_allocation.x = (_tmp16_.x + FT_CONDITION_GROUP_WIDGET_SPACING) + _tmp17_.width;
	_tmp18_ = operator_allocation;
	operator_allocation.y = (height - _tmp18_.height) / 2;
	_tmp19_ = arguments_allocation;
	arguments_allocation.y = (height - _tmp19_.height) / 2;
	_tmp20_ = self->priv->top_bracket;
	_tmp21_ = top_bracket_allocation;
	gtk_widget_size_allocate ((GtkWidget*) _tmp20_, &_tmp21_, -1);
	_tmp22_ = self->priv->operator_button;
	_tmp23_ = operator_allocation;
	gtk_widget_size_allocate ((GtkWidget*) _tmp22_, &_tmp23_, -1);
	_tmp24_ = self->priv->bottom_bracket;
	_tmp25_ = bottom_bracket_allocation;
	gtk_widget_size_allocate ((GtkWidget*) _tmp24_, &_tmp25_, -1);
	_tmp26_ = self->priv->arguments_box;
	_tmp27_ = arguments_allocation;
	gtk_widget_size_allocate ((GtkWidget*) _tmp26_, &_tmp27_, -1);
}

static void
ft_condition_group_widget_real_dispose (GObject* base)
{
	FtConditionGroupWidget * self;
	FtGizmo* _tmp0_;
	FtGizmo* _tmp2_;
	self = (FtConditionGroupWidget*) base;
	_ft_expression_unref0 (self->priv->_operation);
	self->priv->_operation = NULL;
	_tmp0_ = self->priv->top_bracket;
	if (_tmp0_ != NULL) {
		FtGizmo* _tmp1_;
		_tmp1_ = self->priv->top_bracket;
		gtk_widget_unparent ((GtkWidget*) _tmp1_);
		_g_object_unref0 (self->priv->top_bracket);
		self->priv->top_bracket = NULL;
	}
	_tmp2_ = self->priv->bottom_bracket;
	if (_tmp2_ != NULL) {
		FtGizmo* _tmp3_;
		_tmp3_ = self->priv->bottom_bracket;
		gtk_widget_unparent ((GtkWidget*) _tmp3_);
		_g_object_unref0 (self->priv->bottom_bracket);
		self->priv->bottom_bracket = NULL;
	}
	gtk_widget_dispose_template ((GtkWidget*) self, FT_TYPE_CONDITION_GROUP_WIDGET);
	G_OBJECT_CLASS (ft_condition_group_widget_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
}

FtConditionGroupWidget*
ft_condition_group_widget_construct (GType object_type)
{
	FtConditionGroupWidget * self = NULL;
	self = (FtConditionGroupWidget*) g_object_new (object_type, NULL);
	return self;
}

FtConditionGroupWidget*
ft_condition_group_widget_new (void)
{
	return ft_condition_group_widget_construct (FT_TYPE_CONDITION_GROUP_WIDGET);
}

static FtExpression*
ft_condition_group_widget_real_get_expression (FtExpressionWidget* base)
{
	FtExpression* result;
	FtConditionGroupWidget* self;
	FtOperation* _tmp0_;
	self = (FtConditionGroupWidget*) base;
	_tmp0_ = self->priv->_operation;
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, FT_TYPE_EXPRESSION, FtExpression);
	return result;
}

static void
ft_condition_group_widget_real_set_expression (FtExpressionWidget* base,
                                               FtExpression* value)
{
	FtConditionGroupWidget* self;
	FtOperation* operation = NULL;
	FtOperation* _tmp0_;
	FtOperation* _tmp1_;
	FtOperation* _tmp2_;
	FtOperation* _tmp3_;
	self = (FtConditionGroupWidget*) base;
	_tmp0_ = _ft_expression_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (value, FT_TYPE_OPERATION) ? ((FtOperation*) value) : NULL);
	operation = _tmp0_;
	_tmp1_ = self->priv->_operation;
	_tmp2_ = operation;
	if (_tmp1_ == _tmp2_) {
		_ft_expression_unref0 (operation);
		return;
	}
	_tmp3_ = operation;
	if (_tmp3_ != NULL) {
		FtOperation* _tmp4_;
		FtOperation* _tmp5_;
		FtOperation* _tmp6_;
		_tmp4_ = operation;
		_tmp5_ = _ft_expression_ref0 (_tmp4_);
		_ft_expression_unref0 (self->priv->_operation);
		self->priv->_operation = _tmp5_;
		_tmp6_ = operation;
		self->priv->_operator = _tmp6_->operator;
	} else {
		_ft_expression_unref0 (self->priv->_operation);
		self->priv->_operation = NULL;
	}
	g_object_notify ((GObject*) self, "expression");
	g_object_notify ((GObject*) self, "operator");
	ft_condition_group_widget_populate (self);
	_ft_expression_unref0 (operation);
}

FtOperator
ft_condition_group_widget_get_operator (FtConditionGroupWidget* self)
{
	FtOperator result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_operator;
	return result;
}

void
ft_condition_group_widget_set_operator (FtConditionGroupWidget* self,
                                        FtOperator value)
{
	FtOperation* _tmp0_;
	g_return_if_fail (self != NULL);
	if (self->priv->_operator == value) {
		return;
	}
	self->priv->_operator = value;
	_tmp0_ = self->priv->_operation;
	if (_tmp0_ != NULL) {
		FtOperation* _tmp1_;
		_tmp1_ = self->priv->_operation;
		_tmp1_->operator = value;
	}
	ft_condition_group_widget_update_operator_label (self);
	g_object_notify_by_pspec ((GObject *) self, ft_condition_group_widget_properties[FT_CONDITION_GROUP_WIDGET_OPERATOR_PROPERTY]);
}

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

static void
ft_condition_group_widget_real_set_removable (FtExpressionWidget* base,
                                              gboolean value)
{
	FtConditionGroupWidget* self;
	self = (FtConditionGroupWidget*) base;
	if (self->priv->_removable == value) {
		return;
	}
	self->priv->_removable = value;
	ft_condition_group_widget_update_remove_buttons (self);
	g_object_notify_by_pspec ((GObject *) self, ft_condition_group_widget_properties[FT_CONDITION_GROUP_WIDGET_REMOVABLE_PROPERTY]);
}

gboolean
ft_condition_group_widget_get_is_nested (FtConditionGroupWidget* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_nested;
	return result;
}

void
ft_condition_group_widget_set_is_nested (FtConditionGroupWidget* self,
                                         gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_condition_group_widget_get_is_nested (self);
	if (old_value != value) {
		self->priv->_is_nested = value;
		g_object_notify_by_pspec ((GObject *) self, ft_condition_group_widget_properties[FT_CONDITION_GROUP_WIDGET_IS_NESTED_PROPERTY]);
	}
}

static void
_ft_condition_group_widget_measure_bracket_child_cb_ft_gizmo_measure_func (FtGizmo* gizmo,
                                                                           GtkOrientation orientation,
                                                                           gint for_size,
                                                                           gint* minimum,
                                                                           gint* natural,
                                                                           gint* minimum_baseline,
                                                                           gint* natural_baseline,
                                                                           gpointer self)
{
	ft_condition_group_widget_measure_bracket_child_cb (gizmo, orientation, for_size, minimum, natural, minimum_baseline, natural_baseline);
}

static void
_ft_condition_group_widget_snapshot_top_bracket_cb_ft_gizmo_snapshot_func (FtGizmo* gizmo,
                                                                           GtkSnapshot* snapshot,
                                                                           gpointer self)
{
	ft_condition_group_widget_snapshot_top_bracket_cb (gizmo, snapshot);
}

static void
_ft_condition_group_widget_snapshot_bottom_bracket_cb_ft_gizmo_snapshot_func (FtGizmo* gizmo,
                                                                              GtkSnapshot* snapshot,
                                                                              gpointer self)
{
	ft_condition_group_widget_snapshot_bottom_bracket_cb (gizmo, snapshot);
}

static GObject *
ft_condition_group_widget_constructor (GType type,
                                       guint n_construct_properties,
                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FtConditionGroupWidget * self;
	FtGizmo* top_bracket = NULL;
	FtGizmo* _tmp0_;
	FtGizmo* _tmp1_;
	FtGizmo* _tmp2_;
	FtGizmo* bottom_bracket = NULL;
	FtGizmo* _tmp3_;
	FtGizmo* _tmp4_;
	FtGizmo* _tmp5_;
	FtGizmo* _tmp6_;
	FtGizmo* _tmp7_;
	FtGizmo* _tmp8_;
	FtGizmo* _tmp9_;
	parent_class = G_OBJECT_CLASS (ft_condition_group_widget_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_CONDITION_GROUP_WIDGET, FtConditionGroupWidget);
	_tmp0_ = ft_gizmo_new (_ft_condition_group_widget_measure_bracket_child_cb_ft_gizmo_measure_func, NULL, NULL, NULL, NULL, NULL, _ft_condition_group_widget_snapshot_top_bracket_cb_ft_gizmo_snapshot_func, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	g_object_ref_sink (_tmp0_);
	top_bracket = _tmp0_;
	_tmp1_ = top_bracket;
	gtk_widget_set_focusable ((GtkWidget*) _tmp1_, FALSE);
	_tmp2_ = top_bracket;
	gtk_widget_set_parent ((GtkWidget*) _tmp2_, (GtkWidget*) self);
	_tmp3_ = ft_gizmo_new (_ft_condition_group_widget_measure_bracket_child_cb_ft_gizmo_measure_func, NULL, NULL, NULL, NULL, NULL, _ft_condition_group_widget_snapshot_bottom_bracket_cb_ft_gizmo_snapshot_func, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	g_object_ref_sink (_tmp3_);
	bottom_bracket = _tmp3_;
	_tmp4_ = bottom_bracket;
	gtk_widget_set_focusable ((GtkWidget*) _tmp4_, FALSE);
	_tmp5_ = bottom_bracket;
	gtk_widget_set_parent ((GtkWidget*) _tmp5_, (GtkWidget*) self);
	_tmp6_ = top_bracket;
	_tmp7_ = _g_object_ref0 (_tmp6_);
	_g_object_unref0 (self->priv->top_bracket);
	self->priv->top_bracket = _tmp7_;
	_tmp8_ = bottom_bracket;
	_tmp9_ = _g_object_ref0 (_tmp8_);
	_g_object_unref0 (self->priv->bottom_bracket);
	self->priv->bottom_bracket = _tmp9_;
	ft_condition_group_widget_populate (self);
	_g_object_unref0 (bottom_bracket);
	_g_object_unref0 (top_bracket);
	return obj;
}

static void
ft_condition_group_widget_class_init (FtConditionGroupWidgetClass * klass,
                                      gpointer klass_data)
{
	ft_condition_group_widget_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtConditionGroupWidget_private_offset);
	((GtkWidgetClass *) klass)->get_request_mode = (GtkSizeRequestMode (*) (GtkWidget*)) ft_condition_group_widget_real_get_request_mode;
	((GtkWidgetClass *) klass)->measure = (void (*) (GtkWidget*, GtkOrientation, gint, gint*, gint*, gint*, gint*)) ft_condition_group_widget_real_measure;
	((GtkWidgetClass *) klass)->size_allocate = (void (*) (GtkWidget*, gint, gint, gint)) ft_condition_group_widget_real_size_allocate;
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) ft_condition_group_widget_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_condition_group_widget_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_condition_group_widget_set_property;
	G_OBJECT_CLASS (klass)->constructor = ft_condition_group_widget_constructor;
	G_OBJECT_CLASS (klass)->finalize = ft_condition_group_widget_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CONDITION_GROUP_WIDGET_EXPRESSION_PROPERTY, ft_condition_group_widget_properties[FT_CONDITION_GROUP_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_GROUP_WIDGET_OPERATOR_PROPERTY, ft_condition_group_widget_properties[FT_CONDITION_GROUP_WIDGET_OPERATOR_PROPERTY] = g_param_spec_enum ("operator", "operator", "operator", FT_TYPE_OPERATOR, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CONDITION_GROUP_WIDGET_REMOVABLE_PROPERTY, ft_condition_group_widget_properties[FT_CONDITION_GROUP_WIDGET_REMOVABLE_PROPERTY] = g_param_spec_boolean ("removable", "removable", "removable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CONDITION_GROUP_WIDGET_IS_NESTED_PROPERTY, ft_condition_group_widget_properties[FT_CONDITION_GROUP_WIDGET_IS_NESTED_PROPERTY] = g_param_spec_boolean ("is-nested", "is-nested", "is-nested", 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-group-widget.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "operator_button", FALSE, FtConditionGroupWidget_private_offset + G_STRUCT_OFFSET (FtConditionGroupWidgetPrivate, operator_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "arguments_box", FALSE, FtConditionGroupWidget_private_offset + G_STRUCT_OFFSET (FtConditionGroupWidgetPrivate, arguments_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "buttons_box", FALSE, FtConditionGroupWidget_private_offset + G_STRUCT_OFFSET (FtConditionGroupWidgetPrivate, buttons_box));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_operator_button_clicked", G_CALLBACK(_ft_condition_group_widget_on_operator_button_clicked_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_add_condition_button_clicked", G_CALLBACK(_ft_condition_group_widget_on_add_condition_button_clicked_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_add_condition_group_button_clicked", G_CALLBACK(_ft_condition_group_widget_on_add_condition_group_button_clicked_gtk_button_clicked));
	gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (klass), "conditiongroup");
}

static void
ft_condition_group_widget_ft_expression_widget_interface_init (FtExpressionWidgetIface * iface,
                                                               gpointer iface_data)
{
	ft_condition_group_widget_ft_expression_widget_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_expression = ft_condition_group_widget_real_get_expression;
	iface->set_expression = ft_condition_group_widget_real_set_expression;
	iface->get_removable = ft_condition_group_widget_real_get_removable;
	iface->set_removable = ft_condition_group_widget_real_set_removable;
}

static void
ft_condition_group_widget_instance_init (FtConditionGroupWidget * self,
                                         gpointer klass)
{
	self->priv = ft_condition_group_widget_get_instance_private (self);
	self->priv->_is_nested = FALSE;
	self->priv->_operation = NULL;
	self->priv->_operator = FT_OPERATOR_AND;
	self->priv->_removable = FALSE;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
ft_condition_group_widget_finalize (GObject * obj)
{
	FtConditionGroupWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_CONDITION_GROUP_WIDGET, FtConditionGroupWidget);
	_ft_expression_unref0 (self->priv->_operation);
	_g_object_unref0 (self->priv->top_bracket);
	_g_object_unref0 (self->priv->bottom_bracket);
	G_OBJECT_CLASS (ft_condition_group_widget_parent_class)->finalize (obj);
}

static GType
ft_condition_group_widget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtConditionGroupWidgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_condition_group_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtConditionGroupWidget), 0, (GInstanceInitFunc) ft_condition_group_widget_instance_init, NULL };
	static const GInterfaceInfo ft_expression_widget_info = { (GInterfaceInitFunc) ft_condition_group_widget_ft_expression_widget_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType ft_condition_group_widget_type_id;
	ft_condition_group_widget_type_id = g_type_register_static (gtk_widget_get_type (), "FtConditionGroupWidget", &g_define_type_info, 0);
	g_type_add_interface_static (ft_condition_group_widget_type_id, FT_TYPE_EXPRESSION_WIDGET, &ft_expression_widget_info);
	FtConditionGroupWidget_private_offset = g_type_add_instance_private (ft_condition_group_widget_type_id, sizeof (FtConditionGroupWidgetPrivate));
	return ft_condition_group_widget_type_id;
}

GType
ft_condition_group_widget_get_type (void)
{
	static volatile gsize ft_condition_group_widget_type_id__once = 0;
	if (g_once_init_enter (&ft_condition_group_widget_type_id__once)) {
		GType ft_condition_group_widget_type_id;
		ft_condition_group_widget_type_id = ft_condition_group_widget_get_type_once ();
		g_once_init_leave (&ft_condition_group_widget_type_id__once, ft_condition_group_widget_type_id);
	}
	return ft_condition_group_widget_type_id__once;
}

static void
_vala_ft_condition_group_widget_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec)
{
	FtConditionGroupWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_CONDITION_GROUP_WIDGET, FtConditionGroupWidget);
	switch (property_id) {
		case FT_CONDITION_GROUP_WIDGET_EXPRESSION_PROPERTY:
		ft_value_set_expression (value, ft_expression_widget_get_expression ((FtExpressionWidget*) self));
		break;
		case FT_CONDITION_GROUP_WIDGET_OPERATOR_PROPERTY:
		g_value_set_enum (value, ft_condition_group_widget_get_operator (self));
		break;
		case FT_CONDITION_GROUP_WIDGET_REMOVABLE_PROPERTY:
		g_value_set_boolean (value, ft_expression_widget_get_removable ((FtExpressionWidget*) self));
		break;
		case FT_CONDITION_GROUP_WIDGET_IS_NESTED_PROPERTY:
		g_value_set_boolean (value, ft_condition_group_widget_get_is_nested (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_condition_group_widget_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec)
{
	FtConditionGroupWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_CONDITION_GROUP_WIDGET, FtConditionGroupWidget);
	switch (property_id) {
		case FT_CONDITION_GROUP_WIDGET_EXPRESSION_PROPERTY:
		ft_expression_widget_set_expression ((FtExpressionWidget*) self, ft_value_get_expression (value));
		break;
		case FT_CONDITION_GROUP_WIDGET_OPERATOR_PROPERTY:
		ft_condition_group_widget_set_operator (self, g_value_get_enum (value));
		break;
		case FT_CONDITION_GROUP_WIDGET_REMOVABLE_PROPERTY:
		ft_expression_widget_set_removable ((FtExpressionWidget*) self, g_value_get_boolean (value));
		break;
		case FT_CONDITION_GROUP_WIDGET_IS_NESTED_PROPERTY:
		ft_condition_group_widget_set_is_nested (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;
}

