/* math-function-popover.c generated by valac 0.56.0, the Vala compiler
 * generated from math-function-popover.vala, do not modify */

/*
 * Copyright (C) 2013 Garima Joshi
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
 * license.
 */

#include <glib-object.h>
#include <gobject/gvaluecollector.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include "calculator.h"
#include <gio/gio.h>
#include <float.h>
#include <math.h>

#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_SOMETHING (something_get_type ())
#define SOMETHING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SOMETHING, Something))
#define SOMETHING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SOMETHING, SomethingClass))
#define IS_SOMETHING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SOMETHING))
#define IS_SOMETHING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SOMETHING))
#define SOMETHING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SOMETHING, SomethingClass))

typedef struct _Something Something;
typedef struct _SomethingClass SomethingClass;
typedef struct _SomethingPrivate SomethingPrivate;
typedef struct _ParamSpecSomething ParamSpecSomething;

#define TYPE_MATH_POPOVER (math_popover_get_type ())
#define MATH_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MATH_POPOVER, MathPopover))
#define MATH_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MATH_POPOVER, MathPopoverClass))
#define IS_MATH_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MATH_POPOVER))
#define IS_MATH_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MATH_POPOVER))
#define MATH_POPOVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MATH_POPOVER, MathPopoverClass))

typedef struct _MathPopover MathPopover;
typedef struct _MathPopoverClass MathPopoverClass;
typedef struct _MathPopoverPrivate MathPopoverPrivate;

#define TYPE_MATH_FUNCTION_POPOVER (math_function_popover_get_type ())
#define MATH_FUNCTION_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MATH_FUNCTION_POPOVER, MathFunctionPopover))
#define MATH_FUNCTION_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MATH_FUNCTION_POPOVER, MathFunctionPopoverClass))
#define IS_MATH_FUNCTION_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MATH_FUNCTION_POPOVER))
#define IS_MATH_FUNCTION_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MATH_FUNCTION_POPOVER))
#define MATH_FUNCTION_POPOVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MATH_FUNCTION_POPOVER, MathFunctionPopoverClass))

typedef struct _MathFunctionPopover MathFunctionPopover;
typedef struct _MathFunctionPopoverClass MathFunctionPopoverClass;
typedef struct _MathFunctionPopoverPrivate MathFunctionPopoverPrivate;
enum  {
	MATH_FUNCTION_POPOVER_0_PROPERTY,
	MATH_FUNCTION_POPOVER_NUM_PROPERTIES
};
static GParamSpec* math_function_popover_properties[MATH_FUNCTION_POPOVER_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)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

struct _Something {
	GTypeInstance parent_instance;
	volatile int ref_count;
	SomethingPrivate * priv;
};

struct _SomethingClass {
	GTypeClass parent_class;
	void (*finalize) (Something *self);
};

struct _ParamSpecSomething {
	GParamSpec parent_instance;
};

struct _MathPopover {
	GtkPopover parent_instance;
	MathPopoverPrivate * priv;
	MathEquation* equation;
	GListStore* model;
};

struct _MathPopoverClass {
	GtkPopoverClass parent_class;
	gint (*get_item_index) (MathPopover* self, gconstpointer item);
	gboolean (*is_deletable) (MathPopover* self, gconstpointer item);
	gboolean (*is_editable) (MathPopover* self, gconstpointer item);
	gchar* (*get_item_text) (MathPopover* self, gconstpointer item);
};

struct _MathFunctionPopover {
	MathPopover parent_instance;
	MathFunctionPopoverPrivate * priv;
};

struct _MathFunctionPopoverClass {
	MathPopoverClass parent_class;
};

struct _MathFunctionPopoverPrivate {
	GtkListBox* function_list;
	GtkEntry* function_name_entry;
	gboolean function_name_entry_placeholder_reseted;
	GtkButton* add_function_button;
	GtkSpinButton* add_arguments_button;
};

static gpointer something_parent_class = NULL;
static gint MathFunctionPopover_private_offset;
static gpointer math_function_popover_parent_class = NULL;
static gchar** math_function_popover_FUNCTION_ARGS;
static gint math_function_popover_FUNCTION_ARGS_length1;
static gchar** math_function_popover_FUNCTION_ARGS = NULL;
static gint math_function_popover_FUNCTION_ARGS_length1 = 0;
static gint _math_function_popover_FUNCTION_ARGS_size_ = 0;

