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

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

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

#define GRAPHS_SYNC (G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE)
#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_FIGURE_SETTINGS_PAGE_0_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_BOTTOM_LABEL_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_TOP_LABEL_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_LEFT_LABEL_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_RIGHT_LABEL_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_BOTTOM_LIMITS_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_MIN_BOTTOM_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_MAX_BOTTOM_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_TOP_LIMITS_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_MIN_TOP_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_MAX_TOP_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_LEFT_LIMITS_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_MIN_LEFT_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_MAX_LEFT_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_RIGHT_LIMITS_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_MIN_RIGHT_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_MAX_RIGHT_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_BOTTOM_SCALE_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_TOP_SCALE_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_LEFT_SCALE_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_RIGHT_SCALE_PROPERTY,
	GRAPHS_FIGURE_SETTINGS_PAGE_NUM_PROPERTIES
};
static GParamSpec* graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block8Data Block8Data;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
enum  {
	GRAPHS_STYLE_PAGE_0_PROPERTY,
	GRAPHS_STYLE_PAGE_NUM_PROPERTIES
};
static GParamSpec* graphs_style_page_properties[GRAPHS_STYLE_PAGE_NUM_PROPERTIES];

#define GRAPHS_TYPE_STYLE_PREVIEW (graphs_style_preview_get_type ())
#define GRAPHS_STYLE_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GRAPHS_TYPE_STYLE_PREVIEW, GraphsStylePreview))
#define GRAPHS_STYLE_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GRAPHS_TYPE_STYLE_PREVIEW, GraphsStylePreviewClass))
#define GRAPHS_IS_STYLE_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GRAPHS_TYPE_STYLE_PREVIEW))
#define GRAPHS_IS_STYLE_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GRAPHS_TYPE_STYLE_PREVIEW))
#define GRAPHS_STYLE_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GRAPHS_TYPE_STYLE_PREVIEW, GraphsStylePreviewClass))

typedef struct _GraphsStylePreview GraphsStylePreview;
typedef struct _GraphsStylePreviewClass GraphsStylePreviewClass;

struct _GraphsFigureSettingsPagePrivate {
	AdwEntryRow* _title_entry;
	AdwEntryRow* _bottom_label;
	AdwEntryRow* _top_label;
	AdwEntryRow* _left_label;
	AdwEntryRow* _right_label;
	GtkBox* _bottom_limits;
	AdwEntryRow* _min_bottom;
	AdwEntryRow* _max_bottom;
	GtkBox* _top_limits;
	AdwEntryRow* _min_top;
	AdwEntryRow* _max_top;
	GtkBox* _left_limits;
	AdwEntryRow* _min_left;
	AdwEntryRow* _max_left;
	GtkBox* _right_limits;
	AdwEntryRow* _min_right;
	AdwEntryRow* _max_right;
	AdwComboRow* _bottom_scale;
	AdwComboRow* _top_scale;
	AdwComboRow* _left_scale;
	AdwComboRow* _right_scale;
	AdwSwitchRow* _legend;
	AdwComboRow* _legend_position;
	AdwSwitchRow* _hide_unselected;
	GtkLabel* _style_name;
	GraphsWindow* window;
};

struct _Block8Data {
	int _ref_count_;
	GraphsFigureSettingsPage* self;
	AdwEntryRow* entry;
	GraphsFigureSettings* figure_settings;
	gchar* prop;
};

struct _GraphsStylePagePrivate {
	GtkGridView* _style_grid;
	GraphsWindow* window;
};

static gint GraphsFigureSettingsPage_private_offset;
static gpointer graphs_figure_settings_page_parent_class = NULL;
static gint GraphsStylePage_private_offset;
static gpointer graphs_style_page_parent_class = NULL;

static AdwEntryRow* graphs_figure_settings_page_get_title_entry (GraphsFigureSettingsPage* self);
static AdwSwitchRow* graphs_figure_settings_page_get_legend (GraphsFigureSettingsPage* self);
static AdwComboRow* graphs_figure_settings_page_get_legend_position (GraphsFigureSettingsPage* self);
static AdwSwitchRow* graphs_figure_settings_page_get_hide_unselected (GraphsFigureSettingsPage* self);
static GtkLabel* graphs_figure_settings_page_get_style_name (GraphsFigureSettingsPage* self);
static void graphs_figure_settings_page_handle_widgets (GraphsFigureSettingsPage* self,
                                                 GraphsFigureSettings* figure_settings,
                                                 const gchar* direction,
                                                 gboolean x,
                                                 gboolean both_x,
                                                 gboolean both_y);
static void graphs_figure_settings_page_bind_entry (GraphsFigureSettingsPage* self,
                                             AdwEntryRow* entry,
                                             GraphsFigureSettings* figure_settings,
                                             const gchar* prop);
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
static gboolean graphs_figure_settings_page_prettyprint_transform (GBinding* binding,
                                                            GValue* source,
                                                            GValue* target);
static gboolean _graphs_figure_settings_page_prettyprint_transform_gbinding_transform_func (GBinding* binding,
                                                                                     GValue* from_value,
                                                                                     GValue* to_value,
                                                                                     gpointer self);
static void __lambda14_ (Block8Data* _data8_);
static void ___lambda14__adw_entry_row_apply (AdwEntryRow* _sender,
                                       gpointer self);
static void graphs_figure_settings_page_on_limit_entry_change (GraphsFigureSettingsPage* self,
                                                        GObject* object,
                                                        GParamSpec* spec);
static void _graphs_figure_settings_page_on_limit_entry_change_g_object_notify (GObject* _sender,
                                                                         GParamSpec* pspec,
                                                                         gpointer self);
static void graphs_figure_settings_page_open_style_page (GraphsFigureSettingsPage* self);
static void _graphs_figure_settings_page_open_style_page_adw_action_row_activated (AdwActionRow* _sender,
                                                                            gpointer self);
static void graphs_figure_settings_page_set_as_default (GraphsFigureSettingsPage* self);
static void _graphs_figure_settings_page_set_as_default_adw_button_row_activated (AdwButtonRow* _sender,
                                                                           gpointer self);
static void graphs_figure_settings_page_finalize (GObject * obj);
static GType graphs_figure_settings_page_get_type_once (void);
static void _vala_graphs_figure_settings_page_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec);
static void graphs_style_page_on_factory_setup (GraphsStylePage* self,
                                         GObject* object);
static void _graphs_style_page_on_factory_setup_gtk_signal_list_item_factory_setup (GtkSignalListItemFactory* _sender,
                                                                             GObject* object,
                                                                             gpointer self);
static void graphs_style_page_on_factory_bind (GraphsStylePage* self,
                                        GObject* object);
static void _graphs_style_page_on_factory_bind_gtk_signal_list_item_factory_bind (GtkSignalListItemFactory* _sender,
                                                                           GObject* object,
                                                                           gpointer self);
static GtkGridView* graphs_style_page_get_style_grid (GraphsStylePage* self);
VALA_EXTERN GraphsStylePreview* graphs_style_preview_new (void);
VALA_EXTERN GraphsStylePreview* graphs_style_preview_construct (GType object_type);
VALA_EXTERN GType graphs_style_preview_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void graphs_style_preview_set_style (GraphsStylePreview* self,
                                     GraphsStyle* value);
