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

/* SPDX-License-Identifier: GPL-3.0-or-later*/

#include "graphs.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <glib-object.h>
#include <adwaita.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	GRAPHS_EDIT_ITEM_PAGE_0_PROPERTY,
	GRAPHS_EDIT_ITEM_PAGE_NUM_PROPERTIES
};
static GParamSpec* graphs_edit_item_page_properties[GRAPHS_EDIT_ITEM_PAGE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	GRAPHS_EDIT_ITEM_BASE_BOX_0_PROPERTY,
	GRAPHS_EDIT_ITEM_BASE_BOX_NUM_PROPERTIES
};
static GParamSpec* graphs_edit_item_base_box_properties[GRAPHS_EDIT_ITEM_BASE_BOX_NUM_PROPERTIES];
enum  {
	GRAPHS_EDIT_ITEM_DATA_ITEM_BOX_0_PROPERTY,
	GRAPHS_EDIT_ITEM_DATA_ITEM_BOX_NUM_PROPERTIES
};
static GParamSpec* graphs_edit_item_data_item_box_properties[GRAPHS_EDIT_ITEM_DATA_ITEM_BOX_NUM_PROPERTIES];
enum  {
	GRAPHS_EDIT_ITEM_ERROR_BAR_GROUP_0_PROPERTY,
	GRAPHS_EDIT_ITEM_ERROR_BAR_GROUP_NUM_PROPERTIES
};
static GParamSpec* graphs_edit_item_error_bar_group_properties[GRAPHS_EDIT_ITEM_ERROR_BAR_GROUP_NUM_PROPERTIES];
typedef struct _Block7Data Block7Data;
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	GRAPHS_EDIT_ITEM_EQUATION_GROUP_0_PROPERTY,
	GRAPHS_EDIT_ITEM_EQUATION_GROUP_NUM_PROPERTIES
};
static GParamSpec* graphs_edit_item_equation_group_properties[GRAPHS_EDIT_ITEM_EQUATION_GROUP_NUM_PROPERTIES];
enum  {
	GRAPHS_EDIT_ITEM_EQUATION_ITEM_BOX_0_PROPERTY,
	GRAPHS_EDIT_ITEM_EQUATION_ITEM_BOX_NUM_PROPERTIES
};
static GParamSpec* graphs_edit_item_equation_item_box_properties[GRAPHS_EDIT_ITEM_EQUATION_ITEM_BOX_NUM_PROPERTIES];
enum  {
	GRAPHS_EDIT_ITEM_GENERATED_DATA_ITEM_BOX_0_PROPERTY,
	GRAPHS_EDIT_ITEM_GENERATED_DATA_ITEM_BOX_NUM_PROPERTIES
};
static GParamSpec* graphs_edit_item_generated_data_item_box_properties[GRAPHS_EDIT_ITEM_GENERATED_DATA_ITEM_BOX_NUM_PROPERTIES];

struct _GraphsEditItemPagePrivate {
	GtkBox* _edit_item_box;
};

struct _GraphsEditItemBaseBoxPrivate {
	AdwEntryRow* _name_entry;
	AdwComboRow* _xposition;
	AdwComboRow* _yposition;
};

struct _GraphsEditItemDataItemBoxPrivate {
	AdwComboRow* _linestyle;
	GtkScale* _linewidth;
	AdwComboRow* _markerstyle;
	GtkScale* _markersize;
};

struct _GraphsEditItemErrorBarGroupPrivate {
	AdwSwitchRow* _use_xerr;
	AdwSwitchRow* _use_yerr;
	AdwSwitchRow* _errbarsabove;
	GraphsStyleColorRow* _errcolor_row;
	GtkScale* _errcapsize;
	GtkScale* _errcapthick;
	GtkScale* _errlinewidth;
};

struct _Block7Data {
	int _ref_count_;
	GraphsEditItemErrorBarGroup* self;
	GraphsDataItem* item;
};

struct _GraphsEditItemEquationGroupPrivate {
	AdwEntryRow* _equation;
	AdwButtonRow* _simplify;
	GraphsEquationBasedItem* item;
};

struct _GraphsEditItemEquationItemBoxPrivate {
	GraphsEditItemEquationGroup* _equation_group;
	AdwComboRow* _linestyle;
	GtkScale* _linewidth;
};

struct _GraphsEditItemGeneratedDataItemBoxPrivate {
	GraphsEditItemEquationGroup* _equation_group;
	AdwEntryRow* _xstart;
	AdwEntryRow* _xstop;
	AdwSpinRow* _steps;
	AdwComboRow* _scale;
	GraphsGeneratedDataItem* item;
};

static gint GraphsEditItemPage_private_offset;
static gpointer graphs_edit_item_page_parent_class = NULL;
static gint GraphsEditItemBaseBox_private_offset;
static gpointer graphs_edit_item_base_box_parent_class = NULL;
static gint GraphsEditItemDataItemBox_private_offset;
static gpointer graphs_edit_item_data_item_box_parent_class = NULL;
static gint GraphsEditItemErrorBarGroup_private_offset;
static gpointer graphs_edit_item_error_bar_group_parent_class = NULL;
static gint GraphsEditItemEquationGroup_private_offset;
static gpointer graphs_edit_item_equation_group_parent_class = NULL;
static gint GraphsEditItemEquationItemBox_private_offset;
static gpointer graphs_edit_item_equation_item_box_parent_class = NULL;
static gint GraphsEditItemGeneratedDataItemBox_private_offset;
static gpointer graphs_edit_item_generated_data_item_box_parent_class = NULL;

static GtkBox* graphs_edit_item_page_get_edit_item_box (GraphsEditItemPage* self);
static void graphs_edit_item_page_finalize (GObject * obj);
static GType graphs_edit_item_page_get_type_once (void);
static void _vala_graphs_edit_item_page_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static AdwEntryRow* graphs_edit_item_base_box_get_name_entry (GraphsEditItemBaseBox* self);
static AdwComboRow* graphs_edit_item_base_box_get_xposition (GraphsEditItemBaseBox* self);
static AdwComboRow* graphs_edit_item_base_box_get_yposition (GraphsEditItemBaseBox* self);
static void graphs_edit_item_base_box_finalize (GObject * obj);
static GType graphs_edit_item_base_box_get_type_once (void);
static void _vala_graphs_edit_item_base_box_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec);
static AdwComboRow* graphs_edit_item_data_item_box_get_linestyle (GraphsEditItemDataItemBox* self);
static GtkScale* graphs_edit_item_data_item_box_get_linewidth (GraphsEditItemDataItemBox* self);
static AdwComboRow* graphs_edit_item_data_item_box_get_markerstyle (GraphsEditItemDataItemBox* self);
static GtkScale* graphs_edit_item_data_item_box_get_markersize (GraphsEditItemDataItemBox* self);
static void graphs_edit_item_data_item_box_on_linestyle (GraphsEditItemDataItemBox* self);
static void _graphs_edit_item_data_item_box_on_linestyle_g_object_notify (GObject* _sender,
                                                                   GParamSpec* pspec,
                                                                   gpointer self);
static void graphs_edit_item_data_item_box_on_markers (GraphsEditItemDataItemBox* self);
static void _graphs_edit_item_data_item_box_on_markers_g_object_notify (GObject* _sender,
                                                                 GParamSpec* pspec,
                                                                 gpointer self);
static void graphs_edit_item_data_item_box_finalize (GObject * obj);
static GType graphs_edit_item_data_item_box_get_type_once (void);
static void _vala_graphs_edit_item_data_item_box_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static AdwSwitchRow* graphs_edit_item_error_bar_group_get_use_xerr (GraphsEditItemErrorBarGroup* self);
static AdwSwitchRow* graphs_edit_item_error_bar_group_get_use_yerr (GraphsEditItemErrorBarGroup* self);
static AdwSwitchRow* graphs_edit_item_error_bar_group_get_errbarsabove (GraphsEditItemErrorBarGroup* self);
static GtkScale* graphs_edit_item_error_bar_group_get_errcapsize (GraphsEditItemErrorBarGroup* self);
static GtkScale* graphs_edit_item_error_bar_group_get_errcapthick (GraphsEditItemErrorBarGroup* self);
static GtkScale* graphs_edit_item_error_bar_group_get_errlinewidth (GraphsEditItemErrorBarGroup* self);
static GraphsStyleColorRow* graphs_edit_item_error_bar_group_get_errcolor_row (GraphsEditItemErrorBarGroup* self);
static void __lambda12_ (Block7Data* _data7_,
                  GObject* obj,
                  GParamSpec* pspec);
static void ___lambda12__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
static void graphs_edit_item_error_bar_group_finalize (GObject * obj);
static GType graphs_edit_item_error_bar_group_get_type_once (void);
static void _vala_graphs_edit_item_error_bar_group_get_property (GObject * object,
                                                          guint property_id,
                                                          GValue * value,
                                                          GParamSpec * pspec);
