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

/* SPDX-License-Identifier: GPL-3.0-or-later*/
/* Python Helper - Vala Part*/

#include "graphs.h"
#include <glib.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <glib-object.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_PYTHON_HELPER_0_PROPERTY,
	GRAPHS_PYTHON_HELPER_NUM_PROPERTIES
};
static GParamSpec* graphs_python_helper_properties[GRAPHS_PYTHON_HELPER_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	GRAPHS_PYTHON_HELPER_CREATE_STYLE_EDITOR_REQUEST_SIGNAL,
	GRAPHS_PYTHON_HELPER_CREATE_WINDOW_REQUEST_SIGNAL,
	GRAPHS_PYTHON_HELPER_CURVE_FITTING_DIALOG_REQUEST_SIGNAL,
	GRAPHS_PYTHON_HELPER_EQUATION_TO_DATA_REQUEST_SIGNAL,
	GRAPHS_PYTHON_HELPER_EVALUATE_EXPRESSION_REQUEST_SIGNAL,
	GRAPHS_PYTHON_HELPER_EXPORT_ITEMS_REQUEST_SIGNAL,
	GRAPHS_PYTHON_HELPER_EXPORT_FIGURE_REQUEST_SIGNAL,
	GRAPHS_PYTHON_HELPER_PERFORM_OPERATION_REQUEST_SIGNAL,
	GRAPHS_PYTHON_HELPER_PYTHON_METHOD_REQUEST_SIGNAL,
	GRAPHS_PYTHON_HELPER_SIMPLIFY_EQUATION_REQUEST_SIGNAL,
	GRAPHS_PYTHON_HELPER_VALIDATE_EQUATION_REQUEST_SIGNAL,
	GRAPHS_PYTHON_HELPER_NUM_SIGNALS
};
static guint graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_NUM_SIGNALS] = {0};

static gpointer graphs_python_helper_parent_class = NULL;
static GraphsPythonHelper* graphs_python_helper_instance;
static GraphsPythonHelper* graphs_python_helper_instance = NULL;
static gdouble* graphs_python_helper__evaluate_expression_result;
static gint graphs_python_helper__evaluate_expression_result_length1;
static gdouble* graphs_python_helper__evaluate_expression_result = NULL;
static gint graphs_python_helper__evaluate_expression_result_length1 = 0;
static gint _graphs_python_helper__evaluate_expression_result_size_ = 0;

static gdouble* _vala_array_dup31 (gdouble* self,
                            gssize length);
static void g_cclosure_user_marshal_OBJECT__VOID (GClosure * closure,
                                           GValue * return_value,
                                           guint n_param_values,
                                           const GValue * param_values,
                                           gpointer invocation_hint,
                                           gpointer marshal_data);
static void g_cclosure_user_marshal_OBJECT__OBJECT_OBJECT (GClosure * closure,
                                                    GValue * return_value,
                                                    guint n_param_values,
                                                    const GValue * param_values,
                                                    gpointer invocation_hint,
                                                    gpointer marshal_data);
static void g_cclosure_user_marshal_OBJECT__STRING_DOUBLE_DOUBLE_INT_ENUM (GClosure * closure,
                                                                    GValue * return_value,
                                                                    guint n_param_values,
                                                                    const GValue * param_values,
                                                                    gpointer invocation_hint,
                                                                    gpointer marshal_data);