static void graphs_style_page_finalize (GObject * obj);
static GType graphs_style_page_get_type_once (void);
static void _vala_graphs_style_page_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
graphs_figure_settings_page_get_instance_private (GraphsFigureSettingsPage* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsFigureSettingsPage_private_offset);
}

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

GraphsFigureSettingsPage*
graphs_figure_settings_page_construct (GType object_type,
                                       GraphsWindow* window)
{
	GraphsFigureSettingsPage * self = NULL;
	GraphsWindow* _tmp0_;
	GraphsFigureSettings* figure_settings = NULL;
	GraphsData* _tmp1_;
	GraphsData* _tmp2_;
	GraphsFigureSettings* _tmp3_;
	GraphsFigureSettings* _tmp4_;
	GraphsFigureSettings* _tmp5_;
	GraphsFigureSettings* _tmp6_;
	AdwEntryRow* _tmp7_;
	GraphsFigureSettings* _tmp8_;
	AdwEntryRow* _tmp9_;
	GraphsFigureSettings* _tmp10_;
	AdwEntryRow* _tmp11_;
	GraphsFigureSettings* _tmp12_;
	AdwEntryRow* _tmp13_;
	GraphsFigureSettings* _tmp14_;
	AdwEntryRow* _tmp15_;
	GraphsFigureSettings* _tmp16_;
	AdwSwitchRow* _tmp17_;
	GraphsFigureSettings* _tmp18_;
	AdwComboRow* _tmp19_;
	GraphsFigureSettings* _tmp20_;
	AdwSwitchRow* _tmp21_;
	GraphsData* _tmp22_;
	GraphsData* _tmp23_;
	GtkLabel* _tmp24_;
	gboolean* visible_axes = NULL;
	GraphsData* _tmp25_;
	GraphsData* _tmp26_;
	gint _tmp27_ = 0;
	gboolean* _tmp28_;
	gint visible_axes_length1;
	gint _visible_axes_size_;
	gboolean _tmp29_ = FALSE;
	gboolean* _tmp30_;
	gint _tmp30__length1;
	gboolean _tmp31_;
	gboolean both_x = FALSE;
	gboolean _tmp34_ = FALSE;
	gboolean* _tmp35_;
	gint _tmp35__length1;
	gboolean _tmp36_;
	gboolean both_y = FALSE;
	gchar* direction = NULL;
	gboolean* _tmp39_;
	gint _tmp39__length1;
	gboolean _tmp40_;
	gboolean* _tmp44_;
	gint _tmp44__length1;
	gboolean _tmp45_;
	gboolean* _tmp49_;
	gint _tmp49__length1;
	gboolean _tmp50_;
	gboolean* _tmp54_;
	gint _tmp54__length1;
	gboolean _tmp55_;
	g_return_val_if_fail (window != NULL, NULL);
	self = (GraphsFigureSettingsPage*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (window);
	_g_object_unref0 (self->priv->window);
	self->priv->window = _tmp0_;
	_tmp1_ = graphs_window_get_data (window);
	_tmp2_ = _tmp1_;
	_tmp3_ = graphs_data_get_figure_settings (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	figure_settings = _tmp5_;
	_tmp6_ = figure_settings;
	_tmp7_ = self->priv->_title_entry;
	g_object_bind_property_with_closures ((GObject*) _tmp6_, "title", (GObject*) _tmp7_, "text", GRAPHS_SYNC, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp8_ = figure_settings;
	_tmp9_ = self->priv->_bottom_label;
	g_object_bind_property_with_closures ((GObject*) _tmp8_, "bottom_label", (GObject*) _tmp9_, "text", GRAPHS_SYNC, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp10_ = figure_settings;
	_tmp11_ = self->priv->_top_label;
	g_object_bind_property_with_closures ((GObject*) _tmp10_, "top_label", (GObject*) _tmp11_, "text", GRAPHS_SYNC, (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_ = figure_settings;
	_tmp13_ = self->priv->_left_label;
	g_object_bind_property_with_closures ((GObject*) _tmp12_, "left_label", (GObject*) _tmp13_, "text", GRAPHS_SYNC, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp14_ = figure_settings;
	_tmp15_ = self->priv->_right_label;
	g_object_bind_property_with_closures ((GObject*) _tmp14_, "right_label", (GObject*) _tmp15_, "text", GRAPHS_SYNC, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp16_ = figure_settings;
	_tmp17_ = self->priv->_legend;
	g_object_bind_property_with_closures ((GObject*) _tmp16_, "legend", (GObject*) _tmp17_, "active", GRAPHS_SYNC, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp18_ = figure_settings;
	_tmp19_ = self->priv->_legend_position;
	g_object_bind_property_with_closures ((GObject*) _tmp18_, "legend_position", (GObject*) _tmp19_, "selected", GRAPHS_SYNC, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp20_ = figure_settings;
	_tmp21_ = self->priv->_hide_unselected;
	g_object_bind_property_with_closures ((GObject*) _tmp20_, "hide_unselected", (GObject*) _tmp21_, "active", GRAPHS_SYNC, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp22_ = graphs_window_get_data (window);
	_tmp23_ = _tmp22_;
	_tmp24_ = self->priv->_style_name;
	g_object_bind_property_with_closures ((GObject*) _tmp23_, "selected_stylename", (GObject*) _tmp24_, "label", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp25_ = graphs_window_get_data (window);
	_tmp26_ = _tmp25_;
	_tmp28_ = graphs_data_get_used_positions (_tmp26_, &_tmp27_);
	visible_axes = _tmp28_;
	visible_axes_length1 = _tmp27_;
	_visible_axes_size_ = visible_axes_length1;
	_tmp30_ = visible_axes;
	_tmp30__length1 = visible_axes_length1;
	_tmp31_ = _tmp30_[0];
	if (_tmp31_) {
		gboolean* _tmp32_;
		gint _tmp32__length1;
		gboolean _tmp33_;
		_tmp32_ = visible_axes;
		_tmp32__length1 = visible_axes_length1;
		_tmp33_ = _tmp32_[1];
		_tmp29_ = _tmp33_;
	} else {
		_tmp29_ = FALSE;
	}
	both_x = _tmp29_;
	_tmp35_ = visible_axes;
	_tmp35__length1 = visible_axes_length1;
	_tmp36_ = _tmp35_[2];
	if (_tmp36_) {
		gboolean* _tmp37_;
		gint _tmp37__length1;
		gboolean _tmp38_;
		_tmp37_ = visible_axes;
		_tmp37__length1 = visible_axes_length1;
		_tmp38_ = _tmp37_[3];
		_tmp34_ = _tmp38_;
	} else {
		_tmp34_ = FALSE;
	}
	both_y = _tmp34_;
	_tmp39_ = visible_axes;
	_tmp39__length1 = visible_axes_length1;
	_tmp40_ = _tmp39_[0];
	if (_tmp40_) {
		gchar* _tmp41_;
		GraphsFigureSettings* _tmp42_;
		const gchar* _tmp43_;
		_tmp41_ = graphs_xposition_friendly_string (GRAPHS_XPOSITION_BOTTOM);
		_g_free0 (direction);
		direction = _tmp41_;
		_tmp42_ = figure_settings;
		_tmp43_ = direction;
		graphs_figure_settings_page_handle_widgets (self, _tmp42_, _tmp43_, TRUE, both_x, both_y);
	}
	_tmp44_ = visible_axes;
	_tmp44__length1 = visible_axes_length1;
	_tmp45_ = _tmp44_[1];
	if (_tmp45_) {
		gchar* _tmp46_;
		GraphsFigureSettings* _tmp47_;
		const gchar* _tmp48_;
		_tmp46_ = graphs_xposition_friendly_string (GRAPHS_XPOSITION_TOP);
		_g_free0 (direction);
		direction = _tmp46_;
		_tmp47_ = figure_settings;
		_tmp48_ = direction;
		graphs_figure_settings_page_handle_widgets (self, _tmp47_, _tmp48_, TRUE, both_x, both_y);
	}
	_tmp49_ = visible_axes;
	_tmp49__length1 = visible_axes_length1;
	_tmp50_ = _tmp49_[2];
	if (_tmp50_) {
		gchar* _tmp51_;
		GraphsFigureSettings* _tmp52_;
		const gchar* _tmp53_;
		_tmp51_ = graphs_yposition_friendly_string (GRAPHS_YPOSITION_LEFT);
		_g_free0 (direction);
		direction = _tmp51_;
		_tmp52_ = figure_settings;
		_tmp53_ = direction;
		graphs_figure_settings_page_handle_widgets (self, _tmp52_, _tmp53_, FALSE, both_x, both_y);
	}
	_tmp54_ = visible_axes;
	_tmp54__length1 = visible_axes_length1;
	_tmp55_ = _tmp54_[3];
	if (_tmp55_) {
		gchar* _tmp56_;
		GraphsFigureSettings* _tmp57_;
		const gchar* _tmp58_;
		_tmp56_ = graphs_yposition_friendly_string (GRAPHS_YPOSITION_RIGHT);
		_g_free0 (direction);
		direction = _tmp56_;
		_tmp57_ = figure_settings;
		_tmp58_ = direction;
		graphs_figure_settings_page_handle_widgets (self, _tmp57_, _tmp58_, FALSE, both_x, both_y);
	}
	_g_free0 (direction);
	visible_axes = (g_free (visible_axes), NULL);
	_g_object_unref0 (figure_settings);
	return self;
}

GraphsFigureSettingsPage*
graphs_figure_settings_page_new (GraphsWindow* window)
{
	return graphs_figure_settings_page_construct (GRAPHS_TYPE_FIGURE_SETTINGS_PAGE, window);
}

static void
graphs_figure_settings_page_handle_widgets (GraphsFigureSettingsPage* self,
                                            GraphsFigureSettings* figure_settings,
                                            const gchar* direction,
                                            gboolean x,
                                            gboolean both_x,
                                            gboolean both_y)
{
	AdwEntryRow* entry = NULL;
	gchar* prop = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	AdwEntryRow* _tmp2_ = NULL;
	AdwEntryRow* _tmp3_;
	const gchar* _tmp4_;
	gboolean _tmp5_ = FALSE;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	AdwEntryRow* _tmp11_ = NULL;
	AdwEntryRow* _tmp12_;
	const gchar* _tmp13_;
	gboolean _tmp14_ = FALSE;
	AdwComboRow* scale = NULL;
	gchar* _tmp18_;
	const gchar* _tmp19_;
	AdwComboRow* _tmp20_ = NULL;
	AdwEntryRow* label = NULL;
	gchar* _tmp21_;
	gchar* _tmp22_;
	AdwEntryRow* _tmp23_ = NULL;
	GtkBox* limits = NULL;
	gchar* _tmp24_;
	gchar* _tmp25_;
	GtkBox* _tmp26_ = NULL;
	const gchar* _tmp27_;
	AdwComboRow* _tmp28_;
	AdwComboRow* _tmp29_;
	AdwEntryRow* _tmp30_;
	GtkBox* _tmp31_;
	gboolean _tmp32_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (figure_settings != NULL);
	g_return_if_fail (direction != NULL);
	_tmp0_ = g_strconcat ("min-", direction, NULL);
	_g_free0 (prop);
	prop = _tmp0_;
	_tmp1_ = prop;
	g_object_get ((GObject*) self, _tmp1_, &_tmp2_, NULL);
	_g_object_unref0 (entry);
	entry = _tmp2_;
	_tmp3_ = entry;
	_tmp4_ = prop;
	graphs_figure_settings_page_bind_entry (self, _tmp3_, figure_settings, _tmp4_);
	if (x) {
		_tmp5_ = !both_x;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		AdwEntryRow* _tmp6_;
		_tmp6_ = entry;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp6_, _ ("X Axis Minimum"));
	} else {
		gboolean _tmp7_ = FALSE;
		if (!x) {
			_tmp7_ = !both_y;
		} else {
			_tmp7_ = FALSE;
		}
		if (_tmp7_) {
			AdwEntryRow* _tmp8_;
			_tmp8_ = entry;
			adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp8_, _ ("Y Axis Minimum"));
		}
	}
	_tmp9_ = g_strconcat ("max-", direction, NULL);
	_g_free0 (prop);
	prop = _tmp9_;
	_tmp10_ = prop;
	g_object_get ((GObject*) self, _tmp10_, &_tmp11_, NULL);
	_g_object_unref0 (entry);
	entry = _tmp11_;
	_tmp12_ = entry;
	_tmp13_ = prop;
	graphs_figure_settings_page_bind_entry (self, _tmp12_, figure_settings, _tmp13_);
	if (x) {
		_tmp14_ = !both_x;
	} else {
		_tmp14_ = FALSE;
	}
	if (_tmp14_) {
		AdwEntryRow* _tmp15_;
		_tmp15_ = entry;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp15_, _ ("X Axis Maximum"));
	} else {
		gboolean _tmp16_ = FALSE;
		if (!x) {
			_tmp16_ = !both_y;
		} else {
			_tmp16_ = FALSE;
		}
		if (_tmp16_) {
			AdwEntryRow* _tmp17_;
			_tmp17_ = entry;
			adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp17_, _ ("Y Axis Maximum"));
		}
	}
	_tmp18_ = g_strconcat (direction, "-scale", NULL);
	_g_free0 (prop);
	prop = _tmp18_;
	_tmp19_ = prop;
	g_object_get ((GObject*) self, _tmp19_, &_tmp20_, NULL);
	_g_object_unref0 (scale);
	scale = _tmp20_;
	_tmp21_ = g_strconcat (direction, "-label", NULL);
	_tmp22_ = _tmp21_;
	g_object_get ((GObject*) self, _tmp22_, &_tmp23_, NULL);
	_g_object_unref0 (label);
	label = _tmp23_;
	_g_free0 (_tmp22_);
	_tmp24_ = g_strconcat (direction, "-limits", NULL);
	_tmp25_ = _tmp24_;
	g_object_get ((GObject*) self, _tmp25_, &_tmp26_, NULL);
	_g_object_unref0 (limits);
	limits = _tmp26_;
	_g_free0 (_tmp25_);
	_tmp27_ = prop;
	_tmp28_ = scale;
	g_object_bind_property_with_closures ((GObject*) figure_settings, _tmp27_, (GObject*) _tmp28_, "selected", GRAPHS_SYNC, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp29_ = scale;
	gtk_widget_set_visible ((GtkWidget*) _tmp29_, TRUE);
	_tmp30_ = label;
	gtk_widget_set_visible ((GtkWidget*) _tmp30_, TRUE);
	_tmp31_ = limits;
	gtk_widget_set_visible ((GtkWidget*) _tmp31_, TRUE);
	if (x) {
		_tmp32_ = !both_x;
	} else {
		_tmp32_ = FALSE;
	}
	if (_tmp32_) {
		AdwComboRow* _tmp33_;
		AdwEntryRow* _tmp34_;
		_tmp33_ = scale;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp33_, _ ("X Axis Scale"));
		_tmp34_ = label;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp34_, _ ("X Axis Label"));
	} else {
		gboolean _tmp35_ = FALSE;
		if (!x) {
			_tmp35_ = !both_y;
		} else {
			_tmp35_ = FALSE;
		}
		if (_tmp35_) {
			AdwComboRow* _tmp36_;
			AdwEntryRow* _tmp37_;
			_tmp36_ = scale;
			adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp36_, _ ("Y Axis Scale"));
			_tmp37_ = label;
			adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp37_, _ ("Y Axis Label"));
		}
	}
	_g_object_unref0 (limits);
	_g_object_unref0 (label);
	_g_object_unref0 (scale);
	_g_free0 (prop);
	_g_object_unref0 (entry);
}

static Block8Data*
block8_data_ref (Block8Data* _data8_)
{
	g_atomic_int_inc (&_data8_->_ref_count_);
	return _data8_;
}

static void
block8_data_unref (void * _userdata_)
{
	Block8Data* _data8_;
	_data8_ = (Block8Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		GraphsFigureSettingsPage* self;
		self = _data8_->self;
		_g_object_unref0 (_data8_->entry);
		_g_object_unref0 (_data8_->figure_settings);
		_g_free0 (_data8_->prop);
		_g_object_unref0 (self);
		g_slice_free (Block8Data, _data8_);
	}
}

static gboolean
_graphs_figure_settings_page_prettyprint_transform_gbinding_transform_func (GBinding* binding,
                                                                            GValue* from_value,
                                                                            GValue* to_value,
                                                                            gpointer self)
{
	gboolean result;
	result = graphs_figure_settings_page_prettyprint_transform (binding, from_value, to_value);
	return result;
}

static void
__lambda14_ (Block8Data* _data8_)
{
	GraphsFigureSettingsPage* self;
	gdouble new_val = 0.0;
	const gchar* _tmp0_;
	gdouble* _tmp1_ = NULL;
	gdouble* _tmp2_;
	GraphsWindow* _tmp3_;
	GraphsData* _tmp4_;
	GraphsData* _tmp5_;
	GraphsWindow* _tmp6_;
	GraphsCanvas* _tmp7_;
	GraphsCanvas* _tmp8_;
	self = _data8_->self;
	_tmp0_ = gtk_editable_get_text ((GtkEditable*) _data8_->entry);
	graphs_try_evaluate_string (_tmp0_, &_tmp1_, (gunichar) '.');
	_tmp2_ = _tmp1_;
	new_val = *_tmp2_;
	_g_free0 (_tmp2_);
	g_object_set ((GObject*) _data8_->figure_settings, _data8_->prop, new_val, NULL);
	_tmp3_ = self->priv->window;
	_tmp4_ = graphs_window_get_data (_tmp3_);
	_tmp5_ = _tmp4_;
	graphs_data_add_view_history_state (_tmp5_);
	_tmp6_ = self->priv->window;
	_tmp7_ = graphs_window_get_canvas (_tmp6_);
	_tmp8_ = _tmp7_;
	g_signal_emit_by_name (_tmp8_, "view-changed");
	adw_entry_row_set_show_apply_button (_data8_->entry, FALSE);
	adw_entry_row_set_show_apply_button (_data8_->entry, TRUE);
}

static void
___lambda14__adw_entry_row_apply (AdwEntryRow* _sender,
                                  gpointer self)
{
	__lambda14_ (self);
}

static void
graphs_figure_settings_page_bind_entry (GraphsFigureSettingsPage* self,
                                        AdwEntryRow* entry,
                                        GraphsFigureSettings* figure_settings,
                                        const gchar* prop)
{
	Block8Data* _data8_;
	AdwEntryRow* _tmp0_;
	GraphsFigureSettings* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	g_return_if_fail (figure_settings != NULL);
	g_return_if_fail (prop != NULL);
	_data8_ = g_slice_new0 (Block8Data);
	_data8_->_ref_count_ = 1;
	_data8_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (entry);
	_g_object_unref0 (_data8_->entry);
	_data8_->entry = _tmp0_;
	_tmp1_ = _g_object_ref0 (figure_settings);
	_g_object_unref0 (_data8_->figure_settings);
	_data8_->figure_settings = _tmp1_;
	_tmp2_ = g_strdup (prop);
	_g_free0 (_data8_->prop);
	_data8_->prop = _tmp2_;
	g_object_bind_property_with_closures ((GObject*) _data8_->figure_settings, _data8_->prop, (GObject*) _data8_->entry, "text", G_BINDING_SYNC_CREATE, (GClosure*) g_cclosure_new ((GCallback) _graphs_figure_settings_page_prettyprint_transform_gbinding_transform_func, NULL, (GClosureNotify) NULL), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	g_signal_connect_data (_data8_->entry, "apply", (GCallback) ___lambda14__adw_entry_row_apply, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	block8_data_unref (_data8_);
	_data8_ = NULL;
}

void
graphs_figure_settings_page_focus_widget (GraphsFigureSettingsPage* self,
                                          const gchar* name)
{
	GtkWidget* widget = NULL;
	GtkWidget* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	g_object_get ((GObject*) self, name, &_tmp0_, NULL);
	_g_object_unref0 (widget);
	widget = _tmp0_;
	gtk_widget_grab_focus (widget);
	_g_object_unref0 (widget);
}

static gboolean
graphs_figure_settings_page_prettyprint_transform (GBinding* binding,
                                                   GValue* source,
                                                   GValue* target)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean result;
	g_return_val_if_fail (binding != NULL, FALSE);
	g_return_val_if_fail (source != NULL, FALSE);
	g_return_val_if_fail (target != NULL, FALSE);
	_tmp0_ = graphs_math_tools_prettyprint_double (g_value_get_double (source));
	_tmp1_ = _tmp0_;
	g_value_set_string (target, _tmp1_);
	_g_free0 (_tmp1_);
	result = TRUE;
	return result;
}

static void
graphs_figure_settings_page_on_limit_entry_change (GraphsFigureSettingsPage* 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_figure_settings_page_on_limit_entry_change_g_object_notify (GObject* _sender,
                                                                    GParamSpec* pspec,
                                                                    gpointer self)
{
	graphs_figure_settings_page_on_limit_entry_change ((GraphsFigureSettingsPage*) self, _sender, pspec);
}

static void
graphs_figure_settings_page_open_style_page (GraphsFigureSettingsPage* self)
{
	GraphsStylePage* style_page = NULL;
	GraphsWindow* _tmp0_;
	GraphsStylePage* _tmp1_;
	GraphsWindow* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->window;
	_tmp1_ = graphs_style_page_new (_tmp0_);
	g_object_ref_sink (_tmp1_);
	style_page = _tmp1_;
	_tmp2_ = self->priv->window;
	graphs_window_push_sidebar_page (_tmp2_, (AdwNavigationPage*) style_page);
	_g_object_unref0 (style_page);
}

static void
_graphs_figure_settings_page_open_style_page_adw_action_row_activated (AdwActionRow* _sender,
                                                                       gpointer self)
{
	graphs_figure_settings_page_open_style_page ((GraphsFigureSettingsPage*) self);
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_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 NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_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 NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	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 NULL;
}

static void
graphs_figure_settings_page_set_as_default (GraphsFigureSettingsPage* self)
{
	GSettings* settings = NULL;
	GSettings* _tmp0_;
	gchar** strings = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar** _tmp7_;
	gint strings_length1;
	gint _strings_size_;
	gchar** bools = NULL;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar** _tmp11_;
	gint bools_length1;
	gint _bools_size_;
	gchar** enums = NULL;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar** _tmp17_;
	gint enums_length1;
	gint _enums_size_;
	GraphsFigureSettings* figure_settings = NULL;
	GraphsWindow* _tmp18_;
	GraphsData* _tmp19_;
	GraphsData* _tmp20_;
	GraphsFigureSettings* _tmp21_;
	GraphsFigureSettings* _tmp22_;
	GraphsFigureSettings* _tmp23_;
	gchar** _tmp24_;
	gint _tmp24__length1;
	gchar** _tmp34_;
	gint _tmp34__length1;
	gchar** _tmp43_;
	gint _tmp43__length1;
	GraphsWindow* _tmp52_;
	g_return_if_fail (self != NULL);
	_tmp0_ = graphs_application_get_settings_child ("figure");
	settings = _tmp0_;
	_tmp1_ = g_strdup ("custom-style");
	_tmp2_ = g_strdup ("title");
	_tmp3_ = g_strdup ("bottom-label");
	_tmp4_ = g_strdup ("left-label");
	_tmp5_ = g_strdup ("top-label");
	_tmp6_ = g_strdup ("right-label");
	_tmp7_ = g_new0 (gchar*, 6 + 1);
	_tmp7_[0] = _tmp1_;
	_tmp7_[1] = _tmp2_;
	_tmp7_[2] = _tmp3_;
	_tmp7_[3] = _tmp4_;
	_tmp7_[4] = _tmp5_;
	_tmp7_[5] = _tmp6_;
	strings = _tmp7_;
	strings_length1 = 6;
	_strings_size_ = strings_length1;
	_tmp8_ = g_strdup ("hide-unselected");
	_tmp9_ = g_strdup ("legend");
	_tmp10_ = g_strdup ("use-custom-style");
	_tmp11_ = g_new0 (gchar*, 3 + 1);
	_tmp11_[0] = _tmp8_;
	_tmp11_[1] = _tmp9_;
	_tmp11_[2] = _tmp10_;
	bools = _tmp11_;
	bools_length1 = 3;
	_bools_size_ = bools_length1;
	_tmp12_ = g_strdup ("legend-position");
	_tmp13_ = g_strdup ("top-scale");
	_tmp14_ = g_strdup ("bottom-scale");
	_tmp15_ = g_strdup ("left-scale");
	_tmp16_ = g_strdup ("right-scale");
	_tmp17_ = g_new0 (gchar*, 5 + 1);
	_tmp17_[0] = _tmp12_;
	_tmp17_[1] = _tmp13_;
	_tmp17_[2] = _tmp14_;
	_tmp17_[3] = _tmp15_;
	_tmp17_[4] = _tmp16_;
	enums = _tmp17_;
	enums_length1 = 5;
	_enums_size_ = enums_length1;
	_tmp18_ = self->priv->window;
	_tmp19_ = graphs_window_get_data (_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = graphs_data_get_figure_settings (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = _g_object_ref0 (_tmp22_);
	figure_settings = _tmp23_;
	_tmp24_ = strings;
	_tmp24__length1 = strings_length1;
	{
		gchar** key_collection = NULL;
		gint key_collection_length1 = 0;
		gint _key_collection_size_ = 0;
		gint key_it = 0;
		key_collection = _tmp24_;
		key_collection_length1 = _tmp24__length1;
		for (key_it = 0; key_it < key_collection_length1; key_it = key_it + 1) {
			gchar* _tmp25_;
			gchar* key = NULL;
			_tmp25_ = g_strdup (key_collection[key_it]);
			key = _tmp25_;
			{
				gchar* val = NULL;
				GraphsFigureSettings* _tmp26_;
				const gchar* _tmp27_;
				gchar* _tmp28_;
				gchar* _tmp29_;
				gchar* _tmp30_ = NULL;
				GSettings* _tmp31_;
				const gchar* _tmp32_;
				const gchar* _tmp33_;
				_tmp26_ = figure_settings;
				_tmp27_ = key;
				_tmp28_ = string_replace (_tmp27_, "-", "_");
				_tmp29_ = _tmp28_;
				g_object_get ((GObject*) _tmp26_, _tmp29_, &_tmp30_, NULL);
				_g_free0 (val);
				val = _tmp30_;
				_g_free0 (_tmp29_);
				_tmp31_ = settings;
				_tmp32_ = key;
				_tmp33_ = val;
				g_settings_set_string (_tmp31_, _tmp32_, _tmp33_);
				_g_free0 (val);
				_g_free0 (key);
			}
		}
	}
	_tmp34_ = bools;
	_tmp34__length1 = bools_length1;
	{
		gchar** key_collection = NULL;
		gint key_collection_length1 = 0;
		gint _key_collection_size_ = 0;
		gint key_it = 0;
		key_collection = _tmp34_;
		key_collection_length1 = _tmp34__length1;
		for (key_it = 0; key_it < key_collection_length1; key_it = key_it + 1) {
			gchar* _tmp35_;
			gchar* key = NULL;
			_tmp35_ = g_strdup (key_collection[key_it]);
			key = _tmp35_;
			{
				gboolean val = FALSE;
				GraphsFigureSettings* _tmp36_;
				const gchar* _tmp37_;
				gchar* _tmp38_;
				gchar* _tmp39_;
				gboolean _tmp40_ = FALSE;
				GSettings* _tmp41_;
				const gchar* _tmp42_;
				_tmp36_ = figure_settings;
				_tmp37_ = key;
				_tmp38_ = string_replace (_tmp37_, "-", "_");
				_tmp39_ = _tmp38_;
				g_object_get ((GObject*) _tmp36_, _tmp39_, &_tmp40_, NULL);
				val = _tmp40_;
				_g_free0 (_tmp39_);
				_tmp41_ = settings;
				_tmp42_ = key;
				g_settings_set_boolean (_tmp41_, _tmp42_, val);
				_g_free0 (key);
			}
		}
	}
	_tmp43_ = enums;
	_tmp43__length1 = enums_length1;
	{
		gchar** key_collection = NULL;
		gint key_collection_length1 = 0;
		gint _key_collection_size_ = 0;
		gint key_it = 0;
		key_collection = _tmp43_;
		key_collection_length1 = _tmp43__length1;
		for (key_it = 0; key_it < key_collection_length1; key_it = key_it + 1) {
			gchar* _tmp44_;
			gchar* key = NULL;
			_tmp44_ = g_strdup (key_collection[key_it]);
			key = _tmp44_;
			{
				gint val = 0;
				GraphsFigureSettings* _tmp45_;
				const gchar* _tmp46_;
				gchar* _tmp47_;
				gchar* _tmp48_;
				gint _tmp49_ = 0;
				GSettings* _tmp50_;
				const gchar* _tmp51_;
				_tmp45_ = figure_settings;
				_tmp46_ = key;
				_tmp47_ = string_replace (_tmp46_, "-", "_");
				_tmp48_ = _tmp47_;
				g_object_get ((GObject*) _tmp45_, _tmp48_, &_tmp49_, NULL);
				val = _tmp49_;
				_g_free0 (_tmp48_);
				_tmp50_ = settings;
				_tmp51_ = key;
				g_settings_set_enum (_tmp50_, _tmp51_, val);
				_g_free0 (key);
			}
		}
	}
	_tmp52_ = self->priv->window;
	graphs_window_add_toast_string (_tmp52_, _ ("Defaults Updated"));
	_g_object_unref0 (figure_settings);
	enums = (_vala_array_free (enums, enums_length1, (GDestroyNotify) g_free), NULL);
	bools = (_vala_array_free (bools, bools_length1, (GDestroyNotify) g_free), NULL);
	strings = (_vala_array_free (strings, strings_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (settings);
}

static void
_graphs_figure_settings_page_set_as_default_adw_button_row_activated (AdwButtonRow* _sender,
                                                                      gpointer self)
{
	graphs_figure_settings_page_set_as_default ((GraphsFigureSettingsPage*) self);
}

static AdwEntryRow*
graphs_figure_settings_page_get_title_entry (GraphsFigureSettingsPage* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_title_entry;
	result = _tmp0_;
	return result;
}

AdwEntryRow*
graphs_figure_settings_page_get_bottom_label (GraphsFigureSettingsPage* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_bottom_label;
	result = _tmp0_;
	return result;
}

AdwEntryRow*
graphs_figure_settings_page_get_top_label (GraphsFigureSettingsPage* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_top_label;
	result = _tmp0_;
	return result;
}

AdwEntryRow*
graphs_figure_settings_page_get_left_label (GraphsFigureSettingsPage* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_left_label;
	result = _tmp0_;
	return result;
}

AdwEntryRow*
graphs_figure_settings_page_get_right_label (GraphsFigureSettingsPage* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_right_label;
	result = _tmp0_;
	return result;
}

GtkBox*
graphs_figure_settings_page_get_bottom_limits (GraphsFigureSettingsPage* self)
{
	GtkBox* result;
	GtkBox* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_bottom_limits;
	result = _tmp0_;
	return result;
}

AdwEntryRow*
graphs_figure_settings_page_get_min_bottom (GraphsFigureSettingsPage* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_min_bottom;
	result = _tmp0_;
	return result;
}

AdwEntryRow*
graphs_figure_settings_page_get_max_bottom (GraphsFigureSettingsPage* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_max_bottom;
	result = _tmp0_;
	return result;
}

GtkBox*
graphs_figure_settings_page_get_top_limits (GraphsFigureSettingsPage* self)
{
	GtkBox* result;
	GtkBox* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_top_limits;
	result = _tmp0_;
	return result;
}

AdwEntryRow*
graphs_figure_settings_page_get_min_top (GraphsFigureSettingsPage* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_min_top;
	result = _tmp0_;
	return result;
}

AdwEntryRow*
graphs_figure_settings_page_get_max_top (GraphsFigureSettingsPage* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_max_top;
	result = _tmp0_;
	return result;
}

GtkBox*
graphs_figure_settings_page_get_left_limits (GraphsFigureSettingsPage* self)
{
	GtkBox* result;
	GtkBox* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_left_limits;
	result = _tmp0_;
	return result;
}

AdwEntryRow*
graphs_figure_settings_page_get_min_left (GraphsFigureSettingsPage* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_min_left;
	result = _tmp0_;
	return result;
}

AdwEntryRow*
graphs_figure_settings_page_get_max_left (GraphsFigureSettingsPage* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_max_left;
	result = _tmp0_;
	return result;
}

GtkBox*
graphs_figure_settings_page_get_right_limits (GraphsFigureSettingsPage* self)
{
	GtkBox* result;
	GtkBox* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_right_limits;
	result = _tmp0_;
	return result;
}

AdwEntryRow*
graphs_figure_settings_page_get_min_right (GraphsFigureSettingsPage* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_min_right;
	result = _tmp0_;
	return result;
}

AdwEntryRow*
graphs_figure_settings_page_get_max_right (GraphsFigureSettingsPage* self)
{
	AdwEntryRow* result;
	AdwEntryRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_max_right;
	result = _tmp0_;
	return result;
}

AdwComboRow*
graphs_figure_settings_page_get_bottom_scale (GraphsFigureSettingsPage* self)
{
	AdwComboRow* result;
	AdwComboRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_bottom_scale;
	result = _tmp0_;
	return result;
}

AdwComboRow*
graphs_figure_settings_page_get_top_scale (GraphsFigureSettingsPage* self)
{
	AdwComboRow* result;
	AdwComboRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_top_scale;
	result = _tmp0_;
	return result;
}

AdwComboRow*
graphs_figure_settings_page_get_left_scale (GraphsFigureSettingsPage* self)
{
	AdwComboRow* result;
	AdwComboRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_left_scale;
	result = _tmp0_;
	return result;
}

AdwComboRow*
graphs_figure_settings_page_get_right_scale (GraphsFigureSettingsPage* self)
{
	AdwComboRow* result;
	AdwComboRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_right_scale;
	result = _tmp0_;
	return result;
}

static AdwSwitchRow*
graphs_figure_settings_page_get_legend (GraphsFigureSettingsPage* self)
{
	AdwSwitchRow* result;
	AdwSwitchRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_legend;
	result = _tmp0_;
	return result;
}

static AdwComboRow*
graphs_figure_settings_page_get_legend_position (GraphsFigureSettingsPage* self)
{
	AdwComboRow* result;
	AdwComboRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_legend_position;
	result = _tmp0_;
	return result;
}

static AdwSwitchRow*
graphs_figure_settings_page_get_hide_unselected (GraphsFigureSettingsPage* self)
{
	AdwSwitchRow* result;
	AdwSwitchRow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_hide_unselected;
	result = _tmp0_;
	return result;
}

static GtkLabel*
graphs_figure_settings_page_get_style_name (GraphsFigureSettingsPage* self)
{
	GtkLabel* result;
	GtkLabel* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_style_name;
	result = _tmp0_;
	return result;
}

static void
graphs_figure_settings_page_class_init (GraphsFigureSettingsPageClass * klass,
                                        gpointer klass_data)
{
	graphs_figure_settings_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraphsFigureSettingsPage_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_graphs_figure_settings_page_get_property;
	G_OBJECT_CLASS (klass)->finalize = graphs_figure_settings_page_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_BOTTOM_LABEL_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_BOTTOM_LABEL_PROPERTY] = g_param_spec_object ("bottom-label", "bottom-label", "bottom-label", adw_entry_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_TOP_LABEL_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_TOP_LABEL_PROPERTY] = g_param_spec_object ("top-label", "top-label", "top-label", adw_entry_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_LEFT_LABEL_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_LEFT_LABEL_PROPERTY] = g_param_spec_object ("left-label", "left-label", "left-label", adw_entry_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_RIGHT_LABEL_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_RIGHT_LABEL_PROPERTY] = g_param_spec_object ("right-label", "right-label", "right-label", adw_entry_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_BOTTOM_LIMITS_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_BOTTOM_LIMITS_PROPERTY] = g_param_spec_object ("bottom-limits", "bottom-limits", "bottom-limits", gtk_box_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_MIN_BOTTOM_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_MIN_BOTTOM_PROPERTY] = g_param_spec_object ("min-bottom", "min-bottom", "min-bottom", adw_entry_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_MAX_BOTTOM_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_MAX_BOTTOM_PROPERTY] = g_param_spec_object ("max-bottom", "max-bottom", "max-bottom", adw_entry_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_TOP_LIMITS_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_TOP_LIMITS_PROPERTY] = g_param_spec_object ("top-limits", "top-limits", "top-limits", gtk_box_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_MIN_TOP_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_MIN_TOP_PROPERTY] = g_param_spec_object ("min-top", "min-top", "min-top", adw_entry_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_MAX_TOP_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_MAX_TOP_PROPERTY] = g_param_spec_object ("max-top", "max-top", "max-top", adw_entry_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_LEFT_LIMITS_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_LEFT_LIMITS_PROPERTY] = g_param_spec_object ("left-limits", "left-limits", "left-limits", gtk_box_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_MIN_LEFT_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_MIN_LEFT_PROPERTY] = g_param_spec_object ("min-left", "min-left", "min-left", adw_entry_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_MAX_LEFT_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_MAX_LEFT_PROPERTY] = g_param_spec_object ("max-left", "max-left", "max-left", adw_entry_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_RIGHT_LIMITS_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_RIGHT_LIMITS_PROPERTY] = g_param_spec_object ("right-limits", "right-limits", "right-limits", gtk_box_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_MIN_RIGHT_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_MIN_RIGHT_PROPERTY] = g_param_spec_object ("min-right", "min-right", "min-right", adw_entry_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_MAX_RIGHT_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_MAX_RIGHT_PROPERTY] = g_param_spec_object ("max-right", "max-right", "max-right", adw_entry_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_BOTTOM_SCALE_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_BOTTOM_SCALE_PROPERTY] = g_param_spec_object ("bottom-scale", "bottom-scale", "bottom-scale", adw_combo_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_TOP_SCALE_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_TOP_SCALE_PROPERTY] = g_param_spec_object ("top-scale", "top-scale", "top-scale", adw_combo_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_LEFT_SCALE_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_LEFT_SCALE_PROPERTY] = g_param_spec_object ("left-scale", "left-scale", "left-scale", adw_combo_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_FIGURE_SETTINGS_PAGE_RIGHT_SCALE_PROPERTY, graphs_figure_settings_page_properties[GRAPHS_FIGURE_SETTINGS_PAGE_RIGHT_SCALE_PROPERTY] = g_param_spec_object ("right-scale", "right-scale", "right-scale", adw_combo_row_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/se/sjoerd/Graphs/ui/sidebar/figure-settings/settings-page.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "title_entry", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _title_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "bottom_label", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _bottom_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "top_label", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _top_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "left_label", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _left_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "right_label", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _right_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "bottom_limits", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _bottom_limits));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "min_bottom", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _min_bottom));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "max_bottom", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _max_bottom));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "top_limits", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _top_limits));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "min_top", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _min_top));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "max_top", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _max_top));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "left_limits", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _left_limits));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "min_left", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _min_left));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "max_left", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _max_left));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "right_limits", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _right_limits));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "min_right", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _min_right));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "max_right", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _max_right));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "bottom_scale", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _bottom_scale));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "top_scale", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _top_scale));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "left_scale", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _left_scale));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "right_scale", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _right_scale));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "legend", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _legend));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "legend_position", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _legend_position));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "hide_unselected", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _hide_unselected));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "style_name", FALSE, GraphsFigureSettingsPage_private_offset + G_STRUCT_OFFSET (GraphsFigureSettingsPagePrivate, _style_name));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_limit_entry_change", G_CALLBACK(_graphs_figure_settings_page_on_limit_entry_change_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "open_style_page", G_CALLBACK(_graphs_figure_settings_page_open_style_page_adw_action_row_activated));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "set_as_default", G_CALLBACK(_graphs_figure_settings_page_set_as_default_adw_button_row_activated));
}