static AdwEntryRow* graphs_edit_item_equation_group_get_equation (GraphsEditItemEquationGroup* self);
static void graphs_edit_item_equation_group_on_equation_change (GraphsEditItemEquationGroup* self);
static void _graphs_edit_item_equation_group_on_equation_change_g_object_notify (GObject* _sender,
                                                                          GParamSpec* pspec,
                                                                          gpointer self);
static void graphs_edit_item_equation_group_on_equation_apply (GraphsEditItemEquationGroup* self);
static void _graphs_edit_item_equation_group_on_equation_apply_adw_entry_row_apply (AdwEntryRow* _sender,
                                                                             gpointer self);
static void graphs_edit_item_equation_group_on_simplify (GraphsEditItemEquationGroup* self);
static void _graphs_edit_item_equation_group_on_simplify_adw_button_row_activated (AdwButtonRow* _sender,
                                                                            gpointer self);
static AdwButtonRow* graphs_edit_item_equation_group_get_simplify (GraphsEditItemEquationGroup* self);
static void graphs_edit_item_equation_group_finalize (GObject * obj);
static GType graphs_edit_item_equation_group_get_type_once (void);
static void _vala_graphs_edit_item_equation_group_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec);
static GraphsEditItemEquationGroup* graphs_edit_item_equation_item_box_get_equation_group (GraphsEditItemEquationItemBox* self);
static AdwComboRow* graphs_edit_item_equation_item_box_get_linestyle (GraphsEditItemEquationItemBox* self);
static GtkScale* graphs_edit_item_equation_item_box_get_linewidth (GraphsEditItemEquationItemBox* self);
static void graphs_edit_item_equation_item_box_finalize (GObject * obj);
static GType graphs_edit_item_equation_item_box_get_type_once (void);
static void _vala_graphs_edit_item_equation_item_box_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec);
static GraphsEditItemEquationGroup* graphs_edit_item_generated_data_item_box_get_equation_group (GraphsEditItemGeneratedDataItemBox* self);
static AdwEntryRow* graphs_edit_item_generated_data_item_box_get_xstart (GraphsEditItemGeneratedDataItemBox* self);
static AdwEntryRow* graphs_edit_item_generated_data_item_box_get_xstop (GraphsEditItemGeneratedDataItemBox* self);
static AdwSpinRow* graphs_edit_item_generated_data_item_box_get_steps (GraphsEditItemGeneratedDataItemBox* self);
static AdwComboRow* graphs_edit_item_generated_data_item_box_get_scale (GraphsEditItemGeneratedDataItemBox* self);
static void graphs_edit_item_generated_data_item_box_on_entry_change (GraphsEditItemGeneratedDataItemBox* self,
                                                               GObject* object,
                                                               GParamSpec* spec);
static void _graphs_edit_item_generated_data_item_box_on_entry_change_g_object_notify (GObject* _sender,
                                                                                GParamSpec* pspec,
                                                                                gpointer self);
static void graphs_edit_item_generated_data_item_box_on_entry_apply (GraphsEditItemGeneratedDataItemBox* self,
                                                              GtkEditable* editable);
static void _graphs_edit_item_generated_data_item_box_on_entry_apply_adw_entry_row_apply (AdwEntryRow* _sender,
                                                                                   gpointer self);
static gint graphs_edit_item_generated_data_item_box_on_steps_input (GraphsEditItemGeneratedDataItemBox* self,
                                                              gdouble* val);
static gint _graphs_edit_item_generated_data_item_box_on_steps_input_adw_spin_row_input (AdwSpinRow* _sender,
                                                                                  gdouble* new_value,
                                                                                  gpointer self);
static void graphs_edit_item_generated_data_item_box_finalize (GObject * obj);
static GType graphs_edit_item_generated_data_item_box_get_type_once (void);
static void _vala_graphs_edit_item_generated_data_item_box_get_property (GObject * object,
                                                                  guint property_id,
                                                                  GValue * value,
                                                                  GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
graphs_edit_item_page_get_instance_private (GraphsEditItemPage* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsEditItemPage_private_offset);
}

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

void
graphs_edit_item_page_load_item (GraphsEditItemPage* self,
                                 GraphsItem* item)
{
	GtkWidget* widget = NULL;
	GtkBox* _tmp6_;
	GraphsEditItemBaseBox* _tmp7_;
	GraphsEditItemBaseBox* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	while (TRUE) {
		GtkBox* _tmp0_;
		GtkWidget* _tmp1_;
		GtkWidget* _tmp2_;
		GtkWidget* _tmp3_;
		GtkBox* _tmp4_;
		GtkWidget* _tmp5_;
		_tmp0_ = self->priv->_edit_item_box;
		_tmp1_ = gtk_widget_get_last_child ((GtkWidget*) _tmp0_);
		_tmp2_ = _g_object_ref0 (_tmp1_);
		_g_object_unref0 (widget);
		widget = _tmp2_;
		_tmp3_ = widget;
		if (!(_tmp3_ != NULL)) {
			break;
		}
		_tmp4_ = self->priv->_edit_item_box;
		_tmp5_ = widget;
		gtk_box_remove (_tmp4_, _tmp5_);
	}
	_tmp6_ = self->priv->_edit_item_box;
	_tmp7_ = graphs_edit_item_base_box_new (item);
	g_object_ref_sink (_tmp7_);
	_tmp8_ = _tmp7_;
	gtk_box_append (_tmp6_, (GtkWidget*) _tmp8_);
	_g_object_unref0 (_tmp8_);
	if (GRAPHS_IS_GENERATED_DATA_ITEM (item)) {
		GtkBox* _tmp9_;
		GraphsEditItemGeneratedDataItemBox* _tmp10_;
		GraphsEditItemGeneratedDataItemBox* _tmp11_;
		_tmp9_ = self->priv->_edit_item_box;
		_tmp10_ = graphs_edit_item_generated_data_item_box_new (G_TYPE_CHECK_INSTANCE_CAST (item, GRAPHS_TYPE_GENERATED_DATA_ITEM, GraphsGeneratedDataItem));
		g_object_ref_sink (_tmp10_);
		_tmp11_ = _tmp10_;
		gtk_box_append (_tmp9_, (GtkWidget*) _tmp11_);
		_g_object_unref0 (_tmp11_);
	}
	if (GRAPHS_IS_DATA_ITEM (item)) {
		GraphsDataItem* data_item = NULL;
		GraphsDataItem* _tmp12_;
		GtkBox* _tmp13_;
		GraphsDataItem* _tmp14_;
		GraphsEditItemDataItemBox* _tmp15_;
		GraphsEditItemDataItemBox* _tmp16_;
		gboolean _tmp17_ = FALSE;
		GraphsDataItem* _tmp18_;
		_tmp12_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (item, GRAPHS_TYPE_DATA_ITEM, GraphsDataItem));
		data_item = _tmp12_;
		_tmp13_ = self->priv->_edit_item_box;
		_tmp14_ = data_item;
		_tmp15_ = graphs_edit_item_data_item_box_new (_tmp14_);
		g_object_ref_sink (_tmp15_);
		_tmp16_ = _tmp15_;
		gtk_box_append (_tmp13_, (GtkWidget*) _tmp16_);
		_g_object_unref0 (_tmp16_);
		_tmp18_ = data_item;
		if (graphs_data_item_has_xerr (_tmp18_)) {
			_tmp17_ = TRUE;
		} else {
			GraphsDataItem* _tmp19_;
			_tmp19_ = data_item;
			_tmp17_ = graphs_data_item_has_yerr (_tmp19_);
		}
		if (_tmp17_) {
			GtkBox* _tmp20_;
			GraphsDataItem* _tmp21_;
			GraphsEditItemErrorBarGroup* _tmp22_;
			GraphsEditItemErrorBarGroup* _tmp23_;
			_tmp20_ = self->priv->_edit_item_box;
			_tmp21_ = data_item;
			_tmp22_ = graphs_edit_item_error_bar_group_new (_tmp21_);
			g_object_ref_sink (_tmp22_);
			_tmp23_ = _tmp22_;
			gtk_box_append (_tmp20_, (GtkWidget*) _tmp23_);
			_g_object_unref0 (_tmp23_);
		}
		_g_object_unref0 (data_item);
	} else {
		if (GRAPHS_IS_EQUATION_ITEM (item)) {
			GtkBox* _tmp24_;
			GraphsEditItemEquationItemBox* _tmp25_;
			GraphsEditItemEquationItemBox* _tmp26_;
			_tmp24_ = self->priv->_edit_item_box;
			_tmp25_ = graphs_edit_item_equation_item_box_new (G_TYPE_CHECK_INSTANCE_CAST (item, GRAPHS_TYPE_EQUATION_ITEM, GraphsEquationItem));
			g_object_ref_sink (_tmp25_);
			_tmp26_ = _tmp25_;
			gtk_box_append (_tmp24_, (GtkWidget*) _tmp26_);
			_g_object_unref0 (_tmp26_);
		}
	}
	_g_object_unref0 (widget);
}