VALA_EXTERN gpointer something_ref (gpointer instance);
VALA_EXTERN void something_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_something (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
VALA_EXTERN void value_set_something (GValue* value,
                          gpointer v_object);
VALA_EXTERN void value_take_something (GValue* value,
                           gpointer v_object);
VALA_EXTERN gpointer value_get_something (const GValue* value);
VALA_EXTERN GType something_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Something, something_unref)
VALA_EXTERN Something* something_new (void);
VALA_EXTERN Something* something_construct (GType object_type);
static void something_finalize (Something * obj);
static GType something_get_type_once (void);
VALA_EXTERN GType math_popover_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MathPopover, g_object_unref)
VALA_EXTERN GType math_function_popover_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MathFunctionPopover, g_object_unref)
VALA_EXTERN gboolean math_popover_is_deletable (MathPopover* self,
                                    gconstpointer item);
VALA_EXTERN gboolean math_popover_is_editable (MathPopover* self,
                                   gconstpointer item);
VALA_EXTERN gchar* math_popover_get_item_text (MathPopover* self,
                                   gconstpointer item);
VALA_EXTERN gint math_popover_get_item_index (MathPopover* self,
                                  gconstpointer item);
VALA_EXTERN MathFunctionPopover* math_function_popover_new (MathEquation* equation,
                                                GListStore* model);
VALA_EXTERN MathFunctionPopover* math_function_popover_construct (GType object_type,
                                                      MathEquation* equation,
                                                      GListStore* model);
static gint __lambda28_ (MathFunctionPopover* self,
                  gconstpointer a,
                  gconstpointer b);
static gint ___lambda28__gcompare_data_func (gconstpointer a,
                                      gconstpointer b,
                                      gpointer self);
VALA_EXTERN MathPopover* math_popover_construct (GType object_type,
                                     GType t_type,
                                     GBoxedCopyFunc t_dup_func,
                                     GDestroyNotify t_destroy_func,
                                     MathEquation* equation,
                                     GListStore* model,
                                     GCompareDataFunc compare_func,
                                     gpointer compare_func_target);
static GtkWidget* __lambda29_ (MathFunctionPopover* self,
                        GObject* item);
VALA_EXTERN GtkWidget* math_popover_make_item_row (MathPopover* self,
                                       gconstpointer item);
static GtkWidget* ___lambda29__gtk_list_box_create_widget_func (GObject* item,
                                                         gpointer self);
static void math_function_popover_function_edited_cb (MathFunctionPopover* self,
                                               MathFunction* function);
static void _math_function_popover_function_edited_cb_math_popover_item_edited (MathPopover* _sender,
                                                                         gconstpointer item,
                                                                         gpointer self);
static void math_function_popover_function_deleted_cb (MathFunctionPopover* self,
                                                MathFunction* function);
static void _math_function_popover_function_deleted_cb_math_popover_item_deleted (MathPopover* _sender,
                                                                           gconstpointer item,
                                                                           gpointer self);
static void math_function_popover_insert_function_cb (MathFunctionPopover* self,
                                               GtkListBoxRow* row);
static void _math_function_popover_insert_function_cb_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                           GtkListBoxRow* row,
                                                                           gpointer self);
static void math_function_popover_function_name_entry_changed_cb (MathFunctionPopover* self,
                                                           GtkEditable* editable);
static void _math_function_popover_function_name_entry_changed_cb_gtk_editable_changed (GtkEditable* _sender,
                                                                                 gpointer self);
static void math_function_popover_add_function_cb (MathFunctionPopover* self,
                                            GtkWidget* widget);
static void _math_function_popover_add_function_cb_gtk_button_clicked (GtkButton* _sender,
                                                                gpointer self);
static gboolean math_function_popover_real_is_deletable (MathPopover* base,
                                                  MathFunction* function);
static gboolean math_function_popover_real_is_editable (MathPopover* base,
                                                 MathFunction* function);
static gchar* math_function_popover_real_get_item_text (MathPopover* base,
                                                 MathFunction* function);
static gint math_function_popover_real_get_item_index (MathPopover* base,
                                                MathFunction* item);