static void g_cclosure_user_marshal_BOOLEAN__STRING_INT_STRING (GClosure * closure,
                                                         GValue * return_value,
                                                         guint n_param_values,
                                                         const GValue * param_values,
                                                         gpointer invocation_hint,
                                                         gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_STRING_OBJECT_POINTER_INT (GClosure * closure,
                                                                     GValue * return_value,
                                                                     guint n_param_values,
                                                                     const GValue * param_values,
                                                                     gpointer invocation_hint,
                                                                     gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT_OBJECT (GClosure * closure,
                                                         GValue * return_value,
                                                         guint n_param_values,
                                                         const GValue * param_values,
                                                         gpointer invocation_hint,
                                                         gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_STRING (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static void g_cclosure_user_marshal_STRING__STRING (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data);
static void g_cclosure_user_marshal_BOOLEAN__STRING (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data);
static GObject * graphs_python_helper_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties);
static void graphs_python_helper_finalize (GObject * obj);
static GType graphs_python_helper_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

GraphsStyleEditor*
graphs_python_helper_create_style_editor (void)
{
	GraphsPythonHelper* _tmp0_;
	GraphsStyleEditor* _tmp1_ = NULL;
	GraphsStyleEditor* result;
	_tmp0_ = graphs_python_helper_instance;
	g_signal_emit (_tmp0_, graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_CREATE_STYLE_EDITOR_REQUEST_SIGNAL], 0, &_tmp1_);
	result = _tmp1_;
	return result;
}

GraphsWindow*
graphs_python_helper_create_window (void)
{
	GraphsPythonHelper* _tmp0_;
	GraphsWindow* _tmp1_ = NULL;
	GraphsWindow* result;
	_tmp0_ = graphs_python_helper_instance;
	g_signal_emit (_tmp0_, graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_CREATE_WINDOW_REQUEST_SIGNAL], 0, &_tmp1_);
	result = _tmp1_;
	return result;
}

GraphsCurveFittingDialog*
graphs_python_helper_create_curve_fitting_dialog (GraphsWindow* window,
                                                  GraphsItem* item)
{
	GraphsPythonHelper* _tmp0_;
	GraphsCurveFittingDialog* _tmp1_ = NULL;
	GraphsCurveFittingDialog* result;
	g_return_val_if_fail (window != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = graphs_python_helper_instance;
	g_signal_emit (_tmp0_, graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_CURVE_FITTING_DIALOG_REQUEST_SIGNAL], 0, window, item, &_tmp1_);
	result = _tmp1_;
	return result;
}

GraphsDataHolder*
graphs_python_helper_equation_to_data (const gchar* equation,
                                       gdouble xstart,
                                       gdouble xstop,
                                       gint steps,
                                       GraphsScale scale)
{
	GraphsPythonHelper* _tmp0_;
	GraphsDataHolder* _tmp1_ = NULL;
	GraphsDataHolder* result;
	g_return_val_if_fail (equation != NULL, NULL);
	_tmp0_ = graphs_python_helper_instance;
	g_signal_emit (_tmp0_, graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_EQUATION_TO_DATA_REQUEST_SIGNAL], 0, equation, xstart, xstop, steps, scale, &_tmp1_);
	result = _tmp1_;
	return result;
}

static gdouble*
_vala_array_dup31 (gdouble* self,
                   gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (gdouble));
	}
	return NULL;
}

void
graphs_python_helper_set_evaluate_expression_result (gdouble* _result_,
                                                     gint _result__length1)
{
	gdouble* _tmp0_;
	gint _tmp0__length1;
	_tmp0_ = (_result_ != NULL) ? _vala_array_dup31 (_result_, _result__length1) : _result_;
	_tmp0__length1 = _result__length1;
	graphs_python_helper__evaluate_expression_result = (g_free (graphs_python_helper__evaluate_expression_result), NULL);
	graphs_python_helper__evaluate_expression_result = _tmp0_;
	graphs_python_helper__evaluate_expression_result_length1 = _tmp0__length1;
	_graphs_python_helper__evaluate_expression_result_size_ = graphs_python_helper__evaluate_expression_result_length1;
}