GraphsEditItemPage*
graphs_edit_item_page_construct (GType object_type)
{
	GraphsEditItemPage * self = NULL;
	self = (GraphsEditItemPage*) g_object_new (object_type, NULL);
	return self;
}

GraphsEditItemPage*
graphs_edit_item_page_new (void)
{
	return graphs_edit_item_page_construct (GRAPHS_TYPE_EDIT_ITEM_PAGE);
}

static GtkBox*
graphs_edit_item_page_get_edit_item_box (GraphsEditItemPage* self)
{
	GtkBox* result;
	GtkBox* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_edit_item_box;
	result = _tmp0_;
	return result;
}

static void
graphs_edit_item_page_class_init (GraphsEditItemPageClass * klass,
                                  gpointer klass_data)
{
	graphs_edit_item_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraphsEditItemPage_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_graphs_edit_item_page_get_property;
	G_OBJECT_CLASS (klass)->finalize = graphs_edit_item_page_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/se/sjoerd/Graphs/ui/sidebar/edit-item/page.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "edit_item_box", FALSE, GraphsEditItemPage_private_offset + G_STRUCT_OFFSET (GraphsEditItemPagePrivate, _edit_item_box));
}

static void
graphs_edit_item_page_instance_init (GraphsEditItemPage * self,
                                     gpointer klass)
{
	self->priv = graphs_edit_item_page_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
graphs_edit_item_page_finalize (GObject * obj)
{
	GraphsEditItemPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_EDIT_ITEM_PAGE, GraphsEditItemPage);
	G_OBJECT_CLASS (graphs_edit_item_page_parent_class)->finalize (obj);
}

static GType
graphs_edit_item_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsEditItemPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_edit_item_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsEditItemPage), 0, (GInstanceInitFunc) graphs_edit_item_page_instance_init, NULL };
	GType graphs_edit_item_page_type_id;
	graphs_edit_item_page_type_id = g_type_register_static (adw_navigation_page_get_type (), "GraphsEditItemPage", &g_define_type_info, 0);
	GraphsEditItemPage_private_offset = g_type_add_instance_private (graphs_edit_item_page_type_id, sizeof (GraphsEditItemPagePrivate));
	return graphs_edit_item_page_type_id;
}

GType
graphs_edit_item_page_get_type (void)
{
	static volatile gsize graphs_edit_item_page_type_id__once = 0;
	if (g_once_init_enter (&graphs_edit_item_page_type_id__once)) {
		GType graphs_edit_item_page_type_id;
		graphs_edit_item_page_type_id = graphs_edit_item_page_get_type_once ();
		g_once_init_leave (&graphs_edit_item_page_type_id__once, graphs_edit_item_page_type_id);
	}
	return graphs_edit_item_page_type_id__once;
}

static void
_vala_graphs_edit_item_page_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	GraphsEditItemPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_EDIT_ITEM_PAGE, GraphsEditItemPage);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
graphs_edit_item_base_box_get_instance_private (GraphsEditItemBaseBox* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsEditItemBaseBox_private_offset);
}

GraphsEditItemBaseBox*
graphs_edit_item_base_box_construct (GType object_type,
                                     GraphsItem* item)
{
	GraphsEditItemBaseBox * self = NULL;
	AdwEntryRow* _tmp0_;
	AdwComboRow* _tmp1_;
	AdwComboRow* _tmp2_;
	g_return_val_if_fail (item != NULL, NULL);
	self = (GraphsEditItemBaseBox*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->_name_entry;
	g_object_bind_property_with_closures ((GObject*) item, "name", (GObject*) _tmp0_, "text", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp1_ = self->priv->_xposition;
	g_object_bind_property_with_closures ((GObject*) item, "xposition", (GObject*) _tmp1_, "selected", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp2_ = self->priv->_yposition;
	g_object_bind_property_with_closures ((GObject*) item, "yposition", (GObject*) _tmp2_, "selected", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	return self;
}

GraphsEditItemBaseBox*
graphs_edit_item_base_box_new (GraphsItem* item)
{
	return graphs_edit_item_base_box_construct (GRAPHS_TYPE_EDIT_ITEM_BASE_BOX, item);
}

static AdwEntryRow*
graphs_edit_item_base_box_get_name_entry (GraphsEditItemBaseBox* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_name_entry;
	result = _tmp0_;
	return result;
}

static AdwComboRow*
graphs_edit_item_base_box_get_xposition (GraphsEditItemBaseBox* self)
{
	AdwComboRow* result;
	AdwComboRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_xposition;
	result = _tmp0_;
	return result;
}

static AdwComboRow*
graphs_edit_item_base_box_get_yposition (GraphsEditItemBaseBox* self)
{
	AdwComboRow* result;
	AdwComboRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_yposition;
	result = _tmp0_;
	return result;
}

static void
graphs_edit_item_base_box_class_init (GraphsEditItemBaseBoxClass * klass,
                                      gpointer klass_data)
{
	graphs_edit_item_base_box_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraphsEditItemBaseBox_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_graphs_edit_item_base_box_get_property;
	G_OBJECT_CLASS (klass)->finalize = graphs_edit_item_base_box_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/se/sjoerd/Graphs/ui/sidebar/edit-item/base.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "name_entry", FALSE, GraphsEditItemBaseBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemBaseBoxPrivate, _name_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "xposition", FALSE, GraphsEditItemBaseBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemBaseBoxPrivate, _xposition));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "yposition", FALSE, GraphsEditItemBaseBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemBaseBoxPrivate, _yposition));
}

static void
graphs_edit_item_base_box_instance_init (GraphsEditItemBaseBox * self,
                                         gpointer klass)
{
	self->priv = graphs_edit_item_base_box_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
graphs_edit_item_base_box_finalize (GObject * obj)
{
	GraphsEditItemBaseBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_EDIT_ITEM_BASE_BOX, GraphsEditItemBaseBox);
	G_OBJECT_CLASS (graphs_edit_item_base_box_parent_class)->finalize (obj);
}

static GType
graphs_edit_item_base_box_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsEditItemBaseBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_edit_item_base_box_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsEditItemBaseBox), 0, (GInstanceInitFunc) graphs_edit_item_base_box_instance_init, NULL };
	GType graphs_edit_item_base_box_type_id;
	graphs_edit_item_base_box_type_id = g_type_register_static (gtk_box_get_type (), "GraphsEditItemBaseBox", &g_define_type_info, 0);
	GraphsEditItemBaseBox_private_offset = g_type_add_instance_private (graphs_edit_item_base_box_type_id, sizeof (GraphsEditItemBaseBoxPrivate));
	return graphs_edit_item_base_box_type_id;
}

GType
graphs_edit_item_base_box_get_type (void)
{
	static volatile gsize graphs_edit_item_base_box_type_id__once = 0;
	if (g_once_init_enter (&graphs_edit_item_base_box_type_id__once)) {
		GType graphs_edit_item_base_box_type_id;
		graphs_edit_item_base_box_type_id = graphs_edit_item_base_box_get_type_once ();
		g_once_init_leave (&graphs_edit_item_base_box_type_id__once, graphs_edit_item_base_box_type_id);
	}
	return graphs_edit_item_base_box_type_id__once;
}

static void
_vala_graphs_edit_item_base_box_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec)
{
	GraphsEditItemBaseBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_EDIT_ITEM_BASE_BOX, GraphsEditItemBaseBox);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
graphs_edit_item_data_item_box_get_instance_private (GraphsEditItemDataItemBox* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsEditItemDataItemBox_private_offset);
}