static gboolean __lambda30_ (GObject* a,
                      GObject* b);
static gboolean ___lambda30__gequal_func (gconstpointer a,
                                   gconstpointer b);
static void math_function_popover_finalize (GObject * obj);
static GType math_function_popover_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

Something*
something_construct (GType object_type)
{
	Something* self = NULL;
	self = (Something*) g_type_create_instance (object_type);
	return self;
}

Something*
something_new (void)
{
	return something_construct (TYPE_SOMETHING);
}

static void
value_something_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
value_something_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		something_unref (value->data[0].v_pointer);
	}
}

static void
value_something_copy_value (const GValue* src_value,
                            GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = something_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
value_something_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
value_something_collect_value (GValue* value,
                               guint n_collect_values,
                               GTypeCValue* collect_values,
                               guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		Something * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = something_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
value_something_lcopy_value (const GValue* value,
                             guint n_collect_values,
                             GTypeCValue* collect_values,
                             guint collect_flags)
{
	Something ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = something_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
param_spec_something (const gchar* name,
                      const gchar* nick,
                      const gchar* blurb,
                      GType object_type,
                      GParamFlags flags)
{
	ParamSpecSomething* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_SOMETHING), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
value_get_something (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SOMETHING), NULL);
	return value->data[0].v_pointer;
}

void
value_set_something (GValue* value,
                     gpointer v_object)
{
	Something * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SOMETHING));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SOMETHING));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		something_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		something_unref (old);
	}
}

void
value_take_something (GValue* value,
                      gpointer v_object)
{
	Something * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SOMETHING));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SOMETHING));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		something_unref (old);
	}
}

static void
something_class_init (SomethingClass * klass,
                      gpointer klass_data)
{
	something_parent_class = g_type_class_peek_parent (klass);
	((SomethingClass *) klass)->finalize = something_finalize;
}

static void
something_instance_init (Something * self,
                         gpointer klass)
{
	self->ref_count = 1;
}

static void
something_finalize (Something * obj)
{
	Something * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SOMETHING, Something);
	g_signal_handlers_destroy (self);
}

static GType
something_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_something_init, value_something_free_value, value_something_copy_value, value_something_peek_pointer, "p", value_something_collect_value, "p", value_something_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (SomethingClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) something_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Something), 0, (GInstanceInitFunc) something_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType something_type_id;
	something_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Something", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return something_type_id;
}

GType
something_get_type (void)
{
	static volatile gsize something_type_id__once = 0;
	if (g_once_init_enter (&something_type_id__once)) {
		GType something_type_id;
		something_type_id = something_get_type_once ();
		g_once_init_leave (&something_type_id__once, something_type_id);
	}
	return something_type_id__once;
}

