/* math-preferences.c generated by valac 0.34.4, the Vala compiler
 * generated from math-preferences.vala, do not modify */

/*
 * Copyright (C) 2008-2012 Robert Ancell
 *
 * 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.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include "libcalculator.h"
#include <gdk/gdk.h>
#include <glib/gi18n-lib.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>


#define TYPE_MATH_PREFERENCES_DIALOG (math_preferences_dialog_get_type ())
#define MATH_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MATH_PREFERENCES_DIALOG, MathPreferencesDialog))
#define MATH_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MATH_PREFERENCES_DIALOG, MathPreferencesDialogClass))
#define IS_MATH_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MATH_PREFERENCES_DIALOG))
#define IS_MATH_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MATH_PREFERENCES_DIALOG))
#define MATH_PREFERENCES_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MATH_PREFERENCES_DIALOG, MathPreferencesDialogClass))

typedef struct _MathPreferencesDialog MathPreferencesDialog;
typedef struct _MathPreferencesDialogClass MathPreferencesDialogClass;
typedef struct _MathPreferencesDialogPrivate MathPreferencesDialogPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _MathPreferencesDialog {
	GtkDialog parent_instance;
	MathPreferencesDialogPrivate * priv;
};

struct _MathPreferencesDialogClass {
	GtkDialogClass parent_class;
};

struct _MathPreferencesDialogPrivate {
	MathEquation* _equation;
	GtkComboBox* angle_unit_combo;
	GtkComboBox* number_format_combo;
	GtkComboBox* word_size_combo;
	GtkSpinButton* decimal_places_spin;
	GtkCheckButton* thousands_separator_check;
	GtkCheckButton* trailing_zeroes_check;
};


static gpointer math_preferences_dialog_parent_class = NULL;

GType math_preferences_dialog_get_type (void) G_GNUC_CONST;
#define MATH_PREFERENCES_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MATH_PREFERENCES_DIALOG, MathPreferencesDialogPrivate))
enum  {
	MATH_PREFERENCES_DIALOG_DUMMY_PROPERTY,
	MATH_PREFERENCES_DIALOG_EQUATION
};
MathPreferencesDialog* math_preferences_dialog_new (MathEquation* eq);
MathPreferencesDialog* math_preferences_dialog_construct (GType object_type, MathEquation* eq);
static void math_preferences_dialog_real_response (GtkDialog* base, gint id);
static gboolean math_preferences_dialog_real_delete_event (GtkWidget* base, GdkEventAny* event);
static void math_preferences_dialog_number_format_combo_changed_cb (MathPreferencesDialog* self, GtkComboBox* combo);
static MathEquation* math_preferences_dialog_get_equation (MathPreferencesDialog* self);
static void math_preferences_dialog_angle_unit_combo_changed_cb (MathPreferencesDialog* self, GtkComboBox* combo);
static void math_preferences_dialog_word_size_combo_changed_cb (MathPreferencesDialog* self, GtkComboBox* combo);
static void math_preferences_dialog_set_combo_box_from_int (MathPreferencesDialog* self, GtkComboBox* combo, gint value);
static void math_preferences_dialog_set_equation (MathPreferencesDialog* self, MathEquation* value);
static GObject * math_preferences_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _math_preferences_dialog_number_format_combo_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self);
static void _math_preferences_dialog___lambda31_ (MathPreferencesDialog* self);
static void __math_preferences_dialog___lambda31__gtk_spin_button_value_changed (GtkSpinButton* _sender, gpointer self);
static void _math_preferences_dialog___lambda32_ (MathPreferencesDialog* self);
static void __math_preferences_dialog___lambda32__gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void _math_preferences_dialog___lambda33_ (MathPreferencesDialog* self);
static void __math_preferences_dialog___lambda33__gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void _math_preferences_dialog_angle_unit_combo_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self);
static void _math_preferences_dialog_word_size_combo_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self);
static void _math_preferences_dialog___lambda34_ (MathPreferencesDialog* self, GParamSpec* pspec);
static void __math_preferences_dialog___lambda34__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void _math_preferences_dialog___lambda35_ (MathPreferencesDialog* self);
static void __math_preferences_dialog___lambda35__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void _math_preferences_dialog___lambda36_ (MathPreferencesDialog* self);
static void __math_preferences_dialog___lambda36__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void _math_preferences_dialog___lambda37_ (MathPreferencesDialog* self, GParamSpec* pspec);
static void __math_preferences_dialog___lambda37__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void _math_preferences_dialog___lambda38_ (MathPreferencesDialog* self, GParamSpec* pspec);
static void __math_preferences_dialog___lambda38__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void _math_preferences_dialog___lambda39_ (MathPreferencesDialog* self, GParamSpec* pspec);
static void __math_preferences_dialog___lambda39__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void math_preferences_dialog_finalize (GObject* obj);
static void _vala_math_preferences_dialog_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_math_preferences_dialog_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);


MathPreferencesDialog* math_preferences_dialog_construct (GType object_type, MathEquation* eq) {
	MathPreferencesDialog * self = NULL;
	MathEquation* _tmp0_ = NULL;
	g_return_val_if_fail (eq != NULL, NULL);
	_tmp0_ = eq;
	self = (MathPreferencesDialog*) g_object_new (object_type, "use-header-bar", 1, "equation", _tmp0_, NULL);
	return self;
}


MathPreferencesDialog* math_preferences_dialog_new (MathEquation* eq) {
	return math_preferences_dialog_construct (TYPE_MATH_PREFERENCES_DIALOG, eq);
}


static void math_preferences_dialog_real_response (GtkDialog* base, gint id) {
	MathPreferencesDialog * self;
	self = (MathPreferencesDialog*) base;
	gtk_widget_hide ((GtkWidget*) self);
}


static gboolean math_preferences_dialog_real_delete_event (GtkWidget* base, GdkEventAny* event) {
	MathPreferencesDialog * self;
	gboolean result = FALSE;
	self = (MathPreferencesDialog*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	gtk_widget_hide ((GtkWidget*) self);
	result = TRUE;
	return result;
}


static void math_preferences_dialog_number_format_combo_changed_cb (MathPreferencesDialog* self, GtkComboBox* combo) {
	GtkTreeIter iter = {0};
	GtkComboBox* _tmp0_ = NULL;
	GtkTreeIter _tmp1_ = {0};
	DisplayFormat value = 0;
	GtkComboBox* _tmp2_ = NULL;
	GtkTreeModel* _tmp3_ = NULL;
	GtkTreeModel* _tmp4_ = NULL;
	GtkTreeIter _tmp5_ = {0};
	MathEquation* _tmp6_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (combo != NULL);
	_tmp0_ = combo;
	gtk_combo_box_get_active_iter (_tmp0_, &_tmp1_);
	iter = _tmp1_;
	_tmp2_ = combo;
	_tmp3_ = gtk_combo_box_get_model (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = iter;
	gtk_tree_model_get (_tmp4_, &_tmp5_, 1, &value, -1, -1);
	_tmp6_ = self->priv->_equation;
	math_equation_set_number_format (_tmp6_, value);
}


static void math_preferences_dialog_angle_unit_combo_changed_cb (MathPreferencesDialog* self, GtkComboBox* combo) {
	GtkTreeIter iter = {0};
	GtkComboBox* _tmp0_ = NULL;
	GtkTreeIter _tmp1_ = {0};
	AngleUnit value = 0;
	GtkComboBox* _tmp2_ = NULL;
	GtkTreeModel* _tmp3_ = NULL;
	GtkTreeModel* _tmp4_ = NULL;
	GtkTreeIter _tmp5_ = {0};
	MathEquation* _tmp6_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (combo != NULL);
	_tmp0_ = combo;
	gtk_combo_box_get_active_iter (_tmp0_, &_tmp1_);
	iter = _tmp1_;
	_tmp2_ = combo;
	_tmp3_ = gtk_combo_box_get_model (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = iter;
	gtk_tree_model_get (_tmp4_, &_tmp5_, 1, &value, -1, -1);
	_tmp6_ = self->priv->_equation;
	math_equation_set_angle_units (_tmp6_, value);
}


static void math_preferences_dialog_word_size_combo_changed_cb (MathPreferencesDialog* self, GtkComboBox* combo) {
	GtkTreeIter iter = {0};
	GtkComboBox* _tmp0_ = NULL;
	GtkTreeIter _tmp1_ = {0};
	gint value = 0;
	GtkComboBox* _tmp2_ = NULL;
	GtkTreeModel* _tmp3_ = NULL;
	GtkTreeModel* _tmp4_ = NULL;
	GtkTreeIter _tmp5_ = {0};
	MathEquation* _tmp6_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (combo != NULL);
	_tmp0_ = combo;
	gtk_combo_box_get_active_iter (_tmp0_, &_tmp1_);
	iter = _tmp1_;
	_tmp2_ = combo;
	_tmp3_ = gtk_combo_box_get_model (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = iter;
	gtk_tree_model_get (_tmp4_, &_tmp5_, 1, &value, -1, -1);
	_tmp6_ = self->priv->_equation;
	math_equation_set_word_size (_tmp6_, value);
}


static void math_preferences_dialog_set_combo_box_from_int (MathPreferencesDialog* self, GtkComboBox* combo, gint value) {
	GtkTreeIter iter = {0};
	gboolean valid = FALSE;
	GtkComboBox* _tmp0_ = NULL;
	GtkTreeModel* _tmp1_ = NULL;
	GtkTreeModel* _tmp2_ = NULL;
	GtkTreeIter _tmp3_ = {0};
	gboolean _tmp4_ = FALSE;
	gboolean _tmp16_ = FALSE;
	GtkComboBox* _tmp22_ = NULL;
	GtkTreeIter _tmp23_ = {0};
	g_return_if_fail (self != NULL);
	g_return_if_fail (combo != NULL);
	_tmp0_ = combo;
	_tmp1_ = gtk_combo_box_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp4_ = gtk_tree_model_get_iter_first (_tmp2_, &_tmp3_);
	iter = _tmp3_;
	valid = _tmp4_;
	while (TRUE) {
		gboolean _tmp5_ = FALSE;
		gint v = 0;
		GtkComboBox* _tmp6_ = NULL;
		GtkTreeModel* _tmp7_ = NULL;
		GtkTreeModel* _tmp8_ = NULL;
		GtkTreeIter _tmp9_ = {0};
		gint _tmp10_ = 0;
		gint _tmp11_ = 0;
		GtkComboBox* _tmp12_ = NULL;
		GtkTreeModel* _tmp13_ = NULL;
		GtkTreeModel* _tmp14_ = NULL;
		gboolean _tmp15_ = FALSE;
		_tmp5_ = valid;
		if (!_tmp5_) {
			break;
		}
		_tmp6_ = combo;
		_tmp7_ = gtk_combo_box_get_model (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = iter;
		gtk_tree_model_get (_tmp8_, &_tmp9_, 1, &v, -1, -1);
		_tmp10_ = v;
		_tmp11_ = value;
		if (_tmp10_ == _tmp11_) {
			break;
		}
		_tmp12_ = combo;
		_tmp13_ = gtk_combo_box_get_model (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = gtk_tree_model_iter_next (_tmp14_, &iter);
		valid = _tmp15_;
	}
	_tmp16_ = valid;
	if (!_tmp16_) {
		GtkComboBox* _tmp17_ = NULL;
		GtkTreeModel* _tmp18_ = NULL;
		GtkTreeModel* _tmp19_ = NULL;
		GtkTreeIter _tmp20_ = {0};
		gboolean _tmp21_ = FALSE;
		_tmp17_ = combo;
		_tmp18_ = gtk_combo_box_get_model (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp21_ = gtk_tree_model_get_iter_first (_tmp19_, &_tmp20_);
		iter = _tmp20_;
		valid = _tmp21_;
	}
	_tmp22_ = combo;
	_tmp23_ = iter;
	gtk_combo_box_set_active_iter (_tmp22_, &_tmp23_);
}


static MathEquation* math_preferences_dialog_get_equation (MathPreferencesDialog* self) {
	MathEquation* result;
	MathEquation* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_equation;
	result = _tmp0_;
	return result;
}


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


static void math_preferences_dialog_set_equation (MathPreferencesDialog* self, MathEquation* value) {
	MathEquation* _tmp0_ = NULL;
	MathEquation* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_equation);
	self->priv->_equation = _tmp1_;
	g_object_notify ((GObject *) self, "equation");
}


static void _math_preferences_dialog_number_format_combo_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) {
	math_preferences_dialog_number_format_combo_changed_cb ((MathPreferencesDialog*) self, _sender);
}


static gchar* string_strip (const gchar* self) {
	gchar* result = NULL;
	gchar* _result_ = NULL;
	gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	g_strstrip (_tmp1_);
	result = _result_;
	return result;
}


static void _math_preferences_dialog___lambda31_ (MathPreferencesDialog* self) {
	MathEquation* _tmp0_ = NULL;
	GtkSpinButton* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	_tmp0_ = self->priv->_equation;
	_tmp1_ = self->priv->decimal_places_spin;
	_tmp2_ = gtk_spin_button_get_value_as_int (_tmp1_);
	math_equation_set_accuracy (_tmp0_, _tmp2_);
}


static void __math_preferences_dialog___lambda31__gtk_spin_button_value_changed (GtkSpinButton* _sender, gpointer self) {
	_math_preferences_dialog___lambda31_ ((MathPreferencesDialog*) self);
}


static void _math_preferences_dialog___lambda32_ (MathPreferencesDialog* self) {
	MathEquation* _tmp0_ = NULL;
	GtkCheckButton* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	_tmp0_ = self->priv->_equation;
	_tmp1_ = self->priv->trailing_zeroes_check;
	_tmp2_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp1_);
	math_equation_set_show_trailing_zeroes (_tmp0_, _tmp2_);
}


static void __math_preferences_dialog___lambda32__gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	_math_preferences_dialog___lambda32_ ((MathPreferencesDialog*) self);
}


static void _math_preferences_dialog___lambda33_ (MathPreferencesDialog* self) {
	MathEquation* _tmp0_ = NULL;
	GtkCheckButton* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	_tmp0_ = self->priv->_equation;
	_tmp1_ = self->priv->thousands_separator_check;
	_tmp2_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp1_);
	math_equation_set_show_thousands_separators (_tmp0_, _tmp2_);
}


static void __math_preferences_dialog___lambda33__gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	_math_preferences_dialog___lambda33_ ((MathPreferencesDialog*) self);
}


static void _math_preferences_dialog_angle_unit_combo_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) {
	math_preferences_dialog_angle_unit_combo_changed_cb ((MathPreferencesDialog*) self, _sender);
}


static void _math_preferences_dialog_word_size_combo_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) {
	math_preferences_dialog_word_size_combo_changed_cb ((MathPreferencesDialog*) self, _sender);
}


static void _math_preferences_dialog___lambda34_ (MathPreferencesDialog* self, GParamSpec* pspec) {
	GtkSpinButton* _tmp0_ = NULL;
	MathEquation* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	g_return_if_fail (pspec != NULL);
	_tmp0_ = self->priv->decimal_places_spin;
	_tmp1_ = self->priv->_equation;
	_tmp2_ = math_equation_get_accuracy (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_spin_button_set_value (_tmp0_, (gdouble) _tmp3_);
}


static void __math_preferences_dialog___lambda34__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	_math_preferences_dialog___lambda34_ ((MathPreferencesDialog*) self, pspec);
}


static void _math_preferences_dialog___lambda35_ (MathPreferencesDialog* self) {
	GtkCheckButton* _tmp0_ = NULL;
	MathEquation* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	_tmp0_ = self->priv->thousands_separator_check;
	_tmp1_ = self->priv->_equation;
	_tmp2_ = math_equation_get_show_thousands_separators (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp0_, _tmp3_);
}


static void __math_preferences_dialog___lambda35__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	_math_preferences_dialog___lambda35_ ((MathPreferencesDialog*) self);
}


static void _math_preferences_dialog___lambda36_ (MathPreferencesDialog* self) {
	GtkCheckButton* _tmp0_ = NULL;
	MathEquation* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	_tmp0_ = self->priv->trailing_zeroes_check;
	_tmp1_ = self->priv->_equation;
	_tmp2_ = math_equation_get_show_trailing_zeroes (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp0_, _tmp3_);
}


static void __math_preferences_dialog___lambda36__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	_math_preferences_dialog___lambda36_ ((MathPreferencesDialog*) self);
}


static void _math_preferences_dialog___lambda37_ (MathPreferencesDialog* self, GParamSpec* pspec) {
	GtkComboBox* _tmp0_ = NULL;
	MathEquation* _tmp1_ = NULL;
	DisplayFormat _tmp2_ = 0;
	DisplayFormat _tmp3_ = 0;
	g_return_if_fail (pspec != NULL);
	_tmp0_ = self->priv->number_format_combo;
	_tmp1_ = self->priv->_equation;
	_tmp2_ = math_equation_get_number_format (_tmp1_);
	_tmp3_ = _tmp2_;
	math_preferences_dialog_set_combo_box_from_int (self, _tmp0_, (gint) _tmp3_);
}


static void __math_preferences_dialog___lambda37__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	_math_preferences_dialog___lambda37_ ((MathPreferencesDialog*) self, pspec);
}


static void _math_preferences_dialog___lambda38_ (MathPreferencesDialog* self, GParamSpec* pspec) {
	GtkComboBox* _tmp0_ = NULL;
	MathEquation* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	g_return_if_fail (pspec != NULL);
	_tmp0_ = self->priv->word_size_combo;
	_tmp1_ = self->priv->_equation;
	_tmp2_ = math_equation_get_word_size (_tmp1_);
	_tmp3_ = _tmp2_;
	math_preferences_dialog_set_combo_box_from_int (self, _tmp0_, _tmp3_);
}


static void __math_preferences_dialog___lambda38__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	_math_preferences_dialog___lambda38_ ((MathPreferencesDialog*) self, pspec);
}


static void _math_preferences_dialog___lambda39_ (MathPreferencesDialog* self, GParamSpec* pspec) {
	GtkComboBox* _tmp0_ = NULL;
	MathEquation* _tmp1_ = NULL;
	AngleUnit _tmp2_ = 0;
	AngleUnit _tmp3_ = 0;
	g_return_if_fail (pspec != NULL);
	_tmp0_ = self->priv->angle_unit_combo;
	_tmp1_ = self->priv->_equation;
	_tmp2_ = math_equation_get_angle_units (_tmp1_);
	_tmp3_ = _tmp2_;
	math_preferences_dialog_set_combo_box_from_int (self, _tmp0_, (gint) _tmp3_);
}


static void __math_preferences_dialog___lambda39__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	_math_preferences_dialog___lambda39_ ((MathPreferencesDialog*) self, pspec);
}


static GObject * math_preferences_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	MathPreferencesDialog * self;
	const gchar* _tmp0_ = NULL;
	GtkWidget* _tmp1_ = NULL;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp2_ = NULL;
	GtkGrid* _tmp3_ = NULL;
	GtkGrid* _tmp4_ = NULL;
	GtkGrid* _tmp5_ = NULL;
	GtkGrid* _tmp6_ = NULL;
	GtkBox* _tmp7_ = NULL;
	GtkGrid* _tmp8_ = NULL;
	GtkLabel* label = NULL;
	const gchar* _tmp9_ = NULL;
	GtkLabel* _tmp10_ = NULL;
	GtkLabel* _tmp11_ = NULL;
	GtkLabel* _tmp12_ = NULL;
	GtkGrid* _tmp13_ = NULL;
	GtkLabel* _tmp14_ = NULL;
	GtkComboBox* _tmp15_ = NULL;
	GtkLabel* _tmp16_ = NULL;
	GtkComboBox* _tmp17_ = NULL;
	GtkComboBox* _tmp18_ = NULL;
	GtkComboBox* _tmp19_ = NULL;
	GtkGrid* _tmp20_ = NULL;
	GtkComboBox* _tmp21_ = NULL;
	GtkListStore* model = NULL;
	GtkListStore* _tmp22_ = NULL;
	GtkComboBox* _tmp23_ = NULL;
	GtkListStore* _tmp24_ = NULL;
	GtkTreeIter iter = {0};
	GtkListStore* _tmp25_ = NULL;
	GtkTreeIter _tmp26_ = {0};
	GtkListStore* _tmp27_ = NULL;
	GtkTreeIter _tmp28_ = {0};
	const gchar* _tmp29_ = NULL;
	GtkListStore* _tmp30_ = NULL;
	GtkTreeIter _tmp31_ = {0};
	GtkListStore* _tmp32_ = NULL;
	GtkTreeIter _tmp33_ = {0};
	const gchar* _tmp34_ = NULL;
	GtkListStore* _tmp35_ = NULL;
	GtkTreeIter _tmp36_ = {0};
	GtkListStore* _tmp37_ = NULL;
	GtkTreeIter _tmp38_ = {0};
	const gchar* _tmp39_ = NULL;
	GtkListStore* _tmp40_ = NULL;
	GtkTreeIter _tmp41_ = {0};
	GtkListStore* _tmp42_ = NULL;
	GtkTreeIter _tmp43_ = {0};
	const gchar* _tmp44_ = NULL;
	GtkCellRendererText* renderer = NULL;
	GtkCellRendererText* _tmp45_ = NULL;
	GtkComboBox* _tmp46_ = NULL;
	GtkCellRendererText* _tmp47_ = NULL;
	GtkComboBox* _tmp48_ = NULL;
	GtkCellRendererText* _tmp49_ = NULL;
	GtkBox* format_options_box = NULL;
	GtkBox* _tmp50_ = NULL;
	GtkBox* _tmp51_ = NULL;
	GtkBox* _tmp52_ = NULL;
	GtkBox* _tmp53_ = NULL;
	GtkBox* _tmp54_ = NULL;
	GtkBox* _tmp55_ = NULL;
	GtkGrid* _tmp56_ = NULL;
	GtkBox* _tmp57_ = NULL;
	GtkBox* places_box = NULL;
	GtkBox* _tmp58_ = NULL;
	GtkBox* _tmp59_ = NULL;
	GtkBox* _tmp60_ = NULL;
	GtkBox* _tmp61_ = NULL;
	gchar* string = NULL;
	const gchar* _tmp62_ = NULL;
	gchar* _tmp63_ = NULL;
	gchar** tokens = NULL;
	const gchar* _tmp64_ = NULL;
	gchar** _tmp65_ = NULL;
	gchar** _tmp66_ = NULL;
	gint tokens_length1 = 0;
	gint _tokens_size_ = 0;
	GtkAdjustment* decimal_places_adjustment = NULL;
	GtkAdjustment* _tmp67_ = NULL;
	GtkAdjustment* _tmp68_ = NULL;
	GtkSpinButton* _tmp69_ = NULL;
	gchar** _tmp70_ = NULL;
	gint _tmp70__length1 = 0;
	GtkSpinButton* _tmp81_ = NULL;
	GtkSpinButton* _tmp82_ = NULL;
	GtkBox* _tmp83_ = NULL;
	GtkSpinButton* _tmp84_ = NULL;
	gchar** _tmp85_ = NULL;
	gint _tmp85__length1 = 0;
	const gchar* _tmp96_ = NULL;
	GtkCheckButton* _tmp97_ = NULL;
	GtkCheckButton* _tmp98_ = NULL;
	GtkCheckButton* _tmp99_ = NULL;
	GtkBox* _tmp100_ = NULL;
	GtkCheckButton* _tmp101_ = NULL;
	const gchar* _tmp102_ = NULL;
	GtkCheckButton* _tmp103_ = NULL;
	GtkCheckButton* _tmp104_ = NULL;
	GtkCheckButton* _tmp105_ = NULL;
	GtkBox* _tmp106_ = NULL;
	GtkCheckButton* _tmp107_ = NULL;
	const gchar* _tmp108_ = NULL;
	GtkLabel* _tmp109_ = NULL;
	GtkLabel* _tmp110_ = NULL;
	GtkLabel* _tmp111_ = NULL;
	GtkGrid* _tmp112_ = NULL;
	GtkLabel* _tmp113_ = NULL;
	GtkComboBox* _tmp114_ = NULL;
	GtkLabel* _tmp115_ = NULL;
	GtkComboBox* _tmp116_ = NULL;
	GtkComboBox* _tmp117_ = NULL;
	GtkComboBox* _tmp118_ = NULL;
	GtkGrid* _tmp119_ = NULL;
	GtkComboBox* _tmp120_ = NULL;
	GtkListStore* _tmp121_ = NULL;
	GtkComboBox* _tmp122_ = NULL;
	GtkListStore* _tmp123_ = NULL;
	GtkListStore* _tmp124_ = NULL;
	GtkTreeIter _tmp125_ = {0};
	GtkListStore* _tmp126_ = NULL;
	GtkTreeIter _tmp127_ = {0};
	const gchar* _tmp128_ = NULL;
	GtkListStore* _tmp129_ = NULL;
	GtkTreeIter _tmp130_ = {0};
	GtkListStore* _tmp131_ = NULL;
	GtkTreeIter _tmp132_ = {0};
	const gchar* _tmp133_ = NULL;
	GtkListStore* _tmp134_ = NULL;
	GtkTreeIter _tmp135_ = {0};
	GtkListStore* _tmp136_ = NULL;
	GtkTreeIter _tmp137_ = {0};
	const gchar* _tmp138_ = NULL;
	GtkCellRendererText* _tmp139_ = NULL;
	GtkComboBox* _tmp140_ = NULL;
	GtkCellRendererText* _tmp141_ = NULL;
	GtkComboBox* _tmp142_ = NULL;
	GtkCellRendererText* _tmp143_ = NULL;
	const gchar* _tmp144_ = NULL;
	GtkLabel* _tmp145_ = NULL;
	GtkLabel* _tmp146_ = NULL;
	GtkLabel* _tmp147_ = NULL;
	GtkGrid* _tmp148_ = NULL;
	GtkLabel* _tmp149_ = NULL;
	GtkComboBox* _tmp150_ = NULL;
	GtkLabel* _tmp151_ = NULL;
	GtkComboBox* _tmp152_ = NULL;
	GtkComboBox* _tmp153_ = NULL;
	GtkComboBox* _tmp154_ = NULL;
	GtkGrid* _tmp155_ = NULL;
	GtkComboBox* _tmp156_ = NULL;
	GtkListStore* _tmp157_ = NULL;
	GtkComboBox* _tmp158_ = NULL;
	GtkListStore* _tmp159_ = NULL;
	GtkListStore* _tmp160_ = NULL;
	GtkTreeIter _tmp161_ = {0};
	GtkListStore* _tmp162_ = NULL;
	GtkTreeIter _tmp163_ = {0};
	const gchar* _tmp164_ = NULL;
	GtkListStore* _tmp165_ = NULL;
	GtkTreeIter _tmp166_ = {0};
	GtkListStore* _tmp167_ = NULL;
	GtkTreeIter _tmp168_ = {0};
	const gchar* _tmp169_ = NULL;
	GtkListStore* _tmp170_ = NULL;
	GtkTreeIter _tmp171_ = {0};
	GtkListStore* _tmp172_ = NULL;
	GtkTreeIter _tmp173_ = {0};
	const gchar* _tmp174_ = NULL;
	GtkListStore* _tmp175_ = NULL;
	GtkTreeIter _tmp176_ = {0};
	GtkListStore* _tmp177_ = NULL;
	GtkTreeIter _tmp178_ = {0};
	const gchar* _tmp179_ = NULL;
	GtkCellRendererText* _tmp180_ = NULL;
	GtkComboBox* _tmp181_ = NULL;
	GtkCellRendererText* _tmp182_ = NULL;
	GtkComboBox* _tmp183_ = NULL;
	GtkCellRendererText* _tmp184_ = NULL;
	GtkSpinButton* _tmp185_ = NULL;
	MathEquation* _tmp186_ = NULL;
	gint _tmp187_ = 0;
	gint _tmp188_ = 0;
	MathEquation* _tmp189_ = NULL;
	GtkCheckButton* _tmp190_ = NULL;
	MathEquation* _tmp191_ = NULL;
	gboolean _tmp192_ = FALSE;
	gboolean _tmp193_ = FALSE;
	MathEquation* _tmp194_ = NULL;
	GtkCheckButton* _tmp195_ = NULL;
	MathEquation* _tmp196_ = NULL;
	gboolean _tmp197_ = FALSE;
	gboolean _tmp198_ = FALSE;
	MathEquation* _tmp199_ = NULL;
	GtkComboBox* _tmp200_ = NULL;
	MathEquation* _tmp201_ = NULL;
	DisplayFormat _tmp202_ = 0;
	DisplayFormat _tmp203_ = 0;
	MathEquation* _tmp204_ = NULL;
	GtkComboBox* _tmp205_ = NULL;
	MathEquation* _tmp206_ = NULL;
	gint _tmp207_ = 0;
	gint _tmp208_ = 0;
	MathEquation* _tmp209_ = NULL;
	GtkComboBox* _tmp210_ = NULL;
	MathEquation* _tmp211_ = NULL;
	AngleUnit _tmp212_ = 0;
	AngleUnit _tmp213_ = 0;
	MathEquation* _tmp214_ = NULL;
	parent_class = G_OBJECT_CLASS (math_preferences_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MATH_PREFERENCES_DIALOG, MathPreferencesDialog);
	_tmp0_ = _ ("Preferences");
	gtk_window_set_title ((GtkWindow*) self, _tmp0_);
	gtk_container_set_border_width ((GtkContainer*) self, (guint) 8);
	_tmp1_ = gtk_dialog_get_header_bar ((GtkDialog*) self);
	gtk_header_bar_set_show_close_button (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_header_bar_get_type (), GtkHeaderBar), TRUE);
	_tmp2_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp2_);
	grid = _tmp2_;
	_tmp3_ = grid;
	gtk_widget_show ((GtkWidget*) _tmp3_);
	_tmp4_ = grid;
	gtk_container_set_border_width ((GtkContainer*) _tmp4_, (guint) 5);
	_tmp5_ = grid;
	gtk_grid_set_column_spacing (_tmp5_, 6);
	_tmp6_ = grid;
	gtk_grid_set_row_spacing (_tmp6_, 12);
	_tmp7_ = (GtkBox*) gtk_dialog_get_content_area ((GtkDialog*) self);
	_tmp8_ = grid;
	gtk_box_pack_start (_tmp7_, (GtkWidget*) _tmp8_, TRUE, TRUE, (guint) 0);
	_tmp9_ = _ ("Number _Format:");
	_tmp10_ = (GtkLabel*) gtk_label_new_with_mnemonic (_tmp9_);
	g_object_ref_sink (_tmp10_);
	label = _tmp10_;
	_tmp11_ = label;
	gtk_widget_show ((GtkWidget*) _tmp11_);
	_tmp12_ = label;
	gtk_label_set_xalign (_tmp12_, (gfloat) 0);
	_tmp13_ = grid;
	_tmp14_ = label;
	gtk_grid_attach (_tmp13_, (GtkWidget*) _tmp14_, 0, 0, 1, 1);
	_tmp15_ = (GtkComboBox*) gtk_combo_box_new ();
	g_object_ref_sink (_tmp15_);
	_g_object_unref0 (self->priv->number_format_combo);
	self->priv->number_format_combo = _tmp15_;
	_tmp16_ = label;
	_tmp17_ = self->priv->number_format_combo;
	gtk_label_set_mnemonic_widget (_tmp16_, (GtkWidget*) _tmp17_);
	_tmp18_ = self->priv->number_format_combo;
	gtk_widget_show ((GtkWidget*) _tmp18_);
	_tmp19_ = self->priv->number_format_combo;
	g_signal_connect_object (_tmp19_, "changed", (GCallback) _math_preferences_dialog_number_format_combo_changed_cb_gtk_combo_box_changed, self, 0);
	_tmp20_ = grid;
	_tmp21_ = self->priv->number_format_combo;
	gtk_grid_attach (_tmp20_, (GtkWidget*) _tmp21_, 1, 0, 1, 1);
	_tmp22_ = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT, -1);
	model = _tmp22_;
	_tmp23_ = self->priv->number_format_combo;
	_tmp24_ = model;
	gtk_combo_box_set_model (_tmp23_, (GtkTreeModel*) _tmp24_);
	_tmp25_ = model;
	gtk_list_store_append (_tmp25_, &_tmp26_);
	iter = _tmp26_;
	_tmp27_ = model;
	_tmp28_ = iter;
	_tmp29_ = _ ("Automatic");
	gtk_list_store_set (_tmp27_, &_tmp28_, 0, _tmp29_, 1, DISPLAY_FORMAT_AUTOMATIC, -1, -1);
	_tmp30_ = model;
	gtk_list_store_append (_tmp30_, &_tmp31_);
	iter = _tmp31_;
	_tmp32_ = model;
	_tmp33_ = iter;
	_tmp34_ = _ ("Fixed");
	gtk_list_store_set (_tmp32_, &_tmp33_, 0, _tmp34_, 1, DISPLAY_FORMAT_FIXED, -1, -1);
	_tmp35_ = model;
	gtk_list_store_append (_tmp35_, &_tmp36_);
	iter = _tmp36_;
	_tmp37_ = model;
	_tmp38_ = iter;
	_tmp39_ = _ ("Scientific");
	gtk_list_store_set (_tmp37_, &_tmp38_, 0, _tmp39_, 1, DISPLAY_FORMAT_SCIENTIFIC, -1, -1);
	_tmp40_ = model;
	gtk_list_store_append (_tmp40_, &_tmp41_);
	iter = _tmp41_;
	_tmp42_ = model;
	_tmp43_ = iter;
	_tmp44_ = _ ("Engineering");
	gtk_list_store_set (_tmp42_, &_tmp43_, 0, _tmp44_, 1, DISPLAY_FORMAT_ENGINEERING, -1, -1);
	_tmp45_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp45_);
	renderer = _tmp45_;
	_tmp46_ = self->priv->number_format_combo;
	_tmp47_ = renderer;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp46_, (GtkCellRenderer*) _tmp47_, TRUE);
	_tmp48_ = self->priv->number_format_combo;
	_tmp49_ = renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp48_, (GtkCellRenderer*) _tmp49_, "text", 0);
	_tmp50_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	g_object_ref_sink (_tmp50_);
	format_options_box = _tmp50_;
	_tmp51_ = format_options_box;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp51_, 6);
	_tmp52_ = format_options_box;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp52_, 12);
	_tmp53_ = format_options_box;
	gtk_widget_set_halign ((GtkWidget*) _tmp53_, GTK_ALIGN_CENTER);
	_tmp54_ = format_options_box;
	gtk_widget_set_valign ((GtkWidget*) _tmp54_, GTK_ALIGN_CENTER);
	_tmp55_ = format_options_box;
	gtk_widget_show ((GtkWidget*) _tmp55_);
	_tmp56_ = grid;
	_tmp57_ = format_options_box;
	gtk_grid_attach (_tmp56_, (GtkWidget*) _tmp57_, 0, 1, 2, 1);
	_tmp58_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp58_);
	places_box = _tmp58_;
	_tmp59_ = places_box;
	gtk_widget_show ((GtkWidget*) _tmp59_);
	_tmp60_ = format_options_box;
	_tmp61_ = places_box;
	gtk_box_pack_start (_tmp60_, (GtkWidget*) _tmp61_, FALSE, FALSE, (guint) 0);
	_tmp62_ = _ ("Show %d decimal _places");
	_tmp63_ = g_strdup (_tmp62_);
	string = _tmp63_;
	_tmp64_ = string;
	_tmp66_ = _tmp65_ = g_strsplit (_tmp64_, "%d", 2);
	tokens = _tmp66_;
	tokens_length1 = _vala_array_length (_tmp65_);
	_tokens_size_ = tokens_length1;
	_tmp67_ = gtk_adjustment_new (0.0, 0.0, 100.0, 1.0, 1.0, 0.0);
	g_object_ref_sink (_tmp67_);
	decimal_places_adjustment = _tmp67_;
	_tmp68_ = decimal_places_adjustment;
	_tmp69_ = (GtkSpinButton*) gtk_spin_button_new (_tmp68_, 0.0, (guint) 0);
	g_object_ref_sink (_tmp69_);
	_g_object_unref0 (self->priv->decimal_places_spin);
	self->priv->decimal_places_spin = _tmp69_;
	_tmp70_ = tokens;
	_tmp70__length1 = tokens_length1;
	if (_tmp70__length1 > 0) {
		gchar** _tmp71_ = NULL;
		gint _tmp71__length1 = 0;
		const gchar* _tmp72_ = NULL;
		gchar* _tmp73_ = NULL;
		gchar* _tmp74_ = NULL;
		GtkLabel* _tmp75_ = NULL;
		GtkLabel* _tmp76_ = NULL;
		GtkSpinButton* _tmp77_ = NULL;
		GtkLabel* _tmp78_ = NULL;
		GtkBox* _tmp79_ = NULL;
		GtkLabel* _tmp80_ = NULL;
		_tmp71_ = tokens;
		_tmp71__length1 = tokens_length1;
		_tmp72_ = _tmp71_[0];
		_tmp73_ = string_strip (_tmp72_);
		_tmp74_ = _tmp73_;
		_tmp75_ = (GtkLabel*) gtk_label_new_with_mnemonic (_tmp74_);
		g_object_ref_sink (_tmp75_);
		_g_object_unref0 (label);
		label = _tmp75_;
		_g_free0 (_tmp74_);
		_tmp76_ = label;
		_tmp77_ = self->priv->decimal_places_spin;
		gtk_label_set_mnemonic_widget (_tmp76_, (GtkWidget*) _tmp77_);
		_tmp78_ = label;
		gtk_widget_show ((GtkWidget*) _tmp78_);
		_tmp79_ = places_box;
		_tmp80_ = label;
		gtk_box_pack_start (_tmp79_, (GtkWidget*) _tmp80_, FALSE, FALSE, (guint) 0);
	}
	_tmp81_ = self->priv->decimal_places_spin;
	gtk_widget_show ((GtkWidget*) _tmp81_);
	_tmp82_ = self->priv->decimal_places_spin;
	g_signal_connect_object (_tmp82_, "value-changed", (GCallback) __math_preferences_dialog___lambda31__gtk_spin_button_value_changed, self, 0);
	_tmp83_ = places_box;
	_tmp84_ = self->priv->decimal_places_spin;
	gtk_box_pack_start (_tmp83_, (GtkWidget*) _tmp84_, FALSE, FALSE, (guint) 0);
	_tmp85_ = tokens;
	_tmp85__length1 = tokens_length1;
	if (_tmp85__length1 == 2) {
		gchar** _tmp86_ = NULL;
		gint _tmp86__length1 = 0;
		const gchar* _tmp87_ = NULL;
		gchar* _tmp88_ = NULL;
		gchar* _tmp89_ = NULL;
		GtkLabel* _tmp90_ = NULL;
		GtkLabel* _tmp91_ = NULL;
		GtkSpinButton* _tmp92_ = NULL;
		GtkLabel* _tmp93_ = NULL;
		GtkBox* _tmp94_ = NULL;
		GtkLabel* _tmp95_ = NULL;
		_tmp86_ = tokens;
		_tmp86__length1 = tokens_length1;
		_tmp87_ = _tmp86_[1];
		_tmp88_ = string_strip (_tmp87_);
		_tmp89_ = _tmp88_;
		_tmp90_ = (GtkLabel*) gtk_label_new_with_mnemonic (_tmp89_);
		g_object_ref_sink (_tmp90_);
		_g_object_unref0 (label);
		label = _tmp90_;
		_g_free0 (_tmp89_);
		_tmp91_ = label;
		_tmp92_ = self->priv->decimal_places_spin;
		gtk_label_set_mnemonic_widget (_tmp91_, (GtkWidget*) _tmp92_);
		_tmp93_ = label;
		gtk_widget_show ((GtkWidget*) _tmp93_);
		_tmp94_ = places_box;
		_tmp95_ = label;
		gtk_box_pack_start (_tmp94_, (GtkWidget*) _tmp95_, FALSE, FALSE, (guint) 0);
	}
	_tmp96_ = _ ("Show trailing _zeroes");
	_tmp97_ = (GtkCheckButton*) gtk_check_button_new_with_mnemonic (_tmp96_);
	g_object_ref_sink (_tmp97_);
	_g_object_unref0 (self->priv->trailing_zeroes_check);
	self->priv->trailing_zeroes_check = _tmp97_;
	_tmp98_ = self->priv->trailing_zeroes_check;
	gtk_widget_show ((GtkWidget*) _tmp98_);
	_tmp99_ = self->priv->trailing_zeroes_check;
	g_signal_connect_object ((GtkToggleButton*) _tmp99_, "toggled", (GCallback) __math_preferences_dialog___lambda32__gtk_toggle_button_toggled, self, 0);
	_tmp100_ = format_options_box;
	_tmp101_ = self->priv->trailing_zeroes_check;
	gtk_box_pack_start (_tmp100_, (GtkWidget*) _tmp101_, FALSE, FALSE, (guint) 0);
	_tmp102_ = _ ("Show _thousands separators");
	_tmp103_ = (GtkCheckButton*) gtk_check_button_new_with_mnemonic (_tmp102_);
	g_object_ref_sink (_tmp103_);
	_g_object_unref0 (self->priv->thousands_separator_check);
	self->priv->thousands_separator_check = _tmp103_;
	_tmp104_ = self->priv->thousands_separator_check;
	gtk_widget_show ((GtkWidget*) _tmp104_);
	_tmp105_ = self->priv->thousands_separator_check;
	g_signal_connect_object ((GtkToggleButton*) _tmp105_, "toggled", (GCallback) __math_preferences_dialog___lambda33__gtk_toggle_button_toggled, self, 0);
	_tmp106_ = format_options_box;
	_tmp107_ = self->priv->thousands_separator_check;
	gtk_box_pack_start (_tmp106_, (GtkWidget*) _tmp107_, FALSE, FALSE, (guint) 0);
	_tmp108_ = _ ("_Angle units:");
	_tmp109_ = (GtkLabel*) gtk_label_new_with_mnemonic (_tmp108_);
	g_object_ref_sink (_tmp109_);
	_g_object_unref0 (label);
	label = _tmp109_;
	_tmp110_ = label;
	gtk_widget_show ((GtkWidget*) _tmp110_);
	_tmp111_ = label;
	gtk_label_set_xalign (_tmp111_, (gfloat) 0);
	_tmp112_ = grid;
	_tmp113_ = label;
	gtk_grid_attach (_tmp112_, (GtkWidget*) _tmp113_, 0, 2, 1, 1);
	_tmp114_ = (GtkComboBox*) gtk_combo_box_new ();
	g_object_ref_sink (_tmp114_);
	_g_object_unref0 (self->priv->angle_unit_combo);
	self->priv->angle_unit_combo = _tmp114_;
	_tmp115_ = label;
	_tmp116_ = self->priv->angle_unit_combo;
	gtk_label_set_mnemonic_widget (_tmp115_, (GtkWidget*) _tmp116_);
	_tmp117_ = self->priv->angle_unit_combo;
	gtk_widget_show ((GtkWidget*) _tmp117_);
	_tmp118_ = self->priv->angle_unit_combo;
	g_signal_connect_object (_tmp118_, "changed", (GCallback) _math_preferences_dialog_angle_unit_combo_changed_cb_gtk_combo_box_changed, self, 0);
	_tmp119_ = grid;
	_tmp120_ = self->priv->angle_unit_combo;
	gtk_grid_attach (_tmp119_, (GtkWidget*) _tmp120_, 1, 2, 1, 1);
	_tmp121_ = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT, -1);
	_g_object_unref0 (model);
	model = _tmp121_;
	_tmp122_ = self->priv->angle_unit_combo;
	_tmp123_ = model;
	gtk_combo_box_set_model (_tmp122_, (GtkTreeModel*) _tmp123_);
	_tmp124_ = model;
	gtk_list_store_append (_tmp124_, &_tmp125_);
	iter = _tmp125_;
	_tmp126_ = model;
	_tmp127_ = iter;
	_tmp128_ = _ ("Degrees");
	gtk_list_store_set (_tmp126_, &_tmp127_, 0, _tmp128_, 1, ANGLE_UNIT_DEGREES, -1, -1);
	_tmp129_ = model;
	gtk_list_store_append (_tmp129_, &_tmp130_);
	iter = _tmp130_;
	_tmp131_ = model;
	_tmp132_ = iter;
	_tmp133_ = _ ("Radians");
	gtk_list_store_set (_tmp131_, &_tmp132_, 0, _tmp133_, 1, ANGLE_UNIT_RADIANS, -1, -1);
	_tmp134_ = model;
	gtk_list_store_append (_tmp134_, &_tmp135_);
	iter = _tmp135_;
	_tmp136_ = model;
	_tmp137_ = iter;
	_tmp138_ = _ ("Gradians");
	gtk_list_store_set (_tmp136_, &_tmp137_, 0, _tmp138_, 1, ANGLE_UNIT_GRADIANS, -1, -1);
	_tmp139_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp139_);
	_g_object_unref0 (renderer);
	renderer = _tmp139_;
	_tmp140_ = self->priv->angle_unit_combo;
	_tmp141_ = renderer;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp140_, (GtkCellRenderer*) _tmp141_, TRUE);
	_tmp142_ = self->priv->angle_unit_combo;
	_tmp143_ = renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp142_, (GtkCellRenderer*) _tmp143_, "text", 0);
	_tmp144_ = _ ("Word _size:");
	_tmp145_ = (GtkLabel*) gtk_label_new_with_mnemonic (_tmp144_);
	g_object_ref_sink (_tmp145_);
	_g_object_unref0 (label);
	label = _tmp145_;
	_tmp146_ = label;
	gtk_widget_show ((GtkWidget*) _tmp146_);
	_tmp147_ = label;
	gtk_label_set_xalign (_tmp147_, (gfloat) 0);
	_tmp148_ = grid;
	_tmp149_ = label;
	gtk_grid_attach (_tmp148_, (GtkWidget*) _tmp149_, 0, 3, 1, 1);
	_tmp150_ = (GtkComboBox*) gtk_combo_box_new ();
	g_object_ref_sink (_tmp150_);
	_g_object_unref0 (self->priv->word_size_combo);
	self->priv->word_size_combo = _tmp150_;
	_tmp151_ = label;
	_tmp152_ = self->priv->word_size_combo;
	gtk_label_set_mnemonic_widget (_tmp151_, (GtkWidget*) _tmp152_);
	_tmp153_ = self->priv->word_size_combo;
	gtk_widget_show ((GtkWidget*) _tmp153_);
	_tmp154_ = self->priv->word_size_combo;
	g_signal_connect_object (_tmp154_, "changed", (GCallback) _math_preferences_dialog_word_size_combo_changed_cb_gtk_combo_box_changed, self, 0);
	_tmp155_ = grid;
	_tmp156_ = self->priv->word_size_combo;
	gtk_grid_attach (_tmp155_, (GtkWidget*) _tmp156_, 1, 3, 1, 1);
	_tmp157_ = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT, -1);
	_g_object_unref0 (model);
	model = _tmp157_;
	_tmp158_ = self->priv->word_size_combo;
	_tmp159_ = model;
	gtk_combo_box_set_model (_tmp158_, (GtkTreeModel*) _tmp159_);
	_tmp160_ = model;
	gtk_list_store_append (_tmp160_, &_tmp161_);
	iter = _tmp161_;
	_tmp162_ = model;
	_tmp163_ = iter;
	_tmp164_ = _ ("8 bits");
	gtk_list_store_set (_tmp162_, &_tmp163_, 0, _tmp164_, 1, 8, -1);
	_tmp165_ = model;
	gtk_list_store_append (_tmp165_, &_tmp166_);
	iter = _tmp166_;
	_tmp167_ = model;
	_tmp168_ = iter;
	_tmp169_ = _ ("16 bits");
	gtk_list_store_set (_tmp167_, &_tmp168_, 0, _tmp169_, 1, 16, -1);
	_tmp170_ = model;
	gtk_list_store_append (_tmp170_, &_tmp171_);
	iter = _tmp171_;
	_tmp172_ = model;
	_tmp173_ = iter;
	_tmp174_ = _ ("32 bits");
	gtk_list_store_set (_tmp172_, &_tmp173_, 0, _tmp174_, 1, 32, -1);
	_tmp175_ = model;
	gtk_list_store_append (_tmp175_, &_tmp176_);
	iter = _tmp176_;
	_tmp177_ = model;
	_tmp178_ = iter;
	_tmp179_ = _ ("64 bits");
	gtk_list_store_set (_tmp177_, &_tmp178_, 0, _tmp179_, 1, 64, -1);
	_tmp180_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp180_);
	_g_object_unref0 (renderer);
	renderer = _tmp180_;
	_tmp181_ = self->priv->word_size_combo;
	_tmp182_ = renderer;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp181_, (GtkCellRenderer*) _tmp182_, TRUE);
	_tmp183_ = self->priv->word_size_combo;
	_tmp184_ = renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp183_, (GtkCellRenderer*) _tmp184_, "text", 0);
	_tmp185_ = self->priv->decimal_places_spin;
	_tmp186_ = self->priv->_equation;
	_tmp187_ = math_equation_get_accuracy (_tmp186_);
	_tmp188_ = _tmp187_;
	gtk_spin_button_set_value (_tmp185_, (gdouble) _tmp188_);
	_tmp189_ = self->priv->_equation;
	g_signal_connect_object ((GObject*) _tmp189_, "notify::accuracy", (GCallback) __math_preferences_dialog___lambda34__g_object_notify, self, 0);
	_tmp190_ = self->priv->thousands_separator_check;
	_tmp191_ = self->priv->_equation;
	_tmp192_ = math_equation_get_show_thousands_separators (_tmp191_);
	_tmp193_ = _tmp192_;
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp190_, _tmp193_);
	_tmp194_ = self->priv->_equation;
	g_signal_connect_object ((GObject*) _tmp194_, "notify::show-thousands-separators", (GCallback) __math_preferences_dialog___lambda35__g_object_notify, self, 0);
	_tmp195_ = self->priv->trailing_zeroes_check;
	_tmp196_ = self->priv->_equation;
	_tmp197_ = math_equation_get_show_trailing_zeroes (_tmp196_);
	_tmp198_ = _tmp197_;
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp195_, _tmp198_);
	_tmp199_ = self->priv->_equation;
	g_signal_connect_object ((GObject*) _tmp199_, "notify::show-trailing_zeroes", (GCallback) __math_preferences_dialog___lambda36__g_object_notify, self, 0);
	_tmp200_ = self->priv->number_format_combo;
	_tmp201_ = self->priv->_equation;
	_tmp202_ = math_equation_get_number_format (_tmp201_);
	_tmp203_ = _tmp202_;
	math_preferences_dialog_set_combo_box_from_int (self, _tmp200_, (gint) _tmp203_);
	_tmp204_ = self->priv->_equation;
	g_signal_connect_object ((GObject*) _tmp204_, "notify::number-format", (GCallback) __math_preferences_dialog___lambda37__g_object_notify, self, 0);
	_tmp205_ = self->priv->word_size_combo;
	_tmp206_ = self->priv->_equation;
	_tmp207_ = math_equation_get_word_size (_tmp206_);
	_tmp208_ = _tmp207_;
	math_preferences_dialog_set_combo_box_from_int (self, _tmp205_, _tmp208_);
	_tmp209_ = self->priv->_equation;
	g_signal_connect_object ((GObject*) _tmp209_, "notify::word-size", (GCallback) __math_preferences_dialog___lambda38__g_object_notify, self, 0);
	_tmp210_ = self->priv->angle_unit_combo;
	_tmp211_ = self->priv->_equation;
	_tmp212_ = math_equation_get_angle_units (_tmp211_);
	_tmp213_ = _tmp212_;
	math_preferences_dialog_set_combo_box_from_int (self, _tmp210_, (gint) _tmp213_);
	_tmp214_ = self->priv->_equation;
	g_signal_connect_object ((GObject*) _tmp214_, "notify::angle-units", (GCallback) __math_preferences_dialog___lambda39__g_object_notify, self, 0);
	_g_object_unref0 (decimal_places_adjustment);
	tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (string);
	_g_object_unref0 (places_box);
	_g_object_unref0 (format_options_box);
	_g_object_unref0 (renderer);
	_g_object_unref0 (model);
	_g_object_unref0 (label);
	_g_object_unref0 (grid);
	return obj;
}


static void math_preferences_dialog_class_init (MathPreferencesDialogClass * klass) {
	math_preferences_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (MathPreferencesDialogPrivate));
	((GtkDialogClass *) klass)->response = math_preferences_dialog_real_response;
	((GtkWidgetClass *) klass)->delete_event = math_preferences_dialog_real_delete_event;
	G_OBJECT_CLASS (klass)->get_property = _vala_math_preferences_dialog_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_math_preferences_dialog_set_property;
	G_OBJECT_CLASS (klass)->constructor = math_preferences_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = math_preferences_dialog_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), MATH_PREFERENCES_DIALOG_EQUATION, g_param_spec_object ("equation", "equation", "equation", TYPE_MATH_EQUATION, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}


static void math_preferences_dialog_instance_init (MathPreferencesDialog * self) {
	self->priv = MATH_PREFERENCES_DIALOG_GET_PRIVATE (self);
}


static void math_preferences_dialog_finalize (GObject* obj) {
	MathPreferencesDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MATH_PREFERENCES_DIALOG, MathPreferencesDialog);
	_g_object_unref0 (self->priv->_equation);
	_g_object_unref0 (self->priv->angle_unit_combo);
	_g_object_unref0 (self->priv->number_format_combo);
	_g_object_unref0 (self->priv->word_size_combo);
	_g_object_unref0 (self->priv->decimal_places_spin);
	_g_object_unref0 (self->priv->thousands_separator_check);
	_g_object_unref0 (self->priv->trailing_zeroes_check);
	G_OBJECT_CLASS (math_preferences_dialog_parent_class)->finalize (obj);
}


GType math_preferences_dialog_get_type (void) {
	static volatile gsize math_preferences_dialog_type_id__volatile = 0;
	if (g_once_init_enter (&math_preferences_dialog_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (MathPreferencesDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) math_preferences_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MathPreferencesDialog), 0, (GInstanceInitFunc) math_preferences_dialog_instance_init, NULL };
		GType math_preferences_dialog_type_id;
		math_preferences_dialog_type_id = g_type_register_static (gtk_dialog_get_type (), "MathPreferencesDialog", &g_define_type_info, 0);
		g_once_init_leave (&math_preferences_dialog_type_id__volatile, math_preferences_dialog_type_id);
	}
	return math_preferences_dialog_type_id__volatile;
}


static void _vala_math_preferences_dialog_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	MathPreferencesDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MATH_PREFERENCES_DIALOG, MathPreferencesDialog);
	switch (property_id) {
		case MATH_PREFERENCES_DIALOG_EQUATION:
		g_value_set_object (value, math_preferences_dialog_get_equation (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_math_preferences_dialog_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	MathPreferencesDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MATH_PREFERENCES_DIALOG, MathPreferencesDialog);
	switch (property_id) {
		case MATH_PREFERENCES_DIALOG_EQUATION:
		math_preferences_dialog_set_equation (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int 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, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