GraphsEditItemDataItemBox*
graphs_edit_item_data_item_box_construct (GType object_type,
                                          GraphsDataItem* item)
{
	GraphsEditItemDataItemBox * self = NULL;
	AdwComboRow* _tmp0_;
	GtkScale* _tmp1_;
	GtkAdjustment* _tmp2_;
	GtkAdjustment* _tmp3_;
	AdwComboRow* _tmp4_;
	GtkScale* _tmp5_;
	GtkAdjustment* _tmp6_;
	GtkAdjustment* _tmp7_;
	g_return_val_if_fail (item != NULL, NULL);
	self = (GraphsEditItemDataItemBox*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->_linestyle;
	g_object_bind_property_with_closures ((GObject*) item, "linestyle", (GObject*) _tmp0_, "selected", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp1_ = self->priv->_linewidth;
	_tmp2_ = gtk_range_get_adjustment ((GtkRange*) _tmp1_);
	_tmp3_ = _tmp2_;
	g_object_bind_property_with_closures ((GObject*) item, "linewidth", (GObject*) _tmp3_, "value", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp4_ = self->priv->_markerstyle;
	g_object_bind_property_with_closures ((GObject*) item, "markerstyle", (GObject*) _tmp4_, "selected", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp5_ = self->priv->_markersize;
	_tmp6_ = gtk_range_get_adjustment ((GtkRange*) _tmp5_);
	_tmp7_ = _tmp6_;
	g_object_bind_property_with_closures ((GObject*) item, "markersize", (GObject*) _tmp7_, "value", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	return self;
}

GraphsEditItemDataItemBox*
graphs_edit_item_data_item_box_new (GraphsDataItem* item)
{
	return graphs_edit_item_data_item_box_construct (GRAPHS_TYPE_EDIT_ITEM_DATA_ITEM_BOX, item);
}

static void
graphs_edit_item_data_item_box_on_linestyle (GraphsEditItemDataItemBox* self)
{
	GtkScale* _tmp0_;
	AdwComboRow* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_linewidth;
	_tmp1_ = self->priv->_linestyle;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, adw_combo_row_get_selected (_tmp1_) != ((guint) 0));
}

static void
_graphs_edit_item_data_item_box_on_linestyle_g_object_notify (GObject* _sender,
                                                              GParamSpec* pspec,
                                                              gpointer self)
{
	graphs_edit_item_data_item_box_on_linestyle ((GraphsEditItemDataItemBox*) self);
}

static void
graphs_edit_item_data_item_box_on_markers (GraphsEditItemDataItemBox* self)
{
	GtkScale* _tmp0_;
	AdwComboRow* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_markersize;
	_tmp1_ = self->priv->_markerstyle;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, adw_combo_row_get_selected (_tmp1_) != ((guint) 0));
}

static void
_graphs_edit_item_data_item_box_on_markers_g_object_notify (GObject* _sender,
                                                            GParamSpec* pspec,
                                                            gpointer self)
{
	graphs_edit_item_data_item_box_on_markers ((GraphsEditItemDataItemBox*) self);
}

static AdwComboRow*
graphs_edit_item_data_item_box_get_linestyle (GraphsEditItemDataItemBox* self)
{
	AdwComboRow* result;
	AdwComboRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_linestyle;
	result = _tmp0_;
	return result;
}

static GtkScale*
graphs_edit_item_data_item_box_get_linewidth (GraphsEditItemDataItemBox* self)
{
	GtkScale* result;
	GtkScale* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_linewidth;
	result = _tmp0_;
	return result;
}

static AdwComboRow*
graphs_edit_item_data_item_box_get_markerstyle (GraphsEditItemDataItemBox* self)
{
	AdwComboRow* result;
	AdwComboRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_markerstyle;
	result = _tmp0_;
	return result;
}

static GtkScale*
graphs_edit_item_data_item_box_get_markersize (GraphsEditItemDataItemBox* self)
{
	GtkScale* result;
	GtkScale* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_markersize;
	result = _tmp0_;
	return result;
}

static void
graphs_edit_item_data_item_box_class_init (GraphsEditItemDataItemBoxClass * klass,
                                           gpointer klass_data)
{
	graphs_edit_item_data_item_box_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraphsEditItemDataItemBox_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_graphs_edit_item_data_item_box_get_property;
	G_OBJECT_CLASS (klass)->finalize = graphs_edit_item_data_item_box_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/se/sjoerd/Graphs/ui/sidebar/edit-item/data.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "linestyle", FALSE, GraphsEditItemDataItemBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemDataItemBoxPrivate, _linestyle));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "linewidth", FALSE, GraphsEditItemDataItemBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemDataItemBoxPrivate, _linewidth));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "markerstyle", FALSE, GraphsEditItemDataItemBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemDataItemBoxPrivate, _markerstyle));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "markersize", FALSE, GraphsEditItemDataItemBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemDataItemBoxPrivate, _markersize));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_linestyle", G_CALLBACK(_graphs_edit_item_data_item_box_on_linestyle_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_markers", G_CALLBACK(_graphs_edit_item_data_item_box_on_markers_g_object_notify));
}

static void
graphs_edit_item_data_item_box_instance_init (GraphsEditItemDataItemBox * self,
                                              gpointer klass)
{
	self->priv = graphs_edit_item_data_item_box_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
graphs_edit_item_data_item_box_finalize (GObject * obj)
{
	GraphsEditItemDataItemBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_EDIT_ITEM_DATA_ITEM_BOX, GraphsEditItemDataItemBox);
	G_OBJECT_CLASS (graphs_edit_item_data_item_box_parent_class)->finalize (obj);
}

static GType
graphs_edit_item_data_item_box_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsEditItemDataItemBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_edit_item_data_item_box_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsEditItemDataItemBox), 0, (GInstanceInitFunc) graphs_edit_item_data_item_box_instance_init, NULL };
	GType graphs_edit_item_data_item_box_type_id;
	graphs_edit_item_data_item_box_type_id = g_type_register_static (gtk_box_get_type (), "GraphsEditItemDataItemBox", &g_define_type_info, 0);
	GraphsEditItemDataItemBox_private_offset = g_type_add_instance_private (graphs_edit_item_data_item_box_type_id, sizeof (GraphsEditItemDataItemBoxPrivate));
	return graphs_edit_item_data_item_box_type_id;
}

GType
graphs_edit_item_data_item_box_get_type (void)
{
	static volatile gsize graphs_edit_item_data_item_box_type_id__once = 0;
	if (g_once_init_enter (&graphs_edit_item_data_item_box_type_id__once)) {
		GType graphs_edit_item_data_item_box_type_id;
		graphs_edit_item_data_item_box_type_id = graphs_edit_item_data_item_box_get_type_once ();
		g_once_init_leave (&graphs_edit_item_data_item_box_type_id__once, graphs_edit_item_data_item_box_type_id);
	}
	return graphs_edit_item_data_item_box_type_id__once;
}

static void
_vala_graphs_edit_item_data_item_box_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec)
{
	GraphsEditItemDataItemBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_EDIT_ITEM_DATA_ITEM_BOX, GraphsEditItemDataItemBox);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
graphs_edit_item_error_bar_group_get_instance_private (GraphsEditItemErrorBarGroup* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsEditItemErrorBarGroup_private_offset);
}

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

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

static void
__lambda12_ (Block7Data* _data7_,
             GObject* obj,
             GParamSpec* pspec)
{
	GraphsEditItemErrorBarGroup* self;
	GraphsStyleColorRow* _tmp0_;
	GdkRGBA _tmp1_ = {0};
	GdkRGBA _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	self = _data7_->self;
	g_return_if_fail (obj != NULL);
	g_return_if_fail (pspec != NULL);
	_tmp0_ = self->priv->_errcolor_row;
	graphs_style_color_row_get_color (_tmp0_, &_tmp1_);
	_tmp2_ = _tmp1_;
	_tmp3_ = graphs_tools_rgba_to_hex (&_tmp2_);
	_tmp4_ = _tmp3_;
	graphs_data_item_set_errcolor (_data7_->item, _tmp4_);
	_g_free0 (_tmp4_);
}

static void
___lambda12__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	__lambda12_ (self, _sender, pspec);
}