gpointer
something_ref (gpointer instance)
{
	Something * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
something_unref (gpointer instance)
{
	Something * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		SOMETHING_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
math_function_popover_get_instance_private (MathFunctionPopover* self)
{
	return G_STRUCT_MEMBER_P (self, MathFunctionPopover_private_offset);
}

static gint
__lambda28_ (MathFunctionPopover* self,
             gconstpointer a,
             gconstpointer b)
{
	gint result;
	result = math_function_name_compare_func (G_TYPE_CHECK_INSTANCE_TYPE (a, TYPE_MATH_FUNCTION) ? ((MathFunction*) a) : NULL, G_TYPE_CHECK_INSTANCE_TYPE (b, TYPE_MATH_FUNCTION) ? ((MathFunction*) b) : NULL);
	return result;
}

static gint
___lambda28__gcompare_data_func (gconstpointer a,
                                 gconstpointer b,
                                 gpointer self)
{
	gint result;
	result = __lambda28_ ((MathFunctionPopover*) self, a, b);
	return result;
}

static GtkWidget*
__lambda29_ (MathFunctionPopover* self,
             GObject* item)
{
	GtkWidget* _tmp0_;
	GtkWidget* result;
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = math_popover_make_item_row ((MathPopover*) self, G_TYPE_CHECK_INSTANCE_TYPE (item, TYPE_MATH_FUNCTION) ? ((MathFunction*) item) : NULL);
	result = _tmp0_;
	return result;
}

static GtkWidget*
___lambda29__gtk_list_box_create_widget_func (GObject* item,
                                              gpointer self)
{
	GtkWidget* result;
	result = __lambda29_ ((MathFunctionPopover*) self, item);
	return result;
}

static void
_math_function_popover_function_edited_cb_math_popover_item_edited (MathPopover* _sender,
                                                                    gconstpointer item,
                                                                    gpointer self)
{
	math_function_popover_function_edited_cb ((MathFunctionPopover*) self, (MathFunction*) item);
}

static void
_math_function_popover_function_deleted_cb_math_popover_item_deleted (MathPopover* _sender,
                                                                      gconstpointer item,
                                                                      gpointer self)
{
	math_function_popover_function_deleted_cb ((MathFunctionPopover*) self, (MathFunction*) item);
}

MathFunctionPopover*
math_function_popover_construct (GType object_type,
                                 MathEquation* equation,
                                 GListStore* model)
{
	MathFunctionPopover * self = NULL;
	GtkListBox* _tmp0_;
	GtkSpinButton* _tmp1_;
	GtkSpinButton* _tmp2_;
	g_return_val_if_fail (equation != NULL, NULL);
	g_return_val_if_fail (model != NULL, NULL);
	self = (MathFunctionPopover*) math_popover_construct (object_type, TYPE_MATH_FUNCTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, equation, model, ___lambda28__gcompare_data_func, self);
	_tmp0_ = self->priv->function_list;
	gtk_list_box_bind_model (_tmp0_, (GListModel*) model, ___lambda29__gtk_list_box_create_widget_func, g_object_ref (self), g_object_unref);
	_tmp1_ = self->priv->add_arguments_button;
	gtk_spin_button_set_range (_tmp1_, (gdouble) 1, (gdouble) 10);
	_tmp2_ = self->priv->add_arguments_button;
	gtk_spin_button_set_increments (_tmp2_, (gdouble) 1, (gdouble) 1);
	g_signal_connect_object ((MathPopover*) self, "item-edited", (GCallback) _math_function_popover_function_edited_cb_math_popover_item_edited, self, 0);
	g_signal_connect_object ((MathPopover*) self, "item-deleted", (GCallback) _math_function_popover_function_deleted_cb_math_popover_item_deleted, self, 0);
	return self;
}

MathFunctionPopover*
math_function_popover_new (MathEquation* equation,
                           GListStore* model)
{
	return math_function_popover_construct (TYPE_MATH_FUNCTION_POPOVER, equation, model);
}

static gchar*
_vala_g_strjoinv (const gchar* separator,
                  gchar** str_array,
                  gint str_array_length1)
{
	gboolean _tmp0_ = FALSE;
	gchar* result;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp16_;
		gint _tmp17_;
		const gchar* res = NULL;
		void* _tmp18_;
		const gchar* _tmp19_ = NULL;
		const gchar* _tmp20_;
		void* ptr = NULL;
		const gchar* _tmp22_;
		void* _tmp23_;
		const gchar* _tmp33_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					_tmp7_ = i < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp8_ = FALSE;
					if (str_array_length1 == -1) {
						const gchar* _tmp9_;
						_tmp9_ = str_array[i];
						_tmp8_ = _tmp9_ != NULL;
					} else {
						_tmp8_ = FALSE;
					}
					_tmp6_ = _tmp8_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp11_ = str_array[i];
				if (_tmp11_ != NULL) {
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = str_array[i];
					_tmp13_ = strlen ((const gchar*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp10_ = _tmp14_;
				} else {
					_tmp10_ = 0;
				}
				len += (gsize) _tmp10_;
			}
		}
		if (i == 0) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("");
			result = _tmp15_;
			return result;
		}
		str_array_length1 = i;
		_tmp16_ = strlen ((const gchar*) separator);
		_tmp17_ = _tmp16_;
		len += (gsize) (_tmp17_ * (i - 1));
		_tmp18_ = g_malloc (len);
		res = _tmp18_;
		_tmp20_ = str_array[0];
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = str_array[0];
			_tmp19_ = (const gchar*) _tmp21_;
		} else {
			_tmp19_ = "";
		}
		_tmp22_ = res;
		_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_);
		ptr = _tmp23_;
		{
			gboolean _tmp24_ = FALSE;
			i = 1;
			_tmp24_ = TRUE;
			while (TRUE) {
				void* _tmp26_;
				void* _tmp27_;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				void* _tmp31_;
				void* _tmp32_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				if (!(i < str_array_length1)) {
					break;
				}
				_tmp26_ = ptr;
				_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator);
				ptr = _tmp27_;
				_tmp29_ = str_array[i];
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_;
					_tmp30_ = str_array[i];
					_tmp28_ = (const gchar*) _tmp30_;
				} else {
					_tmp28_ = "";
				}
				_tmp31_ = ptr;
				_tmp32_ = g_stpcpy (_tmp31_, _tmp28_);
				ptr = _tmp32_;
			}
		}
		_tmp33_ = res;
		res = NULL;
		result = (gchar*) _tmp33_;
		return result;
	} else {
		gchar* _tmp34_;
		_tmp34_ = g_strdup ("");
		result = _tmp34_;
		return result;
	}
}

