/* MainWindow.c generated by valac 0.38.4, the Vala compiler
 * generated from MainWindow.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 <glib/gi18n-lib.h>
#include <stdio.h>
#include <pango/pango.h>
#include <gdk/gdk.h>
#include <config.h>


#define MOSERIAL_TYPE_MAIN_WINDOW (moserial_main_window_get_type ())
#define MOSERIAL_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOSERIAL_TYPE_MAIN_WINDOW, moserialMainWindow))
#define MOSERIAL_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOSERIAL_TYPE_MAIN_WINDOW, moserialMainWindowClass))
#define MOSERIAL_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOSERIAL_TYPE_MAIN_WINDOW))
#define MOSERIAL_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOSERIAL_TYPE_MAIN_WINDOW))
#define MOSERIAL_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOSERIAL_TYPE_MAIN_WINDOW, moserialMainWindowClass))

typedef struct _moserialMainWindow moserialMainWindow;
typedef struct _moserialMainWindowClass moserialMainWindowClass;
typedef struct _moserialMainWindowPrivate moserialMainWindowPrivate;

#define MOSERIAL_TYPE_SETTINGS_DIALOG (moserial_settings_dialog_get_type ())
#define MOSERIAL_SETTINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOSERIAL_TYPE_SETTINGS_DIALOG, moserialSettingsDialog))
#define MOSERIAL_SETTINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOSERIAL_TYPE_SETTINGS_DIALOG, moserialSettingsDialogClass))
#define MOSERIAL_IS_SETTINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOSERIAL_TYPE_SETTINGS_DIALOG))
#define MOSERIAL_IS_SETTINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOSERIAL_TYPE_SETTINGS_DIALOG))
#define MOSERIAL_SETTINGS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOSERIAL_TYPE_SETTINGS_DIALOG, moserialSettingsDialogClass))

typedef struct _moserialSettingsDialog moserialSettingsDialog;
typedef struct _moserialSettingsDialogClass moserialSettingsDialogClass;

#define TYPE_SETTINGS (settings_get_type ())
#define SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SETTINGS, Settings))
#define SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SETTINGS, SettingsClass))
#define IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SETTINGS))
#define IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SETTINGS))
#define SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SETTINGS, SettingsClass))

typedef struct _Settings Settings;
typedef struct _SettingsClass SettingsClass;

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

#define TYPE_DEFAULT_PATHS (default_paths_get_type ())
#define DEFAULT_PATHS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DEFAULT_PATHS, DefaultPaths))
#define DEFAULT_PATHS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DEFAULT_PATHS, DefaultPathsClass))
#define IS_DEFAULT_PATHS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DEFAULT_PATHS))
#define IS_DEFAULT_PATHS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DEFAULT_PATHS))
#define DEFAULT_PATHS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DEFAULT_PATHS, DefaultPathsClass))

typedef struct _DefaultPaths DefaultPaths;
typedef struct _DefaultPathsClass DefaultPathsClass;

#define MOSERIAL_TYPE_SEND_PROGRESS_DIALOG (moserial_send_progress_dialog_get_type ())
#define MOSERIAL_SEND_PROGRESS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOSERIAL_TYPE_SEND_PROGRESS_DIALOG, moserialSendProgressDialog))
#define MOSERIAL_SEND_PROGRESS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOSERIAL_TYPE_SEND_PROGRESS_DIALOG, moserialSendProgressDialogClass))
#define MOSERIAL_IS_SEND_PROGRESS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOSERIAL_TYPE_SEND_PROGRESS_DIALOG))
#define MOSERIAL_IS_SEND_PROGRESS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOSERIAL_TYPE_SEND_PROGRESS_DIALOG))
#define MOSERIAL_SEND_PROGRESS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOSERIAL_TYPE_SEND_PROGRESS_DIALOG, moserialSendProgressDialogClass))

typedef struct _moserialSendProgressDialog moserialSendProgressDialog;
typedef struct _moserialSendProgressDialogClass moserialSendProgressDialogClass;

#define MOSERIAL_TYPE_SEND_CHOOSER_DIALOG (moserial_send_chooser_dialog_get_type ())
#define MOSERIAL_SEND_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOSERIAL_TYPE_SEND_CHOOSER_DIALOG, moserialSendChooserDialog))
#define MOSERIAL_SEND_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOSERIAL_TYPE_SEND_CHOOSER_DIALOG, moserialSendChooserDialogClass))
#define MOSERIAL_IS_SEND_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOSERIAL_TYPE_SEND_CHOOSER_DIALOG))
#define MOSERIAL_IS_SEND_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOSERIAL_TYPE_SEND_CHOOSER_DIALOG))
#define MOSERIAL_SEND_CHOOSER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOSERIAL_TYPE_SEND_CHOOSER_DIALOG, moserialSendChooserDialogClass))

typedef struct _moserialSendChooserDialog moserialSendChooserDialog;
typedef struct _moserialSendChooserDialogClass moserialSendChooserDialogClass;

#define MOSERIAL_TYPE_RECEIVE_PROGRESS_DIALOG (moserial_receive_progress_dialog_get_type ())
#define MOSERIAL_RECEIVE_PROGRESS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOSERIAL_TYPE_RECEIVE_PROGRESS_DIALOG, moserialReceiveProgressDialog))
#define MOSERIAL_RECEIVE_PROGRESS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOSERIAL_TYPE_RECEIVE_PROGRESS_DIALOG, moserialReceiveProgressDialogClass))
#define MOSERIAL_IS_RECEIVE_PROGRESS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOSERIAL_TYPE_RECEIVE_PROGRESS_DIALOG))
#define MOSERIAL_IS_RECEIVE_PROGRESS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOSERIAL_TYPE_RECEIVE_PROGRESS_DIALOG))
#define MOSERIAL_RECEIVE_PROGRESS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOSERIAL_TYPE_RECEIVE_PROGRESS_DIALOG, moserialReceiveProgressDialogClass))

typedef struct _moserialReceiveProgressDialog moserialReceiveProgressDialog;
typedef struct _moserialReceiveProgressDialogClass moserialReceiveProgressDialogClass;

#define MOSERIAL_TYPE_RECEIVE_CHOOSER_DIALOG (moserial_receive_chooser_dialog_get_type ())
#define MOSERIAL_RECEIVE_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOSERIAL_TYPE_RECEIVE_CHOOSER_DIALOG, moserialReceiveChooserDialog))
#define MOSERIAL_RECEIVE_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOSERIAL_TYPE_RECEIVE_CHOOSER_DIALOG, moserialReceiveChooserDialogClass))
#define MOSERIAL_IS_RECEIVE_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOSERIAL_TYPE_RECEIVE_CHOOSER_DIALOG))
#define MOSERIAL_IS_RECEIVE_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOSERIAL_TYPE_RECEIVE_CHOOSER_DIALOG))
#define MOSERIAL_RECEIVE_CHOOSER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOSERIAL_TYPE_RECEIVE_CHOOSER_DIALOG, moserialReceiveChooserDialogClass))

typedef struct _moserialReceiveChooserDialog moserialReceiveChooserDialog;
typedef struct _moserialReceiveChooserDialogClass moserialReceiveChooserDialogClass;

#define MOSERIAL_TYPE_RECORD_DIALOG (moserial_record_dialog_get_type ())
#define MOSERIAL_RECORD_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOSERIAL_TYPE_RECORD_DIALOG, moserialRecordDialog))
#define MOSERIAL_RECORD_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOSERIAL_TYPE_RECORD_DIALOG, moserialRecordDialogClass))
#define MOSERIAL_IS_RECORD_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOSERIAL_TYPE_RECORD_DIALOG))
#define MOSERIAL_IS_RECORD_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOSERIAL_TYPE_RECORD_DIALOG))
#define MOSERIAL_RECORD_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOSERIAL_TYPE_RECORD_DIALOG, moserialRecordDialogClass))

typedef struct _moserialRecordDialog moserialRecordDialog;
typedef struct _moserialRecordDialogClass moserialRecordDialogClass;

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

#define MOSERIAL_TYPE_SERIAL_CONNECTION (moserial_serial_connection_get_type ())
#define MOSERIAL_SERIAL_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOSERIAL_TYPE_SERIAL_CONNECTION, moserialSerialConnection))
#define MOSERIAL_SERIAL_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOSERIAL_TYPE_SERIAL_CONNECTION, moserialSerialConnectionClass))
#define MOSERIAL_IS_SERIAL_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOSERIAL_TYPE_SERIAL_CONNECTION))
#define MOSERIAL_IS_SERIAL_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOSERIAL_TYPE_SERIAL_CONNECTION))
#define MOSERIAL_SERIAL_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOSERIAL_TYPE_SERIAL_CONNECTION, moserialSerialConnectionClass))

typedef struct _moserialSerialConnection moserialSerialConnection;
typedef struct _moserialSerialConnectionClass moserialSerialConnectionClass;

#define MOSERIAL_TYPE_HEX_TEXT_BUFFER (moserial_hex_text_buffer_get_type ())
#define MOSERIAL_HEX_TEXT_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOSERIAL_TYPE_HEX_TEXT_BUFFER, moserialHexTextBuffer))
#define MOSERIAL_HEX_TEXT_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOSERIAL_TYPE_HEX_TEXT_BUFFER, moserialHexTextBufferClass))
#define MOSERIAL_IS_HEX_TEXT_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOSERIAL_TYPE_HEX_TEXT_BUFFER))
#define MOSERIAL_IS_HEX_TEXT_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOSERIAL_TYPE_HEX_TEXT_BUFFER))
#define MOSERIAL_HEX_TEXT_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOSERIAL_TYPE_HEX_TEXT_BUFFER, moserialHexTextBufferClass))

typedef struct _moserialHexTextBuffer moserialHexTextBuffer;
typedef struct _moserialHexTextBufferClass moserialHexTextBufferClass;

#define MOSERIAL_TYPE_XMODEM_FILENAME_DIALOG (moserial_xmodem_filename_dialog_get_type ())
#define MOSERIAL_XMODEM_FILENAME_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOSERIAL_TYPE_XMODEM_FILENAME_DIALOG, moserialXmodemFilenameDialog))
#define MOSERIAL_XMODEM_FILENAME_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOSERIAL_TYPE_XMODEM_FILENAME_DIALOG, moserialXmodemFilenameDialogClass))
#define MOSERIAL_IS_XMODEM_FILENAME_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOSERIAL_TYPE_XMODEM_FILENAME_DIALOG))
#define MOSERIAL_IS_XMODEM_FILENAME_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOSERIAL_TYPE_XMODEM_FILENAME_DIALOG))
#define MOSERIAL_XMODEM_FILENAME_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOSERIAL_TYPE_XMODEM_FILENAME_DIALOG, moserialXmodemFilenameDialogClass))

typedef struct _moserialXmodemFilenameDialog moserialXmodemFilenameDialog;
typedef struct _moserialXmodemFilenameDialogClass moserialXmodemFilenameDialogClass;

#define MOSERIAL_TYPE_SERIAL_STREAM_RECORDER (moserial_serial_stream_recorder_get_type ())
#define MOSERIAL_SERIAL_STREAM_RECORDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOSERIAL_TYPE_SERIAL_STREAM_RECORDER, moserialSerialStreamRecorder))
#define MOSERIAL_SERIAL_STREAM_RECORDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOSERIAL_TYPE_SERIAL_STREAM_RECORDER, moserialSerialStreamRecorderClass))
#define MOSERIAL_IS_SERIAL_STREAM_RECORDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOSERIAL_TYPE_SERIAL_STREAM_RECORDER))
#define MOSERIAL_IS_SERIAL_STREAM_RECORDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOSERIAL_TYPE_SERIAL_STREAM_RECORDER))
#define MOSERIAL_SERIAL_STREAM_RECORDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOSERIAL_TYPE_SERIAL_STREAM_RECORDER, moserialSerialStreamRecorderClass))

typedef struct _moserialSerialStreamRecorder moserialSerialStreamRecorder;
typedef struct _moserialSerialStreamRecorderClass moserialSerialStreamRecorderClass;

#define MOSERIAL_TYPE_RZWRAPPER (moserial_rzwrapper_get_type ())
#define MOSERIAL_RZWRAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOSERIAL_TYPE_RZWRAPPER, moserialRzwrapper))
#define MOSERIAL_RZWRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOSERIAL_TYPE_RZWRAPPER, moserialRzwrapperClass))
#define MOSERIAL_IS_RZWRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOSERIAL_TYPE_RZWRAPPER))
#define MOSERIAL_IS_RZWRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOSERIAL_TYPE_RZWRAPPER))
#define MOSERIAL_RZWRAPPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOSERIAL_TYPE_RZWRAPPER, moserialRzwrapperClass))

typedef struct _moserialRzwrapper moserialRzwrapper;
typedef struct _moserialRzwrapperClass moserialRzwrapperClass;

#define MOSERIAL_TYPE_SZWRAPPER (moserial_szwrapper_get_type ())
#define MOSERIAL_SZWRAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOSERIAL_TYPE_SZWRAPPER, moserialSzwrapper))
#define MOSERIAL_SZWRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOSERIAL_TYPE_SZWRAPPER, moserialSzwrapperClass))
#define MOSERIAL_IS_SZWRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOSERIAL_TYPE_SZWRAPPER))
#define MOSERIAL_IS_SZWRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOSERIAL_TYPE_SZWRAPPER))
#define MOSERIAL_SZWRAPPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOSERIAL_TYPE_SZWRAPPER, moserialSzwrapperClass))

typedef struct _moserialSzwrapper moserialSzwrapper;
typedef struct _moserialSzwrapperClass moserialSzwrapperClass;

#define TYPE_PROFILE (profile_get_type ())
#define PROFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PROFILE, Profile))
#define PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PROFILE, ProfileClass))
#define IS_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PROFILE))
#define IS_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PROFILE))
#define PROFILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PROFILE, ProfileClass))

typedef struct _Profile Profile;
typedef struct _ProfileClass ProfileClass;
enum  {
	MOSERIAL_MAIN_WINDOW_0_PROPERTY,
	MOSERIAL_MAIN_WINDOW_STARTUP_PROFILE_FILENAME_PROPERTY,
	MOSERIAL_MAIN_WINDOW_NUM_PROPERTIES
};
static GParamSpec* moserial_main_window_properties[MOSERIAL_MAIN_WINDOW_NUM_PROPERTIES];

#define MOSERIAL_MAIN_WINDOW_TYPE_INPUT_MODE_VALUES (moserial_main_window_input_mode_values_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _moserial_serial_stream_recorder_unref0(var) ((var == NULL) ? NULL : (var = (moserial_serial_stream_recorder_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
typedef struct _moserialSerialConnectionPrivate moserialSerialConnectionPrivate;

#define MOSERIAL_SZWRAPPER_TYPE_PROTOCOL (moserial_szwrapper_protocol_get_type ())
typedef struct _moserialSendChooserDialogPrivate moserialSendChooserDialogPrivate;
typedef struct _moserialSzwrapperPrivate moserialSzwrapperPrivate;
typedef struct _moserialReceiveChooserDialogPrivate moserialReceiveChooserDialogPrivate;
typedef struct _moserialXmodemFilenameDialogPrivate moserialXmodemFilenameDialogPrivate;

#define MOSERIAL_RZWRAPPER_TYPE_PROTOCOL (moserial_rzwrapper_protocol_get_type ())
typedef struct _moserialRzwrapperPrivate moserialRzwrapperPrivate;

#define MOSERIAL_SERIAL_STREAM_RECORDER_TYPE_DIRECTION (moserial_serial_stream_recorder_direction_get_type ())
#define __vala_PangoFontDescription_free0(var) ((var == NULL) ? NULL : (var = (_vala_PangoFontDescription_free (var), NULL)))

#define MOSERIAL_SERIAL_CONNECTION_TYPE_LINE_END (moserial_serial_connection_line_end_get_type ())

struct _moserialMainWindow {
	GtkWindow parent_instance;
	moserialMainWindowPrivate * priv;
};

struct _moserialMainWindowClass {
	GtkWindowClass parent_class;
};

struct _moserialMainWindowPrivate {
	GtkWindow* gtkWindow;
	moserialSettingsDialog* settingsDialog;
	GtkToolButton* settingsButton;
	GtkToggleToolButton* recordButton;
	Settings* currentSettings;
	Preferences* currentPreferences;
	DefaultPaths* currentPaths;
	GtkStatusbar* statusbar;
	GtkStatusbar* bytecountbar;
	guint statusbarContext;
	guint bytecountbarContext;
	GtkToolButton* send;
	moserialSendProgressDialog* sendProgressDialog;
	moserialSendChooserDialog* sendChooserDialog;
	GtkToolButton* receive;
	moserialReceiveProgressDialog* receiveProgressDialog;
	moserialReceiveChooserDialog* receiveChooserDialog;
	moserialRecordDialog* recordDialog;
	moserialPreferencesDialog* preferencesDialog;
	moserialSerialConnection* serialConnection;
	GtkTextView* incomingHexTextView;
	GtkTextView* incomingAsciiTextView;
	GtkTextView* outgoingHexTextView;
	GtkTextView* outgoingAsciiTextView;
	GtkComboBox* inputModeCombo;
	GtkComboBox* lineEndModeCombo;
	GtkToggleToolButton* connectButton;
	GtkLabel* disconnectLabel;
	GtkLabel* connectLabel;
	GtkLabel* recordLabel;
	GtkLabel* stopRecordingLabel;
	GtkPaned* paned;
	GtkNotebook* incoming_notebook;
	GtkNotebook* outgoing_notebook;
	moserialHexTextBuffer* incomingHexTextBuffer;
	moserialHexTextBuffer* outgoingHexTextBuffer;
	GtkTextBuffer* incomingAsciiTextBuffer;
	GtkTextTag* echoTag;
	GtkTextBuffer* outgoingAsciiTextBuffer;
	GtkTextMark* echoStartMark;
	moserialXmodemFilenameDialog* xmodemFilenameDialog;
	GtkEntry* entry;
	GtkButton* sendButton;
	moserialSerialStreamRecorder* streamRecorder;
	gboolean recordDataReceived;
	guint recordTimeoutID;
	moserialRzwrapper* rz;
	moserialSzwrapper* sz;
	Profile* profile;
	gchar* _startupProfileFilename;
	gchar* profileFilename;
	gboolean profileChanged;
	GtkImageMenuItem* cutMenuItem;
	GtkImageMenuItem* copyMenuItem;
	GtkAdjustment* va1;
	GtkAdjustment* va2;
	GtkAdjustment* va3;
	GtkAdjustment* va4;
	GtkAccelGroup* ag;
	GtkRecentData recentData;
};

typedef enum  {
	MOSERIAL_MAIN_WINDOW_INPUT_MODE_VALUES_ASCII,
	MOSERIAL_MAIN_WINDOW_INPUT_MODE_VALUES_HEX
} moserialMainWindowinputModeValues;

struct _moserialSerialConnection {
	GObject parent_instance;
	moserialSerialConnectionPrivate * priv;
	gulong tx;
	gulong rx;
	gulong nonprintable;
	gboolean forced_hex_view;
	gboolean lastRxCharWasCR;
	gchar* echoReference;
	gchar* echoCompare;
};

struct _moserialSerialConnectionClass {
	GObjectClass parent_class;
};

typedef enum  {
	HEX_PARSE_ERROR_INVALID_INPUT
} HexParseError;
#define HEX_PARSE_ERROR hex_parse_error_quark ()
typedef enum  {
	MOSERIAL_SZWRAPPER_PROTOCOL_XMODEM,
	MOSERIAL_SZWRAPPER_PROTOCOL_YMODEM,
	MOSERIAL_SZWRAPPER_PROTOCOL_ZMODEM,
	MOSERIAL_SZWRAPPER_PROTOCOL_RAW,
	MOSERIAL_SZWRAPPER_PROTOCOL_NULL
} moserialSzwrapperProtocol;

struct _moserialSendChooserDialog {
	GObject parent_instance;
	moserialSendChooserDialogPrivate * priv;
	GtkComboBox* protocolCombo;
	gchar* filename;
};

struct _moserialSendChooserDialogClass {
	GObjectClass parent_class;
};

struct _moserialSzwrapper {
	GObject parent_instance;
	moserialSzwrapperPrivate * priv;
	gboolean running;
};

struct _moserialSzwrapperClass {
	GObjectClass parent_class;
};

struct _moserialReceiveChooserDialog {
	GObject parent_instance;
	moserialReceiveChooserDialogPrivate * priv;
	GtkComboBox* protocolCombo;
	gchar* path;
};

struct _moserialReceiveChooserDialogClass {
	GObjectClass parent_class;
};

struct _moserialXmodemFilenameDialog {
	GObject parent_instance;
	moserialXmodemFilenameDialogPrivate * priv;
	gchar* filename;
};

struct _moserialXmodemFilenameDialogClass {
	GObjectClass parent_class;
};

typedef enum  {
	MOSERIAL_RZWRAPPER_PROTOCOL_XMODEM,
	MOSERIAL_RZWRAPPER_PROTOCOL_YMODEM,
	MOSERIAL_RZWRAPPER_PROTOCOL_ZMODEM,
	MOSERIAL_RZWRAPPER_PROTOCOL_NULL
} moserialRzwrapperProtocol;

struct _moserialRzwrapper {
	GObject parent_instance;
	moserialRzwrapperPrivate * priv;
	gboolean running;
};

struct _moserialRzwrapperClass {
	GObjectClass parent_class;
};

typedef enum  {
	MOSERIAL_SERIAL_STREAM_RECORDER_DIRECTION_INCOMING,
	MOSERIAL_SERIAL_STREAM_RECORDER_DIRECTION_OUTGOING,
	MOSERIAL_SERIAL_STREAM_RECORDER_DIRECTION_BOTH
} moserialSerialStreamRecorderDirection;

typedef enum  {
	MOSERIAL_SERIAL_CONNECTION_LINE_END_CRLF,
	MOSERIAL_SERIAL_CONNECTION_LINE_END_CR,
	MOSERIAL_SERIAL_CONNECTION_LINE_END_LF,
	MOSERIAL_SERIAL_CONNECTION_LINE_END_TAB,
	MOSERIAL_SERIAL_CONNECTION_LINE_END_ESC,
	MOSERIAL_SERIAL_CONNECTION_LINE_END_NONE
} moserialSerialConnectionLineEnd;


static gpointer moserial_main_window_parent_class = NULL;

GType moserial_main_window_get_type (void) G_GNUC_CONST;
GType moserial_settings_dialog_get_type (void) G_GNUC_CONST;
GType settings_get_type (void) G_GNUC_CONST;
GType preferences_get_type (void) G_GNUC_CONST;
GType default_paths_get_type (void) G_GNUC_CONST;
GType moserial_send_progress_dialog_get_type (void) G_GNUC_CONST;
GType moserial_send_chooser_dialog_get_type (void) G_GNUC_CONST;
GType moserial_receive_progress_dialog_get_type (void) G_GNUC_CONST;
GType moserial_receive_chooser_dialog_get_type (void) G_GNUC_CONST;
GType moserial_record_dialog_get_type (void) G_GNUC_CONST;
GType moserial_preferences_dialog_get_type (void) G_GNUC_CONST;
GType moserial_serial_connection_get_type (void) G_GNUC_CONST;
GType moserial_hex_text_buffer_get_type (void) G_GNUC_CONST;
GType moserial_xmodem_filename_dialog_get_type (void) G_GNUC_CONST;
gpointer moserial_serial_stream_recorder_ref (gpointer instance);
void moserial_serial_stream_recorder_unref (gpointer instance);
GParamSpec* moserial_param_spec_serial_stream_recorder (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void moserial_value_set_serial_stream_recorder (GValue* value, gpointer v_object);
void moserial_value_take_serial_stream_recorder (GValue* value, gpointer v_object);
gpointer moserial_value_get_serial_stream_recorder (const GValue* value);
GType moserial_serial_stream_recorder_get_type (void) G_GNUC_CONST;
GType moserial_rzwrapper_get_type (void) G_GNUC_CONST;
GType moserial_szwrapper_get_type (void) G_GNUC_CONST;
GType profile_get_type (void) G_GNUC_CONST;
#define MOSERIAL_MAIN_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MOSERIAL_TYPE_MAIN_WINDOW, moserialMainWindowPrivate))
static GType moserial_main_window_input_mode_values_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
moserialSerialConnection* moserial_serial_connection_new (void);
moserialSerialConnection* moserial_serial_connection_construct (GType object_type);
moserialSerialStreamRecorder* moserial_serial_stream_recorder_new (void);
moserialSerialStreamRecorder* moserial_serial_stream_recorder_construct (GType object_type);
static void gtk_recent_data_destroy (GtkRecentData * self);
#define MOSERIAL_MAIN_WINDOW_translators N_ ("translator-credits")
#define MOSERIAL_MAIN_WINDOW_recentGroup "moserial-configs"
moserialMainWindow* moserial_main_window_new (const gchar* profileFilename);
moserialMainWindow* moserial_main_window_construct (GType object_type, const gchar* profileFilename);
static void moserial_main_window_applyProfile (moserialMainWindow* self, const gchar* filename);
gboolean profile_load (Profile* self, const gchar* filename, GtkWindow* window);
void moserial_main_window_ensureDisconnected (moserialMainWindow* self);
Settings* settings_loadFromProfile (Profile* profile);
Preferences* preferences_loadFromProfile (Profile* profile);
DefaultPaths* default_paths_loadFromProfile (Profile* profile);
static void moserial_main_window_updatePreferences (moserialMainWindow* self, moserialPreferencesDialog* d, Preferences* newPreferences);
gchar* settings_getStatusbarString (Settings* self, gboolean open);
static void moserial_main_window_setWindowTitle (moserialMainWindow* self, const gchar* recordingFilename);
static void moserial_main_window_recentItemOpen (moserialMainWindow* self, GtkRecentChooser* r);
static void moserial_main_window_insertBufferEnd (moserialMainWindow* self, GtkTextBuffer* buf, const gchar* s);
void moserial_main_window_sendString (moserialMainWindow* self, GtkWidget* w);
gboolean moserial_main_window_ensureConnected (moserialMainWindow* self);
void moserial_serial_connection_sendByte (moserialSerialConnection* self, guchar byte);
void moserial_serial_stream_recorder_writeOutgoing (moserialSerialStreamRecorder* self, guchar data);
void moserial_hex_text_buffer_add (moserialHexTextBuffer* self, guchar data);
GQuark hex_parse_error_quark (void);
guchar* input_parser_parseHex (const gchar* s, int* result_length1, GError** error);
gchar* moserial_serial_connection_getBytecountbarString (moserialSerialConnection* self);
static void moserial_main_window_doSendChooser (moserialMainWindow* self, GtkToolButton* button);
void moserial_send_chooser_dialog_show (moserialSendChooserDialog* self, const gchar* folder);
const gchar* default_paths_get_sendFrom (DefaultPaths* self);
static void moserial_main_window_doSend (moserialMainWindow* self, moserialSendChooserDialog* dialog);
GType moserial_szwrapper_protocol_get_type (void) G_GNUC_CONST;
gchar* mo_utils_getParentFolder (const gchar* path);
void default_paths_set_sendFrom (DefaultPaths* self, const gchar* value);
moserialSzwrapper* moserial_szwrapper_new (moserialSzwrapperProtocol* protocol, moserialSerialConnection* sc, const gchar* filename);
moserialSzwrapper* moserial_szwrapper_construct (GType object_type, moserialSzwrapperProtocol* protocol, moserialSerialConnection* sc, const gchar* filename);
void moserial_send_progress_dialog_show (moserialSendProgressDialog* self);
void moserial_send_progress_dialog_updateStatus (moserialSendProgressDialog* self, GObject* o, const gchar* newStatus);
static void _moserial_send_progress_dialog_updateStatus_moserial_szwrapper_update_status (moserialSzwrapper* _sender, const gchar* newStatus, gpointer self);
void moserial_szwrapper_transferCanceled (moserialSzwrapper* self, GObject* o);
static void _moserial_szwrapper_transferCanceled_moserial_send_progress_dialog_transfer_canceled (moserialSendProgressDialog* _sender, gpointer self);
void moserial_main_window_sendComplete (moserialMainWindow* self, GObject* o);
static void _moserial_main_window_sendComplete_moserial_szwrapper_transfer_complete (moserialSzwrapper* _sender, gpointer self);
gboolean moserial_send_progress_dialog_hide (moserialSendProgressDialog* self);
static void moserial_main_window_doReceiveChooser (moserialMainWindow* self, GtkToolButton* button);
void moserial_receive_chooser_dialog_show (moserialReceiveChooserDialog* self, const gchar* folder);
const gchar* default_paths_get_receiveTo (DefaultPaths* self);
static void moserial_main_window_doReceive (moserialMainWindow* self, moserialReceiveChooserDialog* dialog);
void default_paths_set_receiveTo (DefaultPaths* self, const gchar* value);
void moserial_xmodem_filename_dialog_show (moserialXmodemFilenameDialog* self);
GType moserial_rzwrapper_protocol_get_type (void) G_GNUC_CONST;
moserialRzwrapper* moserial_rzwrapper_new (moserialRzwrapperProtocol* protocol, moserialSerialConnection* sc, const gchar* p, const gchar* filename);
moserialRzwrapper* moserial_rzwrapper_construct (GType object_type, moserialRzwrapperProtocol* protocol, moserialSerialConnection* sc, const gchar* p, const gchar* filename);
void moserial_receive_progress_dialog_show (moserialReceiveProgressDialog* self);
void moserial_receive_progress_dialog_updateStatus (moserialReceiveProgressDialog* self, GObject* o, const gchar* newStatus);
static void _moserial_receive_progress_dialog_updateStatus_moserial_rzwrapper_update_status (moserialRzwrapper* _sender, const gchar* newStatus, gpointer self);
void moserial_rzwrapper_transferCanceled (moserialRzwrapper* self, GObject* o);
static void _moserial_rzwrapper_transferCanceled_moserial_receive_progress_dialog_transfer_canceled (moserialReceiveProgressDialog* _sender, gpointer self);
void moserial_main_window_receiveComplete (moserialMainWindow* self, GObject* o);
static void _moserial_main_window_receiveComplete_moserial_rzwrapper_transfer_complete (moserialRzwrapper* _sender, gpointer self);
gboolean moserial_receive_progress_dialog_hide (moserialReceiveProgressDialog* self);
void moserial_main_window_record (moserialMainWindow* self, GtkToggleToolButton* button);
void moserial_record_dialog_show (moserialRecordDialog* self, const gchar* folder);
const gchar* default_paths_get_recordTo (DefaultPaths* self);
void moserial_serial_stream_recorder_close (moserialSerialStreamRecorder* self, gboolean launch);
gboolean preferences_get_recordLaunch (Preferences* self);
void moserial_main_window_stopRecording (moserialMainWindow* self, moserialRecordDialog* dialog);
GType moserial_serial_stream_recorder_direction_get_type (void) G_GNUC_CONST;
void moserial_main_window_startRecording (moserialMainWindow* self, moserialRecordDialog* dialog, const gchar* filename, moserialSerialStreamRecorderDirection direction);
void moserial_serial_stream_recorder_open (moserialSerialStreamRecorder* self, const gchar* filename, moserialSerialStreamRecorderDirection direction, GError** error);
void default_paths_set_recordTo (DefaultPaths* self, const gchar* value);
gboolean moserial_main_window_recordTimeout (moserialMainWindow* self);
void moserial_main_window_showWindow (moserialMainWindow* self);
static void moserial_main_window_updateSettings (moserialMainWindow* self, moserialSettingsDialog* d, Settings* newSettings);
gboolean preferences_get_useSystemMonospaceFont (Preferences* self);
gchar* preferences_getSystemDefaultMonospaceFont (void);
const gchar* preferences_get_font (Preferences* self);
static void _vala_PangoFontDescription_free (PangoFontDescription* 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);
void moserial_hex_text_buffer_applyPreferences (moserialHexTextBuffer* self, Preferences* preferences);
static void moserial_main_window_showSettingsDialog (moserialMainWindow* self, GObject* o);
void moserial_settings_dialog_show (moserialSettingsDialog* self, Settings* settings);
static void moserial_main_window_showPreferencesDialog (moserialMainWindow* self, GObject* o);
void moserial_preferences_dialog_show (moserialPreferencesDialog* self, Preferences* preferences, gboolean recording);
static gboolean moserial_main_window_startConnection (moserialMainWindow* self);
gboolean moserial_serial_connection_doConnect (moserialSerialConnection* self, Settings* settings);
const gchar* settings_get_device (Settings* self);
void moserial_hex_text_buffer_clear (moserialHexTextBuffer* self);
static void moserial_main_window_updateIncoming (moserialMainWindow* self, moserialSerialConnection* sc, guchar* data, int data_length1, gint size);
static void _moserial_main_window_updateIncoming_moserial_serial_connection_new_data (moserialSerialConnection* _sender, guchar* data, int data_length1, gint size, gpointer self);
static void moserial_main_window_connectButtonClick (moserialMainWindow* self, GtkToggleToolButton* button);
void moserial_serial_connection_doDisconnect (moserialSerialConnection* self);
void moserial_rzwrapper_writeChar (moserialRzwrapper* self, guchar byte);
void moserial_rzwrapper_flush (moserialRzwrapper* self);
void moserial_szwrapper_writeChar (moserialSzwrapper* self, guchar byte);
gboolean preferences_get_enableTimeout (Preferences* self);
gint preferences_get_timeout (Preferences* self);
static gboolean _moserial_main_window_recordTimeout_gsource_func (gpointer self);
void moserial_serial_stream_recorder_writeIncoming (moserialSerialStreamRecorder* self, guchar* data, int data_length1);
static void moserial_main_window_inputModeChanged (moserialMainWindow* self, GtkComboBox* inputModeCombo);
static void moserial_main_window_showHelpButton (moserialMainWindow* self, GtkToolButton* button);
static void moserial_main_window_showHelp (moserialMainWindow* self);
static void moserial_main_window_showHelpAction (moserialMainWindow* self);
static void moserial_main_window_showAboutDialog (moserialMainWindow* self);
static void moserial_main_window_quitSizeSave (moserialMainWindow* self);
static void moserial_main_window_windowSizeSave (moserialMainWindow* self);
static void moserial_main_window_quitSave (moserialMainWindow* self);
static gboolean moserial_main_window_deleteSaveSize (moserialMainWindow* self);
static gboolean moserial_main_window_keyPress (moserialMainWindow* self, GtkWidget* widget, GdkEventKey* key);
void moserial_auto_scroll_scroll (GtkAdjustment* va);
void profile_saveWindowSize (Profile* self, gint w, gint h);
void profile_saveWindowPanedPosition (Profile* self, gint pos);
void preferences_saveToProfile (Preferences* self, Profile* profile);
void settings_saveToProfile (Settings* self, Profile* profile);
void default_paths_saveToProfile (DefaultPaths* self, Profile* profile);
static void moserial_main_window_saveProfile (moserialMainWindow* self);
void profile_save (Profile* self, const gchar* filename, GtkWindow* window);
static void moserial_main_window_saveProfileAs (moserialMainWindow* self);
static void moserial_main_window_loadProfileOnStartup (moserialMainWindow* self, const gchar* profileFilename);
static void moserial_main_window_loadProfile (moserialMainWindow* self);
static void moserial_main_window_copy (moserialMainWindow* self);
static void moserial_main_window_cut (moserialMainWindow* self);
static void moserial_main_window_editMenu (moserialMainWindow* self);
static void moserial_main_window_paste (moserialMainWindow* self);
static void moserial_main_window_clear (moserialMainWindow* self);
const gchar* moserial_main_window_get_startupProfileFilename (moserialMainWindow* self);
static void moserial_main_window_set_startupProfileFilename (moserialMainWindow* self, const gchar* value);
static GObject * moserial_main_window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _moserial_main_window_quitSave_gtk_widget_destroy (GtkWidget* _sender, gpointer self);
static gboolean _moserial_main_window_deleteSaveSize_gtk_widget_delete_event (GtkWidget* _sender, GdkEventAny* event, gpointer self);
static gboolean _moserial_main_window_keyPress_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self);
Profile* profile_new (void);
Profile* profile_construct (GType object_type);
gint profile_getWindowWidth (Profile* self);
gint profile_getWindowHeight (Profile* self);
gint profile_getWindowPanedPosition (Profile* self);
static void _moserial_main_window_quitSizeSave_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
static void _moserial_main_window_saveProfileAs_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
static void _moserial_main_window_saveProfile_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
static void _moserial_main_window_loadProfile_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
static void _moserial_main_window_copy_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
static void _moserial_main_window_editMenu_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
static void _moserial_main_window_cut_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
static void _moserial_main_window_paste_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
static void _moserial_main_window_clear_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
moserialSettingsDialog* moserial_settings_dialog_new (void);
moserialSettingsDialog* moserial_settings_dialog_construct (GType object_type);
static void _moserial_main_window_updateSettings_moserial_settings_dialog_update_settings (moserialSettingsDialog* _sender, Settings* settings, gpointer self);
static void _moserial_main_window_showSettingsDialog_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self);
static void _moserial_main_window_showHelpButton_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self);
static void _moserial_main_window_showAboutDialog_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
moserialSendProgressDialog* moserial_send_progress_dialog_new (void);
moserialSendProgressDialog* moserial_send_progress_dialog_construct (GType object_type);
moserialSendChooserDialog* moserial_send_chooser_dialog_new (void);
moserialSendChooserDialog* moserial_send_chooser_dialog_construct (GType object_type);
static void _moserial_main_window_doSendChooser_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self);
static void _moserial_main_window_doSend_moserial_send_chooser_dialog_start_transfer (moserialSendChooserDialog* _sender, gpointer self);
moserialReceiveProgressDialog* moserial_receive_progress_dialog_new (void);
moserialReceiveProgressDialog* moserial_receive_progress_dialog_construct (GType object_type);
moserialReceiveChooserDialog* moserial_receive_chooser_dialog_new (void);
moserialReceiveChooserDialog* moserial_receive_chooser_dialog_construct (GType object_type);
static void _moserial_main_window_doReceiveChooser_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self);
static void _moserial_main_window_doReceive_moserial_receive_chooser_dialog_start_transfer (moserialReceiveChooserDialog* _sender, gpointer self);
moserialXmodemFilenameDialog* moserial_xmodem_filename_dialog_new (void);
moserialXmodemFilenameDialog* moserial_xmodem_filename_dialog_construct (GType object_type);
moserialRecordDialog* moserial_record_dialog_new (void);
moserialRecordDialog* moserial_record_dialog_construct (GType object_type);
static void _moserial_main_window_record_gtk_toggle_tool_button_toggled (GtkToggleToolButton* _sender, gpointer self);
static void _moserial_main_window_stopRecording_moserial_record_dialog_stop_recording (moserialRecordDialog* _sender, gpointer self);
static void _moserial_main_window_startRecording_moserial_record_dialog_start_recording (moserialRecordDialog* _sender, const gchar* fileName, moserialSerialStreamRecorderDirection direction, gpointer self);
moserialPreferencesDialog* moserial_preferences_dialog_new (void);
moserialPreferencesDialog* moserial_preferences_dialog_construct (GType object_type);
static void _moserial_main_window_updatePreferences_moserial_preferences_dialog_update_preferences (moserialPreferencesDialog* _sender, Preferences* preferences, gpointer self);
static void _moserial_main_window_showPreferencesDialog_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self);
static void _moserial_main_window_connectButtonClick_gtk_toggle_tool_button_toggled (GtkToggleToolButton* _sender, gpointer self);
static void _moserial_main_window_showHelpAction_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
moserialHexTextBuffer* moserial_hex_text_buffer_new (void);
moserialHexTextBuffer* moserial_hex_text_buffer_construct (GType object_type);
void moserial_auto_scroll_setup (GtkAdjustment* incomingAsciiVerticalAdjuster, GtkAdjustment* incomingHexVerticalAdjuster, GtkAdjustment* outgoingAsciiVerticalAdjuster, GtkAdjustment* outgoingHexVerticalAdjuster);
static void _moserial_main_window_sendString_gtk_button_clicked (GtkButton* _sender, gpointer self);
static void _moserial_main_window_sendString_gtk_entry_activate (GtkEntry* _sender, gpointer self);
void mo_utils_populateComboBox (GtkComboBox* Combo, gchar** val_array, int val_array_length1);
static void _moserial_main_window_inputModeChanged_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self);
GType moserial_serial_connection_line_end_get_type (void) G_GNUC_CONST;
static void _moserial_main_window_recentItemOpen_gtk_recent_chooser_item_activated (GtkRecentChooser* _sender, gpointer self);
static void moserial_main_window_finalize (GObject * obj);
static void _vala_moserial_main_window_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_moserial_main_window_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);

static const gchar* MOSERIAL_MAIN_WINDOW_authors[3] = {"Michael J. Chudobiak <mjc@svn.gnome.org>", "marlodavampire", NULL};
static const gchar* MOSERIAL_MAIN_WINDOW_license[3] = {N_ ("moserial is free software: you can redistribute it and/or modify it un" \
"der the terms of the GNU General Public License as published by the Fr" \
"ee Software Foundation, either version 3 of the License, or (at your o" \
"ption) any later version.\n"), N_ ("moserial is distributed in the hope that it will be useful, but WITHOU" \
"T ANY WARRANTY; without even the implied warranty of MERCHANTABILITY o" \
"r FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public Licens" \
"e for more details.\n"), N_ ("You should have received a copy of the GNU General Public License alon" \
"g with this program.  If not, see <http://www.gnu.org/licenses/>.")};
static const gchar* MOSERIAL_MAIN_WINDOW_inputModeStrings[2] = {N_ ("ASCII"), N_ ("HEX")};
extern const gchar* MOSERIAL_SERIAL_CONNECTION_LineEndValues[6];
extern const gchar* MOSERIAL_SERIAL_CONNECTION_LineEndStrings[6];

static GType moserial_main_window_input_mode_values_get_type (void) {
	static volatile gsize moserial_main_window_input_mode_values_type_id__volatile = 0;
	if (g_once_init_enter (&moserial_main_window_input_mode_values_type_id__volatile)) {
		static const GEnumValue values[] = {{MOSERIAL_MAIN_WINDOW_INPUT_MODE_VALUES_ASCII, "MOSERIAL_MAIN_WINDOW_INPUT_MODE_VALUES_ASCII", "ascii"}, {MOSERIAL_MAIN_WINDOW_INPUT_MODE_VALUES_HEX, "MOSERIAL_MAIN_WINDOW_INPUT_MODE_VALUES_HEX", "hex"}, {0, NULL, NULL}};
		GType moserial_main_window_input_mode_values_type_id;
		moserial_main_window_input_mode_values_type_id = g_enum_register_static ("moserialMainWindowinputModeValues", values);
		g_once_init_leave (&moserial_main_window_input_mode_values_type_id__volatile, moserial_main_window_input_mode_values_type_id);
	}
	return moserial_main_window_input_mode_values_type_id__volatile;
}


static void gtk_recent_data_destroy (GtkRecentData * self) {
	_g_free0 ((*self).display_name);
	_g_free0 ((*self).description);
	_g_free0 ((*self).mime_type);
	_g_free0 ((*self).app_name);
	_g_free0 ((*self).app_exec);
	(*self).groups = (_vala_array_free ((*self).groups, _vala_array_length ((*self).groups), (GDestroyNotify) g_free), NULL);
}


moserialMainWindow* moserial_main_window_construct (GType object_type, const gchar* profileFilename) {
	moserialMainWindow * self = NULL;
	const gchar* _tmp0_;
	_tmp0_ = profileFilename;
	self = (moserialMainWindow*) g_object_new (object_type, "startupProfileFilename", _tmp0_, NULL);
	return self;
}


moserialMainWindow* moserial_main_window_new (const gchar* profileFilename) {
	return moserial_main_window_construct (MOSERIAL_TYPE_MAIN_WINDOW, profileFilename);
}


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


static void moserial_main_window_applyProfile (moserialMainWindow* self, const gchar* filename) {
	Profile* _tmp0_;
	const gchar* _tmp1_;
	GtkWindow* _tmp2_;
	gboolean _tmp3_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (filename != NULL);
	_tmp0_ = self->priv->profile;
	_tmp1_ = filename;
	_tmp2_ = self->priv->gtkWindow;
	_tmp3_ = profile_load (_tmp0_, _tmp1_, _tmp2_);
	if (_tmp3_) {
		const gchar* _tmp4_;
		gchar* _tmp5_;
		Profile* _tmp6_;
		Settings* _tmp7_;
		Profile* _tmp8_;
		Preferences* _tmp9_;
		Profile* _tmp10_;
		DefaultPaths* _tmp11_;
		Preferences* _tmp12_;
		GtkStatusbar* _tmp13_;
		guint _tmp14_;
		GtkStatusbar* _tmp15_;
		guint _tmp16_;
		Settings* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		GtkRecentManager* recentManager = NULL;
		GtkRecentManager* _tmp20_;
		GtkRecentManager* _tmp21_;
		_tmp4_ = filename;
		_tmp5_ = g_strdup (_tmp4_);
		_g_free0 (self->priv->profileFilename);
		self->priv->profileFilename = _tmp5_;
		moserial_main_window_ensureDisconnected (self);
		_tmp6_ = self->priv->profile;
		_tmp7_ = settings_loadFromProfile (_tmp6_);
		_g_object_unref0 (self->priv->currentSettings);
		self->priv->currentSettings = _tmp7_;
		_tmp8_ = self->priv->profile;
		_tmp9_ = preferences_loadFromProfile (_tmp8_);
		_g_object_unref0 (self->priv->currentPreferences);
		self->priv->currentPreferences = _tmp9_;
		_tmp10_ = self->priv->profile;
		_tmp11_ = default_paths_loadFromProfile (_tmp10_);
		_g_object_unref0 (self->priv->currentPaths);
		self->priv->currentPaths = _tmp11_;
		_tmp12_ = self->priv->currentPreferences;
		moserial_main_window_updatePreferences (self, NULL, _tmp12_);
		_tmp13_ = self->priv->statusbar;
		_tmp14_ = self->priv->statusbarContext;
		gtk_statusbar_pop (_tmp13_, _tmp14_);
		_tmp15_ = self->priv->statusbar;
		_tmp16_ = self->priv->statusbarContext;
		_tmp17_ = self->priv->currentSettings;
		_tmp18_ = settings_getStatusbarString (_tmp17_, FALSE);
		_tmp19_ = _tmp18_;
		gtk_statusbar_push (_tmp15_, _tmp16_, _tmp19_);
		_g_free0 (_tmp19_);
		moserial_main_window_setWindowTitle (self, NULL);
		self->priv->profileChanged = FALSE;
		_tmp20_ = gtk_recent_manager_get_default ();
		_tmp21_ = _g_object_ref0 (_tmp20_);
		recentManager = _tmp21_;
		{
			gchar* _tmp22_ = NULL;
			const gchar* _tmp23_;
			gchar* _tmp24_;
			GtkRecentManager* _tmp25_;
			GtkRecentData _tmp26_;
			_tmp23_ = filename;
			_tmp24_ = g_filename_to_uri (_tmp23_, NULL, &_inner_error_);
			_tmp22_ = _tmp24_;
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				if (_inner_error_->domain == G_CONVERT_ERROR) {
					goto __catch0_g_convert_error;
				}
				_g_object_unref0 (recentManager);
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return;
			}
			_tmp25_ = recentManager;
			_tmp26_ = self->priv->recentData;
			gtk_recent_manager_add_full (_tmp25_, _tmp22_, &_tmp26_);
			_g_free0 (_tmp22_);
		}
		goto __finally0;
		__catch0_g_convert_error:
		{
			GError* e = NULL;
			FILE* _tmp27_;
			GError* _tmp28_;
			const gchar* _tmp29_;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp27_ = stdout;
			_tmp28_ = e;
			_tmp29_ = _tmp28_->message;
			fprintf (_tmp27_, "%s\n", _tmp29_);
			_g_error_free0 (e);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_object_unref0 (recentManager);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
		_g_object_unref0 (recentManager);
	}
}


static void moserial_main_window_setWindowTitle (moserialMainWindow* self, const gchar* recordingFilename) {
	GString* builder = NULL;
	GString* _tmp0_;
	GString* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp8_;
	GtkWindow* _tmp14_;
	GString* _tmp15_;
	const gchar* _tmp16_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_string_new ("");
	builder = _tmp0_;
	_tmp1_ = builder;
	g_string_append (_tmp1_, "moserial");
	_tmp2_ = self->priv->profileFilename;
	if (_tmp2_ != NULL) {
		GString* _tmp3_;
		GString* _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp3_ = builder;
		g_string_append (_tmp3_, " - ");
		_tmp4_ = builder;
		_tmp5_ = self->priv->profileFilename;
		_tmp6_ = g_path_get_basename (_tmp5_);
		_tmp7_ = _tmp6_;
		g_string_append (_tmp4_, _tmp7_);
		_g_free0 (_tmp7_);
	}
	_tmp8_ = recordingFilename;
	if (_tmp8_ != NULL) {
		GString* _tmp9_;
		GString* _tmp10_;
		const gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		_tmp9_ = builder;
		g_string_append (_tmp9_, " - ");
		_tmp10_ = builder;
		_tmp11_ = recordingFilename;
		_tmp12_ = g_path_get_basename (_tmp11_);
		_tmp13_ = _tmp12_;
		g_string_append (_tmp10_, _tmp13_);
		_g_free0 (_tmp13_);
	}
	_tmp14_ = self->priv->gtkWindow;
	_tmp15_ = builder;
	_tmp16_ = _tmp15_->str;
	gtk_window_set_title (_tmp14_, _tmp16_);
	_g_string_free0 (builder);
}


static void moserial_main_window_recentItemOpen (moserialMainWindow* self, GtkRecentChooser* r) {
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (r != NULL);
	{
		gchar* _tmp0_ = NULL;
		GtkRecentChooser* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp1_ = r;
		_tmp2_ = gtk_recent_chooser_get_current_uri (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = g_filename_from_uri (_tmp3_, NULL, &_inner_error_);
		_tmp5_ = _tmp4_;
		_g_free0 (_tmp3_);
		_tmp0_ = _tmp5_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == G_CONVERT_ERROR) {
				goto __catch1_g_convert_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
		moserial_main_window_applyProfile (self, _tmp0_);
		_g_free0 (_tmp0_);
	}
	goto __finally1;
	__catch1_g_convert_error:
	{
		GError* e = NULL;
		FILE* _tmp6_;
		GError* _tmp7_;
		const gchar* _tmp8_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp6_ = stdout;
		_tmp7_ = e;
		_tmp8_ = _tmp7_->message;
		fprintf (_tmp6_, "%s\n", _tmp8_);
		_g_error_free0 (e);
	}
	__finally1:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


static gunichar string_get_char (const gchar* self, glong index) {
	gunichar result = 0U;
	glong _tmp0_;
	gunichar _tmp1_;
	g_return_val_if_fail (self != NULL, 0U);
	_tmp0_ = index;
	_tmp1_ = g_utf8_get_char (((gchar*) self) + _tmp0_);
	result = _tmp1_;
	return result;
}


static void moserial_main_window_insertBufferEnd (moserialMainWindow* self, GtkTextBuffer* buf, const gchar* s) {
	GtkTextIter iter = {0};
	gint i = 0;
	GString* builder = NULL;
	GString* _tmp0_;
	GtkTextBuffer* _tmp18_;
	GtkTextIter _tmp19_ = {0};
	GtkTextBuffer* _tmp20_;
	GString* _tmp21_;
	const gchar* _tmp22_;
	GString* _tmp23_;
	const gchar* _tmp24_;
	gint _tmp25_;
	gint _tmp26_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (buf != NULL);
	g_return_if_fail (s != NULL);
	_tmp0_ = g_string_new ("");
	builder = _tmp0_;
	{
		gboolean _tmp1_ = FALSE;
		i = 0;
		_tmp1_ = TRUE;
		while (TRUE) {
			gint _tmp3_;
			const gchar* _tmp4_;
			gint _tmp5_;
			gint _tmp6_;
			gunichar c = 0U;
			const gchar* _tmp7_;
			gunichar _tmp8_;
			gboolean _tmp9_ = FALSE;
			gunichar _tmp10_;
			gboolean _tmp11_;
			const gchar* _tmp16_;
			const gchar* _tmp17_;
			if (!_tmp1_) {
				gint _tmp2_;
				_tmp2_ = i;
				i = _tmp2_ + 1;
			}
			_tmp1_ = FALSE;
			_tmp3_ = i;
			_tmp4_ = s;
			_tmp5_ = strlen (_tmp4_);
			_tmp6_ = _tmp5_;
			if (!(_tmp3_ < _tmp6_)) {
				break;
			}
			_tmp7_ = s;
			_tmp8_ = string_get_char (_tmp7_, (glong) 0);
			c = _tmp8_;
			_tmp10_ = c;
			_tmp11_ = g_unichar_isprint (_tmp10_);
			if (_tmp11_) {
				_tmp9_ = TRUE;
			} else {
				gunichar _tmp12_;
				gboolean _tmp13_;
				_tmp12_ = c;
				_tmp13_ = g_unichar_isspace (_tmp12_);
				_tmp9_ = _tmp13_;
			}
			if (_tmp9_) {
				GString* _tmp14_;
				gunichar _tmp15_;
				_tmp14_ = builder;
				_tmp15_ = c;
				g_string_append_unichar (_tmp14_, _tmp15_);
			}
			_tmp16_ = s;
			_tmp17_ = g_utf8_next_char (_tmp16_);
			s = _tmp17_;
		}
	}
	_tmp18_ = buf;
	gtk_text_buffer_get_end_iter (_tmp18_, &_tmp19_);
	iter = _tmp19_;
	_tmp20_ = buf;
	_tmp21_ = builder;
	_tmp22_ = _tmp21_->str;
	_tmp23_ = builder;
	_tmp24_ = _tmp23_->str;
	_tmp25_ = strlen (_tmp24_);
	_tmp26_ = _tmp25_;
	gtk_text_buffer_insert (_tmp20_, &iter, _tmp22_, (gint) _tmp26_);
	_g_string_free0 (builder);
}


void moserial_main_window_sendString (moserialMainWindow* self, GtkWidget* w) {
	gboolean _tmp0_;
	gchar* s = NULL;
	GtkEntry* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	moserialSerialConnection* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	glong len = 0L;
	GtkComboBox* _tmp7_;
	gint _tmp8_;
	GtkStatusbar* _tmp95_;
	guint _tmp96_;
	GtkStatusbar* _tmp97_;
	guint _tmp98_;
	moserialSerialConnection* _tmp99_;
	gchar* _tmp100_;
	gchar* _tmp101_;
	GtkEntry* _tmp102_;
	moserialSerialConnection* _tmp103_;
	gchar* _tmp104_;
	GtkTextIter echoStartIter = {0};
	GtkTextBuffer* _tmp105_;
	GtkTextIter _tmp106_ = {0};
	GtkTextBuffer* _tmp107_;
	GtkTextIter _tmp108_;
	GtkTextMark* _tmp109_;
	GtkTextMark* _tmp110_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (w != NULL);
	_tmp0_ = moserial_main_window_ensureConnected (self);
	if (!_tmp0_) {
		return;
	}
	_tmp1_ = self->priv->entry;
	_tmp2_ = gtk_entry_get_text (_tmp1_);
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (s);
	s = _tmp3_;
	_tmp4_ = self->priv->serialConnection;
	_tmp5_ = s;
	_tmp6_ = g_strdup (_tmp5_);
	_g_free0 (_tmp4_->echoReference);
	_tmp4_->echoReference = _tmp6_;
	_tmp7_ = self->priv->inputModeCombo;
	_tmp8_ = gtk_combo_box_get_active (_tmp7_);
	if (_tmp8_ == ((gint) MOSERIAL_MAIN_WINDOW_INPUT_MODE_VALUES_ASCII)) {
		const gchar* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		gchar* t = NULL;
		moserialSerialConnection* _tmp33_;
		GtkComboBox* _tmp34_;
		gint _tmp35_;
		const gchar* _tmp36_;
		gchar* _tmp37_;
		const gchar* _tmp38_;
		gint _tmp39_;
		gint _tmp40_;
		_tmp9_ = s;
		_tmp10_ = strlen (_tmp9_);
		_tmp11_ = _tmp10_;
		len = (glong) _tmp11_;
		{
			gint x = 0;
			x = 0;
			{
				gboolean _tmp12_ = FALSE;
				_tmp12_ = TRUE;
				while (TRUE) {
					gint _tmp14_;
					glong _tmp15_;
					moserialSerialConnection* _tmp16_;
					const gchar* _tmp17_;
					gunichar _tmp18_;
					moserialSerialStreamRecorder* _tmp19_;
					const gchar* _tmp20_;
					gunichar _tmp21_;
					moserialHexTextBuffer* _tmp22_;
					const gchar* _tmp23_;
					gunichar _tmp24_;
					GtkTextBuffer* _tmp25_;
					const gchar* _tmp26_;
					gunichar _tmp27_;
					gchar* _tmp28_;
					gchar* _tmp29_;
					const gchar* _tmp30_;
					const gchar* _tmp31_;
					gchar* _tmp32_;
					if (!_tmp12_) {
						gint _tmp13_;
						_tmp13_ = x;
						x = _tmp13_ + 1;
					}
					_tmp12_ = FALSE;
					_tmp14_ = x;
					_tmp15_ = len;
					if (!(((glong) _tmp14_) < _tmp15_)) {
						break;
					}
					_tmp16_ = self->priv->serialConnection;
					_tmp17_ = s;
					_tmp18_ = string_get_char (_tmp17_, (glong) 0);
					moserial_serial_connection_sendByte (_tmp16_, (guchar) _tmp18_);
					_tmp19_ = self->priv->streamRecorder;
					_tmp20_ = s;
					_tmp21_ = string_get_char (_tmp20_, (glong) 0);
					moserial_serial_stream_recorder_writeOutgoing (_tmp19_, (guchar) _tmp21_);
					_tmp22_ = self->priv->outgoingHexTextBuffer;
					_tmp23_ = s;
					_tmp24_ = string_get_char (_tmp23_, (glong) 0);
					moserial_hex_text_buffer_add (_tmp22_, (guchar) _tmp24_);
					_tmp25_ = self->priv->outgoingAsciiTextBuffer;
					_tmp26_ = s;
					_tmp27_ = string_get_char (_tmp26_, (glong) 0);
					_tmp28_ = g_strdup_printf ("%c", (gint) ((guchar) _tmp27_));
					_tmp29_ = _tmp28_;
					moserial_main_window_insertBufferEnd (self, _tmp25_, _tmp29_);
					_g_free0 (_tmp29_);
					_tmp30_ = s;
					_tmp31_ = g_utf8_next_char (_tmp30_);
					_tmp32_ = g_strdup (_tmp31_);
					_g_free0 (s);
					s = _tmp32_;
				}
			}
		}
		_tmp33_ = self->priv->serialConnection;
		_tmp34_ = self->priv->lineEndModeCombo;
		_tmp35_ = gtk_combo_box_get_active (_tmp34_);
		_tmp36_ = MOSERIAL_SERIAL_CONNECTION_LineEndValues[_tmp35_];
		_tmp37_ = g_strdup (_tmp36_);
		t = _tmp37_;
		_tmp38_ = t;
		_tmp39_ = strlen (_tmp38_);
		_tmp40_ = _tmp39_;
		len = (glong) _tmp40_;
		{
			gint x = 0;
			x = 0;
			{
				gboolean _tmp41_ = FALSE;
				_tmp41_ = TRUE;
				while (TRUE) {
					gint _tmp43_;
					glong _tmp44_;
					moserialSerialConnection* _tmp45_;
					const gchar* _tmp46_;
					gunichar _tmp47_;
					moserialSerialStreamRecorder* _tmp48_;
					const gchar* _tmp49_;
					gunichar _tmp50_;
					moserialHexTextBuffer* _tmp51_;
					const gchar* _tmp52_;
					gunichar _tmp53_;
					gint _tmp54_;
					const gchar* _tmp60_;
					const gchar* _tmp61_;
					gchar* _tmp62_;
					if (!_tmp41_) {
						gint _tmp42_;
						_tmp42_ = x;
						x = _tmp42_ + 1;
					}
					_tmp41_ = FALSE;
					_tmp43_ = x;
					_tmp44_ = len;
					if (!(((glong) _tmp43_) < _tmp44_)) {
						break;
					}
					_tmp45_ = self->priv->serialConnection;
					_tmp46_ = t;
					_tmp47_ = string_get_char (_tmp46_, (glong) 0);
					moserial_serial_connection_sendByte (_tmp45_, (guchar) _tmp47_);
					_tmp48_ = self->priv->streamRecorder;
					_tmp49_ = t;
					_tmp50_ = string_get_char (_tmp49_, (glong) 0);
					moserial_serial_stream_recorder_writeOutgoing (_tmp48_, (guchar) _tmp50_);
					_tmp51_ = self->priv->outgoingHexTextBuffer;
					_tmp52_ = t;
					_tmp53_ = string_get_char (_tmp52_, (glong) 0);
					moserial_hex_text_buffer_add (_tmp51_, (guchar) _tmp53_);
					_tmp54_ = x;
					if (_tmp54_ == 0) {
						GtkTextBuffer* _tmp55_;
						const gchar* _tmp56_;
						gunichar _tmp57_;
						gchar* _tmp58_;
						gchar* _tmp59_;
						_tmp55_ = self->priv->outgoingAsciiTextBuffer;
						_tmp56_ = t;
						_tmp57_ = string_get_char (_tmp56_, (glong) 0);
						_tmp58_ = g_strdup_printf ("%c", (gint) ((guchar) _tmp57_));
						_tmp59_ = _tmp58_;
						moserial_main_window_insertBufferEnd (self, _tmp55_, _tmp59_);
						_g_free0 (_tmp59_);
					}
					_tmp60_ = t;
					_tmp61_ = g_utf8_next_char (_tmp60_);
					_tmp62_ = g_strdup (_tmp61_);
					_g_free0 (t);
					t = _tmp62_;
				}
			}
		}
		_g_free0 (t);
	} else {
		{
			guchar* h = NULL;
			const gchar* _tmp63_;
			gint _tmp64_;
			guchar* _tmp65_;
			gint h_length1;
			gint _h_size_;
			guchar* _tmp66_;
			gint _tmp66__length1;
			_tmp63_ = s;
			_tmp65_ = input_parser_parseHex (_tmp63_, &_tmp64_, &_inner_error_);
			h = _tmp65_;
			h_length1 = _tmp64_;
			_h_size_ = h_length1;
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				if (_inner_error_->domain == HEX_PARSE_ERROR) {
					goto __catch2_hex_parse_error;
				}
				_g_free0 (s);
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return;
			}
			_tmp66_ = h;
			_tmp66__length1 = h_length1;
			len = (glong) _tmp66__length1;
			{
				gint x = 0;
				x = 0;
				{
					gboolean _tmp67_ = FALSE;
					_tmp67_ = TRUE;
					while (TRUE) {
						gint _tmp69_;
						glong _tmp70_;
						moserialSerialConnection* _tmp71_;
						guchar* _tmp72_;
						gint _tmp72__length1;
						gint _tmp73_;
						guchar _tmp74_;
						moserialSerialStreamRecorder* _tmp75_;
						guchar* _tmp76_;
						gint _tmp76__length1;
						gint _tmp77_;
						guchar _tmp78_;
						moserialHexTextBuffer* _tmp79_;
						guchar* _tmp80_;
						gint _tmp80__length1;
						gint _tmp81_;
						guchar _tmp82_;
						GtkTextBuffer* _tmp83_;
						guchar* _tmp84_;
						gint _tmp84__length1;
						gint _tmp85_;
						guchar _tmp86_;
						gchar* _tmp87_;
						gchar* _tmp88_;
						if (!_tmp67_) {
							gint _tmp68_;
							_tmp68_ = x;
							x = _tmp68_ + 1;
						}
						_tmp67_ = FALSE;
						_tmp69_ = x;
						_tmp70_ = len;
						if (!(((glong) _tmp69_) < _tmp70_)) {
							break;
						}
						_tmp71_ = self->priv->serialConnection;
						_tmp72_ = h;
						_tmp72__length1 = h_length1;
						_tmp73_ = x;
						_tmp74_ = _tmp72_[_tmp73_];
						moserial_serial_connection_sendByte (_tmp71_, _tmp74_);
						_tmp75_ = self->priv->streamRecorder;
						_tmp76_ = h;
						_tmp76__length1 = h_length1;
						_tmp77_ = x;
						_tmp78_ = _tmp76_[_tmp77_];
						moserial_serial_stream_recorder_writeOutgoing (_tmp75_, _tmp78_);
						_tmp79_ = self->priv->outgoingHexTextBuffer;
						_tmp80_ = h;
						_tmp80__length1 = h_length1;
						_tmp81_ = x;
						_tmp82_ = _tmp80_[_tmp81_];
						moserial_hex_text_buffer_add (_tmp79_, _tmp82_);
						_tmp83_ = self->priv->outgoingAsciiTextBuffer;
						_tmp84_ = h;
						_tmp84__length1 = h_length1;
						_tmp85_ = x;
						_tmp86_ = _tmp84_[_tmp85_];
						_tmp87_ = g_strdup_printf ("%c", (gint) _tmp86_);
						_tmp88_ = _tmp87_;
						moserial_main_window_insertBufferEnd (self, _tmp83_, _tmp88_);
						_g_free0 (_tmp88_);
					}
				}
			}
			h = (g_free (h), NULL);
		}
		goto __finally2;
		__catch2_hex_parse_error:
		{
			GError* e = NULL;
			GtkMessageDialog* errorDialog = NULL;
			GtkWindow* _tmp89_;
			GError* _tmp90_;
			const gchar* _tmp91_;
			GtkMessageDialog* _tmp92_;
			GtkMessageDialog* _tmp93_;
			GtkMessageDialog* _tmp94_;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp89_ = self->priv->gtkWindow;
			_tmp90_ = e;
			_tmp91_ = _tmp90_->message;
			_tmp92_ = (GtkMessageDialog*) gtk_message_dialog_new (_tmp89_, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", _tmp91_);
			g_object_ref_sink (_tmp92_);
			errorDialog = _tmp92_;
			_tmp93_ = errorDialog;
			gtk_dialog_run ((GtkDialog*) _tmp93_);
			_tmp94_ = errorDialog;
			gtk_widget_destroy ((GtkWidget*) _tmp94_);
			_g_object_unref0 (errorDialog);
			_g_error_free0 (e);
		}
		__finally2:
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_free0 (s);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	_tmp95_ = self->priv->bytecountbar;
	_tmp96_ = self->priv->bytecountbarContext;
	gtk_statusbar_pop (_tmp95_, _tmp96_);
	_tmp97_ = self->priv->bytecountbar;
	_tmp98_ = self->priv->bytecountbarContext;
	_tmp99_ = self->priv->serialConnection;
	_tmp100_ = moserial_serial_connection_getBytecountbarString (_tmp99_);
	_tmp101_ = _tmp100_;
	gtk_statusbar_push (_tmp97_, _tmp98_, _tmp101_);
	_g_free0 (_tmp101_);
	_tmp102_ = self->priv->entry;
	gtk_entry_set_text (_tmp102_, "");
	_tmp103_ = self->priv->serialConnection;
	_tmp104_ = g_strdup ("");
	_g_free0 (_tmp103_->echoCompare);
	_tmp103_->echoCompare = _tmp104_;
	_tmp105_ = self->priv->incomingAsciiTextBuffer;
	gtk_text_buffer_get_end_iter (_tmp105_, &_tmp106_);
	echoStartIter = _tmp106_;
	_tmp107_ = self->priv->incomingAsciiTextBuffer;
	_tmp108_ = echoStartIter;
	_tmp109_ = gtk_text_buffer_create_mark (_tmp107_, "echo", &_tmp108_, TRUE);
	_tmp110_ = _g_object_ref0 (_tmp109_);
	_g_object_unref0 (self->priv->echoStartMark);
	self->priv->echoStartMark = _tmp110_;
	_g_free0 (s);
}


static void moserial_main_window_doSendChooser (moserialMainWindow* self, GtkToolButton* button) {
	gboolean _tmp0_;
	moserialSendChooserDialog* _tmp1_;
	DefaultPaths* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = moserial_main_window_ensureConnected (self);
	if (!_tmp0_) {
		return;
	}
	_tmp1_ = self->priv->sendChooserDialog;
	_tmp2_ = self->priv->currentPaths;
	_tmp3_ = default_paths_get_sendFrom (_tmp2_);
	_tmp4_ = _tmp3_;
	moserial_send_chooser_dialog_show (_tmp1_, _tmp4_);
}


static void _moserial_send_progress_dialog_updateStatus_moserial_szwrapper_update_status (moserialSzwrapper* _sender, const gchar* newStatus, gpointer self) {
	moserial_send_progress_dialog_updateStatus ((moserialSendProgressDialog*) self, _sender, newStatus);
}


static void _moserial_szwrapper_transferCanceled_moserial_send_progress_dialog_transfer_canceled (moserialSendProgressDialog* _sender, gpointer self) {
	moserial_szwrapper_transferCanceled ((moserialSzwrapper*) self, _sender);
}


static void _moserial_main_window_sendComplete_moserial_szwrapper_transfer_complete (moserialSzwrapper* _sender, gpointer self) {
	moserial_main_window_sendComplete ((moserialMainWindow*) self, _sender);
}


static void moserial_main_window_doSend (moserialMainWindow* self, moserialSendChooserDialog* dialog) {
	moserialSzwrapperProtocol protocol = 0;
	gchar* filename = NULL;
	moserialSendChooserDialog* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	DefaultPaths* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	moserialSendChooserDialog* _tmp7_;
	GtkComboBox* _tmp8_;
	gint _tmp9_;
	moserialSzwrapperProtocol _tmp10_;
	moserialSerialConnection* _tmp11_;
	const gchar* _tmp12_;
	moserialSzwrapper* _tmp13_;
	moserialSzwrapper* _tmp14_;
	gboolean _tmp15_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (dialog != NULL);
	_tmp0_ = dialog;
	_tmp1_ = _tmp0_->filename;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (filename);
	filename = _tmp2_;
	_tmp3_ = self->priv->currentPaths;
	_tmp4_ = filename;
	_tmp5_ = mo_utils_getParentFolder (_tmp4_);
	_tmp6_ = _tmp5_;
	default_paths_set_sendFrom (_tmp3_, _tmp6_);
	_g_free0 (_tmp6_);
	_tmp7_ = dialog;
	_tmp8_ = _tmp7_->protocolCombo;
	_tmp9_ = gtk_combo_box_get_active (_tmp8_);
	switch (_tmp9_) {
		case 0:
		{
			protocol = MOSERIAL_SZWRAPPER_PROTOCOL_XMODEM;
			break;
		}
		case 1:
		{
			protocol = MOSERIAL_SZWRAPPER_PROTOCOL_YMODEM;
			break;
		}
		default:
		case 2:
		{
			protocol = MOSERIAL_SZWRAPPER_PROTOCOL_ZMODEM;
			break;
		}
		case 3:
		{
			protocol = MOSERIAL_SZWRAPPER_PROTOCOL_RAW;
			break;
		}
	}
	_tmp10_ = protocol;
	_tmp11_ = self->priv->serialConnection;
	_tmp12_ = filename;
	_tmp13_ = moserial_szwrapper_new (&_tmp10_, _tmp11_, _tmp12_);
	_g_object_unref0 (self->priv->sz);
	self->priv->sz = _tmp13_;
	_tmp14_ = self->priv->sz;
	_tmp15_ = _tmp14_->running;
	if (_tmp15_) {
		moserialSendProgressDialog* _tmp16_;
		moserialSzwrapper* _tmp17_;
		moserialSendProgressDialog* _tmp18_;
		moserialSendProgressDialog* _tmp19_;
		moserialSzwrapper* _tmp20_;
		moserialSzwrapper* _tmp21_;
		_tmp16_ = self->priv->sendProgressDialog;
		moserial_send_progress_dialog_show (_tmp16_);
		_tmp17_ = self->priv->sz;
		_tmp18_ = self->priv->sendProgressDialog;
		g_signal_connect_object (_tmp17_, "update-status", (GCallback) _moserial_send_progress_dialog_updateStatus_moserial_szwrapper_update_status, _tmp18_, 0);
		_tmp19_ = self->priv->sendProgressDialog;
		_tmp20_ = self->priv->sz;
		g_signal_connect_object (_tmp19_, "transfer-canceled", (GCallback) _moserial_szwrapper_transferCanceled_moserial_send_progress_dialog_transfer_canceled, _tmp20_, 0);
		_tmp21_ = self->priv->sz;
		g_signal_connect_object (_tmp21_, "transfer-complete", (GCallback) _moserial_main_window_sendComplete_moserial_szwrapper_transfer_complete, self, 0);
	}
	_g_free0 (filename);
}


void moserial_main_window_sendComplete (moserialMainWindow* self, GObject* o) {
	moserialSzwrapper* _tmp0_;
	moserialSendProgressDialog* _tmp1_;
	guint _tmp2_;
	moserialSendProgressDialog* _tmp3_;
	moserialSzwrapper* _tmp4_;
	guint _tmp5_;
	moserialSendProgressDialog* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (o != NULL);
	_tmp0_ = self->priv->sz;
	_tmp1_ = self->priv->sendProgressDialog;
	g_signal_parse_name ("update-status", MOSERIAL_TYPE_SZWRAPPER, &_tmp2_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _moserial_send_progress_dialog_updateStatus_moserial_szwrapper_update_status, _tmp1_);
	_tmp3_ = self->priv->sendProgressDialog;
	_tmp4_ = self->priv->sz;
	g_signal_parse_name ("transfer-canceled", MOSERIAL_TYPE_SEND_PROGRESS_DIALOG, &_tmp5_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _moserial_szwrapper_transferCanceled_moserial_send_progress_dialog_transfer_canceled, _tmp4_);
	_tmp6_ = self->priv->sendProgressDialog;
	moserial_send_progress_dialog_hide (_tmp6_);
}


static void moserial_main_window_doReceiveChooser (moserialMainWindow* self, GtkToolButton* button) {
	gboolean _tmp0_;
	moserialReceiveChooserDialog* _tmp1_;
	DefaultPaths* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = moserial_main_window_ensureConnected (self);
	if (!_tmp0_) {
		return;
	}
	_tmp1_ = self->priv->receiveChooserDialog;
	_tmp2_ = self->priv->currentPaths;
	_tmp3_ = default_paths_get_receiveTo (_tmp2_);
	_tmp4_ = _tmp3_;
	moserial_receive_chooser_dialog_show (_tmp1_, _tmp4_);
}


static void _moserial_receive_progress_dialog_updateStatus_moserial_rzwrapper_update_status (moserialRzwrapper* _sender, const gchar* newStatus, gpointer self) {
	moserial_receive_progress_dialog_updateStatus ((moserialReceiveProgressDialog*) self, _sender, newStatus);
}


static void _moserial_rzwrapper_transferCanceled_moserial_receive_progress_dialog_transfer_canceled (moserialReceiveProgressDialog* _sender, gpointer self) {
	moserial_rzwrapper_transferCanceled ((moserialRzwrapper*) self, _sender);
}


static void _moserial_main_window_receiveComplete_moserial_rzwrapper_transfer_complete (moserialRzwrapper* _sender, gpointer self) {
	moserial_main_window_receiveComplete ((moserialMainWindow*) self, _sender);
}


static void moserial_main_window_doReceive (moserialMainWindow* self, moserialReceiveChooserDialog* dialog) {
	gchar* filename = NULL;
	gchar* _tmp0_;
	DefaultPaths* _tmp1_;
	moserialReceiveChooserDialog* _tmp2_;
	const gchar* _tmp3_;
	moserialReceiveChooserDialog* _tmp4_;
	GtkComboBox* _tmp5_;
	gint _tmp6_;
	moserialRzwrapperProtocol protocol = 0;
	moserialReceiveChooserDialog* _tmp11_;
	GtkComboBox* _tmp12_;
	gint _tmp13_;
	moserialRzwrapperProtocol _tmp14_;
	moserialSerialConnection* _tmp15_;
	moserialReceiveChooserDialog* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	moserialRzwrapper* _tmp19_;
	moserialRzwrapper* _tmp20_;
	gboolean _tmp21_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (dialog != NULL);
	_tmp0_ = g_strdup ("");
	filename = _tmp0_;
	_tmp1_ = self->priv->currentPaths;
	_tmp2_ = dialog;
	_tmp3_ = _tmp2_->path;
	default_paths_set_receiveTo (_tmp1_, _tmp3_);
	_tmp4_ = dialog;
	_tmp5_ = _tmp4_->protocolCombo;
	_tmp6_ = gtk_combo_box_get_active (_tmp5_);
	if (_tmp6_ == 0) {
		moserialXmodemFilenameDialog* _tmp7_;
		moserialXmodemFilenameDialog* _tmp8_;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp7_ = self->priv->xmodemFilenameDialog;
		moserial_xmodem_filename_dialog_show (_tmp7_);
		_tmp8_ = self->priv->xmodemFilenameDialog;
		_tmp9_ = _tmp8_->filename;
		_tmp10_ = g_strdup (_tmp9_);
		_g_free0 (filename);
		filename = _tmp10_;
	}
	_tmp11_ = dialog;
	_tmp12_ = _tmp11_->protocolCombo;
	_tmp13_ = gtk_combo_box_get_active (_tmp12_);
	switch (_tmp13_) {
		case 0:
		{
			protocol = MOSERIAL_RZWRAPPER_PROTOCOL_XMODEM;
			break;
		}
		case 1:
		{
			protocol = MOSERIAL_RZWRAPPER_PROTOCOL_YMODEM;
			break;
		}
		default:
		case 2:
		{
			protocol = MOSERIAL_RZWRAPPER_PROTOCOL_ZMODEM;
			break;
		}
	}
	_tmp14_ = protocol;
	_tmp15_ = self->priv->serialConnection;
	_tmp16_ = dialog;
	_tmp17_ = _tmp16_->path;
	_tmp18_ = filename;
	_tmp19_ = moserial_rzwrapper_new (&_tmp14_, _tmp15_, _tmp17_, _tmp18_);
	_g_object_unref0 (self->priv->rz);
	self->priv->rz = _tmp19_;
	_tmp20_ = self->priv->rz;
	_tmp21_ = _tmp20_->running;
	if (_tmp21_) {
		moserialReceiveProgressDialog* _tmp22_;
		moserialRzwrapper* _tmp23_;
		moserialReceiveProgressDialog* _tmp24_;
		moserialReceiveProgressDialog* _tmp25_;
		moserialRzwrapper* _tmp26_;
		moserialRzwrapper* _tmp27_;
		_tmp22_ = self->priv->receiveProgressDialog;
		moserial_receive_progress_dialog_show (_tmp22_);
		_tmp23_ = self->priv->rz;
		_tmp24_ = self->priv->receiveProgressDialog;
		g_signal_connect_object (_tmp23_, "update-status", (GCallback) _moserial_receive_progress_dialog_updateStatus_moserial_rzwrapper_update_status, _tmp24_, 0);
		_tmp25_ = self->priv->receiveProgressDialog;
		_tmp26_ = self->priv->rz;
		g_signal_connect_object (_tmp25_, "transfer-canceled", (GCallback) _moserial_rzwrapper_transferCanceled_moserial_receive_progress_dialog_transfer_canceled, _tmp26_, 0);
		_tmp27_ = self->priv->rz;
		g_signal_connect_object (_tmp27_, "transfer-complete", (GCallback) _moserial_main_window_receiveComplete_moserial_rzwrapper_transfer_complete, self, 0);
	}
	_g_free0 (filename);
}


void moserial_main_window_receiveComplete (moserialMainWindow* self, GObject* o) {
	moserialRzwrapper* _tmp0_;
	moserialReceiveProgressDialog* _tmp1_;
	guint _tmp2_;
	moserialReceiveProgressDialog* _tmp3_;
	moserialRzwrapper* _tmp4_;
	guint _tmp5_;
	moserialReceiveProgressDialog* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (o != NULL);
	_tmp0_ = self->priv->rz;
	_tmp1_ = self->priv->receiveProgressDialog;
	g_signal_parse_name ("update-status", MOSERIAL_TYPE_RZWRAPPER, &_tmp2_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _moserial_receive_progress_dialog_updateStatus_moserial_rzwrapper_update_status, _tmp1_);
	_tmp3_ = self->priv->receiveProgressDialog;
	_tmp4_ = self->priv->rz;
	g_signal_parse_name ("transfer-canceled", MOSERIAL_TYPE_RECEIVE_PROGRESS_DIALOG, &_tmp5_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _moserial_rzwrapper_transferCanceled_moserial_receive_progress_dialog_transfer_canceled, _tmp4_);
	_tmp6_ = self->priv->receiveProgressDialog;
	moserial_receive_progress_dialog_hide (_tmp6_);
}


void moserial_main_window_record (moserialMainWindow* self, GtkToggleToolButton* button) {
	GtkToggleToolButton* _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = button;
	_tmp1_ = gtk_toggle_tool_button_get_active (_tmp0_);
	if (_tmp1_) {
		gboolean _tmp2_;
		GtkToggleToolButton* _tmp4_;
		GtkLabel* _tmp5_;
		moserialRecordDialog* _tmp6_;
		DefaultPaths* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		_tmp2_ = moserial_main_window_ensureConnected (self);
		if (!_tmp2_) {
			GtkToggleToolButton* _tmp3_;
			_tmp3_ = button;
			gtk_toggle_tool_button_set_active (_tmp3_, FALSE);
			return;
		}
		_tmp4_ = button;
		_tmp5_ = self->priv->stopRecordingLabel;
		gtk_tool_button_set_label_widget ((GtkToolButton*) _tmp4_, (GtkWidget*) _tmp5_);
		_tmp6_ = self->priv->recordDialog;
		_tmp7_ = self->priv->currentPaths;
		_tmp8_ = default_paths_get_recordTo (_tmp7_);
		_tmp9_ = _tmp8_;
		moserial_record_dialog_show (_tmp6_, _tmp9_);
	} else {
		moserialSerialStreamRecorder* _tmp10_;
		Preferences* _tmp11_;
		gboolean _tmp12_;
		gboolean _tmp13_;
		GtkToggleToolButton* _tmp14_;
		GtkLabel* _tmp15_;
		guint _tmp16_;
		_tmp10_ = self->priv->streamRecorder;
		_tmp11_ = self->priv->currentPreferences;
		_tmp12_ = preferences_get_recordLaunch (_tmp11_);
		_tmp13_ = _tmp12_;
		moserial_serial_stream_recorder_close (_tmp10_, _tmp13_);
		_tmp14_ = button;
		_tmp15_ = self->priv->recordLabel;
		gtk_tool_button_set_label_widget ((GtkToolButton*) _tmp14_, (GtkWidget*) _tmp15_);
		moserial_main_window_setWindowTitle (self, NULL);
		_tmp16_ = self->priv->recordTimeoutID;
		if (_tmp16_ > ((guint) 0)) {
			guint _tmp17_;
			_tmp17_ = self->priv->recordTimeoutID;
			g_source_remove (_tmp17_);
			self->priv->recordTimeoutID = (guint) 0;
		}
	}
}


void moserial_main_window_stopRecording (moserialMainWindow* self, moserialRecordDialog* dialog) {
	GtkToggleToolButton* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (dialog != NULL);
	_tmp0_ = self->priv->recordButton;
	gtk_toggle_tool_button_set_active (_tmp0_, FALSE);
}


void moserial_main_window_startRecording (moserialMainWindow* self, moserialRecordDialog* dialog, const gchar* filename, moserialSerialStreamRecorderDirection direction) {
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (dialog != NULL);
	g_return_if_fail (filename != NULL);
	{
		moserialSerialStreamRecorder* _tmp0_;
		const gchar* _tmp1_;
		moserialSerialStreamRecorderDirection _tmp2_;
		DefaultPaths* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gboolean _tmp7_;
		const gchar* _tmp9_;
		_tmp0_ = self->priv->streamRecorder;
		_tmp1_ = filename;
		_tmp2_ = direction;
		moserial_serial_stream_recorder_open (_tmp0_, _tmp1_, _tmp2_, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch3_g_error;
		}
		_tmp3_ = self->priv->currentPaths;
		_tmp4_ = filename;
		_tmp5_ = mo_utils_getParentFolder (_tmp4_);
		_tmp6_ = _tmp5_;
		default_paths_set_recordTo (_tmp3_, _tmp6_);
		_g_free0 (_tmp6_);
		_tmp7_ = moserial_main_window_ensureConnected (self);
		if (!_tmp7_) {
			moserialRecordDialog* _tmp8_;
			_tmp8_ = dialog;
			moserial_main_window_stopRecording (self, _tmp8_);
		}
		_tmp9_ = filename;
		moserial_main_window_setWindowTitle (self, _tmp9_);
	}
	goto __finally3;
	__catch3_g_error:
	{
		GError* e = NULL;
		GtkMessageDialog* errorDialog = NULL;
		GtkWindow* _tmp10_;
		const gchar* _tmp11_;
		GError* _tmp12_;
		const gchar* _tmp13_;
		GtkMessageDialog* _tmp14_;
		GtkMessageDialog* _tmp15_;
		GtkMessageDialog* _tmp16_;
		moserialRecordDialog* _tmp17_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp10_ = self->priv->gtkWindow;
		_tmp11_ = filename;
		_tmp12_ = e;
		_tmp13_ = _tmp12_->message;
		_tmp14_ = (GtkMessageDialog*) gtk_message_dialog_new (_tmp10_, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s: %s\n%s", _ ("Error: Could not open file"), _tmp11_, _tmp13_);
		g_object_ref_sink (_tmp14_);
		errorDialog = _tmp14_;
		_tmp15_ = errorDialog;
		gtk_dialog_run ((GtkDialog*) _tmp15_);
		_tmp16_ = errorDialog;
		gtk_widget_destroy ((GtkWidget*) _tmp16_);
		_tmp17_ = dialog;
		moserial_main_window_stopRecording (self, _tmp17_);
		_g_object_unref0 (errorDialog);
		_g_error_free0 (e);
	}
	__finally3:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


gboolean moserial_main_window_recordTimeout (moserialMainWindow* self) {
	gboolean result = FALSE;
	GtkToggleToolButton* _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->recordButton;
	gtk_toggle_tool_button_set_active (_tmp0_, FALSE);
	result = FALSE;
	return result;
}


void moserial_main_window_showWindow (moserialMainWindow* self) {
	GtkWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->gtkWindow;
	gtk_widget_show_all ((GtkWidget*) _tmp0_);
}


static void moserial_main_window_updateSettings (moserialMainWindow* self, moserialSettingsDialog* d, Settings* newSettings) {
	Settings* _tmp0_;
	Settings* _tmp1_;
	GtkStatusbar* _tmp2_;
	guint _tmp3_;
	GtkStatusbar* _tmp4_;
	guint _tmp5_;
	Settings* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (d != NULL);
	g_return_if_fail (newSettings != NULL);
	_tmp0_ = newSettings;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->currentSettings);
	self->priv->currentSettings = _tmp1_;
	_tmp2_ = self->priv->statusbar;
	_tmp3_ = self->priv->statusbarContext;
	gtk_statusbar_pop (_tmp2_, _tmp3_);
	_tmp4_ = self->priv->statusbar;
	_tmp5_ = self->priv->statusbarContext;
	_tmp6_ = self->priv->currentSettings;
	_tmp7_ = settings_getStatusbarString (_tmp6_, FALSE);
	_tmp8_ = _tmp7_;
	gtk_statusbar_push (_tmp4_, _tmp5_, _tmp8_);
	_g_free0 (_tmp8_);
	self->priv->profileChanged = TRUE;
}


static void _vala_PangoFontDescription_free (PangoFontDescription* self) {
	g_boxed_free (pango_font_description_get_type (), self);
}


static void moserial_main_window_updatePreferences (moserialMainWindow* self, moserialPreferencesDialog* d, Preferences* newPreferences) {
	Preferences* _tmp0_;
	Preferences* _tmp1_;
	gchar* font = NULL;
	Preferences* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	GtkTextView* _tmp10_;
	const gchar* _tmp11_;
	PangoFontDescription* _tmp12_;
	PangoFontDescription* _tmp13_;
	GtkTextView* _tmp14_;
	Preferences* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	GdkColor _tmp18_ = {0};
	GtkTextView* _tmp19_;
	Preferences* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	GdkColor _tmp23_ = {0};
	GtkTextTag* _tmp24_;
	Preferences* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	GtkTextView* _tmp28_;
	const gchar* _tmp29_;
	PangoFontDescription* _tmp30_;
	PangoFontDescription* _tmp31_;
	GtkTextView* _tmp32_;
	Preferences* _tmp33_;
	const gchar* _tmp34_;
	const gchar* _tmp35_;
	GdkColor _tmp36_ = {0};
	GtkTextView* _tmp37_;
	Preferences* _tmp38_;
	const gchar* _tmp39_;
	const gchar* _tmp40_;
	GdkColor _tmp41_ = {0};
	moserialHexTextBuffer* _tmp42_;
	Preferences* _tmp43_;
	GtkTextView* _tmp44_;
	const gchar* _tmp45_;
	PangoFontDescription* _tmp46_;
	PangoFontDescription* _tmp47_;
	GtkTextView* _tmp48_;
	Preferences* _tmp49_;
	const gchar* _tmp50_;
	const gchar* _tmp51_;
	GdkColor _tmp52_ = {0};
	GtkTextView* _tmp53_;
	Preferences* _tmp54_;
	const gchar* _tmp55_;
	const gchar* _tmp56_;
	GdkColor _tmp57_ = {0};
	GtkTextView* _tmp58_;
	const gchar* _tmp59_;
	PangoFontDescription* _tmp60_;
	PangoFontDescription* _tmp61_;
	GtkTextView* _tmp62_;
	Preferences* _tmp63_;
	const gchar* _tmp64_;
	const gchar* _tmp65_;
	GdkColor _tmp66_ = {0};
	GtkTextView* _tmp67_;
	Preferences* _tmp68_;
	const gchar* _tmp69_;
	const gchar* _tmp70_;
	GdkColor _tmp71_ = {0};
	moserialHexTextBuffer* _tmp72_;
	Preferences* _tmp73_;
	GtkEntry* _tmp74_;
	const gchar* _tmp75_;
	PangoFontDescription* _tmp76_;
	PangoFontDescription* _tmp77_;
	GtkEntry* _tmp78_;
	Preferences* _tmp79_;
	const gchar* _tmp80_;
	const gchar* _tmp81_;
	GdkColor _tmp82_ = {0};
	GtkEntry* _tmp83_;
	Preferences* _tmp84_;
	const gchar* _tmp85_;
	const gchar* _tmp86_;
	GdkColor _tmp87_ = {0};
	g_return_if_fail (self != NULL);
	g_return_if_fail (newPreferences != NULL);
	_tmp0_ = newPreferences;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->currentPreferences);
	self->priv->currentPreferences = _tmp1_;
	_tmp2_ = self->priv->currentPreferences;
	_tmp3_ = preferences_get_useSystemMonospaceFont (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		gchar* _tmp5_;
		_tmp5_ = preferences_getSystemDefaultMonospaceFont ();
		_g_free0 (font);
		font = _tmp5_;
	} else {
		Preferences* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp6_ = self->priv->currentPreferences;
		_tmp7_ = preferences_get_font (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_strdup (_tmp8_);
		_g_free0 (font);
		font = _tmp9_;
	}
	_tmp10_ = self->priv->incomingAsciiTextView;
	_tmp11_ = font;
	_tmp12_ = pango_font_description_from_string (_tmp11_);
	_tmp13_ = _tmp12_;
	gtk_widget_modify_font ((GtkWidget*) _tmp10_, _tmp13_);
	__vala_PangoFontDescription_free0 (_tmp13_);
	_tmp14_ = self->priv->incomingAsciiTextView;
	_tmp15_ = self->priv->currentPreferences;
	_tmp16_ = preferences_get_fontColor (_tmp15_);
	_tmp17_ = _tmp16_;
	preferences_getGdkColor (_tmp17_, &_tmp18_);
	gtk_widget_modify_text ((GtkWidget*) _tmp14_, GTK_STATE_NORMAL, &_tmp18_);
	_tmp19_ = self->priv->incomingAsciiTextView;
	_tmp20_ = self->priv->currentPreferences;
	_tmp21_ = preferences_get_backgroundColor (_tmp20_);
	_tmp22_ = _tmp21_;
	preferences_getGdkColor (_tmp22_, &_tmp23_);
	gtk_widget_modify_base ((GtkWidget*) _tmp19_, GTK_STATE_NORMAL, &_tmp23_);
	_tmp24_ = self->priv->echoTag;
	_tmp25_ = self->priv->currentPreferences;
	_tmp26_ = preferences_get_highlightColor (_tmp25_);
	_tmp27_ = _tmp26_;
	g_object_set (_tmp24_, "foreground", _tmp27_, NULL);
	_tmp28_ = self->priv->incomingHexTextView;
	_tmp29_ = font;
	_tmp30_ = pango_font_description_from_string (_tmp29_);
	_tmp31_ = _tmp30_;
	gtk_widget_modify_font ((GtkWidget*) _tmp28_, _tmp31_);
	__vala_PangoFontDescription_free0 (_tmp31_);
	_tmp32_ = self->priv->incomingHexTextView;
	_tmp33_ = self->priv->currentPreferences;
	_tmp34_ = preferences_get_fontColor (_tmp33_);
	_tmp35_ = _tmp34_;
	preferences_getGdkColor (_tmp35_, &_tmp36_);
	gtk_widget_modify_text ((GtkWidget*) _tmp32_, GTK_STATE_NORMAL, &_tmp36_);
	_tmp37_ = self->priv->incomingHexTextView;
	_tmp38_ = self->priv->currentPreferences;
	_tmp39_ = preferences_get_backgroundColor (_tmp38_);
	_tmp40_ = _tmp39_;
	preferences_getGdkColor (_tmp40_, &_tmp41_);
	gtk_widget_modify_base ((GtkWidget*) _tmp37_, GTK_STATE_NORMAL, &_tmp41_);
	_tmp42_ = self->priv->incomingHexTextBuffer;
	_tmp43_ = self->priv->currentPreferences;
	moserial_hex_text_buffer_applyPreferences (_tmp42_, _tmp43_);
	_tmp44_ = self->priv->outgoingAsciiTextView;
	_tmp45_ = font;
	_tmp46_ = pango_font_description_from_string (_tmp45_);
	_tmp47_ = _tmp46_;
	gtk_widget_modify_font ((GtkWidget*) _tmp44_, _tmp47_);
	__vala_PangoFontDescription_free0 (_tmp47_);
	_tmp48_ = self->priv->outgoingAsciiTextView;
	_tmp49_ = self->priv->currentPreferences;
	_tmp50_ = preferences_get_fontColor (_tmp49_);
	_tmp51_ = _tmp50_;
	preferences_getGdkColor (_tmp51_, &_tmp52_);
	gtk_widget_modify_text ((GtkWidget*) _tmp48_, GTK_STATE_NORMAL, &_tmp52_);
	_tmp53_ = self->priv->outgoingAsciiTextView;
	_tmp54_ = self->priv->currentPreferences;
	_tmp55_ = preferences_get_backgroundColor (_tmp54_);
	_tmp56_ = _tmp55_;
	preferences_getGdkColor (_tmp56_, &_tmp57_);
	gtk_widget_modify_base ((GtkWidget*) _tmp53_, GTK_STATE_NORMAL, &_tmp57_);
	_tmp58_ = self->priv->outgoingHexTextView;
	_tmp59_ = font;
	_tmp60_ = pango_font_description_from_string (_tmp59_);
	_tmp61_ = _tmp60_;
	gtk_widget_modify_font ((GtkWidget*) _tmp58_, _tmp61_);
	__vala_PangoFontDescription_free0 (_tmp61_);
	_tmp62_ = self->priv->outgoingHexTextView;
	_tmp63_ = self->priv->currentPreferences;
	_tmp64_ = preferences_get_fontColor (_tmp63_);
	_tmp65_ = _tmp64_;
	preferences_getGdkColor (_tmp65_, &_tmp66_);
	gtk_widget_modify_text ((GtkWidget*) _tmp62_, GTK_STATE_NORMAL, &_tmp66_);
	_tmp67_ = self->priv->outgoingHexTextView;
	_tmp68_ = self->priv->currentPreferences;
	_tmp69_ = preferences_get_backgroundColor (_tmp68_);
	_tmp70_ = _tmp69_;
	preferences_getGdkColor (_tmp70_, &_tmp71_);
	gtk_widget_modify_base ((GtkWidget*) _tmp67_, GTK_STATE_NORMAL, &_tmp71_);
	_tmp72_ = self->priv->outgoingHexTextBuffer;
	_tmp73_ = self->priv->currentPreferences;
	moserial_hex_text_buffer_applyPreferences (_tmp72_, _tmp73_);
	_tmp74_ = self->priv->entry;
	_tmp75_ = font;
	_tmp76_ = pango_font_description_from_string (_tmp75_);
	_tmp77_ = _tmp76_;
	gtk_widget_modify_font ((GtkWidget*) _tmp74_, _tmp77_);
	__vala_PangoFontDescription_free0 (_tmp77_);
	_tmp78_ = self->priv->entry;
	_tmp79_ = self->priv->currentPreferences;
	_tmp80_ = preferences_get_fontColor (_tmp79_);
	_tmp81_ = _tmp80_;
	preferences_getGdkColor (_tmp81_, &_tmp82_);
	gtk_widget_modify_text ((GtkWidget*) _tmp78_, GTK_STATE_NORMAL, &_tmp82_);
	_tmp83_ = self->priv->entry;
	_tmp84_ = self->priv->currentPreferences;
	_tmp85_ = preferences_get_backgroundColor (_tmp84_);
	_tmp86_ = _tmp85_;
	preferences_getGdkColor (_tmp86_, &_tmp87_);
	gtk_widget_modify_base ((GtkWidget*) _tmp83_, GTK_STATE_NORMAL, &_tmp87_);
	self->priv->profileChanged = TRUE;
	_g_free0 (font);
}


static void moserial_main_window_showSettingsDialog (moserialMainWindow* self, GObject* o) {
	moserialSettingsDialog* _tmp0_;
	Settings* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (o != NULL);
	_tmp0_ = self->priv->settingsDialog;
	_tmp1_ = self->priv->currentSettings;
	moserial_settings_dialog_show (_tmp0_, _tmp1_);
}


static void moserial_main_window_showPreferencesDialog (moserialMainWindow* self, GObject* o) {
	moserialPreferencesDialog* _tmp0_;
	Preferences* _tmp1_;
	GtkToggleToolButton* _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (o != NULL);
	_tmp0_ = self->priv->preferencesDialog;
	_tmp1_ = self->priv->currentPreferences;
	_tmp2_ = self->priv->recordButton;
	_tmp3_ = gtk_toggle_tool_button_get_active (_tmp2_);
	moserial_preferences_dialog_show (_tmp0_, _tmp1_, _tmp3_);
}


gboolean moserial_main_window_ensureConnected (moserialMainWindow* self) {
	gboolean result = FALSE;
	GtkToggleToolButton* _tmp0_;
	gboolean _tmp1_;
	GtkToggleToolButton* _tmp3_;
	gboolean _tmp4_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->connectButton;
	_tmp1_ = gtk_toggle_tool_button_get_active (_tmp0_);
	if (!_tmp1_) {
		GtkToggleToolButton* _tmp2_;
		_tmp2_ = self->priv->connectButton;
		gtk_toggle_tool_button_set_active (_tmp2_, TRUE);
	}
	_tmp3_ = self->priv->connectButton;
	_tmp4_ = gtk_toggle_tool_button_get_active (_tmp3_);
	result = _tmp4_;
	return result;
}


void moserial_main_window_ensureDisconnected (moserialMainWindow* self) {
	GtkToggleToolButton* _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->connectButton;
	_tmp1_ = gtk_toggle_tool_button_get_active (_tmp0_);
	if (_tmp1_) {
		GtkToggleToolButton* _tmp2_;
		_tmp2_ = self->priv->connectButton;
		gtk_toggle_tool_button_set_active (_tmp2_, FALSE);
	}
}


static void _moserial_main_window_updateIncoming_moserial_serial_connection_new_data (moserialSerialConnection* _sender, guchar* data, int data_length1, gint size, gpointer self) {
	moserial_main_window_updateIncoming ((moserialMainWindow*) self, _sender, data, data_length1, size);
}


static gboolean moserial_main_window_startConnection (moserialMainWindow* self) {
	gboolean result = FALSE;
	moserialSerialConnection* _tmp0_;
	Settings* _tmp1_;
	gboolean _tmp2_;
	moserialHexTextBuffer* _tmp11_;
	GtkTextBuffer* _tmp12_;
	moserialHexTextBuffer* _tmp13_;
	GtkTextBuffer* _tmp14_;
	GtkToolButton* _tmp15_;
	GtkStatusbar* _tmp16_;
	guint _tmp17_;
	GtkStatusbar* _tmp18_;
	guint _tmp19_;
	Settings* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	moserialSerialConnection* _tmp23_;
	GtkToggleToolButton* _tmp24_;
	GtkLabel* _tmp25_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->serialConnection;
	_tmp1_ = self->priv->currentSettings;
	_tmp2_ = moserial_serial_connection_doConnect (_tmp0_, _tmp1_);
	if (!_tmp2_) {
		GtkToggleToolButton* _tmp3_;
		GtkMessageDialog* dialog = NULL;
		GtkWindow* _tmp4_;
		Settings* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		GtkMessageDialog* _tmp8_;
		GtkMessageDialog* _tmp9_;
		GtkMessageDialog* _tmp10_;
		_tmp3_ = self->priv->connectButton;
		gtk_toggle_tool_button_set_active (_tmp3_, FALSE);
		_tmp4_ = self->priv->gtkWindow;
		_tmp5_ = self->priv->currentSettings;
		_tmp6_ = settings_get_device (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = (GtkMessageDialog*) gtk_message_dialog_new (_tmp4_, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s: %s", _ ("Error: Could not open device"), _tmp7_);
		g_object_ref_sink (_tmp8_);
		dialog = _tmp8_;
		_tmp9_ = dialog;
		gtk_dialog_run ((GtkDialog*) _tmp9_);
		_tmp10_ = dialog;
		gtk_widget_destroy ((GtkWidget*) _tmp10_);
		result = FALSE;
		_g_object_unref0 (dialog);
		return result;
	}
	_tmp11_ = self->priv->incomingHexTextBuffer;
	moserial_hex_text_buffer_clear (_tmp11_);
	_tmp12_ = self->priv->incomingAsciiTextBuffer;
	gtk_text_buffer_set_text (_tmp12_, "", 0);
	_tmp13_ = self->priv->outgoingHexTextBuffer;
	moserial_hex_text_buffer_clear (_tmp13_);
	_tmp14_ = self->priv->outgoingAsciiTextBuffer;
	gtk_text_buffer_set_text (_tmp14_, "", 0);
	_tmp15_ = self->priv->settingsButton;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp15_, FALSE);
	_tmp16_ = self->priv->statusbar;
	_tmp17_ = self->priv->statusbarContext;
	gtk_statusbar_pop (_tmp16_, _tmp17_);
	_tmp18_ = self->priv->statusbar;
	_tmp19_ = self->priv->statusbarContext;
	_tmp20_ = self->priv->currentSettings;
	_tmp21_ = settings_getStatusbarString (_tmp20_, TRUE);
	_tmp22_ = _tmp21_;
	gtk_statusbar_push (_tmp18_, _tmp19_, _tmp22_);
	_g_free0 (_tmp22_);
	_tmp23_ = self->priv->serialConnection;
	g_signal_connect_object (_tmp23_, "new-data", (GCallback) _moserial_main_window_updateIncoming_moserial_serial_connection_new_data, self, 0);
	_tmp24_ = self->priv->connectButton;
	_tmp25_ = self->priv->disconnectLabel;
	gtk_tool_button_set_label_widget ((GtkToolButton*) _tmp24_, (GtkWidget*) _tmp25_);
	result = TRUE;
	return result;
}


static void moserial_main_window_connectButtonClick (moserialMainWindow* self, GtkToggleToolButton* button) {
	GtkToggleToolButton* _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = button;
	_tmp1_ = gtk_toggle_tool_button_get_active (_tmp0_);
	if (_tmp1_) {
		moserial_main_window_startConnection (self);
	} else {
		GtkToolButton* _tmp2_;
		moserialSerialConnection* _tmp3_;
		moserialSerialConnection* _tmp4_;
		guint _tmp5_;
		GtkStatusbar* _tmp6_;
		guint _tmp7_;
		GtkStatusbar* _tmp8_;
		guint _tmp9_;
		moserialSerialConnection* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		GtkStatusbar* _tmp13_;
		guint _tmp14_;
		GtkStatusbar* _tmp15_;
		guint _tmp16_;
		Settings* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		GtkToggleToolButton* _tmp20_;
		GtkLabel* _tmp21_;
		GtkToggleToolButton* _tmp22_;
		gboolean _tmp23_;
		_tmp2_ = self->priv->settingsButton;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp2_, TRUE);
		_tmp3_ = self->priv->serialConnection;
		moserial_serial_connection_doDisconnect (_tmp3_);
		_tmp4_ = self->priv->serialConnection;
		g_signal_parse_name ("new-data", MOSERIAL_TYPE_SERIAL_CONNECTION, &_tmp5_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp4_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _moserial_main_window_updateIncoming_moserial_serial_connection_new_data, self);
		_tmp6_ = self->priv->bytecountbar;
		_tmp7_ = self->priv->bytecountbarContext;
		gtk_statusbar_pop (_tmp6_, _tmp7_);
		_tmp8_ = self->priv->bytecountbar;
		_tmp9_ = self->priv->bytecountbarContext;
		_tmp10_ = self->priv->serialConnection;
		_tmp11_ = moserial_serial_connection_getBytecountbarString (_tmp10_);
		_tmp12_ = _tmp11_;
		gtk_statusbar_push (_tmp8_, _tmp9_, _tmp12_);
		_g_free0 (_tmp12_);
		_tmp13_ = self->priv->statusbar;
		_tmp14_ = self->priv->statusbarContext;
		gtk_statusbar_pop (_tmp13_, _tmp14_);
		_tmp15_ = self->priv->statusbar;
		_tmp16_ = self->priv->statusbarContext;
		_tmp17_ = self->priv->currentSettings;
		_tmp18_ = settings_getStatusbarString (_tmp17_, FALSE);
		_tmp19_ = _tmp18_;
		gtk_statusbar_push (_tmp15_, _tmp16_, _tmp19_);
		_g_free0 (_tmp19_);
		_tmp20_ = button;
		_tmp21_ = self->priv->connectLabel;
		gtk_tool_button_set_label_widget ((GtkToolButton*) _tmp20_, (GtkWidget*) _tmp21_);
		_tmp22_ = self->priv->recordButton;
		_tmp23_ = gtk_toggle_tool_button_get_active (_tmp22_);
		if (_tmp23_) {
			GtkToggleToolButton* _tmp24_;
			_tmp24_ = self->priv->recordButton;
			gtk_toggle_tool_button_set_active (_tmp24_, FALSE);
		}
	}
}


static gboolean _moserial_main_window_recordTimeout_gsource_func (gpointer self) {
	gboolean result;
	result = moserial_main_window_recordTimeout ((moserialMainWindow*) self);
	return result;
}


static void moserial_main_window_updateIncoming (moserialMainWindow* self, moserialSerialConnection* sc, guchar* data, int data_length1, gint size) {
	moserialRzwrapper* _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sc != NULL);
	_tmp0_ = self->priv->rz;
	_tmp1_ = _tmp0_->running;
	if (_tmp1_) {
		moserialRzwrapper* _tmp10_;
		{
			gint x = 0;
			x = 0;
			{
				gboolean _tmp2_ = FALSE;
				_tmp2_ = TRUE;
				while (TRUE) {
					gint _tmp4_;
					gint _tmp5_;
					moserialRzwrapper* _tmp6_;
					guchar* _tmp7_;
					gint _tmp7__length1;
					gint _tmp8_;
					guchar _tmp9_;
					if (!_tmp2_) {
						gint _tmp3_;
						_tmp3_ = x;
						x = _tmp3_ + 1;
					}
					_tmp2_ = FALSE;
					_tmp4_ = x;
					_tmp5_ = size;
					if (!(_tmp4_ < _tmp5_)) {
						break;
					}
					_tmp6_ = self->priv->rz;
					_tmp7_ = data;
					_tmp7__length1 = data_length1;
					_tmp8_ = x;
					_tmp9_ = _tmp7_[_tmp8_];
					moserial_rzwrapper_writeChar (_tmp6_, _tmp9_);
				}
			}
		}
		_tmp10_ = self->priv->rz;
		moserial_rzwrapper_flush (_tmp10_);
	} else {
		moserialSzwrapper* _tmp11_;
		gboolean _tmp12_;
		_tmp11_ = self->priv->sz;
		_tmp12_ = _tmp11_->running;
		if (_tmp12_) {
			{
				gint x = 0;
				x = 0;
				{
					gboolean _tmp13_ = FALSE;
					_tmp13_ = TRUE;
					while (TRUE) {
						gint _tmp15_;
						gint _tmp16_;
						moserialSzwrapper* _tmp17_;
						guchar* _tmp18_;
						gint _tmp18__length1;
						gint _tmp19_;
						guchar _tmp20_;
						if (!_tmp13_) {
							gint _tmp14_;
							_tmp14_ = x;
							x = _tmp14_ + 1;
						}
						_tmp13_ = FALSE;
						_tmp15_ = x;
						_tmp16_ = size;
						if (!(_tmp15_ < _tmp16_)) {
							break;
						}
						_tmp17_ = self->priv->sz;
						_tmp18_ = data;
						_tmp18__length1 = data_length1;
						_tmp19_ = x;
						_tmp20_ = _tmp18_[_tmp19_];
						moserial_szwrapper_writeChar (_tmp17_, _tmp20_);
					}
				}
			}
		} else {
			moserialSerialStreamRecorder* _tmp138_;
			guchar* _tmp139_;
			gint _tmp139__length1;
			{
				gint x = 0;
				x = 0;
				{
					gboolean _tmp21_ = FALSE;
					_tmp21_ = TRUE;
					while (TRUE) {
						gint _tmp23_;
						gint _tmp24_;
						moserialHexTextBuffer* _tmp25_;
						guchar* _tmp26_;
						gint _tmp26__length1;
						gint _tmp27_;
						guchar _tmp28_;
						gunichar c = 0U;
						guchar* _tmp29_;
						gint _tmp29__length1;
						gint _tmp30_;
						guchar _tmp31_;
						gchar* _tmp32_;
						gchar* _tmp33_;
						gunichar _tmp34_;
						gunichar _tmp35_;
						gchar* s = NULL;
						guchar* _tmp36_;
						gint _tmp36__length1;
						gint _tmp37_;
						guchar _tmp38_;
						gchar* _tmp39_;
						moserialSerialConnection* _tmp40_;
						const gchar* _tmp41_;
						gint _tmp42_;
						gint _tmp43_;
						moserialSerialConnection* _tmp44_;
						const gchar* _tmp45_;
						gint _tmp46_;
						gint _tmp47_;
						gboolean _tmp53_ = FALSE;
						const gchar* _tmp54_;
						gboolean _tmp55_;
						moserialSerialConnection* _tmp70_;
						gunichar _tmp71_;
						gboolean _tmp72_ = FALSE;
						moserialSerialConnection* _tmp73_;
						const gchar* _tmp74_;
						gint _tmp75_;
						gint _tmp76_;
						gboolean _tmp101_ = FALSE;
						gboolean _tmp102_ = FALSE;
						gboolean _tmp103_ = FALSE;
						moserialSerialConnection* _tmp104_;
						gulong _tmp105_;
						gboolean _tmp116_ = FALSE;
						Preferences* _tmp117_;
						gboolean _tmp118_;
						gboolean _tmp119_;
						GtkStatusbar* _tmp131_;
						guint _tmp132_;
						GtkStatusbar* _tmp133_;
						guint _tmp134_;
						moserialSerialConnection* _tmp135_;
						gchar* _tmp136_;
						gchar* _tmp137_;
						if (!_tmp21_) {
							gint _tmp22_;
							_tmp22_ = x;
							x = _tmp22_ + 1;
						}
						_tmp21_ = FALSE;
						_tmp23_ = x;
						_tmp24_ = size;
						if (!(_tmp23_ < _tmp24_)) {
							break;
						}
						_tmp25_ = self->priv->incomingHexTextBuffer;
						_tmp26_ = data;
						_tmp26__length1 = data_length1;
						_tmp27_ = x;
						_tmp28_ = _tmp26_[_tmp27_];
						moserial_hex_text_buffer_add (_tmp25_, _tmp28_);
						_tmp29_ = data;
						_tmp29__length1 = data_length1;
						_tmp30_ = x;
						_tmp31_ = _tmp29_[_tmp30_];
						_tmp32_ = g_strdup_printf ("%c", (gint) _tmp31_);
						_tmp33_ = _tmp32_;
						_tmp34_ = string_get_char (_tmp33_, (glong) 0);
						_tmp35_ = _tmp34_;
						_g_free0 (_tmp33_);
						c = _tmp35_;
						_tmp36_ = data;
						_tmp36__length1 = data_length1;
						_tmp37_ = x;
						_tmp38_ = _tmp36_[_tmp37_];
						_tmp39_ = g_strdup_printf ("%c", (gint) _tmp38_);
						s = _tmp39_;
						_tmp40_ = sc;
						_tmp41_ = _tmp40_->echoCompare;
						_tmp42_ = strlen (_tmp41_);
						_tmp43_ = _tmp42_;
						_tmp44_ = sc;
						_tmp45_ = _tmp44_->echoReference;
						_tmp46_ = strlen (_tmp45_);
						_tmp47_ = _tmp46_;
						if (_tmp43_ < _tmp47_) {
							moserialSerialConnection* _tmp48_;
							moserialSerialConnection* _tmp49_;
							const gchar* _tmp50_;
							const gchar* _tmp51_;
							gchar* _tmp52_;
							_tmp48_ = sc;
							_tmp49_ = sc;
							_tmp50_ = _tmp49_->echoCompare;
							_tmp51_ = s;
							_tmp52_ = g_strconcat (_tmp50_, _tmp51_, NULL);
							_g_free0 (_tmp49_->echoCompare);
							_tmp49_->echoCompare = _tmp52_;
						}
						_tmp54_ = s;
						_tmp55_ = g_utf8_validate (_tmp54_, (gssize) -1, NULL);
						if (_tmp55_) {
							gboolean _tmp56_ = FALSE;
							gunichar _tmp57_;
							gboolean _tmp58_;
							_tmp57_ = c;
							_tmp58_ = g_unichar_isprint (_tmp57_);
							if (_tmp58_) {
								_tmp56_ = TRUE;
							} else {
								gunichar _tmp59_;
								gboolean _tmp60_;
								_tmp59_ = c;
								_tmp60_ = g_unichar_isspace (_tmp59_);
								_tmp56_ = _tmp60_;
							}
							_tmp53_ = _tmp56_;
						} else {
							_tmp53_ = FALSE;
						}
						if (_tmp53_) {
							gboolean _tmp61_ = FALSE;
							moserialSerialConnection* _tmp62_;
							gboolean _tmp63_;
							_tmp62_ = sc;
							_tmp63_ = _tmp62_->lastRxCharWasCR;
							if (_tmp63_) {
								gunichar _tmp64_;
								_tmp64_ = c;
								_tmp61_ = _tmp64_ == ((gunichar) '\n');
							} else {
								_tmp61_ = FALSE;
							}
							if (!_tmp61_) {
								GtkTextBuffer* _tmp65_;
								const gchar* _tmp66_;
								_tmp65_ = self->priv->incomingAsciiTextBuffer;
								_tmp66_ = s;
								moserial_main_window_insertBufferEnd (self, _tmp65_, _tmp66_);
							}
						} else {
							moserialSerialConnection* _tmp67_;
							moserialSerialConnection* _tmp68_;
							gulong _tmp69_;
							_tmp67_ = sc;
							_tmp68_ = sc;
							_tmp69_ = _tmp68_->nonprintable;
							_tmp68_->nonprintable = _tmp69_ + 1;
						}
						_tmp70_ = sc;
						_tmp71_ = c;
						_tmp70_->lastRxCharWasCR = _tmp71_ == ((gunichar) '\r');
						_tmp73_ = sc;
						_tmp74_ = _tmp73_->echoCompare;
						_tmp75_ = strlen (_tmp74_);
						_tmp76_ = _tmp75_;
						if (_tmp76_ > 0) {
							moserialSerialConnection* _tmp77_;
							const gchar* _tmp78_;
							gint _tmp79_;
							gint _tmp80_;
							moserialSerialConnection* _tmp81_;
							const gchar* _tmp82_;
							gint _tmp83_;
							gint _tmp84_;
							_tmp77_ = sc;
							_tmp78_ = _tmp77_->echoCompare;
							_tmp79_ = strlen (_tmp78_);
							_tmp80_ = _tmp79_;
							_tmp81_ = sc;
							_tmp82_ = _tmp81_->echoReference;
							_tmp83_ = strlen (_tmp82_);
							_tmp84_ = _tmp83_;
							_tmp72_ = _tmp80_ == _tmp84_;
						} else {
							_tmp72_ = FALSE;
						}
						if (_tmp72_) {
							moserialSerialConnection* _tmp85_;
							const gchar* _tmp86_;
							moserialSerialConnection* _tmp87_;
							const gchar* _tmp88_;
							moserialSerialConnection* _tmp97_;
							gchar* _tmp98_;
							moserialSerialConnection* _tmp99_;
							gchar* _tmp100_;
							_tmp85_ = sc;
							_tmp86_ = _tmp85_->echoCompare;
							_tmp87_ = sc;
							_tmp88_ = _tmp87_->echoReference;
							if (g_strcmp0 (_tmp86_, _tmp88_) == 0) {
								GtkTextIter echoStartIter = {0};
								GtkTextIter echoStopIter = {0};
								GtkTextBuffer* _tmp89_;
								GtkTextMark* _tmp90_;
								GtkTextIter _tmp91_ = {0};
								GtkTextBuffer* _tmp92_;
								GtkTextIter _tmp93_ = {0};
								GtkTextBuffer* _tmp94_;
								GtkTextIter _tmp95_;
								GtkTextIter _tmp96_;
								_tmp89_ = self->priv->incomingAsciiTextBuffer;
								_tmp90_ = self->priv->echoStartMark;
								gtk_text_buffer_get_iter_at_mark (_tmp89_, &_tmp91_, _tmp90_);
								echoStartIter = _tmp91_;
								_tmp92_ = self->priv->incomingAsciiTextBuffer;
								gtk_text_buffer_get_end_iter (_tmp92_, &_tmp93_);
								echoStopIter = _tmp93_;
								_tmp94_ = self->priv->incomingAsciiTextBuffer;
								_tmp95_ = echoStartIter;
								_tmp96_ = echoStopIter;
								gtk_text_buffer_apply_tag_by_name (_tmp94_, "echo", &_tmp95_, &_tmp96_);
							}
							_tmp97_ = sc;
							_tmp98_ = g_strdup ("");
							_g_free0 (_tmp97_->echoCompare);
							_tmp97_->echoCompare = _tmp98_;
							_tmp99_ = sc;
							_tmp100_ = g_strdup ("");
							_g_free0 (_tmp99_->echoReference);
							_tmp99_->echoReference = _tmp100_;
						}
						_tmp104_ = sc;
						_tmp105_ = _tmp104_->rx;
						if (_tmp105_ > ((gulong) 32)) {
							moserialSerialConnection* _tmp106_;
							gulong _tmp107_;
							_tmp106_ = sc;
							_tmp107_ = _tmp106_->nonprintable;
							_tmp103_ = _tmp107_ > ((gulong) 0);
						} else {
							_tmp103_ = FALSE;
						}
						if (_tmp103_) {
							moserialSerialConnection* _tmp108_;
							gulong _tmp109_;
							moserialSerialConnection* _tmp110_;
							gulong _tmp111_;
							_tmp108_ = sc;
							_tmp109_ = _tmp108_->rx;
							_tmp110_ = sc;
							_tmp111_ = _tmp110_->nonprintable;
							_tmp102_ = (_tmp109_ / _tmp111_) < ((gulong) 4);
						} else {
							_tmp102_ = FALSE;
						}
						if (_tmp102_) {
							moserialSerialConnection* _tmp112_;
							gboolean _tmp113_;
							_tmp112_ = sc;
							_tmp113_ = _tmp112_->forced_hex_view;
							_tmp101_ = !_tmp113_;
						} else {
							_tmp101_ = FALSE;
						}
						if (_tmp101_) {
							moserialSerialConnection* _tmp114_;
							GtkNotebook* _tmp115_;
							_tmp114_ = sc;
							_tmp114_->forced_hex_view = TRUE;
							_tmp115_ = self->priv->incoming_notebook;
							gtk_notebook_set_current_page (_tmp115_, 1);
						}
						_tmp117_ = self->priv->currentPreferences;
						_tmp118_ = preferences_get_enableTimeout (_tmp117_);
						_tmp119_ = _tmp118_;
						if (_tmp119_) {
							GtkToggleToolButton* _tmp120_;
							gboolean _tmp121_;
							_tmp120_ = self->priv->recordButton;
							_tmp121_ = gtk_toggle_tool_button_get_active (_tmp120_);
							_tmp116_ = _tmp121_;
						} else {
							_tmp116_ = FALSE;
						}
						if (_tmp116_) {
							guint _tmp122_;
							Preferences* _tmp124_;
							gint _tmp125_;
							gint _tmp126_;
							_tmp122_ = self->priv->recordTimeoutID;
							if (_tmp122_ > ((guint) 0)) {
								guint _tmp123_;
								_tmp123_ = self->priv->recordTimeoutID;
								g_source_remove (_tmp123_);
							}
							_tmp124_ = self->priv->currentPreferences;
							_tmp125_ = preferences_get_timeout (_tmp124_);
							_tmp126_ = _tmp125_;
							if (_tmp126_ > 0) {
								Preferences* _tmp127_;
								gint _tmp128_;
								gint _tmp129_;
								guint _tmp130_;
								_tmp127_ = self->priv->currentPreferences;
								_tmp128_ = preferences_get_timeout (_tmp127_);
								_tmp129_ = _tmp128_;
								_tmp130_ = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) _tmp129_, _moserial_main_window_recordTimeout_gsource_func, g_object_ref (self), g_object_unref);
								self->priv->recordTimeoutID = _tmp130_;
							}
						}
						self->priv->recordDataReceived = TRUE;
						_tmp131_ = self->priv->bytecountbar;
						_tmp132_ = self->priv->bytecountbarContext;
						gtk_statusbar_pop (_tmp131_, _tmp132_);
						_tmp133_ = self->priv->bytecountbar;
						_tmp134_ = self->priv->bytecountbarContext;
						_tmp135_ = sc;
						_tmp136_ = moserial_serial_connection_getBytecountbarString (_tmp135_);
						_tmp137_ = _tmp136_;
						gtk_statusbar_push (_tmp133_, _tmp134_, _tmp137_);
						_g_free0 (_tmp137_);
						_g_free0 (s);
					}
				}
			}
			_tmp138_ = self->priv->streamRecorder;
			_tmp139_ = data;
			_tmp139__length1 = data_length1;
			moserial_serial_stream_recorder_writeIncoming (_tmp138_, _tmp139_, _tmp139__length1);
		}
	}
}


static void moserial_main_window_inputModeChanged (moserialMainWindow* self, GtkComboBox* inputModeCombo) {
	GtkComboBox* _tmp0_;
	gint _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (inputModeCombo != NULL);
	_tmp0_ = inputModeCombo;
	_tmp1_ = gtk_combo_box_get_active (_tmp0_);
	if (_tmp1_ == ((gint) MOSERIAL_MAIN_WINDOW_INPUT_MODE_VALUES_HEX)) {
		GtkNotebook* _tmp2_;
		_tmp2_ = self->priv->outgoing_notebook;
		gtk_notebook_set_current_page (_tmp2_, 1);
	} else {
		GtkNotebook* _tmp3_;
		_tmp3_ = self->priv->outgoing_notebook;
		gtk_notebook_set_current_page (_tmp3_, 0);
	}
}


static void moserial_main_window_showHelpButton (moserialMainWindow* self, GtkToolButton* button) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	moserial_main_window_showHelp (self);
}


static void moserial_main_window_showHelpAction (moserialMainWindow* self) {
	g_return_if_fail (self != NULL);
	moserial_main_window_showHelp (self);
}


static void moserial_main_window_showHelp (moserialMainWindow* self) {
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	{
		gtk_show_uri_on_window (NULL, "help:moserial", (guint32) GDK_CURRENT_TIME, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch4_g_error;
		}
	}
	goto __finally4;
	__catch4_g_error:
	{
		GError* e = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp0_ = e;
		_tmp1_ = _tmp0_->message;
		g_warning (_ ("Unable to display help file: %s"), _tmp1_);
		_g_error_free0 (e);
	}
	__finally4:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


static void moserial_main_window_showAboutDialog (moserialMainWindow* self) {
	gchar* license_trans = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GtkWindow* _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = MOSERIAL_MAIN_WINDOW_license[0];
	_tmp1_ = g_strconcat (_ (_tmp0_), "\n", NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = MOSERIAL_MAIN_WINDOW_license[1];
	_tmp4_ = g_strconcat (_tmp2_, _ (_tmp3_), NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strconcat (_tmp5_, "\n", NULL);
	_tmp7_ = _tmp6_;
	_tmp8_ = MOSERIAL_MAIN_WINDOW_license[2];
	_tmp9_ = g_strconcat (_tmp7_, _ (_tmp8_), NULL);
	_tmp10_ = _tmp9_;
	_g_free0 (_tmp7_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp2_);
	license_trans = _tmp10_;
	_tmp11_ = self->priv->gtkWindow;
	gtk_show_about_dialog (_tmp11_, "version", VERSION, "copyright", "Copyright © 2009-2018\nMichael J. Chudobiak\n<mjc@svn.gnome.org>", "comments", _ ("A serial terminal for the GNOME desktop, optimized for logging and fil" \
"e capture."), "authors", MOSERIAL_MAIN_WINDOW_authors, "translator-credits", _ (MOSERIAL_MAIN_WINDOW_translators), "logo-icon-name", "moserial", "wrap-license", TRUE, "license", license_trans, "website", "http://live.gnome.org/moserial", "website_label", "http://live.gnome.org/moserial", NULL, NULL);
	_g_free0 (license_trans);
}


static void moserial_main_window_quitSizeSave (moserialMainWindow* self) {
	g_return_if_fail (self != NULL);
	moserial_main_window_windowSizeSave (self);
	moserial_main_window_quitSave (self);
}


static gboolean moserial_main_window_deleteSaveSize (moserialMainWindow* self) {
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	moserial_main_window_windowSizeSave (self);
	moserial_main_window_quitSave (self);
	gtk_main_quit ();
	result = TRUE;
	return result;
}


static gboolean moserial_main_window_keyPress (moserialMainWindow* self, GtkWidget* widget, GdkEventKey* key) {
	gboolean result = FALSE;
	GdkEventKey* _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (widget != NULL, FALSE);
	g_return_val_if_fail (key != NULL, FALSE);
	_tmp0_ = key;
	_tmp1_ = _tmp0_->keyval;
	_tmp2_ = gdk_keyval_from_name ("Escape");
	if (_tmp1_ == _tmp2_) {
		GtkAdjustment* _tmp3_;
		GtkAdjustment* _tmp4_;
		GtkAdjustment* _tmp5_;
		GtkAdjustment* _tmp6_;
		GtkEntry* _tmp7_;
		GtkEntry* _tmp8_;
		_tmp3_ = self->priv->va1;
		moserial_auto_scroll_scroll (_tmp3_);
		_tmp4_ = self->priv->va2;
		moserial_auto_scroll_scroll (_tmp4_);
		_tmp5_ = self->priv->va3;
		moserial_auto_scroll_scroll (_tmp5_);
		_tmp6_ = self->priv->va4;
		moserial_auto_scroll_scroll (_tmp6_);
		_tmp7_ = self->priv->entry;
		gtk_widget_grab_focus ((GtkWidget*) _tmp7_);
		_tmp8_ = self->priv->entry;
		gtk_editable_set_position ((GtkEditable*) _tmp8_, -1);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}


static void moserial_main_window_windowSizeSave (moserialMainWindow* self) {
	gint width = 0;
	gint height = 0;
	gint pos = 0;
	GtkPaned* _tmp0_;
	gint _tmp1_;
	GtkWindow* _tmp2_;
	gint _tmp3_ = 0;
	gint _tmp4_ = 0;
	Profile* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	Profile* _tmp8_;
	g_return_if_fail (self != NULL);
	width = 0;
	height = 0;
	_tmp0_ = self->priv->paned;
	_tmp1_ = gtk_paned_get_position (_tmp0_);
	pos = _tmp1_;
	_tmp2_ = self->priv->gtkWindow;
	gtk_window_get_size (_tmp2_, &_tmp3_, &_tmp4_);
	width = _tmp3_;
	height = _tmp4_;
	_tmp5_ = self->priv->profile;
	_tmp6_ = width;
	_tmp7_ = height;
	profile_saveWindowSize (_tmp5_, _tmp6_, _tmp7_);
	_tmp8_ = self->priv->profile;
	profile_saveWindowPanedPosition (_tmp8_, pos);
}


static void moserial_main_window_quitSave (moserialMainWindow* self) {
	Preferences* _tmp0_;
	Profile* _tmp1_;
	Settings* _tmp2_;
	Profile* _tmp3_;
	DefaultPaths* _tmp4_;
	Profile* _tmp5_;
	const gchar* _tmp6_;
	Profile* _tmp14_;
	GtkWindow* _tmp15_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->currentPreferences;
	_tmp1_ = self->priv->profile;
	preferences_saveToProfile (_tmp0_, _tmp1_);
	_tmp2_ = self->priv->currentSettings;
	_tmp3_ = self->priv->profile;
	settings_saveToProfile (_tmp2_, _tmp3_);
	_tmp4_ = self->priv->currentPaths;
	_tmp5_ = self->priv->profile;
	default_paths_saveToProfile (_tmp4_, _tmp5_);
	_tmp6_ = self->priv->profileFilename;
	if (_tmp6_ != NULL) {
		gboolean _tmp7_;
		_tmp7_ = self->priv->profileChanged;
		if (_tmp7_) {
			GtkMessageDialog* dialog = NULL;
			GtkWindow* _tmp8_;
			GtkMessageDialog* _tmp9_;
			gint response = 0;
			GtkMessageDialog* _tmp10_;
			gint _tmp11_;
			gint _tmp12_;
			GtkMessageDialog* _tmp13_;
			_tmp8_ = self->priv->gtkWindow;
			_tmp9_ = (GtkMessageDialog*) gtk_message_dialog_new (_tmp8_, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", _ ("You have changed your setting or preferences. Do you want to save thes" \
"e changes to the loaded profile?"));
			g_object_ref_sink (_tmp9_);
			dialog = _tmp9_;
			_tmp10_ = dialog;
			_tmp11_ = gtk_dialog_run ((GtkDialog*) _tmp10_);
			response = _tmp11_;
			_tmp12_ = response;
			if (_tmp12_ == ((gint) GTK_RESPONSE_YES)) {
				moserial_main_window_saveProfile (self);
			}
			_tmp13_ = dialog;
			gtk_widget_destroy ((GtkWidget*) _tmp13_);
			_g_object_unref0 (dialog);
		} else {
			moserial_main_window_saveProfile (self);
		}
	}
	_tmp14_ = self->priv->profile;
	_tmp15_ = self->priv->gtkWindow;
	profile_save (_tmp14_, NULL, _tmp15_);
	gtk_main_quit ();
}


static void moserial_main_window_saveProfile (moserialMainWindow* self) {
	Preferences* _tmp0_;
	Profile* _tmp1_;
	Settings* _tmp2_;
	Profile* _tmp3_;
	DefaultPaths* _tmp4_;
	Profile* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	Profile* _tmp8_;
	const gchar* _tmp9_;
	GtkWindow* _tmp10_;
	GtkRecentManager* recentManager = NULL;
	GtkRecentManager* _tmp11_;
	GtkRecentManager* _tmp12_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->currentPreferences;
	_tmp1_ = self->priv->profile;
	preferences_saveToProfile (_tmp0_, _tmp1_);
	_tmp2_ = self->priv->currentSettings;
	_tmp3_ = self->priv->profile;
	settings_saveToProfile (_tmp2_, _tmp3_);
	_tmp4_ = self->priv->currentPaths;
	_tmp5_ = self->priv->profile;
	default_paths_saveToProfile (_tmp4_, _tmp5_);
	_tmp6_ = self->priv->profileFilename;
	if (_tmp6_ == NULL) {
		moserial_main_window_saveProfileAs (self);
	}
	_tmp7_ = self->priv->profileFilename;
	if (_tmp7_ == NULL) {
		return;
	}
	_tmp8_ = self->priv->profile;
	_tmp9_ = self->priv->profileFilename;
	_tmp10_ = self->priv->gtkWindow;
	profile_save (_tmp8_, _tmp9_, _tmp10_);
	self->priv->profileChanged = FALSE;
	_tmp11_ = gtk_recent_manager_get_default ();
	_tmp12_ = _g_object_ref0 (_tmp11_);
	recentManager = _tmp12_;
	{
		gchar* _tmp13_ = NULL;
		const gchar* _tmp14_;
		gchar* _tmp15_;
		GtkRecentManager* _tmp16_;
		GtkRecentData _tmp17_;
		_tmp14_ = self->priv->profileFilename;
		_tmp15_ = g_filename_to_uri (_tmp14_, NULL, &_inner_error_);
		_tmp13_ = _tmp15_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == G_CONVERT_ERROR) {
				goto __catch5_g_convert_error;
			}
			_g_object_unref0 (recentManager);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
		_tmp16_ = recentManager;
		_tmp17_ = self->priv->recentData;
		gtk_recent_manager_add_full (_tmp16_, _tmp13_, &_tmp17_);
		_g_free0 (_tmp13_);
	}
	goto __finally5;
	__catch5_g_convert_error:
	{
		GError* e = NULL;
		FILE* _tmp18_;
		GError* _tmp19_;
		const gchar* _tmp20_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp18_ = stdout;
		_tmp19_ = e;
		_tmp20_ = _tmp19_->message;
		fprintf (_tmp18_, "%s\n", _tmp20_);
		_g_error_free0 (e);
	}
	__finally5:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_object_unref0 (recentManager);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_g_object_unref0 (recentManager);
}


static void moserial_main_window_saveProfileAs (moserialMainWindow* self) {
	GtkFileChooserDialog* dialog = NULL;
	GtkWindow* _tmp0_;
	GtkFileChooserDialog* _tmp1_;
	GtkFileChooserDialog* _tmp2_;
	GtkFileChooserDialog* _tmp3_;
	GtkFileChooserDialog* _tmp4_;
	gint response = 0;
	GtkFileChooserDialog* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	GtkFileChooserDialog* _tmp10_;
	gint _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->gtkWindow;
	_tmp1_ = (GtkFileChooserDialog*) gtk_file_chooser_dialog_new (NULL, _tmp0_, GTK_FILE_CHOOSER_ACTION_SAVE, NULL);
	g_object_ref_sink (_tmp1_);
	dialog = _tmp1_;
	_tmp2_ = dialog;
	gtk_dialog_add_buttons ((GtkDialog*) _tmp2_, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL, NULL);
	_tmp3_ = dialog;
	gtk_file_chooser_set_do_overwrite_confirmation ((GtkFileChooser*) _tmp3_, TRUE);
	_tmp4_ = dialog;
	gtk_file_chooser_set_local_only ((GtkFileChooser*) _tmp4_, FALSE);
	_tmp5_ = dialog;
	_tmp6_ = gtk_dialog_run ((GtkDialog*) _tmp5_);
	response = _tmp6_;
	_tmp7_ = response;
	if (_tmp7_ == ((gint) GTK_RESPONSE_ACCEPT)) {
		GtkFileChooserDialog* _tmp8_;
		gchar* _tmp9_;
		_tmp8_ = dialog;
		_tmp9_ = gtk_file_chooser_get_filename ((GtkFileChooser*) _tmp8_);
		_g_free0 (self->priv->profileFilename);
		self->priv->profileFilename = _tmp9_;
	}
	_tmp10_ = dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp10_);
	_tmp11_ = response;
	if (_tmp11_ == ((gint) GTK_RESPONSE_ACCEPT)) {
		moserial_main_window_saveProfile (self);
	}
	_g_object_unref0 (dialog);
}


static void moserial_main_window_loadProfileOnStartup (moserialMainWindow* self, const gchar* profileFilename) {
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (profileFilename != NULL);
	_tmp0_ = profileFilename;
	moserial_main_window_applyProfile (self, _tmp0_);
}


static void moserial_main_window_loadProfile (moserialMainWindow* self) {
	GtkFileChooserDialog* dialog = NULL;
	GtkWindow* _tmp0_;
	GtkFileChooserDialog* _tmp1_;
	GtkFileChooserDialog* _tmp2_;
	GtkFileChooserDialog* _tmp3_;
	gint response = 0;
	GtkFileChooserDialog* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	GtkFileChooserDialog* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->gtkWindow;
	_tmp1_ = (GtkFileChooserDialog*) gtk_file_chooser_dialog_new (NULL, _tmp0_, GTK_FILE_CHOOSER_ACTION_OPEN, NULL);
	g_object_ref_sink (_tmp1_);
	dialog = _tmp1_;
	_tmp2_ = dialog;
	gtk_dialog_add_buttons ((GtkDialog*) _tmp2_, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL, NULL);
	_tmp3_ = dialog;
	gtk_file_chooser_set_local_only ((GtkFileChooser*) _tmp3_, FALSE);
	_tmp4_ = dialog;
	_tmp5_ = gtk_dialog_run ((GtkDialog*) _tmp4_);
	response = _tmp5_;
	_tmp6_ = response;
	if (_tmp6_ == ((gint) GTK_RESPONSE_ACCEPT)) {
		GtkFileChooserDialog* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp7_ = dialog;
		_tmp8_ = gtk_file_chooser_get_filename ((GtkFileChooser*) _tmp7_);
		_tmp9_ = _tmp8_;
		moserial_main_window_applyProfile (self, _tmp9_);
		_g_free0 (_tmp9_);
	}
	_tmp10_ = dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp10_);
	_g_object_unref0 (dialog);
}


static void moserial_main_window_copy (moserialMainWindow* self) {
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	GtkWindow* _tmp3_;
	GtkWidget* _tmp4_;
	GtkTextView* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp3_ = self->priv->gtkWindow;
	_tmp4_ = gtk_window_get_focus (_tmp3_);
	_tmp5_ = self->priv->outgoingAsciiTextView;
	if (_tmp4_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, gtk_widget_get_type (), GtkWidget)) {
		_tmp2_ = TRUE;
	} else {
		GtkWindow* _tmp6_;
		GtkWidget* _tmp7_;
		GtkTextView* _tmp8_;
		_tmp6_ = self->priv->gtkWindow;
		_tmp7_ = gtk_window_get_focus (_tmp6_);
		_tmp8_ = self->priv->incomingAsciiTextView;
		_tmp2_ = _tmp7_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, gtk_widget_get_type (), GtkWidget);
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		GtkWindow* _tmp9_;
		GtkWidget* _tmp10_;
		GtkTextView* _tmp11_;
		_tmp9_ = self->priv->gtkWindow;
		_tmp10_ = gtk_window_get_focus (_tmp9_);
		_tmp11_ = self->priv->outgoingHexTextView;
		_tmp1_ = _tmp10_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, gtk_widget_get_type (), GtkWidget);
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		GtkWindow* _tmp12_;
		GtkWidget* _tmp13_;
		GtkTextView* _tmp14_;
		_tmp12_ = self->priv->gtkWindow;
		_tmp13_ = gtk_window_get_focus (_tmp12_);
		_tmp14_ = self->priv->incomingHexTextView;
		_tmp0_ = _tmp13_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, gtk_widget_get_type (), GtkWidget);
	}
	if (_tmp0_) {
		GtkTextView* tv = NULL;
		GtkWindow* _tmp15_;
		GtkWidget* _tmp16_;
		GtkTextView* _tmp17_;
		GtkTextView* _tmp18_;
		GtkTextBuffer* _tmp19_;
		GtkTextBuffer* _tmp20_;
		GtkClipboard* _tmp21_;
		_tmp15_ = self->priv->gtkWindow;
		_tmp16_ = gtk_window_get_focus (_tmp15_);
		_tmp17_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, gtk_text_view_get_type (), GtkTextView));
		tv = _tmp17_;
		_tmp18_ = tv;
		_tmp19_ = gtk_text_view_get_buffer (_tmp18_);
		_tmp20_ = _tmp19_;
		_tmp21_ = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
		gtk_text_buffer_copy_clipboard (_tmp20_, _tmp21_);
		_g_object_unref0 (tv);
	} else {
		GtkWindow* _tmp22_;
		GtkWidget* _tmp23_;
		GtkEntry* _tmp24_;
		_tmp22_ = self->priv->gtkWindow;
		_tmp23_ = gtk_window_get_focus (_tmp22_);
		_tmp24_ = self->priv->entry;
		if (_tmp23_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, gtk_widget_get_type (), GtkWidget)) {
			GtkEntry* _tmp25_;
			_tmp25_ = self->priv->entry;
			g_signal_emit_by_name (_tmp25_, "copy-clipboard");
		}
	}
}


static void moserial_main_window_cut (moserialMainWindow* self) {
	GtkWindow* _tmp0_;
	GtkWidget* _tmp1_;
	GtkEntry* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->gtkWindow;
	_tmp1_ = gtk_window_get_focus (_tmp0_);
	_tmp2_ = self->priv->entry;
	if (_tmp1_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_widget_get_type (), GtkWidget)) {
		GtkEntry* _tmp3_;
		_tmp3_ = self->priv->entry;
		g_signal_emit_by_name (_tmp3_, "cut-clipboard");
	}
}


static void moserial_main_window_editMenu (moserialMainWindow* self) {
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	GtkWindow* _tmp3_;
	GtkWidget* _tmp4_;
	GtkTextView* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp3_ = self->priv->gtkWindow;
	_tmp4_ = gtk_window_get_focus (_tmp3_);
	_tmp5_ = self->priv->outgoingAsciiTextView;
	if (_tmp4_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, gtk_widget_get_type (), GtkWidget)) {
		_tmp2_ = TRUE;
	} else {
		GtkWindow* _tmp6_;
		GtkWidget* _tmp7_;
		GtkTextView* _tmp8_;
		_tmp6_ = self->priv->gtkWindow;
		_tmp7_ = gtk_window_get_focus (_tmp6_);
		_tmp8_ = self->priv->incomingAsciiTextView;
		_tmp2_ = _tmp7_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, gtk_widget_get_type (), GtkWidget);
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		GtkWindow* _tmp9_;
		GtkWidget* _tmp10_;
		GtkTextView* _tmp11_;
		_tmp9_ = self->priv->gtkWindow;
		_tmp10_ = gtk_window_get_focus (_tmp9_);
		_tmp11_ = self->priv->outgoingHexTextView;
		_tmp1_ = _tmp10_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, gtk_widget_get_type (), GtkWidget);
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		GtkWindow* _tmp12_;
		GtkWidget* _tmp13_;
		GtkTextView* _tmp14_;
		_tmp12_ = self->priv->gtkWindow;
		_tmp13_ = gtk_window_get_focus (_tmp12_);
		_tmp14_ = self->priv->incomingHexTextView;
		_tmp0_ = _tmp13_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, gtk_widget_get_type (), GtkWidget);
	}
	if (_tmp0_) {
		GtkImageMenuItem* _tmp15_;
		GtkTextView* tv = NULL;
		GtkWindow* _tmp16_;
		GtkWidget* _tmp17_;
		GtkTextView* _tmp18_;
		GtkTextView* _tmp19_;
		GtkTextBuffer* _tmp20_;
		GtkTextBuffer* _tmp21_;
		gboolean _tmp22_;
		gboolean _tmp23_;
		_tmp15_ = self->priv->cutMenuItem;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp15_, FALSE);
		_tmp16_ = self->priv->gtkWindow;
		_tmp17_ = gtk_window_get_focus (_tmp16_);
		_tmp18_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, gtk_text_view_get_type (), GtkTextView));
		tv = _tmp18_;
		_tmp19_ = tv;
		_tmp20_ = gtk_text_view_get_buffer (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = gtk_text_buffer_get_has_selection (_tmp21_);
		_tmp23_ = _tmp22_;
		if (_tmp23_) {
			GtkImageMenuItem* _tmp24_;
			_tmp24_ = self->priv->copyMenuItem;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp24_, TRUE);
		} else {
			GtkImageMenuItem* _tmp25_;
			_tmp25_ = self->priv->copyMenuItem;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp25_, FALSE);
		}
		_g_object_unref0 (tv);
	} else {
		GtkWindow* _tmp26_;
		GtkWidget* _tmp27_;
		GtkEntry* _tmp28_;
		_tmp26_ = self->priv->gtkWindow;
		_tmp27_ = gtk_window_get_focus (_tmp26_);
		_tmp28_ = self->priv->entry;
		if (_tmp27_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp28_, gtk_widget_get_type (), GtkWidget)) {
			GtkEntry* _tmp29_;
			gboolean _tmp30_;
			_tmp29_ = self->priv->entry;
			_tmp30_ = gtk_editable_get_selection_bounds ((GtkEditable*) _tmp29_, NULL, NULL);
			if (_tmp30_) {
				GtkImageMenuItem* _tmp31_;
				GtkImageMenuItem* _tmp32_;
				_tmp31_ = self->priv->cutMenuItem;
				gtk_widget_set_sensitive ((GtkWidget*) _tmp31_, TRUE);
				_tmp32_ = self->priv->copyMenuItem;
				gtk_widget_set_sensitive ((GtkWidget*) _tmp32_, TRUE);
			} else {
				GtkImageMenuItem* _tmp33_;
				GtkImageMenuItem* _tmp34_;
				_tmp33_ = self->priv->cutMenuItem;
				gtk_widget_set_sensitive ((GtkWidget*) _tmp33_, FALSE);
				_tmp34_ = self->priv->copyMenuItem;
				gtk_widget_set_sensitive ((GtkWidget*) _tmp34_, FALSE);
			}
		} else {
			GtkImageMenuItem* _tmp35_;
			GtkImageMenuItem* _tmp36_;
			_tmp35_ = self->priv->cutMenuItem;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp35_, FALSE);
			_tmp36_ = self->priv->copyMenuItem;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp36_, FALSE);
		}
	}
}


static void moserial_main_window_paste (moserialMainWindow* self) {
	GtkEntry* _tmp0_;
	GtkEntry* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->entry;
	g_signal_emit_by_name (_tmp0_, "paste-clipboard");
	_tmp1_ = self->priv->entry;
	g_object_get ((GtkWidget*) _tmp1_, "has-focus", &_tmp2_, NULL);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		GtkEntry* _tmp4_;
		GtkEntry* _tmp5_;
		_tmp4_ = self->priv->entry;
		gtk_widget_grab_focus ((GtkWidget*) _tmp4_);
		_tmp5_ = self->priv->entry;
		gtk_editable_set_position ((GtkEditable*) _tmp5_, -1);
	}
}


static void moserial_main_window_clear (moserialMainWindow* self) {
	moserialHexTextBuffer* _tmp0_;
	GtkTextBuffer* _tmp1_;
	moserialHexTextBuffer* _tmp2_;
	GtkTextBuffer* _tmp3_;
	GtkEntry* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->incomingHexTextBuffer;
	moserial_hex_text_buffer_clear (_tmp0_);
	_tmp1_ = self->priv->incomingAsciiTextBuffer;
	gtk_text_buffer_set_text (_tmp1_, "", 0);
	_tmp2_ = self->priv->outgoingHexTextBuffer;
	moserial_hex_text_buffer_clear (_tmp2_);
	_tmp3_ = self->priv->outgoingAsciiTextBuffer;
	gtk_text_buffer_set_text (_tmp3_, "", 0);
	_tmp4_ = self->priv->entry;
	gtk_entry_set_text (_tmp4_, "");
}


const gchar* moserial_main_window_get_startupProfileFilename (moserialMainWindow* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_startupProfileFilename;
	result = _tmp0_;
	return result;
}


static void moserial_main_window_set_startupProfileFilename (moserialMainWindow* self, const gchar* value) {
	g_return_if_fail (self != NULL);
	if (g_strcmp0 (value, moserial_main_window_get_startupProfileFilename (self)) != 0) {
		const gchar* _tmp0_;
		gchar* _tmp1_;
		_tmp0_ = value;
		_tmp1_ = g_strdup (_tmp0_);
		_g_free0 (self->priv->_startupProfileFilename);
		self->priv->_startupProfileFilename = _tmp1_;
		g_object_notify_by_pspec ((GObject *) self, moserial_main_window_properties[MOSERIAL_MAIN_WINDOW_STARTUP_PROFILE_FILENAME_PROPERTY]);
	}
}


static void _moserial_main_window_quitSave_gtk_widget_destroy (GtkWidget* _sender, gpointer self) {
	moserial_main_window_quitSave ((moserialMainWindow*) self);
}


static gboolean _moserial_main_window_deleteSaveSize_gtk_widget_delete_event (GtkWidget* _sender, GdkEventAny* event, gpointer self) {
	gboolean result;
	result = moserial_main_window_deleteSaveSize ((moserialMainWindow*) self);
	return result;
}


static gboolean _moserial_main_window_keyPress_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) {
	gboolean result;
	result = moserial_main_window_keyPress ((moserialMainWindow*) self, _sender, event);
	return result;
}


static void _moserial_main_window_quitSizeSave_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
	moserial_main_window_quitSizeSave ((moserialMainWindow*) self);
}


static void _moserial_main_window_saveProfileAs_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
	moserial_main_window_saveProfileAs ((moserialMainWindow*) self);
}


static void _moserial_main_window_saveProfile_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
	moserial_main_window_saveProfile ((moserialMainWindow*) self);
}


static void _moserial_main_window_loadProfile_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
	moserial_main_window_loadProfile ((moserialMainWindow*) self);
}


static void _moserial_main_window_copy_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
	moserial_main_window_copy ((moserialMainWindow*) self);
}


static void _moserial_main_window_editMenu_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
	moserial_main_window_editMenu ((moserialMainWindow*) self);
}


static void _moserial_main_window_cut_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
	moserial_main_window_cut ((moserialMainWindow*) self);
}


static void _moserial_main_window_paste_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
	moserial_main_window_paste ((moserialMainWindow*) self);
}


static void _moserial_main_window_clear_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
	moserial_main_window_clear ((moserialMainWindow*) self);
}


static void _moserial_main_window_updateSettings_moserial_settings_dialog_update_settings (moserialSettingsDialog* _sender, Settings* settings, gpointer self) {
	moserial_main_window_updateSettings ((moserialMainWindow*) self, _sender, settings);
}


static void _moserial_main_window_showSettingsDialog_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
	moserial_main_window_showSettingsDialog ((moserialMainWindow*) self, _sender);
}


static void _moserial_main_window_showHelpButton_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
	moserial_main_window_showHelpButton ((moserialMainWindow*) self, _sender);
}


static void _moserial_main_window_showAboutDialog_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
	moserial_main_window_showAboutDialog ((moserialMainWindow*) self);
}


static void _moserial_main_window_doSendChooser_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
	moserial_main_window_doSendChooser ((moserialMainWindow*) self, _sender);
}


static void _moserial_main_window_doSend_moserial_send_chooser_dialog_start_transfer (moserialSendChooserDialog* _sender, gpointer self) {
	moserial_main_window_doSend ((moserialMainWindow*) self, _sender);
}


static void _moserial_main_window_doReceiveChooser_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
	moserial_main_window_doReceiveChooser ((moserialMainWindow*) self, _sender);
}


static void _moserial_main_window_doReceive_moserial_receive_chooser_dialog_start_transfer (moserialReceiveChooserDialog* _sender, gpointer self) {
	moserial_main_window_doReceive ((moserialMainWindow*) self, _sender);
}


static void _moserial_main_window_record_gtk_toggle_tool_button_toggled (GtkToggleToolButton* _sender, gpointer self) {
	moserial_main_window_record ((moserialMainWindow*) self, _sender);
}


static void _moserial_main_window_stopRecording_moserial_record_dialog_stop_recording (moserialRecordDialog* _sender, gpointer self) {
	moserial_main_window_stopRecording ((moserialMainWindow*) self, _sender);
}


static void _moserial_main_window_startRecording_moserial_record_dialog_start_recording (moserialRecordDialog* _sender, const gchar* fileName, moserialSerialStreamRecorderDirection direction, gpointer self) {
	moserial_main_window_startRecording ((moserialMainWindow*) self, _sender, fileName, direction);
}


static void _moserial_main_window_updatePreferences_moserial_preferences_dialog_update_preferences (moserialPreferencesDialog* _sender, Preferences* preferences, gpointer self) {
	moserial_main_window_updatePreferences ((moserialMainWindow*) self, _sender, preferences);
}


static void _moserial_main_window_showPreferencesDialog_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
	moserial_main_window_showPreferencesDialog ((moserialMainWindow*) self, _sender);
}


static void _moserial_main_window_connectButtonClick_gtk_toggle_tool_button_toggled (GtkToggleToolButton* _sender, gpointer self) {
	moserial_main_window_connectButtonClick ((moserialMainWindow*) self, _sender);
}


static void _moserial_main_window_showHelpAction_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
	moserial_main_window_showHelpAction ((moserialMainWindow*) self);
}


static void _moserial_main_window_sendString_gtk_button_clicked (GtkButton* _sender, gpointer self) {
	moserial_main_window_sendString ((moserialMainWindow*) self, _sender);
}


static void _moserial_main_window_sendString_gtk_entry_activate (GtkEntry* _sender, gpointer self) {
	moserial_main_window_sendString ((moserialMainWindow*) self, _sender);
}


static void _moserial_main_window_inputModeChanged_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) {
	moserial_main_window_inputModeChanged ((moserialMainWindow*) self, _sender);
}


static void _moserial_main_window_recentItemOpen_gtk_recent_chooser_item_activated (GtkRecentChooser* _sender, gpointer self) {
	moserial_main_window_recentItemOpen ((moserialMainWindow*) self, _sender);
}


static GObject * moserial_main_window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	moserialMainWindow * self;
	GtkBuilder* builder = NULL;
	GtkBuilder* _tmp0_;
	GtkBuilder* _tmp1_;
	GObject* _tmp2_;
	GtkWindow* _tmp3_;
	GtkBuilder* _tmp4_;
	GObject* _tmp5_;
	GtkAccelGroup* _tmp6_;
	GtkWindow* _tmp7_;
	GtkAccelGroup* _tmp8_;
	GtkWindow* _tmp9_;
	GtkWindow* _tmp10_;
	GtkWindow* _tmp11_;
	Profile* _tmp12_;
	Profile* _tmp13_;
	GtkWindow* _tmp14_;
	Profile* _tmp15_;
	Settings* _tmp16_;
	gint width = 0;
	Profile* _tmp17_;
	gint _tmp18_;
	gint height = 0;
	Profile* _tmp19_;
	gint _tmp20_;
	gint panedPosition = 0;
	Profile* _tmp21_;
	gint _tmp22_;
	gboolean _tmp23_ = FALSE;
	gint _tmp24_;
	GtkBuilder* _tmp29_;
	GObject* _tmp30_;
	GtkPaned* _tmp31_;
	gint _tmp32_;
	GtkImageMenuItem* quit = NULL;
	GtkBuilder* _tmp36_;
	GObject* _tmp37_;
	GtkImageMenuItem* _tmp38_;
	GtkImageMenuItem* _tmp39_;
	GtkImageMenuItem* saveAs = NULL;
	GtkBuilder* _tmp40_;
	GObject* _tmp41_;
	GtkImageMenuItem* _tmp42_;
	GtkImageMenuItem* _tmp43_;
	GtkImageMenuItem* save = NULL;
	GtkBuilder* _tmp44_;
	GObject* _tmp45_;
	GtkImageMenuItem* _tmp46_;
	GtkImageMenuItem* _tmp47_;
	GtkImageMenuItem* open = NULL;
	GtkBuilder* _tmp48_;
	GObject* _tmp49_;
	GtkImageMenuItem* _tmp50_;
	GtkImageMenuItem* _tmp51_;
	GtkBuilder* _tmp52_;
	GObject* _tmp53_;
	GtkImageMenuItem* _tmp54_;
	GtkImageMenuItem* _tmp55_;
	GtkMenuItem* editMenuItem = NULL;
	GtkBuilder* _tmp56_;
	GObject* _tmp57_;
	GtkMenuItem* _tmp58_;
	GtkMenuItem* _tmp59_;
	GtkBuilder* _tmp60_;
	GObject* _tmp61_;
	GtkImageMenuItem* _tmp62_;
	GtkImageMenuItem* _tmp63_;
	GtkImageMenuItem* _tmp64_;
	GtkImageMenuItem* _tmp65_;
	GtkImageMenuItem* pasteMenuItem = NULL;
	GtkBuilder* _tmp66_;
	GObject* _tmp67_;
	GtkImageMenuItem* _tmp68_;
	GtkImageMenuItem* _tmp69_;
	GtkImageMenuItem* clearMenuItem = NULL;
	GtkBuilder* _tmp70_;
	GObject* _tmp71_;
	GtkImageMenuItem* _tmp72_;
	GtkImageMenuItem* _tmp73_;
	moserialSettingsDialog* _tmp74_;
	moserialSettingsDialog* _tmp75_;
	GtkBuilder* _tmp76_;
	GObject* _tmp77_;
	GtkToolButton* _tmp78_;
	GtkToolButton* _tmp79_;
	GtkToolButton* _tmp80_;
	GtkToolButton* helpButton = NULL;
	GtkBuilder* _tmp81_;
	GObject* _tmp82_;
	GtkToolButton* _tmp83_;
	GtkToolButton* _tmp84_;
	GtkToolButton* _tmp85_;
	GtkBuilder* _tmp86_;
	GObject* _tmp87_;
	GtkStatusbar* _tmp88_;
	GtkStatusbar* _tmp89_;
	guint _tmp90_;
	GtkStatusbar* _tmp91_;
	guint _tmp92_;
	Settings* _tmp93_;
	gchar* _tmp94_;
	gchar* _tmp95_;
	GtkBuilder* _tmp96_;
	GObject* _tmp97_;
	GtkStatusbar* _tmp98_;
	GtkStatusbar* _tmp99_;
	guint _tmp100_;
	GtkStatusbar* _tmp101_;
	guint _tmp102_;
	GtkImageMenuItem* about = NULL;
	GtkBuilder* _tmp103_;
	GObject* _tmp104_;
	GtkImageMenuItem* _tmp105_;
	GtkImageMenuItem* _tmp106_;
	moserialSendProgressDialog* _tmp107_;
	moserialSendChooserDialog* _tmp108_;
	GtkBuilder* _tmp109_;
	GObject* _tmp110_;
	GtkToolButton* _tmp111_;
	GtkToolButton* _tmp112_;
	GtkToolButton* _tmp113_;
	moserialSendChooserDialog* _tmp114_;
	moserialSzwrapperProtocol _tmp115_;
	moserialSzwrapper* _tmp116_;
	moserialReceiveProgressDialog* _tmp117_;
	moserialReceiveChooserDialog* _tmp118_;
	GtkBuilder* _tmp119_;
	GObject* _tmp120_;
	GtkToolButton* _tmp121_;
	GtkToolButton* _tmp122_;
	GtkToolButton* _tmp123_;
	moserialReceiveChooserDialog* _tmp124_;
	moserialXmodemFilenameDialog* _tmp125_;
	moserialRzwrapperProtocol _tmp126_;
	moserialRzwrapper* _tmp127_;
	moserialRecordDialog* _tmp128_;
	GtkBuilder* _tmp129_;
	GObject* _tmp130_;
	GtkToggleToolButton* _tmp131_;
	GtkToggleToolButton* _tmp132_;
	GtkToggleToolButton* _tmp133_;
	moserialRecordDialog* _tmp134_;
	moserialRecordDialog* _tmp135_;
	GtkBuilder* _tmp136_;
	GObject* _tmp137_;
	GtkLabel* _tmp138_;
	GtkBuilder* _tmp139_;
	GObject* _tmp140_;
	GtkLabel* _tmp141_;
	moserialPreferencesDialog* _tmp142_;
	moserialPreferencesDialog* _tmp143_;
	GtkToolButton* preferences = NULL;
	GtkBuilder* _tmp144_;
	GObject* _tmp145_;
	GtkToolButton* _tmp146_;
	GtkToolButton* _tmp147_;
	GtkToolButton* _tmp148_;
	GtkBuilder* _tmp149_;
	GObject* _tmp150_;
	GtkToggleToolButton* _tmp151_;
	GtkToggleToolButton* _tmp152_;
	GtkToggleToolButton* _tmp153_;
	GtkBuilder* _tmp154_;
	GObject* _tmp155_;
	GtkLabel* _tmp156_;
	GtkBuilder* _tmp157_;
	GObject* _tmp158_;
	GtkLabel* _tmp159_;
	GtkImageMenuItem* contents = NULL;
	GtkBuilder* _tmp160_;
	GObject* _tmp161_;
	GtkImageMenuItem* _tmp162_;
	GtkImageMenuItem* _tmp163_;
	GtkBuilder* _tmp164_;
	GObject* _tmp165_;
	GtkNotebook* _tmp166_;
	GtkBuilder* _tmp167_;
	GObject* _tmp168_;
	GtkNotebook* _tmp169_;
	moserialHexTextBuffer* _tmp170_;
	GtkTextTagTable* _tmp171_;
	GtkTextTagTable* _tmp172_;
	GtkTextBuffer* _tmp173_;
	moserialHexTextBuffer* _tmp174_;
	GtkTextTagTable* _tmp175_;
	GtkTextTagTable* _tmp176_;
	GtkTextBuffer* _tmp177_;
	GtkTextBuffer* _tmp178_;
	GtkTextTag* _tmp179_;
	GtkTextTag* _tmp180_;
	GtkBuilder* _tmp181_;
	GObject* _tmp182_;
	GtkTextView* _tmp183_;
	GtkTextView* _tmp184_;
	moserialHexTextBuffer* _tmp185_;
	GtkBuilder* _tmp186_;
	GObject* _tmp187_;
	GtkTextView* _tmp188_;
	GtkTextView* _tmp189_;
	GtkTextBuffer* _tmp190_;
	GtkBuilder* _tmp191_;
	GObject* _tmp192_;
	GtkTextView* _tmp193_;
	GtkTextView* _tmp194_;
	moserialHexTextBuffer* _tmp195_;
	GtkBuilder* _tmp196_;
	GObject* _tmp197_;
	GtkTextView* _tmp198_;
	GtkTextView* _tmp199_;
	GtkTextBuffer* _tmp200_;
	GtkScrolledWindow* incomingAsciiScrolledWindow = NULL;
	GtkBuilder* _tmp201_;
	GObject* _tmp202_;
	GtkScrolledWindow* _tmp203_;
	GtkScrolledWindow* _tmp204_;
	GtkAdjustment* _tmp205_;
	GtkAdjustment* _tmp206_;
	GtkScrolledWindow* incomingHexScrolledWindow = NULL;
	GtkBuilder* _tmp207_;
	GObject* _tmp208_;
	GtkScrolledWindow* _tmp209_;
	GtkScrolledWindow* _tmp210_;
	GtkAdjustment* _tmp211_;
	GtkAdjustment* _tmp212_;
	GtkScrolledWindow* outgoingAsciiScrolledWindow = NULL;
	GtkBuilder* _tmp213_;
	GObject* _tmp214_;
	GtkScrolledWindow* _tmp215_;
	GtkScrolledWindow* _tmp216_;
	GtkAdjustment* _tmp217_;
	GtkAdjustment* _tmp218_;
	GtkScrolledWindow* outgoingHexScrolledWindow = NULL;
	GtkBuilder* _tmp219_;
	GObject* _tmp220_;
	GtkScrolledWindow* _tmp221_;
	GtkScrolledWindow* _tmp222_;
	GtkAdjustment* _tmp223_;
	GtkAdjustment* _tmp224_;
	GtkAdjustment* _tmp225_;
	GtkAdjustment* _tmp226_;
	GtkAdjustment* _tmp227_;
	GtkAdjustment* _tmp228_;
	GtkBuilder* _tmp229_;
	GObject* _tmp230_;
	GtkButton* _tmp231_;
	GtkButton* _tmp232_;
	GtkButton* _tmp233_;
	GtkBuilder* _tmp234_;
	GObject* _tmp235_;
	GtkEntry* _tmp236_;
	GtkEntry* _tmp237_;
	GtkEntry* _tmp238_;
	GtkBuilder* _tmp239_;
	GObject* _tmp240_;
	GtkComboBox* _tmp241_;
	GtkComboBox* _tmp242_;
	GtkComboBox* _tmp243_;
	GtkComboBox* _tmp244_;
	GtkBuilder* _tmp245_;
	GObject* _tmp246_;
	GtkComboBox* _tmp247_;
	GtkComboBox* _tmp248_;
	moserialSerialConnection* _tmp249_;
	GtkComboBox* _tmp250_;
	gchar* _tmp251_;
	gchar** _tmp252_;
	const gchar* _tmp253_;
	gchar* _tmp254_;
	const gchar* _tmp255_;
	gchar* _tmp256_;
	gchar* _tmp257_;
	GtkRecentManager* recentManager = NULL;
	GtkRecentManager* _tmp258_;
	GtkRecentManager* _tmp259_;
	GtkRecentChooserMenu* recentChooserMenu = NULL;
	GtkRecentManager* _tmp260_;
	GtkRecentChooserMenu* _tmp261_;
	GtkRecentChooserMenu* _tmp262_;
	GtkRecentFilter* filter = NULL;
	GtkRecentFilter* _tmp263_;
	GtkRecentFilter* _tmp264_;
	GtkRecentChooserMenu* _tmp265_;
	GtkRecentFilter* _tmp266_;
	GtkRecentChooserMenu* _tmp267_;
	GtkRecentChooserMenu* _tmp268_;
	GtkMenuItem* recentFileItem = NULL;
	GtkBuilder* _tmp269_;
	GObject* _tmp270_;
	GtkMenuItem* _tmp271_;
	GtkMenuItem* _tmp272_;
	GtkRecentChooserMenu* _tmp273_;
	Profile* _tmp274_;
	Preferences* _tmp275_;
	Preferences* _tmp276_;
	const gchar* _tmp277_;
	Profile* _tmp279_;
	DefaultPaths* _tmp280_;
	parent_class = G_OBJECT_CLASS (moserial_main_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MOSERIAL_TYPE_MAIN_WINDOW, moserialMainWindow);
	_tmp0_ = gtk_builder_new_from_resource (UIROOT "mainwindow.ui");
	builder = _tmp0_;
	_tmp1_ = builder;
	_tmp2_ = gtk_builder_get_object (_tmp1_, "window");
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_window_get_type (), GtkWindow));
	_g_object_unref0 (self->priv->gtkWindow);
	self->priv->gtkWindow = _tmp3_;
	_tmp4_ = builder;
	_tmp5_ = gtk_builder_get_object (_tmp4_, "accelgroup1");
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, gtk_accel_group_get_type (), GtkAccelGroup));
	_g_object_unref0 (self->priv->ag);
	self->priv->ag = _tmp6_;
	_tmp7_ = self->priv->gtkWindow;
	_tmp8_ = self->priv->ag;
	gtk_window_add_accel_group (_tmp7_, _tmp8_);
	_tmp9_ = self->priv->gtkWindow;
	g_signal_connect_object ((GtkWidget*) _tmp9_, "destroy", (GCallback) _moserial_main_window_quitSave_gtk_widget_destroy, self, 0);
	_tmp10_ = self->priv->gtkWindow;
	g_signal_connect_object ((GtkWidget*) _tmp10_, "delete-event", (GCallback) _moserial_main_window_deleteSaveSize_gtk_widget_delete_event, self, 0);
	_tmp11_ = self->priv->gtkWindow;
	g_signal_connect_object ((GtkWidget*) _tmp11_, "key-press-event", (GCallback) _moserial_main_window_keyPress_gtk_widget_key_press_event, self, 0);
	_tmp12_ = profile_new ();
	_g_object_unref0 (self->priv->profile);
	self->priv->profile = _tmp12_;
	_tmp13_ = self->priv->profile;
	_tmp14_ = self->priv->gtkWindow;
	profile_load (_tmp13_, NULL, _tmp14_);
	_tmp15_ = self->priv->profile;
	_tmp16_ = settings_loadFromProfile (_tmp15_);
	_g_object_unref0 (self->priv->currentSettings);
	self->priv->currentSettings = _tmp16_;
	_tmp17_ = self->priv->profile;
	_tmp18_ = profile_getWindowWidth (_tmp17_);
	width = _tmp18_;
	_tmp19_ = self->priv->profile;
	_tmp20_ = profile_getWindowHeight (_tmp19_);
	height = _tmp20_;
	_tmp21_ = self->priv->profile;
	_tmp22_ = profile_getWindowPanedPosition (_tmp21_);
	panedPosition = _tmp22_;
	_tmp24_ = width;
	if (_tmp24_ > 0) {
		gint _tmp25_;
		_tmp25_ = height;
		_tmp23_ = _tmp25_ > 0;
	} else {
		_tmp23_ = FALSE;
	}
	if (_tmp23_) {
		GtkWindow* _tmp26_;
		gint _tmp27_;
		gint _tmp28_;
		_tmp26_ = self->priv->gtkWindow;
		_tmp27_ = width;
		_tmp28_ = height;
		gtk_window_resize (_tmp26_, _tmp27_, _tmp28_);
	}
	_tmp29_ = builder;
	_tmp30_ = gtk_builder_get_object (_tmp29_, "vpaned");
	_tmp31_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp30_, gtk_paned_get_type (), GtkPaned));
	_g_object_unref0 (self->priv->paned);
	self->priv->paned = _tmp31_;
	_tmp32_ = panedPosition;
	if (_tmp32_ >= -1) {
		GtkPaned* _tmp33_;
		gint _tmp34_;
		_tmp33_ = self->priv->paned;
		_tmp34_ = panedPosition;
		gtk_paned_set_position (_tmp33_, _tmp34_);
	} else {
		GtkPaned* _tmp35_;
		_tmp35_ = self->priv->paned;
		gtk_paned_set_position (_tmp35_, -1);
	}
	_tmp36_ = builder;
	_tmp37_ = gtk_builder_get_object (_tmp36_, "menubar_quit");
	_tmp38_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp37_, gtk_image_menu_item_get_type (), GtkImageMenuItem));
	quit = _tmp38_;
	_tmp39_ = quit;
	g_signal_connect_object ((GtkMenuItem*) _tmp39_, "activate", (GCallback) _moserial_main_window_quitSizeSave_gtk_menu_item_activate, self, 0);
	_tmp40_ = builder;
	_tmp41_ = gtk_builder_get_object (_tmp40_, "menubar_save_settings_as");
	_tmp42_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp41_, gtk_image_menu_item_get_type (), GtkImageMenuItem));
	saveAs = _tmp42_;
	_tmp43_ = saveAs;
	g_signal_connect_object ((GtkMenuItem*) _tmp43_, "activate", (GCallback) _moserial_main_window_saveProfileAs_gtk_menu_item_activate, self, 0);
	_tmp44_ = builder;
	_tmp45_ = gtk_builder_get_object (_tmp44_, "menubar_save_settings");
	_tmp46_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp45_, gtk_image_menu_item_get_type (), GtkImageMenuItem));
	save = _tmp46_;
	_tmp47_ = save;
	g_signal_connect_object ((GtkMenuItem*) _tmp47_, "activate", (GCallback) _moserial_main_window_saveProfile_gtk_menu_item_activate, self, 0);
	_tmp48_ = builder;
	_tmp49_ = gtk_builder_get_object (_tmp48_, "menubar_open_settings");
	_tmp50_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp49_, gtk_image_menu_item_get_type (), GtkImageMenuItem));
	open = _tmp50_;
	_tmp51_ = open;
	g_signal_connect_object ((GtkMenuItem*) _tmp51_, "activate", (GCallback) _moserial_main_window_loadProfile_gtk_menu_item_activate, self, 0);
	_tmp52_ = builder;
	_tmp53_ = gtk_builder_get_object (_tmp52_, "menubar_copy");
	_tmp54_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp53_, gtk_image_menu_item_get_type (), GtkImageMenuItem));
	_g_object_unref0 (self->priv->copyMenuItem);
	self->priv->copyMenuItem = _tmp54_;
	_tmp55_ = self->priv->copyMenuItem;
	g_signal_connect_object ((GtkMenuItem*) _tmp55_, "activate", (GCallback) _moserial_main_window_copy_gtk_menu_item_activate, self, 0);
	_tmp56_ = builder;
	_tmp57_ = gtk_builder_get_object (_tmp56_, "menubar_edit");
	_tmp58_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp57_, gtk_menu_item_get_type (), GtkMenuItem));
	editMenuItem = _tmp58_;
	_tmp59_ = editMenuItem;
	g_signal_connect_object (_tmp59_, "activate", (GCallback) _moserial_main_window_editMenu_gtk_menu_item_activate, self, 0);
	_tmp60_ = builder;
	_tmp61_ = gtk_builder_get_object (_tmp60_, "menubar_cut");
	_tmp62_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp61_, gtk_image_menu_item_get_type (), GtkImageMenuItem));
	_g_object_unref0 (self->priv->cutMenuItem);
	self->priv->cutMenuItem = _tmp62_;
	_tmp63_ = self->priv->copyMenuItem;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp63_, FALSE);
	_tmp64_ = self->priv->cutMenuItem;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp64_, FALSE);
	_tmp65_ = self->priv->cutMenuItem;
	g_signal_connect_object ((GtkMenuItem*) _tmp65_, "activate", (GCallback) _moserial_main_window_cut_gtk_menu_item_activate, self, 0);
	_tmp66_ = builder;
	_tmp67_ = gtk_builder_get_object (_tmp66_, "menubar_paste");
	_tmp68_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp67_, gtk_image_menu_item_get_type (), GtkImageMenuItem));
	pasteMenuItem = _tmp68_;
	_tmp69_ = pasteMenuItem;
	g_signal_connect_object ((GtkMenuItem*) _tmp69_, "activate", (GCallback) _moserial_main_window_paste_gtk_menu_item_activate, self, 0);
	_tmp70_ = builder;
	_tmp71_ = gtk_builder_get_object (_tmp70_, "menubar_clear");
	_tmp72_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp71_, gtk_image_menu_item_get_type (), GtkImageMenuItem));
	clearMenuItem = _tmp72_;
	_tmp73_ = clearMenuItem;
	g_signal_connect_object ((GtkMenuItem*) _tmp73_, "activate", (GCallback) _moserial_main_window_clear_gtk_menu_item_activate, self, 0);
	_tmp74_ = moserial_settings_dialog_new ();
	_g_object_unref0 (self->priv->settingsDialog);
	self->priv->settingsDialog = _tmp74_;
	_tmp75_ = self->priv->settingsDialog;
	g_signal_connect_object (_tmp75_, "update-settings", (GCallback) _moserial_main_window_updateSettings_moserial_settings_dialog_update_settings, self, 0);
	_tmp76_ = builder;
	_tmp77_ = gtk_builder_get_object (_tmp76_, "toolbar_settings");
	_tmp78_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp77_, gtk_tool_button_get_type (), GtkToolButton));
	_g_object_unref0 (self->priv->settingsButton);
	self->priv->settingsButton = _tmp78_;
	_tmp79_ = self->priv->settingsButton;
	g_signal_connect_object (_tmp79_, "clicked", (GCallback) _moserial_main_window_showSettingsDialog_gtk_tool_button_clicked, self, 0);
	_tmp80_ = self->priv->settingsButton;
	gtk_tool_item_set_tooltip_text ((GtkToolItem*) _tmp80_, _ ("Port configuration"));
	_tmp81_ = builder;
	_tmp82_ = gtk_builder_get_object (_tmp81_, "toolbar_help");
	_tmp83_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp82_, gtk_tool_button_get_type (), GtkToolButton));
	helpButton = _tmp83_;
	_tmp84_ = helpButton;
	g_signal_connect_object (_tmp84_, "clicked", (GCallback) _moserial_main_window_showHelpButton_gtk_tool_button_clicked, self, 0);
	_tmp85_ = helpButton;
	gtk_tool_item_set_tooltip_text ((GtkToolItem*) _tmp85_, _ ("Read the manual"));
	_tmp86_ = builder;
	_tmp87_ = gtk_builder_get_object (_tmp86_, "statusbar");
	_tmp88_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp87_, gtk_statusbar_get_type (), GtkStatusbar));
	_g_object_unref0 (self->priv->statusbar);
	self->priv->statusbar = _tmp88_;
	_tmp89_ = self->priv->statusbar;
	_tmp90_ = gtk_statusbar_get_context_id (_tmp89_, "moserial port status");
	self->priv->statusbarContext = _tmp90_;
	_tmp91_ = self->priv->statusbar;
	_tmp92_ = self->priv->statusbarContext;
	_tmp93_ = self->priv->currentSettings;
	_tmp94_ = settings_getStatusbarString (_tmp93_, FALSE);
	_tmp95_ = _tmp94_;
	gtk_statusbar_push (_tmp91_, _tmp92_, _tmp95_);
	_g_free0 (_tmp95_);
	_tmp96_ = builder;
	_tmp97_ = gtk_builder_get_object (_tmp96_, "bytecountbar");
	_tmp98_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp97_, gtk_statusbar_get_type (), GtkStatusbar));
	_g_object_unref0 (self->priv->bytecountbar);
	self->priv->bytecountbar = _tmp98_;
	_tmp99_ = self->priv->statusbar;
	_tmp100_ = gtk_statusbar_get_context_id (_tmp99_, "moserial byte counts");
	self->priv->bytecountbarContext = _tmp100_;
	_tmp101_ = self->priv->bytecountbar;
	_tmp102_ = self->priv->bytecountbarContext;
	gtk_statusbar_push (_tmp101_, _tmp102_, _ ("TX: 0, RX: 0"));
	_tmp103_ = builder;
	_tmp104_ = gtk_builder_get_object (_tmp103_, "menubar_about");
	_tmp105_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp104_, gtk_image_menu_item_get_type (), GtkImageMenuItem));
	about = _tmp105_;
	_tmp106_ = about;
	g_signal_connect_object ((GtkMenuItem*) _tmp106_, "activate", (GCallback) _moserial_main_window_showAboutDialog_gtk_menu_item_activate, self, 0);
	_tmp107_ = moserial_send_progress_dialog_new ();
	_g_object_unref0 (self->priv->sendProgressDialog);
	self->priv->sendProgressDialog = _tmp107_;
	_tmp108_ = moserial_send_chooser_dialog_new ();
	_g_object_unref0 (self->priv->sendChooserDialog);
	self->priv->sendChooserDialog = _tmp108_;
	_tmp109_ = builder;
	_tmp110_ = gtk_builder_get_object (_tmp109_, "toolbar_send");
	_tmp111_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp110_, gtk_tool_button_get_type (), GtkToolButton));
	_g_object_unref0 (self->priv->send);
	self->priv->send = _tmp111_;
	_tmp112_ = self->priv->send;
	g_signal_connect_object (_tmp112_, "clicked", (GCallback) _moserial_main_window_doSendChooser_gtk_tool_button_clicked, self, 0);
	_tmp113_ = self->priv->send;
	gtk_tool_item_set_tooltip_text ((GtkToolItem*) _tmp113_, _ ("Send a file"));
	_tmp114_ = self->priv->sendChooserDialog;
	g_signal_connect_object (_tmp114_, "start-transfer", (GCallback) _moserial_main_window_doSend_moserial_send_chooser_dialog_start_transfer, self, 0);
	_tmp115_ = MOSERIAL_SZWRAPPER_PROTOCOL_NULL;
	_tmp116_ = moserial_szwrapper_new (&_tmp115_, NULL, NULL);
	_g_object_unref0 (self->priv->sz);
	self->priv->sz = _tmp116_;
	_tmp117_ = moserial_receive_progress_dialog_new ();
	_g_object_unref0 (self->priv->receiveProgressDialog);
	self->priv->receiveProgressDialog = _tmp117_;
	_tmp118_ = moserial_receive_chooser_dialog_new ();
	_g_object_unref0 (self->priv->receiveChooserDialog);
	self->priv->receiveChooserDialog = _tmp118_;
	_tmp119_ = builder;
	_tmp120_ = gtk_builder_get_object (_tmp119_, "toolbar_receive");
	_tmp121_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp120_, gtk_tool_button_get_type (), GtkToolButton));
	_g_object_unref0 (self->priv->receive);
	self->priv->receive = _tmp121_;
	_tmp122_ = self->priv->receive;
	g_signal_connect_object (_tmp122_, "clicked", (GCallback) _moserial_main_window_doReceiveChooser_gtk_tool_button_clicked, self, 0);
	_tmp123_ = self->priv->receive;
	gtk_tool_item_set_tooltip_text ((GtkToolItem*) _tmp123_, _ ("Receive a file"));
	_tmp124_ = self->priv->receiveChooserDialog;
	g_signal_connect_object (_tmp124_, "start-transfer", (GCallback) _moserial_main_window_doReceive_moserial_receive_chooser_dialog_start_transfer, self, 0);
	_tmp125_ = moserial_xmodem_filename_dialog_new ();
	_g_object_unref0 (self->priv->xmodemFilenameDialog);
	self->priv->xmodemFilenameDialog = _tmp125_;
	_tmp126_ = MOSERIAL_RZWRAPPER_PROTOCOL_NULL;
	_tmp127_ = moserial_rzwrapper_new (&_tmp126_, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->rz);
	self->priv->rz = _tmp127_;
	_tmp128_ = moserial_record_dialog_new ();
	_g_object_unref0 (self->priv->recordDialog);
	self->priv->recordDialog = _tmp128_;
	_tmp129_ = builder;
	_tmp130_ = gtk_builder_get_object (_tmp129_, "toolbar_logging");
	_tmp131_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp130_, gtk_toggle_tool_button_get_type (), GtkToggleToolButton));
	_g_object_unref0 (self->priv->recordButton);
	self->priv->recordButton = _tmp131_;
	_tmp132_ = self->priv->recordButton;
	g_signal_connect_object (_tmp132_, "toggled", (GCallback) _moserial_main_window_record_gtk_toggle_tool_button_toggled, self, 0);
	_tmp133_ = self->priv->recordButton;
	gtk_tool_item_set_tooltip_text ((GtkToolItem*) _tmp133_, _ ("Record sent and/or received data"));
	_tmp134_ = self->priv->recordDialog;
	g_signal_connect_object (_tmp134_, "stop-recording", (GCallback) _moserial_main_window_stopRecording_moserial_record_dialog_stop_recording, self, 0);
	_tmp135_ = self->priv->recordDialog;
	g_signal_connect_object (_tmp135_, "start-recording", (GCallback) _moserial_main_window_startRecording_moserial_record_dialog_start_recording, self, 0);
	_tmp136_ = builder;
	_tmp137_ = gtk_builder_get_object (_tmp136_, "record_label");
	_tmp138_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp137_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (self->priv->recordLabel);
	self->priv->recordLabel = _tmp138_;
	_tmp139_ = builder;
	_tmp140_ = gtk_builder_get_object (_tmp139_, "stop_recording_label");
	_tmp141_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp140_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (self->priv->stopRecordingLabel);
	self->priv->stopRecordingLabel = _tmp141_;
	_tmp142_ = moserial_preferences_dialog_new ();
	_g_object_unref0 (self->priv->preferencesDialog);
	self->priv->preferencesDialog = _tmp142_;
	_tmp143_ = self->priv->preferencesDialog;
	g_signal_connect_object (_tmp143_, "update-preferences", (GCallback) _moserial_main_window_updatePreferences_moserial_preferences_dialog_update_preferences, self, 0);
	_tmp144_ = builder;
	_tmp145_ = gtk_builder_get_object (_tmp144_, "toolbar_preferences");
	_tmp146_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp145_, gtk_tool_button_get_type (), GtkToolButton));
	preferences = _tmp146_;
	_tmp147_ = preferences;
	g_signal_connect_object (_tmp147_, "clicked", (GCallback) _moserial_main_window_showPreferencesDialog_gtk_tool_button_clicked, self, 0);
	_tmp148_ = preferences;
	gtk_tool_item_set_tooltip_text ((GtkToolItem*) _tmp148_, _ ("Other preferences"));
	_tmp149_ = builder;
	_tmp150_ = gtk_builder_get_object (_tmp149_, "toolbar_connect");
	_tmp151_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp150_, gtk_toggle_tool_button_get_type (), GtkToggleToolButton));
	_g_object_unref0 (self->priv->connectButton);
	self->priv->connectButton = _tmp151_;
	_tmp152_ = self->priv->connectButton;
	g_signal_connect_object (_tmp152_, "toggled", (GCallback) _moserial_main_window_connectButtonClick_gtk_toggle_tool_button_toggled, self, 0);
	_tmp153_ = self->priv->connectButton;
	gtk_tool_item_set_tooltip_text ((GtkToolItem*) _tmp153_, _ ("Open/close port"));
	_tmp154_ = builder;
	_tmp155_ = gtk_builder_get_object (_tmp154_, "disconnect_label");
	_tmp156_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp155_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (self->priv->disconnectLabel);
	self->priv->disconnectLabel = _tmp156_;
	_tmp157_ = builder;
	_tmp158_ = gtk_builder_get_object (_tmp157_, "connect_label");
	_tmp159_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp158_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (self->priv->connectLabel);
	self->priv->connectLabel = _tmp159_;
	_tmp160_ = builder;
	_tmp161_ = gtk_builder_get_object (_tmp160_, "menubar_contents");
	_tmp162_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp161_, gtk_image_menu_item_get_type (), GtkImageMenuItem));
	contents = _tmp162_;
	_tmp163_ = contents;
	g_signal_connect_object ((GtkMenuItem*) _tmp163_, "activate", (GCallback) _moserial_main_window_showHelpAction_gtk_menu_item_activate, self, 0);
	_tmp164_ = builder;
	_tmp165_ = gtk_builder_get_object (_tmp164_, "incoming_notebook");
	_tmp166_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp165_, gtk_notebook_get_type (), GtkNotebook));
	_g_object_unref0 (self->priv->incoming_notebook);
	self->priv->incoming_notebook = _tmp166_;
	_tmp167_ = builder;
	_tmp168_ = gtk_builder_get_object (_tmp167_, "outgoing_notebook");
	_tmp169_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp168_, gtk_notebook_get_type (), GtkNotebook));
	_g_object_unref0 (self->priv->outgoing_notebook);
	self->priv->outgoing_notebook = _tmp169_;
	_tmp170_ = moserial_hex_text_buffer_new ();
	_g_object_unref0 (self->priv->incomingHexTextBuffer);
	self->priv->incomingHexTextBuffer = _tmp170_;
	_tmp171_ = gtk_text_tag_table_new ();
	_tmp172_ = _tmp171_;
	_tmp173_ = gtk_text_buffer_new (_tmp172_);
	_g_object_unref0 (self->priv->incomingAsciiTextBuffer);
	self->priv->incomingAsciiTextBuffer = _tmp173_;
	_g_object_unref0 (_tmp172_);
	_tmp174_ = moserial_hex_text_buffer_new ();
	_g_object_unref0 (self->priv->outgoingHexTextBuffer);
	self->priv->outgoingHexTextBuffer = _tmp174_;
	_tmp175_ = gtk_text_tag_table_new ();
	_tmp176_ = _tmp175_;
	_tmp177_ = gtk_text_buffer_new (_tmp176_);
	_g_object_unref0 (self->priv->outgoingAsciiTextBuffer);
	self->priv->outgoingAsciiTextBuffer = _tmp177_;
	_g_object_unref0 (_tmp176_);
	_tmp178_ = self->priv->incomingAsciiTextBuffer;
	_tmp179_ = gtk_text_buffer_create_tag (_tmp178_, "echo", NULL, NULL);
	_tmp180_ = _g_object_ref0 (_tmp179_);
	_g_object_unref0 (self->priv->echoTag);
	self->priv->echoTag = _tmp180_;
	_tmp181_ = builder;
	_tmp182_ = gtk_builder_get_object (_tmp181_, "incoming_hex_textview");
	_tmp183_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp182_, gtk_text_view_get_type (), GtkTextView));
	_g_object_unref0 (self->priv->incomingHexTextView);
	self->priv->incomingHexTextView = _tmp183_;
	_tmp184_ = self->priv->incomingHexTextView;
	_tmp185_ = self->priv->incomingHexTextBuffer;
	gtk_text_view_set_buffer (_tmp184_, (GtkTextBuffer*) _tmp185_);
	_tmp186_ = builder;
	_tmp187_ = gtk_builder_get_object (_tmp186_, "incoming_ascii_textview");
	_tmp188_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp187_, gtk_text_view_get_type (), GtkTextView));
	_g_object_unref0 (self->priv->incomingAsciiTextView);
	self->priv->incomingAsciiTextView = _tmp188_;
	_tmp189_ = self->priv->incomingAsciiTextView;
	_tmp190_ = self->priv->incomingAsciiTextBuffer;
	gtk_text_view_set_buffer (_tmp189_, _tmp190_);
	_tmp191_ = builder;
	_tmp192_ = gtk_builder_get_object (_tmp191_, "outgoing_hex_textview");
	_tmp193_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp192_, gtk_text_view_get_type (), GtkTextView));
	_g_object_unref0 (self->priv->outgoingHexTextView);
	self->priv->outgoingHexTextView = _tmp193_;
	_tmp194_ = self->priv->outgoingHexTextView;
	_tmp195_ = self->priv->outgoingHexTextBuffer;
	gtk_text_view_set_buffer (_tmp194_, (GtkTextBuffer*) _tmp195_);
	_tmp196_ = builder;
	_tmp197_ = gtk_builder_get_object (_tmp196_, "outgoing_ascii_textview");
	_tmp198_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp197_, gtk_text_view_get_type (), GtkTextView));
	_g_object_unref0 (self->priv->outgoingAsciiTextView);
	self->priv->outgoingAsciiTextView = _tmp198_;
	_tmp199_ = self->priv->outgoingAsciiTextView;
	_tmp200_ = self->priv->outgoingAsciiTextBuffer;
	gtk_text_view_set_buffer (_tmp199_, _tmp200_);
	_tmp201_ = builder;
	_tmp202_ = gtk_builder_get_object (_tmp201_, "incoming_ascii_scrolledwindow");
	_tmp203_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp202_, gtk_scrolled_window_get_type (), GtkScrolledWindow));
	incomingAsciiScrolledWindow = _tmp203_;
	_tmp204_ = incomingAsciiScrolledWindow;
	_tmp205_ = gtk_scrolled_window_get_vadjustment (_tmp204_);
	_tmp206_ = _g_object_ref0 (_tmp205_);
	_g_object_unref0 (self->priv->va1);
	self->priv->va1 = _tmp206_;
	_tmp207_ = builder;
	_tmp208_ = gtk_builder_get_object (_tmp207_, "incoming_hex_scrolledwindow");
	_tmp209_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp208_, gtk_scrolled_window_get_type (), GtkScrolledWindow));
	incomingHexScrolledWindow = _tmp209_;
	_tmp210_ = incomingHexScrolledWindow;
	_tmp211_ = gtk_scrolled_window_get_vadjustment (_tmp210_);
	_tmp212_ = _g_object_ref0 (_tmp211_);
	_g_object_unref0 (self->priv->va2);
	self->priv->va2 = _tmp212_;
	_tmp213_ = builder;
	_tmp214_ = gtk_builder_get_object (_tmp213_, "outgoing_ascii_scrolledwindow");
	_tmp215_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp214_, gtk_scrolled_window_get_type (), GtkScrolledWindow));
	outgoingAsciiScrolledWindow = _tmp215_;
	_tmp216_ = outgoingAsciiScrolledWindow;
	_tmp217_ = gtk_scrolled_window_get_vadjustment (_tmp216_);
	_tmp218_ = _g_object_ref0 (_tmp217_);
	_g_object_unref0 (self->priv->va3);
	self->priv->va3 = _tmp218_;
	_tmp219_ = builder;
	_tmp220_ = gtk_builder_get_object (_tmp219_, "outgoing_hex_scrolledwindow");
	_tmp221_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp220_, gtk_scrolled_window_get_type (), GtkScrolledWindow));
	outgoingHexScrolledWindow = _tmp221_;
	_tmp222_ = outgoingHexScrolledWindow;
	_tmp223_ = gtk_scrolled_window_get_vadjustment (_tmp222_);
	_tmp224_ = _g_object_ref0 (_tmp223_);
	_g_object_unref0 (self->priv->va4);
	self->priv->va4 = _tmp224_;
	_tmp225_ = self->priv->va1;
	_tmp226_ = self->priv->va2;
	_tmp227_ = self->priv->va3;
	_tmp228_ = self->priv->va4;
	moserial_auto_scroll_setup (_tmp225_, _tmp226_, _tmp227_, _tmp228_);
	_tmp229_ = builder;
	_tmp230_ = gtk_builder_get_object (_tmp229_, "send");
	_tmp231_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp230_, gtk_button_get_type (), GtkButton));
	_g_object_unref0 (self->priv->sendButton);
	self->priv->sendButton = _tmp231_;
	_tmp232_ = self->priv->sendButton;
	g_signal_connect_object (_tmp232_, "clicked", (GCallback) _moserial_main_window_sendString_gtk_button_clicked, self, 0);
	_tmp233_ = self->priv->sendButton;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp233_, _ ("Send the outgoing data now."));
	_tmp234_ = builder;
	_tmp235_ = gtk_builder_get_object (_tmp234_, "entry");
	_tmp236_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp235_, gtk_entry_get_type (), GtkEntry));
	_g_object_unref0 (self->priv->entry);
	self->priv->entry = _tmp236_;
	_tmp237_ = self->priv->entry;
	g_signal_connect_object (_tmp237_, "activate", (GCallback) _moserial_main_window_sendString_gtk_entry_activate, self, 0);
	_tmp238_ = self->priv->entry;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp238_, _ ("Type outgoing data here. Press Enter or Send to send it."));
	_tmp239_ = builder;
	_tmp240_ = gtk_builder_get_object (_tmp239_, "input_mode");
	_tmp241_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp240_, gtk_combo_box_get_type (), GtkComboBox));
	_g_object_unref0 (self->priv->inputModeCombo);
	self->priv->inputModeCombo = _tmp241_;
	_tmp242_ = self->priv->inputModeCombo;
	mo_utils_populateComboBox (_tmp242_, MOSERIAL_MAIN_WINDOW_inputModeStrings, G_N_ELEMENTS (MOSERIAL_MAIN_WINDOW_inputModeStrings));
	_tmp243_ = self->priv->inputModeCombo;
	gtk_combo_box_set_active (_tmp243_, (gint) MOSERIAL_MAIN_WINDOW_INPUT_MODE_VALUES_ASCII);
	_tmp244_ = self->priv->inputModeCombo;
	g_signal_connect_object (_tmp244_, "changed", (GCallback) _moserial_main_window_inputModeChanged_gtk_combo_box_changed, self, 0);
	_tmp245_ = builder;
	_tmp246_ = gtk_builder_get_object (_tmp245_, "termination_mode");
	_tmp247_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp246_, gtk_combo_box_get_type (), GtkComboBox));
	_g_object_unref0 (self->priv->lineEndModeCombo);
	self->priv->lineEndModeCombo = _tmp247_;
	_tmp248_ = self->priv->lineEndModeCombo;
	_tmp249_ = self->priv->serialConnection;
	mo_utils_populateComboBox (_tmp248_, MOSERIAL_SERIAL_CONNECTION_LineEndStrings, G_N_ELEMENTS (MOSERIAL_SERIAL_CONNECTION_LineEndStrings));
	_tmp250_ = self->priv->lineEndModeCombo;
	gtk_combo_box_set_active (_tmp250_, (gint) MOSERIAL_SERIAL_CONNECTION_LINE_END_CRLF);
	_tmp251_ = g_strdup (MOSERIAL_MAIN_WINDOW_recentGroup);
	_tmp252_ = g_new0 (gchar*, 1 + 1);
	_tmp252_[0] = _tmp251_;
	self->priv->recentData.groups = (_vala_array_free (self->priv->recentData.groups, _vala_array_length (self->priv->recentData.groups), (GDestroyNotify) g_free), NULL);
	self->priv->recentData.groups = _tmp252_;
	_tmp253_ = g_get_application_name ();
	_tmp254_ = g_strdup (_tmp253_);
	_g_free0 (self->priv->recentData.app_name);
	self->priv->recentData.app_name = _tmp254_;
	_tmp255_ = g_get_prgname ();
	_tmp256_ = g_strconcat (_tmp255_, " %u", NULL);
	_g_free0 (self->priv->recentData.app_exec);
	self->priv->recentData.app_exec = _tmp256_;
	_tmp257_ = g_strdup ("text/plain");
	_g_free0 (self->priv->recentData.mime_type);
	self->priv->recentData.mime_type = _tmp257_;
	_tmp258_ = gtk_recent_manager_get_default ();
	_tmp259_ = _g_object_ref0 (_tmp258_);
	recentManager = _tmp259_;
	_tmp260_ = recentManager;
	_tmp261_ = (GtkRecentChooserMenu*) gtk_recent_chooser_menu_new_for_manager (_tmp260_);
	g_object_ref_sink (_tmp261_);
	recentChooserMenu = _tmp261_;
	_tmp262_ = recentChooserMenu;
	g_signal_connect_object ((GtkRecentChooser*) _tmp262_, "item-activated", (GCallback) _moserial_main_window_recentItemOpen_gtk_recent_chooser_item_activated, self, 0);
	_tmp263_ = gtk_recent_filter_new ();
	g_object_ref_sink (_tmp263_);
	filter = _tmp263_;
	_tmp264_ = filter;
	gtk_recent_filter_add_group (_tmp264_, MOSERIAL_MAIN_WINDOW_recentGroup);
	_tmp265_ = recentChooserMenu;
	_tmp266_ = filter;
	gtk_recent_chooser_add_filter ((GtkRecentChooser*) _tmp265_, _tmp266_);
	_tmp267_ = recentChooserMenu;
	gtk_recent_chooser_menu_set_show_numbers (_tmp267_, TRUE);
	_tmp268_ = recentChooserMenu;
	gtk_recent_chooser_set_show_not_found ((GtkRecentChooser*) _tmp268_, FALSE);
	_tmp269_ = builder;
	_tmp270_ = gtk_builder_get_object (_tmp269_, "menubar_open_recent");
	_tmp271_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp270_, gtk_menu_item_get_type (), GtkMenuItem));
	recentFileItem = _tmp271_;
	_tmp272_ = recentFileItem;
	_tmp273_ = recentChooserMenu;
	gtk_menu_item_set_submenu (_tmp272_, (GtkWidget*) _tmp273_);
	_tmp274_ = self->priv->profile;
	_tmp275_ = preferences_loadFromProfile (_tmp274_);
	_g_object_unref0 (self->priv->currentPreferences);
	self->priv->currentPreferences = _tmp275_;
	_tmp276_ = self->priv->currentPreferences;
	moserial_main_window_updatePreferences (self, NULL, _tmp276_);
	self->priv->profileChanged = FALSE;
	_tmp277_ = self->priv->_startupProfileFilename;
	if (!(_tmp277_ == NULL)) {
		const gchar* _tmp278_;
		_tmp278_ = self->priv->_startupProfileFilename;
		moserial_main_window_loadProfileOnStartup (self, _tmp278_);
	}
	_tmp279_ = self->priv->profile;
	_tmp280_ = default_paths_loadFromProfile (_tmp279_);
	_g_object_unref0 (self->priv->currentPaths);
	self->priv->currentPaths = _tmp280_;
	_g_object_unref0 (recentFileItem);
	_g_object_unref0 (filter);
	_g_object_unref0 (recentChooserMenu);
	_g_object_unref0 (recentManager);
	_g_object_unref0 (outgoingHexScrolledWindow);
	_g_object_unref0 (outgoingAsciiScrolledWindow);
	_g_object_unref0 (incomingHexScrolledWindow);
	_g_object_unref0 (incomingAsciiScrolledWindow);
	_g_object_unref0 (contents);
	_g_object_unref0 (preferences);
	_g_object_unref0 (about);
	_g_object_unref0 (helpButton);
	_g_object_unref0 (clearMenuItem);
	_g_object_unref0 (pasteMenuItem);
	_g_object_unref0 (editMenuItem);
	_g_object_unref0 (open);
	_g_object_unref0 (save);
	_g_object_unref0 (saveAs);
	_g_object_unref0 (quit);
	_g_object_unref0 (builder);
	return obj;
}


static void moserial_main_window_class_init (moserialMainWindowClass * klass) {
	moserial_main_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (moserialMainWindowPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_moserial_main_window_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_moserial_main_window_set_property;
	G_OBJECT_CLASS (klass)->constructor = moserial_main_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = moserial_main_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), MOSERIAL_MAIN_WINDOW_STARTUP_PROFILE_FILENAME_PROPERTY, moserial_main_window_properties[MOSERIAL_MAIN_WINDOW_STARTUP_PROFILE_FILENAME_PROPERTY] = g_param_spec_string ("startupProfileFilename", "startupProfileFilename", "startupProfileFilename", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}


static void moserial_main_window_instance_init (moserialMainWindow * self) {
	moserialSerialConnection* _tmp0_;
	moserialSerialStreamRecorder* _tmp1_;
	self->priv = MOSERIAL_MAIN_WINDOW_GET_PRIVATE (self);
	_tmp0_ = moserial_serial_connection_new ();
	self->priv->serialConnection = _tmp0_;
	_tmp1_ = moserial_serial_stream_recorder_new ();
	self->priv->streamRecorder = _tmp1_;
	self->priv->recordDataReceived = FALSE;
	self->priv->recordTimeoutID = (guint) 0;
	self->priv->profileFilename = NULL;
	self->priv->profileChanged = FALSE;
}


static void moserial_main_window_finalize (GObject * obj) {
	moserialMainWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MOSERIAL_TYPE_MAIN_WINDOW, moserialMainWindow);
	_g_object_unref0 (self->priv->gtkWindow);
	_g_object_unref0 (self->priv->settingsDialog);
	_g_object_unref0 (self->priv->settingsButton);
	_g_object_unref0 (self->priv->recordButton);
	_g_object_unref0 (self->priv->currentSettings);
	_g_object_unref0 (self->priv->currentPreferences);
	_g_object_unref0 (self->priv->currentPaths);
	_g_object_unref0 (self->priv->statusbar);
	_g_object_unref0 (self->priv->bytecountbar);
	_g_object_unref0 (self->priv->send);
	_g_object_unref0 (self->priv->sendProgressDialog);
	_g_object_unref0 (self->priv->sendChooserDialog);
	_g_object_unref0 (self->priv->receive);
	_g_object_unref0 (self->priv->receiveProgressDialog);
	_g_object_unref0 (self->priv->receiveChooserDialog);
	_g_object_unref0 (self->priv->recordDialog);
	_g_object_unref0 (self->priv->preferencesDialog);
	_g_object_unref0 (self->priv->serialConnection);
	_g_object_unref0 (self->priv->incomingHexTextView);
	_g_object_unref0 (self->priv->incomingAsciiTextView);
	_g_object_unref0 (self->priv->outgoingHexTextView);
	_g_object_unref0 (self->priv->outgoingAsciiTextView);
	_g_object_unref0 (self->priv->inputModeCombo);
	_g_object_unref0 (self->priv->lineEndModeCombo);
	_g_object_unref0 (self->priv->connectButton);
	_g_object_unref0 (self->priv->disconnectLabel);
	_g_object_unref0 (self->priv->connectLabel);
	_g_object_unref0 (self->priv->recordLabel);
	_g_object_unref0 (self->priv->stopRecordingLabel);
	_g_object_unref0 (self->priv->paned);
	_g_object_unref0 (self->priv->incoming_notebook);
	_g_object_unref0 (self->priv->outgoing_notebook);
	_g_object_unref0 (self->priv->incomingHexTextBuffer);
	_g_object_unref0 (self->priv->outgoingHexTextBuffer);
	_g_object_unref0 (self->priv->incomingAsciiTextBuffer);
	_g_object_unref0 (self->priv->echoTag);
	_g_object_unref0 (self->priv->outgoingAsciiTextBuffer);
	_g_object_unref0 (self->priv->echoStartMark);
	_g_object_unref0 (self->priv->xmodemFilenameDialog);
	_g_object_unref0 (self->priv->entry);
	_g_object_unref0 (self->priv->sendButton);
	_moserial_serial_stream_recorder_unref0 (self->priv->streamRecorder);
	_g_object_unref0 (self->priv->rz);
	_g_object_unref0 (self->priv->sz);
	_g_object_unref0 (self->priv->profile);
	_g_free0 (self->priv->_startupProfileFilename);
	_g_free0 (self->priv->profileFilename);
	_g_object_unref0 (self->priv->cutMenuItem);
	_g_object_unref0 (self->priv->copyMenuItem);
	_g_object_unref0 (self->priv->va1);
	_g_object_unref0 (self->priv->va2);
	_g_object_unref0 (self->priv->va3);
	_g_object_unref0 (self->priv->va4);
	_g_object_unref0 (self->priv->ag);
	gtk_recent_data_destroy (&self->priv->recentData);
	G_OBJECT_CLASS (moserial_main_window_parent_class)->finalize (obj);
}


GType moserial_main_window_get_type (void) {
	static volatile gsize moserial_main_window_type_id__volatile = 0;
	if (g_once_init_enter (&moserial_main_window_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (moserialMainWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) moserial_main_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (moserialMainWindow), 0, (GInstanceInitFunc) moserial_main_window_instance_init, NULL };
		GType moserial_main_window_type_id;
		moserial_main_window_type_id = g_type_register_static (gtk_window_get_type (), "moserialMainWindow", &g_define_type_info, 0);
		g_once_init_leave (&moserial_main_window_type_id__volatile, moserial_main_window_type_id);
	}
	return moserial_main_window_type_id__volatile;
}


static void _vala_moserial_main_window_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	moserialMainWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, MOSERIAL_TYPE_MAIN_WINDOW, moserialMainWindow);
	switch (property_id) {
		case MOSERIAL_MAIN_WINDOW_STARTUP_PROFILE_FILENAME_PROPERTY:
		g_value_set_string (value, moserial_main_window_get_startupProfileFilename (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_moserial_main_window_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	moserialMainWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, MOSERIAL_TYPE_MAIN_WINDOW, moserialMainWindow);
	switch (property_id) {
		case MOSERIAL_MAIN_WINDOW_STARTUP_PROFILE_FILENAME_PROPERTY:
		moserial_main_window_set_startupProfileFilename (self, g_value_get_string (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;
}



