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

/*
 *  Copyright (C) 2009-2010 Michael J. Chudobiak.
 *
 *  This file is part of moserial.
 *
 *  moserial 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.
 *
 *  moserial is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with moserial.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.h>
#include <config.h>
#include <glib/gi18n-lib.h>


#define MOSERIAL_TYPE_PREFERENCES_DIALOG (moserial_preferences_dialog_get_type ())
#define MOSERIAL_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOSERIAL_TYPE_PREFERENCES_DIALOG, moserialPreferencesDialog))
#define MOSERIAL_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOSERIAL_TYPE_PREFERENCES_DIALOG, moserialPreferencesDialogClass))
#define MOSERIAL_IS_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOSERIAL_TYPE_PREFERENCES_DIALOG))
#define MOSERIAL_IS_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOSERIAL_TYPE_PREFERENCES_DIALOG))
#define MOSERIAL_PREFERENCES_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOSERIAL_TYPE_PREFERENCES_DIALOG, moserialPreferencesDialogClass))

typedef struct _moserialPreferencesDialog moserialPreferencesDialog;
typedef struct _moserialPreferencesDialogClass moserialPreferencesDialogClass;
typedef struct _moserialPreferencesDialogPrivate moserialPreferencesDialogPrivate;
enum  {
	MOSERIAL_PREFERENCES_DIALOG_0_PROPERTY,
	MOSERIAL_PREFERENCES_DIALOG_NUM_PROPERTIES
};
static GParamSpec* moserial_preferences_dialog_properties[MOSERIAL_PREFERENCES_DIALOG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_PREFERENCES (preferences_get_type ())
#define PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PREFERENCES, Preferences))
#define PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PREFERENCES, PreferencesClass))
#define IS_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PREFERENCES))
#define IS_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PREFERENCES))
#define PREFERENCES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PREFERENCES, PreferencesClass))

typedef struct _Preferences Preferences;
typedef struct _PreferencesClass PreferencesClass;
enum  {
	MOSERIAL_PREFERENCES_DIALOG_UPDATE_PREFERENCES_SIGNAL,
	MOSERIAL_PREFERENCES_DIALOG_NUM_SIGNALS
};
static guint moserial_preferences_dialog_signals[MOSERIAL_PREFERENCES_DIALOG_NUM_SIGNALS] = {0};

struct _moserialPreferencesDialog {
	GObject parent_instance;
	moserialPreferencesDialogPrivate * priv;
};

struct _moserialPreferencesDialogClass {
	GObjectClass parent_class;
};

struct _moserialPreferencesDialogPrivate {
	GtkDialog* dialog;
	GtkButton* cancelButton;
	GtkButton* okButton;
	GtkCheckButton* systemFont;
	GtkFontButton* fontButton;
	GtkColorButton* fontColorButton;
	GtkColorButton* backgroundColorButton;
	GtkColorButton* highlightColorButton;
	GtkCheckButton* recordLaunch;
	GtkCheckButton* enableTimeout;
	GtkSpinButton* timeout;
};


static gpointer moserial_preferences_dialog_parent_class = NULL;

GType moserial_preferences_dialog_get_type (void) G_GNUC_CONST;
#define MOSERIAL_PREFERENCES_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MOSERIAL_TYPE_PREFERENCES_DIALOG, moserialPreferencesDialogPrivate))
void moserial_preferences_dialog_ok (moserialPreferencesDialog* self, GtkButton* button);
gboolean moserial_preferences_dialog_hide (moserialPreferencesDialog* self);
GType preferences_get_type (void) G_GNUC_CONST;
Preferences* preferences_new (gboolean useSystemMonospaceFont, const gchar* font, const gchar* fontColor, const gchar* backgroundColor, const gchar* highlightColor, gboolean recordLaunch, gboolean enableTimeout, gint timeout);
Preferences* preferences_construct (GType object_type, gboolean useSystemMonospaceFont, const gchar* font, const gchar* fontColor, const gchar* backgroundColor, const gchar* highlightColor, gboolean recordLaunch, gboolean enableTimeout, gint timeout);
void moserial_preferences_dialog_show (moserialPreferencesDialog* self, Preferences* preferences, gboolean recording);
gboolean preferences_get_useSystemMonospaceFont (Preferences* self);
const gchar* preferences_get_font (Preferences* self);
void preferences_getGdkColor (const gchar* color, GdkColor* result);
const gchar* preferences_get_fontColor (Preferences* self);
const gchar* preferences_get_backgroundColor (Preferences* self);
const gchar* preferences_get_highlightColor (Preferences* self);
gboolean preferences_get_recordLaunch (Preferences* self);
gboolean preferences_get_enableTimeout (Preferences* self);
gint preferences_get_timeout (Preferences* self);
void moserial_preferences_dialog_cancel (moserialPreferencesDialog* self, GtkWidget* w);
void moserial_preferences_dialog_systemFontToggled (moserialPreferencesDialog* self, GtkToggleButton* button);
void moserial_preferences_dialog_enableTimeoutToggled (moserialPreferencesDialog* self, GtkToggleButton* button);
moserialPreferencesDialog* moserial_preferences_dialog_new (void);
moserialPreferencesDialog* moserial_preferences_dialog_construct (GType object_type);
static GObject * moserial_preferences_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _moserial_preferences_dialog_systemFontToggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void _moserial_preferences_dialog_enableTimeoutToggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void _moserial_preferences_dialog_ok_gtk_button_clicked (GtkButton* _sender, gpointer self);
static void _moserial_preferences_dialog_cancel_gtk_button_clicked (GtkButton* _sender, gpointer self);
static gboolean _moserial_preferences_dialog_hide_gtk_widget_delete_event (GtkWidget* _sender, GdkEventAny* event, gpointer self);
static void moserial_preferences_dialog_finalize (GObject * obj);


void moserial_preferences_dialog_ok (moserialPreferencesDialog* self, GtkButton* button) {
	gboolean pSystemFont = FALSE;
	gchar* pFont = NULL;
	gchar* pFontColor = NULL;
	gchar* pBackgroundColor = NULL;
	gchar* pHighlightColor = NULL;
	gboolean pRecordLaunch = FALSE;
	gboolean pEnableTimeout = FALSE;
	gint pTimeout = 0;
	GtkCheckButton* _tmp0_;
	gboolean _tmp1_;
	GtkFontButton* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	GdkColor c = {0};
	GtkColorButton* _tmp5_;
	GdkColor _tmp6_ = {0};
	gchar* _tmp7_;
	GtkColorButton* _tmp8_;
	GdkColor _tmp9_ = {0};
	gchar* _tmp10_;
	GtkColorButton* _tmp11_;
	GdkColor _tmp12_ = {0};
	gchar* _tmp13_;
	GtkCheckButton* _tmp14_;
	gboolean _tmp15_;
	GtkCheckButton* _tmp16_;
	gboolean _tmp17_;
	GtkSpinButton* _tmp18_;
	gdouble _tmp19_;
	Preferences* preferences = NULL;
	gboolean _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	gboolean _tmp25_;
	gboolean _tmp26_;
	Preferences* _tmp27_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	moserial_preferences_dialog_hide (self);
	_tmp0_ = self->priv->systemFont;
	_tmp1_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp0_);
	if (_tmp1_) {
		pSystemFont = TRUE;
	} else {
		pSystemFont = FALSE;
	}
	_tmp2_ = self->priv->fontButton;
	_tmp3_ = gtk_font_button_get_font_name (_tmp2_);
	_tmp4_ = g_strdup (_tmp3_);
	_g_free0 (pFont);
	pFont = _tmp4_;
	_tmp5_ = self->priv->fontColorButton;
	gtk_color_button_get_color (_tmp5_, &_tmp6_);
	c = _tmp6_;
	_tmp7_ = gdk_color_to_string (&c);
	_g_free0 (pFontColor);
	pFontColor = _tmp7_;
	_tmp8_ = self->priv->backgroundColorButton;
	gtk_color_button_get_color (_tmp8_, &_tmp9_);
	c = _tmp9_;
	_tmp10_ = gdk_color_to_string (&c);
	_g_free0 (pBackgroundColor);
	pBackgroundColor = _tmp10_;
	_tmp11_ = self->priv->highlightColorButton;
	gtk_color_button_get_color (_tmp11_, &_tmp12_);
	c = _tmp12_;
	_tmp13_ = gdk_color_to_string (&c);
	_g_free0 (pHighlightColor);
	pHighlightColor = _tmp13_;
	_tmp14_ = self->priv->recordLaunch;
	_tmp15_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp14_);
	if (_tmp15_) {
		pRecordLaunch = TRUE;
	} else {
		pRecordLaunch = FALSE;
	}
	_tmp16_ = self->priv->enableTimeout;
	_tmp17_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp16_);
	if (_tmp17_) {
		pEnableTimeout = TRUE;
	} else {
		pEnableTimeout = FALSE;
	}
	_tmp18_ = self->priv->timeout;
	_tmp19_ = gtk_spin_button_get_value (_tmp18_);
	pTimeout = (gint) _tmp19_;
	_tmp20_ = pSystemFont;
	_tmp21_ = pFont;
	_tmp22_ = pFontColor;
	_tmp23_ = pBackgroundColor;
	_tmp24_ = pHighlightColor;
	_tmp25_ = pRecordLaunch;
	_tmp26_ = pEnableTimeout;
	_tmp27_ = preferences_new (_tmp20_, _tmp21_, _tmp22_, _tmp23_, _tmp24_, _tmp25_, _tmp26_, pTimeout);
	preferences = _tmp27_;
	g_signal_emit (self, moserial_preferences_dialog_signals[MOSERIAL_PREFERENCES_DIALOG_UPDATE_PREFERENCES_SIGNAL], 0, preferences);
	_g_object_unref0 (preferences);
	_g_free0 (pHighlightColor);
	_g_free0 (pBackgroundColor);
	_g_free0 (pFontColor);
	_g_free0 (pFont);
}


void moserial_preferences_dialog_show (moserialPreferencesDialog* self, Preferences* preferences, gboolean recording) {
	Preferences* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GtkFontButton* _tmp7_;
	Preferences* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	GtkColorButton* _tmp11_;
	Preferences* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	GdkColor _tmp15_ = {0};
	GtkColorButton* _tmp16_;
	Preferences* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	GdkColor _tmp20_ = {0};
	GtkColorButton* _tmp21_;
	Preferences* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	GdkColor _tmp25_ = {0};
	Preferences* _tmp26_;
	gboolean _tmp27_;
	gboolean _tmp28_;
	Preferences* _tmp31_;
	gboolean _tmp32_;
	gboolean _tmp33_;
	gboolean _tmp38_;
	GtkSpinButton* _tmp42_;
	Preferences* _tmp43_;
	gint _tmp44_;
	gint _tmp45_;
	GtkDialog* _tmp46_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (preferences != NULL);
	_tmp0_ = preferences;
	_tmp1_ = preferences_get_useSystemMonospaceFont (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkFontButton* _tmp3_;
		GtkCheckButton* _tmp4_;
		_tmp3_ = self->priv->fontButton;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, FALSE);
		_tmp4_ = self->priv->systemFont;
		gtk_toggle_button_set_active ((GtkToggleButton*) _tmp4_, TRUE);
	} else {
		GtkFontButton* _tmp5_;
		GtkCheckButton* _tmp6_;
		_tmp5_ = self->priv->fontButton;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp5_, TRUE);
		_tmp6_ = self->priv->systemFont;
		gtk_toggle_button_set_active ((GtkToggleButton*) _tmp6_, FALSE);
	}
	_tmp7_ = self->priv->fontButton;
	_tmp8_ = preferences;
	_tmp9_ = preferences_get_font (_tmp8_);
	_tmp10_ = _tmp9_;
	gtk_font_button_set_font_name (_tmp7_, _tmp10_);
	_tmp11_ = self->priv->fontColorButton;
	_tmp12_ = preferences;
	_tmp13_ = preferences_get_fontColor (_tmp12_);
	_tmp14_ = _tmp13_;
	preferences_getGdkColor (_tmp14_, &_tmp15_);
	gtk_color_button_set_color (_tmp11_, &_tmp15_);
	_tmp16_ = self->priv->backgroundColorButton;
	_tmp17_ = preferences;
	_tmp18_ = preferences_get_backgroundColor (_tmp17_);
	_tmp19_ = _tmp18_;
	preferences_getGdkColor (_tmp19_, &_tmp20_);
	gtk_color_button_set_color (_tmp16_, &_tmp20_);
	_tmp21_ = self->priv->highlightColorButton;
	_tmp22_ = preferences;
	_tmp23_ = preferences_get_highlightColor (_tmp22_);
	_tmp24_ = _tmp23_;
	preferences_getGdkColor (_tmp24_, &_tmp25_);
	gtk_color_button_set_color (_tmp21_, &_tmp25_);
	_tmp26_ = preferences;
	_tmp27_ = preferences_get_recordLaunch (_tmp26_);
	_tmp28_ = _tmp27_;
	if (_tmp28_) {
		GtkCheckButton* _tmp29_;
		_tmp29_ = self->priv->recordLaunch;
		gtk_toggle_button_set_active ((GtkToggleButton*) _tmp29_, TRUE);
	} else {
		GtkCheckButton* _tmp30_;
		_tmp30_ = self->priv->recordLaunch;
		gtk_toggle_button_set_active ((GtkToggleButton*) _tmp30_, FALSE);
	}
	_tmp31_ = preferences;
	_tmp32_ = preferences_get_enableTimeout (_tmp31_);
	_tmp33_ = _tmp32_;
	if (_tmp33_) {
		GtkCheckButton* _tmp34_;
		GtkSpinButton* _tmp35_;
		_tmp34_ = self->priv->enableTimeout;
		gtk_toggle_button_set_active ((GtkToggleButton*) _tmp34_, TRUE);
		_tmp35_ = self->priv->timeout;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp35_, TRUE);
	} else {
		GtkCheckButton* _tmp36_;
		GtkSpinButton* _tmp37_;
		_tmp36_ = self->priv->enableTimeout;
		gtk_toggle_button_set_active ((GtkToggleButton*) _tmp36_, FALSE);
		_tmp37_ = self->priv->timeout;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp37_, FALSE);
	}
	_tmp38_ = recording;
	if (_tmp38_) {
		GtkCheckButton* _tmp39_;
		GtkSpinButton* _tmp40_;
		_tmp39_ = self->priv->enableTimeout;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp39_, FALSE);
		_tmp40_ = self->priv->timeout;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp40_, FALSE);
	} else {
		GtkCheckButton* _tmp41_;
		_tmp41_ = self->priv->enableTimeout;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp41_, TRUE);
	}
	_tmp42_ = self->priv->timeout;
	_tmp43_ = preferences;
	_tmp44_ = preferences_get_timeout (_tmp43_);
	_tmp45_ = _tmp44_;
	gtk_spin_button_set_value (_tmp42_, (gdouble) _tmp45_);
	_tmp46_ = self->priv->dialog;
	gtk_widget_show_all ((GtkWidget*) _tmp46_);
}


void moserial_preferences_dialog_cancel (moserialPreferencesDialog* self, GtkWidget* w) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (w != NULL);
	moserial_preferences_dialog_hide (self);
}


gboolean moserial_preferences_dialog_hide (moserialPreferencesDialog* self) {
	gboolean result = FALSE;
	GtkDialog* _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->dialog;
	gtk_widget_hide ((GtkWidget*) _tmp0_);
	result = TRUE;
	return result;
}


void moserial_preferences_dialog_systemFontToggled (moserialPreferencesDialog* self, GtkToggleButton* button) {
	GtkToggleButton* _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = button;
	_tmp1_ = gtk_toggle_button_get_active (_tmp0_);
	if (_tmp1_) {
		GtkFontButton* _tmp2_;
		_tmp2_ = self->priv->fontButton;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp2_, FALSE);
	} else {
		GtkFontButton* _tmp3_;
		_tmp3_ = self->priv->fontButton;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, TRUE);
	}
}


void moserial_preferences_dialog_enableTimeoutToggled (moserialPreferencesDialog* self, GtkToggleButton* button) {
	GtkToggleButton* _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = button;
	_tmp1_ = gtk_toggle_button_get_active (_tmp0_);
	if (_tmp1_) {
		GtkSpinButton* _tmp2_;
		_tmp2_ = self->priv->timeout;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp2_, TRUE);
	} else {
		GtkSpinButton* _tmp3_;
		_tmp3_ = self->priv->timeout;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, FALSE);
	}
}


moserialPreferencesDialog* moserial_preferences_dialog_construct (GType object_type) {
	moserialPreferencesDialog * self = NULL;
	self = (moserialPreferencesDialog*) g_object_new (object_type, NULL);
	return self;
}


moserialPreferencesDialog* moserial_preferences_dialog_new (void) {
	return moserial_preferences_dialog_construct (MOSERIAL_TYPE_PREFERENCES_DIALOG);
}


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


static void _moserial_preferences_dialog_systemFontToggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	moserial_preferences_dialog_systemFontToggled ((moserialPreferencesDialog*) self, _sender);
}


static void _moserial_preferences_dialog_enableTimeoutToggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	moserial_preferences_dialog_enableTimeoutToggled ((moserialPreferencesDialog*) self, _sender);
}


static void _moserial_preferences_dialog_ok_gtk_button_clicked (GtkButton* _sender, gpointer self) {
	moserial_preferences_dialog_ok ((moserialPreferencesDialog*) self, _sender);
}


static void _moserial_preferences_dialog_cancel_gtk_button_clicked (GtkButton* _sender, gpointer self) {
	moserial_preferences_dialog_cancel ((moserialPreferencesDialog*) self, _sender);
}


static gboolean _moserial_preferences_dialog_hide_gtk_widget_delete_event (GtkWidget* _sender, GdkEventAny* event, gpointer self) {
	gboolean result;
	result = moserial_preferences_dialog_hide ((moserialPreferencesDialog*) self);
	return result;
}


static GObject * moserial_preferences_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	moserialPreferencesDialog * self;
	GtkBuilder* builder = NULL;
	GtkBuilder* _tmp0_;
	GtkBuilder* _tmp1_;
	GObject* _tmp2_;
	GtkDialog* _tmp3_;
	GtkBuilder* _tmp4_;
	GObject* _tmp5_;
	GtkButton* _tmp6_;
	GtkBuilder* _tmp7_;
	GObject* _tmp8_;
	GtkButton* _tmp9_;
	GtkBuilder* _tmp10_;
	GObject* _tmp11_;
	GtkCheckButton* _tmp12_;
	GtkBuilder* _tmp13_;
	GObject* _tmp14_;
	GtkFontButton* _tmp15_;
	GtkBuilder* _tmp16_;
	GObject* _tmp17_;
	GtkColorButton* _tmp18_;
	GtkBuilder* _tmp19_;
	GObject* _tmp20_;
	GtkColorButton* _tmp21_;
	GtkBuilder* _tmp22_;
	GObject* _tmp23_;
	GtkColorButton* _tmp24_;
	GtkBuilder* _tmp25_;
	GObject* _tmp26_;
	GtkCheckButton* _tmp27_;
	GtkCheckButton* _tmp28_;
	GtkBuilder* _tmp29_;
	GObject* _tmp30_;
	GtkCheckButton* _tmp31_;
	GtkCheckButton* _tmp32_;
	GtkBuilder* _tmp33_;
	GObject* _tmp34_;
	GtkSpinButton* _tmp35_;
	GtkSpinButton* _tmp36_;
	GtkAdjustment* _tmp37_;
	GtkAdjustment* _tmp38_;
	GtkSpinButton* _tmp39_;
	GtkAdjustment* _tmp40_;
	GtkAdjustment* _tmp41_;
	GtkSpinButton* _tmp42_;
	GtkAdjustment* _tmp43_;
	GtkAdjustment* _tmp44_;
	GtkSpinButton* _tmp45_;
	GtkAdjustment* _tmp46_;
	GtkAdjustment* _tmp47_;
	GtkCheckButton* _tmp48_;
	GtkCheckButton* _tmp49_;
	GtkButton* _tmp50_;
	GtkButton* _tmp51_;
	GtkDialog* _tmp52_;
	parent_class = G_OBJECT_CLASS (moserial_preferences_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MOSERIAL_TYPE_PREFERENCES_DIALOG, moserialPreferencesDialog);
	_tmp0_ = gtk_builder_new_from_resource (UIROOT "preferences.ui");
	builder = _tmp0_;
	_tmp1_ = builder;
	_tmp2_ = gtk_builder_get_object (_tmp1_, "preferences_dialog");
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_dialog_get_type (), GtkDialog));
	_g_object_unref0 (self->priv->dialog);
	self->priv->dialog = _tmp3_;
	_tmp4_ = builder;
	_tmp5_ = gtk_builder_get_object (_tmp4_, "preferences_ok");
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, gtk_button_get_type (), GtkButton));
	_g_object_unref0 (self->priv->okButton);
	self->priv->okButton = _tmp6_;
	_tmp7_ = builder;
	_tmp8_ = gtk_builder_get_object (_tmp7_, "preferences_cancel");
	_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, gtk_button_get_type (), GtkButton));
	_g_object_unref0 (self->priv->cancelButton);
	self->priv->cancelButton = _tmp9_;
	_tmp10_ = builder;
	_tmp11_ = gtk_builder_get_object (_tmp10_, "preferences_use_system_font");
	_tmp12_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, gtk_check_button_get_type (), GtkCheckButton));
	_g_object_unref0 (self->priv->systemFont);
	self->priv->systemFont = _tmp12_;
	_tmp13_ = builder;
	_tmp14_ = gtk_builder_get_object (_tmp13_, "preferences_font_button");
	_tmp15_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, gtk_font_button_get_type (), GtkFontButton));
	_g_object_unref0 (self->priv->fontButton);
	self->priv->fontButton = _tmp15_;
	_tmp16_ = builder;
	_tmp17_ = gtk_builder_get_object (_tmp16_, "preferences_font_color_button");
	_tmp18_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, gtk_color_button_get_type (), GtkColorButton));
	_g_object_unref0 (self->priv->fontColorButton);
	self->priv->fontColorButton = _tmp18_;
	_tmp19_ = builder;
	_tmp20_ = gtk_builder_get_object (_tmp19_, "preferences_background_color_button");
	_tmp21_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, gtk_color_button_get_type (), GtkColorButton));
	_g_object_unref0 (self->priv->backgroundColorButton);
	self->priv->backgroundColorButton = _tmp21_;
	_tmp22_ = builder;
	_tmp23_ = gtk_builder_get_object (_tmp22_, "preferences_highlight_color_button");
	_tmp24_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp23_, gtk_color_button_get_type (), GtkColorButton));
	_g_object_unref0 (self->priv->highlightColorButton);
	self->priv->highlightColorButton = _tmp24_;
	_tmp25_ = builder;
	_tmp26_ = gtk_builder_get_object (_tmp25_, "preferences_record_launch");
	_tmp27_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, gtk_check_button_get_type (), GtkCheckButton));
	_g_object_unref0 (self->priv->recordLaunch);
	self->priv->recordLaunch = _tmp27_;
	_tmp28_ = self->priv->recordLaunch;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp28_, _ ("If this option is enabled, a recorded file will be opened immediately " \
"after it is saved, using the default application for the file type. Th" \
"e default application is defined by the desktop environment."));
	_tmp29_ = builder;
	_tmp30_ = gtk_builder_get_object (_tmp29_, "preferences_record_enable_timeout");
	_tmp31_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp30_, gtk_check_button_get_type (), GtkCheckButton));
	_g_object_unref0 (self->priv->enableTimeout);
	self->priv->enableTimeout = _tmp31_;
	_tmp32_ = self->priv->enableTimeout;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp32_, _ ("If this option is enabled, recording will be automatically stopped aft" \
"er an adjustable period of inactivity after receiving some data. Moser" \
"ial will wait indefinitely to record the first data byte before activa" \
"ting the inactivity timer."));
	_tmp33_ = builder;
	_tmp34_ = gtk_builder_get_object (_tmp33_, "preferences_record_timeout");
	_tmp35_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp34_, gtk_spin_button_get_type (), GtkSpinButton));
	_g_object_unref0 (self->priv->timeout);
	self->priv->timeout = _tmp35_;
	_tmp36_ = self->priv->timeout;
	_tmp37_ = gtk_spin_button_get_adjustment (_tmp36_);
	_tmp38_ = _tmp37_;
	gtk_adjustment_set_lower (_tmp38_, (gdouble) 0);
	_tmp39_ = self->priv->timeout;
	_tmp40_ = gtk_spin_button_get_adjustment (_tmp39_);
	_tmp41_ = _tmp40_;
	gtk_adjustment_set_upper (_tmp41_, (gdouble) 600);
	_tmp42_ = self->priv->timeout;
	_tmp43_ = gtk_spin_button_get_adjustment (_tmp42_);
	_tmp44_ = _tmp43_;
	gtk_adjustment_set_step_increment (_tmp44_, (gdouble) 1);
	_tmp45_ = self->priv->timeout;
	_tmp46_ = gtk_spin_button_get_adjustment (_tmp45_);
	_tmp47_ = _tmp46_;
	gtk_adjustment_set_page_increment (_tmp47_, (gdouble) 60);
	_tmp48_ = self->priv->systemFont;
	g_signal_connect_object ((GtkToggleButton*) _tmp48_, "toggled", (GCallback) _moserial_preferences_dialog_systemFontToggled_gtk_toggle_button_toggled, self, 0);
	_tmp49_ = self->priv->enableTimeout;
	g_signal_connect_object ((GtkToggleButton*) _tmp49_, "toggled", (GCallback) _moserial_preferences_dialog_enableTimeoutToggled_gtk_toggle_button_toggled, self, 0);
	_tmp50_ = self->priv->okButton;
	g_signal_connect_object (_tmp50_, "clicked", (GCallback) _moserial_preferences_dialog_ok_gtk_button_clicked, self, 0);
	_tmp51_ = self->priv->cancelButton;
	g_signal_connect_object (_tmp51_, "clicked", (GCallback) _moserial_preferences_dialog_cancel_gtk_button_clicked, self, 0);
	_tmp52_ = self->priv->dialog;
	g_signal_connect_object ((GtkWidget*) _tmp52_, "delete-event", (GCallback) _moserial_preferences_dialog_hide_gtk_widget_delete_event, self, 0);
	_g_object_unref0 (builder);
	return obj;
}


static void moserial_preferences_dialog_class_init (moserialPreferencesDialogClass * klass) {
	moserial_preferences_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (moserialPreferencesDialogPrivate));
	G_OBJECT_CLASS (klass)->constructor = moserial_preferences_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = moserial_preferences_dialog_finalize;
	moserial_preferences_dialog_signals[MOSERIAL_PREFERENCES_DIALOG_UPDATE_PREFERENCES_SIGNAL] = g_signal_new ("update-preferences", MOSERIAL_TYPE_PREFERENCES_DIALOG, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, TYPE_PREFERENCES);
}


static void moserial_preferences_dialog_instance_init (moserialPreferencesDialog * self) {
	self->priv = MOSERIAL_PREFERENCES_DIALOG_GET_PRIVATE (self);
}


static void moserial_preferences_dialog_finalize (GObject * obj) {
	moserialPreferencesDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MOSERIAL_TYPE_PREFERENCES_DIALOG, moserialPreferencesDialog);
	_g_object_unref0 (self->priv->dialog);
	_g_object_unref0 (self->priv->cancelButton);
	_g_object_unref0 (self->priv->okButton);
	_g_object_unref0 (self->priv->systemFont);
	_g_object_unref0 (self->priv->fontButton);
	_g_object_unref0 (self->priv->fontColorButton);
	_g_object_unref0 (self->priv->backgroundColorButton);
	_g_object_unref0 (self->priv->highlightColorButton);
	_g_object_unref0 (self->priv->recordLaunch);
	_g_object_unref0 (self->priv->enableTimeout);
	_g_object_unref0 (self->priv->timeout);
	G_OBJECT_CLASS (moserial_preferences_dialog_parent_class)->finalize (obj);
}


GType moserial_preferences_dialog_get_type (void) {
	static volatile gsize moserial_preferences_dialog_type_id__volatile = 0;
	if (g_once_init_enter (&moserial_preferences_dialog_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (moserialPreferencesDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) moserial_preferences_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (moserialPreferencesDialog), 0, (GInstanceInitFunc) moserial_preferences_dialog_instance_init, NULL };
		GType moserial_preferences_dialog_type_id;
		moserial_preferences_dialog_type_id = g_type_register_static (G_TYPE_OBJECT, "moserialPreferencesDialog", &g_define_type_info, 0);
		g_once_init_leave (&moserial_preferences_dialog_type_id__volatile, moserial_preferences_dialog_type_id);
	}
	return moserial_preferences_dialog_type_id__volatile;
}