static void
math_function_popover_function_edited_cb (MathFunctionPopover* self,
                                          MathFunction* function)
{
	gchar* function_to_edit = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gint _tmp3_ = 0;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	MathEquation* _tmp13_;
	MathEquation* _tmp14_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (function != NULL);
	_tmp0_ = math_function_get_name (function);
	_tmp1_ = _tmp0_;
	_tmp2_ = math_function_get_arguments (function, &_tmp3_);
	_tmp2__length1 = _tmp3_;
	_tmp4_ = _tmp2_;
	_tmp4__length1 = _tmp2__length1;
	_tmp5_ = _vala_g_strjoinv (";", _tmp4_, (gint) _tmp4__length1);
	_tmp6_ = _tmp5_;
	_tmp7_ = math_function_get_expression (function);
	_tmp8_ = _tmp7_;
	_tmp9_ = math_function_get_description (function);
	_tmp10_ = _tmp9_;
	_tmp11_ = g_strdup_printf ("%s(%s)=%s@%s", _tmp1_, _tmp6_, _tmp8_, _tmp10_);
	_tmp12_ = _tmp11_;
	_g_free0 (_tmp6_);
	function_to_edit = _tmp12_;
	_tmp13_ = ((MathPopover*) self)->equation;
	math_equation_clear (_tmp13_);
	_tmp14_ = ((MathPopover*) self)->equation;
	math_equation_insert (_tmp14_, function_to_edit);
	_g_free0 (function_to_edit);
}

static void
math_function_popover_function_deleted_cb (MathFunctionPopover* self,
                                           MathFunction* function)
{
	FunctionManager* function_manager = NULL;
	FunctionManager* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (function != NULL);
	_tmp0_ = function_manager_get_default_function_manager ();
	function_manager = _tmp0_;
	_tmp1_ = math_function_get_name (function);
	_tmp2_ = _tmp1_;
	function_manager_delete (function_manager, _tmp2_);
	_g_object_unref0 (function_manager);
}

static void
math_function_popover_insert_function_cb (MathFunctionPopover* self,
                                          GtkListBoxRow* row)
{
	MathFunction* function = NULL;
	GListStore* _tmp0_;
	GObject* _tmp1_;
	MathFunction* _tmp2_;
	MathEquation* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GtkTextIter end = {0};
	MathEquation* _tmp8_;
	MathEquation* _tmp9_;
	GtkTextMark* _tmp10_;
	GtkTextIter _tmp11_ = {0};
	MathEquation* _tmp12_;
	GtkTextIter _tmp13_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (row != NULL);
	_tmp0_ = ((MathPopover*) self)->model;
	_tmp1_ = g_list_model_get_item ((GListModel*) _tmp0_, (guint) gtk_list_box_row_get_index (row));
	_tmp2_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, TYPE_MATH_FUNCTION) ? ((MathFunction*) _tmp1_) : NULL;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (_tmp1_);
	}
	function = _tmp2_;
	_tmp3_ = ((MathPopover*) self)->equation;
	_tmp4_ = math_function_get_name (function);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strconcat (_tmp5_, "()", NULL);
	_tmp7_ = _tmp6_;
	math_equation_insert (_tmp3_, _tmp7_);
	_g_free0 (_tmp7_);
	_tmp8_ = ((MathPopover*) self)->equation;
	_tmp9_ = ((MathPopover*) self)->equation;
	_tmp10_ = gtk_text_buffer_get_insert ((GtkTextBuffer*) _tmp9_);
	gtk_text_buffer_get_iter_at_mark ((GtkTextBuffer*) _tmp8_, &_tmp11_, _tmp10_);
	end = _tmp11_;
	gtk_text_iter_backward_chars (&end, 1);
	_tmp12_ = ((MathPopover*) self)->equation;
	_tmp13_ = end;
	gtk_text_buffer_place_cursor ((GtkTextBuffer*) _tmp12_, &_tmp13_);
	_g_object_unref0 (function);
}