static void
graphs_figure_settings_page_instance_init (GraphsFigureSettingsPage * self,
                                           gpointer klass)
{
	self->priv = graphs_figure_settings_page_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
graphs_figure_settings_page_finalize (GObject * obj)
{
	GraphsFigureSettingsPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_FIGURE_SETTINGS_PAGE, GraphsFigureSettingsPage);
	_g_object_unref0 (self->priv->window);
	G_OBJECT_CLASS (graphs_figure_settings_page_parent_class)->finalize (obj);
}

static GType
graphs_figure_settings_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsFigureSettingsPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_figure_settings_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsFigureSettingsPage), 0, (GInstanceInitFunc) graphs_figure_settings_page_instance_init, NULL };
	GType graphs_figure_settings_page_type_id;
	graphs_figure_settings_page_type_id = g_type_register_static (adw_navigation_page_get_type (), "GraphsFigureSettingsPage", &g_define_type_info, 0);
	GraphsFigureSettingsPage_private_offset = g_type_add_instance_private (graphs_figure_settings_page_type_id, sizeof (GraphsFigureSettingsPagePrivate));
	return graphs_figure_settings_page_type_id;
}

GType
graphs_figure_settings_page_get_type (void)
{
	static volatile gsize graphs_figure_settings_page_type_id__once = 0;
	if (g_once_init_enter (&graphs_figure_settings_page_type_id__once)) {
		GType graphs_figure_settings_page_type_id;
		graphs_figure_settings_page_type_id = graphs_figure_settings_page_get_type_once ();
		g_once_init_leave (&graphs_figure_settings_page_type_id__once, graphs_figure_settings_page_type_id);
	}
	return graphs_figure_settings_page_type_id__once;
}

