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

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

#include "graphs.h"
#include <gtk/gtk.h>
#include <adwaita.h>
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.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_OPERATIONS_0_PROPERTY,
	GRAPHS_OPERATIONS_SHIFT_BUTTON_PROPERTY,
	GRAPHS_OPERATIONS_SMOOTHEN_BUTTON_PROPERTY,
	GRAPHS_OPERATIONS_TRANSLATE_X_ENTRY_PROPERTY,
	GRAPHS_OPERATIONS_TRANSLATE_Y_ENTRY_PROPERTY,
	GRAPHS_OPERATIONS_MULTIPLY_X_ENTRY_PROPERTY,
	GRAPHS_OPERATIONS_MULTIPLY_Y_ENTRY_PROPERTY,
	GRAPHS_OPERATIONS_TRANSLATE_X_BUTTON_PROPERTY,
	GRAPHS_OPERATIONS_TRANSLATE_Y_BUTTON_PROPERTY,
	GRAPHS_OPERATIONS_MULTIPLY_X_BUTTON_PROPERTY,
	GRAPHS_OPERATIONS_MULTIPLY_Y_BUTTON_PROPERTY,
	GRAPHS_OPERATIONS_NUM_PROPERTIES
};
static GParamSpec* graphs_operations_properties[GRAPHS_OPERATIONS_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block9Data Block9Data;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

struct _GraphsOperationsPrivate {
	GtkButton* _shift_button;
	AdwSplitButton* _smoothen_button;
	GtkButton* _cut_button;
	GtkEntry* _translate_x_entry;
	GtkEntry* _translate_y_entry;
	GtkEntry* _multiply_x_entry;
	GtkEntry* _multiply_y_entry;
	GtkButton* _translate_x_button;
	GtkButton* _translate_y_button;
	GtkButton* _multiply_x_button;
	GtkButton* _multiply_y_button;
	GraphsWindow* _window;
	gboolean entries_sensitive;
	gboolean cut_sensitive;
};

struct _Block9Data {
	int _ref_count_;
	GraphsOperations* self;
	GtkEntry* entry;
	GtkButton* button;
};

static gint GraphsOperations_private_offset;
static gpointer graphs_operations_parent_class = NULL;

static void graphs_operations_on_mode_change (GraphsOperations* self);
static void _graphs_operations_on_mode_change_g_object_notify (GObject* _sender,
                                                        GParamSpec* pspec,
                                                        gpointer self);
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
static void ____lambda9_ (Block9Data* _data9_);
static void graphs_operations_validate_entry (GraphsOperations* self,
                                       GtkEntry* entry,
                                       GtkButton* button);
static void _____lambda9__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void ____lambda10_ (Block9Data* _data9_);
static void _____lambda10__g_object_notify (GObject* _sender,
                                     GParamSpec* pspec,
                                     gpointer self);
static void graphs_operations_perform_operation (GraphsOperations* self,
                                          GtkButton* button);
static void _graphs_operations_perform_operation_gtk_button_clicked (GtkButton* _sender,
                                                              gpointer self);
static GtkButton* graphs_operations_get_cut_button (GraphsOperations* self);
static void graphs_operations_finalize (GObject * obj);
static GType graphs_operations_get_type_once (void);
static void _vala_graphs_operations_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_operations_get_instance_private (GraphsOperations* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsOperations_private_offset);
}

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

static void
_graphs_operations_on_mode_change_g_object_notify (GObject* _sender,
                                                   GParamSpec* pspec,
                                                   gpointer self)
{
	graphs_operations_on_mode_change ((GraphsOperations*) self);
}

static Block9Data*
block9_data_ref (Block9Data* _data9_)
{
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}

static void
block9_data_unref (void * _userdata_)
{
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		GraphsOperations* self;
		self = _data9_->self;
		_g_object_unref0 (_data9_->button);
		_g_object_unref0 (_data9_->entry);
		_g_object_unref0 (self);
		g_slice_free (Block9Data, _data9_);
	}
}