static void
_math_function_popover_insert_function_cb_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                      GtkListBoxRow* row,
                                                                      gpointer self)
{
	math_function_popover_insert_function_cb ((MathFunctionPopover*) self, row);
}

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

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
math_function_popover_function_name_entry_changed_cb (MathFunctionPopover* self,
                                                      GtkEditable* editable)
{
	GtkEntry* entry = NULL;
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GtkButton* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (editable != NULL);
	self->priv->function_name_entry_placeholder_reseted = TRUE;
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (editable, gtk_entry_get_type ()) ? ((GtkEntry*) editable) : NULL);
	entry = _tmp0_;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) entry);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_replace (_tmp2_, " ", "_");
	_tmp4_ = _tmp3_;
	gtk_editable_set_text ((GtkEditable*) entry, _tmp4_);
	_g_free0 (_tmp4_);
	_tmp5_ = self->priv->add_function_button;
	_tmp6_ = gtk_editable_get_text ((GtkEditable*) entry);
	_tmp7_ = _tmp6_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp5_, g_strcmp0 (_tmp7_, "") != 0);
	_g_object_unref0 (entry);
}

static void
_math_function_popover_function_name_entry_changed_cb_gtk_editable_changed (GtkEditable* _sender,
                                                                            gpointer self)
{
	math_function_popover_function_name_entry_changed_cb ((MathFunctionPopover*) self, _sender);
}