static void
_vala_graphs_figure_settings_page_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec)
{
	GraphsFigureSettingsPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_FIGURE_SETTINGS_PAGE, GraphsFigureSettingsPage);
	switch (property_id) {
		case GRAPHS_FIGURE_SETTINGS_PAGE_BOTTOM_LABEL_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_bottom_label (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_TOP_LABEL_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_top_label (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_LEFT_LABEL_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_left_label (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_RIGHT_LABEL_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_right_label (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_BOTTOM_LIMITS_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_bottom_limits (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_MIN_BOTTOM_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_min_bottom (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_MAX_BOTTOM_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_max_bottom (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_TOP_LIMITS_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_top_limits (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_MIN_TOP_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_min_top (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_MAX_TOP_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_max_top (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_LEFT_LIMITS_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_left_limits (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_MIN_LEFT_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_min_left (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_MAX_LEFT_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_max_left (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_RIGHT_LIMITS_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_right_limits (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_MIN_RIGHT_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_min_right (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_MAX_RIGHT_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_max_right (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_BOTTOM_SCALE_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_bottom_scale (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_TOP_SCALE_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_top_scale (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_LEFT_SCALE_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_left_scale (self));
		break;
		case GRAPHS_FIGURE_SETTINGS_PAGE_RIGHT_SCALE_PROPERTY:
		g_value_set_object (value, graphs_figure_settings_page_get_right_scale (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
graphs_style_page_get_instance_private (GraphsStylePage* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsStylePage_private_offset);
}

static void
_graphs_style_page_on_factory_setup_gtk_signal_list_item_factory_setup (GtkSignalListItemFactory* _sender,
                                                                        GObject* object,
                                                                        gpointer self)
{
	graphs_style_page_on_factory_setup ((GraphsStylePage*) self, object);
}

static void
_graphs_style_page_on_factory_bind_gtk_signal_list_item_factory_bind (GtkSignalListItemFactory* _sender,
                                                                      GObject* object,
                                                                      gpointer self)
{
	graphs_style_page_on_factory_bind ((GraphsStylePage*) self, object);
}

GraphsStylePage*
graphs_style_page_construct (GType object_type,
                             GraphsWindow* window)
{
	GraphsStylePage * self = NULL;
	GraphsWindow* _tmp0_;
	GtkSignalListItemFactory* factory = NULL;
	GtkSignalListItemFactory* _tmp1_;
	GtkGridView* _tmp2_;
	GtkGridView* _tmp3_;
	GraphsData* _tmp4_;
	GraphsData* _tmp5_;
	GtkSingleSelection* _tmp6_;
	GtkSingleSelection* _tmp7_;
	g_return_val_if_fail (window != NULL, NULL);
	self = (GraphsStylePage*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (window);
	_g_object_unref0 (self->priv->window);
	self->priv->window = _tmp0_;
	_tmp1_ = (GtkSignalListItemFactory*) gtk_signal_list_item_factory_new ();
	factory = _tmp1_;
	g_signal_connect_object (factory, "setup", (GCallback) _graphs_style_page_on_factory_setup_gtk_signal_list_item_factory_setup, self, 0);
	g_signal_connect_object (factory, "bind", (GCallback) _graphs_style_page_on_factory_bind_gtk_signal_list_item_factory_bind, self, 0);
	_tmp2_ = self->priv->_style_grid;
	gtk_grid_view_set_factory (_tmp2_, (GtkListItemFactory*) factory);
	_tmp3_ = self->priv->_style_grid;
	_tmp4_ = graphs_window_get_data (window);
	_tmp5_ = _tmp4_;
	_tmp6_ = graphs_data_get_style_selection_model (_tmp5_);
	_tmp7_ = _tmp6_;
	gtk_grid_view_set_model (_tmp3_, (GtkSelectionModel*) _tmp7_);
	_g_object_unref0 (factory);
	return self;
}

GraphsStylePage*
graphs_style_page_new (GraphsWindow* window)
{
	return graphs_style_page_construct (GRAPHS_TYPE_STYLE_PAGE, window);
}

static void
graphs_style_page_on_factory_setup (GraphsStylePage* self,
                                    GObject* object)
{
	GtkListItem* item = NULL;
	GtkListItem* _tmp0_;
	GraphsStylePreview* _tmp1_;
	GraphsStylePreview* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (object, gtk_list_item_get_type (), GtkListItem));
	item = _tmp0_;
	_tmp1_ = graphs_style_preview_new ();
	g_object_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	gtk_list_item_set_child (item, (GtkWidget*) _tmp2_);
	_g_object_unref0 (_tmp2_);
	_g_object_unref0 (item);
}

static void
graphs_style_page_on_factory_bind (GraphsStylePage* self,
                                   GObject* object)
{
	GtkListItem* item = NULL;
	GtkListItem* _tmp0_;
	GraphsStylePreview* preview = NULL;
	GtkWidget* _tmp1_;
	GraphsStylePreview* _tmp2_;
	GObject* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (object, gtk_list_item_get_type (), GtkListItem));
	item = _tmp0_;
	_tmp1_ = gtk_list_item_get_child (item);
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GRAPHS_TYPE_STYLE_PREVIEW, GraphsStylePreview));
	preview = _tmp2_;
	_tmp3_ = gtk_list_item_get_item (item);
	graphs_style_preview_set_style (preview, G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GRAPHS_TYPE_STYLE, GraphsStyle));
	_g_object_unref0 (preview);
	_g_object_unref0 (item);
}

static GtkGridView*
graphs_style_page_get_style_grid (GraphsStylePage* self)
{
	GtkGridView* result;
	GtkGridView* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_style_grid;
	result = _tmp0_;
	return result;
}

static void
graphs_style_page_class_init (GraphsStylePageClass * klass,
                              gpointer klass_data)
{
	graphs_style_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraphsStylePage_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_graphs_style_page_get_property;
	G_OBJECT_CLASS (klass)->finalize = graphs_style_page_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/se/sjoerd/Graphs/ui/sidebar/figure-settings/style-page.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "style_grid", FALSE, GraphsStylePage_private_offset + G_STRUCT_OFFSET (GraphsStylePagePrivate, _style_grid));
}

static void
graphs_style_page_instance_init (GraphsStylePage * self,
                                 gpointer klass)
{
	self->priv = graphs_style_page_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
graphs_style_page_finalize (GObject * obj)
{
	GraphsStylePage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_STYLE_PAGE, GraphsStylePage);
	_g_object_unref0 (self->priv->window);
	G_OBJECT_CLASS (graphs_style_page_parent_class)->finalize (obj);
}

static GType
graphs_style_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsStylePageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_style_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsStylePage), 0, (GInstanceInitFunc) graphs_style_page_instance_init, NULL };
	GType graphs_style_page_type_id;
	graphs_style_page_type_id = g_type_register_static (adw_navigation_page_get_type (), "GraphsStylePage", &g_define_type_info, 0);
	GraphsStylePage_private_offset = g_type_add_instance_private (graphs_style_page_type_id, sizeof (GraphsStylePagePrivate));
	return graphs_style_page_type_id;
}

GType
graphs_style_page_get_type (void)
{
	static volatile gsize graphs_style_page_type_id__once = 0;
	if (g_once_init_enter (&graphs_style_page_type_id__once)) {
		GType graphs_style_page_type_id;
		graphs_style_page_type_id = graphs_style_page_get_type_once ();
		g_once_init_leave (&graphs_style_page_type_id__once, graphs_style_page_type_id);
	}
	return graphs_style_page_type_id__once;
}

static void
_vala_graphs_style_page_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec)
{
	GraphsStylePage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_STYLE_PAGE, GraphsStylePage);
	switch (property_id) {
		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;
}