GraphsEditItemErrorBarGroup*
graphs_edit_item_error_bar_group_construct (GType object_type,
                                            GraphsDataItem* item)
{
	GraphsEditItemErrorBarGroup * self = NULL;
	Block7Data* _data7_;
	GraphsDataItem* _tmp0_;
	AdwSwitchRow* _tmp5_;
	GtkScale* _tmp6_;
	GtkAdjustment* _tmp7_;
	GtkAdjustment* _tmp8_;
	GtkScale* _tmp9_;
	GtkAdjustment* _tmp10_;
	GtkAdjustment* _tmp11_;
	GtkScale* _tmp12_;
	GtkAdjustment* _tmp13_;
	GtkAdjustment* _tmp14_;
	GraphsStyleColorRow* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	GdkRGBA _tmp18_ = {0};
	GraphsStyleColorRow* _tmp19_;
	g_return_val_if_fail (item != NULL, NULL);
	_data7_ = g_slice_new0 (Block7Data);
	_data7_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (item);
	_g_object_unref0 (_data7_->item);
	_data7_->item = _tmp0_;
	self = (GraphsEditItemErrorBarGroup*) g_object_new (object_type, NULL);
	_data7_->self = g_object_ref (self);
	if (graphs_data_item_has_xerr (_data7_->item)) {
		AdwSwitchRow* _tmp1_;
		AdwSwitchRow* _tmp2_;
		_tmp1_ = self->priv->_use_xerr;
		gtk_widget_set_visible ((GtkWidget*) _tmp1_, TRUE);
		_tmp2_ = self->priv->_use_xerr;
		g_object_bind_property_with_closures ((GObject*) _data7_->item, "showxerr", (GObject*) _tmp2_, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	}
	if (graphs_data_item_has_yerr (_data7_->item)) {
		AdwSwitchRow* _tmp3_;
		AdwSwitchRow* _tmp4_;
		_tmp3_ = self->priv->_use_yerr;
		gtk_widget_set_visible ((GtkWidget*) _tmp3_, TRUE);
		_tmp4_ = self->priv->_use_yerr;
		g_object_bind_property_with_closures ((GObject*) _data7_->item, "showyerr", (GObject*) _tmp4_, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	}
	_tmp5_ = self->priv->_errbarsabove;
	g_object_bind_property_with_closures ((GObject*) _data7_->item, "errbarsabove", (GObject*) _tmp5_, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp6_ = self->priv->_errcapsize;
	_tmp7_ = gtk_range_get_adjustment ((GtkRange*) _tmp6_);
	_tmp8_ = _tmp7_;
	g_object_bind_property_with_closures ((GObject*) _data7_->item, "errcapsize", (GObject*) _tmp8_, "value", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp9_ = self->priv->_errcapthick;
	_tmp10_ = gtk_range_get_adjustment ((GtkRange*) _tmp9_);
	_tmp11_ = _tmp10_;
	g_object_bind_property_with_closures ((GObject*) _data7_->item, "errcapthick", (GObject*) _tmp11_, "value", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp12_ = self->priv->_errlinewidth;
	_tmp13_ = gtk_range_get_adjustment ((GtkRange*) _tmp12_);
	_tmp14_ = _tmp13_;
	g_object_bind_property_with_closures ((GObject*) _data7_->item, "errlinewidth", (GObject*) _tmp14_, "value", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp15_ = self->priv->_errcolor_row;
	_tmp16_ = graphs_data_item_get_errcolor (_data7_->item);
	_tmp17_ = _tmp16_;
	graphs_tools_hex_to_rgba (_tmp17_, &_tmp18_);
	graphs_style_color_row_set_color (_tmp15_, &_tmp18_);
	_tmp19_ = self->priv->_errcolor_row;
	g_signal_connect_data ((GObject*) _tmp19_, "notify::color", (GCallback) ___lambda12__g_object_notify, block7_data_ref (_data7_), (GClosureNotify) block7_data_unref, 0);
	block7_data_unref (_data7_);
	_data7_ = NULL;
	return self;
}

GraphsEditItemErrorBarGroup*
graphs_edit_item_error_bar_group_new (GraphsDataItem* item)
{
	return graphs_edit_item_error_bar_group_construct (GRAPHS_TYPE_EDIT_ITEM_ERROR_BAR_GROUP, item);
}

static AdwSwitchRow*
graphs_edit_item_error_bar_group_get_use_xerr (GraphsEditItemErrorBarGroup* self)
{
	AdwSwitchRow* result;
	AdwSwitchRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_use_xerr;
	result = _tmp0_;
	return result;
}

static AdwSwitchRow*
graphs_edit_item_error_bar_group_get_use_yerr (GraphsEditItemErrorBarGroup* self)
{
	AdwSwitchRow* result;
	AdwSwitchRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_use_yerr;
	result = _tmp0_;
	return result;
}

static AdwSwitchRow*
graphs_edit_item_error_bar_group_get_errbarsabove (GraphsEditItemErrorBarGroup* self)
{
	AdwSwitchRow* result;
	AdwSwitchRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_errbarsabove;
	result = _tmp0_;
	return result;
}

static GraphsStyleColorRow*
graphs_edit_item_error_bar_group_get_errcolor_row (GraphsEditItemErrorBarGroup* self)
{
	GraphsStyleColorRow* result;
	GraphsStyleColorRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_errcolor_row;
	result = _tmp0_;
	return result;
}

static GtkScale*
graphs_edit_item_error_bar_group_get_errcapsize (GraphsEditItemErrorBarGroup* self)
{
	GtkScale* result;
	GtkScale* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_errcapsize;
	result = _tmp0_;
	return result;
}

static GtkScale*
graphs_edit_item_error_bar_group_get_errcapthick (GraphsEditItemErrorBarGroup* self)
{
	GtkScale* result;
	GtkScale* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_errcapthick;
	result = _tmp0_;
	return result;
}

static GtkScale*
graphs_edit_item_error_bar_group_get_errlinewidth (GraphsEditItemErrorBarGroup* self)
{
	GtkScale* result;
	GtkScale* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_errlinewidth;
	result = _tmp0_;
	return result;
}

static void
graphs_edit_item_error_bar_group_class_init (GraphsEditItemErrorBarGroupClass * klass,
                                             gpointer klass_data)
{
	graphs_edit_item_error_bar_group_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraphsEditItemErrorBarGroup_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_graphs_edit_item_error_bar_group_get_property;
	G_OBJECT_CLASS (klass)->finalize = graphs_edit_item_error_bar_group_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/se/sjoerd/Graphs/ui/sidebar/edit-item/errorbar-group.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "use_xerr", FALSE, GraphsEditItemErrorBarGroup_private_offset + G_STRUCT_OFFSET (GraphsEditItemErrorBarGroupPrivate, _use_xerr));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "use_yerr", FALSE, GraphsEditItemErrorBarGroup_private_offset + G_STRUCT_OFFSET (GraphsEditItemErrorBarGroupPrivate, _use_yerr));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "errbarsabove", FALSE, GraphsEditItemErrorBarGroup_private_offset + G_STRUCT_OFFSET (GraphsEditItemErrorBarGroupPrivate, _errbarsabove));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "errcolor_row", FALSE, GraphsEditItemErrorBarGroup_private_offset + G_STRUCT_OFFSET (GraphsEditItemErrorBarGroupPrivate, _errcolor_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "errcapsize", FALSE, GraphsEditItemErrorBarGroup_private_offset + G_STRUCT_OFFSET (GraphsEditItemErrorBarGroupPrivate, _errcapsize));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "errcapthick", FALSE, GraphsEditItemErrorBarGroup_private_offset + G_STRUCT_OFFSET (GraphsEditItemErrorBarGroupPrivate, _errcapthick));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "errlinewidth", FALSE, GraphsEditItemErrorBarGroup_private_offset + G_STRUCT_OFFSET (GraphsEditItemErrorBarGroupPrivate, _errlinewidth));
}

static void
graphs_edit_item_error_bar_group_instance_init (GraphsEditItemErrorBarGroup * self,
                                                gpointer klass)
{
	self->priv = graphs_edit_item_error_bar_group_get_instance_private (self);
	g_type_ensure (GRAPHS_TYPE_STYLE_COLOR_ROW);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
graphs_edit_item_error_bar_group_finalize (GObject * obj)
{
	GraphsEditItemErrorBarGroup * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_EDIT_ITEM_ERROR_BAR_GROUP, GraphsEditItemErrorBarGroup);
	G_OBJECT_CLASS (graphs_edit_item_error_bar_group_parent_class)->finalize (obj);
}

static GType
graphs_edit_item_error_bar_group_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsEditItemErrorBarGroupClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_edit_item_error_bar_group_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsEditItemErrorBarGroup), 0, (GInstanceInitFunc) graphs_edit_item_error_bar_group_instance_init, NULL };
	GType graphs_edit_item_error_bar_group_type_id;
	graphs_edit_item_error_bar_group_type_id = g_type_register_static (gtk_box_get_type (), "GraphsEditItemErrorBarGroup", &g_define_type_info, 0);
	GraphsEditItemErrorBarGroup_private_offset = g_type_add_instance_private (graphs_edit_item_error_bar_group_type_id, sizeof (GraphsEditItemErrorBarGroupPrivate));
	return graphs_edit_item_error_bar_group_type_id;
}

GType
graphs_edit_item_error_bar_group_get_type (void)
{
	static volatile gsize graphs_edit_item_error_bar_group_type_id__once = 0;
	if (g_once_init_enter (&graphs_edit_item_error_bar_group_type_id__once)) {
		GType graphs_edit_item_error_bar_group_type_id;
		graphs_edit_item_error_bar_group_type_id = graphs_edit_item_error_bar_group_get_type_once ();
		g_once_init_leave (&graphs_edit_item_error_bar_group_type_id__once, graphs_edit_item_error_bar_group_type_id);
	}
	return graphs_edit_item_error_bar_group_type_id__once;
}