static void
math_function_popover_add_function_cb (MathFunctionPopover* self,
                                       GtkWidget* widget)
{
	gchar* name = NULL;
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gint arguments = 0;
	GtkSpinButton* _tmp5_;
	gchar* formatted_args = NULL;
	gchar* _tmp6_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	MathEquation* _tmp14_;
	MathEquation* _tmp15_;
	const gchar* _tmp16_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->priv->function_name_entry;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	name = _tmp3_;
	_tmp4_ = name;
	if (g_strcmp0 (_tmp4_, "") == 0) {
		_g_free0 (name);
		return;
	}
	_tmp5_ = self->priv->add_arguments_button;
	arguments = gtk_spin_button_get_value_as_int (_tmp5_);
	_tmp6_ = g_strdup ("");
	formatted_args = _tmp6_;
	if (arguments > 0) {
		gchar** _tmp7_;
		gint _tmp7__length1;
		gchar* _tmp8_;
		_tmp7_ = math_function_popover_FUNCTION_ARGS;
		_tmp7__length1 = math_function_popover_FUNCTION_ARGS_length1;
		_tmp8_ = _vala_g_strjoinv ("; ", _tmp7_ + 0, (gint) (arguments - 0));
		_g_free0 (formatted_args);
		formatted_args = _tmp8_;
	}
	_tmp9_ = name;
	_tmp10_ = formatted_args;
	_tmp11_ = g_strdup_printf ("(%s)=", _tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = g_strconcat (_tmp9_, _tmp12_, NULL);
	_g_free0 (name);
	name = _tmp13_;
	_g_free0 (_tmp12_);
	_tmp14_ = ((MathPopover*) self)->equation;
	math_equation_clear (_tmp14_);
	_tmp15_ = ((MathPopover*) self)->equation;
	_tmp16_ = name;
	math_equation_insert (_tmp15_, _tmp16_);
	_g_free0 (formatted_args);
	_g_free0 (name);
}

static void
_math_function_popover_add_function_cb_gtk_button_clicked (GtkButton* _sender,
                                                           gpointer self)
{
	math_function_popover_add_function_cb ((MathFunctionPopover*) self, _sender);
}

static gboolean
math_function_popover_real_is_deletable (MathPopover* base,
                                         MathFunction* function)
{
	MathFunctionPopover * self;
	gboolean result;
	self = (MathFunctionPopover*) base;
	g_return_val_if_fail (function != NULL, FALSE);
	result = math_function_is_custom_function (function);
	return result;
}

static gboolean
math_function_popover_real_is_editable (MathPopover* base,
                                        MathFunction* function)
{
	MathFunctionPopover * self;
	gboolean result;
	self = (MathFunctionPopover*) base;
	g_return_val_if_fail (function != NULL, FALSE);
	result = math_function_is_custom_function (function);
	return result;
}

static gchar*
math_function_popover_real_get_item_text (MathPopover* base,
                                          MathFunction* function)
{
	MathFunctionPopover * self;
	gchar* expression = NULL;
	gchar* _tmp0_;
	gchar* text = NULL;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* result;
	self = (MathFunctionPopover*) base;
	g_return_val_if_fail (function != NULL, NULL);
	_tmp0_ = g_strdup ("(x)");
	expression = _tmp0_;
	if (math_function_is_custom_function (function)) {
		gchar** _tmp1_;
		gint _tmp1__length1;
		gint _tmp2_ = 0;
		gchar** _tmp3_;
		gint _tmp3__length1;
		gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp1_ = math_function_get_arguments (function, &_tmp2_);
		_tmp1__length1 = _tmp2_;
		_tmp3_ = _tmp1_;
		_tmp3__length1 = _tmp1__length1;
		_tmp4_ = _vala_g_strjoinv (";", _tmp3_, (gint) _tmp3__length1);
		_tmp5_ = _tmp4_;
		_tmp6_ = g_strdup_printf ("(%s)", _tmp5_);
		_g_free0 (expression);
		expression = _tmp6_;
		_g_free0 (_tmp5_);
	}
	_tmp7_ = math_function_get_name (function);
	_tmp8_ = _tmp7_;
	_tmp9_ = expression;
	_tmp10_ = g_strdup_printf ("<b>%s</b>%s", _tmp8_, _tmp9_);
	text = _tmp10_;
	result = text;
	_g_free0 (expression);
	return result;
}

static gboolean
__lambda30_ (GObject* a,
             GObject* b)
{
	gboolean result;
	g_return_val_if_fail (a != NULL, FALSE);
	g_return_val_if_fail (b != NULL, FALSE);
	result = math_function_name_equal_func (G_TYPE_CHECK_INSTANCE_TYPE (a, TYPE_MATH_FUNCTION) ? ((MathFunction*) a) : NULL, G_TYPE_CHECK_INSTANCE_TYPE (b, TYPE_MATH_FUNCTION) ? ((MathFunction*) b) : NULL);
	return result;
}

static gboolean
___lambda30__gequal_func (gconstpointer a,
                          gconstpointer b)
{
	gboolean result;
	result = __lambda30_ ((GObject*) a, (GObject*) b);
	return result;
}

static gint
math_function_popover_real_get_item_index (MathPopover* base,
                                           MathFunction* item)
{
	MathFunctionPopover * self;
	guint position = 0U;
	GListStore* _tmp0_;
	guint _tmp1_ = 0U;
	gboolean _tmp2_;
	gint result;
	self = (MathFunctionPopover*) base;
	g_return_val_if_fail (item != NULL, 0);
	_tmp0_ = ((MathPopover*) self)->model;
	_tmp2_ = g_list_store_find_with_equal_func (_tmp0_, G_TYPE_CHECK_INSTANCE_TYPE (item, G_TYPE_OBJECT) ? ((GObject*) item) : NULL, ___lambda30__gequal_func, &_tmp1_);
	position = _tmp1_;
	if (_tmp2_) {
		result = (gint) position;
		return result;
	} else {
		result = -1;
		return result;
	}
}

static void
math_function_popover_class_init (MathFunctionPopoverClass * klass,
                                  gpointer klass_data)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar** _tmp10_;
	math_function_popover_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MathFunctionPopover_private_offset);
	((MathPopoverClass *) klass)->is_deletable = (gboolean (*) (MathPopover*, gconstpointer)) math_function_popover_real_is_deletable;
	((MathPopoverClass *) klass)->is_editable = (gboolean (*) (MathPopover*, gconstpointer)) math_function_popover_real_is_editable;
	((MathPopoverClass *) klass)->get_item_text = (gchar* (*) (MathPopover*, gconstpointer)) math_function_popover_real_get_item_text;
	((MathPopoverClass *) klass)->get_item_index = (gint (*) (MathPopover*, gconstpointer)) math_function_popover_real_get_item_index;
	G_OBJECT_CLASS (klass)->finalize = math_function_popover_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/calculator/math-function-popover.ui");
	_tmp0_ = g_strdup ("x");
	_tmp1_ = g_strdup ("y");
	_tmp2_ = g_strdup ("z");
	_tmp3_ = g_strdup ("u");
	_tmp4_ = g_strdup ("v");
	_tmp5_ = g_strdup ("w");
	_tmp6_ = g_strdup ("a");
	_tmp7_ = g_strdup ("b");
	_tmp8_ = g_strdup ("c");
	_tmp9_ = g_strdup ("d");
	_tmp10_ = g_new0 (gchar*, 10 + 1);
	_tmp10_[0] = _tmp0_;
	_tmp10_[1] = _tmp1_;
	_tmp10_[2] = _tmp2_;
	_tmp10_[3] = _tmp3_;
	_tmp10_[4] = _tmp4_;
	_tmp10_[5] = _tmp5_;
	_tmp10_[6] = _tmp6_;
	_tmp10_[7] = _tmp7_;
	_tmp10_[8] = _tmp8_;
	_tmp10_[9] = _tmp9_;
	math_function_popover_FUNCTION_ARGS = _tmp10_;
	math_function_popover_FUNCTION_ARGS_length1 = 10;
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "function_list", FALSE, MathFunctionPopover_private_offset + G_STRUCT_OFFSET (MathFunctionPopoverPrivate, function_list));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "function_name_entry", FALSE, MathFunctionPopover_private_offset + G_STRUCT_OFFSET (MathFunctionPopoverPrivate, function_name_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "add_function_button", FALSE, MathFunctionPopover_private_offset + G_STRUCT_OFFSET (MathFunctionPopoverPrivate, add_function_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "add_arguments_button", FALSE, MathFunctionPopover_private_offset + G_STRUCT_OFFSET (MathFunctionPopoverPrivate, add_arguments_button));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "insert_function_cb", G_CALLBACK(_math_function_popover_insert_function_cb_gtk_list_box_row_activated));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "function_name_entry_changed_cb", G_CALLBACK(_math_function_popover_function_name_entry_changed_cb_gtk_editable_changed));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "add_function_cb", G_CALLBACK(_math_function_popover_add_function_cb_gtk_button_clicked));
}