gdouble*
graphs_python_helper_evaluate_expression (const gchar* equation,
                                          gint steps,
                                          const gchar* variable,
                                          gint* result_length1,
                                          GError** error)
{
	GraphsPythonHelper* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gdouble* _tmp3_;
	gint _tmp3__length1;
	gdouble* _tmp4_;
	gint _tmp4__length1;
	GError* _inner_error0_ = NULL;
	gdouble* result;
	g_return_val_if_fail (equation != NULL, NULL);
	g_return_val_if_fail (variable != NULL, NULL);
	_tmp0_ = graphs_python_helper_instance;
	g_signal_emit (_tmp0_, graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_EVALUATE_EXPRESSION_REQUEST_SIGNAL], 0, equation, steps, variable, &_tmp1_);
	if (!_tmp1_) {
		GError* _tmp2_;
		_tmp2_ = g_error_new_literal (GRAPHS_MATH_ERROR, GRAPHS_MATH_ERROR_SYNTAX, "invalid equation");
		_inner_error0_ = _tmp2_;
		if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		} else {
			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;
		}
	}
	_tmp3_ = graphs_python_helper__evaluate_expression_result;
	_tmp3__length1 = graphs_python_helper__evaluate_expression_result_length1;
	graphs_python_helper__evaluate_expression_result = NULL;
	graphs_python_helper__evaluate_expression_result_length1 = 0;
	_tmp4_ = _tmp3_;
	_tmp4__length1 = _tmp3__length1;
	if (result_length1) {
		*result_length1 = _tmp4__length1;
	}
	result = _tmp4_;
	return result;
}

void
graphs_python_helper_export_items (GraphsWindow* window,
                                   const gchar* mode,
                                   GFile* file,
                                   GraphsItem** items,
                                   gint items_length1)
{
	GraphsPythonHelper* _tmp0_;
	g_return_if_fail (window != NULL);
	g_return_if_fail (mode != NULL);
	g_return_if_fail (file != NULL);
	_tmp0_ = graphs_python_helper_instance;
	g_signal_emit (_tmp0_, graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_EXPORT_ITEMS_REQUEST_SIGNAL], 0, window, mode, file, items, (gint) items_length1);
	graphs_window_add_toast_string_with_file (window, _ ("Exported Data"), file);
}

void
graphs_python_helper_export_figure (GFile* file,
                                    GSettings* settings,
                                    GraphsData* data)
{
	GraphsPythonHelper* _tmp0_;
	g_return_if_fail (file != NULL);
	g_return_if_fail (settings != NULL);
	g_return_if_fail (data != NULL);
	_tmp0_ = graphs_python_helper_instance;
	g_signal_emit (_tmp0_, graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_EXPORT_FIGURE_REQUEST_SIGNAL], 0, file, settings, data);
}

void
graphs_python_helper_perform_operation (GraphsWindow* window,
                                        const gchar* name)
{
	GraphsPythonHelper* _tmp0_;
	g_return_if_fail (window != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = graphs_python_helper_instance;
	g_signal_emit (_tmp0_, graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_PERFORM_OPERATION_REQUEST_SIGNAL], 0, window, name);
}

void
graphs_python_helper_run_method (GObject* object,
                                 const gchar* method)
{
	GraphsPythonHelper* _tmp0_;
	g_return_if_fail (object != NULL);
	g_return_if_fail (method != NULL);
	_tmp0_ = graphs_python_helper_instance;
	g_signal_emit (_tmp0_, graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_PYTHON_METHOD_REQUEST_SIGNAL], 0, object, method);
}

gchar*
graphs_python_helper_simplify_equation (const gchar* input)
{
	GraphsPythonHelper* _tmp0_;
	gchar* _tmp1_ = NULL;
	gchar* result;
	g_return_val_if_fail (input != NULL, NULL);
	_tmp0_ = graphs_python_helper_instance;
	g_signal_emit (_tmp0_, graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_SIMPLIFY_EQUATION_REQUEST_SIGNAL], 0, input, &_tmp1_);
	result = _tmp1_;
	return result;
}