static void
_vala_graphs_edit_item_error_bar_group_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec)
{
	GraphsEditItemErrorBarGroup * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_EDIT_ITEM_ERROR_BAR_GROUP, GraphsEditItemErrorBarGroup);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
graphs_edit_item_equation_group_get_instance_private (GraphsEditItemEquationGroup* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsEditItemEquationGroup_private_offset);
}

void
graphs_edit_item_equation_group_setup (GraphsEditItemEquationGroup* self,
                                       GraphsEquationBasedItem* item)
{
	GraphsEquationBasedItem* _tmp0_;
	AdwEntryRow* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_tmp0_ = _g_object_ref0 (item);
	_g_object_unref0 (self->priv->item);
	self->priv->item = _tmp0_;
	_tmp1_ = self->priv->_equation;
	_tmp2_ = graphs_equation_based_item_get_equation (item);
	_tmp3_ = _tmp2_;
	gtk_editable_set_text ((GtkEditable*) _tmp1_, _tmp3_);
}

static void
graphs_edit_item_equation_group_on_equation_change (GraphsEditItemEquationGroup* self)
{
	AdwEntryRow* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_equation;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	if (graphs_python_helper_validate_equation (_tmp1_)) {
		AdwEntryRow* _tmp2_;
		AdwEntryRow* _tmp3_;
		_tmp2_ = self->priv->_equation;
		gtk_widget_remove_css_class ((GtkWidget*) _tmp2_, "error");
		_tmp3_ = self->priv->_equation;
		adw_entry_row_set_show_apply_button (_tmp3_, TRUE);
	} else {
		AdwEntryRow* _tmp4_;
		AdwEntryRow* _tmp5_;
		_tmp4_ = self->priv->_equation;
		gtk_widget_add_css_class ((GtkWidget*) _tmp4_, "error");
		_tmp5_ = self->priv->_equation;
		adw_entry_row_set_show_apply_button (_tmp5_, FALSE);
	}
}

static void
_graphs_edit_item_equation_group_on_equation_change_g_object_notify (GObject* _sender,
                                                                     GParamSpec* pspec,
                                                                     gpointer self)
{
	graphs_edit_item_equation_group_on_equation_change ((GraphsEditItemEquationGroup*) self);
}

static void
graphs_edit_item_equation_group_on_equation_apply (GraphsEditItemEquationGroup* self)
{
	GraphsEquationBasedItem* _tmp0_;
	AdwEntryRow* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->item;
	_tmp1_ = self->priv->_equation;
	_tmp2_ = gtk_editable_get_text ((GtkEditable*) _tmp1_);
	graphs_equation_based_item_set_equation (_tmp0_, _tmp2_);
}

static void
_graphs_edit_item_equation_group_on_equation_apply_adw_entry_row_apply (AdwEntryRow* _sender,
                                                                        gpointer self)
{
	graphs_edit_item_equation_group_on_equation_apply ((GraphsEditItemEquationGroup*) self);
}

static void
graphs_edit_item_equation_group_on_simplify (GraphsEditItemEquationGroup* self)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		gchar* equation_str = NULL;
		AdwEntryRow* _tmp0_;
		const gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_ = NULL;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_ = NULL;
		const gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		AdwEntryRow* _tmp13_;
		const gchar* _tmp14_;
		GraphsEquationBasedItem* _tmp15_;
		const gchar* _tmp16_;
		_tmp0_ = self->priv->_equation;
		_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
		_tmp2_ = g_strdup (_tmp1_);
		equation_str = _tmp2_;
		_tmp4_ = equation_str;
		_tmp5_ = graphs_preprocess_equation (_tmp4_, &_inner_error0_);
		_tmp3_ = _tmp5_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (equation_str);
			if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
				goto __catch0_graphs_math_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		_tmp6_ = _tmp3_;
		_tmp3_ = NULL;
		_g_free0 (equation_str);
		equation_str = _tmp6_;
		_tmp7_ = equation_str;
		_tmp8_ = graphs_python_helper_simplify_equation (_tmp7_);
		_g_free0 (equation_str);
		equation_str = _tmp8_;
		_tmp10_ = equation_str;
		_tmp11_ = graphs_prettify_equation (_tmp10_, &_inner_error0_);
		_tmp9_ = _tmp11_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (_tmp3_);
			_g_free0 (equation_str);
			if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
				goto __catch0_graphs_math_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		_tmp12_ = _tmp9_;
		_tmp9_ = NULL;
		_g_free0 (equation_str);
		equation_str = _tmp12_;
		_tmp13_ = self->priv->_equation;
		_tmp14_ = equation_str;
		gtk_editable_set_text ((GtkEditable*) _tmp13_, _tmp14_);
		_tmp15_ = self->priv->item;
		_tmp16_ = equation_str;
		graphs_equation_based_item_set_equation (_tmp15_, _tmp16_);
		_g_free0 (_tmp9_);
		_g_free0 (_tmp3_);
		_g_free0 (equation_str);
	}
	goto __finally0;
	__catch0_graphs_math_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
_graphs_edit_item_equation_group_on_simplify_adw_button_row_activated (AdwButtonRow* _sender,
                                                                       gpointer self)
{
	graphs_edit_item_equation_group_on_simplify ((GraphsEditItemEquationGroup*) self);
}

GraphsEditItemEquationGroup*
graphs_edit_item_equation_group_construct (GType object_type)
{
	GraphsEditItemEquationGroup * self = NULL;
	self = (GraphsEditItemEquationGroup*) g_object_new (object_type, NULL);
	return self;
}

GraphsEditItemEquationGroup*
graphs_edit_item_equation_group_new (void)
{
	return graphs_edit_item_equation_group_construct (GRAPHS_TYPE_EDIT_ITEM_EQUATION_GROUP);
}

static AdwEntryRow*
graphs_edit_item_equation_group_get_equation (GraphsEditItemEquationGroup* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_equation;
	result = _tmp0_;
	return result;
}

static AdwButtonRow*
graphs_edit_item_equation_group_get_simplify (GraphsEditItemEquationGroup* self)
{
	AdwButtonRow* result;
	AdwButtonRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_simplify;
	result = _tmp0_;
	return result;
}

static void
graphs_edit_item_equation_group_class_init (GraphsEditItemEquationGroupClass * klass,
                                            gpointer klass_data)
{
	graphs_edit_item_equation_group_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraphsEditItemEquationGroup_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_graphs_edit_item_equation_group_get_property;
	G_OBJECT_CLASS (klass)->finalize = graphs_edit_item_equation_group_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/se/sjoerd/Graphs/ui/sidebar/edit-item/equation-group.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "equation", FALSE, GraphsEditItemEquationGroup_private_offset + G_STRUCT_OFFSET (GraphsEditItemEquationGroupPrivate, _equation));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "simplify", FALSE, GraphsEditItemEquationGroup_private_offset + G_STRUCT_OFFSET (GraphsEditItemEquationGroupPrivate, _simplify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_equation_change", G_CALLBACK(_graphs_edit_item_equation_group_on_equation_change_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_equation_apply", G_CALLBACK(_graphs_edit_item_equation_group_on_equation_apply_adw_entry_row_apply));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_simplify", G_CALLBACK(_graphs_edit_item_equation_group_on_simplify_adw_button_row_activated));
}

static void
graphs_edit_item_equation_group_instance_init (GraphsEditItemEquationGroup * self,
                                               gpointer klass)
{
	self->priv = graphs_edit_item_equation_group_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
graphs_edit_item_equation_group_finalize (GObject * obj)
{
	GraphsEditItemEquationGroup * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_EDIT_ITEM_EQUATION_GROUP, GraphsEditItemEquationGroup);
	_g_object_unref0 (self->priv->item);
	G_OBJECT_CLASS (graphs_edit_item_equation_group_parent_class)->finalize (obj);
}

static GType
graphs_edit_item_equation_group_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsEditItemEquationGroupClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_edit_item_equation_group_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsEditItemEquationGroup), 0, (GInstanceInitFunc) graphs_edit_item_equation_group_instance_init, NULL };
	GType graphs_edit_item_equation_group_type_id;
	graphs_edit_item_equation_group_type_id = g_type_register_static (adw_preferences_group_get_type (), "GraphsEditItemEquationGroup", &g_define_type_info, 0);
	GraphsEditItemEquationGroup_private_offset = g_type_add_instance_private (graphs_edit_item_equation_group_type_id, sizeof (GraphsEditItemEquationGroupPrivate));
	return graphs_edit_item_equation_group_type_id;
}

GType
graphs_edit_item_equation_group_get_type (void)
{
	static volatile gsize graphs_edit_item_equation_group_type_id__once = 0;
	if (g_once_init_enter (&graphs_edit_item_equation_group_type_id__once)) {
		GType graphs_edit_item_equation_group_type_id;
		graphs_edit_item_equation_group_type_id = graphs_edit_item_equation_group_get_type_once ();
		g_once_init_leave (&graphs_edit_item_equation_group_type_id__once, graphs_edit_item_equation_group_type_id);
	}
	return graphs_edit_item_equation_group_type_id__once;
}