static void
math_function_popover_instance_init (MathFunctionPopover * self,
                                     gpointer klass)
{
	self->priv = math_function_popover_get_instance_private (self);
	self->priv->function_name_entry_placeholder_reseted = FALSE;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
math_function_popover_finalize (GObject * obj)
{
	MathFunctionPopover * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MATH_FUNCTION_POPOVER, MathFunctionPopover);
	G_OBJECT_CLASS (math_function_popover_parent_class)->finalize (obj);
}

static GType
math_function_popover_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MathFunctionPopoverClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) math_function_popover_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MathFunctionPopover), 0, (GInstanceInitFunc) math_function_popover_instance_init, NULL };
	GType math_function_popover_type_id;
	math_function_popover_type_id = g_type_register_static (TYPE_MATH_POPOVER, "MathFunctionPopover", &g_define_type_info, 0);
	MathFunctionPopover_private_offset = g_type_add_instance_private (math_function_popover_type_id, sizeof (MathFunctionPopoverPrivate));
	return math_function_popover_type_id;
}

GType
math_function_popover_get_type (void)
{
	static volatile gsize math_function_popover_type_id__once = 0;
	if (g_once_init_enter (&math_function_popover_type_id__once)) {
		GType math_function_popover_type_id;
		math_function_popover_type_id = math_function_popover_get_type_once ();
		g_once_init_leave (&math_function_popover_type_id__once, math_function_popover_type_id);
	}
	return math_function_popover_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;
}