gboolean
graphs_python_helper_validate_equation (const gchar* input)
{
	gboolean _tmp5_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (input != NULL, FALSE);
	{
		gchar* _tmp0_ = NULL;
		gchar* _tmp1_;
		GraphsPythonHelper* _tmp3_;
		gboolean _tmp4_ = FALSE;
		_tmp1_ = graphs_preprocess_equation (input, &_inner_error0_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp2_ = FALSE;
			if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
				goto __catch0_graphs_math_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp2_;
		}
		_tmp3_ = graphs_python_helper_instance;
		g_signal_emit (_tmp3_, graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_VALIDATE_EQUATION_REQUEST_SIGNAL], 0, _tmp0_, &_tmp4_);
		result = _tmp4_;
		_g_free0 (_tmp0_);
		return result;
	}
	goto __finally0;
	__catch0_graphs_math_error:
	{
		g_clear_error (&_inner_error0_);
		result = FALSE;
		return result;
	}
	__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 _tmp5_;
}

GraphsPythonHelper*
graphs_python_helper_construct (GType object_type)
{
	GraphsPythonHelper * self = NULL;
	self = (GraphsPythonHelper*) g_object_new (object_type, NULL);
	return self;
}

GraphsPythonHelper*
graphs_python_helper_new (void)
{
	return graphs_python_helper_construct (GRAPHS_TYPE_PYTHON_HELPER);
}

static void
g_cclosure_user_marshal_OBJECT__VOID (GClosure * closure,
                                      GValue * return_value,
                                      guint n_param_values,
                                      const GValue * param_values,
                                      gpointer invocation_hint,
                                      gpointer marshal_data)
{
	typedef gpointer (*GMarshalFunc_OBJECT__VOID) (gpointer data1, gpointer data2);
	register GMarshalFunc_OBJECT__VOID callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	gpointer v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 1);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_OBJECT__VOID) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, data2);
	g_value_take_object (return_value, v_return);
}

static void
g_cclosure_user_marshal_OBJECT__OBJECT_OBJECT (GClosure * closure,
                                               GValue * return_value,
                                               guint n_param_values,
                                               const GValue * param_values,
                                               gpointer invocation_hint,
                                               gpointer marshal_data)
{
	typedef gpointer (*GMarshalFunc_OBJECT__OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_OBJECT__OBJECT_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	gpointer v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_OBJECT__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, g_value_get_object (param_values + 1), g_value_get_object (param_values + 2), data2);
	g_value_take_object (return_value, v_return);
}

static void
g_cclosure_user_marshal_OBJECT__STRING_DOUBLE_DOUBLE_INT_ENUM (GClosure * closure,
                                                               GValue * return_value,
                                                               guint n_param_values,
                                                               const GValue * param_values,
                                                               gpointer invocation_hint,
                                                               gpointer marshal_data)
{
	typedef gpointer (*GMarshalFunc_OBJECT__STRING_DOUBLE_DOUBLE_INT_ENUM) (gpointer data1, const char* arg_1, gdouble arg_2, gdouble arg_3, gint arg_4, gint arg_5, gpointer data2);
	register GMarshalFunc_OBJECT__STRING_DOUBLE_DOUBLE_INT_ENUM callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	gpointer v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 6);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_OBJECT__STRING_DOUBLE_DOUBLE_INT_ENUM) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, g_value_get_string (param_values + 1), g_value_get_double (param_values + 2), g_value_get_double (param_values + 3), g_value_get_int (param_values + 4), g_value_get_enum (param_values + 5), data2);
	g_value_take_object (return_value, v_return);
}

