/* MainWindow.c generated by valac 0.54.3, 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 <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <stdio.h>
#include <pango/pango.h>
#include <math.h>
#include <float.h>
#include <gdk/gdk.h>
#include <config.h>

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

#define 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];
typedef enum  {
	MOSERIAL_MAIN_WINDOW_INPUT_MODE_VALUES_ASCII,
	MOSERIAL_MAIN_WINDOW_INPUT_MODE_VALUES_HEX
} moserialMainWindowinputModeValues;

#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 _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
typedef enum  {
	MOSERIAL_SZWRAPPER_PROTOCOL_XMODEM,
	MOSERIAL_SZWRAPPER_PROTOCOL_YMODEM,
	MOSERIAL_SZWRAPPER_PROTOCOL_ZMODEM,
	MOSERIAL_SZWRAPPER_PROTOCOL_RAW,
	MOSERIAL_SZWRAPPER_PROTOCOL_NULL
} moserialSzwrapperProtocol;

#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;
typedef enum  {
	MOSERIAL_RZWRAPPER_PROTOCOL_XMODEM,
	MOSERIAL_RZWRAPPER_PROTOCOL_YMODEM,
	MOSERIAL_RZWRAPPER_PROTOCOL_ZMODEM,
	MOSERIAL_RZWRAPPER_PROTOCOL_NULL
} moserialRzwrapperProtocol;

#define MOSERIAL_RZWRAPPER_TYPE_PROTOCOL (moserial_rzwrapper_protocol_get_type ())
typedef struct _moserialRzwrapperPrivate moserialRzwrapperPrivate;
typedef enum  {
	MOSERIAL_SERIAL_STREAM_RECORDER_DIRECTION_INCOMING,
	MOSERIAL_SERIAL_STREAM_RECORDER_DIRECTION_OUTGOING,
	MOSERIAL_SERIAL_STREAM_RECORDER_DIRECTION_BOTH
} moserialSerialStreamRecorderDirection;

#define MOSERIAL_SERIAL_STREAM_RECORDER_TYPE_DIRECTION (moserial_serial_stream_recorder_direction_get_type ())
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
typedef enum  {
	SETTINGS_ACCESS_MODE_READWRITE,
	SETTINGS_ACCESS_MODE_READONLY,
	SETTINGS_ACCESS_MODE_WRITEONLY
} SettingsAccessMode;

#define SETTINGS_TYPE_ACCESS_MODE (settings_access_mode_get_type ())
#define __vala_PangoFontDescription_free0(var) ((var == NULL) ? NULL : (var = (_vala_PangoFontDescription_free (var), NULL)))

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;
	GtkMenuItem* cutMenuItem;
	GtkMenuItem* copyMenuItem;
	GtkAdjustment* va1;
	GtkAdjustment* va2;
	GtkAdjustment* va3;
	GtkAdjustment* va4;
	GtkAccelGroup* ag;
	GtkButton* incomingClearButton;
	GtkButton* outgoingClearButton;
	GtkToggleButton* dtrButton;
	GtkToggleButton* rtsButton;
	GtkGrid* incoming_signals;
	GtkGrid* outgoing_signals;
	GtkCheckMenuItem* extraControlsCheck;
	GtkRecentData recentData;
	GtkLabel* serialStatusSignals[4];
};

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

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

struct _moserialRzwrapperClass {
	GObjectClass parent_class;
};

static gint moserialMainWindow_private_offset;
static gpointer moserial_main_window_parent_class = NULL;

VALA_EXTERN GType moserial_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (moserialMainWindow, g_object_unref)
VALA_EXTERN GType moserial_settings_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (moserialSettingsDialog, g_object_unref)
VALA_EXTERN GType settings_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Settings, g_object_unref)
VALA_EXTERN GType preferences_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Preferences, g_object_unref)
VALA_EXTERN GType default_paths_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DefaultPaths, g_object_unref)
VALA_EXTERN GType moserial_send_progress_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (moserialSendProgressDialog, g_object_unref)
VALA_EXTERN GType moserial_send_chooser_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (moserialSendChooserDialog, g_object_unref)
VALA_EXTERN GType moserial_receive_progress_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (moserialReceiveProgressDialog, g_object_unref)
VALA_EXTERN GType moserial_receive_chooser_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (moserialReceiveChooserDialog, g_object_unref)
VALA_EXTERN GType moserial_record_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (moserialRecordDialog, g_object_unref)
VALA_EXTERN GType moserial_preferences_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (moserialPreferencesDialog, g_object_unref)
VALA_EXTERN GType moserial_serial_connection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (moserialSerialConnection, g_object_unref)
VALA_EXTERN GType moserial_hex_text_buffer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (moserialHexTextBuffer, g_object_unref)
VALA_EXTERN GType moserial_xmodem_filename_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (moserialXmodemFilenameDialog, g_object_unref)
VALA_EXTERN gpointer moserial_serial_stream_recorder_ref (gpointer instance);
VALA_EXTERN void moserial_serial_stream_recorder_unref (gpointer instance);
VALA_EXTERN GParamSpec* moserial_param_spec_serial_stream_recorder (const gchar* name,
                                                        const gchar* nick,
                                                        const gchar* blurb,
                                                        GType object_type,
                                                        GParamFlags flags);
VALA_EXTERN void moserial_value_set_serial_stream_recorder (GValue* value,
                                                gpointer v_object);
VALA_EXTERN void moserial_value_take_serial_stream_recorder (GValue* value,
                                                 gpointer v_object);
VALA_EXTERN gpointer moserial_value_get_serial_stream_recorder (const GValue* value);
VALA_EXTERN GType moserial_serial_stream_recorder_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (moserialSerialStreamRecorder, moserial_serial_stream_recorder_unref)
VALA_EXTERN GType moserial_rzwrapper_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (moserialRzwrapper, g_object_unref)
VALA_EXTERN GType moserial_szwrapper_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (moserialSzwrapper, g_object_unref)
VALA_EXTERN GType profile_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Profile, g_object_unref)
static GType moserial_main_window_input_mode_values_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
#define MOSERIAL_MAIN_WINDOW_translators N_ ("translator-credits")
#define MOSERIAL_MAIN_WINDOW_recentGroup "moserial-configs"
VALA_EXTERN moserialSerialConnection* moserial_serial_connection_new (void);
VALA_EXTERN moserialSerialConnection* moserial_serial_connection_construct (GType object_type);
VALA_EXTERN moserialSerialStreamRecorder* moserial_serial_stream_recorder_new (void);
VALA_EXTERN moserialSerialStreamRecorder* moserial_serial_stream_recorder_construct (GType object_type);
static void gtk_recent_data_destroy (GtkRecentData * self);
VALA_EXTERN moserialMainWindow* moserial_main_window_new (const gchar* profileFilename);
VALA_EXTERN moserialMainWindow* moserial_main_window_construct (GType object_type,
                                                    const gchar* profileFilename);
static void moserial_main_window_onIncomingNotebookSwitchPage (moserialMainWindow* self,
                                                        GtkWidget* page,
                                                        guint page_num);
VALA_EXTERN void profile_setInteger (Profile* self,
                         const gchar* group,
                         const gchar* key,
                         gint new_val);
static void moserial_main_window_onOutgoingNotebookSwitchPage (moserialMainWindow* self,
                                                        GtkWidget* page,
                                                        guint page_num);
static void moserial_main_window_checkExtraVisible (moserialMainWindow* self,
                                             GtkWidget* widget);
VALA_EXTERN gboolean profile_getBoolean (Profile* self,
                             const gchar* group,
                             const gchar* key,
                             gboolean default_val);
static void moserial_main_window_toggleExtraControls (moserialMainWindow* self,
                                               GtkCheckMenuItem* check);
VALA_EXTERN void profile_setBoolean (Profile* self,
                         const gchar* group,
                         const gchar* key,
                         gboolean new_val);
static void moserial_main_window_toggleRTS (moserialMainWindow* self,
                                     GtkToggleButton* button);
VALA_EXTERN gboolean moserial_serial_connection_isConnected (moserialSerialConnection* self);
VALA_EXTERN void moserial_serial_connection_controlRTS (moserialSerialConnection* self,
                                            gboolean y);
static void moserial_main_window_toggleDTR (moserialMainWindow* self,
                                     GtkToggleButton* button);
VALA_EXTERN void moserial_serial_connection_controlDTR (moserialSerialConnection* self,
                                            gboolean y);
static void moserial_main_window_clearIncoming (moserialMainWindow* self);
VALA_EXTERN void moserial_hex_text_buffer_clear (moserialHexTextBuffer* self);
static void moserial_main_window_clearOutgoing (moserialMainWindow* self);
static void moserial_main_window_applyProfile (moserialMainWindow* self,
                                        const gchar* filename);
VALA_EXTERN gboolean profile_load (Profile* self,
                       const gchar* filename,
                       GtkWindow* window);
VALA_EXTERN void moserial_main_window_ensureDisconnected (moserialMainWindow* self);
VALA_EXTERN Settings* settings_loadFromProfile (Profile* profile);
VALA_EXTERN Preferences* preferences_loadFromProfile (Profile* profile);
VALA_EXTERN DefaultPaths* default_paths_loadFromProfile (Profile* profile);
VALA_EXTERN gint profile_getInteger (Profile* self,
                         const gchar* group,
                         const gchar* key,
                         gint default_val);
static void moserial_main_window_updateOutgoingInputArea (moserialMainWindow* self);
static void moserial_main_window_updatePreferences (moserialMainWindow* self,
                                             moserialPreferencesDialog* d,
                                             Preferences* newPreferences);
VALA_EXTERN gchar* settings_getStatusbarString (Settings* self,
                                    gboolean open);
static void moserial_main_window_setWindowTitle (moserialMainWindow* self,
                                          const gchar* recordingFilename);
VALA_EXTERN gboolean settings_get_autoConnect (Settings* self);
VALA_EXTERN gboolean moserial_main_window_ensureConnected (moserialMainWindow* self);
static void moserial_main_window_recentItemOpen (moserialMainWindow* self,
                                          GtkRecentChooser* r);
static void moserial_main_window_insertBufferEnd (moserialMainWindow* self,
                                           GtkTextBuffer* buf,
                                           const gchar* s);
VALA_EXTERN void moserial_main_window_sendString (moserialMainWindow* self,
                                      GtkWidget* w);
VALA_EXTERN void moserial_serial_connection_sendByte (moserialSerialConnection* self,
                                          guchar byte);
VALA_EXTERN void moserial_serial_stream_recorder_writeOutgoing (moserialSerialStreamRecorder* self,
                                                    guchar data);
VALA_EXTERN void moserial_hex_text_buffer_add (moserialHexTextBuffer* self,
                                   guchar data);
VALA_EXTERN GQuark hex_parse_error_quark (void);
VALA_EXTERN guchar* input_parser_parseHex (const gchar* s,
                               gint* result_length1,
                               GError** error);
VALA_EXTERN gchar* moserial_serial_connection_getBytecountbarString (moserialSerialConnection* self);
static void moserial_main_window_doSendChooser (moserialMainWindow* self,
                                         GtkToolButton* button);
VALA_EXTERN void moserial_send_chooser_dialog_show (moserialSendChooserDialog* self,
                                        const gchar* folder);
VALA_EXTERN const gchar* default_paths_get_sendFrom (DefaultPaths* self);
static void moserial_main_window_doSend (moserialMainWindow* self,
                                  moserialSendChooserDialog* dialog);
VALA_EXTERN GType moserial_szwrapper_protocol_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gchar* mo_utils_getParentFolder (const gchar* path);
VALA_EXTERN void default_paths_set_sendFrom (DefaultPaths* self,
                                 const gchar* value);
VALA_EXTERN moserialSzwrapper* moserial_szwrapper_new (moserialSzwrapperProtocol* protocol,
                                           moserialSerialConnection* sc,
                                           const gchar* filename);
VALA_EXTERN moserialSzwrapper* moserial_szwrapper_construct (GType object_type,
                                                 moserialSzwrapperProtocol* protocol,
                                                 moserialSerialConnection* sc,
                                                 const gchar* filename);
VALA_EXTERN void moserial_send_progress_dialog_show (moserialSendProgressDialog* self);
VALA_EXTERN 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);
VALA_EXTERN void moserial_szwrapper_transferCanceled (moserialSzwrapper* self,
                                          GObject* o);
static void _moserial_szwrapper_transferCanceled_moserial_send_progress_dialog_transfer_canceled (moserialSendProgressDialog* _sender,
                                                                                           gpointer self);
VALA_EXTERN void moserial_main_window_sendComplete (moserialMainWindow* self,
                                        GObject* o);
static void _moserial_main_window_sendComplete_moserial_szwrapper_transfer_complete (moserialSzwrapper* _sender,
                                                                              gpointer self);
VALA_EXTERN gboolean moserial_send_progress_dialog_hide (moserialSendProgressDialog* self);
static void moserial_main_window_doReceiveChooser (moserialMainWindow* self,
                                            GtkToolButton* button);
VALA_EXTERN void moserial_receive_chooser_dialog_show (moserialReceiveChooserDialog* self,
                                           const gchar* folder);
VALA_EXTERN const gchar* default_paths_get_receiveTo (DefaultPaths* self);
static void moserial_main_window_doReceive (moserialMainWindow* self,
                                     moserialReceiveChooserDialog* dialog);
VALA_EXTERN void default_paths_set_receiveTo (DefaultPaths* self,
                                  const gchar* value);
VALA_EXTERN void moserial_xmodem_filename_dialog_show (moserialXmodemFilenameDialog* self);
VALA_EXTERN GType moserial_rzwrapper_protocol_get_type (void) G_GNUC_CONST ;
VALA_EXTERN moserialRzwrapper* moserial_rzwrapper_new (moserialRzwrapperProtocol* protocol,
                                           moserialSerialConnection* sc,
                                           const gchar* p,
                                           const gchar* filename);
VALA_EXTERN moserialRzwrapper* moserial_rzwrapper_construct (GType object_type,
                                                 moserialRzwrapperProtocol* protocol,
                                                 moserialSerialConnection* sc,
                                                 const gchar* p,
                                                 const gchar* filename);
VALA_EXTERN void moserial_receive_progress_dialog_show (moserialReceiveProgressDialog* self);
VALA_EXTERN 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);
VALA_EXTERN void moserial_rzwrapper_transferCanceled (moserialRzwrapper* self,
                                          GObject* o);
static void _moserial_rzwrapper_transferCanceled_moserial_receive_progress_dialog_transfer_canceled (moserialReceiveProgressDialog* _sender,
                                                                                              gpointer self);
VALA_EXTERN void moserial_main_window_receiveComplete (moserialMainWindow* self,
                                           GObject* o);
static void _moserial_main_window_receiveComplete_moserial_rzwrapper_transfer_complete (moserialRzwrapper* _sender,
                                                                                 gpointer self);
VALA_EXTERN gboolean moserial_receive_progress_dialog_hide (moserialReceiveProgressDialog* self);
VALA_EXTERN void moserial_main_window_record (moserialMainWindow* self,
                                  GtkToggleToolButton* button);
VALA_EXTERN gboolean preferences_get_recordAutoName (Preferences* self);
VALA_EXTERN const gchar* preferences_get_recordAutoFolder (Preferences* self);
VALA_EXTERN const gchar* preferences_get_recordAutoExtension (Preferences* self);
VALA_EXTERN GType moserial_serial_stream_recorder_direction_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gint preferences_get_recordAutoDirection (Preferences* self);
VALA_EXTERN void moserial_main_window_startRecording (moserialMainWindow* self,
                                          const gchar* filename,
                                          moserialSerialStreamRecorderDirection direction);
VALA_EXTERN void moserial_record_dialog_show (moserialRecordDialog* self,
                                  const gchar* folder);
VALA_EXTERN const gchar* default_paths_get_recordTo (DefaultPaths* self);
VALA_EXTERN void moserial_serial_stream_recorder_close (moserialSerialStreamRecorder* self,
                                            gboolean launch);
VALA_EXTERN gboolean preferences_get_recordLaunch (Preferences* self);
VALA_EXTERN void moserial_main_window_stopRecording (moserialMainWindow* self);
VALA_EXTERN void moserial_serial_stream_recorder_open (moserialSerialStreamRecorder* self,
                                           const gchar* filename,
                                           moserialSerialStreamRecorderDirection direction,
                                           GError** error);
VALA_EXTERN void default_paths_set_recordTo (DefaultPaths* self,
                                 const gchar* value);
VALA_EXTERN gboolean moserial_main_window_recordTimeout (moserialMainWindow* self);
VALA_EXTERN void moserial_main_window_showWindow (moserialMainWindow* self);
static void moserial_main_window_updateSettings (moserialMainWindow* self,
                                          moserialSettingsDialog* d,
                                          Settings* newSettings);
VALA_EXTERN GType settings_access_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN SettingsAccessMode settings_get_accessMode (Settings* self);
VALA_EXTERN gboolean preferences_get_useSystemMonospaceFont (Preferences* self);
VALA_EXTERN gchar* preferences_getSystemDefaultMonospaceFont (void);
VALA_EXTERN const gchar* preferences_get_font (Preferences* self);
VALA_EXTERN const gchar* preferences_get_fontColor (Preferences* self);
VALA_EXTERN const gchar* preferences_get_backgroundColor (Preferences* self);
static void _vala_PangoFontDescription_free (PangoFontDescription* self);
VALA_EXTERN const gchar* preferences_get_highlightColor (Preferences* self);
VALA_EXTERN void moserial_hex_text_buffer_applyPreferences (moserialHexTextBuffer* self,
                                                Preferences* preferences);
static void moserial_main_window_showSettingsDialog (moserialMainWindow* self,
                                              GObject* o);
VALA_EXTERN void moserial_settings_dialog_show (moserialSettingsDialog* self,
                                    Settings* settings);
static void moserial_main_window_showPreferencesDialog (moserialMainWindow* self,
                                                 GObject* o);
VALA_EXTERN void moserial_preferences_dialog_show (moserialPreferencesDialog* self,
                                       Preferences* preferences,
                                       gboolean recording);
static gboolean moserial_main_window_startConnection (moserialMainWindow* self);
VALA_EXTERN gboolean moserial_serial_connection_doConnect (moserialSerialConnection* self,
                                               Settings* settings);
VALA_EXTERN const gchar* settings_get_device (Settings* self);
VALA_EXTERN gboolean* moserial_serial_connection_getStatus (moserialSerialConnection* self,
                                                gint* result_length1);
static void moserial_main_window_updateIncoming (moserialMainWindow* self,
                                          moserialSerialConnection* sc,
                                          guchar* data,
                                          gint data_length1,
                                          gint size);
static void _moserial_main_window_updateIncoming_moserial_serial_connection_new_data (moserialSerialConnection* _sender,
                                                                               guchar* data,
                                                                               gint data_length1,
                                                                               gint size,
                                                                               gpointer self);
static void moserial_main_window_connectionError (moserialMainWindow* self);
static void _moserial_main_window_connectionError_moserial_serial_connection_on_error (moserialSerialConnection* _sender,
                                                                                gpointer self);
static void moserial_main_window_connectButtonClick (moserialMainWindow* self,
                                              GtkToggleToolButton* button);
VALA_EXTERN void moserial_serial_connection_doDisconnect (moserialSerialConnection* self);
static gboolean moserial_main_window_showSerialStatus (moserialMainWindow* self);
VALA_EXTERN void moserial_rzwrapper_writeChar (moserialRzwrapper* self,
                                   guchar byte);
VALA_EXTERN void moserial_rzwrapper_flush (moserialRzwrapper* self);
VALA_EXTERN void moserial_szwrapper_writeChar (moserialSzwrapper* self,
                                   guchar byte);
VALA_EXTERN gboolean preferences_get_enableTimeout (Preferences* self);
VALA_EXTERN gint preferences_get_timeout (Preferences* self);
static gboolean _moserial_main_window_recordTimeout_gsource_func (gpointer self);
VALA_EXTERN void moserial_serial_stream_recorder_writeIncoming (moserialSerialStreamRecorder* self,
                                                    guchar* data,
                                                    gint data_length1);
static void moserial_main_window_inputModeChanged (moserialMainWindow* self,
                                            GtkComboBox* inputModeCombo);
static void moserial_main_window_lineEndChanged (moserialMainWindow* self,
                                          GtkComboBox* lineEndCombo);
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);
VALA_EXTERN void moserial_auto_scroll_scroll (GtkAdjustment* va);
VALA_EXTERN void preferences_saveToProfile (Preferences* self,
                                Profile* profile);
VALA_EXTERN void settings_saveToProfile (Settings* self,
                             Profile* profile);
VALA_EXTERN void default_paths_saveToProfile (DefaultPaths* self,
                                  Profile* profile);
VALA_EXTERN gboolean profile_get_profileChanged (Profile* self);
static void moserial_main_window_saveProfile (moserialMainWindow* self);
VALA_EXTERN void profile_save (Profile* self,
                   const gchar* filename,
                   GtkWindow* window);
static void moserial_main_window_saveProfileAs (moserialMainWindow* self);
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);
VALA_EXTERN 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);
static void _moserial_main_window_checkExtraVisible_gtk_widget_realize (GtkWidget* _sender,
                                                                 gpointer self);
VALA_EXTERN Profile* profile_new (void);
VALA_EXTERN Profile* profile_construct (GType object_type);
static void _moserial_main_window_toggleExtraControls_gtk_check_menu_item_toggled (GtkCheckMenuItem* _sender,
                                                                            gpointer 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);
VALA_EXTERN moserialSettingsDialog* moserial_settings_dialog_new (GtkWindow* parent);
VALA_EXTERN moserialSettingsDialog* moserial_settings_dialog_construct (GType object_type,
                                                            GtkWindow* parent);
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);
VALA_EXTERN moserialSendProgressDialog* moserial_send_progress_dialog_new (GtkWindow* parent);
VALA_EXTERN moserialSendProgressDialog* moserial_send_progress_dialog_construct (GType object_type,
                                                                     GtkWindow* parent);
VALA_EXTERN moserialSendChooserDialog* moserial_send_chooser_dialog_new (GtkWindow* parent);
VALA_EXTERN moserialSendChooserDialog* moserial_send_chooser_dialog_construct (GType object_type,
                                                                   GtkWindow* parent);
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);
VALA_EXTERN moserialReceiveProgressDialog* moserial_receive_progress_dialog_new (GtkWindow* parent);
VALA_EXTERN moserialReceiveProgressDialog* moserial_receive_progress_dialog_construct (GType object_type,
                                                                           GtkWindow* parent);
VALA_EXTERN moserialReceiveChooserDialog* moserial_receive_chooser_dialog_new (GtkWindow* parent);
VALA_EXTERN moserialReceiveChooserDialog* moserial_receive_chooser_dialog_construct (GType object_type,
                                                                         GtkWindow* parent);
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);
VALA_EXTERN moserialXmodemFilenameDialog* moserial_xmodem_filename_dialog_new (GtkWindow* parent);
VALA_EXTERN moserialXmodemFilenameDialog* moserial_xmodem_filename_dialog_construct (GType object_type,
                                                                         GtkWindow* parent);
VALA_EXTERN moserialRecordDialog* moserial_record_dialog_new (GtkWindow* parent);
VALA_EXTERN moserialRecordDialog* moserial_record_dialog_construct (GType object_type,
                                                        GtkWindow* parent);
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);
VALA_EXTERN moserialPreferencesDialog* moserial_preferences_dialog_new (GtkWindow* parent);
VALA_EXTERN moserialPreferencesDialog* moserial_preferences_dialog_construct (GType object_type,
                                                                  GtkWindow* parent);
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);
static void _moserial_main_window_onIncomingNotebookSwitchPage_gtk_notebook_switch_page (GtkNotebook* _sender,
                                                                                  GtkWidget* page,
                                                                                  guint page_num,
                                                                                  gpointer self);
static void _moserial_main_window_onOutgoingNotebookSwitchPage_gtk_notebook_switch_page (GtkNotebook* _sender,
                                                                                  GtkWidget* page,
                                                                                  guint page_num,
                                                                                  gpointer self);
VALA_EXTERN moserialHexTextBuffer* moserial_hex_text_buffer_new (void);
VALA_EXTERN moserialHexTextBuffer* moserial_hex_text_buffer_construct (GType object_type);
VALA_EXTERN 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);
VALA_EXTERN void mo_utils_populateComboBox (GtkComboBox* Combo,
                                gchar** val_array,
                                gint val_array_length1,
                                gboolean render_cell);
static void _moserial_main_window_inputModeChanged_gtk_combo_box_changed (GtkComboBox* _sender,
                                                                   gpointer self);
static void _moserial_main_window_lineEndChanged_gtk_combo_box_changed (GtkComboBox* _sender,
                                                                 gpointer self);
static void _moserial_main_window_recentItemOpen_gtk_recent_chooser_item_activated (GtkRecentChooser* _sender,
                                                                             gpointer self);
static void _moserial_main_window_toggleDTR_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                gpointer self);
static void _moserial_main_window_toggleRTS_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                gpointer self);
static void _moserial_main_window_clearIncoming_gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self);
static void _moserial_main_window_clearOutgoing_gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self);
static void moserial_main_window_finalize (GObject * obj);
static GType moserial_main_window_get_type_once (void);
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,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static const gchar* MOSERIAL_MAIN_WINDOW_authors[4] = {"Michael J. Chudobiak <mjc@avtechpulse.com>", "mdarlodavampire", "Michael Wolf <michael.wolf@mictronics.de>", 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")};
VALA_EXTERN const gchar* MOSERIAL_SERIAL_CONNECTION_LineEndValues[6];
VALA_EXTERN const gchar* MOSERIAL_SERIAL_CONNECTION_LineEndStrings[6];

static inline gpointer
moserial_main_window_get_instance_private (moserialMainWindow* self)
{
	return G_STRUCT_MEMBER_P (self, moserialMainWindow_private_offset);
}

static GType
moserial_main_window_input_mode_values_get_type_once (void)
{
	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);
	return moserial_main_window_input_mode_values_type_id;
}

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)) {
		GType moserial_main_window_input_mode_values_type_id;
		moserial_main_window_input_mode_values_type_id = moserial_main_window_input_mode_values_get_type_once ();
		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;
	self = (moserialMainWindow*) g_object_new (object_type, "startupProfileFilename", profileFilename, NULL);
	return self;
}

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

static void
moserial_main_window_onIncomingNotebookSwitchPage (moserialMainWindow* self,
                                                   GtkWidget* page,
                                                   guint page_num)
{
	Profile* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (page != NULL);
	_tmp0_ = self->priv->profile;
	profile_setInteger (_tmp0_, "main_ui_controls", "incoming_tab", (gint) page_num);
}

static void
moserial_main_window_onOutgoingNotebookSwitchPage (moserialMainWindow* self,
                                                   GtkWidget* page,
                                                   guint page_num)
{
	Profile* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (page != NULL);
	_tmp0_ = self->priv->profile;
	profile_setInteger (_tmp0_, "main_ui_controls", "outgoing_tab", (gint) page_num);
}

static void
moserial_main_window_checkExtraVisible (moserialMainWindow* self,
                                        GtkWidget* widget)
{
	gboolean new_state = FALSE;
	Profile* _tmp0_;
	GtkGrid* _tmp1_;
	GtkGrid* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->priv->profile;
	new_state = profile_getBoolean (_tmp0_, "main_ui_controls", "show_extra_controls", TRUE);
	_tmp1_ = self->priv->incoming_signals;
	gtk_widget_set_visible ((GtkWidget*) _tmp1_, new_state);
	_tmp2_ = self->priv->outgoing_signals;
	gtk_widget_set_visible ((GtkWidget*) _tmp2_, new_state);
}

static void
moserial_main_window_toggleExtraControls (moserialMainWindow* self,
                                          GtkCheckMenuItem* check)
{
	Profile* _tmp0_;
	GtkWindow* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (check != NULL);
	_tmp0_ = self->priv->profile;
	profile_setBoolean (_tmp0_, "main_ui_controls", "show_extra_controls", gtk_check_menu_item_get_active (check));
	_tmp1_ = self->priv->gtkWindow;
	moserial_main_window_checkExtraVisible (self, (GtkWidget*) _tmp1_);
}

static void
moserial_main_window_toggleRTS (moserialMainWindow* self,
                                GtkToggleButton* button)
{
	moserialSerialConnection* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = self->priv->serialConnection;
	if (!moserial_serial_connection_isConnected (_tmp0_)) {
		return;
	}
	if (gtk_toggle_button_get_active (button)) {
		moserialSerialConnection* _tmp1_;
		_tmp1_ = self->priv->serialConnection;
		moserial_serial_connection_controlRTS (_tmp1_, TRUE);
	} else {
		moserialSerialConnection* _tmp2_;
		_tmp2_ = self->priv->serialConnection;
		moserial_serial_connection_controlRTS (_tmp2_, FALSE);
	}
}

static void
moserial_main_window_toggleDTR (moserialMainWindow* self,
                                GtkToggleButton* button)
{
	moserialSerialConnection* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = self->priv->serialConnection;
	if (!moserial_serial_connection_isConnected (_tmp0_)) {
		return;
	}
	if (gtk_toggle_button_get_active (button)) {
		moserialSerialConnection* _tmp1_;
		_tmp1_ = self->priv->serialConnection;
		moserial_serial_connection_controlDTR (_tmp1_, TRUE);
	} else {
		moserialSerialConnection* _tmp2_;
		_tmp2_ = self->priv->serialConnection;
		moserial_serial_connection_controlDTR (_tmp2_, FALSE);
	}
}

static void
moserial_main_window_clearIncoming (moserialMainWindow* self)
{
	moserialHexTextBuffer* _tmp0_;
	GtkTextBuffer* _tmp1_;
	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);
}

static void
moserial_main_window_clearOutgoing (moserialMainWindow* self)
{
	moserialHexTextBuffer* _tmp0_;
	GtkTextBuffer* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->outgoingHexTextBuffer;
	moserial_hex_text_buffer_clear (_tmp0_);
	_tmp1_ = self->priv->outgoingAsciiTextBuffer;
	gtk_text_buffer_set_text (_tmp1_, "", 0);
}

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_;
	GtkWindow* _tmp1_;
	gchar* _tmp2_;
	Profile* _tmp3_;
	Settings* _tmp4_;
	Profile* _tmp5_;
	Preferences* _tmp6_;
	Profile* _tmp7_;
	DefaultPaths* _tmp8_;
	gint width = 0;
	Profile* _tmp9_;
	gint height = 0;
	Profile* _tmp10_;
	gint panedPosition = 0;
	Profile* _tmp11_;
	gboolean _tmp12_ = FALSE;
	GtkNotebook* _tmp16_;
	Profile* _tmp17_;
	GtkNotebook* _tmp18_;
	Profile* _tmp19_;
	Profile* _tmp20_;
	GtkComboBox* _tmp23_;
	Profile* _tmp24_;
	Preferences* _tmp25_;
	GtkStatusbar* _tmp26_;
	GtkStatusbar* _tmp27_;
	Settings* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	GtkCheckMenuItem* _tmp31_;
	Profile* _tmp32_;
	GtkWindow* _tmp33_;
	Settings* _tmp43_;
	gboolean _tmp44_;
	gboolean _tmp45_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->profile;
	_tmp1_ = self->priv->gtkWindow;
	profile_load (_tmp0_, filename, _tmp1_);
	_tmp2_ = g_strdup (filename);
	_g_free0 (self->priv->profileFilename);
	self->priv->profileFilename = _tmp2_;
	moserial_main_window_ensureDisconnected (self);
	_tmp3_ = self->priv->profile;
	_tmp4_ = settings_loadFromProfile (_tmp3_);
	_g_object_unref0 (self->priv->currentSettings);
	self->priv->currentSettings = _tmp4_;
	_tmp5_ = self->priv->profile;
	_tmp6_ = preferences_loadFromProfile (_tmp5_);
	_g_object_unref0 (self->priv->currentPreferences);
	self->priv->currentPreferences = _tmp6_;
	_tmp7_ = self->priv->profile;
	_tmp8_ = default_paths_loadFromProfile (_tmp7_);
	_g_object_unref0 (self->priv->currentPaths);
	self->priv->currentPaths = _tmp8_;
	_tmp9_ = self->priv->profile;
	width = profile_getInteger (_tmp9_, "window", "width", -1);
	_tmp10_ = self->priv->profile;
	height = profile_getInteger (_tmp10_, "window", "height", -1);
	_tmp11_ = self->priv->profile;
	panedPosition = profile_getInteger (_tmp11_, "window", "paned_pos", -1);
	if (width > 0) {
		_tmp12_ = height > 0;
	} else {
		_tmp12_ = FALSE;
	}
	if (_tmp12_) {
		GtkWindow* _tmp13_;
		_tmp13_ = self->priv->gtkWindow;
		gtk_window_resize (_tmp13_, width, height);
	}
	if (panedPosition >= -1) {
		GtkPaned* _tmp14_;
		_tmp14_ = self->priv->paned;
		gtk_paned_set_position (_tmp14_, panedPosition);
	} else {
		GtkPaned* _tmp15_;
		_tmp15_ = self->priv->paned;
		gtk_paned_set_position (_tmp15_, -1);
	}
	_tmp16_ = self->priv->incoming_notebook;
	_tmp17_ = self->priv->profile;
	gtk_notebook_set_current_page (_tmp16_, profile_getInteger (_tmp17_, "main_ui_controls", "incoming_tab", 0));
	_tmp18_ = self->priv->outgoing_notebook;
	_tmp19_ = self->priv->profile;
	gtk_notebook_set_current_page (_tmp18_, profile_getInteger (_tmp19_, "main_ui_controls", "outgoing_tab", 0));
	_tmp20_ = self->priv->profile;
	if (profile_getBoolean (_tmp20_, "main_ui_controls", "input_mode_hex", FALSE)) {
		GtkComboBox* _tmp21_;
		_tmp21_ = self->priv->inputModeCombo;
		gtk_combo_box_set_active (_tmp21_, (gint) MOSERIAL_MAIN_WINDOW_INPUT_MODE_VALUES_HEX);
	} else {
		GtkComboBox* _tmp22_;
		_tmp22_ = self->priv->inputModeCombo;
		gtk_combo_box_set_active (_tmp22_, (gint) MOSERIAL_MAIN_WINDOW_INPUT_MODE_VALUES_ASCII);
	}
	_tmp23_ = self->priv->lineEndModeCombo;
	_tmp24_ = self->priv->profile;
	gtk_combo_box_set_active (_tmp23_, profile_getInteger (_tmp24_, "main_ui_controls", "input_line_end", 0));
	moserial_main_window_updateOutgoingInputArea (self);
	_tmp25_ = self->priv->currentPreferences;
	moserial_main_window_updatePreferences (self, NULL, _tmp25_);
	_tmp26_ = self->priv->statusbar;
	gtk_statusbar_pop (_tmp26_, self->priv->statusbarContext);
	_tmp27_ = self->priv->statusbar;
	_tmp28_ = self->priv->currentSettings;
	_tmp29_ = settings_getStatusbarString (_tmp28_, FALSE);
	_tmp30_ = _tmp29_;
	gtk_statusbar_push (_tmp27_, self->priv->statusbarContext, _tmp30_);
	_g_free0 (_tmp30_);
	_tmp31_ = self->priv->extraControlsCheck;
	_tmp32_ = self->priv->profile;
	gtk_check_menu_item_set_active (_tmp31_, profile_getBoolean (_tmp32_, "main_ui_controls", "show_extra_controls", TRUE));
	_tmp33_ = self->priv->gtkWindow;
	moserial_main_window_checkExtraVisible (self, (GtkWidget*) _tmp33_);
	moserial_main_window_setWindowTitle (self, NULL);
	if (filename != NULL) {
		GtkRecentManager* recentManager = NULL;
		GtkRecentManager* _tmp34_;
		GtkRecentManager* _tmp35_;
		_tmp34_ = gtk_recent_manager_get_default ();
		_tmp35_ = _g_object_ref0 (_tmp34_);
		recentManager = _tmp35_;
		{
			gchar* _tmp36_ = NULL;
			gchar* _tmp37_;
			GtkRecentManager* _tmp38_;
			GtkRecentData _tmp39_;
			_tmp37_ = g_filename_to_uri (filename, NULL, &_inner_error0_);
			_tmp36_ = _tmp37_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				if (_inner_error0_->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_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return;
			}
			_tmp38_ = recentManager;
			_tmp39_ = self->priv->recentData;
			gtk_recent_manager_add_full (_tmp38_, _tmp36_, &_tmp39_);
			_g_free0 (_tmp36_);
		}
		goto __finally0;
		__catch0_g_convert_error:
		{
			GError* e = NULL;
			FILE* _tmp40_;
			GError* _tmp41_;
			const gchar* _tmp42_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp40_ = stdout;
			_tmp41_ = e;
			_tmp42_ = _tmp41_->message;
			fprintf (_tmp40_, "%s\n", _tmp42_);
			_g_error_free0 (e);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (recentManager);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		_g_object_unref0 (recentManager);
	}
	_tmp43_ = self->priv->currentSettings;
	_tmp44_ = settings_get_autoConnect (_tmp43_);
	_tmp45_ = _tmp44_;
	if (_tmp45_) {
		moserial_main_window_ensureConnected (self);
	}
}

static void
moserial_main_window_setWindowTitle (moserialMainWindow* self,
                                     const gchar* recordingFilename)
{
	GString* builder = NULL;
	GString* _tmp0_;
	GString* _tmp1_;
	const gchar* _tmp2_;
	GtkWindow* _tmp12_;
	GString* _tmp13_;
	const gchar* _tmp14_;
	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_);
	}
	if (recordingFilename != NULL) {
		GString* _tmp8_;
		GString* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp8_ = builder;
		g_string_append (_tmp8_, " - ");
		_tmp9_ = builder;
		_tmp10_ = g_path_get_basename (recordingFilename);
		_tmp11_ = _tmp10_;
		g_string_append (_tmp9_, _tmp11_);
		_g_free0 (_tmp11_);
	}
	_tmp12_ = self->priv->gtkWindow;
	_tmp13_ = builder;
	_tmp14_ = _tmp13_->str;
	gtk_window_set_title (_tmp12_, _tmp14_);
	_g_string_free0 (builder);
}

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

static gunichar
string_get_char (const gchar* self,
                 glong index)
{
	gunichar result = 0U;
	g_return_val_if_fail (self != NULL, 0U);
	result = g_utf8_get_char (((gchar*) self) + index);
	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_;
	GtkTextIter _tmp8_ = {0};
	GString* _tmp9_;
	const gchar* _tmp10_;
	GString* _tmp11_;
	const gchar* _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	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_;
			gint _tmp4_;
			gunichar c = 0U;
			gboolean _tmp5_ = FALSE;
			const gchar* _tmp7_;
			if (!_tmp1_) {
				gint _tmp2_;
				_tmp2_ = i;
				i = _tmp2_ + 1;
			}
			_tmp1_ = FALSE;
			_tmp3_ = strlen (s);
			_tmp4_ = _tmp3_;
			if (!(i < _tmp4_)) {
				break;
			}
			c = string_get_char (s, (glong) 0);
			if (g_unichar_isprint (c)) {
				_tmp5_ = TRUE;
			} else {
				_tmp5_ = g_unichar_isspace (c);
			}
			if (_tmp5_) {
				GString* _tmp6_;
				_tmp6_ = builder;
				g_string_append_unichar (_tmp6_, c);
			}
			_tmp7_ = g_utf8_next_char (s);
			s = _tmp7_;
		}
	}
	gtk_text_buffer_get_end_iter (buf, &_tmp8_);
	iter = _tmp8_;
	_tmp9_ = builder;
	_tmp10_ = _tmp9_->str;
	_tmp11_ = builder;
	_tmp12_ = _tmp11_->str;
	_tmp13_ = strlen (_tmp12_);
	_tmp14_ = _tmp13_;
	gtk_text_buffer_insert (buf, &iter, _tmp10_, (gint) _tmp14_);
	_g_string_free0 (builder);
}

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

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

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;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	DefaultPaths* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GtkComboBox* _tmp6_;
	moserialSzwrapperProtocol _tmp7_;
	moserialSerialConnection* _tmp8_;
	const gchar* _tmp9_;
	moserialSzwrapper* _tmp10_;
	moserialSzwrapper* _tmp11_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (dialog != NULL);
	_tmp0_ = dialog->filename;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (filename);
	filename = _tmp1_;
	_tmp2_ = self->priv->currentPaths;
	_tmp3_ = filename;
	_tmp4_ = mo_utils_getParentFolder (_tmp3_);
	_tmp5_ = _tmp4_;
	default_paths_set_sendFrom (_tmp2_, _tmp5_);
	_g_free0 (_tmp5_);
	_tmp6_ = dialog->protocolCombo;
	switch (gtk_combo_box_get_active (_tmp6_)) {
		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;
		}
	}
	_tmp7_ = protocol;
	_tmp8_ = self->priv->serialConnection;
	_tmp9_ = filename;
	_tmp10_ = moserial_szwrapper_new (&_tmp7_, _tmp8_, _tmp9_);
	_g_object_unref0 (self->priv->sz);
	self->priv->sz = _tmp10_;
	_tmp11_ = self->priv->sz;
	if (_tmp11_->running) {
		moserialSendProgressDialog* _tmp12_;
		moserialSzwrapper* _tmp13_;
		moserialSendProgressDialog* _tmp14_;
		moserialSendProgressDialog* _tmp15_;
		moserialSzwrapper* _tmp16_;
		moserialSzwrapper* _tmp17_;
		_tmp12_ = self->priv->sendProgressDialog;
		moserial_send_progress_dialog_show (_tmp12_);
		_tmp13_ = self->priv->sz;
		_tmp14_ = self->priv->sendProgressDialog;
		g_signal_connect_object (_tmp13_, "update-status", (GCallback) _moserial_send_progress_dialog_updateStatus_moserial_szwrapper_update_status, _tmp14_, 0);
		_tmp15_ = self->priv->sendProgressDialog;
		_tmp16_ = self->priv->sz;
		g_signal_connect_object (_tmp15_, "transfer-canceled", (GCallback) _moserial_szwrapper_transferCanceled_moserial_send_progress_dialog_transfer_canceled, _tmp16_, 0);
		_tmp17_ = self->priv->sz;
		g_signal_connect_object (_tmp17_, "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)
{
	moserialReceiveChooserDialog* _tmp0_;
	DefaultPaths* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	if (!moserial_main_window_ensureConnected (self)) {
		return;
	}
	_tmp0_ = self->priv->receiveChooserDialog;
	_tmp1_ = self->priv->currentPaths;
	_tmp2_ = default_paths_get_receiveTo (_tmp1_);
	_tmp3_ = _tmp2_;
	moserial_receive_chooser_dialog_show (_tmp0_, _tmp3_);
}

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_;
	const gchar* _tmp2_;
	GtkComboBox* _tmp3_;
	moserialRzwrapperProtocol protocol = 0;
	GtkComboBox* _tmp8_;
	moserialRzwrapperProtocol _tmp9_;
	moserialSerialConnection* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	moserialRzwrapper* _tmp13_;
	moserialRzwrapper* _tmp14_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (dialog != NULL);
	_tmp0_ = g_strdup ("");
	filename = _tmp0_;
	_tmp1_ = self->priv->currentPaths;
	_tmp2_ = dialog->path;
	default_paths_set_receiveTo (_tmp1_, _tmp2_);
	_tmp3_ = dialog->protocolCombo;
	if (gtk_combo_box_get_active (_tmp3_) == 0) {
		moserialXmodemFilenameDialog* _tmp4_;
		moserialXmodemFilenameDialog* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp4_ = self->priv->xmodemFilenameDialog;
		moserial_xmodem_filename_dialog_show (_tmp4_);
		_tmp5_ = self->priv->xmodemFilenameDialog;
		_tmp6_ = _tmp5_->filename;
		_tmp7_ = g_strdup (_tmp6_);
		_g_free0 (filename);
		filename = _tmp7_;
	}
	_tmp8_ = dialog->protocolCombo;
	switch (gtk_combo_box_get_active (_tmp8_)) {
		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;
		}
	}
	_tmp9_ = protocol;
	_tmp10_ = self->priv->serialConnection;
	_tmp11_ = dialog->path;
	_tmp12_ = filename;
	_tmp13_ = moserial_rzwrapper_new (&_tmp9_, _tmp10_, _tmp11_, _tmp12_);
	_g_object_unref0 (self->priv->rz);
	self->priv->rz = _tmp13_;
	_tmp14_ = self->priv->rz;
	if (_tmp14_->running) {
		moserialReceiveProgressDialog* _tmp15_;
		moserialRzwrapper* _tmp16_;
		moserialReceiveProgressDialog* _tmp17_;
		moserialReceiveProgressDialog* _tmp18_;
		moserialRzwrapper* _tmp19_;
		moserialRzwrapper* _tmp20_;
		_tmp15_ = self->priv->receiveProgressDialog;
		moserial_receive_progress_dialog_show (_tmp15_);
		_tmp16_ = self->priv->rz;
		_tmp17_ = self->priv->receiveProgressDialog;
		g_signal_connect_object (_tmp16_, "update-status", (GCallback) _moserial_receive_progress_dialog_updateStatus_moserial_rzwrapper_update_status, _tmp17_, 0);
		_tmp18_ = self->priv->receiveProgressDialog;
		_tmp19_ = self->priv->rz;
		g_signal_connect_object (_tmp18_, "transfer-canceled", (GCallback) _moserial_rzwrapper_transferCanceled_moserial_receive_progress_dialog_transfer_canceled, _tmp19_, 0);
		_tmp20_ = self->priv->rz;
		g_signal_connect_object (_tmp20_, "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)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	if (gtk_toggle_tool_button_get_active (button)) {
		GtkLabel* _tmp0_;
		Preferences* _tmp1_;
		gboolean _tmp2_;
		gboolean _tmp3_;
		if (!moserial_main_window_ensureConnected (self)) {
			gtk_toggle_tool_button_set_active (button, FALSE);
			return;
		}
		_tmp0_ = self->priv->stopRecordingLabel;
		gtk_tool_button_set_label_widget ((GtkToolButton*) button, (GtkWidget*) _tmp0_);
		_tmp1_ = self->priv->currentPreferences;
		_tmp2_ = preferences_get_recordAutoName (_tmp1_);
		_tmp3_ = _tmp2_;
		if (_tmp3_) {
			GDateTime* now = NULL;
			GDateTime* _tmp4_;
			gint year = 0;
			GDateTime* _tmp5_;
			gint month = 0;
			GDateTime* _tmp6_;
			gint day = 0;
			GDateTime* _tmp7_;
			gint hour = 0;
			GDateTime* _tmp8_;
			gint minute = 0;
			GDateTime* _tmp9_;
			gint second = 0;
			GDateTime* _tmp10_;
			gchar* folder = NULL;
			Preferences* _tmp11_;
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			gchar* _tmp14_;
			gchar* pExtension = NULL;
			Preferences* _tmp15_;
			const gchar* _tmp16_;
			const gchar* _tmp17_;
			gchar* _tmp18_;
			gchar* extension = NULL;
			gchar* _tmp19_;
			const gchar* _tmp20_;
			gchar* filename = NULL;
			const gchar* _tmp23_;
			const gchar* _tmp24_;
			gchar* _tmp25_;
			moserialSerialStreamRecorderDirection direction = 0;
			Preferences* _tmp26_;
			gint _tmp27_;
			gint _tmp28_;
			const gchar* _tmp29_;
			moserialSerialStreamRecorderDirection _tmp30_;
			_tmp4_ = g_date_time_new_now_local ();
			now = _tmp4_;
			_tmp5_ = now;
			year = g_date_time_get_year (_tmp5_);
			_tmp6_ = now;
			month = g_date_time_get_month (_tmp6_);
			_tmp7_ = now;
			day = g_date_time_get_day_of_month (_tmp7_);
			_tmp8_ = now;
			hour = g_date_time_get_hour (_tmp8_);
			_tmp9_ = now;
			minute = g_date_time_get_minute (_tmp9_);
			_tmp10_ = now;
			second = g_date_time_get_second (_tmp10_);
			_tmp11_ = self->priv->currentPreferences;
			_tmp12_ = preferences_get_recordAutoFolder (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp14_ = g_strdup (_tmp13_);
			folder = _tmp14_;
			_tmp15_ = self->priv->currentPreferences;
			_tmp16_ = preferences_get_recordAutoExtension (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp18_ = g_strdup (_tmp17_);
			pExtension = _tmp18_;
			_tmp19_ = g_strdup ("");
			extension = _tmp19_;
			_tmp20_ = pExtension;
			if (g_strcmp0 (_tmp20_, "") != 0) {
				const gchar* _tmp21_;
				gchar* _tmp22_;
				_tmp21_ = pExtension;
				_tmp22_ = g_strdup_printf (".%s", _tmp21_);
				_g_free0 (extension);
				extension = _tmp22_;
			}
			_tmp23_ = folder;
			_tmp24_ = extension;
			_tmp25_ = g_strdup_printf ("%s/moserial_%04d-%02d-%02d_%02d-%02d-%02d%s", _tmp23_, year, month, day, hour, minute, second, _tmp24_);
			filename = _tmp25_;
			_tmp26_ = self->priv->currentPreferences;
			_tmp27_ = preferences_get_recordAutoDirection (_tmp26_);
			_tmp28_ = _tmp27_;
			switch (_tmp28_) {
				default:
				case 0:
				{
					direction = MOSERIAL_SERIAL_STREAM_RECORDER_DIRECTION_INCOMING;
					break;
				}
				case 1:
				{
					direction = MOSERIAL_SERIAL_STREAM_RECORDER_DIRECTION_OUTGOING;
					break;
				}
				case 2:
				{
					direction = MOSERIAL_SERIAL_STREAM_RECORDER_DIRECTION_BOTH;
					break;
				}
			}
			_tmp29_ = filename;
			_tmp30_ = direction;
			moserial_main_window_startRecording (self, _tmp29_, _tmp30_);
			_g_free0 (filename);
			_g_free0 (extension);
			_g_free0 (pExtension);
			_g_free0 (folder);
			_g_date_time_unref0 (now);
		} else {
			moserialRecordDialog* _tmp31_;
			DefaultPaths* _tmp32_;
			const gchar* _tmp33_;
			const gchar* _tmp34_;
			_tmp31_ = self->priv->recordDialog;
			_tmp32_ = self->priv->currentPaths;
			_tmp33_ = default_paths_get_recordTo (_tmp32_);
			_tmp34_ = _tmp33_;
			moserial_record_dialog_show (_tmp31_, _tmp34_);
		}
	} else {
		moserialSerialStreamRecorder* _tmp35_;
		Preferences* _tmp36_;
		gboolean _tmp37_;
		gboolean _tmp38_;
		GtkLabel* _tmp39_;
		_tmp35_ = self->priv->streamRecorder;
		_tmp36_ = self->priv->currentPreferences;
		_tmp37_ = preferences_get_recordLaunch (_tmp36_);
		_tmp38_ = _tmp37_;
		moserial_serial_stream_recorder_close (_tmp35_, _tmp38_);
		_tmp39_ = self->priv->recordLabel;
		gtk_tool_button_set_label_widget ((GtkToolButton*) button, (GtkWidget*) _tmp39_);
		moserial_main_window_setWindowTitle (self, NULL);
		if (self->priv->recordTimeoutID > ((guint) 0)) {
			g_source_remove (self->priv->recordTimeoutID);
			self->priv->recordTimeoutID = (guint) 0;
		}
	}
}

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

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

gboolean
moserial_main_window_recordTimeout (moserialMainWindow* self)
{
	GtkToggleToolButton* _tmp0_;
	gboolean result = FALSE;
	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_;
	GtkStatusbar* _tmp1_;
	GtkStatusbar* _tmp2_;
	Settings* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (d != NULL);
	g_return_if_fail (newSettings != NULL);
	_tmp0_ = _g_object_ref0 (newSettings);
	_g_object_unref0 (self->priv->currentSettings);
	self->priv->currentSettings = _tmp0_;
	_tmp1_ = self->priv->statusbar;
	gtk_statusbar_pop (_tmp1_, self->priv->statusbarContext);
	_tmp2_ = self->priv->statusbar;
	_tmp3_ = self->priv->currentSettings;
	_tmp4_ = settings_getStatusbarString (_tmp3_, FALSE);
	_tmp5_ = _tmp4_;
	gtk_statusbar_push (_tmp2_, self->priv->statusbarContext, _tmp5_);
	_g_free0 (_tmp5_);
	moserial_main_window_updateOutgoingInputArea (self);
}

static void
moserial_main_window_updateOutgoingInputArea (moserialMainWindow* self)
{
	Settings* _tmp0_;
	SettingsAccessMode _tmp1_;
	SettingsAccessMode _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->currentSettings;
	_tmp1_ = settings_get_accessMode (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == SETTINGS_ACCESS_MODE_READONLY) {
		GtkEntry* _tmp3_;
		GtkButton* _tmp4_;
		_tmp3_ = self->priv->entry;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, FALSE);
		_tmp4_ = self->priv->sendButton;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp4_, FALSE);
	} else {
		GtkEntry* _tmp5_;
		GtkButton* _tmp6_;
		_tmp5_ = self->priv->entry;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp5_, TRUE);
		_tmp6_ = self->priv->sendButton;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp6_, 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_;
	gchar* font = NULL;
	Preferences* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	PangoFontDescription* fd = NULL;
	const gchar* _tmp9_;
	PangoFontDescription* _tmp10_;
	gchar* unit = NULL;
	gchar* _tmp11_;
	const gchar* _tmp12_;
	gchar* family = NULL;
	PangoFontDescription* _tmp14_;
	const gchar* _tmp15_;
	gchar** _tmp16_;
	gchar** _tmp17_;
	gchar** _tmp18_;
	gint _tmp18__length1;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gint size = 0;
	PangoFontDescription* _tmp22_;
	gint weight = 0;
	PangoFontDescription* _tmp23_;
	gchar* style = NULL;
	Preferences* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	Preferences* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	Preferences* _tmp30_;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	Preferences* _tmp33_;
	const gchar* _tmp34_;
	const gchar* _tmp35_;
	const gchar* _tmp36_;
	gchar* _tmp37_;
	GtkCssProvider* css_provider = NULL;
	GtkCssProvider* _tmp38_;
	GdkScreen* _tmp41_;
	GtkTextTag* _tmp42_;
	Preferences* _tmp43_;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	moserialHexTextBuffer* _tmp46_;
	Preferences* _tmp47_;
	moserialHexTextBuffer* _tmp48_;
	Preferences* _tmp49_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (newPreferences != NULL);
	_tmp0_ = _g_object_ref0 (newPreferences);
	_g_object_unref0 (self->priv->currentPreferences);
	self->priv->currentPreferences = _tmp0_;
	_tmp1_ = self->priv->currentPreferences;
	_tmp2_ = preferences_get_useSystemMonospaceFont (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		gchar* _tmp4_;
		_tmp4_ = preferences_getSystemDefaultMonospaceFont ();
		_g_free0 (font);
		font = _tmp4_;
	} else {
		Preferences* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp5_ = self->priv->currentPreferences;
		_tmp6_ = preferences_get_font (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = g_strdup (_tmp7_);
		_g_free0 (font);
		font = _tmp8_;
	}
	_tmp9_ = font;
	_tmp10_ = pango_font_description_from_string (_tmp9_);
	fd = _tmp10_;
	_tmp11_ = g_strdup ("px");
	unit = _tmp11_;
	_tmp12_ = gtk_check_version ((guint) 3, (guint) 22, (guint) 0);
	if (_tmp12_ == NULL) {
		gchar* _tmp13_;
		_tmp13_ = g_strdup ("pt");
		_g_free0 (unit);
		unit = _tmp13_;
	}
	_tmp14_ = fd;
	_tmp15_ = pango_font_description_get_family (_tmp14_);
	_tmp17_ = _tmp16_ = g_strsplit (_tmp15_, ",", 0);
	_tmp18_ = _tmp17_;
	_tmp18__length1 = _vala_array_length (_tmp16_);
	_tmp19_ = _tmp18_[0];
	_tmp20_ = g_strdup (_tmp19_);
	_tmp21_ = _tmp20_;
	_tmp18_ = (_vala_array_free (_tmp18_, _tmp18__length1, (GDestroyNotify) g_free), NULL);
	family = _tmp21_;
	_tmp22_ = fd;
	size = (gint) round ((gdouble) (pango_font_description_get_size (_tmp22_) / PANGO_SCALE));
	_tmp23_ = fd;
	weight = (gint) pango_font_description_get_weight (_tmp23_);
	_tmp24_ = self->priv->currentPreferences;
	_tmp25_ = preferences_get_fontColor (_tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = self->priv->currentPreferences;
	_tmp28_ = preferences_get_backgroundColor (_tmp27_);
	_tmp29_ = _tmp28_;
	_tmp30_ = self->priv->currentPreferences;
	_tmp31_ = preferences_get_fontColor (_tmp30_);
	_tmp32_ = _tmp31_;
	_tmp33_ = self->priv->currentPreferences;
	_tmp34_ = preferences_get_backgroundColor (_tmp33_);
	_tmp35_ = _tmp34_;
	_tmp36_ = unit;
	_tmp37_ = g_strdup_printf ("\n" \
"                    .TextviewColor text {\n" \
"                        color:\n" \
"                        %s;\n" \
"                        background-color:\n" \
"                        %s;\n" \
"                    }\n" \
"        .TextInputColor {\n" \
"color:\n" \
"            %s;\n" \
"background-color:\n" \
"            %s;\n" \
"        }\n" \
"        .TextFont {\n" \
"font-family:\n" \
"            %s;\n" \
"font-size:\n" \
"            %d%s;\n" \
"font-weight:\n" \
"            %d;\n" \
"        }\n" \
"        ", _tmp26_, _tmp29_, _tmp32_, _tmp35_, family, size, _tmp36_, weight);
	style = _tmp37_;
	_tmp38_ = gtk_css_provider_new ();
	css_provider = _tmp38_;
	{
		gtk_css_provider_load_from_data (css_provider, style, (gssize) -1, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp39_;
		const gchar* _tmp40_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp39_ = e;
		_tmp40_ = _tmp39_->message;
		g_warning ("MainWindow.vala:836: Failed to parse CSS style : %s", _tmp40_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (css_provider);
		_g_free0 (style);
		_g_free0 (family);
		_g_free0 (unit);
		__vala_PangoFontDescription_free0 (fd);
		_g_free0 (font);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_tmp41_ = gdk_screen_get_default ();
	gtk_style_context_add_provider_for_screen (_tmp41_, (GtkStyleProvider*) css_provider, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
	_tmp42_ = self->priv->echoTag;
	_tmp43_ = self->priv->currentPreferences;
	_tmp44_ = preferences_get_highlightColor (_tmp43_);
	_tmp45_ = _tmp44_;
	g_object_set (_tmp42_, "foreground", _tmp45_, NULL);
	_tmp46_ = self->priv->incomingHexTextBuffer;
	_tmp47_ = self->priv->currentPreferences;
	moserial_hex_text_buffer_applyPreferences (_tmp46_, _tmp47_);
	_tmp48_ = self->priv->outgoingHexTextBuffer;
	_tmp49_ = self->priv->currentPreferences;
	moserial_hex_text_buffer_applyPreferences (_tmp48_, _tmp49_);
	_g_object_unref0 (css_provider);
	_g_free0 (style);
	_g_free0 (family);
	_g_free0 (unit);
	__vala_PangoFontDescription_free0 (fd);
	_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_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (o != NULL);
	_tmp0_ = self->priv->preferencesDialog;
	_tmp1_ = self->priv->currentPreferences;
	_tmp2_ = self->priv->recordButton;
	moserial_preferences_dialog_show (_tmp0_, _tmp1_, gtk_toggle_tool_button_get_active (_tmp2_));
}

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

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

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

static void
_moserial_main_window_connectionError_moserial_serial_connection_on_error (moserialSerialConnection* _sender,
                                                                           gpointer self)
{
	moserial_main_window_connectionError ((moserialMainWindow*) self);
}

static gboolean
moserial_main_window_startConnection (moserialMainWindow* self)
{
	moserialSerialConnection* _tmp0_;
	Settings* _tmp1_;
	moserialHexTextBuffer* _tmp10_;
	GtkTextBuffer* _tmp11_;
	moserialHexTextBuffer* _tmp12_;
	GtkTextBuffer* _tmp13_;
	gboolean* state = NULL;
	moserialSerialConnection* _tmp14_;
	gint _tmp15_ = 0;
	gboolean* _tmp16_;
	gint state_length1;
	gint _state_size_;
	GtkToggleButton* _tmp17_;
	gboolean* _tmp18_;
	gint _tmp18__length1;
	gboolean _tmp19_;
	GtkToggleButton* _tmp20_;
	gboolean* _tmp21_;
	gint _tmp21__length1;
	gboolean _tmp22_;
	GtkToolButton* _tmp23_;
	GtkStatusbar* _tmp24_;
	GtkStatusbar* _tmp25_;
	Settings* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	moserialSerialConnection* _tmp29_;
	moserialSerialConnection* _tmp30_;
	GtkToggleToolButton* _tmp31_;
	GtkLabel* _tmp32_;
	GtkToggleToolButton* _tmp33_;
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->serialConnection;
	_tmp1_ = self->priv->currentSettings;
	if (!moserial_serial_connection_doConnect (_tmp0_, _tmp1_)) {
		GtkToggleToolButton* _tmp2_;
		GtkMessageDialog* dialog = NULL;
		GtkWindow* _tmp3_;
		Settings* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		GtkMessageDialog* _tmp7_;
		GtkMessageDialog* _tmp8_;
		GtkMessageDialog* _tmp9_;
		_tmp2_ = self->priv->connectButton;
		gtk_toggle_tool_button_set_active (_tmp2_, FALSE);
		_tmp3_ = self->priv->gtkWindow;
		_tmp4_ = self->priv->currentSettings;
		_tmp5_ = settings_get_device (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = (GtkMessageDialog*) gtk_message_dialog_new (_tmp3_, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s: %s", _ ("Error: Could not open device"), _tmp6_);
		g_object_ref_sink (_tmp7_);
		dialog = _tmp7_;
		_tmp8_ = dialog;
		gtk_dialog_run ((GtkDialog*) _tmp8_);
		_tmp9_ = dialog;
		gtk_widget_destroy ((GtkWidget*) _tmp9_);
		result = FALSE;
		_g_object_unref0 (dialog);
		return result;
	}
	_tmp10_ = self->priv->incomingHexTextBuffer;
	moserial_hex_text_buffer_clear (_tmp10_);
	_tmp11_ = self->priv->incomingAsciiTextBuffer;
	gtk_text_buffer_set_text (_tmp11_, "", 0);
	_tmp12_ = self->priv->outgoingHexTextBuffer;
	moserial_hex_text_buffer_clear (_tmp12_);
	_tmp13_ = self->priv->outgoingAsciiTextBuffer;
	gtk_text_buffer_set_text (_tmp13_, "", 0);
	_tmp14_ = self->priv->serialConnection;
	_tmp16_ = moserial_serial_connection_getStatus (_tmp14_, &_tmp15_);
	state = _tmp16_;
	state_length1 = _tmp15_;
	_state_size_ = state_length1;
	_tmp17_ = self->priv->rtsButton;
	_tmp18_ = state;
	_tmp18__length1 = state_length1;
	_tmp19_ = _tmp18_[4];
	gtk_toggle_button_set_active (_tmp17_, _tmp19_);
	_tmp20_ = self->priv->dtrButton;
	_tmp21_ = state;
	_tmp21__length1 = state_length1;
	_tmp22_ = _tmp21_[5];
	gtk_toggle_button_set_active (_tmp20_, _tmp22_);
	_tmp23_ = self->priv->settingsButton;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp23_, FALSE);
	_tmp24_ = self->priv->statusbar;
	gtk_statusbar_pop (_tmp24_, self->priv->statusbarContext);
	_tmp25_ = self->priv->statusbar;
	_tmp26_ = self->priv->currentSettings;
	_tmp27_ = settings_getStatusbarString (_tmp26_, TRUE);
	_tmp28_ = _tmp27_;
	gtk_statusbar_push (_tmp25_, self->priv->statusbarContext, _tmp28_);
	_g_free0 (_tmp28_);
	_tmp29_ = self->priv->serialConnection;
	g_signal_connect_object (_tmp29_, "new-data", (GCallback) _moserial_main_window_updateIncoming_moserial_serial_connection_new_data, self, 0);
	_tmp30_ = self->priv->serialConnection;
	g_signal_connect_object (_tmp30_, "on-error", (GCallback) _moserial_main_window_connectionError_moserial_serial_connection_on_error, self, 0);
	_tmp31_ = self->priv->connectButton;
	_tmp32_ = self->priv->disconnectLabel;
	gtk_tool_button_set_label_widget ((GtkToolButton*) _tmp31_, (GtkWidget*) _tmp32_);
	_tmp33_ = self->priv->connectButton;
	gtk_tool_button_set_icon_name ((GtkToolButton*) _tmp33_, "network-transmit-receive");
	result = TRUE;
	state = (g_free (state), NULL);
	return result;
}

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

static gboolean
moserial_main_window_showSerialStatus (moserialMainWindow* self)
{
	moserialSerialConnection* _tmp0_;
	gboolean* state = NULL;
	moserialSerialConnection* _tmp1_;
	gint _tmp2_ = 0;
	gboolean* _tmp3_;
	gint state_length1;
	gint _state_size_;
	GtkLabel* _tmp4_;
	gboolean* _tmp5_;
	gint _tmp5__length1;
	gboolean _tmp6_;
	GtkLabel* _tmp7_;
	gboolean* _tmp8_;
	gint _tmp8__length1;
	gboolean _tmp9_;
	GtkLabel* _tmp10_;
	gboolean* _tmp11_;
	gint _tmp11__length1;
	gboolean _tmp12_;
	GtkLabel* _tmp13_;
	gboolean* _tmp14_;
	gint _tmp14__length1;
	gboolean _tmp15_;
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->serialConnection;
	if (!moserial_serial_connection_isConnected (_tmp0_)) {
		result = TRUE;
		return result;
	}
	_tmp1_ = self->priv->serialConnection;
	_tmp3_ = moserial_serial_connection_getStatus (_tmp1_, &_tmp2_);
	state = _tmp3_;
	state_length1 = _tmp2_;
	_state_size_ = state_length1;
	_tmp4_ = self->priv->serialStatusSignals[0];
	_tmp5_ = state;
	_tmp5__length1 = state_length1;
	_tmp6_ = _tmp5_[0];
	gtk_widget_set_sensitive ((GtkWidget*) _tmp4_, _tmp6_);
	_tmp7_ = self->priv->serialStatusSignals[1];
	_tmp8_ = state;
	_tmp8__length1 = state_length1;
	_tmp9_ = _tmp8_[1];
	gtk_widget_set_sensitive ((GtkWidget*) _tmp7_, _tmp9_);
	_tmp10_ = self->priv->serialStatusSignals[2];
	_tmp11_ = state;
	_tmp11__length1 = state_length1;
	_tmp12_ = _tmp11_[2];
	gtk_widget_set_sensitive ((GtkWidget*) _tmp10_, _tmp12_);
	_tmp13_ = self->priv->serialStatusSignals[3];
	_tmp14_ = state;
	_tmp14__length1 = state_length1;
	_tmp15_ = _tmp14_[3];
	gtk_widget_set_sensitive ((GtkWidget*) _tmp13_, _tmp15_);
	result = TRUE;
	state = (g_free (state), NULL);
	return result;
}

static void
moserial_main_window_connectionError (moserialMainWindow* self)
{
	GtkToolButton* _tmp0_;
	moserialSerialConnection* _tmp1_;
	moserialSerialConnection* _tmp2_;
	guint _tmp3_;
	moserialSerialConnection* _tmp4_;
	guint _tmp5_;
	GtkStatusbar* _tmp6_;
	GtkStatusbar* _tmp7_;
	moserialSerialConnection* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GtkStatusbar* _tmp11_;
	GtkStatusbar* _tmp12_;
	Settings* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	GtkToggleToolButton* _tmp16_;
	GtkLabel* _tmp17_;
	GtkToggleToolButton* _tmp18_;
	GtkToggleToolButton* _tmp19_;
	GtkToggleToolButton* _tmp20_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->settingsButton;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, TRUE);
	_tmp1_ = self->priv->serialConnection;
	moserial_serial_connection_doDisconnect (_tmp1_);
	_tmp2_ = self->priv->serialConnection;
	g_signal_parse_name ("new-data", MOSERIAL_TYPE_SERIAL_CONNECTION, &_tmp3_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _moserial_main_window_updateIncoming_moserial_serial_connection_new_data, self);
	_tmp4_ = self->priv->serialConnection;
	g_signal_parse_name ("on-error", 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_connectionError_moserial_serial_connection_on_error, self);
	_tmp6_ = self->priv->bytecountbar;
	gtk_statusbar_pop (_tmp6_, self->priv->bytecountbarContext);
	_tmp7_ = self->priv->bytecountbar;
	_tmp8_ = self->priv->serialConnection;
	_tmp9_ = moserial_serial_connection_getBytecountbarString (_tmp8_);
	_tmp10_ = _tmp9_;
	gtk_statusbar_push (_tmp7_, self->priv->bytecountbarContext, _tmp10_);
	_g_free0 (_tmp10_);
	_tmp11_ = self->priv->statusbar;
	gtk_statusbar_pop (_tmp11_, self->priv->statusbarContext);
	_tmp12_ = self->priv->statusbar;
	_tmp13_ = self->priv->currentSettings;
	_tmp14_ = settings_getStatusbarString (_tmp13_, FALSE);
	_tmp15_ = _tmp14_;
	gtk_statusbar_push (_tmp12_, self->priv->statusbarContext, _tmp15_);
	_g_free0 (_tmp15_);
	_tmp16_ = self->priv->connectButton;
	_tmp17_ = self->priv->connectLabel;
	gtk_tool_button_set_label_widget ((GtkToolButton*) _tmp16_, (GtkWidget*) _tmp17_);
	_tmp18_ = self->priv->connectButton;
	gtk_tool_button_set_icon_name ((GtkToolButton*) _tmp18_, "network-offline");
	_tmp19_ = self->priv->connectButton;
	gtk_toggle_tool_button_set_active (_tmp19_, FALSE);
	_tmp20_ = self->priv->recordButton;
	if (gtk_toggle_tool_button_get_active (_tmp20_)) {
		GtkToggleToolButton* _tmp21_;
		_tmp21_ = self->priv->recordButton;
		gtk_toggle_tool_button_set_active (_tmp21_, 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,
                                     gint data_length1,
                                     gint size)
{
	moserialRzwrapper* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sc != NULL);
	_tmp0_ = self->priv->rz;
	if (_tmp0_->running) {
		moserialRzwrapper* _tmp5_;
		{
			gint x = 0;
			x = 0;
			{
				gboolean _tmp1_ = FALSE;
				_tmp1_ = TRUE;
				while (TRUE) {
					moserialRzwrapper* _tmp3_;
					guchar _tmp4_;
					if (!_tmp1_) {
						gint _tmp2_;
						_tmp2_ = x;
						x = _tmp2_ + 1;
					}
					_tmp1_ = FALSE;
					if (!(x < size)) {
						break;
					}
					_tmp3_ = self->priv->rz;
					_tmp4_ = data[x];
					moserial_rzwrapper_writeChar (_tmp3_, _tmp4_);
				}
			}
		}
		_tmp5_ = self->priv->rz;
		moserial_rzwrapper_flush (_tmp5_);
	} else {
		moserialSzwrapper* _tmp6_;
		_tmp6_ = self->priv->sz;
		if (_tmp6_->running) {
			{
				gint x = 0;
				x = 0;
				{
					gboolean _tmp7_ = FALSE;
					_tmp7_ = TRUE;
					while (TRUE) {
						moserialSzwrapper* _tmp9_;
						guchar _tmp10_;
						if (!_tmp7_) {
							gint _tmp8_;
							_tmp8_ = x;
							x = _tmp8_ + 1;
						}
						_tmp7_ = FALSE;
						if (!(x < size)) {
							break;
						}
						_tmp9_ = self->priv->sz;
						_tmp10_ = data[x];
						moserial_szwrapper_writeChar (_tmp9_, _tmp10_);
					}
				}
			}
		} else {
			moserialSerialStreamRecorder* _tmp79_;
			{
				gint x = 0;
				x = 0;
				{
					gboolean _tmp11_ = FALSE;
					_tmp11_ = TRUE;
					while (TRUE) {
						moserialHexTextBuffer* _tmp13_;
						guchar _tmp14_;
						gunichar c = 0U;
						guchar _tmp15_;
						gchar* _tmp16_;
						gchar* _tmp17_;
						gunichar _tmp18_;
						gchar* s = NULL;
						guchar _tmp19_;
						gchar* _tmp20_;
						const gchar* _tmp21_;
						gint _tmp22_;
						gint _tmp23_;
						const gchar* _tmp24_;
						gint _tmp25_;
						gint _tmp26_;
						gboolean _tmp30_ = FALSE;
						const gchar* _tmp31_;
						gboolean _tmp37_ = FALSE;
						const gchar* _tmp38_;
						gint _tmp39_;
						gint _tmp40_;
						gboolean _tmp59_ = FALSE;
						gboolean _tmp60_ = FALSE;
						gboolean _tmp61_ = FALSE;
						gboolean _tmp64_ = FALSE;
						Preferences* _tmp65_;
						gboolean _tmp66_;
						gboolean _tmp67_;
						GtkStatusbar* _tmp75_;
						GtkStatusbar* _tmp76_;
						gchar* _tmp77_;
						gchar* _tmp78_;
						if (!_tmp11_) {
							gint _tmp12_;
							_tmp12_ = x;
							x = _tmp12_ + 1;
						}
						_tmp11_ = FALSE;
						if (!(x < size)) {
							break;
						}
						_tmp13_ = self->priv->incomingHexTextBuffer;
						_tmp14_ = data[x];
						moserial_hex_text_buffer_add (_tmp13_, _tmp14_);
						_tmp15_ = data[x];
						_tmp16_ = g_strdup_printf ("%c", (gint) _tmp15_);
						_tmp17_ = _tmp16_;
						_tmp18_ = string_get_char (_tmp17_, (glong) 0);
						_g_free0 (_tmp17_);
						c = _tmp18_;
						_tmp19_ = data[x];
						_tmp20_ = g_strdup_printf ("%c", (gint) _tmp19_);
						s = _tmp20_;
						_tmp21_ = sc->echoCompare;
						_tmp22_ = strlen (_tmp21_);
						_tmp23_ = _tmp22_;
						_tmp24_ = sc->echoReference;
						_tmp25_ = strlen (_tmp24_);
						_tmp26_ = _tmp25_;
						if (_tmp23_ < _tmp26_) {
							const gchar* _tmp27_;
							const gchar* _tmp28_;
							gchar* _tmp29_;
							_tmp27_ = sc->echoCompare;
							_tmp28_ = s;
							_tmp29_ = g_strconcat (_tmp27_, _tmp28_, NULL);
							_g_free0 (sc->echoCompare);
							sc->echoCompare = _tmp29_;
						}
						_tmp31_ = s;
						if (g_utf8_validate (_tmp31_, (gssize) -1, NULL)) {
							gboolean _tmp32_ = FALSE;
							if (g_unichar_isprint (c)) {
								_tmp32_ = TRUE;
							} else {
								_tmp32_ = g_unichar_isspace (c);
							}
							_tmp30_ = _tmp32_;
						} else {
							_tmp30_ = FALSE;
						}
						if (_tmp30_) {
							gboolean _tmp33_ = FALSE;
							if (sc->lastRxCharWasCR) {
								_tmp33_ = c == ((gunichar) '\n');
							} else {
								_tmp33_ = FALSE;
							}
							if (!_tmp33_) {
								GtkTextBuffer* _tmp34_;
								const gchar* _tmp35_;
								_tmp34_ = self->priv->incomingAsciiTextBuffer;
								_tmp35_ = s;
								moserial_main_window_insertBufferEnd (self, _tmp34_, _tmp35_);
							}
						} else {
							gulong _tmp36_;
							sc->nonprintable = sc->nonprintable + 1;
							_tmp36_ = sc->nonprintable;
						}
						sc->lastRxCharWasCR = c == ((gunichar) '\r');
						_tmp38_ = sc->echoCompare;
						_tmp39_ = strlen (_tmp38_);
						_tmp40_ = _tmp39_;
						if (_tmp40_ > 0) {
							const gchar* _tmp41_;
							gint _tmp42_;
							gint _tmp43_;
							const gchar* _tmp44_;
							gint _tmp45_;
							gint _tmp46_;
							_tmp41_ = sc->echoCompare;
							_tmp42_ = strlen (_tmp41_);
							_tmp43_ = _tmp42_;
							_tmp44_ = sc->echoReference;
							_tmp45_ = strlen (_tmp44_);
							_tmp46_ = _tmp45_;
							_tmp37_ = _tmp43_ == _tmp46_;
						} else {
							_tmp37_ = FALSE;
						}
						if (_tmp37_) {
							const gchar* _tmp47_;
							const gchar* _tmp48_;
							gchar* _tmp57_;
							gchar* _tmp58_;
							_tmp47_ = sc->echoCompare;
							_tmp48_ = sc->echoReference;
							if (g_strcmp0 (_tmp47_, _tmp48_) == 0) {
								GtkTextIter echoStartIter = {0};
								GtkTextIter echoStopIter = {0};
								GtkTextBuffer* _tmp49_;
								GtkTextMark* _tmp50_;
								GtkTextIter _tmp51_ = {0};
								GtkTextBuffer* _tmp52_;
								GtkTextIter _tmp53_ = {0};
								GtkTextBuffer* _tmp54_;
								GtkTextIter _tmp55_;
								GtkTextIter _tmp56_;
								_tmp49_ = self->priv->incomingAsciiTextBuffer;
								_tmp50_ = self->priv->echoStartMark;
								gtk_text_buffer_get_iter_at_mark (_tmp49_, &_tmp51_, _tmp50_);
								echoStartIter = _tmp51_;
								_tmp52_ = self->priv->incomingAsciiTextBuffer;
								gtk_text_buffer_get_end_iter (_tmp52_, &_tmp53_);
								echoStopIter = _tmp53_;
								_tmp54_ = self->priv->incomingAsciiTextBuffer;
								_tmp55_ = echoStartIter;
								_tmp56_ = echoStopIter;
								gtk_text_buffer_apply_tag_by_name (_tmp54_, "echo", &_tmp55_, &_tmp56_);
							}
							_tmp57_ = g_strdup ("");
							_g_free0 (sc->echoCompare);
							sc->echoCompare = _tmp57_;
							_tmp58_ = g_strdup ("");
							_g_free0 (sc->echoReference);
							sc->echoReference = _tmp58_;
						}
						if (sc->rx > ((gulong) 32)) {
							_tmp61_ = sc->nonprintable > ((gulong) 0);
						} else {
							_tmp61_ = FALSE;
						}
						if (_tmp61_) {
							_tmp60_ = (sc->rx / sc->nonprintable) < ((gulong) 4);
						} else {
							_tmp60_ = FALSE;
						}
						if (_tmp60_) {
							_tmp59_ = !sc->forced_hex_view;
						} else {
							_tmp59_ = FALSE;
						}
						if (_tmp59_) {
							GtkNotebook* _tmp62_;
							Profile* _tmp63_;
							sc->forced_hex_view = TRUE;
							_tmp62_ = self->priv->incoming_notebook;
							gtk_notebook_set_current_page (_tmp62_, 1);
							_tmp63_ = self->priv->profile;
							profile_setInteger (_tmp63_, "main_ui_controls", "incoming_tab", 1);
						}
						_tmp65_ = self->priv->currentPreferences;
						_tmp66_ = preferences_get_enableTimeout (_tmp65_);
						_tmp67_ = _tmp66_;
						if (_tmp67_) {
							GtkToggleToolButton* _tmp68_;
							_tmp68_ = self->priv->recordButton;
							_tmp64_ = gtk_toggle_tool_button_get_active (_tmp68_);
						} else {
							_tmp64_ = FALSE;
						}
						if (_tmp64_) {
							Preferences* _tmp69_;
							gint _tmp70_;
							gint _tmp71_;
							if (self->priv->recordTimeoutID > ((guint) 0)) {
								g_source_remove (self->priv->recordTimeoutID);
							}
							_tmp69_ = self->priv->currentPreferences;
							_tmp70_ = preferences_get_timeout (_tmp69_);
							_tmp71_ = _tmp70_;
							if (_tmp71_ > 0) {
								Preferences* _tmp72_;
								gint _tmp73_;
								gint _tmp74_;
								_tmp72_ = self->priv->currentPreferences;
								_tmp73_ = preferences_get_timeout (_tmp72_);
								_tmp74_ = _tmp73_;
								self->priv->recordTimeoutID = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) _tmp74_, _moserial_main_window_recordTimeout_gsource_func, g_object_ref (self), g_object_unref);
							}
						}
						self->priv->recordDataReceived = TRUE;
						_tmp75_ = self->priv->bytecountbar;
						gtk_statusbar_pop (_tmp75_, self->priv->bytecountbarContext);
						_tmp76_ = self->priv->bytecountbar;
						_tmp77_ = moserial_serial_connection_getBytecountbarString (sc);
						_tmp78_ = _tmp77_;
						gtk_statusbar_push (_tmp76_, self->priv->bytecountbarContext, _tmp78_);
						_g_free0 (_tmp78_);
						_g_free0 (s);
					}
				}
			}
			_tmp79_ = self->priv->streamRecorder;
			moserial_serial_stream_recorder_writeIncoming (_tmp79_, data, (gint) data_length1);
		}
	}
}

static void
moserial_main_window_inputModeChanged (moserialMainWindow* self,
                                       GtkComboBox* inputModeCombo)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (inputModeCombo != NULL);
	if (gtk_combo_box_get_active (inputModeCombo) == ((gint) MOSERIAL_MAIN_WINDOW_INPUT_MODE_VALUES_HEX)) {
		GtkNotebook* _tmp0_;
		Profile* _tmp1_;
		Profile* _tmp2_;
		_tmp0_ = self->priv->outgoing_notebook;
		gtk_notebook_set_current_page (_tmp0_, 1);
		_tmp1_ = self->priv->profile;
		profile_setInteger (_tmp1_, "main_ui_controls", "outgoing_tab", 1);
		_tmp2_ = self->priv->profile;
		profile_setBoolean (_tmp2_, "main_ui_controls", "input_mode_hex", TRUE);
	} else {
		GtkNotebook* _tmp3_;
		Profile* _tmp4_;
		Profile* _tmp5_;
		_tmp3_ = self->priv->outgoing_notebook;
		gtk_notebook_set_current_page (_tmp3_, 0);
		_tmp4_ = self->priv->profile;
		profile_setInteger (_tmp4_, "main_ui_controls", "outgoing_tab", 0);
		_tmp5_ = self->priv->profile;
		profile_setBoolean (_tmp5_, "main_ui_controls", "input_mode_hex", FALSE);
	}
}

static void
moserial_main_window_lineEndChanged (moserialMainWindow* self,
                                     GtkComboBox* lineEndCombo)
{
	Profile* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (lineEndCombo != NULL);
	_tmp0_ = self->priv->profile;
	profile_setInteger (_tmp0_, "main_ui_controls", "input_line_end", gtk_combo_box_get_active (lineEndCombo));
}

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_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		gtk_show_uri_on_window (NULL, "help:moserial", (guint32) GDK_CURRENT_TIME, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = e;
		_tmp1_ = _tmp0_->message;
		g_warning (_ ("Unable to display help file: %s"), _tmp1_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

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-2021\nMichael J. Chudobiak\n<mjc@avtechpulse.com>", "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;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (widget != NULL, FALSE);
	g_return_val_if_fail (key != NULL, FALSE);
	if (key->keyval == gdk_keyval_from_name ("Escape")) {
		GtkAdjustment* _tmp0_;
		GtkAdjustment* _tmp1_;
		GtkAdjustment* _tmp2_;
		GtkAdjustment* _tmp3_;
		GtkEntry* _tmp4_;
		GtkEntry* _tmp5_;
		_tmp0_ = self->priv->va1;
		moserial_auto_scroll_scroll (_tmp0_);
		_tmp1_ = self->priv->va2;
		moserial_auto_scroll_scroll (_tmp1_);
		_tmp2_ = self->priv->va3;
		moserial_auto_scroll_scroll (_tmp2_);
		_tmp3_ = self->priv->va4;
		moserial_auto_scroll_scroll (_tmp3_);
		_tmp4_ = self->priv->entry;
		gtk_widget_grab_focus ((GtkWidget*) _tmp4_);
		_tmp5_ = self->priv->entry;
		gtk_editable_set_position ((GtkEditable*) _tmp5_, -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_;
	GtkWindow* _tmp1_;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	Profile* _tmp4_;
	Profile* _tmp5_;
	Profile* _tmp6_;
	g_return_if_fail (self != NULL);
	width = 0;
	height = 0;
	_tmp0_ = self->priv->paned;
	pos = gtk_paned_get_position (_tmp0_);
	_tmp1_ = self->priv->gtkWindow;
	gtk_window_get_size (_tmp1_, &_tmp2_, &_tmp3_);
	width = _tmp2_;
	height = _tmp3_;
	_tmp4_ = self->priv->profile;
	profile_setInteger (_tmp4_, "window", "width", width);
	_tmp5_ = self->priv->profile;
	profile_setInteger (_tmp5_, "window", "height", height);
	_tmp6_ = self->priv->profile;
	profile_setInteger (_tmp6_, "window", "paned_pos", 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) {
		Profile* _tmp7_;
		gboolean _tmp8_;
		gboolean _tmp9_;
		_tmp7_ = self->priv->profile;
		_tmp8_ = profile_get_profileChanged (_tmp7_);
		_tmp9_ = _tmp8_;
		if (_tmp9_) {
			GtkMessageDialog* dialog = NULL;
			GtkWindow* _tmp10_;
			GtkMessageDialog* _tmp11_;
			gint response = 0;
			GtkMessageDialog* _tmp12_;
			GtkMessageDialog* _tmp13_;
			_tmp10_ = self->priv->gtkWindow;
			_tmp11_ = (GtkMessageDialog*) gtk_message_dialog_new (_tmp10_, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", _ ("Save modified settings to the loaded profile?"));
			g_object_ref_sink (_tmp11_);
			dialog = _tmp11_;
			_tmp12_ = dialog;
			response = gtk_dialog_run ((GtkDialog*) _tmp12_);
			if (response == ((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_error0_ = 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_);
	_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_error0_);
		_tmp13_ = _tmp15_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->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_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		_tmp16_ = recentManager;
		_tmp17_ = self->priv->recentData;
		gtk_recent_manager_add_full (_tmp16_, _tmp13_, &_tmp17_);
		_g_free0 (_tmp13_);
	}
	goto __finally0;
	__catch0_g_convert_error:
	{
		GError* e = NULL;
		FILE* _tmp18_;
		GError* _tmp19_;
		const gchar* _tmp20_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp18_ = stdout;
		_tmp19_ = e;
		_tmp20_ = _tmp19_->message;
		fprintf (_tmp18_, "%s\n", _tmp20_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (recentManager);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_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_;
	GtkFileChooserDialog* _tmp8_;
	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-cancel", GTK_RESPONSE_CANCEL, "gtk-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;
	response = gtk_dialog_run ((GtkDialog*) _tmp5_);
	if (response == ((gint) GTK_RESPONSE_ACCEPT)) {
		GtkFileChooserDialog* _tmp6_;
		gchar* _tmp7_;
		_tmp6_ = dialog;
		_tmp7_ = gtk_file_chooser_get_filename ((GtkFileChooser*) _tmp6_);
		_g_free0 (self->priv->profileFilename);
		self->priv->profileFilename = _tmp7_;
	}
	_tmp8_ = dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp8_);
	if (response == ((gint) GTK_RESPONSE_ACCEPT)) {
		moserial_main_window_saveProfile (self);
	}
	_g_object_unref0 (dialog);
}

static void
moserial_main_window_loadProfile (moserialMainWindow* self)
{
	GtkFileChooserDialog* dialog = NULL;
	GtkWindow* _tmp0_;
	GtkFileChooserDialog* _tmp1_;
	GtkFileChooserDialog* _tmp2_;
	GtkFileChooserDialog* _tmp3_;
	gint response = 0;
	GtkFileChooserDialog* _tmp4_;
	GtkFileChooserDialog* _tmp8_;
	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-cancel", GTK_RESPONSE_CANCEL, "gtk-open", GTK_RESPONSE_ACCEPT, NULL, NULL);
	_tmp3_ = dialog;
	gtk_file_chooser_set_local_only ((GtkFileChooser*) _tmp3_, FALSE);
	_tmp4_ = dialog;
	response = gtk_dialog_run ((GtkDialog*) _tmp4_);
	if (response == ((gint) GTK_RESPONSE_ACCEPT)) {
		GtkFileChooserDialog* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp5_ = dialog;
		_tmp6_ = gtk_file_chooser_get_filename ((GtkFileChooser*) _tmp5_);
		_tmp7_ = _tmp6_;
		moserial_main_window_applyProfile (self, _tmp7_);
		_g_free0 (_tmp7_);
	}
	_tmp8_ = dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp8_);
	_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_) {
		GtkMenuItem* _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_) {
			GtkMenuItem* _tmp24_;
			_tmp24_ = self->priv->copyMenuItem;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp24_, TRUE);
		} else {
			GtkMenuItem* _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_;
			_tmp29_ = self->priv->entry;
			if (gtk_editable_get_selection_bounds ((GtkEditable*) _tmp29_, NULL, NULL)) {
				GtkMenuItem* _tmp30_;
				GtkMenuItem* _tmp31_;
				_tmp30_ = self->priv->cutMenuItem;
				gtk_widget_set_sensitive ((GtkWidget*) _tmp30_, TRUE);
				_tmp31_ = self->priv->copyMenuItem;
				gtk_widget_set_sensitive ((GtkWidget*) _tmp31_, TRUE);
			} else {
				GtkMenuItem* _tmp32_;
				GtkMenuItem* _tmp33_;
				_tmp32_ = self->priv->cutMenuItem;
				gtk_widget_set_sensitive ((GtkWidget*) _tmp32_, FALSE);
				_tmp33_ = self->priv->copyMenuItem;
				gtk_widget_set_sensitive ((GtkWidget*) _tmp33_, FALSE);
			}
		} else {
			GtkMenuItem* _tmp34_;
			GtkMenuItem* _tmp35_;
			_tmp34_ = self->priv->cutMenuItem;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp34_, FALSE);
			_tmp35_ = self->priv->copyMenuItem;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp35_, 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)
{
	GtkEntry* _tmp0_;
	g_return_if_fail (self != NULL);
	moserial_main_window_clearOutgoing (self);
	moserial_main_window_clearIncoming (self);
	_tmp0_ = self->priv->entry;
	gtk_entry_set_text (_tmp0_, "");
}

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)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = moserial_main_window_get_startupProfileFilename (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_startupProfileFilename);
		self->priv->_startupProfileFilename = _tmp0_;
		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_checkExtraVisible_gtk_widget_realize (GtkWidget* _sender,
                                                            gpointer self)
{
	moserial_main_window_checkExtraVisible ((moserialMainWindow*) self, _sender);
}

static void
_moserial_main_window_toggleExtraControls_gtk_check_menu_item_toggled (GtkCheckMenuItem* _sender,
                                                                       gpointer self)
{
	moserial_main_window_toggleExtraControls ((moserialMainWindow*) self, _sender);
}

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

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, 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_onIncomingNotebookSwitchPage_gtk_notebook_switch_page (GtkNotebook* _sender,
                                                                             GtkWidget* page,
                                                                             guint page_num,
                                                                             gpointer self)
{
	moserial_main_window_onIncomingNotebookSwitchPage ((moserialMainWindow*) self, page, page_num);
}

static void
_moserial_main_window_onOutgoingNotebookSwitchPage_gtk_notebook_switch_page (GtkNotebook* _sender,
                                                                             GtkWidget* page,
                                                                             guint page_num,
                                                                             gpointer self)
{
	moserial_main_window_onOutgoingNotebookSwitchPage ((moserialMainWindow*) self, page, page_num);
}

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_lineEndChanged_gtk_combo_box_changed (GtkComboBox* _sender,
                                                            gpointer self)
{
	moserial_main_window_lineEndChanged ((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 void
_moserial_main_window_toggleDTR_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                           gpointer self)
{
	moserial_main_window_toggleDTR ((moserialMainWindow*) self, _sender);
}

static void
_moserial_main_window_toggleRTS_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                           gpointer self)
{
	moserial_main_window_toggleRTS ((moserialMainWindow*) self, _sender);
}

static void
_moserial_main_window_clearIncoming_gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self)
{
	moserial_main_window_clearIncoming ((moserialMainWindow*) self);
}

static void
_moserial_main_window_clearOutgoing_gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self)
{
	moserial_main_window_clearOutgoing ((moserialMainWindow*) self);
}

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_;
	GtkWindow* _tmp12_;
	GtkBuilder* _tmp13_;
	GObject* _tmp14_;
	GtkPaned* _tmp15_;
	Profile* _tmp16_;
	Profile* _tmp17_;
	GtkWindow* _tmp18_;
	GtkBuilder* _tmp19_;
	GObject* _tmp20_;
	GtkGrid* _tmp21_;
	GtkBuilder* _tmp22_;
	GObject* _tmp23_;
	GtkGrid* _tmp24_;
	GtkBuilder* _tmp25_;
	GObject* _tmp26_;
	GtkCheckMenuItem* _tmp27_;
	GtkCheckMenuItem* _tmp28_;
	GtkMenuItem* quit = NULL;
	GtkBuilder* _tmp29_;
	GObject* _tmp30_;
	GtkMenuItem* _tmp31_;
	GtkMenuItem* _tmp32_;
	GtkMenuItem* saveAs = NULL;
	GtkBuilder* _tmp33_;
	GObject* _tmp34_;
	GtkMenuItem* _tmp35_;
	GtkMenuItem* _tmp36_;
	GtkMenuItem* save = NULL;
	GtkBuilder* _tmp37_;
	GObject* _tmp38_;
	GtkMenuItem* _tmp39_;
	GtkMenuItem* _tmp40_;
	GtkMenuItem* open = NULL;
	GtkBuilder* _tmp41_;
	GObject* _tmp42_;
	GtkMenuItem* _tmp43_;
	GtkMenuItem* _tmp44_;
	GtkBuilder* _tmp45_;
	GObject* _tmp46_;
	GtkMenuItem* _tmp47_;
	GtkMenuItem* _tmp48_;
	GtkMenuItem* editMenuItem = NULL;
	GtkBuilder* _tmp49_;
	GObject* _tmp50_;
	GtkMenuItem* _tmp51_;
	GtkMenuItem* _tmp52_;
	GtkBuilder* _tmp53_;
	GObject* _tmp54_;
	GtkMenuItem* _tmp55_;
	GtkMenuItem* _tmp56_;
	GtkMenuItem* _tmp57_;
	GtkMenuItem* _tmp58_;
	GtkMenuItem* pasteMenuItem = NULL;
	GtkBuilder* _tmp59_;
	GObject* _tmp60_;
	GtkMenuItem* _tmp61_;
	GtkMenuItem* _tmp62_;
	GtkMenuItem* clearMenuItem = NULL;
	GtkBuilder* _tmp63_;
	GObject* _tmp64_;
	GtkMenuItem* _tmp65_;
	GtkMenuItem* _tmp66_;
	GtkWindow* _tmp67_;
	moserialSettingsDialog* _tmp68_;
	moserialSettingsDialog* _tmp69_;
	GtkBuilder* _tmp70_;
	GObject* _tmp71_;
	GtkToolButton* _tmp72_;
	GtkToolButton* _tmp73_;
	GtkToolButton* _tmp74_;
	GtkToolButton* helpButton = NULL;
	GtkBuilder* _tmp75_;
	GObject* _tmp76_;
	GtkToolButton* _tmp77_;
	GtkToolButton* _tmp78_;
	GtkToolButton* _tmp79_;
	GtkBuilder* _tmp80_;
	GObject* _tmp81_;
	GtkStatusbar* _tmp82_;
	GtkStatusbar* _tmp83_;
	GtkBuilder* _tmp84_;
	GObject* _tmp85_;
	GtkStatusbar* _tmp86_;
	GtkStatusbar* _tmp87_;
	GtkStatusbar* _tmp88_;
	GtkMenuItem* about = NULL;
	GtkBuilder* _tmp89_;
	GObject* _tmp90_;
	GtkMenuItem* _tmp91_;
	GtkMenuItem* _tmp92_;
	GtkWindow* _tmp93_;
	moserialSendProgressDialog* _tmp94_;
	GtkWindow* _tmp95_;
	moserialSendChooserDialog* _tmp96_;
	GtkBuilder* _tmp97_;
	GObject* _tmp98_;
	GtkToolButton* _tmp99_;
	GtkToolButton* _tmp100_;
	GtkToolButton* _tmp101_;
	moserialSendChooserDialog* _tmp102_;
	moserialSzwrapperProtocol _tmp103_;
	moserialSzwrapper* _tmp104_;
	GtkWindow* _tmp105_;
	moserialReceiveProgressDialog* _tmp106_;
	GtkWindow* _tmp107_;
	moserialReceiveChooserDialog* _tmp108_;
	GtkBuilder* _tmp109_;
	GObject* _tmp110_;
	GtkToolButton* _tmp111_;
	GtkToolButton* _tmp112_;
	GtkToolButton* _tmp113_;
	moserialReceiveChooserDialog* _tmp114_;
	GtkWindow* _tmp115_;
	moserialXmodemFilenameDialog* _tmp116_;
	moserialRzwrapperProtocol _tmp117_;
	moserialRzwrapper* _tmp118_;
	GtkWindow* _tmp119_;
	moserialRecordDialog* _tmp120_;
	GtkBuilder* _tmp121_;
	GObject* _tmp122_;
	GtkToggleToolButton* _tmp123_;
	GtkToggleToolButton* _tmp124_;
	GtkToggleToolButton* _tmp125_;
	moserialRecordDialog* _tmp126_;
	moserialRecordDialog* _tmp127_;
	GtkBuilder* _tmp128_;
	GObject* _tmp129_;
	GtkLabel* _tmp130_;
	GtkBuilder* _tmp131_;
	GObject* _tmp132_;
	GtkLabel* _tmp133_;
	GtkWindow* _tmp134_;
	moserialPreferencesDialog* _tmp135_;
	moserialPreferencesDialog* _tmp136_;
	GtkToolButton* preferences = NULL;
	GtkBuilder* _tmp137_;
	GObject* _tmp138_;
	GtkToolButton* _tmp139_;
	GtkToolButton* _tmp140_;
	GtkToolButton* _tmp141_;
	GtkBuilder* _tmp142_;
	GObject* _tmp143_;
	GtkToggleToolButton* _tmp144_;
	GtkToggleToolButton* _tmp145_;
	GtkToggleToolButton* _tmp146_;
	GtkBuilder* _tmp147_;
	GObject* _tmp148_;
	GtkLabel* _tmp149_;
	GtkBuilder* _tmp150_;
	GObject* _tmp151_;
	GtkLabel* _tmp152_;
	GtkMenuItem* contents = NULL;
	GtkBuilder* _tmp153_;
	GObject* _tmp154_;
	GtkMenuItem* _tmp155_;
	GtkMenuItem* _tmp156_;
	GtkBuilder* _tmp157_;
	GObject* _tmp158_;
	GtkNotebook* _tmp159_;
	GtkNotebook* _tmp160_;
	GtkBuilder* _tmp161_;
	GObject* _tmp162_;
	GtkNotebook* _tmp163_;
	GtkNotebook* _tmp164_;
	moserialHexTextBuffer* _tmp165_;
	GtkTextTagTable* _tmp166_;
	GtkTextTagTable* _tmp167_;
	GtkTextBuffer* _tmp168_;
	moserialHexTextBuffer* _tmp169_;
	GtkTextTagTable* _tmp170_;
	GtkTextTagTable* _tmp171_;
	GtkTextBuffer* _tmp172_;
	GtkTextBuffer* _tmp173_;
	GtkTextTag* _tmp174_;
	GtkTextTag* _tmp175_;
	GtkBuilder* _tmp176_;
	GObject* _tmp177_;
	GtkTextView* _tmp178_;
	GtkTextView* _tmp179_;
	moserialHexTextBuffer* _tmp180_;
	GtkBuilder* _tmp181_;
	GObject* _tmp182_;
	GtkTextView* _tmp183_;
	GtkTextView* _tmp184_;
	GtkTextBuffer* _tmp185_;
	GtkBuilder* _tmp186_;
	GObject* _tmp187_;
	GtkTextView* _tmp188_;
	GtkTextView* _tmp189_;
	moserialHexTextBuffer* _tmp190_;
	GtkBuilder* _tmp191_;
	GObject* _tmp192_;
	GtkTextView* _tmp193_;
	GtkTextView* _tmp194_;
	GtkTextBuffer* _tmp195_;
	GtkScrolledWindow* incomingAsciiScrolledWindow = NULL;
	GtkBuilder* _tmp196_;
	GObject* _tmp197_;
	GtkScrolledWindow* _tmp198_;
	GtkScrolledWindow* _tmp199_;
	GtkAdjustment* _tmp200_;
	GtkAdjustment* _tmp201_;
	GtkScrolledWindow* incomingHexScrolledWindow = NULL;
	GtkBuilder* _tmp202_;
	GObject* _tmp203_;
	GtkScrolledWindow* _tmp204_;
	GtkScrolledWindow* _tmp205_;
	GtkAdjustment* _tmp206_;
	GtkAdjustment* _tmp207_;
	GtkScrolledWindow* outgoingAsciiScrolledWindow = NULL;
	GtkBuilder* _tmp208_;
	GObject* _tmp209_;
	GtkScrolledWindow* _tmp210_;
	GtkScrolledWindow* _tmp211_;
	GtkAdjustment* _tmp212_;
	GtkAdjustment* _tmp213_;
	GtkScrolledWindow* outgoingHexScrolledWindow = NULL;
	GtkBuilder* _tmp214_;
	GObject* _tmp215_;
	GtkScrolledWindow* _tmp216_;
	GtkScrolledWindow* _tmp217_;
	GtkAdjustment* _tmp218_;
	GtkAdjustment* _tmp219_;
	GtkAdjustment* _tmp220_;
	GtkAdjustment* _tmp221_;
	GtkAdjustment* _tmp222_;
	GtkAdjustment* _tmp223_;
	GtkBuilder* _tmp224_;
	GObject* _tmp225_;
	GtkButton* _tmp226_;
	GtkButton* _tmp227_;
	GtkButton* _tmp228_;
	GtkBuilder* _tmp229_;
	GObject* _tmp230_;
	GtkEntry* _tmp231_;
	GtkEntry* _tmp232_;
	GtkEntry* _tmp233_;
	GtkBuilder* _tmp234_;
	GObject* _tmp235_;
	GtkComboBox* _tmp236_;
	GtkComboBox* _tmp237_;
	GtkComboBox* _tmp238_;
	GtkBuilder* _tmp239_;
	GObject* _tmp240_;
	GtkComboBox* _tmp241_;
	GtkComboBox* _tmp242_;
	GtkComboBox* _tmp243_;
	gchar* _tmp244_;
	gchar** _tmp245_;
	const gchar* _tmp246_;
	gchar* _tmp247_;
	const gchar* _tmp248_;
	gchar* _tmp249_;
	gchar* _tmp250_;
	GtkRecentManager* recentManager = NULL;
	GtkRecentManager* _tmp251_;
	GtkRecentManager* _tmp252_;
	GtkRecentChooserMenu* recentChooserMenu = NULL;
	GtkRecentManager* _tmp253_;
	GtkRecentChooserMenu* _tmp254_;
	GtkRecentChooserMenu* _tmp255_;
	GtkRecentFilter* filter = NULL;
	GtkRecentFilter* _tmp256_;
	GtkRecentFilter* _tmp257_;
	GtkRecentChooserMenu* _tmp258_;
	GtkRecentFilter* _tmp259_;
	GtkRecentChooserMenu* _tmp260_;
	GtkRecentChooserMenu* _tmp261_;
	GtkMenuItem* recentFileItem = NULL;
	GtkBuilder* _tmp262_;
	GObject* _tmp263_;
	GtkMenuItem* _tmp264_;
	GtkMenuItem* _tmp265_;
	GtkRecentChooserMenu* _tmp266_;
	GtkLabel* label = NULL;
	GtkBuilder* _tmp267_;
	GObject* _tmp268_;
	GtkLabel* _tmp269_;
	GtkLabel* _tmp270_;
	GtkLabel* _tmp271_;
	GtkLabel* _tmp272_;
	GtkBuilder* _tmp273_;
	GObject* _tmp274_;
	GtkLabel* _tmp275_;
	GtkLabel* _tmp276_;
	GtkLabel* _tmp277_;
	GtkLabel* _tmp278_;
	GtkBuilder* _tmp279_;
	GObject* _tmp280_;
	GtkLabel* _tmp281_;
	GtkLabel* _tmp282_;
	GtkLabel* _tmp283_;
	GtkLabel* _tmp284_;
	GtkBuilder* _tmp285_;
	GObject* _tmp286_;
	GtkLabel* _tmp287_;
	GtkLabel* _tmp288_;
	GtkLabel* _tmp289_;
	GtkLabel* _tmp290_;
	GtkBuilder* _tmp291_;
	GObject* _tmp292_;
	GtkToggleButton* _tmp293_;
	GtkToggleButton* _tmp294_;
	GtkToggleButton* _tmp295_;
	GtkBuilder* _tmp296_;
	GObject* _tmp297_;
	GtkToggleButton* _tmp298_;
	GtkToggleButton* _tmp299_;
	GtkToggleButton* _tmp300_;
	GtkBuilder* _tmp301_;
	GObject* _tmp302_;
	GtkButton* _tmp303_;
	GtkButton* _tmp304_;
	GtkButton* _tmp305_;
	GtkBuilder* _tmp306_;
	GObject* _tmp307_;
	GtkButton* _tmp308_;
	GtkButton* _tmp309_;
	GtkButton* _tmp310_;
	const gchar* _tmp311_;
	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_ = self->priv->gtkWindow;
	g_signal_connect_object ((GtkWidget*) _tmp12_, "realize", (GCallback) _moserial_main_window_checkExtraVisible_gtk_widget_realize, self, 0);
	_tmp13_ = builder;
	_tmp14_ = gtk_builder_get_object (_tmp13_, "vpaned");
	_tmp15_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, gtk_paned_get_type (), GtkPaned));
	_g_object_unref0 (self->priv->paned);
	self->priv->paned = _tmp15_;
	_tmp16_ = profile_new ();
	_g_object_unref0 (self->priv->profile);
	self->priv->profile = _tmp16_;
	_tmp17_ = self->priv->profile;
	_tmp18_ = self->priv->gtkWindow;
	profile_load (_tmp17_, NULL, _tmp18_);
	_tmp19_ = builder;
	_tmp20_ = gtk_builder_get_object (_tmp19_, "incoming_signals");
	_tmp21_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, gtk_grid_get_type (), GtkGrid));
	_g_object_unref0 (self->priv->incoming_signals);
	self->priv->incoming_signals = _tmp21_;
	_tmp22_ = builder;
	_tmp23_ = gtk_builder_get_object (_tmp22_, "outgoing_signals");
	_tmp24_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp23_, gtk_grid_get_type (), GtkGrid));
	_g_object_unref0 (self->priv->outgoing_signals);
	self->priv->outgoing_signals = _tmp24_;
	_tmp25_ = builder;
	_tmp26_ = gtk_builder_get_object (_tmp25_, "menubar_extracontrols");
	_tmp27_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, gtk_check_menu_item_get_type (), GtkCheckMenuItem));
	_g_object_unref0 (self->priv->extraControlsCheck);
	self->priv->extraControlsCheck = _tmp27_;
	_tmp28_ = self->priv->extraControlsCheck;
	g_signal_connect_object (_tmp28_, "toggled", (GCallback) _moserial_main_window_toggleExtraControls_gtk_check_menu_item_toggled, self, 0);
	_tmp29_ = builder;
	_tmp30_ = gtk_builder_get_object (_tmp29_, "menubar_quit");
	_tmp31_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp30_, gtk_menu_item_get_type (), GtkMenuItem));
	quit = _tmp31_;
	_tmp32_ = quit;
	g_signal_connect_object (_tmp32_, "activate", (GCallback) _moserial_main_window_quitSizeSave_gtk_menu_item_activate, self, 0);
	_tmp33_ = builder;
	_tmp34_ = gtk_builder_get_object (_tmp33_, "menubar_save_settings_as");
	_tmp35_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp34_, gtk_menu_item_get_type (), GtkMenuItem));
	saveAs = _tmp35_;
	_tmp36_ = saveAs;
	g_signal_connect_object (_tmp36_, "activate", (GCallback) _moserial_main_window_saveProfileAs_gtk_menu_item_activate, self, 0);
	_tmp37_ = builder;
	_tmp38_ = gtk_builder_get_object (_tmp37_, "menubar_save_settings");
	_tmp39_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp38_, gtk_menu_item_get_type (), GtkMenuItem));
	save = _tmp39_;
	_tmp40_ = save;
	g_signal_connect_object (_tmp40_, "activate", (GCallback) _moserial_main_window_saveProfile_gtk_menu_item_activate, self, 0);
	_tmp41_ = builder;
	_tmp42_ = gtk_builder_get_object (_tmp41_, "menubar_open_settings");
	_tmp43_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp42_, gtk_menu_item_get_type (), GtkMenuItem));
	open = _tmp43_;
	_tmp44_ = open;
	g_signal_connect_object (_tmp44_, "activate", (GCallback) _moserial_main_window_loadProfile_gtk_menu_item_activate, self, 0);
	_tmp45_ = builder;
	_tmp46_ = gtk_builder_get_object (_tmp45_, "menubar_copy");
	_tmp47_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp46_, gtk_menu_item_get_type (), GtkMenuItem));
	_g_object_unref0 (self->priv->copyMenuItem);
	self->priv->copyMenuItem = _tmp47_;
	_tmp48_ = self->priv->copyMenuItem;
	g_signal_connect_object (_tmp48_, "activate", (GCallback) _moserial_main_window_copy_gtk_menu_item_activate, self, 0);
	_tmp49_ = builder;
	_tmp50_ = gtk_builder_get_object (_tmp49_, "menubar_edit");
	_tmp51_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp50_, gtk_menu_item_get_type (), GtkMenuItem));
	editMenuItem = _tmp51_;
	_tmp52_ = editMenuItem;
	g_signal_connect_object (_tmp52_, "activate", (GCallback) _moserial_main_window_editMenu_gtk_menu_item_activate, self, 0);
	_tmp53_ = builder;
	_tmp54_ = gtk_builder_get_object (_tmp53_, "menubar_cut");
	_tmp55_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp54_, gtk_menu_item_get_type (), GtkMenuItem));
	_g_object_unref0 (self->priv->cutMenuItem);
	self->priv->cutMenuItem = _tmp55_;
	_tmp56_ = self->priv->copyMenuItem;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp56_, FALSE);
	_tmp57_ = self->priv->cutMenuItem;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp57_, FALSE);
	_tmp58_ = self->priv->cutMenuItem;
	g_signal_connect_object (_tmp58_, "activate", (GCallback) _moserial_main_window_cut_gtk_menu_item_activate, self, 0);
	_tmp59_ = builder;
	_tmp60_ = gtk_builder_get_object (_tmp59_, "menubar_paste");
	_tmp61_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp60_, gtk_menu_item_get_type (), GtkMenuItem));
	pasteMenuItem = _tmp61_;
	_tmp62_ = pasteMenuItem;
	g_signal_connect_object (_tmp62_, "activate", (GCallback) _moserial_main_window_paste_gtk_menu_item_activate, self, 0);
	_tmp63_ = builder;
	_tmp64_ = gtk_builder_get_object (_tmp63_, "menubar_clear");
	_tmp65_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp64_, gtk_menu_item_get_type (), GtkMenuItem));
	clearMenuItem = _tmp65_;
	_tmp66_ = clearMenuItem;
	g_signal_connect_object (_tmp66_, "activate", (GCallback) _moserial_main_window_clear_gtk_menu_item_activate, self, 0);
	_tmp67_ = self->priv->gtkWindow;
	_tmp68_ = moserial_settings_dialog_new (_tmp67_);
	_g_object_unref0 (self->priv->settingsDialog);
	self->priv->settingsDialog = _tmp68_;
	_tmp69_ = self->priv->settingsDialog;
	g_signal_connect_object (_tmp69_, "update-settings", (GCallback) _moserial_main_window_updateSettings_moserial_settings_dialog_update_settings, self, 0);
	_tmp70_ = builder;
	_tmp71_ = gtk_builder_get_object (_tmp70_, "toolbar_settings");
	_tmp72_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp71_, gtk_tool_button_get_type (), GtkToolButton));
	_g_object_unref0 (self->priv->settingsButton);
	self->priv->settingsButton = _tmp72_;
	_tmp73_ = self->priv->settingsButton;
	g_signal_connect_object (_tmp73_, "clicked", (GCallback) _moserial_main_window_showSettingsDialog_gtk_tool_button_clicked, self, 0);
	_tmp74_ = self->priv->settingsButton;
	gtk_tool_item_set_tooltip_text ((GtkToolItem*) _tmp74_, _ ("Port configuration"));
	_tmp75_ = builder;
	_tmp76_ = gtk_builder_get_object (_tmp75_, "toolbar_help");
	_tmp77_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp76_, gtk_tool_button_get_type (), GtkToolButton));
	helpButton = _tmp77_;
	_tmp78_ = helpButton;
	g_signal_connect_object (_tmp78_, "clicked", (GCallback) _moserial_main_window_showHelpButton_gtk_tool_button_clicked, self, 0);
	_tmp79_ = helpButton;
	gtk_tool_item_set_tooltip_text ((GtkToolItem*) _tmp79_, _ ("Read the manual"));
	_tmp80_ = builder;
	_tmp81_ = gtk_builder_get_object (_tmp80_, "statusbar");
	_tmp82_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp81_, gtk_statusbar_get_type (), GtkStatusbar));
	_g_object_unref0 (self->priv->statusbar);
	self->priv->statusbar = _tmp82_;
	_tmp83_ = self->priv->statusbar;
	self->priv->statusbarContext = gtk_statusbar_get_context_id (_tmp83_, "moserial port status");
	_tmp84_ = builder;
	_tmp85_ = gtk_builder_get_object (_tmp84_, "bytecountbar");
	_tmp86_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp85_, gtk_statusbar_get_type (), GtkStatusbar));
	_g_object_unref0 (self->priv->bytecountbar);
	self->priv->bytecountbar = _tmp86_;
	_tmp87_ = self->priv->statusbar;
	self->priv->bytecountbarContext = gtk_statusbar_get_context_id (_tmp87_, "moserial byte counts");
	_tmp88_ = self->priv->bytecountbar;
	gtk_statusbar_push (_tmp88_, self->priv->bytecountbarContext, _ ("TX: 0, RX: 0"));
	_tmp89_ = builder;
	_tmp90_ = gtk_builder_get_object (_tmp89_, "menubar_about");
	_tmp91_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp90_, gtk_menu_item_get_type (), GtkMenuItem));
	about = _tmp91_;
	_tmp92_ = about;
	g_signal_connect_object (_tmp92_, "activate", (GCallback) _moserial_main_window_showAboutDialog_gtk_menu_item_activate, self, 0);
	_tmp93_ = self->priv->gtkWindow;
	_tmp94_ = moserial_send_progress_dialog_new (_tmp93_);
	_g_object_unref0 (self->priv->sendProgressDialog);
	self->priv->sendProgressDialog = _tmp94_;
	_tmp95_ = self->priv->gtkWindow;
	_tmp96_ = moserial_send_chooser_dialog_new (_tmp95_);
	_g_object_unref0 (self->priv->sendChooserDialog);
	self->priv->sendChooserDialog = _tmp96_;
	_tmp97_ = builder;
	_tmp98_ = gtk_builder_get_object (_tmp97_, "toolbar_send");
	_tmp99_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp98_, gtk_tool_button_get_type (), GtkToolButton));
	_g_object_unref0 (self->priv->send);
	self->priv->send = _tmp99_;
	_tmp100_ = self->priv->send;
	g_signal_connect_object (_tmp100_, "clicked", (GCallback) _moserial_main_window_doSendChooser_gtk_tool_button_clicked, self, 0);
	_tmp101_ = self->priv->send;
	gtk_tool_item_set_tooltip_text ((GtkToolItem*) _tmp101_, _ ("Send a file"));
	_tmp102_ = self->priv->sendChooserDialog;
	g_signal_connect_object (_tmp102_, "start-transfer", (GCallback) _moserial_main_window_doSend_moserial_send_chooser_dialog_start_transfer, self, 0);
	_tmp103_ = MOSERIAL_SZWRAPPER_PROTOCOL_NULL;
	_tmp104_ = moserial_szwrapper_new (&_tmp103_, NULL, NULL);
	_g_object_unref0 (self->priv->sz);
	self->priv->sz = _tmp104_;
	_tmp105_ = self->priv->gtkWindow;
	_tmp106_ = moserial_receive_progress_dialog_new (_tmp105_);
	_g_object_unref0 (self->priv->receiveProgressDialog);
	self->priv->receiveProgressDialog = _tmp106_;
	_tmp107_ = self->priv->gtkWindow;
	_tmp108_ = moserial_receive_chooser_dialog_new (_tmp107_);
	_g_object_unref0 (self->priv->receiveChooserDialog);
	self->priv->receiveChooserDialog = _tmp108_;
	_tmp109_ = builder;
	_tmp110_ = gtk_builder_get_object (_tmp109_, "toolbar_receive");
	_tmp111_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp110_, gtk_tool_button_get_type (), GtkToolButton));
	_g_object_unref0 (self->priv->receive);
	self->priv->receive = _tmp111_;
	_tmp112_ = self->priv->receive;
	g_signal_connect_object (_tmp112_, "clicked", (GCallback) _moserial_main_window_doReceiveChooser_gtk_tool_button_clicked, self, 0);
	_tmp113_ = self->priv->receive;
	gtk_tool_item_set_tooltip_text ((GtkToolItem*) _tmp113_, _ ("Receive a file"));
	_tmp114_ = self->priv->receiveChooserDialog;
	g_signal_connect_object (_tmp114_, "start-transfer", (GCallback) _moserial_main_window_doReceive_moserial_receive_chooser_dialog_start_transfer, self, 0);
	_tmp115_ = self->priv->gtkWindow;
	_tmp116_ = moserial_xmodem_filename_dialog_new (_tmp115_);
	_g_object_unref0 (self->priv->xmodemFilenameDialog);
	self->priv->xmodemFilenameDialog = _tmp116_;
	_tmp117_ = MOSERIAL_RZWRAPPER_PROTOCOL_NULL;
	_tmp118_ = moserial_rzwrapper_new (&_tmp117_, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->rz);
	self->priv->rz = _tmp118_;
	_tmp119_ = self->priv->gtkWindow;
	_tmp120_ = moserial_record_dialog_new (_tmp119_);
	_g_object_unref0 (self->priv->recordDialog);
	self->priv->recordDialog = _tmp120_;
	_tmp121_ = builder;
	_tmp122_ = gtk_builder_get_object (_tmp121_, "toolbar_logging");
	_tmp123_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp122_, gtk_toggle_tool_button_get_type (), GtkToggleToolButton));
	_g_object_unref0 (self->priv->recordButton);
	self->priv->recordButton = _tmp123_;
	_tmp124_ = self->priv->recordButton;
	g_signal_connect_object (_tmp124_, "toggled", (GCallback) _moserial_main_window_record_gtk_toggle_tool_button_toggled, self, 0);
	_tmp125_ = self->priv->recordButton;
	gtk_tool_item_set_tooltip_text ((GtkToolItem*) _tmp125_, _ ("Record sent and/or received data"));
	_tmp126_ = self->priv->recordDialog;
	g_signal_connect_object (_tmp126_, "stop-recording", (GCallback) _moserial_main_window_stopRecording_moserial_record_dialog_stop_recording, self, 0);
	_tmp127_ = self->priv->recordDialog;
	g_signal_connect_object (_tmp127_, "start-recording", (GCallback) _moserial_main_window_startRecording_moserial_record_dialog_start_recording, self, 0);
	_tmp128_ = builder;
	_tmp129_ = gtk_builder_get_object (_tmp128_, "record_label");
	_tmp130_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp129_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (self->priv->recordLabel);
	self->priv->recordLabel = _tmp130_;
	_tmp131_ = builder;
	_tmp132_ = gtk_builder_get_object (_tmp131_, "stop_recording_label");
	_tmp133_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp132_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (self->priv->stopRecordingLabel);
	self->priv->stopRecordingLabel = _tmp133_;
	_tmp134_ = self->priv->gtkWindow;
	_tmp135_ = moserial_preferences_dialog_new (_tmp134_);
	_g_object_unref0 (self->priv->preferencesDialog);
	self->priv->preferencesDialog = _tmp135_;
	_tmp136_ = self->priv->preferencesDialog;
	g_signal_connect_object (_tmp136_, "update-preferences", (GCallback) _moserial_main_window_updatePreferences_moserial_preferences_dialog_update_preferences, self, 0);
	_tmp137_ = builder;
	_tmp138_ = gtk_builder_get_object (_tmp137_, "toolbar_preferences");
	_tmp139_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp138_, gtk_tool_button_get_type (), GtkToolButton));
	preferences = _tmp139_;
	_tmp140_ = preferences;
	g_signal_connect_object (_tmp140_, "clicked", (GCallback) _moserial_main_window_showPreferencesDialog_gtk_tool_button_clicked, self, 0);
	_tmp141_ = preferences;
	gtk_tool_item_set_tooltip_text ((GtkToolItem*) _tmp141_, _ ("Other preferences"));
	_tmp142_ = builder;
	_tmp143_ = gtk_builder_get_object (_tmp142_, "toolbar_connect");
	_tmp144_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp143_, gtk_toggle_tool_button_get_type (), GtkToggleToolButton));
	_g_object_unref0 (self->priv->connectButton);
	self->priv->connectButton = _tmp144_;
	_tmp145_ = self->priv->connectButton;
	g_signal_connect_object (_tmp145_, "toggled", (GCallback) _moserial_main_window_connectButtonClick_gtk_toggle_tool_button_toggled, self, 0);
	_tmp146_ = self->priv->connectButton;
	gtk_tool_item_set_tooltip_text ((GtkToolItem*) _tmp146_, _ ("Open/close port"));
	_tmp147_ = builder;
	_tmp148_ = gtk_builder_get_object (_tmp147_, "disconnect_label");
	_tmp149_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp148_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (self->priv->disconnectLabel);
	self->priv->disconnectLabel = _tmp149_;
	_tmp150_ = builder;
	_tmp151_ = gtk_builder_get_object (_tmp150_, "connect_label");
	_tmp152_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp151_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (self->priv->connectLabel);
	self->priv->connectLabel = _tmp152_;
	_tmp153_ = builder;
	_tmp154_ = gtk_builder_get_object (_tmp153_, "menubar_contents");
	_tmp155_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp154_, gtk_menu_item_get_type (), GtkMenuItem));
	contents = _tmp155_;
	_tmp156_ = contents;
	g_signal_connect_object (_tmp156_, "activate", (GCallback) _moserial_main_window_showHelpAction_gtk_menu_item_activate, self, 0);
	_tmp157_ = builder;
	_tmp158_ = gtk_builder_get_object (_tmp157_, "incoming_notebook");
	_tmp159_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp158_, gtk_notebook_get_type (), GtkNotebook));
	_g_object_unref0 (self->priv->incoming_notebook);
	self->priv->incoming_notebook = _tmp159_;
	_tmp160_ = self->priv->incoming_notebook;
	g_signal_connect_object (_tmp160_, "switch-page", (GCallback) _moserial_main_window_onIncomingNotebookSwitchPage_gtk_notebook_switch_page, self, 0);
	_tmp161_ = builder;
	_tmp162_ = gtk_builder_get_object (_tmp161_, "outgoing_notebook");
	_tmp163_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp162_, gtk_notebook_get_type (), GtkNotebook));
	_g_object_unref0 (self->priv->outgoing_notebook);
	self->priv->outgoing_notebook = _tmp163_;
	_tmp164_ = self->priv->outgoing_notebook;
	g_signal_connect_object (_tmp164_, "switch-page", (GCallback) _moserial_main_window_onOutgoingNotebookSwitchPage_gtk_notebook_switch_page, self, 0);
	_tmp165_ = moserial_hex_text_buffer_new ();
	_g_object_unref0 (self->priv->incomingHexTextBuffer);
	self->priv->incomingHexTextBuffer = _tmp165_;
	_tmp166_ = gtk_text_tag_table_new ();
	_tmp167_ = _tmp166_;
	_tmp168_ = gtk_text_buffer_new (_tmp167_);
	_g_object_unref0 (self->priv->incomingAsciiTextBuffer);
	self->priv->incomingAsciiTextBuffer = _tmp168_;
	_g_object_unref0 (_tmp167_);
	_tmp169_ = moserial_hex_text_buffer_new ();
	_g_object_unref0 (self->priv->outgoingHexTextBuffer);
	self->priv->outgoingHexTextBuffer = _tmp169_;
	_tmp170_ = gtk_text_tag_table_new ();
	_tmp171_ = _tmp170_;
	_tmp172_ = gtk_text_buffer_new (_tmp171_);
	_g_object_unref0 (self->priv->outgoingAsciiTextBuffer);
	self->priv->outgoingAsciiTextBuffer = _tmp172_;
	_g_object_unref0 (_tmp171_);
	_tmp173_ = self->priv->incomingAsciiTextBuffer;
	_tmp174_ = gtk_text_buffer_create_tag (_tmp173_, "echo", NULL, NULL);
	_tmp175_ = _g_object_ref0 (_tmp174_);
	_g_object_unref0 (self->priv->echoTag);
	self->priv->echoTag = _tmp175_;
	_tmp176_ = builder;
	_tmp177_ = gtk_builder_get_object (_tmp176_, "incoming_hex_textview");
	_tmp178_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp177_, gtk_text_view_get_type (), GtkTextView));
	_g_object_unref0 (self->priv->incomingHexTextView);
	self->priv->incomingHexTextView = _tmp178_;
	_tmp179_ = self->priv->incomingHexTextView;
	_tmp180_ = self->priv->incomingHexTextBuffer;
	gtk_text_view_set_buffer (_tmp179_, (GtkTextBuffer*) _tmp180_);
	_tmp181_ = builder;
	_tmp182_ = gtk_builder_get_object (_tmp181_, "incoming_ascii_textview");
	_tmp183_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp182_, gtk_text_view_get_type (), GtkTextView));
	_g_object_unref0 (self->priv->incomingAsciiTextView);
	self->priv->incomingAsciiTextView = _tmp183_;
	_tmp184_ = self->priv->incomingAsciiTextView;
	_tmp185_ = self->priv->incomingAsciiTextBuffer;
	gtk_text_view_set_buffer (_tmp184_, _tmp185_);
	_tmp186_ = builder;
	_tmp187_ = gtk_builder_get_object (_tmp186_, "outgoing_hex_textview");
	_tmp188_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp187_, gtk_text_view_get_type (), GtkTextView));
	_g_object_unref0 (self->priv->outgoingHexTextView);
	self->priv->outgoingHexTextView = _tmp188_;
	_tmp189_ = self->priv->outgoingHexTextView;
	_tmp190_ = self->priv->outgoingHexTextBuffer;
	gtk_text_view_set_buffer (_tmp189_, (GtkTextBuffer*) _tmp190_);
	_tmp191_ = builder;
	_tmp192_ = gtk_builder_get_object (_tmp191_, "outgoing_ascii_textview");
	_tmp193_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp192_, gtk_text_view_get_type (), GtkTextView));
	_g_object_unref0 (self->priv->outgoingAsciiTextView);
	self->priv->outgoingAsciiTextView = _tmp193_;
	_tmp194_ = self->priv->outgoingAsciiTextView;
	_tmp195_ = self->priv->outgoingAsciiTextBuffer;
	gtk_text_view_set_buffer (_tmp194_, _tmp195_);
	_tmp196_ = builder;
	_tmp197_ = gtk_builder_get_object (_tmp196_, "incoming_ascii_scrolledwindow");
	_tmp198_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp197_, gtk_scrolled_window_get_type (), GtkScrolledWindow));
	incomingAsciiScrolledWindow = _tmp198_;
	_tmp199_ = incomingAsciiScrolledWindow;
	_tmp200_ = gtk_scrolled_window_get_vadjustment (_tmp199_);
	_tmp201_ = _g_object_ref0 (_tmp200_);
	_g_object_unref0 (self->priv->va1);
	self->priv->va1 = _tmp201_;
	_tmp202_ = builder;
	_tmp203_ = gtk_builder_get_object (_tmp202_, "incoming_hex_scrolledwindow");
	_tmp204_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp203_, gtk_scrolled_window_get_type (), GtkScrolledWindow));
	incomingHexScrolledWindow = _tmp204_;
	_tmp205_ = incomingHexScrolledWindow;
	_tmp206_ = gtk_scrolled_window_get_vadjustment (_tmp205_);
	_tmp207_ = _g_object_ref0 (_tmp206_);
	_g_object_unref0 (self->priv->va2);
	self->priv->va2 = _tmp207_;
	_tmp208_ = builder;
	_tmp209_ = gtk_builder_get_object (_tmp208_, "outgoing_ascii_scrolledwindow");
	_tmp210_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp209_, gtk_scrolled_window_get_type (), GtkScrolledWindow));
	outgoingAsciiScrolledWindow = _tmp210_;
	_tmp211_ = outgoingAsciiScrolledWindow;
	_tmp212_ = gtk_scrolled_window_get_vadjustment (_tmp211_);
	_tmp213_ = _g_object_ref0 (_tmp212_);
	_g_object_unref0 (self->priv->va3);
	self->priv->va3 = _tmp213_;
	_tmp214_ = builder;
	_tmp215_ = gtk_builder_get_object (_tmp214_, "outgoing_hex_scrolledwindow");
	_tmp216_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp215_, gtk_scrolled_window_get_type (), GtkScrolledWindow));
	outgoingHexScrolledWindow = _tmp216_;
	_tmp217_ = outgoingHexScrolledWindow;
	_tmp218_ = gtk_scrolled_window_get_vadjustment (_tmp217_);
	_tmp219_ = _g_object_ref0 (_tmp218_);
	_g_object_unref0 (self->priv->va4);
	self->priv->va4 = _tmp219_;
	_tmp220_ = self->priv->va1;
	_tmp221_ = self->priv->va2;
	_tmp222_ = self->priv->va3;
	_tmp223_ = self->priv->va4;
	moserial_auto_scroll_setup (_tmp220_, _tmp221_, _tmp222_, _tmp223_);
	_tmp224_ = builder;
	_tmp225_ = gtk_builder_get_object (_tmp224_, "send");
	_tmp226_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp225_, gtk_button_get_type (), GtkButton));
	_g_object_unref0 (self->priv->sendButton);
	self->priv->sendButton = _tmp226_;
	_tmp227_ = self->priv->sendButton;
	g_signal_connect_object (_tmp227_, "clicked", (GCallback) _moserial_main_window_sendString_gtk_button_clicked, self, 0);
	_tmp228_ = self->priv->sendButton;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp228_, _ ("Send the outgoing data now."));
	_tmp229_ = builder;
	_tmp230_ = gtk_builder_get_object (_tmp229_, "entry");
	_tmp231_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp230_, gtk_entry_get_type (), GtkEntry));
	_g_object_unref0 (self->priv->entry);
	self->priv->entry = _tmp231_;
	_tmp232_ = self->priv->entry;
	g_signal_connect_object (_tmp232_, "activate", (GCallback) _moserial_main_window_sendString_gtk_entry_activate, self, 0);
	_tmp233_ = self->priv->entry;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp233_, _ ("Type outgoing data here. Press Enter or Send to send it."));
	_tmp234_ = builder;
	_tmp235_ = gtk_builder_get_object (_tmp234_, "input_mode");
	_tmp236_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp235_, gtk_combo_box_get_type (), GtkComboBox));
	_g_object_unref0 (self->priv->inputModeCombo);
	self->priv->inputModeCombo = _tmp236_;
	_tmp237_ = self->priv->inputModeCombo;
	mo_utils_populateComboBox (_tmp237_, MOSERIAL_MAIN_WINDOW_inputModeStrings, (gint) G_N_ELEMENTS (MOSERIAL_MAIN_WINDOW_inputModeStrings), TRUE);
	_tmp238_ = self->priv->inputModeCombo;
	g_signal_connect_object (_tmp238_, "changed", (GCallback) _moserial_main_window_inputModeChanged_gtk_combo_box_changed, self, 0);
	_tmp239_ = builder;
	_tmp240_ = gtk_builder_get_object (_tmp239_, "termination_mode");
	_tmp241_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp240_, gtk_combo_box_get_type (), GtkComboBox));
	_g_object_unref0 (self->priv->lineEndModeCombo);
	self->priv->lineEndModeCombo = _tmp241_;
	_tmp242_ = self->priv->lineEndModeCombo;
	mo_utils_populateComboBox (_tmp242_, MOSERIAL_SERIAL_CONNECTION_LineEndStrings, (gint) G_N_ELEMENTS (MOSERIAL_SERIAL_CONNECTION_LineEndStrings), TRUE);
	_tmp243_ = self->priv->lineEndModeCombo;
	g_signal_connect_object (_tmp243_, "changed", (GCallback) _moserial_main_window_lineEndChanged_gtk_combo_box_changed, self, 0);
	_tmp244_ = g_strdup (MOSERIAL_MAIN_WINDOW_recentGroup);
	_tmp245_ = g_new0 (gchar*, 1 + 1);
	_tmp245_[0] = _tmp244_;
	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 = _tmp245_;
	_tmp246_ = g_get_application_name ();
	_tmp247_ = g_strdup (_tmp246_);
	_g_free0 (self->priv->recentData.app_name);
	self->priv->recentData.app_name = _tmp247_;
	_tmp248_ = g_get_prgname ();
	_tmp249_ = g_strconcat (_tmp248_, " %u", NULL);
	_g_free0 (self->priv->recentData.app_exec);
	self->priv->recentData.app_exec = _tmp249_;
	_tmp250_ = g_strdup ("text/plain");
	_g_free0 (self->priv->recentData.mime_type);
	self->priv->recentData.mime_type = _tmp250_;
	_tmp251_ = gtk_recent_manager_get_default ();
	_tmp252_ = _g_object_ref0 (_tmp251_);
	recentManager = _tmp252_;
	_tmp253_ = recentManager;
	_tmp254_ = (GtkRecentChooserMenu*) gtk_recent_chooser_menu_new_for_manager (_tmp253_);
	g_object_ref_sink (_tmp254_);
	recentChooserMenu = _tmp254_;
	_tmp255_ = recentChooserMenu;
	g_signal_connect_object ((GtkRecentChooser*) _tmp255_, "item-activated", (GCallback) _moserial_main_window_recentItemOpen_gtk_recent_chooser_item_activated, self, 0);
	_tmp256_ = gtk_recent_filter_new ();
	g_object_ref_sink (_tmp256_);
	filter = _tmp256_;
	_tmp257_ = filter;
	gtk_recent_filter_add_group (_tmp257_, MOSERIAL_MAIN_WINDOW_recentGroup);
	_tmp258_ = recentChooserMenu;
	_tmp259_ = filter;
	gtk_recent_chooser_add_filter ((GtkRecentChooser*) _tmp258_, _tmp259_);
	_tmp260_ = recentChooserMenu;
	gtk_recent_chooser_menu_set_show_numbers (_tmp260_, TRUE);
	_tmp261_ = recentChooserMenu;
	gtk_recent_chooser_set_show_not_found ((GtkRecentChooser*) _tmp261_, FALSE);
	_tmp262_ = builder;
	_tmp263_ = gtk_builder_get_object (_tmp262_, "menubar_open_recent");
	_tmp264_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp263_, gtk_menu_item_get_type (), GtkMenuItem));
	recentFileItem = _tmp264_;
	_tmp265_ = recentFileItem;
	_tmp266_ = recentChooserMenu;
	gtk_menu_item_set_submenu (_tmp265_, (GtkMenu*) _tmp266_);
	_tmp267_ = builder;
	_tmp268_ = gtk_builder_get_object (_tmp267_, "labelStatusRI");
	_tmp269_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp268_, gtk_label_get_type (), GtkLabel));
	label = _tmp269_;
	_tmp270_ = label;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp270_, FALSE);
	_tmp271_ = label;
	_tmp272_ = _g_object_ref0 (_tmp271_);
	_g_object_unref0 (self->priv->serialStatusSignals[0]);
	self->priv->serialStatusSignals[0] = _tmp272_;
	_tmp273_ = builder;
	_tmp274_ = gtk_builder_get_object (_tmp273_, "labelStatusDSR");
	_tmp275_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp274_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (label);
	label = _tmp275_;
	_tmp276_ = label;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp276_, FALSE);
	_tmp277_ = label;
	_tmp278_ = _g_object_ref0 (_tmp277_);
	_g_object_unref0 (self->priv->serialStatusSignals[1]);
	self->priv->serialStatusSignals[1] = _tmp278_;
	_tmp279_ = builder;
	_tmp280_ = gtk_builder_get_object (_tmp279_, "labelStatusCD");
	_tmp281_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp280_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (label);
	label = _tmp281_;
	_tmp282_ = label;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp282_, FALSE);
	_tmp283_ = label;
	_tmp284_ = _g_object_ref0 (_tmp283_);
	_g_object_unref0 (self->priv->serialStatusSignals[2]);
	self->priv->serialStatusSignals[2] = _tmp284_;
	_tmp285_ = builder;
	_tmp286_ = gtk_builder_get_object (_tmp285_, "labelStatusCTS");
	_tmp287_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp286_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (label);
	label = _tmp287_;
	_tmp288_ = label;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp288_, FALSE);
	_tmp289_ = label;
	_tmp290_ = _g_object_ref0 (_tmp289_);
	_g_object_unref0 (self->priv->serialStatusSignals[3]);
	self->priv->serialStatusSignals[3] = _tmp290_;
	g_timeout_add_full (0, (guint) 200, (GSourceFunc) moserial_main_window_showSerialStatus, g_object_ref (self), g_object_unref);
	_tmp291_ = builder;
	_tmp292_ = gtk_builder_get_object (_tmp291_, "buttonDTR");
	_tmp293_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp292_, gtk_toggle_button_get_type (), GtkToggleButton));
	_g_object_unref0 (self->priv->dtrButton);
	self->priv->dtrButton = _tmp293_;
	_tmp294_ = self->priv->dtrButton;
	g_signal_connect_object (_tmp294_, "toggled", (GCallback) _moserial_main_window_toggleDTR_gtk_toggle_button_toggled, self, 0);
	_tmp295_ = self->priv->dtrButton;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp295_, _ ("Shows and toggles the DTR output (Data Terminal Ready)"));
	_tmp296_ = builder;
	_tmp297_ = gtk_builder_get_object (_tmp296_, "buttonRTS");
	_tmp298_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp297_, gtk_toggle_button_get_type (), GtkToggleButton));
	_g_object_unref0 (self->priv->rtsButton);
	self->priv->rtsButton = _tmp298_;
	_tmp299_ = self->priv->rtsButton;
	g_signal_connect_object (_tmp299_, "toggled", (GCallback) _moserial_main_window_toggleRTS_gtk_toggle_button_toggled, self, 0);
	_tmp300_ = self->priv->rtsButton;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp300_, _ ("Shows and toggles the RTS output (Request To Send)"));
	_tmp301_ = builder;
	_tmp302_ = gtk_builder_get_object (_tmp301_, "buttonIncomingClear");
	_tmp303_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp302_, gtk_button_get_type (), GtkButton));
	_g_object_unref0 (self->priv->incomingClearButton);
	self->priv->incomingClearButton = _tmp303_;
	_tmp304_ = self->priv->incomingClearButton;
	g_signal_connect_object (_tmp304_, "clicked", (GCallback) _moserial_main_window_clearIncoming_gtk_button_clicked, self, 0);
	_tmp305_ = self->priv->incomingClearButton;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp305_, _ ("Clear incoming text box"));
	_tmp306_ = builder;
	_tmp307_ = gtk_builder_get_object (_tmp306_, "buttonOutgoingClear");
	_tmp308_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp307_, gtk_button_get_type (), GtkButton));
	_g_object_unref0 (self->priv->outgoingClearButton);
	self->priv->outgoingClearButton = _tmp308_;
	_tmp309_ = self->priv->outgoingClearButton;
	g_signal_connect_object (_tmp309_, "clicked", (GCallback) _moserial_main_window_clearOutgoing_gtk_button_clicked, self, 0);
	_tmp310_ = self->priv->outgoingClearButton;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp310_, _ ("Clear outgoing text box"));
	_tmp311_ = self->priv->_startupProfileFilename;
	moserial_main_window_applyProfile (self, _tmp311_);
	_g_object_unref0 (label);
	_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,
                                 gpointer klass_data)
{
	moserial_main_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &moserialMainWindow_private_offset);
	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_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
moserial_main_window_instance_init (moserialMainWindow * self,
                                    gpointer klass)
{
	moserialSerialConnection* _tmp0_;
	moserialSerialStreamRecorder* _tmp1_;
	self->priv = moserial_main_window_get_instance_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;
}

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);
	_g_object_unref0 (self->priv->incomingClearButton);
	_g_object_unref0 (self->priv->outgoingClearButton);
	_g_object_unref0 (self->priv->dtrButton);
	_g_object_unref0 (self->priv->rtsButton);
	_g_object_unref0 (self->priv->incoming_signals);
	_g_object_unref0 (self->priv->outgoing_signals);
	_g_object_unref0 (self->priv->extraControlsCheck);
	gtk_recent_data_destroy (&self->priv->recentData);
	_vala_array_destroy (self->priv->serialStatusSignals, 4, (GDestroyNotify) g_object_unref);
	G_OBJECT_CLASS (moserial_main_window_parent_class)->finalize (obj);
}

static GType
moserial_main_window_get_type_once (void)
{
	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);
	moserialMainWindow_private_offset = g_type_add_instance_private (moserial_main_window_type_id, sizeof (moserialMainWindowPrivate));
	return moserial_main_window_type_id;
}

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)) {
		GType moserial_main_window_type_id;
		moserial_main_window_type_id = moserial_main_window_get_type_once ();
		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,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize 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,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

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