static void
_vala_graphs_edit_item_equation_group_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec)
{
	GraphsEditItemEquationGroup * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_EDIT_ITEM_EQUATION_GROUP, GraphsEditItemEquationGroup);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
graphs_edit_item_equation_item_box_get_instance_private (GraphsEditItemEquationItemBox* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsEditItemEquationItemBox_private_offset);
}

GraphsEditItemEquationItemBox*
graphs_edit_item_equation_item_box_construct (GType object_type,
                                              GraphsEquationItem* item)
{
	GraphsEditItemEquationItemBox * self = NULL;
	GraphsEditItemEquationGroup* _tmp0_;
	AdwComboRow* _tmp1_;
	GtkScale* _tmp2_;
	GtkAdjustment* _tmp3_;
	GtkAdjustment* _tmp4_;
	g_return_val_if_fail (item != NULL, NULL);
	self = (GraphsEditItemEquationItemBox*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->_equation_group;
	graphs_edit_item_equation_group_setup (_tmp0_, (GraphsEquationBasedItem*) item);
	_tmp1_ = self->priv->_linestyle;
	g_object_bind_property_with_closures ((GObject*) item, "linestyle", (GObject*) _tmp1_, "selected", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp2_ = self->priv->_linewidth;
	_tmp3_ = gtk_range_get_adjustment ((GtkRange*) _tmp2_);
	_tmp4_ = _tmp3_;
	g_object_bind_property_with_closures ((GObject*) item, "linewidth", (GObject*) _tmp4_, "value", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	return self;
}

GraphsEditItemEquationItemBox*
graphs_edit_item_equation_item_box_new (GraphsEquationItem* item)
{
	return graphs_edit_item_equation_item_box_construct (GRAPHS_TYPE_EDIT_ITEM_EQUATION_ITEM_BOX, item);
}

static GraphsEditItemEquationGroup*
graphs_edit_item_equation_item_box_get_equation_group (GraphsEditItemEquationItemBox* self)
{
	GraphsEditItemEquationGroup* result;
	GraphsEditItemEquationGroup* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_equation_group;
	result = _tmp0_;
	return result;
}

static AdwComboRow*
graphs_edit_item_equation_item_box_get_linestyle (GraphsEditItemEquationItemBox* self)
{
	AdwComboRow* result;
	AdwComboRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_linestyle;
	result = _tmp0_;
	return result;
}

static GtkScale*
graphs_edit_item_equation_item_box_get_linewidth (GraphsEditItemEquationItemBox* self)
{
	GtkScale* result;
	GtkScale* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_linewidth;
	result = _tmp0_;
	return result;
}

static void
graphs_edit_item_equation_item_box_class_init (GraphsEditItemEquationItemBoxClass * klass,
                                               gpointer klass_data)
{
	graphs_edit_item_equation_item_box_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraphsEditItemEquationItemBox_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_graphs_edit_item_equation_item_box_get_property;
	G_OBJECT_CLASS (klass)->finalize = graphs_edit_item_equation_item_box_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/se/sjoerd/Graphs/ui/sidebar/edit-item/equation.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "equation_group", FALSE, GraphsEditItemEquationItemBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemEquationItemBoxPrivate, _equation_group));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "linestyle", FALSE, GraphsEditItemEquationItemBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemEquationItemBoxPrivate, _linestyle));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "linewidth", FALSE, GraphsEditItemEquationItemBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemEquationItemBoxPrivate, _linewidth));
}

static void
graphs_edit_item_equation_item_box_instance_init (GraphsEditItemEquationItemBox * self,
                                                  gpointer klass)
{
	self->priv = graphs_edit_item_equation_item_box_get_instance_private (self);
	g_type_ensure (GRAPHS_TYPE_EDIT_ITEM_EQUATION_GROUP);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
graphs_edit_item_equation_item_box_finalize (GObject * obj)
{
	GraphsEditItemEquationItemBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_EDIT_ITEM_EQUATION_ITEM_BOX, GraphsEditItemEquationItemBox);
	G_OBJECT_CLASS (graphs_edit_item_equation_item_box_parent_class)->finalize (obj);
}

static GType
graphs_edit_item_equation_item_box_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsEditItemEquationItemBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_edit_item_equation_item_box_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsEditItemEquationItemBox), 0, (GInstanceInitFunc) graphs_edit_item_equation_item_box_instance_init, NULL };
	GType graphs_edit_item_equation_item_box_type_id;
	graphs_edit_item_equation_item_box_type_id = g_type_register_static (gtk_box_get_type (), "GraphsEditItemEquationItemBox", &g_define_type_info, 0);
	GraphsEditItemEquationItemBox_private_offset = g_type_add_instance_private (graphs_edit_item_equation_item_box_type_id, sizeof (GraphsEditItemEquationItemBoxPrivate));
	return graphs_edit_item_equation_item_box_type_id;
}

GType
graphs_edit_item_equation_item_box_get_type (void)
{
	static volatile gsize graphs_edit_item_equation_item_box_type_id__once = 0;
	if (g_once_init_enter (&graphs_edit_item_equation_item_box_type_id__once)) {
		GType graphs_edit_item_equation_item_box_type_id;
		graphs_edit_item_equation_item_box_type_id = graphs_edit_item_equation_item_box_get_type_once ();
		g_once_init_leave (&graphs_edit_item_equation_item_box_type_id__once, graphs_edit_item_equation_item_box_type_id);
	}
	return graphs_edit_item_equation_item_box_type_id__once;
}

static void
_vala_graphs_edit_item_equation_item_box_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec)
{
	GraphsEditItemEquationItemBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_EDIT_ITEM_EQUATION_ITEM_BOX, GraphsEditItemEquationItemBox);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
graphs_edit_item_generated_data_item_box_get_instance_private (GraphsEditItemGeneratedDataItemBox* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsEditItemGeneratedDataItemBox_private_offset);
}