static void
g_cclosure_user_marshal_BOOLEAN__STRING_INT_STRING (GClosure * closure,
                                                    GValue * return_value,
                                                    guint n_param_values,
                                                    const GValue * param_values,
                                                    gpointer invocation_hint,
                                                    gpointer marshal_data)
{
	typedef gboolean (*GMarshalFunc_BOOLEAN__STRING_INT_STRING) (gpointer data1, const char* arg_1, gint arg_2, const char* arg_3, gpointer data2);
	register GMarshalFunc_BOOLEAN__STRING_INT_STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	gboolean v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 4);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_BOOLEAN__STRING_INT_STRING) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, g_value_get_string (param_values + 1), g_value_get_int (param_values + 2), g_value_get_string (param_values + 3), data2);
	g_value_set_boolean (return_value, v_return);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_STRING_OBJECT_POINTER_INT (GClosure * closure,
                                                                GValue * return_value,
                                                                guint n_param_values,
                                                                const GValue * param_values,
                                                                gpointer invocation_hint,
                                                                gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_STRING_OBJECT_POINTER_INT) (gpointer data1, gpointer arg_1, const char* arg_2, gpointer arg_3, gpointer arg_4, gint arg_5, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_STRING_OBJECT_POINTER_INT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 6);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_STRING_OBJECT_POINTER_INT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_string (param_values + 2), g_value_get_object (param_values + 3), g_value_get_pointer (param_values + 4), g_value_get_int (param_values + 5), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_OBJECT_OBJECT (GClosure * closure,
                                                    GValue * return_value,
                                                    guint n_param_values,
                                                    const GValue * param_values,
                                                    gpointer invocation_hint,
                                                    gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer arg_3, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_OBJECT_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 4);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_object (param_values + 2), g_value_get_object (param_values + 3), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_STRING (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_STRING) (gpointer data1, gpointer arg_1, const char* arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_STRING) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_string (param_values + 2), data2);
}

static void
g_cclosure_user_marshal_STRING__STRING (GClosure * closure,
                                        GValue * return_value,
                                        guint n_param_values,
                                        const GValue * param_values,
                                        gpointer invocation_hint,
                                        gpointer marshal_data)
{
	typedef const char* (*GMarshalFunc_STRING__STRING) (gpointer data1, const char* arg_1, gpointer data2);
	register GMarshalFunc_STRING__STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	const char* v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 2);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_STRING__STRING) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, g_value_get_string (param_values + 1), data2);
	g_value_take_string (return_value, v_return);
}

static void
g_cclosure_user_marshal_BOOLEAN__STRING (GClosure * closure,
                                         GValue * return_value,
                                         guint n_param_values,
                                         const GValue * param_values,
                                         gpointer invocation_hint,
                                         gpointer marshal_data)
{
	typedef gboolean (*GMarshalFunc_BOOLEAN__STRING) (gpointer data1, const char* arg_1, gpointer data2);
	register GMarshalFunc_BOOLEAN__STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	gboolean v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 2);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_BOOLEAN__STRING) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, g_value_get_string (param_values + 1), data2);
	g_value_set_boolean (return_value, v_return);
}

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

static GObject *
graphs_python_helper_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GraphsPythonHelper * self;
	GraphsPythonHelper* _tmp0_;
	parent_class = G_OBJECT_CLASS (graphs_python_helper_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_PYTHON_HELPER, GraphsPythonHelper);
	_tmp0_ = _g_object_ref0 (self);
	_g_object_unref0 (graphs_python_helper_instance);
	graphs_python_helper_instance = _tmp0_;
	return obj;
}