static void
____lambda9_ (Block9Data* _data9_)
{
	GraphsOperations* self;
	GtkEntry* _tmp0_;
	GtkButton* _tmp1_;
	self = _data9_->self;
	_tmp0_ = _data9_->entry;
	_tmp1_ = _data9_->button;
	graphs_operations_validate_entry (self, _tmp0_, _tmp1_);
}

static void
_____lambda9__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	____lambda9_ (self);
}

static void
____lambda10_ (Block9Data* _data9_)
{
	GraphsOperations* self;
	GtkEntry* _tmp0_;
	GtkButton* _tmp1_;
	self = _data9_->self;
	_tmp0_ = _data9_->entry;
	_tmp1_ = _data9_->button;
	graphs_operations_validate_entry (self, _tmp0_, _tmp1_);
}

static void
_____lambda10__g_object_notify (GObject* _sender,
                                GParamSpec* pspec,
                                gpointer self)
{
	____lambda10_ (self);
}

GraphsOperations*
graphs_operations_construct (GType object_type,
                             GraphsWindow* window)
{
	GraphsOperations * self = NULL;
	GraphsWindow* _tmp0_;
	gchar** action_names = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar** _tmp5_;
	gint action_names_length1;
	gint _action_names_size_;
	gchar** _tmp6_;
	gint _tmp6__length1;
	g_return_val_if_fail (window != NULL, NULL);
	self = (GraphsOperations*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (window);
	_g_object_unref0 (self->priv->_window);
	self->priv->_window = _tmp0_;
	g_signal_connect_object ((GObject*) window, "notify::mode", (GCallback) _graphs_operations_on_mode_change_g_object_notify, self, 0);
	_tmp1_ = g_strdup ("multiply_x");
	_tmp2_ = g_strdup ("multiply_y");
	_tmp3_ = g_strdup ("translate_x");
	_tmp4_ = g_strdup ("translate_y");
	_tmp5_ = g_new0 (gchar*, 4 + 1);
	_tmp5_[0] = _tmp1_;
	_tmp5_[1] = _tmp2_;
	_tmp5_[2] = _tmp3_;
	_tmp5_[3] = _tmp4_;
	action_names = _tmp5_;
	action_names_length1 = 4;
	_action_names_size_ = action_names_length1;
	_tmp6_ = action_names;
	_tmp6__length1 = action_names_length1;
	{
		gchar** action_name_collection = NULL;
		gint action_name_collection_length1 = 0;
		gint _action_name_collection_size_ = 0;
		gint action_name_it = 0;
		action_name_collection = _tmp6_;
		action_name_collection_length1 = _tmp6__length1;
		for (action_name_it = 0; action_name_it < action_name_collection_length1; action_name_it = action_name_it + 1) {
			gchar* _tmp7_;
			gchar* action_name = NULL;
			_tmp7_ = g_strdup (action_name_collection[action_name_it]);
			action_name = _tmp7_;
			{
				Block9Data* _data9_;
				const gchar* _tmp8_;
				gchar* _tmp9_;
				gchar* _tmp10_;
				GtkEntry* _tmp11_ = NULL;
				const gchar* _tmp12_;
				gchar* _tmp13_;
				gchar* _tmp14_;
				GtkButton* _tmp15_ = NULL;
				GtkEntry* _tmp16_;
				GraphsWindow* _tmp17_;
				GraphsData* _tmp18_;
				GraphsData* _tmp19_;
				GtkEntry* _tmp20_;
				GtkButton* _tmp21_;
				_data9_ = g_slice_new0 (Block9Data);
				_data9_->_ref_count_ = 1;
				_data9_->self = g_object_ref (self);
				_tmp8_ = action_name;
				_tmp9_ = g_strconcat (_tmp8_, "_entry", NULL);
				_tmp10_ = _tmp9_;
				g_object_get ((GObject*) self, _tmp10_, &_tmp11_, NULL);
				_g_object_unref0 (_data9_->entry);
				_data9_->entry = _tmp11_;
				_g_free0 (_tmp10_);
				_tmp12_ = action_name;
				_tmp13_ = g_strconcat (_tmp12_, "_button", NULL);
				_tmp14_ = _tmp13_;
				g_object_get ((GObject*) self, _tmp14_, &_tmp15_, NULL);
				_g_object_unref0 (_data9_->button);
				_data9_->button = _tmp15_;
				_g_free0 (_tmp14_);
				_tmp16_ = _data9_->entry;
				g_signal_connect_data ((GObject*) _tmp16_, "notify::text", (GCallback) _____lambda9__g_object_notify, block9_data_ref (_data9_), (GClosureNotify) block9_data_unref, 0);
				_tmp17_ = self->priv->_window;
				_tmp18_ = graphs_window_get_data (_tmp17_);
				_tmp19_ = _tmp18_;
				g_signal_connect_data ((GObject*) _tmp19_, "notify::items-selected", (GCallback) _____lambda10__g_object_notify, block9_data_ref (_data9_), (GClosureNotify) block9_data_unref, 0);
				_tmp20_ = _data9_->entry;
				_tmp21_ = _data9_->button;
				graphs_operations_validate_entry (self, _tmp20_, _tmp21_);
				_g_free0 (action_name);
				block9_data_unref (_data9_);
				_data9_ = NULL;
			}
		}
	}
	action_names = (_vala_array_free (action_names, action_names_length1, (GDestroyNotify) g_free), NULL);
	return self;
}

GraphsOperations*
graphs_operations_new (GraphsWindow* window)
{
	return graphs_operations_construct (GRAPHS_TYPE_OPERATIONS, window);
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static void
graphs_operations_perform_operation (GraphsOperations* self,
                                     GtkButton* button)
{
	GAction* action = NULL;
	GraphsWindow* _tmp0_;
	GAction* _tmp1_;
	GAction* _tmp2_;
	gchar* name = NULL;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	GVariant* _tmp5_;
	GVariant* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = self->priv->_window;
	_tmp1_ = g_action_map_lookup_action ((GActionMap*) _tmp0_, "perform_operation");
	_tmp2_ = _g_object_ref0 (_tmp1_);
	action = _tmp2_;
	_tmp3_ = gtk_buildable_get_buildable_id ((GtkBuildable*) button);
	_tmp4_ = string_slice (_tmp3_, (glong) 0, (glong) -7);
	name = _tmp4_;
	_tmp5_ = g_variant_new_string (name);
	g_variant_ref_sink (_tmp5_);
	_tmp6_ = _tmp5_;
	g_action_activate (action, _tmp6_);
	_g_variant_unref0 (_tmp6_);
	_g_free0 (name);
	_g_object_unref0 (action);
}

static void
_graphs_operations_perform_operation_gtk_button_clicked (GtkButton* _sender,
                                                         gpointer self)
{
	graphs_operations_perform_operation ((GraphsOperations*) self, _sender);
}

void
graphs_operations_set_entry_sensitivity (GraphsOperations* self,
                                         gboolean entries_sensitive)
{
	GtkEntry* _tmp0_;
	GtkButton* _tmp1_;
	GtkEntry* _tmp2_;
	GtkButton* _tmp3_;
	GtkEntry* _tmp4_;
	GtkButton* _tmp5_;
	GtkEntry* _tmp6_;
	GtkButton* _tmp7_;
	g_return_if_fail (self != NULL);
	self->priv->entries_sensitive = entries_sensitive;
	_tmp0_ = self->priv->_translate_x_entry;
	_tmp1_ = self->priv->_translate_x_button;
	graphs_operations_validate_entry (self, _tmp0_, _tmp1_);
	_tmp2_ = self->priv->_translate_y_entry;
	_tmp3_ = self->priv->_translate_y_button;
	graphs_operations_validate_entry (self, _tmp2_, _tmp3_);
	_tmp4_ = self->priv->_multiply_x_entry;
	_tmp5_ = self->priv->_multiply_x_button;
	graphs_operations_validate_entry (self, _tmp4_, _tmp5_);
	_tmp6_ = self->priv->_multiply_y_entry;
	_tmp7_ = self->priv->_multiply_y_button;
	graphs_operations_validate_entry (self, _tmp6_, _tmp7_);
}

void
graphs_operations_set_cut_sensitivity (GraphsOperations* self,
                                       gboolean sensitive)
{
	g_return_if_fail (self != NULL);
	self->priv->cut_sensitive = sensitive;
	graphs_operations_on_mode_change (self);
}

static void
graphs_operations_on_mode_change (GraphsOperations* self)
{
	gboolean _tmp0_ = FALSE;
	GtkButton* _tmp4_;
	g_return_if_fail (self != NULL);
	if (self->priv->cut_sensitive) {
		GraphsWindow* _tmp1_;
		GraphsMode _tmp2_;
		GraphsMode _tmp3_;
		_tmp1_ = self->priv->_window;
		_tmp2_ = graphs_window_get_mode (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp0_ = _tmp3_ == 2;
	} else {
		_tmp0_ = FALSE;
	}
	_tmp4_ = self->priv->_cut_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp4_, _tmp0_);
}

static void
graphs_operations_validate_entry (GraphsOperations* self,
                                  GtkEntry* entry,
                                  GtkButton* button)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = gtk_editable_get_text ((GtkEditable*) entry);
	if (graphs_try_evaluate_string (_tmp0_, NULL, (gunichar) '.')) {
		gtk_widget_remove_css_class ((GtkWidget*) entry, "error");
		gtk_widget_set_sensitive ((GtkWidget*) button, self->priv->entries_sensitive);
	} else {
		gtk_widget_add_css_class ((GtkWidget*) entry, "error");
		gtk_widget_set_sensitive ((GtkWidget*) button, FALSE);
	}
}

GtkButton*
graphs_operations_get_shift_button (GraphsOperations* self)
{
	GtkButton* result;
	GtkButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_shift_button;
	result = _tmp0_;
	return result;
}

AdwSplitButton*
graphs_operations_get_smoothen_button (GraphsOperations* self)
{
	AdwSplitButton* result;
	AdwSplitButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_smoothen_button;
	result = _tmp0_;
	return result;
}

static GtkButton*
graphs_operations_get_cut_button (GraphsOperations* self)
{
	GtkButton* result;
	GtkButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_cut_button;
	result = _tmp0_;
	return result;
}

GtkEntry*
graphs_operations_get_translate_x_entry (GraphsOperations* self)
{
	GtkEntry* result;
	GtkEntry* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_translate_x_entry;
	result = _tmp0_;
	return result;
}

GtkEntry*
graphs_operations_get_translate_y_entry (GraphsOperations* self)
{
	GtkEntry* result;
	GtkEntry* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_translate_y_entry;
	result = _tmp0_;
	return result;
}

GtkEntry*
graphs_operations_get_multiply_x_entry (GraphsOperations* self)
{
	GtkEntry* result;
	GtkEntry* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_multiply_x_entry;
	result = _tmp0_;
	return result;
}

GtkEntry*
graphs_operations_get_multiply_y_entry (GraphsOperations* self)
{
	GtkEntry* result;
	GtkEntry* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_multiply_y_entry;
	result = _tmp0_;
	return result;
}

GtkButton*
graphs_operations_get_translate_x_button (GraphsOperations* self)
{
	GtkButton* result;
	GtkButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_translate_x_button;
	result = _tmp0_;
	return result;
}

GtkButton*
graphs_operations_get_translate_y_button (GraphsOperations* self)
{
	GtkButton* result;
	GtkButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_translate_y_button;
	result = _tmp0_;
	return result;
}

GtkButton*
graphs_operations_get_multiply_x_button (GraphsOperations* self)
{
	GtkButton* result;
	GtkButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_multiply_x_button;
	result = _tmp0_;
	return result;
}

GtkButton*
graphs_operations_get_multiply_y_button (GraphsOperations* self)
{
	GtkButton* result;
	GtkButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_multiply_y_button;
	result = _tmp0_;
	return result;
}

static void
graphs_operations_class_init (GraphsOperationsClass * klass,
                              gpointer klass_data)
{
	graphs_operations_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraphsOperations_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_graphs_operations_get_property;
	G_OBJECT_CLASS (klass)->finalize = graphs_operations_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_OPERATIONS_SHIFT_BUTTON_PROPERTY, graphs_operations_properties[GRAPHS_OPERATIONS_SHIFT_BUTTON_PROPERTY] = g_param_spec_object ("shift-button", "shift-button", "shift-button", gtk_button_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_OPERATIONS_SMOOTHEN_BUTTON_PROPERTY, graphs_operations_properties[GRAPHS_OPERATIONS_SMOOTHEN_BUTTON_PROPERTY] = g_param_spec_object ("smoothen-button", "smoothen-button", "smoothen-button", adw_split_button_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_OPERATIONS_TRANSLATE_X_ENTRY_PROPERTY, graphs_operations_properties[GRAPHS_OPERATIONS_TRANSLATE_X_ENTRY_PROPERTY] = g_param_spec_object ("translate-x-entry", "translate-x-entry", "translate-x-entry", gtk_entry_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_OPERATIONS_TRANSLATE_Y_ENTRY_PROPERTY, graphs_operations_properties[GRAPHS_OPERATIONS_TRANSLATE_Y_ENTRY_PROPERTY] = g_param_spec_object ("translate-y-entry", "translate-y-entry", "translate-y-entry", gtk_entry_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_OPERATIONS_MULTIPLY_X_ENTRY_PROPERTY, graphs_operations_properties[GRAPHS_OPERATIONS_MULTIPLY_X_ENTRY_PROPERTY] = g_param_spec_object ("multiply-x-entry", "multiply-x-entry", "multiply-x-entry", gtk_entry_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_OPERATIONS_MULTIPLY_Y_ENTRY_PROPERTY, graphs_operations_properties[GRAPHS_OPERATIONS_MULTIPLY_Y_ENTRY_PROPERTY] = g_param_spec_object ("multiply-y-entry", "multiply-y-entry", "multiply-y-entry", gtk_entry_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_OPERATIONS_TRANSLATE_X_BUTTON_PROPERTY, graphs_operations_properties[GRAPHS_OPERATIONS_TRANSLATE_X_BUTTON_PROPERTY] = g_param_spec_object ("translate-x-button", "translate-x-button", "translate-x-button", gtk_button_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_OPERATIONS_TRANSLATE_Y_BUTTON_PROPERTY, graphs_operations_properties[GRAPHS_OPERATIONS_TRANSLATE_Y_BUTTON_PROPERTY] = g_param_spec_object ("translate-y-button", "translate-y-button", "translate-y-button", gtk_button_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_OPERATIONS_MULTIPLY_X_BUTTON_PROPERTY, graphs_operations_properties[GRAPHS_OPERATIONS_MULTIPLY_X_BUTTON_PROPERTY] = g_param_spec_object ("multiply-x-button", "multiply-x-button", "multiply-x-button", gtk_button_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_OPERATIONS_MULTIPLY_Y_BUTTON_PROPERTY, graphs_operations_properties[GRAPHS_OPERATIONS_MULTIPLY_Y_BUTTON_PROPERTY] = g_param_spec_object ("multiply-y-button", "multiply-y-button", "multiply-y-button", gtk_button_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/operations.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "shift_button", FALSE, GraphsOperations_private_offset + G_STRUCT_OFFSET (GraphsOperationsPrivate, _shift_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "smoothen_button", FALSE, GraphsOperations_private_offset + G_STRUCT_OFFSET (GraphsOperationsPrivate, _smoothen_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "cut_button", FALSE, GraphsOperations_private_offset + G_STRUCT_OFFSET (GraphsOperationsPrivate, _cut_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "translate_x_entry", FALSE, GraphsOperations_private_offset + G_STRUCT_OFFSET (GraphsOperationsPrivate, _translate_x_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "translate_y_entry", FALSE, GraphsOperations_private_offset + G_STRUCT_OFFSET (GraphsOperationsPrivate, _translate_y_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "multiply_x_entry", FALSE, GraphsOperations_private_offset + G_STRUCT_OFFSET (GraphsOperationsPrivate, _multiply_x_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "multiply_y_entry", FALSE, GraphsOperations_private_offset + G_STRUCT_OFFSET (GraphsOperationsPrivate, _multiply_y_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "translate_x_button", FALSE, GraphsOperations_private_offset + G_STRUCT_OFFSET (GraphsOperationsPrivate, _translate_x_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "translate_y_button", FALSE, GraphsOperations_private_offset + G_STRUCT_OFFSET (GraphsOperationsPrivate, _translate_y_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "multiply_x_button", FALSE, GraphsOperations_private_offset + G_STRUCT_OFFSET (GraphsOperationsPrivate, _multiply_x_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "multiply_y_button", FALSE, GraphsOperations_private_offset + G_STRUCT_OFFSET (GraphsOperationsPrivate, _multiply_y_button));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "perform_operation", G_CALLBACK(_graphs_operations_perform_operation_gtk_button_clicked));
}

static void
graphs_operations_instance_init (GraphsOperations * self,
                                 gpointer klass)
{
	self->priv = graphs_operations_get_instance_private (self);
	self->priv->entries_sensitive = FALSE;
	self->priv->cut_sensitive = FALSE;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
graphs_operations_finalize (GObject * obj)
{
	GraphsOperations * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_OPERATIONS, GraphsOperations);
	_g_object_unref0 (self->priv->_window);
	G_OBJECT_CLASS (graphs_operations_parent_class)->finalize (obj);
}

static GType
graphs_operations_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsOperationsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_operations_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsOperations), 0, (GInstanceInitFunc) graphs_operations_instance_init, NULL };
	GType graphs_operations_type_id;
	graphs_operations_type_id = g_type_register_static (gtk_box_get_type (), "GraphsOperations", &g_define_type_info, 0);
	GraphsOperations_private_offset = g_type_add_instance_private (graphs_operations_type_id, sizeof (GraphsOperationsPrivate));
	return graphs_operations_type_id;
}

GType
graphs_operations_get_type (void)
{
	static volatile gsize graphs_operations_type_id__once = 0;
	if (g_once_init_enter (&graphs_operations_type_id__once)) {
		GType graphs_operations_type_id;
		graphs_operations_type_id = graphs_operations_get_type_once ();
		g_once_init_leave (&graphs_operations_type_id__once, graphs_operations_type_id);
	}
	return graphs_operations_type_id__once;
}

static void
_vala_graphs_operations_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec)
{
	GraphsOperations * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_OPERATIONS, GraphsOperations);
	switch (property_id) {
		case GRAPHS_OPERATIONS_SHIFT_BUTTON_PROPERTY:
		g_value_set_object (value, graphs_operations_get_shift_button (self));
		break;
		case GRAPHS_OPERATIONS_SMOOTHEN_BUTTON_PROPERTY:
		g_value_set_object (value, graphs_operations_get_smoothen_button (self));
		break;
		case GRAPHS_OPERATIONS_TRANSLATE_X_ENTRY_PROPERTY:
		g_value_set_object (value, graphs_operations_get_translate_x_entry (self));
		break;
		case GRAPHS_OPERATIONS_TRANSLATE_Y_ENTRY_PROPERTY:
		g_value_set_object (value, graphs_operations_get_translate_y_entry (self));
		break;
		case GRAPHS_OPERATIONS_MULTIPLY_X_ENTRY_PROPERTY:
		g_value_set_object (value, graphs_operations_get_multiply_x_entry (self));
		break;
		case GRAPHS_OPERATIONS_MULTIPLY_Y_ENTRY_PROPERTY:
		g_value_set_object (value, graphs_operations_get_multiply_y_entry (self));
		break;
		case GRAPHS_OPERATIONS_TRANSLATE_X_BUTTON_PROPERTY:
		g_value_set_object (value, graphs_operations_get_translate_x_button (self));
		break;
		case GRAPHS_OPERATIONS_TRANSLATE_Y_BUTTON_PROPERTY:
		g_value_set_object (value, graphs_operations_get_translate_y_button (self));
		break;
		case GRAPHS_OPERATIONS_MULTIPLY_X_BUTTON_PROPERTY:
		g_value_set_object (value, graphs_operations_get_multiply_x_button (self));
		break;
		case GRAPHS_OPERATIONS_MULTIPLY_Y_BUTTON_PROPERTY:
		g_value_set_object (value, graphs_operations_get_multiply_y_button (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

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