GraphsEditItemGeneratedDataItemBox*
graphs_edit_item_generated_data_item_box_construct (GType object_type,
                                                    GraphsGeneratedDataItem* item)
{
	GraphsEditItemGeneratedDataItemBox * self = NULL;
	GraphsGeneratedDataItem* _tmp0_;
	GraphsEditItemEquationGroup* _tmp1_;
	AdwEntryRow* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	AdwEntryRow* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	AdwSpinRow* _tmp8_;
	AdwComboRow* _tmp9_;
	g_return_val_if_fail (item != NULL, NULL);
	self = (GraphsEditItemGeneratedDataItemBox*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (item);
	_g_object_unref0 (self->priv->item);
	self->priv->item = _tmp0_;
	_tmp1_ = self->priv->_equation_group;
	graphs_edit_item_equation_group_setup (_tmp1_, (GraphsEquationBasedItem*) item);
	_tmp2_ = self->priv->_xstart;
	_tmp3_ = graphs_generated_data_item_get_xstart (item);
	_tmp4_ = _tmp3_;
	gtk_editable_set_text ((GtkEditable*) _tmp2_, _tmp4_);
	_tmp5_ = self->priv->_xstop;
	_tmp6_ = graphs_generated_data_item_get_xstop (item);
	_tmp7_ = _tmp6_;
	gtk_editable_set_text ((GtkEditable*) _tmp5_, _tmp7_);
	_tmp8_ = self->priv->_steps;
	g_object_bind_property_with_closures ((GObject*) item, "steps", (GObject*) _tmp8_, "value", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp9_ = self->priv->_scale;
	g_object_bind_property_with_closures ((GObject*) item, "scale", (GObject*) _tmp9_, "selected", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	return self;
}

GraphsEditItemGeneratedDataItemBox*
graphs_edit_item_generated_data_item_box_new (GraphsGeneratedDataItem* item)
{
	return graphs_edit_item_generated_data_item_box_construct (GRAPHS_TYPE_EDIT_ITEM_GENERATED_DATA_ITEM_BOX, item);
}

static void
graphs_edit_item_generated_data_item_box_on_entry_change (GraphsEditItemGeneratedDataItemBox* self,
                                                          GObject* object,
                                                          GParamSpec* spec)
{
	AdwEntryRow* entry = NULL;
	AdwEntryRow* _tmp0_;
	AdwEntryRow* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (spec != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (object, adw_entry_row_get_type (), AdwEntryRow));
	entry = _tmp0_;
	_tmp1_ = entry;
	_tmp2_ = gtk_editable_get_text ((GtkEditable*) _tmp1_);
	if (graphs_try_evaluate_string (_tmp2_, NULL, (gunichar) '.')) {
		AdwEntryRow* _tmp3_;
		AdwEntryRow* _tmp4_;
		_tmp3_ = entry;
		gtk_widget_remove_css_class ((GtkWidget*) _tmp3_, "error");
		_tmp4_ = entry;
		adw_entry_row_set_show_apply_button (_tmp4_, TRUE);
	} else {
		AdwEntryRow* _tmp5_;
		AdwEntryRow* _tmp6_;
		_tmp5_ = entry;
		gtk_widget_add_css_class ((GtkWidget*) _tmp5_, "error");
		_tmp6_ = entry;
		adw_entry_row_set_show_apply_button (_tmp6_, FALSE);
	}
	_g_object_unref0 (entry);
}

static void
_graphs_edit_item_generated_data_item_box_on_entry_change_g_object_notify (GObject* _sender,
                                                                           GParamSpec* pspec,
                                                                           gpointer self)
{
	graphs_edit_item_generated_data_item_box_on_entry_change ((GraphsEditItemGeneratedDataItemBox*) self, _sender, pspec);
}

static void
graphs_edit_item_generated_data_item_box_on_entry_apply (GraphsEditItemGeneratedDataItemBox* self,
                                                         GtkEditable* editable)
{
	GraphsGeneratedDataItem* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (editable != NULL);
	_tmp0_ = self->priv->item;
	_tmp1_ = gtk_buildable_get_buildable_id ((GtkBuildable*) editable);
	_tmp2_ = gtk_editable_get_text (editable);
	g_object_set ((GObject*) _tmp0_, _tmp1_, _tmp2_, NULL);
}

static void
_graphs_edit_item_generated_data_item_box_on_entry_apply_adw_entry_row_apply (AdwEntryRow* _sender,
                                                                              gpointer self)
{
	graphs_edit_item_generated_data_item_box_on_entry_apply ((GraphsEditItemGeneratedDataItemBox*) self, _sender);
}

static gint
graphs_edit_item_generated_data_item_box_on_steps_input (GraphsEditItemGeneratedDataItemBox* self,
                                                         gdouble* val)
{
	gdouble _vala_val = 0.0;
	AdwSpinRow* _tmp0_;
	const gchar* _tmp1_;
	gdouble* _tmp2_ = NULL;
	gboolean _tmp3_;
	gdouble* _tmp4_;
	gboolean _tmp5_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = self->priv->_steps;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp3_ = graphs_try_evaluate_string (_tmp1_, &_tmp2_, (gunichar) '.');
	_tmp4_ = _tmp2_;
	_vala_val = *_tmp4_;
	_tmp5_ = _tmp3_;
	_g_free0 (_tmp4_);
	if (_tmp5_) {
		result = 1;
		if (val) {
			*val = _vala_val;
		}
		return result;
	} else {
		result = GTK_INPUT_ERROR;
		if (val) {
			*val = _vala_val;
		}
		return result;
	}
}

static gint
_graphs_edit_item_generated_data_item_box_on_steps_input_adw_spin_row_input (AdwSpinRow* _sender,
                                                                             gdouble* new_value,
                                                                             gpointer self)
{
	gint result;
	result = graphs_edit_item_generated_data_item_box_on_steps_input ((GraphsEditItemGeneratedDataItemBox*) self, new_value);
	return result;
}

static GraphsEditItemEquationGroup*
graphs_edit_item_generated_data_item_box_get_equation_group (GraphsEditItemGeneratedDataItemBox* self)
{
	GraphsEditItemEquationGroup* result;
	GraphsEditItemEquationGroup* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_equation_group;
	result = _tmp0_;
	return result;
}

static AdwEntryRow*
graphs_edit_item_generated_data_item_box_get_xstart (GraphsEditItemGeneratedDataItemBox* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_xstart;
	result = _tmp0_;
	return result;
}

static AdwEntryRow*
graphs_edit_item_generated_data_item_box_get_xstop (GraphsEditItemGeneratedDataItemBox* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_xstop;
	result = _tmp0_;
	return result;
}

static AdwSpinRow*
graphs_edit_item_generated_data_item_box_get_steps (GraphsEditItemGeneratedDataItemBox* self)
{
	AdwSpinRow* result;
	AdwSpinRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_steps;
	result = _tmp0_;
	return result;
}

static AdwComboRow*
graphs_edit_item_generated_data_item_box_get_scale (GraphsEditItemGeneratedDataItemBox* self)
{
	AdwComboRow* result;
	AdwComboRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_scale;
	result = _tmp0_;
	return result;
}

static void
graphs_edit_item_generated_data_item_box_class_init (GraphsEditItemGeneratedDataItemBoxClass * klass,
                                                     gpointer klass_data)
{
	graphs_edit_item_generated_data_item_box_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraphsEditItemGeneratedDataItemBox_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_graphs_edit_item_generated_data_item_box_get_property;
	G_OBJECT_CLASS (klass)->finalize = graphs_edit_item_generated_data_item_box_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/se/sjoerd/Graphs/ui/sidebar/edit-item/generated-data.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "equation_group", FALSE, GraphsEditItemGeneratedDataItemBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemGeneratedDataItemBoxPrivate, _equation_group));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "xstart", FALSE, GraphsEditItemGeneratedDataItemBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemGeneratedDataItemBoxPrivate, _xstart));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "xstop", FALSE, GraphsEditItemGeneratedDataItemBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemGeneratedDataItemBoxPrivate, _xstop));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "steps", FALSE, GraphsEditItemGeneratedDataItemBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemGeneratedDataItemBoxPrivate, _steps));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "scale", FALSE, GraphsEditItemGeneratedDataItemBox_private_offset + G_STRUCT_OFFSET (GraphsEditItemGeneratedDataItemBoxPrivate, _scale));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_entry_change", G_CALLBACK(_graphs_edit_item_generated_data_item_box_on_entry_change_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_entry_apply", G_CALLBACK(_graphs_edit_item_generated_data_item_box_on_entry_apply_adw_entry_row_apply));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_steps_input", G_CALLBACK(_graphs_edit_item_generated_data_item_box_on_steps_input_adw_spin_row_input));
}

static void
graphs_edit_item_generated_data_item_box_instance_init (GraphsEditItemGeneratedDataItemBox * self,
                                                        gpointer klass)
{
	self->priv = graphs_edit_item_generated_data_item_box_get_instance_private (self);
	g_type_ensure (GRAPHS_TYPE_EDIT_ITEM_EQUATION_GROUP);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
graphs_edit_item_generated_data_item_box_finalize (GObject * obj)
{
	GraphsEditItemGeneratedDataItemBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_EDIT_ITEM_GENERATED_DATA_ITEM_BOX, GraphsEditItemGeneratedDataItemBox);
	_g_object_unref0 (self->priv->item);
	G_OBJECT_CLASS (graphs_edit_item_generated_data_item_box_parent_class)->finalize (obj);
}

static GType
graphs_edit_item_generated_data_item_box_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsEditItemGeneratedDataItemBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_edit_item_generated_data_item_box_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsEditItemGeneratedDataItemBox), 0, (GInstanceInitFunc) graphs_edit_item_generated_data_item_box_instance_init, NULL };
	GType graphs_edit_item_generated_data_item_box_type_id;
	graphs_edit_item_generated_data_item_box_type_id = g_type_register_static (gtk_box_get_type (), "GraphsEditItemGeneratedDataItemBox", &g_define_type_info, 0);
	GraphsEditItemGeneratedDataItemBox_private_offset = g_type_add_instance_private (graphs_edit_item_generated_data_item_box_type_id, sizeof (GraphsEditItemGeneratedDataItemBoxPrivate));
	return graphs_edit_item_generated_data_item_box_type_id;
}

GType
graphs_edit_item_generated_data_item_box_get_type (void)
{
	static volatile gsize graphs_edit_item_generated_data_item_box_type_id__once = 0;
	if (g_once_init_enter (&graphs_edit_item_generated_data_item_box_type_id__once)) {
		GType graphs_edit_item_generated_data_item_box_type_id;
		graphs_edit_item_generated_data_item_box_type_id = graphs_edit_item_generated_data_item_box_get_type_once ();
		g_once_init_leave (&graphs_edit_item_generated_data_item_box_type_id__once, graphs_edit_item_generated_data_item_box_type_id);
	}
	return graphs_edit_item_generated_data_item_box_type_id__once;
}

static void
_vala_graphs_edit_item_generated_data_item_box_get_property (GObject * object,
                                                             guint property_id,
                                                             GValue * value,
                                                             GParamSpec * pspec)
{
	GraphsEditItemGeneratedDataItemBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_EDIT_ITEM_GENERATED_DATA_ITEM_BOX, GraphsEditItemGeneratedDataItemBox);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