static void
graphs_python_helper_class_init (GraphsPythonHelperClass * klass,
                                 gpointer klass_data)
{
	graphs_python_helper_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = graphs_python_helper_constructor;
	G_OBJECT_CLASS (klass)->finalize = graphs_python_helper_finalize;
	graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_CREATE_STYLE_EDITOR_REQUEST_SIGNAL] = g_signal_new ("create-style-editor-request", GRAPHS_TYPE_PYTHON_HELPER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_OBJECT__VOID, GRAPHS_TYPE_STYLE_EDITOR, 0);
	graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_CREATE_WINDOW_REQUEST_SIGNAL] = g_signal_new ("create-window-request", GRAPHS_TYPE_PYTHON_HELPER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_OBJECT__VOID, GRAPHS_TYPE_WINDOW, 0);
	graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_CURVE_FITTING_DIALOG_REQUEST_SIGNAL] = g_signal_new ("curve-fitting-dialog-request", GRAPHS_TYPE_PYTHON_HELPER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_OBJECT__OBJECT_OBJECT, GRAPHS_TYPE_CURVE_FITTING_DIALOG, 2, GRAPHS_TYPE_WINDOW, GRAPHS_TYPE_ITEM);
	graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_EQUATION_TO_DATA_REQUEST_SIGNAL] = g_signal_new ("equation-to-data-request", GRAPHS_TYPE_PYTHON_HELPER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_OBJECT__STRING_DOUBLE_DOUBLE_INT_ENUM, GRAPHS_TYPE_DATA_HOLDER, 5, G_TYPE_STRING, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_INT, GRAPHS_TYPE_SCALE);
	graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_EVALUATE_EXPRESSION_REQUEST_SIGNAL] = g_signal_new ("evaluate-expression-request", GRAPHS_TYPE_PYTHON_HELPER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_BOOLEAN__STRING_INT_STRING, G_TYPE_BOOLEAN, 3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING);
	graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_EXPORT_ITEMS_REQUEST_SIGNAL] = g_signal_new ("export-items-request", GRAPHS_TYPE_PYTHON_HELPER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_STRING_OBJECT_POINTER_INT, G_TYPE_NONE, 5, GRAPHS_TYPE_WINDOW, G_TYPE_STRING, g_file_get_type (), G_TYPE_POINTER, G_TYPE_INT);
	graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_EXPORT_FIGURE_REQUEST_SIGNAL] = g_signal_new ("export-figure-request", GRAPHS_TYPE_PYTHON_HELPER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT_OBJECT, G_TYPE_NONE, 3, g_file_get_type (), g_settings_get_type (), GRAPHS_TYPE_DATA);
	graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_PERFORM_OPERATION_REQUEST_SIGNAL] = g_signal_new ("perform-operation-request", GRAPHS_TYPE_PYTHON_HELPER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2, GRAPHS_TYPE_WINDOW, G_TYPE_STRING);
	graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_PYTHON_METHOD_REQUEST_SIGNAL] = g_signal_new ("python-method-request", GRAPHS_TYPE_PYTHON_HELPER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_STRING);
	graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_SIMPLIFY_EQUATION_REQUEST_SIGNAL] = g_signal_new ("simplify-equation-request", GRAPHS_TYPE_PYTHON_HELPER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_STRING__STRING, G_TYPE_STRING, 1, G_TYPE_STRING);
	graphs_python_helper_signals[GRAPHS_PYTHON_HELPER_VALIDATE_EQUATION_REQUEST_SIGNAL] = g_signal_new ("validate-equation-request", GRAPHS_TYPE_PYTHON_HELPER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_BOOLEAN__STRING, G_TYPE_BOOLEAN, 1, G_TYPE_STRING);
}

static void
graphs_python_helper_instance_init (GraphsPythonHelper * self,
                                    gpointer klass)
{
}

static void
graphs_python_helper_finalize (GObject * obj)
{
	GraphsPythonHelper * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_PYTHON_HELPER, GraphsPythonHelper);
	G_OBJECT_CLASS (graphs_python_helper_parent_class)->finalize (obj);
}

static GType
graphs_python_helper_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsPythonHelperClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_python_helper_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsPythonHelper), 0, (GInstanceInitFunc) graphs_python_helper_instance_init, NULL };
	GType graphs_python_helper_type_id;
	graphs_python_helper_type_id = g_type_register_static (G_TYPE_OBJECT, "GraphsPythonHelper", &g_define_type_info, 0);
	return graphs_python_helper_type_id;
}

GType
graphs_python_helper_get_type (void)
{
	static volatile gsize graphs_python_helper_type_id__once = 0;
	if (g_once_init_enter (&graphs_python_helper_type_id__once)) {
		GType graphs_python_helper_type_id;
		graphs_python_helper_type_id = graphs_python_helper_get_type_once ();
		g_once_init_leave (&graphs_python_helper_type_id__once, graphs_python_helper_type_id);
	}
	return graphs_python_helper_type_id__once;
}

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;
}

