New Upstream Release - gtkterm

Ready changes

Summary

Merged new upstream version: 1.9.1 (was: 1.2.1).

Resulting package

Built on 2023-06-03T14:51 (took 18m31s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-releases gtkterm-dbgsymapt install -t fresh-releases gtkterm

Lintian Result

Diff

diff --git a/NEWS b/NEWS
index 043cafc..d26dd62 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,3 @@
-1.2    : Searchbar added
-	 Load/save config from XDG_CONFIG_HOME
-
 1.1.1  : Fixed many typos (Thanks to Markus Hiereth)
 
 1.1    : Clear scrollbuffer option
diff --git a/README.md b/README.md
index 160e903..45afb70 100644
--- a/README.md
+++ b/README.md
@@ -50,8 +50,8 @@ You may find it useful to send these signals in your own firmware flashing scrip
 
 ## Installation
 GTKTerm has a few dependencies-
-* Gtk+3.0 (version 3.12 or higher)
-* vte (version 0.40 or higher)
+* Gtk+4.0 (version 4.6 or higher)
+* vte-gtk4 (version 0.68 or higher)
 * intltool (version 0.40.0 or higher)
 * libgudev (version 229 or higher)
 
diff --git a/README_source.md b/README_source.md
new file mode 100644
index 0000000..1786ae8
--- /dev/null
+++ b/README_source.md
@@ -0,0 +1,124 @@
+# GTKTerm: The source code architecture
+
+This file describes the architecture of GTKTerm.
+GtkTerm has several objects and uses signals to communicate between these 
+objects.
+
+One of the subgoals is not to use any global variables but exchange data
+by the use of signals. For that only the array of signals is a global
+variable.
+
+Use of GTKTerm/GtkTerm/gtkterm naming schema:
+In this document several ways of Upper/Lowercase combinations of GTKTerm is 
+used:
+- GTKTerm: The name of the application
+- GtkTerm: The first part of the name of the object in the source code. 
+For example: GtkTermWindow.
+- gtk_term: The first part of the function of an object in the source code.
+For example: gtkterm_window_init
+
+## General description
+
+GTKTerm is build with the GTK4 framework. It uses Gobjects and communicates 
+(mostly) through signals.
+
+GTKTerm is the main application object. It is a holder for the keyfile.
+The commandline interfaces uses the application object framework to handle
+all commandline options. The options are connected to the relevant GObjects by
+signals.
+Almost all objects have a 'public' and 'private' part. However the 'public' part
+is not globally known (except for GtkTerm application object).
+
+The core of the application is the terminal. This is a VTE object and 
+handles all communication to and from the serial port.
+The terminal window holds the configuration of the terminal window and 
+the serial ports.
+The configuraton is copied from the GtkTerm application which holds the 
+keyfile. It is copied back to the keyfile if it is saved.
+For now the GtkTerm application has just one terminal window. The architecture
+of GTKTerm is able to support multiple terminal windows in future releases.
+
+## Objects
+
+This part lists an overview of all objects used in GTKTerm. For details about
+implementation please use the GTKTERM.pdf which is a Doxygen generated overview
+of the GTKTerm source code.
+
+### GtkTerm
+
+GtkTerm is the main GtkApplication object for GTKTerm. It starts the gtkterm_window
+and handles the cmdline interface (CLI). Options given at the CLI are directly 
+stored into the in memory keyfile. 
+This in memory keyfile is the base for the configuration of the terminal windows. 
+Getting configuration for the terminal window is done by signals for the [section] 
+needed.
+
+#### Members
+#### Signals
+#### Main functions
+
+### GtkTermWindow
+
+GtkTermWindow is the main application window for GtkTerm. It creates all widgets
+and does the handling for the statusbar.
+
+#### Members
+#### Signals
+#### Main functions
+
+### GtkTermTerminal
+
+The terminal window in which all serial communication is shown. It is an VTE object
+and hold the configuration for the terminal and serial port.
+Each terminal window (just 1 for now) has only one serial interface which it connects 
+to. It has 2 USR signals for communication from scripts.
+The terminal communicates (transmit/receive) with the serial port through the GtkTermBuffer.
+
+#### Members
+#### Signals
+#### Main functions
+
+### GtkTermConfiguration
+
+GtkTerm does all operation on the keyfile. It loads, saves the file and removes, checks
+sections.
+It also copies the section configuration info the configuration for the terminal. 
+
+#### Members
+#### Signals
+#### Main functions
+
+### GtkTermSerialPort
+
+The Serial port object which does all communication to the serial port.
+It configures the port based on the port_conf from terminal. It has an in- and output
+stream to communicate with the serial device.
+
+#### Members
+#### Signals
+#### Main functions
+
+### GtkTermBuffer
+
+The buffer is the interface between the serial port and the terminal. The buffer receives
+the data from the serial port and 'translates' it to ASCII or HEX. 
+It gets notified from the serial port when nieuw data is recieved. After conversion and
+markup (CR/LF Timestamps) it notifies the terminal which can feed it to the vte.
+
+#### Members
+#### Signals
+#### Main functions
+
+## Resources
+
+For the migration to gtk4 several links were used:
+- https://docs.gtk.org/gobject/tutorial.html
+- https://docs.gtk.org/gobject/concepts.html
+- https://docs.gtk.org/glib/
+- https://toshiocp.github.io/Gtk4-tutorial/index.html
+- https://blogs.gnome.org/mcatanzaro/2022/07/27/common-glib-programming-errors/
+
+The gtk room on IRC was a big support when asking questions.
+
+Also special thanks to Jens Georg. Sellerie (an earlier fork of GTKTerm)
+was used as inspiration to solve some problems.
diff --git a/convert/gtkterm_conv.c b/convert/gtkterm_conv.c
new file mode 100644
index 0000000..eee22e9
--- /dev/null
+++ b/convert/gtkterm_conv.c
@@ -0,0 +1,74 @@
+#include <stdio.h>
+
+#include <gtk/gtk.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gprintf.h>
+#include <pango/pango-font.h>
+
+#include "gtkterm_struct.h"
+#include "resource_file_conv.h"
+#include "parsecfg.h"
+
+#include <config.h>
+
+//! load old config file with parsecfg
+//! Because we convert all sections we can walk trough all section numbers
+extern int load_old_configuration_from_file (int);
+extern cfgStruct cfg[];
+
+//! Define external variables here
+//! configuration for terminal window and serial port
+display_config_t term_conf;
+port_config_t port_conf;
+
+//! This is the cli version of the one in gtkterm
+void show_message (char * msg, int type) {
+	g_printf ("%s\n", msg);
+};
+
+int main (int argc, char **argv) {
+
+	int error = 0;
+	int i;
+	int section_count = 0;
+	GKeyFile *configrc;
+
+	//! Initialize for localization
+	bindtextdomain(PACKAGE, LOCALEDIR);
+	bind_textdomain_codeset(PACKAGE, "UTF-8");
+	textdomain(PACKAGE);
+
+	g_printf(_("\nGTKTerm version %s\n"), PACKAGE_VERSION);
+	g_printf(_("\t (c) Julien Schmitt\n"));
+	g_printf(_("\nThis program is released under the terms of the GPL V3 or later\n"));
+	g_printf(_("GTKTerm_conv converts the 1.x resource file (.gtktermrc) to 2.0 resource structure.\n\n"));
+
+	//! Check if the file exists
+	config_file_init ();
+
+	section_count  = cfgParse(g_file_get_path(config_file), cfg, CFG_INI);
+
+	for (i = 0; i < section_count; i++)
+		g_printf(_("Found section [%s]\n"), cfgSectionNumberToName(i));
+
+	g_printf("\n");
+
+	configrc  = g_key_file_new ();
+
+	for (i = 0; i < section_count; i++) {
+
+		g_printf(_("Converting section [%s]\n"), cfgSectionNumberToName(i));
+		//! load old config file with parsecfg
+		error = load_old_configuration_from_file (i);
+
+		if (error == 0) {
+			//! Copy the section into the '2.0' structure and save it
+			copy_configuration(configrc, cfgSectionNumberToName(i));
+		}
+	}
+
+	save_configuration_to_file(configrc);
+
+	g_key_file_unref (configrc);
+}
\ No newline at end of file
diff --git a/convert/gtkterm_struct.h b/convert/gtkterm_struct.h
new file mode 100644
index 0000000..892d972
--- /dev/null
+++ b/convert/gtkterm_struct.h
@@ -0,0 +1,57 @@
+
+#define DEFAULT_FONT "Monospace 12"
+#define DEFAULT_SCROLLBACK 10000
+
+#define DEFAULT_DELAY 		0
+#define DEFAULT_CHAR 		-1
+#define DEFAULT_DELAY_RS485 30
+#define DEFAULT_ECHO 		"false"
+#define DEFAULT_VISUAL_BELL "false"
+
+#define DEFAULT_PORT 	 "/dev/ttyS0"
+#define DEFAULT_BAUDRATE 115200
+#define DEFAULT_PARITY 	 "none"
+#define DEFAULT_BITS 	 8
+#define DEFAULT_STOPBITS 1
+#define DEFAULT_FLOW 	 "none"
+
+typedef struct
+{
+	char port[PATH_MAX];
+	long int baudrate;              // 300 - 600 - 1200 - ... - 2000000
+	int bits;                   	// 5 - 6 - 7 - 8
+	int stopbits;                   // 1 - 2
+	int parity;                 	// 0 : None, 1 : Odd, 2 : Even
+	int flow_control;               // 0 : None, 1 : Xon/Xoff, 2 : RTS/CTS, 3 : RS485halfduplex
+	int rs485_rts_time_before_transmit;
+	int rs485_rts_time_after_transmit;
+	char char_queue;            	// character in queue
+	bool disable_port_lock;
+
+} port_config_t;
+
+typedef struct
+{
+	bool block_cursor;
+	bool show_cursor;
+	char char_queue;             // character in queue
+	bool echo;               // echo local
+	bool auto_cr;           // line feed auto
+	bool auto_lf;           // return auto
+	bool timestamp;
+	int delay;                  // end of char delay: in ms
+	int rows;
+	int columns;
+	int scrollback;
+	bool visual_bell;
+	GdkRGBA foreground_color;
+	GdkRGBA background_color;
+	PangoFontDescription *font;
+	char *active_section;
+
+	char *default_filename;
+
+} display_config_t;
+
+extern display_config_t term_conf;
+extern port_config_t port_conf;
diff --git a/convert/macros.c b/convert/macros.c
new file mode 100644
index 0000000..217e74d
--- /dev/null
+++ b/convert/macros.c
@@ -0,0 +1,140 @@
+/***********************************************************************
+ * macros.c                                                         
+ * --------                                       
+ *           GTKTerm Software                        
+ *                      (c) Julien Schmitt         
+ *                                              
+ * -------------------------------------------------------------------
+ *                                            
+ *   \brief Purpose                                        
+ *      	Functions for the management of the macros  
+ *                                              
+ *   ChangeLog
+ *		- 2.0	 : Add conversion functions to/from string arrays                       
+ *      - 0.99.2 : Internationalization                 
+ *      - 0.99.0 : file creation by Julien
+ *                                                         
+ ***********************************************************************/
+
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkkeysyms.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "macros.h"
+
+#include <config.h>
+#include <glib/gi18n.h>
+
+/**\todo: Migrate to GObject */
+
+enum
+{
+	COLUMN_SHORTCUT,
+	COLUMN_ACTION,
+	NUM_COLUMNS
+};
+
+macro_t *macros = NULL;
+
+// Number of macro's
+int nr_of_macros = 0;
+
+int macro_count () {
+	return (nr_of_macros);
+}
+
+//! Convert the array of strings to macros
+void convert_string_to_macros (char **string_list, int size) {
+	char **strptr = string_list;
+	
+	// Remove existing macro's
+	remove_shortcuts ();
+
+	if (macros)
+		g_free(macros);
+
+	// Allocate memory size. To be sure we use the
+	// size of the array. We only need half.
+	macros = g_malloc(size * sizeof(macro_t));
+	nr_of_macros = 0;
+
+	// Copy into macro untill end of array
+	while  (*strptr) {
+		macros[nr_of_macros].shortcut = g_strdup(*strptr++);
+		macros[nr_of_macros++].action = g_strdup(*strptr++);
+	}
+}
+
+//! Convert the in memory macros to an array of strings
+//! for storage in file
+int convert_macros_to_string (char **string_list) {
+	char **strptr = string_list;
+
+	for (int i = 0; i < nr_of_macros; i++) {
+		*strptr++ = macros[i].shortcut;
+		*strptr++ = macros[i].action;
+	}
+
+	//! Must be NULL terminated
+	*strptr++ = NULL;
+
+	//! Number of strings is 2x the macros (shortcut and action)
+	return (nr_of_macros * 2);
+}
+
+static void macros_destroy(void)
+{
+	int i = 0;
+
+	if(macros == NULL)
+		return;
+
+	//! Free all macro-member memory
+	while(macros[i].shortcut != NULL)
+	{
+		g_free(macros[i].shortcut);
+		g_free(macros[i].action);
+		/*
+		    g_closure_unref(macros[i].closure);
+		*/
+		i++;
+	}
+
+	g_free(macros);
+	macros = NULL;
+}
+
+macro_t *get_shortcuts(int *size)
+{
+	int i = 0;
+
+	if(macros != NULL)
+	{
+		while(macros[i].shortcut != NULL)
+			i++;
+	}
+
+	*size = i;
+	
+	return macros;
+}
+
+void remove_shortcuts(void)
+{
+	int i = 0;
+
+	if(macros == NULL)
+		return;
+
+	while(macros[i].shortcut != NULL)
+	{
+//		gtk_accel_group_disconnect(shortcuts, macros[i].closure);
+		i++;
+	}
+
+	//! Clean up all macros
+	macros_destroy();
+}
\ No newline at end of file
diff --git a/convert/macros.h b/convert/macros.h
new file mode 100644
index 0000000..de72367
--- /dev/null
+++ b/convert/macros.h
@@ -0,0 +1,41 @@
+/***********************************************************************
+ * macros.h                                                            
+ * --------                                                            
+ *           GTKTerm Software                                          
+ *                      (c) Julien Schmitt                             
+ *                                                                     
+ * ------------------------------------------------------------------- 
+ *                                                                     
+ * \brief Purpose                                                    
+ *        Functions for the management of the macros                   
+ *        - Header file -                                               
+ *                                                                     
+ ***********************************************************************/
+
+#ifndef MACROS_H_
+#define MACROS_H_
+
+/** todo: Migrate to GObject */
+
+//! Define macro structure type
+typedef struct
+{
+	char *shortcut;		//!< Shortcut of the macro
+	char *action;		//!< Command to perform
+	GClosure *closure;	//!<
+}
+macro_t;
+
+//void config_macros(GtkAction *action, gpointer data);
+void remove_shortcuts(void); 				//!< Remove shortcuts from accel_group and free memory
+void add_shortcuts(void);					//!< 
+macro_t *get_shortcuts(gint *);				//!<
+
+void convert_string_to_macros (char **, int);
+int convert_macros_to_string (char **);
+
+int macro_count ();
+
+extern macro_t *macros;
+
+#endif
diff --git a/convert/meson.build b/convert/meson.build
new file mode 100644
index 0000000..cde7431
--- /dev/null
+++ b/convert/meson.build
@@ -0,0 +1,18 @@
+gtkterm_conv_sources = [
+	'gtkterm_conv.c',
+	'resource_file_conv.c',
+	'old_config.c',
+	'parsecfg.c',
+	'macros.c'
+]
+
+executable(
+	'gtkterm_conv', 
+	[gtkterm_conv_sources],
+	export_dynamic : true,
+	dependencies : [
+		gtk_deps,
+		config,
+	],
+	install : true
+)
diff --git a/convert/old_config.c b/convert/old_config.c
new file mode 100644
index 0000000..0d4641e
--- /dev/null
+++ b/convert/old_config.c
@@ -0,0 +1,239 @@
+#include <stdio.h>
+
+#include <gtk/gtk.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gprintf.h>
+#include <pango/pango-font.h>
+#include "parsecfg.h"
+#include "macros.h"
+#include "gtkterm_struct.h"
+#include "resource_file_conv.h"
+
+extern int nr_of_macros;
+
+/* Configuration file variables */
+char **port;
+int *speed;
+int *bits;
+int *stopbits;
+char **parity;
+char **flow;
+int *wait_delay;
+int *wait_char;
+int *rts_time_before_tx;
+int *rts_time_after_tx;
+int *echo;
+int *crlfauto;
+int *timestamp;
+cfgList **macro_list = NULL;
+char **font;
+
+int *block_cursor;
+int *rows;
+int *columns;
+int *scrollback;
+int *visual_bell;
+float *foreground_red;
+float *foreground_blue;
+float *foreground_green;
+float *foreground_alpha;
+float *background_red;
+float *background_blue;
+float *background_green;
+float *background_alpha;
+
+cfgStruct cfg[] =
+{
+    {"port", CFG_STRING, &port},
+    {"speed", CFG_INT, &speed},
+    {"bits", CFG_INT, &bits},
+    {"stopbits", CFG_INT, &stopbits},
+    {"parity", CFG_STRING, &parity},
+    {"flow", CFG_STRING, &flow},
+    {"wait_delay", CFG_INT, &wait_delay},
+    {"wait_char", CFG_INT, &wait_char},
+    {"rs485_rts_time_before_tx", CFG_INT, &rts_time_before_tx},
+    {"rs485_rts_time_after_tx", CFG_INT, &rts_time_after_tx},
+    {"echo", CFG_BOOL, &echo},
+    {"crlfauto", CFG_BOOL, &crlfauto},
+    {"timestamp", CFG_BOOL, &timestamp},
+    {"font", CFG_STRING, &font},
+    {"macros", CFG_STRING_LIST, &macro_list},
+    {"term_block_cursor", CFG_BOOL, &block_cursor},
+    {"term_rows", CFG_INT, &rows},
+    {"term_columns", CFG_INT, &columns},
+    {"term_scrollback", CFG_INT, &scrollback},
+    {"term_visual_bell", CFG_BOOL, &visual_bell},
+    {"term_foreground_red", CFG_FLOAT, &foreground_red},
+    {"term_foreground_blue", CFG_FLOAT, &foreground_blue},
+    {"term_foreground_green", CFG_FLOAT, &foreground_green},
+    {"term_foreground_alpha", CFG_FLOAT, &foreground_alpha},
+    {"term_background_red", CFG_FLOAT, &background_red},
+    {"term_background_blue", CFG_FLOAT, &background_blue},
+    {"term_background_green", CFG_FLOAT, &background_green},
+    {"term_background_alpha", CFG_FLOAT, &background_alpha},
+    {NULL, CFG_END, NULL}
+};
+
+//! Proberbly we only need it for old_config
+//! So can be removed from gtkterm
+void create_shortcuts(macro_t *macro, int size)
+{
+	macros = g_malloc((size + 1) * sizeof(macro_t));
+	if(macros != NULL)
+	{
+		memcpy(macros, macro, size * sizeof(macro_t));
+		macros[size].shortcut = NULL;
+		macros[size].action = NULL;
+
+		nr_of_macros = size;
+	}
+	else
+		perror("malloc");
+}
+
+int load_old_configuration_from_file(int section_nr)
+{
+	int j, k, size;
+	char *str;
+	macro_t *macros = NULL;
+	cfgList *t;
+
+	hard_default_configuration();
+
+	if(port[section_nr] != NULL)
+		strcpy(port_conf.port, port[section_nr]);
+	if(speed[section_nr] != 0)
+		port_conf.baudrate = speed[section_nr];
+	if(bits[section_nr] != 0)
+		port_conf.bits = bits[section_nr];
+	if(stopbits[section_nr] != 0)
+		port_conf.stopbits = stopbits[section_nr];
+	if(parity[section_nr] != NULL)
+	{
+		if(!g_ascii_strcasecmp(parity[section_nr], "none"))
+			port_conf.parity = 0;
+		else if(!g_ascii_strcasecmp(parity[section_nr], "odd"))
+			port_conf.parity = 1;
+		else if(!g_ascii_strcasecmp(parity[section_nr], "even"))
+			port_conf.parity = 2;
+	}
+	if(flow[section_nr] != NULL)
+	{
+		if(!g_ascii_strcasecmp(flow[section_nr], "none"))
+			port_conf.flow_control = 0;
+		else if(!g_ascii_strcasecmp(flow[section_nr], "xon"))
+			port_conf.flow_control = 1;
+		else if(!g_ascii_strcasecmp(flow[section_nr], "rts"))
+			port_conf.flow_control = 2;
+		else if(!g_ascii_strcasecmp(flow[section_nr], "rs485"))
+			port_conf.flow_control = 3;
+	}
+
+	term_conf.delay = wait_delay[section_nr];
+
+	if(wait_char[section_nr] != 0)
+		term_conf.char_queue = (signed char)wait_char[section_nr];
+	else
+		term_conf.char_queue = -1;
+
+	port_conf.rs485_rts_time_before_transmit = rts_time_before_tx[section_nr];
+	port_conf.rs485_rts_time_after_transmit = rts_time_after_tx[section_nr];
+
+	if(echo[section_nr] != -1)
+		term_conf.echo = (gboolean)echo[section_nr];
+	else
+		term_conf.echo = FALSE;
+
+	if(crlfauto[section_nr] != -1) {
+		term_conf.auto_lf = (gboolean)crlfauto[section_nr];
+		term_conf.auto_cr = (gboolean)crlfauto[section_nr];
+	}
+	else {
+		term_conf.auto_lf = FALSE;
+		term_conf.auto_cr = FALSE;
+	}
+
+	if(timestamp[section_nr] != -1)
+		term_conf.timestamp = (gboolean)timestamp[section_nr];
+	else
+		term_conf.timestamp = FALSE;
+
+	if (term_conf.font != NULL)
+		g_clear_pointer (&term_conf.font, pango_font_description_free);
+	term_conf.font = pango_font_description_from_string(font[section_nr]);
+
+	// remove old macro's and free memory
+	remove_shortcuts ();
+
+	t = macro_list[section_nr];
+	size = 0;
+	if(t != NULL)
+	{
+		size++;
+		while(t->next != NULL)
+		{
+			t = t->next;
+			size++;
+		}
+	}
+
+	if(size != 0)
+	{
+		t = macro_list[section_nr];
+		macros = g_malloc(size * sizeof(macro_t));
+		if(macros == NULL)
+		{
+			perror("malloc");
+			return -1;
+		}
+		for(j = 0; j < size; j++)
+		{
+			for(k = 0; k < (strlen(t->str) - 1); k++)
+			{
+				if((t->str[k] == ':') && (t->str[k + 1] == ':'))
+					break;
+			}
+			macros[j].shortcut = g_strndup(t->str, k);
+			str = &(t->str[k + 2]);
+			macros[j].action = g_strdup(str);
+
+			t = t->next;
+		}
+	}
+
+	create_shortcuts(macros, size);
+	g_free(macros);
+
+	if(block_cursor[section_nr] != -1)
+		term_conf.block_cursor = (gboolean)block_cursor[section_nr];
+	else
+		term_conf.block_cursor = TRUE;
+
+	if(rows[section_nr] != 0)
+		term_conf.rows = rows[section_nr];
+
+	if(columns[section_nr] != 0)
+		term_conf.columns = columns[section_nr];
+
+	if(scrollback[section_nr] != 0)
+		term_conf.scrollback = scrollback[section_nr];
+
+	if(visual_bell[section_nr] != -1)
+		term_conf.visual_bell = (gboolean)visual_bell[section_nr];
+	else
+		term_conf.visual_bell = FALSE;
+
+	term_conf.foreground_color.red = foreground_red[section_nr];
+	term_conf.foreground_color.green = foreground_green[section_nr];
+	term_conf.foreground_color.blue = foreground_blue[section_nr];
+	term_conf.foreground_color.alpha = foreground_alpha[section_nr];
+
+	term_conf.background_color.red = background_red[section_nr];
+	term_conf.background_color.green = background_green[section_nr];
+	term_conf.background_color.blue = background_blue[section_nr];
+	term_conf.background_color.alpha = background_alpha[section_nr];
+
+	return 0;
+}
\ No newline at end of file
diff --git a/src/parsecfg.c b/convert/parsecfg.c
similarity index 97%
rename from src/parsecfg.c
rename to convert/parsecfg.c
index e4ea717..37d867d 100644
--- a/src/parsecfg.c
+++ b/convert/parsecfg.c
@@ -36,10 +36,10 @@
 #include <locale.h>
 
 #include "parsecfg.h"
-#include "i18n.h"
 
 #include <config.h>
 #include <glib/gi18n.h>
+#include <glib/gprintf.h>
 
 /* proto type declaration of private functions */
 
@@ -352,42 +352,42 @@ static void cfgFatalFunc(cfgErrorCode error_code, const char *file, int line, co
 	switch (error_code)
 	{
 	case CFG_OPEN_FAIL:
-		i18n_fprintf(stderr, _("Cannot open configuration file `%s'.\n"), file);
+		g_fprintf(stderr, _("Cannot open configuration file `%s'.\n"), file);
 		break;
 	case CFG_CREATE_FAIL:
-		i18n_fprintf(stderr, _("Cannot create configuration file `%s'.\n"), file);
+		g_fprintf(stderr, _("Cannot create configuration file `%s'.\n"), file);
 		break;
 	case CFG_SYNTAX_ERROR:
-		i18n_fprintf(stderr, _("%s(%d): %s\nSyntax error\n"), file, line, str);
+		g_fprintf(stderr, _("%s(%d): %s\nSyntax error\n"), file, line, str);
 		break;
 	case CFG_WRONG_PARAMETER:
-		i18n_fprintf(stderr, _("%s(%d): %s\nUnrecognized parameter\n"), file, line, str);
+		g_fprintf(stderr, _("%s(%d): %s\nUnrecognized parameter\n"), file, line, str);
 		break;
 	case CFG_INTERNAL_ERROR:
-		i18n_fprintf(stderr, _("%s(%d): %s\nInternal error\n"), file, line, str);
+		g_fprintf(stderr, _("%s(%d): %s\nInternal error\n"), file, line, str);
 		break;
 	case CFG_INVALID_NUMBER:
-		i18n_fprintf(stderr, _("%s(%d): %s\nInvalid number\n"), file, line, str);
+		g_fprintf(stderr, _("%s(%d): %s\nInvalid number\n"), file, line, str);
 		break;
 	case CFG_OUT_OF_RANGE:
-		i18n_fprintf(stderr, _("%s(%d): %s\nOut of range\n"), file, line, str);
+		g_fprintf(stderr, _("%s(%d): %s\nOut of range\n"), file, line, str);
 		break;
 	case CFG_MEM_ALLOC_FAIL:
-		i18n_fprintf(stderr, _("%s(%d): %s\nCannot allocate memory.\n"), file, line, str);
+		g_fprintf(stderr, _("%s(%d): %s\nCannot allocate memory.\n"), file, line, str);
 		break;
 	case CFG_BOOL_ERROR:
-		i18n_fprintf(stderr, _("%s(%d): %s\nIt must be specified TRUE or FALSE.\n"), file, line, str);
+		g_fprintf(stderr, _("%s(%d): %s\nIt must be specified TRUE or FALSE.\n"), file, line, str);
 		break;
 	case CFG_USED_SECTION:
-		i18n_fprintf(stderr, _("%s(%d): %s\nThe section name is already used.\n"), file, line, str);
+		g_fprintf(stderr, _("%s(%d): %s\nThe section name is already used.\n"), file, line, str);
 		break;
 	case CFG_NO_CLOSING_BRACE:
-		i18n_fprintf(stderr, _("%s(%d)\nThere is no closing bracket.\n"), file, line);
+		g_fprintf(stderr, _("%s(%d)\nThere is no closing bracket.\n"), file, line);
 		break;
 	case CFG_JUST_RETURN_WITHOUT_MSG:
 		break;
 	default:
-		i18n_fprintf(stderr, _("%s(%d): %s\nUnexplained error\n"), file, line, str);
+		g_fprintf(stderr, _("%s(%d): %s\nUnexplained error\n"), file, line, str);
 	}
 }
 
diff --git a/src/parsecfg.h b/convert/parsecfg.h
similarity index 100%
rename from src/parsecfg.h
rename to convert/parsecfg.h
diff --git a/convert/resource_file_conv.c b/convert/resource_file_conv.c
new file mode 100644
index 0000000..a685a05
--- /dev/null
+++ b/convert/resource_file_conv.c
@@ -0,0 +1,596 @@
+/***********************************************************************
+ * resource_config.c                                 
+ * -----------------                                    
+ *           GTKTerm Software                              
+ *                      (c) Julien Schmitt  
+ *                                              
+ * ------------------------------------------------------------------- 
+ *                                           
+ *   \brief Purpose                               
+ *      Save and load configuration from resource file          
+ *                                              
+ *   ChangeLog                                
+ *      - 2.0 : Remove parsecfg. Switch to GKeyFile  
+ *              Migration done by Jens Georg (phako)       
+ *                                                                
+ ***********************************************************************/
+
+#include <stdio.h>
+#include <sys/stat.h>
+#include <gtk/gtk.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gprintf.h>
+#include <pango/pango-font.h>
+
+#include <config.h>
+
+#include "gtkterm_struct.h"
+#include "resource_file_conv.h"
+#include "macros.h"
+
+//! Default configuration filename
+#define CONFIGURATION_FILENAME ".gtktermrc"
+#define CONFIGURATION_FILENAME_V1 ".gtktermrc.v1"
+//! The key file
+GFile *config_file;
+
+//! Define all configuration items which are used
+//! in the resource file. it is an index to ConfigurationItem.
+enum {
+		CONF_ITEM_SERIAL_PORT,
+		CONF_ITEM_SERIAL_BAUDRATE,
+		CONF_ITEM_SERIAL_BITS,
+		CONF_ITEM_SERIAL_STOPBITS,
+		CONF_ITEM_SERIAL_PARITY,
+		CONF_ITEM_SERIAL_FLOW_CONTROL,
+		CONF_ITEM_TERM_WAIT_DELAY,
+		CONF_ITEM_TERM_WAIT_CHAR,
+		CONF_ITEM_SERIAL_RS485_RTS_TIME_BEFORE_TX,
+		CONF_ITEM_SERIAL_RS485_RTS_TIME_AFTER_TX,
+		CONF_ITEM_TERM_MACROS,
+		CONF_ITEM_TERM_RAW_FILENAME,
+		CONF_ITEM_TERM_ECHO,
+		CONF_ITEM_TERM_AUTO_LF,
+		CONF_ITEM_TERM_AUTO_CR,
+		CONF_ITEM_SERIAL_DISABLE_PORT_LOCK,
+		CONF_ITEM_TERM_FONT,
+		CONF_ITEM_TERM_TIMESTAMP,		
+		CONF_ITEM_TERM_BLOCK_CURSOR,		
+		CONF_ITEM_TERM_SHOW_CURSOR,
+		CONF_ITEM_TERM_ROWS,
+		CONF_ITEM_TERM_COLS,
+		CONF_ITEM_TERM_SCROLLBACK,
+		CONF_ITEM_TERM_VISUAL_BELL,		
+		CONF_ITEM_TERM_FOREGROUND_RED,
+		CONF_ITEM_TERM_FOREGROUND_GREEN,
+		CONF_ITEM_TERM_FOREGROUND_BLUE,
+		CONF_ITEM_TERM_FOREGROUND_ALPHA,
+		CONF_ITEM_TERM_BACKGROUND_RED,
+		CONF_ITEM_TERM_BACKGROUND_GREEN,
+		CONF_ITEM_TERM_BACKGROUND_BLUE,
+		CONF_ITEM_TERM_BACKGROUND_ALPHA,	
+		CONF_ITEM_LAST						//! Checking as last item in the list.
+};
+
+// Used configuration options to hold consistency between load/save functions
+const char ConfigurationItem [][32] = {
+		"port",
+		"baudrate",
+		"bits",
+		"stopbits",
+		"parity",
+		"flow_control",
+		"term_wait_delay",
+		"term_wait_char",
+		"rs485_rts_time_before_tx",
+		"rs485_rts_time_after_tx",
+		"macros",
+		"term_raw_filename",		
+		"term_echo",
+		"term_auto_lf",
+		"term_auto_cr",
+		"disable_port_lock",
+		"term_font",
+		"term_show_timestamp",
+		"term_block_cursor",				
+		"term_show_cursor",
+		"term_rows",
+		"term_columns",
+		"term_scrollback",
+		"term_visual_bell",
+		"term_foreground_red",
+		"term_foreground_green",
+		"term_foreground_blue",
+		"term_foreground_alpha",
+		"term_background_red",
+		"term_background_green",
+		"term_background_blue",
+		"term_background_alpha",
+};
+
+void config_file_init(void) {
+	/*
+	 * Old location of configuration file was $HOME/.gtktermrc
+	 * New location is $XDG_CONFIG_HOME/.gtktermrc
+	 *
+	 * If configuration file exists at new location, use that one.
+	 * Otherwise, if file exists at old location, move file to new location.
+	 *
+         * Version 2.0: Because we have to use gtkterm_conv, the file is always at
+	 * the user directory. So we can skip eventually moving the file.
+	 */
+	GFile *config_file_old = g_file_new_build_filename(getenv("HOME"), CONFIGURATION_FILENAME, NULL);
+	GFile *config_file_v1 = g_file_new_build_filename(g_get_user_config_dir(), CONFIGURATION_FILENAME_V1, NULL);
+	config_file = g_file_new_build_filename(g_get_user_config_dir(), CONFIGURATION_FILENAME, NULL);
+
+	if (!g_file_query_exists(config_file, NULL) && g_file_query_exists(config_file_old, NULL))
+		g_file_move(config_file_old, config_file, G_FILE_COPY_NONE, NULL, NULL, NULL, NULL);
+
+	// Save the original file
+	g_printf(_("Your original file will be backuped to %s\n"), g_file_get_path (config_file_v1));
+	g_file_copy(config_file, config_file_v1, G_FILE_COPY_BACKUP, NULL, NULL, NULL, NULL);
+}
+
+/* Save <section> configuration to file */
+void save_configuration_to_file(GKeyFile *config) {
+	GError *error = NULL;
+
+	g_key_file_save_to_file (config, g_file_get_path(config_file), &error);
+
+}
+
+/* Load the configuration from <section> into the port and term config */
+/* If it does not exists it creates one from the defaults              */
+int load_configuration_from_file(const char *section) {
+	GKeyFile *config_object = NULL;
+	GError *error = NULL;
+	char *str = NULL;
+	char **macrostring;
+	gsize nr_of_strings;
+	int value = 0;
+
+	char *string = NULL;
+
+	//! Load the key file
+	//! Note: all sections are loaded into memory.
+	config_object = g_key_file_new ();
+	if (!g_key_file_load_from_file (config_object, g_file_get_path (config_file), G_KEY_FILE_NONE, &error)) {
+		g_debug ("Failed to load configuration file: %s", error->message);
+		g_error_free (error);
+		g_key_file_unref (config_object);
+
+		return -1;
+	}
+
+	//! Check if the <section> exists in the key file.
+	if (!g_key_file_has_group (config_object, section)) {
+		string = g_strdup_printf(_("No section \"%s\" in configuration file\n"), section);
+		show_message(string, GTK_MESSAGE_ERROR);
+		g_free(string);
+		g_key_file_unref (config_object);
+		return -1;
+	}
+
+	//! First initialize with a default structure.
+	//! Not really needed.
+	hard_default_configuration();
+
+	// Load all key file items into the port_conf or term_conf so we can use it 
+	str = g_key_file_get_string (config_object, section, ConfigurationItem[CONF_ITEM_SERIAL_PORT], NULL);
+	if (str != NULL) {
+		g_strlcpy (port_conf.port, str, sizeof (port_conf.port) - 1);
+		g_free (str);
+	}
+
+	value = g_key_file_get_integer (config_object, section, ConfigurationItem[CONF_ITEM_SERIAL_BAUDRATE], NULL);
+	if (value != 0) {
+		port_conf.baudrate = value;
+	}
+
+	value = g_key_file_get_integer (config_object, section, ConfigurationItem[CONF_ITEM_SERIAL_BITS], NULL);
+	if (value != 0) {
+		port_conf.bits = value;
+	}
+
+	value = g_key_file_get_integer (config_object, section, ConfigurationItem[CONF_ITEM_SERIAL_STOPBITS], NULL);
+	if (value != 0) {
+		port_conf.stopbits = value;
+	}
+
+	str = g_key_file_get_string (config_object, section, ConfigurationItem[CONF_ITEM_SERIAL_PARITY], NULL);
+	if (str != NULL) {
+		if(!g_ascii_strcasecmp(str, "none"))
+			port_conf.parity = 0;
+		else if(!g_ascii_strcasecmp(str, "odd"))
+			port_conf.parity = 1;
+		else if(!g_ascii_strcasecmp(str, "even"))
+			port_conf.parity = 2;
+		g_free (str);
+	}
+
+	str = g_key_file_get_string (config_object, section,  ConfigurationItem[CONF_ITEM_SERIAL_FLOW_CONTROL], NULL);
+	if (str != NULL) {
+		if(!g_ascii_strcasecmp(str, "none"))
+			port_conf.flow_control = 0;
+		else if(!g_ascii_strcasecmp(str, "xon"))
+			port_conf.flow_control = 1;
+		else if(!g_ascii_strcasecmp(str, "rts"))
+			port_conf.flow_control = 2;
+		else if(!g_ascii_strcasecmp(str, "rs485"))
+			port_conf.flow_control = 3;
+    		
+		g_free (str);
+	}
+
+	term_conf.delay = g_key_file_get_integer (config_object, section, ConfigurationItem[CONF_ITEM_TERM_WAIT_DELAY], NULL);
+
+	value = g_key_file_get_integer (config_object, section, ConfigurationItem[CONF_ITEM_TERM_WAIT_CHAR], NULL);
+	if (value != 0) {
+		term_conf.char_queue = (signed char) value;
+	} else {
+		term_conf.char_queue = -1;
+	}
+    
+	port_conf.rs485_rts_time_before_transmit = g_key_file_get_integer (config_object, section, ConfigurationItem[CONF_ITEM_SERIAL_RS485_RTS_TIME_BEFORE_TX], NULL);
+	port_conf.rs485_rts_time_after_transmit = g_key_file_get_integer (config_object, section, ConfigurationItem[CONF_ITEM_SERIAL_RS485_RTS_TIME_AFTER_TX], NULL);
+	term_conf.echo = g_key_file_get_boolean (config_object, section, ConfigurationItem[CONF_ITEM_TERM_ECHO], NULL);
+	term_conf.auto_cr = g_key_file_get_boolean (config_object, section, ConfigurationItem[CONF_ITEM_TERM_AUTO_CR], NULL);
+	term_conf.auto_lf = g_key_file_get_boolean (config_object, section, ConfigurationItem[CONF_ITEM_TERM_AUTO_LF], NULL);
+	port_conf.disable_port_lock = g_key_file_get_boolean (config_object, section, ConfigurationItem[CONF_ITEM_SERIAL_DISABLE_PORT_LOCK], NULL);
+
+	//! The Font is a Pango structure. This only can be added to a terminal
+	//! So we have to convert it.
+	g_clear_pointer (&term_conf.font, pango_font_description_free);
+	str = g_key_file_get_string (config_object, section, ConfigurationItem[CONF_ITEM_TERM_FONT], NULL);
+	term_conf.font = pango_font_description_from_string (str);
+	g_free (str);
+
+	/// Convert the stringlist to macros. Existing shortcuts will be delete from convert_string_to_macros
+	macrostring = g_key_file_get_string_list (config_object, section, ConfigurationItem[CONF_ITEM_TERM_MACROS], &nr_of_strings, NULL);
+	convert_string_to_macros (macrostring, nr_of_strings);
+	g_strfreev(macrostring);
+
+	term_conf.show_cursor = g_key_file_get_boolean (config_object, section, ConfigurationItem[CONF_ITEM_TERM_SHOW_CURSOR], NULL);
+	term_conf.rows = g_key_file_get_integer (config_object, section, ConfigurationItem[CONF_ITEM_TERM_ROWS], NULL);
+	term_conf.columns = g_key_file_get_integer (config_object, section, ConfigurationItem[CONF_ITEM_TERM_COLS], NULL);
+	value = g_key_file_get_integer (config_object, section, ConfigurationItem[CONF_ITEM_TERM_SCROLLBACK], NULL);
+	if (value != 0) {
+		term_conf.scrollback = value;
+	}
+
+	term_conf.visual_bell = g_key_file_get_boolean (config_object, section, ConfigurationItem[CONF_ITEM_TERM_VISUAL_BELL], NULL);
+	term_conf.foreground_color.red = g_key_file_get_double (config_object, section, ConfigurationItem[CONF_ITEM_TERM_FOREGROUND_RED], NULL);
+	term_conf.foreground_color.green = g_key_file_get_double (config_object, section, ConfigurationItem[CONF_ITEM_TERM_FOREGROUND_GREEN], NULL);
+	term_conf.foreground_color.blue = g_key_file_get_double (config_object, section, ConfigurationItem[CONF_ITEM_TERM_FOREGROUND_BLUE], NULL);
+	term_conf.foreground_color.alpha = g_key_file_get_double (config_object, section, ConfigurationItem[CONF_ITEM_TERM_FOREGROUND_ALPHA], NULL);
+	term_conf.background_color.red = g_key_file_get_double (config_object, section, ConfigurationItem[CONF_ITEM_TERM_BACKGROUND_RED], NULL);
+	term_conf.background_color.green = g_key_file_get_double (config_object, section, ConfigurationItem[CONF_ITEM_TERM_BACKGROUND_GREEN], NULL);
+	term_conf.background_color.blue = g_key_file_get_double (config_object, section, ConfigurationItem[CONF_ITEM_TERM_BACKGROUND_BLUE], NULL);
+	term_conf.background_color.alpha = g_key_file_get_double (config_object, section, ConfigurationItem[CONF_ITEM_TERM_BACKGROUND_ALPHA], NULL);
+
+	return 0;
+}
+
+//! This checks if the configuration file exists. If not it creates a
+//! new [default]
+int check_configuration_file(void)
+{
+	struct stat my_stat;
+	char *string = NULL;
+
+	/* is configuration file present ? */
+	if(stat(g_file_get_path(config_file), &my_stat) == 0)
+	{
+		/* If bad configuration file, fallback to _hardcoded_ defaults! */
+		if(load_configuration_from_file("default") == -1)
+		{
+			hard_default_configuration();
+			return -1;
+		}
+	} /* if not, create it, with the [default] section */
+	else
+	{
+		GKeyFile *config;
+
+		string = g_strdup_printf(_("Configuration file (%s) with [default] configuration has been created.\n"), g_file_get_path(config_file));
+		show_message(string, GTK_MESSAGE_WARNING);
+		g_free(string);
+
+		config = g_key_file_new ();
+		hard_default_configuration();
+
+		//! Put the new default in the key file
+		copy_configuration(config, "default");
+
+		//! And save the config to file
+		save_configuration_to_file(config);		
+
+		g_key_file_unref (config);
+	}
+
+	return 0;
+}
+
+//! Copy the active configuration into <section> of the Key file
+void copy_configuration(GKeyFile *configrc, const char *section)
+{
+	char *string = NULL;
+	char **string_list = NULL;
+	gsize nr_of_strings = 0;
+
+	g_key_file_set_string (configrc, section, ConfigurationItem[CONF_ITEM_SERIAL_PORT], port_conf.port);
+	g_key_file_set_integer (configrc, section, ConfigurationItem[CONF_ITEM_SERIAL_BAUDRATE], port_conf.baudrate);
+	g_key_file_set_integer (configrc, section, ConfigurationItem[CONF_ITEM_SERIAL_BITS], port_conf.bits);
+	g_key_file_set_integer (configrc, section, ConfigurationItem[CONF_ITEM_SERIAL_STOPBITS], port_conf.stopbits);
+
+	switch(port_conf.parity)
+	{
+		case 0:
+			string = g_strdup_printf("none");
+			break;
+		case 1:
+			string = g_strdup_printf("odd");
+			break;
+		case 2:
+			string = g_strdup_printf("even");
+			break;
+		default:
+		    string = g_strdup_printf("none");
+	}
+
+	g_key_file_set_string (configrc, section, ConfigurationItem[CONF_ITEM_SERIAL_PARITY], string);
+	g_free(string);
+
+	switch(port_conf.flow_control)
+	{
+		case 0:
+			string = g_strdup_printf("none");
+			break;
+		case 1:
+			string = g_strdup_printf("xon");
+			break;
+		case 2:
+			string = g_strdup_printf("rts");
+			break;
+		case 3:
+			string = g_strdup_printf("rs485");
+			break;
+		default:
+			string = g_strdup_printf("none");
+	}
+
+	g_key_file_set_string (configrc, section, ConfigurationItem[CONF_ITEM_SERIAL_FLOW_CONTROL], string);
+	g_free(string);
+
+	g_key_file_set_integer (configrc, section, ConfigurationItem[CONF_ITEM_TERM_WAIT_DELAY], term_conf.delay);
+	g_key_file_set_integer (configrc, section, ConfigurationItem[CONF_ITEM_TERM_WAIT_CHAR], term_conf.char_queue);
+	g_key_file_set_integer (configrc, section, ConfigurationItem[CONF_ITEM_SERIAL_RS485_RTS_TIME_BEFORE_TX],
+    	                        port_conf.rs485_rts_time_before_transmit);
+	g_key_file_set_integer (configrc, section, ConfigurationItem[CONF_ITEM_SERIAL_RS485_RTS_TIME_AFTER_TX],
+    	                        port_conf.rs485_rts_time_after_transmit);
+
+	g_key_file_set_boolean (configrc, section, ConfigurationItem[CONF_ITEM_TERM_ECHO], term_conf.echo);
+	g_key_file_set_boolean (configrc, section, ConfigurationItem[CONF_ITEM_TERM_AUTO_LF], term_conf.auto_lf);
+	g_key_file_set_boolean (configrc, section, ConfigurationItem[CONF_ITEM_TERM_AUTO_CR], term_conf.auto_cr);
+	g_key_file_set_boolean (configrc, section, ConfigurationItem[CONF_ITEM_SERIAL_DISABLE_PORT_LOCK], port_conf.disable_port_lock);
+
+	string = pango_font_description_to_string (term_conf.font);
+	g_key_file_set_string (configrc, section, ConfigurationItem[CONF_ITEM_TERM_FONT], string);
+	g_free(string);
+
+	//! Macros are an array of strings, so we have to convert it
+	//! All macros ends up in the string_list
+	string_list = g_malloc ( macro_count () * sizeof (char *) * 2 + 1);
+	nr_of_strings = convert_macros_to_string (string_list);
+	g_key_file_set_string_list (configrc, section, ConfigurationItem[CONF_ITEM_TERM_MACROS], (const char * const*) string_list, nr_of_strings);
+	g_free(string_list);	
+
+	g_key_file_set_boolean (configrc, section, ConfigurationItem[CONF_ITEM_TERM_SHOW_CURSOR], term_conf.show_cursor);
+	g_key_file_set_boolean (configrc, section, ConfigurationItem[CONF_ITEM_TERM_BLOCK_CURSOR], term_conf.block_cursor);	
+	g_key_file_set_integer (configrc, section, ConfigurationItem[CONF_ITEM_TERM_ROWS], term_conf.rows);
+	g_key_file_set_integer (configrc, section, ConfigurationItem[CONF_ITEM_TERM_COLS], term_conf.columns);
+	g_key_file_set_integer (configrc, section, ConfigurationItem[CONF_ITEM_TERM_SCROLLBACK], term_conf.scrollback);
+	g_key_file_set_boolean (configrc, section, ConfigurationItem[CONF_ITEM_TERM_VISUAL_BELL], term_conf.visual_bell);
+	g_key_file_set_boolean (configrc, section, ConfigurationItem[CONF_ITEM_TERM_TIMESTAMP], term_conf.timestamp);	
+
+	g_key_file_set_double (configrc, section, ConfigurationItem[CONF_ITEM_TERM_FOREGROUND_RED], term_conf.foreground_color.red);
+	g_key_file_set_double (configrc, section, ConfigurationItem[CONF_ITEM_TERM_FOREGROUND_GREEN], term_conf.foreground_color.green);
+	g_key_file_set_double (configrc, section, ConfigurationItem[CONF_ITEM_TERM_FOREGROUND_BLUE], term_conf.foreground_color.blue);
+	g_key_file_set_double (configrc, section, ConfigurationItem[CONF_ITEM_TERM_FOREGROUND_ALPHA], term_conf.foreground_color.alpha);
+
+	g_key_file_set_double (configrc, section, ConfigurationItem[CONF_ITEM_TERM_BACKGROUND_RED], term_conf.background_color.red);
+	g_key_file_set_double (configrc, section, ConfigurationItem[CONF_ITEM_TERM_BACKGROUND_GREEN], term_conf.background_color.green);
+	g_key_file_set_double (configrc, section, ConfigurationItem[CONF_ITEM_TERM_BACKGROUND_BLUE], term_conf.background_color.blue);
+	g_key_file_set_double (configrc, section, ConfigurationItem[CONF_ITEM_TERM_BACKGROUND_ALPHA], term_conf.background_color.alpha);
+}
+
+/*!
+ * Remove a section from the file
+ * \todo: Perhaps remove because we dont need it.
+ */ 
+int remove_section(char *cfg_file, char *section)
+{
+	FILE *f = NULL;
+	char *buffer = NULL;
+	char *buf;
+	size_t size;
+	char *to_search;
+	size_t i, j, length, sect;
+
+	f = fopen(cfg_file, "r");
+	if(f == NULL)
+	{
+		perror(cfg_file);
+		return -1;
+	}
+
+	fseek(f, 0L, SEEK_END);
+	size = ftell(f);
+	rewind(f);
+
+	buffer = g_malloc(size);
+	if(buffer == NULL)
+	{
+		perror("malloc");
+		return -1;
+	}
+
+	if(fread(buffer, 1, size, f) != size)
+	{
+		perror(cfg_file);
+		fclose(f);
+		return -1;
+	}
+
+	to_search = g_strdup_printf("[%s]", section);
+	length = strlen(to_search);
+
+	/* Search section */
+	for(i = 0; i < size - length; i++)
+	{
+		for(j = 0; j < length; j++)
+		{
+			if(to_search[j] != buffer[i + j])
+				break;
+		}
+
+		if(j == length)
+			break;
+	}
+
+	if(i == size - length)
+	{
+		g_printf(_("Cannot find section %s\n"), to_search);
+		return -1;
+	}
+
+	sect = i;
+
+	/* Search for next section */
+	for(i = sect + length; i < size; i++)
+	{
+		if(buffer[i] == '[')
+			break;
+	}
+
+	f = fopen(cfg_file, "w");
+	if(f == NULL)
+	{
+		perror(cfg_file);
+		return -1;
+	}
+
+	fwrite(buffer, 1, sect, f);
+	buf = buffer + i;
+	fwrite(buf, 1, size - i, f);
+	fclose(f);
+
+	g_free(to_search);
+	g_free(buffer);
+
+	return 0;
+}
+
+//! Create a new <default> configuration
+void hard_default_configuration(void)
+{
+	g_strlcpy(port_conf.port, DEFAULT_PORT, sizeof (port_conf.port));
+	port_conf.baudrate = DEFAULT_BAUDRATE;
+	port_conf.parity = 0;
+	port_conf.bits = DEFAULT_BITS;
+	port_conf.stopbits = DEFAULT_STOPBITS;
+	port_conf.flow_control = FALSE;
+	port_conf.rs485_rts_time_before_transmit = DEFAULT_DELAY_RS485;
+	port_conf.rs485_rts_time_after_transmit = DEFAULT_DELAY_RS485;
+	port_conf.disable_port_lock = FALSE;
+
+	term_conf.char_queue = DEFAULT_CHAR;
+	term_conf.delay = DEFAULT_DELAY;
+	term_conf.echo = DEFAULT_ECHO;
+	term_conf.auto_cr = FALSE;
+	term_conf.auto_lf = FALSE;
+	term_conf.timestamp = FALSE;
+	term_conf.font = pango_font_description_from_string (DEFAULT_FONT);
+	term_conf.block_cursor = TRUE;
+	term_conf.show_cursor = TRUE;
+	term_conf.rows = 80;
+	term_conf.columns = 25;
+	term_conf.scrollback = DEFAULT_SCROLLBACK;
+	term_conf.visual_bell = TRUE;
+
+	set_color (&term_conf.foreground_color, 0.66, 0.66, 0.66, 1.0);
+	set_color (&term_conf.background_color, 0, 0, 0, 1.0);
+}
+
+//! validate the active configuration
+void validate_configuration(void)
+{
+	char *string = NULL;
+
+	switch(port_conf.baudrate)
+	{
+		case 300:
+		case 600:
+		case 1200:
+		case 2400:
+		case 4800:
+		case 9600:
+		case 19200:
+		case 38400:
+		case 57600:
+		case 115200:
+		case 230400:
+		case 460800:
+		case 576000:
+		case 921600:
+		case 1000000:
+		case 2000000:
+			break;
+
+		default:
+			string = g_strdup_printf(_("Baudrate %ld may not be supported by all hardware"), port_conf.baudrate);
+			show_message(string, GTK_MESSAGE_ERROR);
+	    
+			g_free(string);
+	}
+
+	if(port_conf.stopbits != 1 && port_conf.stopbits != 2)
+	{
+		string = g_strdup_printf(_("Invalid number of stop-bits: %d\nFalling back to default number of stop-bits number: %d\n"), port_conf.stopbits, DEFAULT_STOPBITS);
+		show_message(string, GTK_MESSAGE_ERROR);
+		port_conf.stopbits = DEFAULT_STOPBITS;
+
+		g_free(string);
+	}
+
+	if(port_conf.bits < 5 || port_conf.bits > 8)
+	{
+		string = g_strdup_printf(_("Invalid number of bits: %d\nFalling back to default number of bits: %d\n"), port_conf.bits, DEFAULT_BITS);
+		show_message(string, GTK_MESSAGE_ERROR);
+		port_conf.bits = DEFAULT_BITS;
+
+		g_free(string);
+	}
+
+	if(term_conf.delay < 0 || term_conf.delay > 500)
+	{
+		string = g_strdup_printf(_("Invalid delay: %d ms\nFalling back to default delay: %d ms\n"), term_conf.delay, DEFAULT_DELAY);
+		show_message(string, GTK_MESSAGE_ERROR);
+		term_conf.delay = DEFAULT_DELAY;
+
+		g_free(string);
+	}
+
+	if(term_conf.font == NULL)
+		term_conf.font = pango_font_description_from_string (DEFAULT_FONT);
+}
+
+//! Convert the colors RGB to internal color scheme
+void set_color(GdkRGBA *color, float R, float G, float B, float A)
+{
+	color->red = R;
+	color->green = G;
+	color->blue = B;
+	color->alpha = A;
+}
diff --git a/convert/resource_file_conv.h b/convert/resource_file_conv.h
new file mode 100644
index 0000000..c874ffe
--- /dev/null
+++ b/convert/resource_file_conv.h
@@ -0,0 +1,31 @@
+/***********************************************************************
+ * resource_file.h                                              
+ * ---------------                          
+ *           GTKTerm Software                                   
+ *                      (c) Julien Schmitt               
+ *                                                               
+ * ------------------------------------------------------------------- 
+ *                                                            
+ *   \brief Purpose                                        
+ *      Load and save configuration file                              
+ *      - Header file -                                       
+ *                                                           
+ ***********************************************************************/
+
+#ifndef RESOURCE_FILE_H_
+#define RESOURCE_FILE_H_
+
+void config_file_init (void);
+void save_configuration_to_file(GKeyFile *);
+int load_configuration_from_file(const char *);
+int check_configuration_file ();
+void dump_configuration_to_cli(char *);
+void hard_default_configuration (void);
+void validate_configuration(void);
+void copy_configuration(GKeyFile *, const char *);
+int remove_section(char *cfg_file, char *section);
+void set_color(GdkRGBA *color, float, float, float, float);
+
+extern GFile *config_file;
+extern void show_message (char *, int);
+#endif
diff --git a/data/com.github.jeija.gtkterm.gschema.xml b/data/com.github.jeija.gtkterm.gschema.xml
new file mode 100644
index 0000000..c5e66f1
--- /dev/null
+++ b/data/com.github.jeija.gtkterm.gschema.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<schemalist>
+
+  <schema path="/com/github/jeija/gtkterm/" id="com.github.jeija.gtkterm">
+    <key name='window-size' type='(ii)'>
+      <default>(-1, -1)</default>
+    </key>
+    <key name='maximized' type='b'>
+      <default>false</default>
+    </key>
+    <key name='fullscreen' type='b'>
+      <default>false</default>
+    </key>
+
+  </schema>
+
+</schemalist>
\ No newline at end of file
diff --git a/data/config_terminal_dialog.ui b/data/config_terminal_dialog.ui
index 0dfeb64..415770b 100644
--- a/data/config_terminal_dialog.ui
+++ b/data/config_terminal_dialog.ui
@@ -1,216 +1,100 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
 <interface>
-  <requires lib="gtk+" version="3.12"/>
-  <object class="GtkAdjustment" id="cfg_scrollback_lines">
-    <property name="lower">100</property>
-    <property name="upper">99999</property>
-    <property name="value">3000</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkDialog" id="dialog">
-    <property name="width_request">290</property>
-    <property name="height_request">245</property>
-    <property name="can_focus">False</property>
-    <property name="resizable">False</property>
-    <property name="modal">True</property>
-    <property name="window_position">center-on-parent</property>
-    <property name="destroy_with_parent">True</property>
-    <property name="type_hint">dialog</property>
-    <property name="gravity">center</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox1">
-        <property name="can_focus">False</property>
-        <property name="halign">center</property>
-        <property name="valign">center</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area1">
-            <property name="can_focus">False</property>
-            <child>
-              <object class="GtkButton" id="close">
-                <property name="label">Close</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="image_position">bottom</property>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
+  <template class="GtkTermWindow" parent="GtkApplicationWindow">
+    <property name="title" translatable="yes">GTKTerm</property>
+    <property name="default-width">750</property>
+    <property name="default-height">550</property>
+    <property name="icon-name">document-open</property>
+    <child>
+      <object class="GtkGrid">
         <child>
-          <object class="GtkGrid" id="grid1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="halign">center</property>
-            <property name="valign">start</property>
-            <property name="margin_bottom">5</property>
-            <property name="row_spacing">6</property>
-            <property name="column_spacing">12</property>
-            <property name="row_homogeneous">True</property>
-            <child>
-              <object class="GtkLabel" id="label1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Terminal Font</property>
-                <property name="angle">0.01</property>
-                <property name="xalign">1</property>
-                <attributes>
-                  <attribute name="foreground" value="#555557575353"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkFontButton" id="cfg_terminal_font">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="font">Sans 12</property>
-                <property name="preview_text"/>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label5">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Scrollback Lines</property>
-                <property name="xalign">1</property>
-                <attributes>
-                  <attribute name="foreground" value="#555557575353"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
+          <object class="GtkBox">
+            <property name="hexpand">1</property>
             <child>
-              <object class="GtkSpinButton" id="cfg_scrollback_lines_spinner">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="max_width_chars">5</property>
-                <property name="adjustment">cfg_scrollback_lines</property>
-                <property name="value">100</property>
+              <object class="GtkMenuButton" id="menubutton">
+                <property name="icon-name">document-open</property>
               </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
-              </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="label4">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Background color</property>
-                <property name="xalign">1</property>
-                <attributes>
-                  <attribute name="foreground" value="#555557575353"/>
-                </attributes>
+              <object class="GtkButton">
+                <property name="icon-name">application-exit</property>
+                <property name="action-name">app.quit</property>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">4</property>
-              </packing>
             </child>
             <child>
-              <object class="GtkColorButton" id="cfg_background_color">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="halign">start</property>
-                <property name="title" translatable="yes">Background color</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">4</property>
-              </packing>
+              <object class="GtkSeparator"/>
             </child>
             <child>
-              <object class="GtkLabel" id="label3">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Text color</property>
-                <property name="xalign">1</property>
-                <attributes>
-                  <attribute name="foreground" value="#555557575353"/>
-                </attributes>
+              <object class="GtkButton">
+                <property name="icon-name">applications-other</property>
+                <property name="action-name">win.logo</property>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">3</property>
-              </packing>
             </child>
+            <layout>
+              <property name="column">0</property>
+              <property name="row">0</property>
+            </layout>
+          </object>
+        </child>
+        <child>
+          <object class="GtkInfoBar" id="infobar">
+            <property name="visible">0</property>
+            <property name="hexpand">1</property>
             <child>
-              <object class="GtkColorButton" id="cfg_text_color">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="halign">start</property>
-                <property name="title" translatable="yes">Text color</property>
+              <object class="GtkLabel" id="message">
+                <property name="hexpand">1</property>
               </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">3</property>
-              </packing>
             </child>
-            <child>
-              <object class="GtkLabel" id="label2">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Block cursor</property>
-                <property name="ellipsize">end</property>
-                <property name="xalign">1</property>
-                <attributes>
-                  <attribute name="foreground" value="#555557575353"/>
-                </attributes>
+            <child type="action">
+              <object class="GtkButton">
+                <property name="valign">center</property>
+                <property name="label" translatable="yes">_OK</property>
+                <property name="use-underline">1</property>
+                <signal name="clicked" handler="clicked_cb"/>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">2</property>
-              </packing>
             </child>
+            <layout>
+              <property name="column">0</property>
+              <property name="row">1</property>
+            </layout>
+          </object>
+        </child>
+        <child>
+          <object class="GtkScrolledWindow">
+            <property name="has-frame">1</property>
             <child>
-              <object class="GtkSwitch" id="cfg_block_cursor">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="halign">start</property>
-                <property name="valign">center</property>
-                <property name="active">True</property>
-                <property name="state">True</property>
+              <object class="GtkTextView">
+                <property name="hexpand">1</property>
+                <property name="vexpand">1</property>
+                <property name="buffer">buffer</property>
               </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">2</property>
-              </packing>
             </child>
+            <layout>
+              <property name="column">0</property>
+              <property name="row">2</property>
+            </layout>
+          </object>
+        </child>
+        <child>
+          <object class="GtkStatusbar" id="status">
+            <property name="hexpand">1</property>
+            <layout>
+              <property name="column">0</property>
+              <property name="row">3</property>
+            </layout>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
         </child>
       </object>
     </child>
+  </template>
+  <menu id="toolmenu">
+    <item>
+      <attribute name="label">File1</attribute>
+      <attribute name="action">win.file1</attribute>
+    </item>
+  </menu>
+  <object class="GtkTextBuffer" id="buffer">
+    <signal name="changed" handler="update_statusbar"/>
+    <signal name="mark-set" handler="mark_set_callback"/>
   </object>
 </interface>
diff --git a/data/gresource.xml b/data/gresource.xml
index 86b3b05..c078565 100644
--- a/data/gresource.xml
+++ b/data/gresource.xml
@@ -1,7 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
-	<gresource prefix="/org/gtk/gtkterm">
-		<file compressed="true">config_terminal_dialog.ui</file>
+	<gresource prefix="/com/github/jeija/gtkterm">
+		<file compressed="true">gtkterm_main.ui</file>
+		<file compressed="true">menu.ui</file>
 		<file compressed="true">gtkterm_64x64.png</file>
+		<file compressed="true">gtkterm_48x48.png</file>		
 	</gresource>
 </gresources>
diff --git a/data/gtkterm.1 b/data/gtkterm.1
index 1fadd57..7841516 100644
--- a/data/gtkterm.1
+++ b/data/gtkterm.1
@@ -21,6 +21,12 @@ Help screen.
 .B \-c, \-\-config <configuration>
 Load configuration (default is "default").
 .TP
+.B \-o, \-\-show_config <configuration>
+Show configuration (default is "default").
+.TP
+.B \-R, \-\-remove_config <configuration>
+Remove configuration (default is "default").
+.TP
 .B \-p, \-\-port <device>
 Serial port device (default /dev/ttyS0).
 .TP
diff --git a/data/gtkterm_main.ui b/data/gtkterm_main.ui
new file mode 100644
index 0000000..3fba000
--- /dev/null
+++ b/data/gtkterm_main.ui
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="GtkTermWindow" parent="GtkApplicationWindow">
+    <property name="title" translatable="yes">GTKTerm</property>
+    <property name="default-width">750</property>
+    <property name="default-height">550</property>
+    <property name="icon-name">document-open</property>
+    <child>
+      <object class="GtkBox" id="main_window">
+        <property name="orientation">vertical</property>      
+        <child>
+          <object class="GtkBox">
+            <property name="hexpand">1</property>
+            <child>
+              <object class="GtkMenuButton" id="menubutton">
+                <property name="icon-name">document-open</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkButton">
+                <property name="icon-name">application-exit</property>
+                <property name="action-name">app.quit</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSeparator"/>
+            </child>
+            <child>
+              <object class="GtkButton">
+                <property name="icon-name">applications-other</property>
+                <property name="action-name">win.logo</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkInfoBar" id="infobar">
+            <property name="visible">0</property>
+            <property name="hexpand">1</property>
+            <child>
+              <object class="GtkLabel" id="message">
+                <property name="hexpand">1</property>
+              </object>
+            </child>
+            <child type="action">
+              <object class="GtkButton">
+                <property name="valign">center</property>
+                <property name="label" translatable="yes">_OK</property>
+                <property name="use-underline">1</property>
+                <signal name="clicked" handler="clicked_cb"/>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkScrolledWindow" id="scrolled_window">
+            <property name="vexpand">1</property>
+            <property name="focusable">1</property>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkBox" id="statusbox">
+            <property name="valign">center</property> 
+            <property name="spacing">6</property>
+            <property name="margin_top">6</property>
+            <property name="margin_bottom">6</property>            
+            <property name="margin_end">20</property>                               
+            <child>
+              <object class="GtkBox" id="status_config">
+                <property name="valign">center</property>
+                <property name="hexpand">1</property>                
+              </object>
+            </child>           
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+  <menu id="toolmenu">
+    <item>
+      <attribute name="label">File1</attribute>
+      <attribute name="action">win.file1</attribute>
+    </item>
+  </menu>
+</interface>
diff --git a/data/menu.ui b/data/menu.ui
new file mode 100644
index 0000000..a933219
--- /dev/null
+++ b/data/menu.ui
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <menu id="gtkterm_menubar">
+    <submenu>
+      <attribute name="label" translatable="yes">_File</attribute>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Clear screen</attribute>
+          <attribute name="action">gtmterm_window.clear_screen</attribute>
+          <attribute name="accel">&lt;Control&gt;&lt;Shift&gt;L</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Clear scrollback</attribute>
+          <attribute name="action">gtmterm_window.clear_scrollback</attribute>
+          <attribute name="accel">&lt;Control&gt;&lt;Shift&gt;K</attribute>          
+        </item>
+      </section>
+      <section>        
+        <item>
+          <attribute name="label" translatable="yes">_Send raw file</attribute>
+          <attribute name="action">gtmterm_window.send_raw</attribute>
+          <attribute name="accel">&lt;Control&gt;&lt;Shift&gt;R</attribute>  
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Save raw file</attribute>
+          <attribute name="action">gtmterm_window.save_raw</attribute>
+          <attribute name="accel">&lt;Control&gt;&lt;Shift&gt;s</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Quit</attribute>
+          <attribute name="action">app.quit</attribute>
+          <attribute name="accel">&lt;Control&gt;q</attribute>
+        </item>
+      </section>
+    </submenu>
+    <submenu>
+      <attribute name="label" translatable="yes">_Edit</attribute>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Copy</attribute>
+          <attribute name="action">gtmterm_window.copy</attribute>
+          <attribute name="accel">&lt;Control&gt;&lt;Shift&gt;C</attribute>          
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Paste</attribute>
+          <attribute name="action">gktterm.paste</attribute>
+          <attribute name="accel">&lt;Control&gt;&lt;Shift&gt;V</attribute>            
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Select all</attribute>
+          <attribute name="action">gtmterm_window.select_all</attribute>
+          <attribute name="accel">&lt;Control&gt;&lt;Shift&gt;V</attribute>            
+        </item>
+      </section>      
+    </submenu>
+    <submenu>
+      <attribute name="label" translatable="yes">_Log</attribute>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_To file</attribute>
+          <attribute name="action">gtmterm_window.log_to_file</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Resume</attribute>
+          <attribute name="action">gtmterm_window.log_resume</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Stop</attribute>
+          <attribute name="action">gtmterm_window.log_stop</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Clear</attribute>
+          <attribute name="action">gtmterm_window.log_clear</attribute>
+        </item>
+      </section>                  
+    </submenu>      
+    <submenu>
+      <attribute name="label" translatable="yes">_Configuration</attribute>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Prefer Dark Theme</attribute>
+          <attribute name="action">gtmterm_window.dark</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Port</attribute>
+          <attribute name="action">gtmterm_window.config_port</attribute>
+          <attribute name="accel">&lt;Control&gt;&lt;Shift&gt;S</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Main window</attribute>
+          <attribute name="action">gtmterm_window.config_main_window</attribute>
+        </item>        
+      </section> 
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Local echo</attribute>
+          <attribute name="action">gtmterm_window.local_echo</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_CR LF auto</attribute>
+          <attribute name="action">gtmterm_window.crlf_auto</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Timestamp</attribute>
+          <attribute name="action">gtmterm_window.timestamp</attribute>
+        </item>         
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Macros</attribute>
+          <attribute name="action">gtmterm_window.macros</attribute>
+        </item>       
+      </section>       
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Load configuration</attribute>
+          <attribute name="action">gtmterm_window.load_config</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Save configuration</attribute>
+          <attribute name="action">gtmterm_window.save_config</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Delete configuration</attribute>
+          <attribute name="action">gtmterm_window.remove_config</attribute>
+        </item>         
+      </section>          
+    </submenu>
+    <submenu>
+      <attribute name="label" translatable="yes">_Control signals</attribute>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Send break</attribute>
+          <attribute name="action">gtmterm_window.send_break</attribute>
+          <attribute name="accel">&lt;Control&gt;&lt;Shift&gt;V</attribute>               
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Open Port</attribute>
+          <attribute name="action">gtmterm_window.open_port</attribute>            
+          <attribute name="accel">F5</attribute>               
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Close Port</attribute>
+          <attribute name="action">gtmterm_window.close_port</attribute>              
+          <attribute name="accel">F6</attribute>               
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Toggle DTR</attribute>
+          <attribute name="action">gtmterm_window.toggle_DTR</attribute>            
+          <attribute name="accel">F7</attribute>               
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Toggle RTS</attribute>
+          <attribute name="action">gtmterm_window.toggle_RTS</attribute>              
+          <attribute name="accel">F8</attribute>               
+        </item>             
+      </section>      
+    </submenu>
+    <submenu>
+      <attribute name="label" translatable="yes">_View</attribute>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_ASCII</attribute>
+          <attribute name="action">gtmterm_window.show_ascii</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Hexadecimal</attribute>
+          <attribute name="action">gtmterm_window.show_hex</attribute>
+        </item>    
+        <submenu>
+          <attribute name="label" translatable="yes">_Hexadecimal chars</attribute>
+          <section>
+            <item>
+              <attribute name="label" translatable="yes">_8</attribute>
+              <attribute name="action">gtmterm_window.view_hex</attribute>
+            </item>
+            <item>
+              <attribute name="label" translatable="yes">_10</attribute>
+              <attribute name="action">gtmterm_window.view_hex</attribute>
+            </item>
+            <item>
+              <attribute name="label" translatable="yes">_16</attribute>
+              <attribute name="action">gtmterm_window.view_hex</attribute>
+            </item>
+            <item>
+              <attribute name="label" translatable="yes">_24</attribute>
+              <attribute name="action">gtmterm_window.view_hex</attribute>
+            </item>
+            <item>
+              <attribute name="label" translatable="yes">_32</attribute>
+              <attribute name="action">gtmterm_window.view_hex</attribute>
+            </item>
+          </section>          
+        </submenu> 
+      </section> 
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Show index</attribute>
+          <attribute name="action">gtmterm_window.show_index</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Send hexadecimal data</attribute>
+          <attribute name="action">gtmterm_window.send_hex_data</attribute>
+        </item>
+      </section>              
+    </submenu>       
+    <submenu>
+      <attribute name="label" translatable="yes">_Help</attribute>
+      <item>
+        <attribute name="label" translatable="yes">_About</attribute>
+        <attribute name="action">gtkterm_window.about</attribute>
+        <attribute name="accel">&lt;Control&gt;a</attribute>
+      </item>
+    </submenu>
+  </menu>
+</interface>
diff --git a/data/meson.build b/data/meson.build
index 56c49ed..5856998 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -28,6 +28,11 @@ if desktop_file_validate.found()
 	)
 endif
 
+schemas_dir = get_option('prefix') / get_option('datadir') / 'glib-2.0' / 'schemas'
+settings_schemas = [ 'com.github.jeija.gtkterm.gschema.xml' ]
+
+install_data(settings_schemas, install_dir: schemas_dir)
+
 # Icon
 install_data('gtkterm_256x256.png',
 	install_dir: join_paths(datadir, 'icons', 'hicolor', '256x256', 'apps'),
@@ -49,7 +54,6 @@ install_data('gtkterm_48x48.png',
 	rename : 'gtkterm.png'
 )
 
-
 install_data('gtkterm_48x48.png',
 	install_dir: join_paths(datadir, 'icons', 'hicolor', '48x48', 'apps'),
 	rename : 'gtkterm.png'
diff --git a/debian/changelog b/debian/changelog
index ccb6366..28a38f1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,11 +1,12 @@
-gtkterm (1.2.1-2) UNRELEASED; urgency=medium
+gtkterm (1.9.1-1) UNRELEASED; urgency=medium
 
   * Bump debhelper from old 12 to 13.
   * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository,
     Repository-Browse.
   * Remove deprecated Encoding key from desktop file debian/gtkterm.desktop.
+  * New upstream release.
 
- -- Debian Janitor <janitor@jelmer.uk>  Thu, 01 Sep 2022 04:50:37 -0000
+ -- Debian Janitor <janitor@jelmer.uk>  Sat, 03 Jun 2023 14:34:31 -0000
 
 gtkterm (1.2.1-1) unstable; urgency=medium
 
diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in
new file mode 100644
index 0000000..713bdc6
--- /dev/null
+++ b/doc/Doxyfile.in
@@ -0,0 +1,2733 @@
+# Doxyfile 1.9.4
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+#
+# Note:
+#
+# Use doxygen to compare the used configuration file with the template
+# configuration file:
+# doxygen -x [configFile]
+# Use doxygen to compare the used configuration file with the template
+# configuration file without replacing the environment variables:
+# doxygen -x_noenv [configFile]
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the configuration
+# file that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# https://www.gnu.org/software/libiconv/ for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME           = @PROJECT_NAME@
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER         = @PROJECT_VERSION@
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          = GTKTerm: A GTK+ Serial Port Terminal
+
+# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
+# in the documentation. The maximum height of the logo should not exceed 55
+# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
+# the logo to the output directory.
+
+PROJECT_LOGO           =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = @TOP_BUILDDIR@/doc
+
+# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096
+# sub-directories (in 2 levels) under the output directory of each output format
+# and will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to
+# control the number of sub-directories.
+# The default value is: NO.
+
+CREATE_SUBDIRS         = NO
+
+# Controls the number of sub-directories that will be created when
+# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every
+# level increment doubles the number of directories, resulting in 4096
+# directories at level 8 which is the default and also the maximum value. The
+# sub-directories are organized in 2 levels, the first level always has a fixed
+# numer of 16 directories.
+# Minimum value: 0, maximum value: 8, default value: 8.
+# This tag requires that the tag CREATE_SUBDIRS is set to YES.
+
+CREATE_SUBDIRS_LEVEL   = 8
+
+# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
+# characters to appear in the names of generated files. If set to NO, non-ASCII
+# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
+# U+3044.
+# The default value is: NO.
+
+ALLOW_UNICODE_NAMES    = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian,
+# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English
+# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek,
+# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with
+# English messages), Korean, Korean-en (Korean with English messages), Latvian,
+# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese,
+# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish,
+# Swedish, Turkish, Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES        = NO
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line
+# such as
+# /***************
+# as being the beginning of a Javadoc-style comment "banner". If set to NO, the
+# Javadoc-style will behave just like regular comments and it will not be
+# interpreted by doxygen.
+# The default value is: NO.
+
+JAVADOC_BANNER         = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# By default Python docstrings are displayed as preformatted text and doxygen's
+# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the
+# doxygen's special commands can be used and the contents of the docstring
+# documentation blocks is shown as doxygen documentation.
+# The default value is: YES.
+
+PYTHON_DOCSTRING       = YES
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
+# page for each member. If set to NO, the documentation of a member will be part
+# of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:^^"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". Note that you cannot put \n's in the value part of an alias
+# to insert newlines (in the resulting output). You can put ^^ in the value part
+# of an alias to insert a newline as if a physical newline was in the original
+# file. When you need a literal { or } or , in the value part of an alias you
+# have to escape them by means of a backslash (\), this can lead to conflicts
+# with the commands \{ and \} for these it is advised to use the version @{ and
+# @} or use a double escape (\\{ and \\})
+
+ALIASES                =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice
+# sources only. Doxygen will then generate output that is more tailored for that
+# language. For instance, namespaces will be presented as modules, types will be
+# separated into more groups, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_SLICE  = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
+# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice,
+# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
+# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
+# tries to guess whether the code is fixed or free formatted code, this is the
+# default for Fortran type files). For instance to make doxygen treat .inc files
+# as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C.
+#
+# Note: For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen. When specifying no_extension you should add
+# * to the FILE_PATTERNS.
+#
+# Note see also the list of default file extension mappings.
+
+EXTENSION_MAPPING      =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See https://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT       = YES
+
+# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
+# to that level are automatically included in the table of contents, even if
+# they do not have an id attribute.
+# Note: This feature currently applies only to Markdown headings.
+# Minimum value: 0, maximum value: 99, default value: 5.
+# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
+
+TOC_INCLUDE_HEADINGS   = 5
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by putting a % sign in front of the word or
+# globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# If one adds a struct or class to a group and this option is enabled, then also
+# any nested class or struct is added to the same group. By default this option
+# is disabled and one has to add nested compounds explicitly via \ingroup.
+# The default value is: NO.
+
+GROUP_NESTED_COMPOUNDS = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE      = 0
+
+# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use
+# during processing. When set to 0 doxygen will based this on the number of
+# cores available in the system. You can set it explicitly to a value larger
+# than 0 to get more control over the balance between CPU load and processing
+# speed. At this moment only the input processing can be done using multiple
+# threads. Since this is still an experimental feature the default is set to 1,
+# which effectively disables parallel processing. Please report any issues you
+# encounter. Generating dot graphs in parallel is controlled by the
+# DOT_NUM_THREADS setting.
+# Minimum value: 0, maximum value: 32, default value: 1.
+
+NUM_PROC_THREADS       = 1
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
+# methods of a class will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIV_VIRTUAL   = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO,
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. If set to YES, local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO, only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If this flag is set to YES, the name of an unnamed parameter in a declaration
+# will be determined by the corresponding definition. By default unnamed
+# parameters remain unnamed in the output.
+# The default value is: YES.
+
+RESOLVE_UNNAMED_PARAMS = YES
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO, these classes will be included in the various overviews. This option
+# has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# declarations. If set to NO, these declarations will be included in the
+# documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO, these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS          = NO
+
+# With the correct setting of option CASE_SENSE_NAMES doxygen will better be
+# able to match the capabilities of the underlying filesystem. In case the
+# filesystem is case sensitive (i.e. it supports files in the same directory
+# whose names only differ in casing), the option must be set to YES to properly
+# deal with such files in case they appear in the input. For filesystems that
+# are not case sensitive the option should be set to NO to properly deal with
+# output files written for symbols that only differ in casing, such as for two
+# classes, one named CLASS and the other named Class, and to also support
+# references to files without having to specify the exact matching casing. On
+# Windows (including Cygwin) and MacOS, users should typically set this option
+# to NO, whereas on Linux or other Unix flavors it should typically be set to
+# YES.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES, the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
+# append additional text to a page's title, such as Class Reference. If set to
+# YES the compound reference will be hidden.
+# The default value is: NO.
+
+HIDE_COMPOUND_REFERENCE= NO
+
+# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class
+# will show which file needs to be included to use the class.
+# The default value is: YES.
+
+SHOW_HEADERFILE        = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC  = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
+# list. This list is created by putting \todo commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
+# list. This list is created by putting \test commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES, the
+# list will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES        = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file. See also section "Changing the
+# layout of pages" for information.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE            =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. See also \cite for info how to create references.
+
+CITE_BIB_FILES         =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET                  = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS               = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as documenting some parameters in
+# a documented function twice, or documenting parameters that don't exist or
+# using markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR      = YES
+
+# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete
+# function parameter documentation. If set to NO, doxygen will accept that some
+# parameters have no documentation without warning.
+# The default value is: YES.
+
+WARN_IF_INCOMPLETE_DOC = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO, doxygen will only warn about wrong parameter
+# documentation, but not about the absence of documentation. If EXTRACT_ALL is
+# set to YES then this flag will automatically be disabled. See also
+# WARN_IF_INCOMPLETE_DOC
+# The default value is: NO.
+
+WARN_NO_PARAMDOC       = NO
+
+# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
+# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
+# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but
+# at the end of the doxygen process doxygen will return with a non-zero status.
+# Possible values are: NO, YES and FAIL_ON_WARNINGS.
+# The default value is: NO.
+
+WARN_AS_ERROR          = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# See also: WARN_LINE_FORMAT
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# In the $text part of the WARN_FORMAT command it is possible that a reference
+# to a more specific place is given. To make it easier to jump to this place
+# (outside of doxygen) the user can define a custom "cut" / "paste" string.
+# Example:
+# WARN_LINE_FORMAT = "'vi $file +$line'"
+# See also: WARN_FORMAT
+# The default value is: at line $line of file $file.
+
+WARN_LINE_FORMAT       = "at line $line of file $file"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr). In case the file specified cannot be opened for writing the
+# warning and error messages are written to standard error. When as file - is
+# specified the warning and error messages are written to standard output
+# (stdout).
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
+# Note: If this tag is empty the current directory is searched.
+
+INPUT                  = @README_PATH@ @TOP_SRCDIR@/src
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see:
+# https://www.gnu.org/software/libiconv/) for the list of possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# read by doxygen.
+#
+# Note the list of default checked file patterns might differ from the list of
+# default file extension mappings.
+#
+# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
+# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
+# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml,
+# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C
+# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd,
+# *.vhdl, *.ucf, *.qsf and *.ice.
+
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.cxx \
+                         *.cpp \
+                         *.c++ \
+                         *.java \
+                         *.ii \
+                         *.ixx \
+                         *.ipp \
+                         *.i++ \
+                         *.inl \
+                         *.idl \
+                         *.ddl \
+                         *.odl \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++ \
+                         *.l \
+                         *.cs \
+                         *.d \
+                         *.php \
+                         *.php4 \
+                         *.php5 \
+                         *.phtml \
+                         *.inc \
+                         *.m \
+                         *.markdown \
+                         *.md \
+                         *.mm \
+                         *.dox \
+                         *.py \
+                         *.pyw \
+                         *.f90 \
+                         *.f95 \
+                         *.f03 \
+                         *.f08 \
+                         *.f18 \
+                         *.f \
+                         *.for \
+                         *.vhd \
+                         *.vhdl \
+                         *.ucf \
+                         *.qsf \
+                         *.ice
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# ANamespace::AClass, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS       = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE = README_source.md
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# entity all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS        = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see https://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS       = YES
+
+# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
+# clang parser (see:
+# http://clang.llvm.org/) for more accurate parsing at the cost of reduced
+# performance. This can be particularly helpful with template rich C++ code for
+# which doxygen's built-in parser lacks the necessary type information.
+# Note: The availability of this option depends on whether or not doxygen was
+# generated with the -Duse_libclang=ON option for CMake.
+# The default value is: NO.
+
+CLANG_ASSISTED_PARSING = NO
+
+# If the CLANG_ASSISTED_PARSING tag is set to YES and the CLANG_ADD_INC_PATHS
+# tag is set to YES then doxygen will add the directory of each input to the
+# include path.
+# The default value is: YES.
+# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
+
+CLANG_ADD_INC_PATHS    = YES
+
+# If clang assisted parsing is enabled you can provide the compiler with command
+# line options that you would normally use when invoking the compiler. Note that
+# the include paths will already be set by doxygen for the files and directories
+# specified with INPUT and INCLUDE_PATH.
+# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
+
+CLANG_OPTIONS          =
+
+# If clang assisted parsing is enabled you can provide the clang parser with the
+# path to the directory containing a file called compile_commands.json. This
+# file is the compilation database (see:
+# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the
+# options used when the source files were built. This is equivalent to
+# specifying the -p option to a clang tool, such as clang-check. These options
+# will then be passed to the parser. Any options specified with CLANG_OPTIONS
+# will be added as well.
+# Note: The availability of this option depends on whether or not doxygen was
+# generated with the -Duse_libclang=ON option for CMake.
+
+CLANG_DATABASE_PATH    =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX     = YES
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML          = NO
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# cascading style sheets that are included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefore more robust against future updates.
+# Doxygen will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list). For an example see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET  =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the style sheet and background images according to
+# this color. Hue is specified as an angle on a color-wheel, see
+# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use gray-scales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to YES can help to show when doxygen was last run and thus if the
+# documentation is up to date.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP         = NO
+
+# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
+# documentation will contain a main index with vertical navigation menus that
+# are dynamically created via JavaScript. If disabled, the navigation index will
+# consists of multiple levels of tabs that are statically embedded in every HTML
+# page. Disable this option to support browsers that do not have JavaScript,
+# like the Qt help browser.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_MENUS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see:
+# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To
+# create a documentation set, doxygen will generate a Makefile in the HTML
+# output directory. Running make will produce the docset in that directory and
+# running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
+# genXcode/_index.html for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET        = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# This tag determines the URL of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDURL         =
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# on Windows. In the beginning of 2021 Microsoft took the original page, with
+# a.o. the download links, offline the HTML help workshop was already many years
+# in maintenance mode). You can download the HTML help workshop from the web
+# archives at Installation executable (see:
+# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo
+# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe).
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP      = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE               =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler (hhc.exe). If non-empty,
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION           =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated
+# (YES) or that it should be included in the main .chm file (NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI           = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING     =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated
+# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
+# enables the Previous and Next buttons.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# The QHG_LOCATION tag can be used to specify the location (absolute path
+# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to
+# run qhelpgenerator on the generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine tune the look of the index (see "Fine-tuning the output"). As an
+# example, the default style sheet generated by doxygen has an example that
+# shows how to put an image at the root of the tree instead of the PROJECT_NAME.
+# Since the tree basically has the same information as the tab index, you could
+# consider setting DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW      = NO
+
+# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the
+# FULL_SIDEBAR option determines if the side bar is limited to only the treeview
+# area (value NO) or if it should extend to the full height of the window (value
+# YES). Setting this to YES gives a layout similar to
+# https://docs.readthedocs.io with more room for contents, but less room for the
+# project logo, title, and description. If either GENERATE_TREEVIEW or
+# DISABLE_INDEX is set to NO, this option has no effect.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FULL_SIDEBAR           = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH         = 250
+
+# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email
+# addresses.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+OBFUSCATE_EMAILS       = YES
+
+# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg
+# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see
+# https://inkscape.org) to generate formulas as SVG images instead of PNGs for
+# the HTML output. These images will generally look nicer at scaled resolutions.
+# Possible values are: png (the default) and svg (looks nicer but requires the
+# pdf2svg or inkscape tool).
+# The default value is: png.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FORMULA_FORMAT    = png
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT    = YES
+
+# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
+# to create new LaTeX commands to be used in formulas as building blocks. See
+# the section "Including formulas" for details.
+
+FORMULA_MACROFILE      =
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# https://www.mathjax.org) which uses client side JavaScript for the rendering
+# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX            = NO
+
+# With MATHJAX_VERSION it is possible to specify the MathJax version to be used.
+# Note that the different versions of MathJax have different requirements with
+# regards to the different settings, so it is possible that also other MathJax
+# settings have to be changed when switching between the different MathJax
+# versions.
+# Possible values are: MathJax_2 and MathJax_3.
+# The default value is: MathJax_2.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_VERSION        = MathJax_2
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. For more details about the output format see MathJax
+# version 2 (see:
+# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3
+# (see:
+# http://docs.mathjax.org/en/latest/web/components/output.html).
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility. This is the name for Mathjax version 2, for MathJax version 3
+# this will be translated into chtml), NativeMML (i.e. MathML. Only supported
+# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This
+# is the name for Mathjax version 3, for MathJax version 2 this will be
+# translated into HTML-CSS) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from https://www.mathjax.org before deployment. The default value is:
+# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2
+# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH        =
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# for MathJax version 2 (see
+# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions):
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# For example for MathJax version 3 (see
+# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html):
+# MATHJAX_EXTENSIONS = ams
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS     =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see:
+# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE       =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using JavaScript. There
+# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
+# setting. When disabled, doxygen will generate a PHP script for searching and
+# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
+# and searching needs to be provided by external tools. See the section
+# "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH    = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see:
+# https://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see:
+# https://xapian.org/). See the section "External Indexing and Searching" for
+# details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL       =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID     =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX         = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when not enabling USE_PDFLATEX the default is latex when enabling
+# USE_PDFLATEX the default is pdflatex and when in the later case latex is
+# chosen this is overwritten by pdflatex. For specific output languages the
+# default can have been set differently, this depends on the implementation of
+# the output language.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME         =
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# Note: This tag is used in the Makefile / make.bat.
+# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file
+# (.tex).
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to
+# generate index for LaTeX. In case there is no backslash (\) as first character
+# it will be automatically added in the LaTeX code.
+# Note: This tag is used in the generated output file (.tex).
+# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.
+# The default value is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_MAKEINDEX_CMD    = makeindex
+
+# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. The package can be specified just
+# by its name or with the correct syntax as to be used with the LaTeX
+# \usepackage command. To get the times font for instance you can specify :
+# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
+# To use the option intlimits with the amsmath package you can specify:
+# EXTRA_PACKAGES=[intlimits]{amsmath}
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a user-defined LaTeX header for
+# the generated LaTeX document. The header should contain everything until the
+# first chapter. If it is left blank doxygen will generate a standard header. It
+# is highly recommended to start with a default header using
+# doxygen -w latex new_header.tex new_footer.tex new_stylesheet.sty
+# and then modify the file new_header.tex. See also section "Doxygen usage" for
+# information on how to generate the default header that doxygen normally uses.
+#
+# Note: Only use a user-defined header if you know what you are doing!
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. The following
+# commands have a special meaning inside the header (and footer): For a
+# description of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a user-defined LaTeX footer for
+# the generated LaTeX document. The footer should contain everything after the
+# last chapter. If it is left blank doxygen will generate a standard footer. See
+# LATEX_HEADER for more information on how to generate a default footer and what
+# special commands can be used inside the footer. See also section "Doxygen
+# usage" for information on how to generate the default footer that doxygen
+# normally uses. Note: Only use a user-defined footer if you know what you are
+# doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER           =
+
+# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# LaTeX style sheets that are included after the standard style sheets created
+# by doxygen. Using this option one can overrule certain style aspects. Doxygen
+# will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_STYLESHEET =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES      =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as
+# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX
+# files. Set this option to YES, to get a higher quality PDF documentation.
+#
+# See also section LATEX_CMD_NAME for selecting the engine.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE        = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES     = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE        = plain
+
+# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_TIMESTAMP        = NO
+
+# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
+# path from which the emoji images will be read. If a relative path is entered,
+# it will be relative to the LATEX_OUTPUT directory. If left blank the
+# LATEX_OUTPUT directory will be used.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EMOJI_DIRECTORY  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# configuration file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's configuration file. A template extensions file can be
+# generated using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION          = .3
+
+# The MAN_SUBDIR tag determines the name of the directory created within
+# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
+# MAN_EXTENSION with the initial . removed.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_SUBDIR             =
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT             = xml
+
+# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING     = YES
+
+# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include
+# namespace members in file scope as well, matching the HTML output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_NS_MEMB_FILE_SCOPE = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT         = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
+# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
+# the structure of the code including all documentation. Note that this feature
+# is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO, the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
+# in the source code. If set to NO, only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES, the include files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor. Note that the INCLUDE_PATH is not recursive, so the setting of
+# RECURSIVE has no effect here.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all references to function-like macros that are alone on a line, have
+# an all uppercase name, and do not end with a semicolon. Such function macros
+# are typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have a unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
+# the class index. If set to NO, only the inherited external classes will be
+# listed.
+# The default value is: NO.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS        = YES
+
+# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES         = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH               =
+
+# If set to YES the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: YES.
+
+HAVE_DOT               = YES
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS        = 0
+
+# When you want a differently looking font in the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a
+# graph for each documented class showing the direct and indirect inheritance
+# relations. In case HAVE_DOT is set as well dot will be used to draw the graph,
+# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set
+# to TEXT the direct and indirect inheritance relations will be shown as texts /
+# links.
+# Possible values are: NO, YES, TEXT and GRAPH.
+# The default value is: YES.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies. See also the chapter Grouping
+# in the manual.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag UML_LOOK is set to YES.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and
+# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS
+# tag is set to YES, doxygen will add type and arguments for attributes and
+# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen
+# will not generate fields with class member information in the UML graphs. The
+# class diagrams will look similar to the default class diagrams but using UML
+# notation for the relationships.
+# Possible values are: NO, YES and NONE.
+# The default value is: NO.
+# This tag requires that the tag UML_LOOK is set to YES.
+
+DOT_UML_DETAILS        = NO
+
+# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters
+# to display on a single line. If the actual line length exceeds this threshold
+# significantly it will wrapped across multiple lines. Some heuristics are apply
+# to avoid ugly line breaks.
+# Minimum value: 0, maximum value: 1000, default value: 17.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_WRAP_THRESHOLD     = 17
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH          = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command. Disabling a call graph can be
+# accomplished by means of the command \hidecallgraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH             = YES
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command. Disabling a caller graph can be
+# accomplished by means of the command \hidecallergraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH           = YES
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH        = YES
+
+# The DIR_GRAPH_MAX_DEPTH tag can be used to limit the maximum number of levels
+# of child directories generated in directory dependency graphs by dot.
+# Minimum value: 1, maximum value: 25, default value: 1.
+# This tag requires that the tag DIRECTORY_GRAPH is set to YES.
+
+DIR_GRAPH_MAX_DEPTH    = 1
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. For an explanation of the image formats see the section
+# output formats in the documentation of the dot tool (Graphviz (see:
+# http://www.graphviz.org/)).
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd,
+# gif, gif:cairo, gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd,
+# png:cairo, png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
+# png:gdiplus:gdiplus.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG        = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS           =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS           =
+
+# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
+# path where java can find the plantuml.jar file or to the filename of jar file
+# to be used. If left blank, it is assumed PlantUML is not used or called during
+# a preprocessing step. Doxygen will generate a warning when it encounters a
+# \startuml command in this case and will not generate output for the diagram.
+
+PLANTUML_JAR_PATH      =
+
+# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
+# configuration file for plantuml.
+
+PLANTUML_CFG_FILE      =
+
+# When using plantuml, the specified paths are searched for files specified by
+# the !include statement in a plantuml block.
+
+PLANTUML_INCLUDE_PATH  =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# Note: This tag requires that UML_LOOK isn't set, i.e. the doxygen internal
+# graphical representation for inheritance and collaboration diagrams is used.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate
+# files that are used to generate the various graphs.
+#
+# Note: This setting is not only used for dot files but also for msc temporary
+# files.
+# The default value is: YES.
+
+DOT_CLEANUP            = YES
diff --git a/doc/gtkterm.pdf b/doc/gtkterm.pdf
new file mode 100644
index 0000000..956a405
Binary files /dev/null and b/doc/gtkterm.pdf differ
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..948dc37
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,15 @@
+cdata = configuration_data()
+cdata.set('TOP_SRCDIR', meson.global_source_root())
+cdata.set('TOP_BUILDDIR', meson.global_build_root())
+cdata.set('README_PATH', join_paths(meson.global_source_root(),'README_source.md'))
+cdata.set('PROJECT_VERSION', meson.project_version())
+cdata.set('PROJECT_NAME', meson.project_name())
+
+doxyfile = configure_file(input: 'Doxyfile.in',
+                          output: 'Doxyfile',
+                          configuration: cdata,
+                          install: false)
+
+doxygen = find_program('doxygen')
+
+doc_target = run_target('doc',command: [doxygen, doxyfile])
diff --git a/meson.build b/meson.build
index 1c25894..2ceda54 100644
--- a/meson.build
+++ b/meson.build
@@ -1,13 +1,13 @@
 project(
-	'gtkterm',
+	'GTKTerm',
 	'c',
-	version: '1.2.1',
-	meson_version : '>= 0.46.0'
+	version: '1.99.1',
+	meson_version : '>= 0.60.0'
 )
 
 # Find dependencies
-gtk_deps = dependency('gtk+-3.0', version : '>= 3.0.0')
-vte_deps = dependency('vte-2.91', version : '>= 0.28.0')
+gtk_deps = dependency('gtk4', version : '>= 4.6.0')
+vte_deps = dependency('vte-2.91-gtk4', version : '>= 0.69.92')
 gudev_deps = dependency('gudev-1.0', version: '>= 230')
 
 # Find install paths
@@ -17,9 +17,10 @@ localedir = join_paths(prefix, get_option('localedir'))
 
 # Configure GTKTerm
 conf = configuration_data()
-conf.set_quoted('VERSION', meson.project_version())
+conf.set_quoted('PACKAGE_VERSION', meson.project_version())
 conf.set_quoted('PACKAGE', meson.project_name())
-conf.set_quoted('RELEASE_DATE', 'July 2022')
+conf.set_quoted('RELEASE_DATE', 'September 2022')
+conf.set_quoted('BUILD_DIR',  meson.project_build_root())
 conf.set_quoted('LOCALEDIR', localedir)
 
 cc = meson.get_compiler('c')
@@ -28,9 +29,22 @@ if have_serial_h
   conf.set('HAVE_LINUX_SERIAL_H', '1')
 endif
 
+doxygen = find_program('doxygen', required : false)
+if doxygen.found()
+  message('Doxygen found')
+else
+  warning('Documentation disabled without doxygen')
+endif
+
 configure_file(output : 'config.h', configuration : conf)
-config = declare_dependency(include_directories : include_directories('.'))
+config = declare_dependency(include_directories : include_directories('.', 'src'))
 
 subdir('data')
 subdir('src')
+subdir('convert')
 subdir('po')
+subdir('doc')
+
+install_man('data/gtkterm.1')
+
+meson.add_install_script('meson_post_install.py')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..f458bb0
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+install_prefix = os.environ['MESON_INSTALL_PREFIX']
+schemadir = os.path.join(install_prefix, 'share', 'glib-2.0', 'schemas')
+
+if not os.environ.get('DESTDIR'):
+    print('Compiling gsettings schemas...')
+    subprocess.call(['glib-compile-schemas', schemadir])
+
+    print ('Update icon chache ...')
+    subprocess.call ('gtk-update-icon-cache')
+
diff --git a/po/meson.build b/po/meson.build
index 43424fe..73a662b 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1,5 +1,5 @@
 i18n = import('i18n')
 
 i18n.gettext(meson.project_name(),
-	args: '--directory=' + meson.source_root()
+	args: '--directory=' + meson.project_source_root()
 )
diff --git a/src/auto_config.h b/src/auto_config.h
deleted file mode 100644
index 34c8ca0..0000000
--- a/src/auto_config.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/***********************************************************************/
-/* gettext.h                                                           */
-/* ---------                                                           */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Include for ../config.h to avoid redefinitions                 */
-/*      - Header file -                                                */
-/*                                                                     */
-/*   ChangeLog                                                         */
-/*      - 0.99.2 : file creation by Julien                             */
-/*                                                                     */
-/***********************************************************************/
-
-#ifndef AUTO_CONFIG_H_
-#define AUTO_CONFIG_H_
-
-#include "../config.h"
-
-#endif
diff --git a/src/buffer.c b/src/buffer.c
deleted file mode 100644
index cac18a9..0000000
--- a/src/buffer.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/***********************************************************************/
-/* buffer.c                                                            */
-/* --------                                                            */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Management of a local buffer of data received                  */
-/*                                                                     */
-/*   ChangeLog                                                         */
-/*      - 0.99.7 : removed (send)auto crlf stuff - (use macros instead)*/
-/*      - 0.99.5 : Corrected segfault in case of buffer overlap        */
-/*      - 0.99.2 : Internationalization                                */
-/*      - 0.98.4 : file creation by Julien                             */
-/*                                                                     */
-/***********************************************************************/
-
-#include <glib.h>
-#include <stdlib.h>
-#include <string.h>
-#include "buffer.h"
-#include "i18n.h"
-#include "serial.h"
-
-#include <config.h>
-#include <glib/gi18n.h>
-#include <time.h>
-
-#define TIMESTAMP_SIZE 50
-
-extern gboolean timestamp_on;
-static int need_to_write_timestamp = 0;
-static char *buffer = NULL;
-static char *current_buffer;
-static unsigned int pointer;
-static int cr_received = 0;
-char overlapped;
-
-extern guint virt_col_pos;
-
-
-void (*write_func)(const char *, unsigned int) = NULL;
-void (*clear_func)(void) = NULL;
-
-void create_buffer(void)
-{
-	if(buffer == NULL)
-	{
-		buffer = malloc(BUFFER_SIZE);
-		clear_buffer();
-	}
-	return;
-}
-
-void delete_buffer(void)
-{
-	if(buffer != NULL)
-		free(buffer);
-	return;
-}
-
-//assumes that buffer always has space for timestamp (TIMESTAMP_SIZE)
-//buffer points to location where timestamp will be inserted
-unsigned int insert_timestamp(char *buffer)
-{
-  unsigned int size = 0;
-
-	if(timestamp_on)
-	{
-		char buf[TIMESTAMP_SIZE];
-		struct timespec ts;
-		int d,h,m,s,x;
-		timespec_get(&ts, TIME_UTC);
-		d = (ts.tv_sec / (3600 * 24));
-		h = (ts.tv_sec / 3600) % 24;
-		m = (ts.tv_sec / 60 ) % 60;
-		s = ts.tv_sec % 60;
-		x = ts.tv_nsec / 1000000;
-		snprintf(buf, TIMESTAMP_SIZE - 1, "[%d.%02uh.%02um.%02us.%03u] "
-				, d, h, m, s, x );
-		strcpy(buffer, buf);
-		size = strlen(buf);
-	}
-  return size;
-}
-
-void put_chars(const char *chars, unsigned int size, gboolean crlf_auto)
-{
-	// buffer must still be valid after cr conversion or adding timestamp
-	// only pointer is copied below
-	char out_buffer[(BUFFER_RECEPTION*2) + TIMESTAMP_SIZE];
-	const char *characters;
-
-	/* If the auto CR LF mode on, read the buffer to add \r before \n */
-	if(crlf_auto || timestamp_on)
-	{
-		int i, out_size = 0;
-
-		for (i=0; i<size; i++)
-		{
-      if(crlf_auto)
-			{
-				if (chars[i] == '\r')
-				{
-					/* If the previous character was a CR too, insert a newline */
-					if (cr_received)
-					{
-						out_buffer[out_size] = '\n';
-						out_size++;
-						need_to_write_timestamp = 1;
-					}
-					cr_received = 1;
-				}
-				else
-				{
-					if (chars[i] == '\n')
-					{
-						/* If we get a newline without a CR first, insert a CR */
-						if (!cr_received)
-						{
-							out_buffer[out_size] = '\r';
-							out_size++;
-						}
-					}
-					else
-					{
-						/* If we receive a normal char, and the previous one was a
-						   CR insert a newline */
-						if (cr_received)
-						{
-							out_buffer[out_size] = '\n';
-							out_size++;
-							need_to_write_timestamp = 1;
-						}
-					}
-					cr_received = 0;
-				}
-			} //if crlf_auto
-
-			if(need_to_write_timestamp)
-			{
-				out_size += insert_timestamp(&out_buffer[out_size]);
-				need_to_write_timestamp = 0;
-			}
-
-			if(chars[i] == '\n' )
-			{
-				need_to_write_timestamp = 1; //remember until we have a new character to print
-			}
-
-			//copy each character to new buffer
-			out_buffer[out_size] = chars[i];
-			out_size++; // increment for each stored character
-
-		} // for
-
-		// set "incoming" data pointer to new buffer containing all normal and
-		// converted newline characters
-		chars = out_buffer;
-		size = out_size;
-	} // if(crlf_auto || timestamp_on)
-
-	if(buffer == NULL)
-	{
-		i18n_printf(_("ERROR : Buffer is not initialized !\n"));
-		return;
-	}
-
-	// when incoming size is larger than buffer, then just print the
-	// last BUFFER_SIZE characters and ignore all other at begin of buffer
-	if(size > BUFFER_SIZE)
-	{
-		characters = chars + (size - BUFFER_SIZE);
-		size = BUFFER_SIZE;
-	}
-	else
-		characters = chars;
-
-	if((size + pointer) >= BUFFER_SIZE)
-	{
-		memcpy(current_buffer, characters, BUFFER_SIZE - pointer);
-		chars = characters + BUFFER_SIZE - pointer;
-		pointer = size - (BUFFER_SIZE - pointer);
-		memcpy(buffer, chars, pointer);
-		current_buffer = buffer + pointer;
-		overlapped = 1;
-	}
-	else
-	{
-		memcpy(current_buffer, characters, size);
-		pointer += size;
-		current_buffer += size;
-	}
-
-	if(write_func != NULL)
-		write_func(characters, size);
-}
-
-void write_buffer(void)
-{
-	if(write_func == NULL)
-		return;
-
-	if(overlapped == 0)
-		write_func(buffer, pointer);
-	else
-	{
-		write_func(current_buffer, BUFFER_SIZE - pointer);
-		write_func(buffer, pointer);
-	}
-}
-
-void write_buffer_with_func(void (*func)(const char *, unsigned int))
-{
-	void (*write_func_backup)(const char *, unsigned int);
-
-	write_func_backup = write_func;
-	write_func = func;
-	write_buffer();
-	write_func = write_func_backup;
-}
-
-void clear_buffer(void)
-{
-	if(clear_func != NULL)
-		clear_func();
-
-	if(buffer == NULL)
-		return;
-
-	overlapped = 0;
-	memset(buffer, 0, BUFFER_SIZE);
-	current_buffer = buffer;
-	pointer = 0;
-	cr_received = 0;
-
-	virt_col_pos = 0;
-}
-
-void set_clear_func(void (*func)(void))
-{
-	clear_func = func;
-}
-
-void unset_clear_func(void (*func)(void))
-{
-	clear_func = NULL;
-}
-
-void set_display_func(void (*func)(const char *, unsigned int))
-{
-	write_func = func;
-}
-
-void unset_display_func(void (*func)(const char *, unsigned int))
-{
-	write_func = NULL;
-}
diff --git a/src/buffer.h b/src/buffer.h
deleted file mode 100644
index 1caece8..0000000
--- a/src/buffer.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/***********************************************************************/
-/* buffer.h                                                            */
-/* --------                                                            */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Management of a local buffer of data received                  */
-/*      - Header file -                                                */
-/*                                                                     */
-/*   ChangeLog                                                         */
-/*      - 0.99.7 : removed auto crlf stuff - (use macros instead)      */
-/*      - 0.98.4 : file creation by Julien                             */
-/*                                                                     */
-/***********************************************************************/
-
-#ifndef BUFFER_H_
-#define BUFFER_H_
-
-#define BUFFER_SIZE (128 * 1024)
-
-void create_buffer(void);
-void delete_buffer(void);
-void put_chars(const char *, unsigned int, gboolean);
-void clear_buffer(void);
-void write_buffer(void);
-void set_display_func(void (*func)(const char *, unsigned int));
-void unset_display_func(void (*func)(const char *, unsigned int));
-void set_clear_func(void (*func)(void));
-void unset_clear_func(void (*func)(void));
-void write_buffer_with_func(void (*func)(const char *, unsigned int));
-
-#endif
diff --git a/src/cmdline.c b/src/cmdline.c
deleted file mode 100644
index 7afc601..0000000
--- a/src/cmdline.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/***********************************************************************/
-/* cmdline.c                                                           */
-/* ---------                                                           */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Reads the command line                                         */
-/*                                                                     */
-/*   ChangeLog                                                         */
-/*      - 0.99.2 : Internationalization                                */
-/*      - 0.98.3 : modified for configuration file                     */
-/*      - 0.98.2 : added --echo                                        */
-/*      - 0.98 : file creation by Julien                               */
-/*                                                                     */
-/***********************************************************************/
-
-#include <gtk/gtk.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <string.h>
-
-#include "term_config.h"
-#include "files.h"
-#include "auto_config.h"
-#include "i18n.h"
-
-#include <config.h>
-#include <glib/gi18n.h>
-
-extern struct configuration_port config;
-
-void display_help(void)
-{
-	i18n_printf(_("\nGTKTerm version %s\n"), VERSION);
-	i18n_printf(_("\t (c) Julien Schmitt\n"));
-	i18n_printf(_("\nThis program is released under the terms of the GPL V.2\n"));
-	i18n_printf(_("\t ** Use at your own risks ! **\n"));
-	i18n_printf(_("\nCommand line options\n"));
-	i18n_printf(_("--help or -h : this help screen\n"));
-	i18n_printf(_("--config <configuration> or -c : load configuration\n"));
-	i18n_printf(_("--port <device> or -p : serial port device (default /dev/ttyS0)\n"));
-	i18n_printf(_("--speed <speed> or -s : serial port speed (default 9600)\n"));
-	i18n_printf(_("--bits <bits> or -b : number of bits (default 8)\n"));
-	i18n_printf(_("--stopbits <stopbits> or -t : number of stopbits (default 1)\n"));
-	i18n_printf(_("--parity <odd | even> or -a : parity (default none)\n"));
-	i18n_printf(_("--flow <Xon | RTS | RS485> or -w : flow control (default none)\n"));
-	i18n_printf(_("--delay <ms> or -d : end of line delay in ms (default none)\n"));
-	i18n_printf(_("--char <char> or -r : wait for a special char at end of line (default none)\n"));
-	i18n_printf(_("--file <filename> or -f : default file to send (default none)\n"));
-	i18n_printf(_("--rts_time_before <ms> or -x : for RS-485, time in ms before transmit with rts on\n"));
-	i18n_printf(_("--rts_time_after <ms> or -y : for RS-485, time in ms after transmit with rts on\n"));
-	i18n_printf(_("--echo or -e : switch on local echo\n"));
-	i18n_printf(_("--disable-port-lock or -L: does not lock serial port. Allows to send to serial port from different terminals\n"));
-	i18n_printf(_("                      Note: incoming data are displayed randomly on only one terminal\n"));
-	i18n_printf("\n");
-}
-
-int read_command_line(int argc, char **argv, gchar *configuration_to_read)
-{
-	int c;
-	int option_index = 0;
-
-	static struct option long_options[] =
-	{
-		{"speed", 1, 0, 's'},
-		{"parity", 1, 0, 'a'},
-		{"stopbits", 1, 0, 't'},
-		{"bits", 1, 0, 'b'},
-		{"file", 1, 0, 'f'},
-		{"port", 1, 0, 'p'},
-		{"flow", 1, 0, 'w'},
-		{"delay", 1, 0, 'd'},
-		{"char", 1, 0, 'r'},
-		{"help", 0, 0, 'h'},
-		{"echo", 0, 0, 'e'},
-		{"disable-port-lock", 0, 0, 'L'},
-		{"rts_time_before", 1, 0, 'x'},
-		{"rts_time_after", 1, 0, 'y'},
-		{"config", 1, 0, 'c'},
-		{0, 0, 0, 0}
-	};
-
-	/* need a working configuration file ! */
-	Check_configuration_file();
-
-	while(1)
-	{
-		c = getopt_long (argc, argv, "s:a:t:b:f:p:w:d:r:heLc:x:y:", long_options, &option_index);
-
-		if(c == -1)
-			break;
-
-		switch(c)
-		{
-		case 'c':
-			Load_configuration_from_file(optarg);
-			break;
-
-		case 's':
-			config.vitesse = atoi(optarg);
-			break;
-
-		case 'a':
-			if(!strcmp(optarg, "odd"))
-				config.parite = 1;
-			else if(!strcmp(optarg, "even"))
-				config.parite = 2;
-			break;
-
-		case 't':
-			config.stops = atoi(optarg);
-			break;
-
-		case 'b':
-			config.bits = atoi(optarg);
-			break;
-
-		case 'f':
-			fic_defaut = g_strdup(optarg);
-			break;
-
-		case 'p':
-			strcpy(config.port, optarg);
-			break;
-
-		case 'w':
-			if(!strcmp(optarg, "Xon"))
-				config.flux = 1;
-			else if(!strcmp(optarg, "RTS"))
-				config.flux = 2;
-			else if(!strcmp(optarg, "RS485"))
-				config.flux = 3;
-			break;
-
-		case 'd':
-			config.delai = atoi(optarg);
-			break;
-
-		case 'r':
-			config.car = *optarg;
-			break;
-
-		case 'e':
-			config.echo = TRUE;
-			break;
-
-		case 'L':
-			config.disable_port_lock = TRUE;
-			break;
-
-		case 'x':
-			config.rs485_rts_time_before_transmit = atoi(optarg);
-			break;
-
-		case 'y':
-			config.rs485_rts_time_after_transmit = atoi(optarg);
-			break;
-
-		case 'h':
-			display_help();
-			return -1;
-
-		default:
-			i18n_printf(_("Undefined command line option\n"));
-			return -1;
-		}
-	}
-	Verify_configuration();
-	return 0;
-}
diff --git a/src/device_monitor.c b/src/device_monitor.c
deleted file mode 100644
index 8da5e4f..0000000
--- a/src/device_monitor.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/***********************************************************************/
-/* device_mintor.h													 */
-/* ---------														   */
-/*		   GTKTerm Software										  */
-/*					  (c) Julien Schmitt							 */
-/*																	 */
-/* ------------------------------------------------------------------- */
-/*																	 */
-/*   Purpose														   */
-/*	  Monitor device to autoreconnect								*/
-/*   Written by Kevin Picot - picotk27@gmail.com					   */
-/*																	 */
-/***********************************************************************/
-
-#include <device_monitor.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <pthread.h>
-#include <stdbool.h>
-#include <unistd.h>
-#include <locale.h>
-#include <string.h>
-#include <gtk/gtk.h>
-#include <glib.h>
-#include <serial.h>
-#include <interface.h>
-#include <term_config.h>
-#include <gudev/gudev.h>
-
-#include "interface.h"
-
-extern struct configuration_port config;
-
-static inline void device_monitor_status(const bool connected)
-{
-	if (connected)
-		interface_open_port();
-	else
-		interface_close_port();
-}
-
-static inline void device_monitor_handle(const char *action)
-{
-	if (strcmp(action, "remove") == 0)
-		device_monitor_status(false);
-	else if (strcmp(action, "add") == 0)
-		device_monitor_status(true);
-}
-
-void event_udev(GUdevClient *client, const gchar *action, GUdevDevice *device)
-{
-
-	if (!device || !action)
-		return;
-
-	if (!g_udev_device_get_device_file(device))
-		return;
-
-	const gchar *name = config.port;
-
-	if (strcmp(g_udev_device_get_device_file(device), name) == 0)
-		device_monitor_handle(action);
-}
-
-extern void device_monitor_start(void)
-{
-
-	const gchar *const subsystems[] = {NULL, NULL};
-
-	/* Initial check */
-	GUdevClient *udev_client = g_udev_client_new(subsystems);
-
-	if (g_udev_client_query_by_device_file(udev_client, config.port) == NULL) {
-		device_monitor_status(false);
-	} else {
-		device_monitor_status(true);
-	}
-
-	/* Monitor device */
-	g_signal_connect(G_OBJECT(udev_client), "uevent",
-	                 G_CALLBACK(event_udev), NULL);
-}
diff --git a/src/device_monitor.h b/src/device_monitor.h
deleted file mode 100644
index 47db11f..0000000
--- a/src/device_monitor.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/***********************************************************************/
-/* device_mintor.h                                                     */
-/* ---------                                                           */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Monitor device to autoreconnect                                */
-/*   Written by Kevin Picot - picotk27@gmail.com                       */
-/*                                                                     */
-/***********************************************************************/
-
-#ifndef DEV_MON_H_
-#define DEV_MON_H_
-
-extern void device_monitor_start(void);
-
-#endif
diff --git a/src/files.c b/src/files.c
deleted file mode 100644
index 9b80d2d..0000000
--- a/src/files.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/***********************************************************************/
-/* fichier.c                                                           */
-/* ---------                                                           */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Raw / text file transfer management                            */
-/*                                                                     */
-/*   ChangeLog                                                         */
-/*   (All changes by Julien Schmitt except when explicitly written)    */
-/*                                                                     */
-/*      - 0.99.5 : changed all calls to strerror() by strerror_utf8()  */
-/*      - 0.99.4 : added auto CR LF function by Sebastien              */
-/*                 modified ecriture() to use send_serial()            */
-/*      - 0.99.2 : Internationalization                                */
-/*      - 0.98.4 : modified to use new buffer                          */
-/*      - 0.98 : file transfer completely rewritten / optimized        */
-/*                                                                     */
-/***********************************************************************/
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <glib.h>
-
-#include "term_config.h"
-#include "interface.h"
-#include "serial.h"
-#include "buffer.h"
-
-#include <config.h>
-#include <glib/gi18n.h>
-
-/* Global variables */
-gint nb_car;
-gint car_written;
-gint current_buffer_position;
-gint bytes_read;
-GtkAdjustment *adj;
-GtkWidget *ProgressBar;
-gint Fichier;
-guint callback_handler;
-gchar *fic_defaut = NULL;
-GtkWidget *Window;
-gboolean waiting_for_char = FALSE;
-gboolean waiting_for_timer = FALSE;
-gboolean input_running = FALSE;
-gchar *str = NULL;
-FILE *Fic;
-
-/* Local functions prototype */
-gint Envoie_fichier(GtkFileChooser *FS);
-gint Sauve_fichier(GtkFileChooser *FS);
-gint close_all(void);
-void ecriture(gpointer data, gint source);
-gboolean timer(gpointer pointer);
-gboolean idle(gpointer pointer);
-void remove_input(void);
-void add_input(void);
-void write_file(char *, unsigned int);
-
-extern struct configuration_port config;
-
-
-void send_raw_file(GtkAction *action, gpointer data)
-{
-	GtkWidget *file_select;
-
-	file_select = gtk_file_chooser_dialog_new(_("Send RAW File"),
-	              GTK_WINDOW(Fenetre),
-	              GTK_FILE_CHOOSER_ACTION_OPEN,
-	              GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-	              GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
-	              NULL);
-
-	if(fic_defaut != NULL)
-		gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(file_select), fic_defaut);
-
-	if(gtk_dialog_run(GTK_DIALOG(file_select)) == GTK_RESPONSE_ACCEPT)
-	{
-		gchar *fileName;
-		gchar *msg;
-
-		fileName = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_select));
-
-		if(!g_file_test(fileName, G_FILE_TEST_IS_REGULAR))
-		{
-			msg = g_strdup_printf(_("Error opening file\n"));
-			show_message(msg, MSG_ERR);
-			g_free(msg);
-			g_free(fileName);
-			gtk_widget_destroy(file_select);
-			return;
-		}
-
-		Fichier = open(fileName, O_RDONLY);
-		if(Fichier != -1)
-		{
-			GtkWidget *Bouton_annuler, *Box;
-
-			fic_defaut = g_strdup(fileName);
-			msg = g_strdup_printf(_("%s : transfer in progress..."), fileName);
-
-			gtk_statusbar_push(GTK_STATUSBAR(StatusBar), id, msg);
-			car_written = 0;
-			current_buffer_position = 0;
-			bytes_read = 0;
-			nb_car = lseek(Fichier, 0L, SEEK_END);
-			lseek(Fichier, 0L, SEEK_SET);
-
-			Window = gtk_dialog_new();
-			gtk_window_set_title(GTK_WINDOW(Window), msg);
-			g_free(msg);
-			Box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10);
-			gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(Window))), Box);
-			ProgressBar = gtk_progress_bar_new();
-
-			gtk_box_pack_start(GTK_BOX(Box), ProgressBar, FALSE, FALSE, 5);
-
-			Bouton_annuler = gtk_button_new_with_label(_("Cancel"));
-			g_signal_connect(GTK_WIDGET(Bouton_annuler), "clicked", G_CALLBACK(close_all), NULL);
-
-			gtk_container_add(GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(Window))), Bouton_annuler);
-
-			g_signal_connect(GTK_WIDGET(Window), "delete_event", G_CALLBACK(close_all), NULL);
-
-			gtk_window_set_default_size(GTK_WINDOW(Window), 250, 100);
-			gtk_window_set_modal(GTK_WINDOW(Window), TRUE);
-			gtk_widget_show_all(Window);
-
-			add_input();
-		}
-		else
-		{
-			msg = g_strdup_printf(_("Cannot read file %s: %s\n"), fileName, strerror(errno));
-			show_message(msg, MSG_ERR);
-			g_free(msg);
-		}
-		g_free(fileName);
-	}
-	gtk_widget_destroy(file_select);
-}
-
-void ecriture(gpointer data, gint source)
-{
-	static gchar buffer[BUFFER_EMISSION];
-	static gchar *current_buffer;
-	static gint bytes_to_write;
-	gint bytes_written;
-	gchar *car;
-
-	gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ProgressBar), (gfloat)car_written/(gfloat)nb_car );
-
-	if(car_written < nb_car)
-	{
-		/* Read the file only if buffer totally sent or if buffer empty */
-		if(current_buffer_position == bytes_read)
-		{
-			bytes_read = read(Fichier, buffer, BUFFER_EMISSION);
-
-			current_buffer_position = 0;
-			current_buffer = buffer;
-			bytes_to_write = bytes_read;
-		}
-
-		if(current_buffer == NULL)
-		{
-			/* something went wrong... */
-			g_free(str);
-			str = g_strdup_printf(_("Error sending file\n"));
-			show_message(str, MSG_ERR);
-			close_all();
-			return;
-		}
-
-		car = current_buffer;
-
-		if(config.delai != 0 || config.car != -1)
-		{
-			/* search for next LF */
-			bytes_to_write = current_buffer_position;
-			while(*car != LINE_FEED && bytes_to_write < bytes_read)
-			{
-				car++;
-				bytes_to_write++;
-			}
-			if(*car == LINE_FEED)
-				bytes_to_write++;
-		}
-
-		/* write to serial port */
-		bytes_written = send_serial(current_buffer, bytes_to_write - current_buffer_position);
-
-		if(bytes_written == -1)
-		{
-			/* Problem while writing, stop file transfer */
-			g_free(str);
-			str = g_strdup_printf(_("Error sending file: %s\n"), strerror(errno));
-			show_message(str, MSG_ERR);
-			close_all();
-			return;
-		}
-
-		car_written += bytes_written;
-		current_buffer_position += bytes_written;
-		current_buffer += bytes_written;
-
-		gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ProgressBar), (gfloat)car_written/(gfloat)nb_car );
-
-		if(config.delai != 0 && *car == LINE_FEED)
-		{
-			remove_input();
-			g_timeout_add(config.delai, (GSourceFunc)timer, NULL);
-			waiting_for_timer = TRUE;
-		}
-		else if(config.car != -1 && *car == LINE_FEED)
-		{
-			remove_input();
-			waiting_for_char = TRUE;
-		}
-	}
-	else
-	{
-		close_all();
-		return;
-	}
-	return;
-}
-
-gboolean timer(gpointer pointer)
-{
-	if(waiting_for_timer == TRUE)
-	{
-		add_input();
-		waiting_for_timer = FALSE;
-	}
-	return FALSE;
-}
-
-void add_input(void)
-{
-	if(input_running == FALSE)
-	{
-		input_running = TRUE;
-		callback_handler = g_io_add_watch_full(g_io_channel_unix_new(serial_port_fd),
-		                                       10,
-		                                       G_IO_OUT,
-		                                       (GIOFunc)ecriture,
-		                                       NULL, NULL);
-
-	}
-}
-
-void remove_input(void)
-{
-	if(input_running == TRUE)
-	{
-		g_source_remove(callback_handler);
-		input_running = FALSE;
-	}
-}
-
-gint close_all(void)
-{
-	remove_input();
-	waiting_for_char = FALSE;
-	waiting_for_timer = FALSE;
-	gtk_statusbar_pop(GTK_STATUSBAR(StatusBar), id);
-	close(Fichier);
-	gtk_widget_destroy(Window);
-
-	return FALSE;
-}
-
-void write_file(char *data, unsigned int size)
-{
-	fwrite(data, size, 1, Fic);
-}
-
-void save_raw_file(GtkAction *action, gpointer data)
-{
-	GtkWidget *file_select;
-
-	file_select = gtk_file_chooser_dialog_new(_("Save RAW File"),
-	              GTK_WINDOW(Fenetre),
-	              GTK_FILE_CHOOSER_ACTION_SAVE,
-	              GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-	              GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
-	              NULL);
-	gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(file_select), TRUE);
-
-	if(fic_defaut != NULL)
-		gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(file_select), fic_defaut);
-
-	if(gtk_dialog_run(GTK_DIALOG(file_select)) == GTK_RESPONSE_ACCEPT)
-	{
-		gchar *fileName;
-		gchar *msg;
-
-		fileName = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_select));
-		if ((!fileName || (strcmp(fileName, ""))) == 0)
-		{
-			msg = g_strdup_printf(_("File error\n"));
-			show_message(msg, MSG_ERR);
-			g_free(msg);
-			g_free(fileName);
-			gtk_widget_destroy(file_select);
-			return;
-		}
-
-		Fic = fopen(fileName, "w");
-		if(Fic == NULL)
-		{
-			msg = g_strdup_printf(_("Cannot open file %s: %s\n"), fileName, strerror(errno));
-			show_message(msg, MSG_ERR);
-			g_free(msg);
-		}
-		else
-		{
-			fic_defaut = g_strdup(fileName);
-
-			write_buffer_with_func(write_file);
-
-			fclose(Fic);
-		}
-		g_free(fileName);
-	}
-	gtk_widget_destroy(file_select);
-}
-
diff --git a/src/files.h b/src/files.h
deleted file mode 100644
index 8bf83c0..0000000
--- a/src/files.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/***********************************************************************/
-/* files.h                                                           */
-/* ---------                                                           */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Raw / text file transfer management                            */
-/*      - Header file -                                                */
-/*                                                                     */
-/***********************************************************************/
-
-#ifndef FICHIER_H_
-#define FICHIER_H_
-
-void send_raw_file(GtkAction *action, gpointer data);
-void save_raw_file(GtkAction *action, gpointer data);
-void add_input(void);
-
-extern gboolean waiting_for_char;
-extern gchar *fic_defaut;
-
-
-#endif
diff --git a/src/gtkterm.c b/src/gtkterm.c
index cee9f82..55df0c6 100644
--- a/src/gtkterm.c
+++ b/src/gtkterm.c
@@ -10,6 +10,7 @@
 /*      Main program file                                              */
 /*                                                                     */
 /*   ChangeLog                                                         */
+/*      - 2.0 : Ported to GTK4                                         */
 /*      - 0.99.2 : Internationalization                                */
 /*      - 0.99.0 : added call to add_shortcuts()                       */
 /*      - 0.98 : all GUI functions moved to widgets.c                  */
@@ -17,65 +18,290 @@
 /***********************************************************************/
 
 #include <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include <stdlib.h>
-
-#include "interface.h"
-#include "serial.h"
-#include "term_config.h"
-#include "cmdline.h"
-#include "parsecfg.h"
-#include "buffer.h"
-#include "macros.h"
-#include "auto_config.h"
-#include "device_monitor.h"
-#include "user_signals.h"
-
-#include <config.h>
+#include <vte/vte.h>
 #include <glib/gi18n.h>
+#include <glib/gprintf.h>
 
-int main(int argc, char *argv[])
-{
-	gchar *message;
+#include "config.h"
+#include "gtkterm_defaults.h"
+#include "gtkterm.h"
+#include "gtkterm_window.h"
+#include "gtkterm_terminal.h"
+#include "gtkterm_cmdline.h"
+#include "gtkterm_serial_port.h"
 
-	config_file_init();
-	bindtextdomain(PACKAGE, LOCALEDIR);
-	bind_textdomain_codeset(PACKAGE, "UTF-8");
-	textdomain(PACKAGE);
+/** The gtkterm signals available */
+unsigned int gtkterm_signals[LAST_GTKTERM_SIGNAL];
+
+G_DEFINE_TYPE (GtkTerm, gtkterm, GTK_TYPE_APPLICATION)
+
+/**
+ * @brief Quitthe application
+ * 
+ * Is a callback function from the menubar and cleans up all
+ * memory, windows etc.
+ * 
+ * @param action Not used.
+ * 
+ * @param parameter Not used.
+ * 
+ * @param user_data The application we want to quit
+ * 
+ */
+static void on_gtkterm_quit (GSimpleAction *action,
+               GVariant      *parameter,
+               gpointer       user_data) {
+ 
+  GtkTerm *app = GTKTERM_APP(user_data);
+  GtkWidget *win;
+  GList *list, *next;
+
+  list = gtk_application_get_windows (GTK_APPLICATION(app));
+  while (list)
+    {
+      win = list->data;
+      next = list->next;
+
+      gtk_window_destroy (GTK_WINDOW (win));
+
+      list = next;
+    }
+
+  /** Clean up memory */
+  g_free (app->section);
+
+  /** \todo: Should be part of the Gtkterm application struct */
+  g_option_group_unref (app->g_term_group);
+  g_option_group_unref (app->g_port_group);
+  g_option_group_unref (app->g_config_group); 
+}
+
+static GActionEntry gtkterm_entries[] = {
+  { "quit", on_gtkterm_quit, NULL, NULL, NULL },
+
+};
+
+/**
+ * @brief Startup the application
+ * 
+ * Initiaze the builder and add menu resources to the application
+ * 
+ * @param app The application
+ * 
+ */
+static void gtkterm_startup (GApplication *app) {
+
+  GtkBuilder *builder;
+
+  G_APPLICATION_CLASS (gtkterm_parent_class)->startup (app);
+
+  builder = gtk_builder_new ();
+  gtk_builder_add_from_resource (builder, "/com/github/jeija/gtkterm/menu.ui", NULL);
+
+  gtk_application_set_menubar (GTK_APPLICATION (app),
+                               G_MENU_MODEL (gtk_builder_get_object (builder, "gtkterm_menubar")));
+
+  g_object_unref (builder);
+}
 
-	gtk_init(&argc, &argv);
+/**
+ * @brief Activates the application
+ * 
+ * Create the main window. The actual creation of the terminal will be done
+ * in the GtkTermWindow file.
+ * 
+ * @param app The application
+ * 
+ *  \todo embed create_window in the gtkapplication window 
+ * 
+ */
+static void gtkterm_activate (GApplication *app) {
 
-	create_buffer();
+  GtkTermWindow *window = (GtkTermWindow *)g_object_new (GTKTERM_TYPE_GTKTERM_WINDOW,
+                                                          "application", 
+                                                          GTKTERM_APP(app),
+                                                          "show-menubar", 
+                                                          TRUE,
+                                                          NULL);
 
-	create_main_window();
+  create_window (app, window);
 
-	if(read_command_line(argc, argv) < 0)
-	{
-		delete_buffer();
-		exit(1);
-	}
+  gtk_window_present (GTK_WINDOW (window));  
+}
+
+/**
+ * @brief The initialization of the application
+ * 
+ * Setting the cli options and initialize the application variables
+ * 
+ * @param app The application
+ * 
+ */
+static void gtkterm_init (GtkTerm *app) {
+  GSettings *settings;
+
+  settings = g_settings_new ("com.github.jeija.gtkterm");
+
+  /** Set an action group for the app entries. */
+  app->action_group =  G_ACTION_GROUP (g_simple_action_group_new ()); 
+
+  g_action_map_add_action_entries (G_ACTION_MAP (app),
+                                   gtkterm_entries, 
+                                   G_N_ELEMENTS (gtkterm_entries),
+                                   app);  
+
+  /** Initialize the config file and set the section to [default] */
+  app->config = GTKTERM_CONFIGURATION (g_object_new (GTKTERM_TYPE_CONFIGURATION, NULL));
+  app->section = g_strdup (DEFAULT_SECTION);
+
+  gtkterm_add_cmdline_options (app); 
+
+  g_object_unref (settings);
+}
+
+/**
+ * @brief Initializing the application class
+ * 
+ * Setting the signals and callback functions
+ * 
+ * @param class The application class
+ * 
+ */
+static void gtkterm_class_init (GtkTermClass *class) {
 
-	Config_port();
-	ConfigFlags();
+  GApplicationClass *app_class = G_APPLICATION_CLASS (class); 
 
-	message = get_port_string();
-	Set_window_title(message);
-	Set_status_message(message);
-	g_free(message);
+  gtkterm_signals[SIGNAL_GTKTERM_LOAD_CONFIG] = g_signal_new ("config_load",
+                                                GTKTERM_TYPE_CONFIGURATION,
+                                                G_SIGNAL_RUN_FIRST,
+                                                0,
+                                                NULL,
+                                                NULL,
+                                                NULL,
+                                                G_TYPE_POINTER,
+                                                0,
+                                                NULL);
 
-	add_shortcuts();
+  gtkterm_signals[SIGNAL_GTKTERM_SAVE_CONFIG] = g_signal_new ("config_save",
+                                                GTKTERM_TYPE_CONFIGURATION,
+                                                G_SIGNAL_RUN_FIRST,
+                                                0,
+                                                NULL,
+                                                NULL,
+                                                NULL,
+                                                G_TYPE_POINTER,
+                                                0,
+                                                NULL);
 
-	set_view(ASCII_VIEW);
+  gtkterm_signals[SIGNAL_GTKTERM_LIST_CONFIG] = g_signal_new ("config_list",
+                                                GTKTERM_TYPE_CONFIGURATION,
+                                                G_SIGNAL_RUN_FIRST,
+                                                0,
+                                                NULL,
+                                                NULL,
+                                                NULL,
+                                                G_TYPE_POINTER,
+                                                0,
+                                                NULL);
 
-	device_monitor_start();
 
-	user_signals_catch();
+  gtkterm_signals[SIGNAL_GTKTERM_PRINT_SECTION] = g_signal_new ("config_print",
+                                                GTKTERM_TYPE_CONFIGURATION,
+                                                G_SIGNAL_RUN_FIRST,
+                                                0,
+                                                NULL,
+                                                NULL,
+                                                NULL,
+                                                G_TYPE_NONE,
+                                                1,
+                                                G_TYPE_POINTER,
+                                                NULL);                                                                                                                                            
 
-	gtk_main();
+  gtkterm_signals[SIGNAL_GTKTERM_REMOVE_SECTION] = g_signal_new ("config_remove",
+                                               GTKTERM_TYPE_CONFIGURATION,
+                                               G_SIGNAL_RUN_FIRST,
+                                               0,
+                                               NULL,
+                                               NULL,
+                                               NULL,
+                                               G_TYPE_POINTER,
+                                               0,
+                                               NULL);
 
-	delete_buffer();
+  gtkterm_signals[SIGNAL_GTKTERM_CONFIG_CHECK_FILE] = g_signal_new ("config_check",
+                                               GTKTERM_TYPE_CONFIGURATION,
+                                               G_SIGNAL_RUN_FIRST,
+                                               0,
+                                               NULL,
+                                               NULL,
+                                               NULL,
+                                               G_TYPE_NONE,
+                                               0,
+                                               NULL);                                               
+
+    gtkterm_signals[SIGNAL_GTKTERM_CONFIG_TERMINAL] = g_signal_new ("config_terminal",
+                                               GTKTERM_TYPE_CONFIGURATION,
+                                               G_SIGNAL_RUN_FIRST,
+                                               0,
+                                             	 NULL,
+                                               NULL,
+                                               NULL,
+                                               G_TYPE_POINTER,
+                                               1,
+																               G_TYPE_POINTER,
+                                               NULL);
+
+    gtkterm_signals[SIGNAL_GTKTERM_CONFIG_SERIAL] = g_signal_new ("config_serial",
+                                               GTKTERM_TYPE_CONFIGURATION,
+                                               G_SIGNAL_RUN_FIRST,
+                                               0,
+                                               NULL,
+                                               NULL,
+                                               NULL,
+                                               G_TYPE_POINTER,
+                                               1,
+																               G_TYPE_POINTER,
+                                               NULL);
+
+  gtkterm_signals[SIGNAL_GTKTERM_COPY_SECTION] = g_signal_new ("config_copy",
+                                               GTKTERM_TYPE_CONFIGURATION,
+                                               G_SIGNAL_RUN_FIRST,
+                                               0,
+                                               NULL,
+                                               NULL,
+                                               NULL,
+                                               G_TYPE_POINTER,
+                                               3,
+																               G_TYPE_POINTER,
+																               G_TYPE_POINTER,
+																               G_TYPE_POINTER,                                                                                                                                             
+                                               NULL);                                               
+
+  app_class->startup = gtkterm_startup;
+  app_class->activate = gtkterm_activate;
+}
+
+/**
+ * @brief The main function
+ * 
+ * @param argc Number of cli arguments
+ * 
+ * @param argv The cli arguments
+ * 
+ */
+int main (int argc, char *argv[]) {
+	GtkApplication *app;
+
+	bindtextdomain(PACKAGE, LOCALEDIR);
+	bind_textdomain_codeset(PACKAGE, "UTF-8");
+	textdomain(PACKAGE);
 
-	Close_port();
+	app = GTK_APPLICATION (g_object_new (GTKTERM_TYPE_APP,
+                                       "application-id", 
+                                       "com.github.jeija.gtkterm",
+                                       "flags", 
+                                       G_APPLICATION_HANDLES_OPEN,
+                                       NULL));                                    
 
-	return 0;
+	return g_application_run (G_APPLICATION (app), argc, argv);
 }
diff --git a/src/gtkterm.h b/src/gtkterm.h
new file mode 100644
index 0000000..15206f2
--- /dev/null
+++ b/src/gtkterm.h
@@ -0,0 +1,64 @@
+
+#ifndef GTKTERM_H
+#define GTKTERM_H
+
+#include <gio/gio.h>
+#include <glib-object.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gprintf.h>
+
+#include "gtkterm_defaults.h"
+#include "gtkterm_configuration.h"
+
+/** The signals which are defined */
+enum {
+    SIGNAL_GTKTERM_LOAD_CONFIG,
+    SIGNAL_GTKTERM_SAVE_CONFIG,
+    SIGNAL_GTKTERM_LIST_CONFIG, 
+    SIGNAL_GTKTERM_REMOVE_SECTION,
+    SIGNAL_GTKTERM_PRINT_SECTION,
+    SIGNAL_GTKTERM_COPY_SECTION,    
+    SIGNAL_GTKTERM_CONFIG_TERMINAL,
+    SIGNAL_GTKTERM_CONFIG_SERIAL,
+    SIGNAL_GTKTERM_CONFIG_CHECK_FILE,  
+    SIGNAL_GTKTERM_TERMINAL_CHANGED,
+    SIGNAL_GTKTERM_SERIAL_CONNECT,
+    SIGNAL_GTKTERM_VTE_DATA_RECEIVED,
+    SIGNAL_GTKTERM_SERIAL_DATA_RECEIVED,
+    SIGNAL_GTKTERM_SERIAL_DATA_TRANSMIT,
+    SIGNAL_GTKTERM_SERIAL_SIGNALS_CHANGED,
+    SIGNAL_GTKTERM_BUFFER_UPDATED,
+    LAST_GTKTERM_SIGNAL
+};
+
+extern unsigned int gtkterm_signals[];
+
+G_BEGIN_DECLS
+
+/**
+ * @brief The main GtkTerm application class.
+ * 
+ * All application specific variables are defined here.
+ */
+struct _GtkTerm {
+
+  GtkApplication parent_instance;
+
+  GOptionGroup *g_term_group;
+  GOptionGroup *g_port_group;
+  GOptionGroup *g_config_group;
+
+  GActionGroup *action_group;           //!< App action group
+
+  GtkTermConfiguration *config;         //!< The Key file with the configurations
+  char *section;                        //!< The section provided from the cli. 
+};
+
+#define GTKTERM_TYPE_APP gtkterm_get_type()
+G_DECLARE_FINAL_TYPE (GtkTerm, gtkterm, GTKTERM, APP, GtkApplication)
+typedef struct _GtkTerm GtkTerm;
+
+G_END_DECLS
+
+#endif // GTKTERM_H
\ No newline at end of file
diff --git a/src/gtkterm_buffer.c b/src/gtkterm_buffer.c
new file mode 100644
index 0000000..32a0794
--- /dev/null
+++ b/src/gtkterm_buffer.c
@@ -0,0 +1,476 @@
+#include <gtk/gtk.h>
+#include <glib.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <config.h>
+#include <glib/gi18n.h>
+
+#include "gtkterm_window.h"
+#include "gtkterm_defaults.h"
+#include "gtkterm_terminal.h"
+#include "gtkterm_serial_port.h"
+#include "gtkterm_buffer.h"
+
+#define TIMESTAMP_SIZE 50
+
+typedef struct {
+    char *buffer;								/**< The actual buffer										*/
+	size_t tail;								/**< The tail of the buffer									*/
+	term_config_t *term_conf;
+
+	bool lf_received;							/**< Reminder if we have a LF received						*/
+	bool cr_received;							/**< Reminder if we have a CR received						*/
+	bool need_to_write_timestamp;				/**< Reminder we need to write the timestamp (after a CR)	*/
+
+	GError *config_error;						/**< Error of the last file operation						*/
+	GtkTermConfigurationState config_status; 	/**< Status when operating the buffer						*/	
+
+	GtkTermSerialPort *serial_port;				/**< For connecting to the serial-data-received signals 	*/
+	GtkTermTerminal *terminal;					/**< For connecting to the vte-data-received signals 		*/
+	GError *error;
+
+} GtkTermBufferPrivate;
+
+struct _GtkTermBuffer {
+	
+    GObject parent_instance;
+};
+
+struct _GtkTermBufferClass {
+
+    GObjectClass parent_class;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkTermBuffer, gtkterm_buffer, G_TYPE_OBJECT)
+
+enum { 
+	PROP_0, 
+	PROP_SERIAL_PORT,
+	PROP_TERMINAL,		
+	PROP_TERM_CONF,	
+	N_PROPS 
+};
+
+static GParamSpec *gtkterm_buffer_properties[N_PROPS] = {NULL};
+
+static GtkTermBufferState gtkterm_buffer_add_data (GObject *, gpointer, gpointer);
+GtkTermBufferState gtkterm_buffer_set_status(GtkTermBuffer *, GtkTermBufferState, GError *);
+unsigned int insert_timestamp (char *);
+void gtkterm_buffer_repage (GtkTermBuffer *);
+
+/**
+ * @brief Create a new buffer object
+ * 
+ * @return The buffer object.
+ * 
+ */
+GtkTermBuffer *gtkterm_buffer_new (GtkTermSerialPort * serial_port, GtkTermTerminal *terminal, term_config_t *term_conf) {
+
+    return g_object_new (GTKTERM_TYPE_BUFFER, "serial_port", serial_port, "terminal", terminal, "term_conf", term_conf, NULL);
+}
+
+/**
+ * @brief Finalizing the buffer class
+ * 
+ * Clears the pointer of the buffer.
+ * 
+ * @param object The object which is finialized
+ * 
+ */
+static void gtkterm_buffer_finalize (GObject *object) {
+    GtkTermBuffer *self = GTKTERM_BUFFER (object);
+    GtkTermBufferPrivate *priv = gtkterm_buffer_get_instance_private (self);
+    GObjectClass *object_class = G_OBJECT_CLASS (gtkterm_buffer_parent_class);
+
+    g_clear_pointer (&priv->buffer, g_free);
+
+    object_class->finalize (object);    
+}
+
+/**
+ * @brief Constructs the buffer.
+ * 
+ * Setup signals etc.
+ * 
+ * @param object The buffer object we are constructing.
+ * 
+ */
+static void gtkterm_buffer_constructed (GObject *object) {
+    GtkTermBuffer *self = GTKTERM_BUFFER(object);
+    GtkTermBufferPrivate *priv = gtkterm_buffer_get_instance_private (self);   
+
+	/** Connect to data received signals from vte and serial */
+   	g_signal_connect (priv->serial_port, "serial-data-received", G_CALLBACK(gtkterm_buffer_add_data), self);
+  	g_signal_connect (priv->terminal, "vte-data-received", G_CALLBACK(gtkterm_buffer_add_data), self);
+
+    G_OBJECT_CLASS (gtkterm_buffer_parent_class)->constructed (object);
+}
+
+/**
+ * @brief Called when distroying the buffer
+ * 
+ * This is used to clean up an freeing the variables in the buffer structure.
+ * 
+ * @param object The object.
+ * 
+ */
+static void gtkterm_buffer_dispose (GObject *object) {
+    GtkTermBuffer *self = GTKTERM_BUFFER(object);
+    GtkTermBufferPrivate *priv = gtkterm_buffer_get_instance_private (self);	
+	
+    g_free(priv->term_conf);
+    g_free(priv->serial_port);
+	g_free(priv->terminal);
+}
+
+/**
+ * @brief Set the property of the GtkTermBuffer structure
+ * 
+ * This is used to initialize the variables when creating a new buffer
+ * 
+ * @param object The object.
+ * 
+ * @param prop_id The id of the property to set.
+ * 
+ * @param value The value for the property
+ * 
+ * @param pspec Metadata for property setting.
+ * 
+ */
+static void gtkterm_buffer_set_property (GObject *object,
+                             unsigned int prop_id,
+                             const GValue *value,
+                             GParamSpec *pspec) {
+
+    GtkTermBuffer *self = GTKTERM_BUFFER(object);
+    GtkTermBufferPrivate *priv = gtkterm_buffer_get_instance_private (self);
+
+    switch (prop_id) {
+    	case PROP_SERIAL_PORT:
+        	priv->serial_port = g_value_dup_object (value);
+        	break;
+
+    	case PROP_TERMINAL:
+        	priv->terminal = g_value_dup_object(value);
+        	break;					
+
+    	case PROP_TERM_CONF:
+        	priv->term_conf = g_value_get_pointer(value);
+        	break;		
+
+    	default:
+        	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+/**
+ * @brief Initializing the buffer class
+ * 
+ * Setting the properties and callback functions
+ * 
+ * @param class The buffer port class
+ * 
+ */
+static void gtkterm_buffer_class_init (GtkTermBufferClass *class) {
+    GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+    object_class->set_property = gtkterm_buffer_set_property;
+    object_class->finalize = gtkterm_buffer_finalize;
+    object_class->constructed = gtkterm_buffer_constructed;
+  	object_class->dispose = gtkterm_buffer_dispose;	
+
+    gtkterm_signals[SIGNAL_GTKTERM_BUFFER_UPDATED] = g_signal_new ("buffer-updated",
+                                               GTKTERM_TYPE_BUFFER,
+                                               G_SIGNAL_RUN_FIRST,
+                                               0,
+                                               NULL,
+                                               NULL,
+                                               NULL,
+                                               G_TYPE_NONE,
+                                               2,
+                                               G_TYPE_POINTER,
+                                               G_TYPE_UINT);
+
+	/** 
+     * Parameters to hand over at creation of the object
+	 * We need the section to load the config from the keyfile.
+     */
+  	gtkterm_buffer_properties[PROP_SERIAL_PORT] = g_param_spec_object (
+        "serial_port",
+        "serial_port",
+        "serial_port",
+        GTKTERM_TYPE_SERIAL_PORT,
+        G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
+
+  	gtkterm_buffer_properties[PROP_TERMINAL] = g_param_spec_object (
+        "terminal",
+        "terminal",
+        "terminal",
+        GTKTERM_TYPE_TERMINAL,
+        G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);	   
+
+  	gtkterm_buffer_properties[PROP_TERM_CONF] = g_param_spec_pointer (
+        "term_conf",
+        "term_conf",
+        "term_conf",
+        G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);		
+
+    g_object_class_install_properties (object_class, N_PROPS, gtkterm_buffer_properties);
+}
+
+/**
+ * @brief Initialize the buffer with size BUFFER_SIZE.
+ * 
+ * @param self The buffer we are initializing.
+ * 
+ */
+static void gtkterm_buffer_init (GtkTermBuffer *self) {
+    GtkTermBufferPrivate *priv = gtkterm_buffer_get_instance_private (self);
+
+    priv->buffer = g_malloc0 (BUFFER_SIZE);
+	priv->tail = 0;
+
+	priv->lf_received = false;
+	priv->cr_received = false;
+	priv->need_to_write_timestamp = false;
+}
+
+/**
+ * @brief New data is available to add to the buffer.
+ * 
+ * The buffer will signal the terminal new data is available.
+ * 
+ * @param object Not used.
+ * 
+ * @param data The new byte-string of data for the buffer.
+ * 
+ * @param user_data The buffer.
+ * 
+ */
+static GtkTermBufferState gtkterm_buffer_add_data (GObject *object, gpointer data, gpointer user_data) {
+    GtkTermBuffer *self = GTKTERM_BUFFER(user_data);
+    GtkTermBufferPrivate *priv = gtkterm_buffer_get_instance_private (self);
+	size_t str_size;
+	size_t old_tail;
+    const char *string = g_bytes_get_data ((GBytes *)data, &str_size);
+
+	if(priv->buffer == NULL) {
+		GError *error;
+		error = g_error_new (g_quark_from_static_string ("GTKTERM_BUFFER"),
+                             GTKTERM_BUFFER_NOT_INITALIZED,
+                             _("Buffer not initialized")
+                             );
+
+		return gtkterm_buffer_set_status (self, GTKTERM_BUFFER_NOT_INITALIZED, error);
+	}
+
+	/**
+     * (When incoming size is larger than buffer, then just print the
+	 * last BUFFER_SIZE characters and ignore all other at begin of buffer)
+	 * In theory the str_size (8k) cannot be larger then the buffer size (128k)
+	 * 
+	 * \todo Make buffer also work with greater datastrings to make tbe above work.
+     */
+	if (str_size > BUFFER_SIZE) {
+		string += (str_size - BUFFER_SIZE);
+		str_size = BUFFER_SIZE;
+
+		GError *error;
+		error = g_error_new (g_quark_from_static_string ("GTKTERM_BUFFER"),
+                             GTKTERM_BUFFER_OVERFLOW,
+                             _("Buffer overflow")
+                             );
+
+		return gtkterm_buffer_set_status (self, GTKTERM_BUFFER_OVERFLOW, error);
+	}
+
+	/**
+     * When incoming size is larger than free space in the buffer
+	 * then repage the buffer which will move the head.
+	 * We use 2x the str_size to be sure.
+     */
+	if ((2 * str_size) > (BUFFER_SIZE - priv->tail))
+		gtkterm_buffer_repage (self);
+
+	/** Indicates from where to send data to the terminal */
+	old_tail = priv->tail;
+
+	/** If the auto CR or LF mode on, read the buffer to add LF before CR */
+	if (priv->term_conf->auto_lf || priv->term_conf->auto_cr || priv->term_conf->timestamp) {
+
+		for (int i = 0; i < str_size; i++) {
+
+            if (priv->term_conf->auto_cr) {
+
+			 	/** If the previous character was a CR too, insert a newline */
+			 	if (string[i] == '\r' && priv->cr_received) {
+			 		
+					*(priv->buffer + priv->tail) = '\n';
+			 		priv->tail++;
+			 		priv->need_to_write_timestamp = 1;
+
+					priv->cr_received = 1;
+			 	}
+			} 
+
+			if (priv->term_conf->auto_lf) {
+			 		if (string[i] == '\n') {
+
+			 			/* If we get a newline without a CR first, insert a CR */
+			 			if (!priv->cr_received) {
+			 				*(priv->buffer + priv->tail) = '\r';
+			 				priv->tail++;
+			 			}
+			 		} else {
+			 			/** If we receive a normal char, and the previous one was a CR insert a newline */
+			 			if (priv->cr_received) {
+			 				*(priv->buffer + priv->tail) = '\n';
+			 				priv->tail++;
+			 				priv->need_to_write_timestamp = 1;
+			 			}
+					}
+
+			 	priv->cr_received = 0;
+			}
+
+			/** If we have timestamps configured and it is time to print one, print it */
+		    if (priv->term_conf->timestamp && priv->need_to_write_timestamp) {
+
+			 	priv->tail += insert_timestamp (priv->buffer + priv->tail);
+				priv->need_to_write_timestamp = 0;
+			}
+
+			if (string[i] == '\n')
+			 	priv->need_to_write_timestamp = 1; 					/**< remember until we have a new character to print	*/
+
+			*(priv->buffer + priv->tail) = string[i];				/**< Copy the string character to the buffer			*/
+			priv->tail++; 											/**< Increment for each stored character				*/
+
+			/** If we are growing out of the buffer, then repage */
+			if ((priv->tail + 2 * TIMESTAMP_SIZE) >= BUFFER_SIZE)
+				gtkterm_buffer_repage (self);
+		}
+	} else {
+
+		/** We dont need any timestamps or LF/CR so just copy the string into the buffer */
+		memcpy ((priv->buffer + priv->tail), string, str_size);
+		priv->tail += str_size;	
+	}
+
+//	g_printf ("T %ld S %ld O %ld\n", priv->tail, str_size, old_tail);
+
+    g_bytes_unref (data);	
+
+	/** Send new data to the terminal */
+	g_signal_emit (self, 
+					gtkterm_signals[SIGNAL_GTKTERM_BUFFER_UPDATED], 0, 
+					(priv->buffer + old_tail), 
+					priv->tail - old_tail);
+
+	return GTKTERM_BUFFER_SUCCESS;				
+}
+
+/**
+ * @brief Add a timestamp to the buffer.
+ * 
+ * Assumes that buffer always has space for timestamp (TIMESTAMP_SIZE)
+ * 
+ * @param buffer Points to location where timestamp will be inserted.
+ * 
+ * @return unsigned int Length of the timestamp added.
+ * 
+ */
+unsigned int insert_timestamp (char *buffer) {
+  	unsigned int timestamp_length = 0;
+	struct timespec ts;
+	int d,h,m,s,x;
+
+	timespec_get(&ts, TIME_UTC);
+	d = (ts.tv_sec / (3600 * 24));
+	h = (ts.tv_sec / 3600) % 24;
+	m = (ts.tv_sec / 60 ) % 60;
+	s = ts.tv_sec % 60;
+	x = ts.tv_nsec / 1000000;
+
+	g_snprintf(buffer, TIMESTAMP_SIZE - 1, "[%d.%02uh.%02um.%02us.%03u] ", d, h, m, s, x );
+
+	timestamp_length = strlen(buffer);
+
+  	return timestamp_length;
+}
+
+/**
+ * @brief  Repage the buffer to make room for new data
+ * 
+ * When repaging thebuffer is moved 2 pages up.
+ * The head is always placed after a CR to make sure we start with a new string.
+ */
+void gtkterm_buffer_repage (GtkTermBuffer *self) {
+    GtkTermBufferPrivate *priv = gtkterm_buffer_get_instance_private (self);
+
+//	g_printf ("Repaging ...\n");
+
+	memmove (priv->buffer + 16 * 1024, priv->buffer, BUFFER_SIZE - 16 * 1024);
+	priv->tail = BUFFER_SIZE - 16 * 1024;
+
+	while (*(priv->buffer + priv->tail) != '\n')
+		priv->tail++;
+
+//	g_printf ("Repaging ready %ld...\n", priv->tail);		
+}
+
+/**
+ * @brief  Sets the status and error of the last operation.
+ *
+ * @param self The configuration for which the get the status for.
+ *
+ * @param status The status to be set.
+ * 
+ * @param error The error message (can be NULL)
+ *
+ * @return  The latest status.
+ *
+ */
+GtkTermBufferState gtkterm_buffer_set_status (GtkTermBuffer *self, GtkTermBufferState status, GError *error) {
+    GtkTermBufferPrivate *priv = gtkterm_buffer_get_instance_private (self);
+
+	priv->config_status = status;
+
+	/** If there is a previous error, clear it */
+	if (priv->config_error != NULL)
+		g_error_free (priv->config_error);
+	
+	priv->config_error = error;	
+
+	return status;
+}
+
+/**
+ * @brief  Return the latest status condiation for the buffer operation.
+ *
+ * @param self The configuration for which the get the status for.
+ *
+ * @return  The latest status.
+ *
+ */
+GtkTermBufferState gtkterm_buffer_get_status (GtkTermBuffer*self) {
+    GtkTermBufferPrivate *priv = gtkterm_buffer_get_instance_private (self);
+
+	return (priv->config_status);
+}
+
+/**
+ * @brief  Return the latest error for the buffer operation.
+ *
+ * @param self The configuration for which the get the status for.
+ *
+ * @return  The latest error.
+ *
+ */
+GError *gtkterm_buffer_get_error (GtkTermBuffer *self) {
+    GtkTermBufferPrivate *priv = gtkterm_buffer_get_instance_private (self);
+
+	return (priv->config_error);
+}
\ No newline at end of file
diff --git a/src/gtkterm_buffer.h b/src/gtkterm_buffer.h
new file mode 100644
index 0000000..f07e130
--- /dev/null
+++ b/src/gtkterm_buffer.h
@@ -0,0 +1,31 @@
+#ifndef GTMTERM_BUFFER_H
+#define GTKTERM_BUFFER_H
+
+/**
+ * @brief  Enum buffer_error id.
+ * 
+ * Many of the gtk_buffer functions return
+ * an error id.
+ */
+typedef enum {
+	GTKTERM_BUFFER_SUCCESS,
+	GTKTERM_BUFFER_NOT_INITALIZED,
+	GTKTERM_BUFFER_OVERFLOW,
+	GTKTERM_BUFFER_LAST
+
+} GtkTermBufferState;
+
+G_BEGIN_DECLS
+
+#define GTKTERM_TYPE_BUFFER gtkterm_buffer_get_type ()
+G_DECLARE_FINAL_TYPE (GtkTermBuffer, gtkterm_buffer, GTKTERM, BUFFER, GObject)
+typedef struct _GtkTermBuffer GtkTermBuffer;
+
+GtkTermBuffer *gtkterm_buffer_new (GtkTermSerialPort *, GtkTermTerminal *, term_config_t *);
+
+G_END_DECLS
+
+GtkTermBufferState gtkterm_buffer_get_status (GtkTermBuffer *);
+GError *gtkterm_buffer_get_error (GtkTermBuffer*);
+
+#endif // GTKTERM_BUFFER_H
\ No newline at end of file
diff --git a/src/gtkterm_cmdline.c b/src/gtkterm_cmdline.c
new file mode 100644
index 0000000..b8cbbad
--- /dev/null
+++ b/src/gtkterm_cmdline.c
@@ -0,0 +1,274 @@
+/***********************************************************************/
+/* cmdline.c                                                           */
+/* ---------                                                           */
+/*           GTKTerm Software                                          */
+/*                      (c) Julien Schmitt                             */
+/*                                                                     */
+/* ------------------------------------------------------------------- */
+/*                                                                     */
+/*   Purpose                                                           */
+/*      Parse cmdline options                                          */
+/*                                                                     */
+/*   ChangeLog                                                         */
+/*      - 2.0 : Switch to GOptionEntry (thanks to Jens Georg (phako))  */
+/*      - 0.99.2 : Internationalization                                */
+/*      - 0.98.3 : modified for configuration file                     */
+/*      - 0.98.2 : added --echo                                        */
+/*      - 0.98 : file creation by Julien                               */
+/*                                                                     */
+/***********************************************************************/
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <glib/gprintf.h>
+#include <config.h>
+
+#include "gtkterm_defaults.h"
+#include "gtkterm.h"
+#include "gtkterm_window.h"
+#include "gtkterm_terminal.h"
+#include "gtkterm_serial_port.h"
+#include "gtkterm_buffer.h"
+#include "gtkterm_configuration.h"
+#include "gtkterm_cmdline.h"
+#include "gtkterm_serial_port.h"
+
+/**
+ * @brief  Removes a configuration sectons
+ * 
+ * The functions emits a signal which is connected to the config remove function.
+ * After removing, the g_application_quit is called for exiting the application (we only want
+ * to remove the section, not to start up GTKTerm).
+ * 
+ * @param name Not used.
+ * 
+ * @param value The section we want to remove.
+ * 
+ * @param data The application app. 
+ * 
+ * @param error Error (not used). 
+ * 
+ * @return  true on succes (we will not get there).
+ * 
+ */
+static bool on_remove_config (const char *name, const char *value, gpointer data,  GError **error) {
+    int rc = GTKTERM_CONFIGURATION_SUCCESS;
+
+    /** Signal to load the configuration and dump it to the cli */
+    g_signal_emit(GTKTERM_APP(data)->config, gtkterm_signals[SIGNAL_GTKTERM_REMOVE_SECTION], 0, value, &rc);
+
+    g_printf ("%s\n", gtkterm_configuration_get_error (GTKTERM_APP(data)->config)->message);
+
+    g_application_quit (G_APPLICATION(data)); 
+
+    return true;
+}
+
+/**
+ * @brief  Saves a configuration sectons
+ * 
+ * The functions emits a signal which is connected to the config save function.
+ * After saving, the g_application_quit is called for exiting the application (we only want
+ * to save the section, not to start up GTKTerm).
+ * If we want to save cli options we have to put the save option as last parameter.
+ * 
+ * @param name Not used.
+ * 
+ * @param value The section we want to save.
+ * 
+ * @param data The application app. 
+ * 
+ * @param error Error (not used). 
+ * 
+ * @return  true on succes (we will not get there).
+ * 
+ */
+static bool on_save_section (const char *name, const char *value, gpointer data,  GError **error) {
+    int rc = GTKTERM_CONFIGURATION_SUCCESS;
+
+    /** Signal to save the configuration and dump it to the cli */
+    g_signal_emit(GTKTERM_APP(data)->config, gtkterm_signals[SIGNAL_GTKTERM_SAVE_CONFIG], 0, &rc);
+
+    g_printf ("%s\n", gtkterm_configuration_get_error (GTKTERM_APP(data)->config)->message);
+
+    g_application_quit (G_APPLICATION(data)); 
+
+    return true;
+}
+
+/**
+ * @brief  Prints a configuration sectons
+ * 
+ * The functions emits a signal which is connected to the config print function.
+ * After printing, the g_application_quit is called for exiting the application (we only want
+ * to print the section, not to start up GTKTerm)
+ * 
+ * @param name Not used.
+ * 
+ * @param value The section we want to print.
+ * 
+ * @param data The application app. 
+ * 
+ * @param error Error (not used). 
+ * 
+ * @return  true on succes (we will not get there).
+ * 
+ */
+static bool on_print_section (const char *name, const char *value, gpointer data,  GError **error) {
+    int rc = GTKTERM_CONFIGURATION_SUCCESS;
+
+    /** Signal to load the configuration and dump it to the cli */
+    g_signal_emit(GTKTERM_APP(data)->config, gtkterm_signals[SIGNAL_GTKTERM_PRINT_SECTION], 0, value, &rc);
+
+    if (rc != GTKTERM_CONFIGURATION_SUCCESS) {
+        g_printf ("%s\n", gtkterm_configuration_get_error (GTKTERM_APP(data)->config)->message);
+    }
+
+    g_application_quit (G_APPLICATION(data)); 
+
+    return true;
+}
+
+/**
+ * @brief  List all configurations
+ * 
+ * The functions emits a signal which is connected to list all configurations.
+ * After printing, the g_application_quit is called for exiting the application (we only want
+ * to list the configs, not to start up GTKTerm)
+ * 
+ * @param name Not used.
+ * 
+ * @param value Not used.
+ * 
+ * @param data The application app. 
+ * 
+ * @param error Error (not used). 
+ * 
+ * @return  true on succes (we will not get there).
+ * 
+ */
+static bool on_list_config (const char *name, const char *value, gpointer data,  GError **error) {
+    int rc = GTKTERM_CONFIGURATION_SUCCESS;
+
+    /** Signal to list the comfigurations and dump it to the cli */
+    g_signal_emit(GTKTERM_APP(data)->config, gtkterm_signals[SIGNAL_GTKTERM_LIST_CONFIG], 0, &rc);
+
+    if (rc != GTKTERM_CONFIGURATION_SUCCESS) {
+        g_printf ("%s\n", gtkterm_configuration_get_error (GTKTERM_APP(data)->config)->message);
+    }
+
+    g_application_quit (G_APPLICATION(data)); 
+
+    return true;
+}
+
+/**
+ * @brief  Sets the use of a configuration section.
+ * 
+ * This is used as input for config options or starting GTKTerm with the
+ * section active.
+ * 
+ * @param name Not used.
+ * 
+ * @param value The section we want to use.
+ * 
+ * @param data The application app. 
+ * 
+ * @param error Error (not used). 
+ * 
+ * @return  true on succes (continues startup). False if the configurationname is too long.
+ * 
+ */
+static bool on_use_config (const char *name, const char *value, gpointer data,  GError **error) {
+
+    if (strlen (value) < MAX_SECTION_LENGTH)  {
+
+        GTKTERM_APP(data)->section = g_strdup ( value);
+
+    } else {
+
+        g_printf (_("[CONFIGURATION]-name to long (max %d)\n\n"), MAX_SECTION_LENGTH);
+        return false;
+    }
+
+    return true;
+}
+
+/**
+ * @brief GOptionEntry mappings.
+ * 
+ * We use callback in GOptionEntry. So we can directly put them
+ * in the Terminal configuration instead of handing over a pointer from the config.
+ * 
+ * \todo Update gtkterm.1.
+ * 
+ */
+static GOptionEntry gtkterm_config_options[] = {    
+    {"show_config", 'V', 0, G_OPTION_ARG_CALLBACK, on_print_section, N_("Show configuration"), "[configuration]"}, 
+    {"save_config", 'S', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, on_save_section, N_("Save configuration"), NULL},     
+    {"remove_config", 'R', 0, G_OPTION_ARG_CALLBACK, on_remove_config, N_("Remove configuration"), "[configuration]"},
+    {"use_config", 'U', 0, G_OPTION_ARG_CALLBACK, on_use_config, N_("Use configuration (must be first argument)"), "[configuration]"},
+    {"list_config", 'L', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, on_list_config, N_("List all configurations"), NULL},   
+    {NULL}
+};
+
+/**
+ * @brief Longname CLI options
+ *
+ */
+static GOptionEntry gtkterm_term_options[] = {    
+    {GtkTermConfigurationItems[CONF_ITEM_TERM_WAIT_DELAY], 'd', 0, G_OPTION_ARG_CALLBACK, on_set_config_options, N_("End of line delay in ms (default none)"), "<ms>"},
+    {GtkTermConfigurationItems[CONF_ITEM_TERM_ECHO], 'e', 0, G_OPTION_ARG_CALLBACK, on_set_config_options,  N_("Local echo"),  "<on|off>"},
+    {GtkTermConfigurationItems[CONF_ITEM_TERM_RAW_FILENAME], 'f', 0, G_OPTION_ARG_CALLBACK, on_set_config_options,  N_ ("Default file to send (default none)"), "<filename>"},
+    {GtkTermConfigurationItems[CONF_ITEM_TERM_WAIT_CHAR], 'r', 0, G_OPTION_ARG_CALLBACK, on_set_config_options, N_("Wait for a special char at end of line (default none)"), "<character in HEX>"},
+    {GtkTermConfigurationItems[CONF_ITEM_TERM_ROWS], 'o', 0, G_OPTION_ARG_CALLBACK, on_set_config_options, N_ ("Terminal rows (default 25)"), "<rows>"},
+    {GtkTermConfigurationItems[CONF_ITEM_TERM_COLS], 'c', 0, G_OPTION_ARG_CALLBACK, on_set_config_options, N_ ("Terminal cols (default 80)"), "<cols>"},
+    {GtkTermConfigurationItems[CONF_ITEM_TERM_AUTO_CR], 'g', 0, G_OPTION_ARG_CALLBACK, on_set_config_options, N_ ("Auto LF (default on)"), "<on|off>"},
+    {GtkTermConfigurationItems[CONF_ITEM_TERM_AUTO_LF], 'h', 0, G_OPTION_ARG_CALLBACK, on_set_config_options, N_ ("Auto CR (default on)"), "<on|off>"},        
+    {NULL}
+};
+
+static GOptionEntry gtkterm_port_options[] = {    
+    {GtkTermConfigurationItems[CONF_ITEM_SERIAL_PARITY], 'a', 0, G_OPTION_ARG_CALLBACK, on_set_config_options, N_("Parity(default = none)"), "<odd|even|none>"},    
+    {GtkTermConfigurationItems[CONF_ITEM_SERIAL_BITS], 'b', 0, G_OPTION_ARG_CALLBACK, on_set_config_options, N_("Number of bits (default 8)"), "<7|8> "},
+    {GtkTermConfigurationItems[CONF_ITEM_SERIAL_PORT], 'p', 0, G_OPTION_ARG_CALLBACK, on_set_config_options,  N_("Serial port device (default /dev/ttyS0)"), "[device]"},
+    {GtkTermConfigurationItems[CONF_ITEM_SERIAL_BAUDRATE], 's', 0, G_OPTION_ARG_CALLBACK, on_set_config_options, N_("Serial port baudrate(default 9600bps)"), "[baudrate]",}, 
+    {GtkTermConfigurationItems[CONF_ITEM_SERIAL_STOPBITS], 't', 0, G_OPTION_ARG_CALLBACK, on_set_config_options,  N_("Number of stopbits (default 1)"), "<1|2>"},
+    {GtkTermConfigurationItems[CONF_ITEM_SERIAL_FLOW_CONTROL], 'w', 0, G_OPTION_ARG_CALLBACK, on_set_config_options, N_("Flow control (default none)"), "<Xon|RTS|RS485|none>"},
+    {GtkTermConfigurationItems[CONF_ITEM_SERIAL_RS485_RTS_TIME_BEFORE_TX], 'x', 0, G_OPTION_ARG_CALLBACK, on_set_config_options, N_("For RS485, time in ms before transmit with RTS on"), "[ms]"},
+    {GtkTermConfigurationItems[CONF_ITEM_SERIAL_RS485_RTS_TIME_AFTER_TX], 'y', 0, G_OPTION_ARG_CALLBACK, on_set_config_options, N_("For RS485, time in ms after transmit with RTS on"), "[ms]"},
+    {GtkTermConfigurationItems[CONF_ITEM_SERIAL_DISABLE_PORT_LOCK], 'l', 0, G_OPTION_ARG_CALLBACK, on_set_config_options,  N_("Disable lock serial port "), "<on|off>"},   
+    {NULL}
+};
+
+/**
+ * @brief Add the commandline options.
+ * 
+ * Commandline options are grouped. So each group is created.
+ * Each group has app as parameter passed through the callback.
+ * 
+ * @param app The application
+ * 
+ */
+void gtkterm_add_cmdline_options (GtkTerm *app)
+{
+    char sz_context_summary[BUFFER_LENGTH];
+
+    g_snprintf (sz_context_summary, BUFFER_LENGTH, "GTKTerm version %s (c) Julien Schmitt\n"
+	        "This program is released under the terms of the GPL V3 or later.", PACKAGE_VERSION);
+    g_application_set_option_context_summary (G_APPLICATION(app), sz_context_summary);
+
+    /** Pass app as data to the new created group */
+    app->g_term_group = g_option_group_new ("terminal", N_("Terminal options"), N_("Options for configuring terminal"), GTKTERM_APP(app), NULL);
+    app->g_port_group = g_option_group_new ("port", N_("Port options"), N_("Options for configuring the port"), GTKTERM_APP(app), NULL);
+    app->g_config_group = g_option_group_new ("configuration", N_("Configuration options"), N_("Options for maintaining the configuration (default = default)"), GTKTERM_APP(app), NULL);    
+
+    g_option_group_add_entries (app->g_term_group, gtkterm_term_options);
+    g_option_group_add_entries (app->g_port_group, gtkterm_port_options);
+    g_option_group_add_entries (app->g_config_group, gtkterm_config_options); 
+
+    g_application_add_option_group (G_APPLICATION(app), app->g_term_group);
+    g_application_add_option_group (G_APPLICATION(app), app->g_port_group);
+    g_application_add_option_group (G_APPLICATION(app), app->g_config_group);    
+} 
diff --git a/src/cmdline.h b/src/gtkterm_cmdline.h
similarity index 80%
rename from src/cmdline.h
rename to src/gtkterm_cmdline.h
index 9181ef5..b325f1c 100644
--- a/src/cmdline.h
+++ b/src/gtkterm_cmdline.h
@@ -1,5 +1,5 @@
 /***********************************************************************/
-/* cmdline.h                                                           */
+/* gtkterm_cmdline.h                                                   */
 /* ---------                                                           */
 /*           GTKTerm Software                                          */
 /*                      (c) Julien Schmitt                             */
@@ -11,8 +11,14 @@
 /*      - Header file -                                                */
 /*                                                                     */
 /*   ChangeLog                                                         */
+/*      - 2.0 : migrated to GTK4                                       */
 /*      - 0.98 : file creation by Julien                               */
 /*                                                                     */
 /***********************************************************************/
 
-int read_command_line(int, char **);
+#ifndef GTKTERM_CMDLINE_H
+#define GTKTERM_CMDLINE_H
+
+void gtkterm_add_cmdline_options (GtkTerm *app);
+
+#endif // GTKTERM_CMDLINE_H
\ No newline at end of file
diff --git a/src/gtkterm_configuration.c b/src/gtkterm_configuration.c
new file mode 100644
index 0000000..f924da6
--- /dev/null
+++ b/src/gtkterm_configuration.c
@@ -0,0 +1,1257 @@
+/***********************************************************************
+ * resource_config.c
+ * -----------------
+ *           GTKTerm Software
+ *                      (c) Julien Schmitt
+ *
+ * -------------------------------------------------------------------
+ *
+ *   \brief Purpose
+ *      Save and load configuration from resource file
+ *
+ *   ChangeLog
+ *      - 2.0 : Remove parsecfg. Switch to GKeyFile
+ *              Migration done by Jens Georg (phako)
+ *
+ ***********************************************************************/
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <sys/stat.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gprintf.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <gio/gio.h>
+#include <pango/pango-font.h>
+
+#include "config.h"
+#include "gtkterm_defaults.h"
+#include "gtkterm_window.h"
+#include "gtkterm_serial_port.h"
+#include "gtkterm_terminal.h"
+#include "gtkterm_configuration.h"
+#include "macros.h"
+
+/**
+ * @brief Configuration options
+ *
+ * Used configuration options to hold consistency between load/save functions
+ * Also used as long-option when configuring by CLI
+ *
+ * @todo Add the short option.
+ *
+ */
+const char GtkTermConfigurationItems[][CONF_ITEM_LENGTH] = {
+	"port",
+	"baudrate",
+	"bits",
+	"stopbits",
+	"parity",
+	"flow_control",
+	"term_wait_delay",
+	"term_wait_char",
+	"rs485_rts_time_before_tx",
+	"rs485_rts_time_after_tx",
+	"macros",
+	"term_raw_filename",
+	"term_echo",
+	"term_auto_lf",
+	"term_auto_cr",
+	"disable_port_lock",
+	"term_font",
+	"term_show_timestamp",
+	"term_block_cursor",
+	"term_show_cursor",
+	"term_rows",
+	"term_columns",
+	"term_scrollback",
+	"term_visual_bell",
+	"term_foreground_red",
+	"term_foreground_green",
+	"term_foreground_blue",
+	"term_foreground_alpha",
+	"term_background_red",
+	"term_background_green",
+	"term_background_blue",
+	"term_background_alpha",
+};
+
+const char GtkTermCLIShortOption[][CONF_ITEM_LENGTH] = {
+	"p",
+	"s",
+	"b",
+	"t",
+	"a",
+	"w",
+	"d",
+	"r",
+	"x",
+	"y",
+	"",
+	"f",
+	"e",
+	"",
+	"",
+	"l",
+	"",
+	"",
+	"",
+	"",
+	"o",
+	"c",
+	"",
+	"",
+	"",
+	"",
+	"",
+	"",
+	"",
+	"",
+	"",
+	"",
+};
+
+G_BEGIN_DECLS
+
+typedef struct
+{
+	GKeyFile *key_file;	 						/**< The memory loaded keyfile				*/
+	GFile *config_file; 						/**< The config file						*/
+
+	GError *config_error;						/**< Error of the last file operation		*/
+	GtkTermConfigurationState config_status; 	/**< Status when operating configfiles		*/
+
+	bool config_is_dirty;						/**< If changes are made but not yet saved	*/
+
+} GtkTermConfigurationPrivate;
+
+struct _GtkTermConfiguration
+{
+
+	GObject parent_instance;
+};
+
+struct _GtkTermConfigurationClass
+{
+
+	GObjectClass parent_class;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GtkTermConfiguration, gtkterm_configuration, G_TYPE_OBJECT)
+
+/**
+ * @brief Callback functions for signals
+ */
+static int gtkterm_configuration_load_keyfile(GtkTermConfiguration *, gpointer);
+static int gtkterm_configuration_save_keyfile(GtkTermConfiguration *, gpointer);
+static int gtkterm_configuration_list_config(GtkTermConfiguration *, gpointer);
+static int gtkterm_configuration_print_section(GtkTermConfiguration *, gpointer, gpointer);
+static int gtkterm_configuration_remove_section(GtkTermConfiguration *, gpointer, gpointer);
+static int gtkterm_configuration_set_config_file(GtkTermConfiguration *, gpointer);
+static term_config_t *gtkterm_configuration_load_terminal_config(GtkTermConfiguration *, gpointer, gpointer);
+static port_config_t *gtkterm_configuration_load_serial_config(GtkTermConfiguration *, gpointer, gpointer);
+static int gtkterm_configuration_copy_section(GtkTermConfiguration *, gpointer, gpointer, gpointer, gpointer);
+
+/**
+ * @brief Functions for internal use only
+ *
+ */
+static void set_color(GdkRGBA *, float, float, float, float);
+
+static GtkTermConfigurationState gtkterm_configuration_check_configuration_file(GtkTermConfiguration *);
+void gtkterm_configuration_default_configuration(GtkTermConfiguration *, char *);
+GtkTermConfigurationState gtkterm_configuration_validate(GtkTermConfiguration *, char *);
+GtkTermConfigurationState gtkterm_configuration_set_status(GtkTermConfiguration *self, GtkTermConfigurationState, GError *);
+
+/**
+ * @brief Remote all pointers when removing the object.
+ * 
+ * @param object The pointer to the configuration object.
+ */
+static void gtkterm_configuration_finalize (GObject *object) {
+   	GtkTermConfiguration *self = GTKTERM_CONFIGURATION(object);
+    GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private (self);
+
+    g_clear_error (&priv->config_error);
+
+    GObjectClass *object_class = G_OBJECT_CLASS (gtkterm_configuration_parent_class);
+    object_class->finalize (object);	
+}
+
+/**
+ * @brief  Connect callback functions to signals.
+ *
+ * The callback functions performs the operation on the keyfile or configuration.
+ *
+ * @param object The configuration class object.
+ *
+ */
+static void gtkterm_configuration_class_constructed(GObject *object) {
+	GtkTermConfiguration *self = GTKTERM_CONFIGURATION(object);
+
+	g_signal_connect(self, "config_print", G_CALLBACK(gtkterm_configuration_print_section), NULL);
+	g_signal_connect(self, "config_remove", G_CALLBACK(gtkterm_configuration_remove_section), NULL);
+	g_signal_connect(self, "config_load", G_CALLBACK(gtkterm_configuration_load_keyfile), NULL);
+	g_signal_connect(self, "config_save", G_CALLBACK(gtkterm_configuration_save_keyfile), NULL);
+	g_signal_connect(self, "config_list", G_CALLBACK(gtkterm_configuration_list_config), NULL);	
+	g_signal_connect(self, "config_terminal", G_CALLBACK(gtkterm_configuration_load_terminal_config), NULL);
+	g_signal_connect(self, "config_serial", G_CALLBACK(gtkterm_configuration_load_serial_config), NULL);
+	g_signal_connect(self, "config_copy", G_CALLBACK(gtkterm_configuration_copy_section), NULL);
+	g_signal_connect(self, "config_check", G_CALLBACK(gtkterm_configuration_set_config_file), NULL);	
+
+	G_OBJECT_CLASS(gtkterm_configuration_parent_class)->constructed(object);
+}
+
+/**
+ * @brief  Initialize the class functions.
+ *
+ * Nothing special to do here.
+ *
+ * @param class The configuration.
+ *
+ */
+static void gtkterm_configuration_class_init(GtkTermConfigurationClass *class) {
+	GObjectClass *object_class = G_OBJECT_CLASS(class);
+
+	object_class->constructed = gtkterm_configuration_class_constructed;
+	object_class->finalize = gtkterm_configuration_finalize;	
+}
+
+/**
+ * @brief  Initialize the class members.
+ *
+ * @param self  the configuration.
+ *
+ */
+static void gtkterm_configuration_init(GtkTermConfiguration *self) {
+
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+
+	//! Initialize to NULL so we can detect if it is loaded.
+	priv->config_file = NULL;
+	priv->key_file = NULL;
+	priv->config_error = NULL;
+	priv->config_is_dirty = false;
+}
+
+/**
+ * @brief Check if the configuration file exists on disk.
+ *
+ * If not it creates and new default one and save it to disk.
+ *
+ * @param self The configuration class.
+ *
+ * @return The result of the operation
+ *
+ */
+static GtkTermConfigurationState gtkterm_configuration_check_configuration_file(GtkTermConfiguration *self)
+{
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+	GtkTermConfigurationState rc = GTKTERM_CONFIGURATION_SUCCESS;
+	GError *error = NULL;
+	struct stat my_stat;
+
+	/** is configuration file present
+	 * if not, create it, with the [default] section
+	 */
+	if (stat(g_file_get_path(priv->config_file), &my_stat) != 0) 	{
+
+		priv->key_file = g_key_file_new();
+		gtkterm_configuration_default_configuration(self, DEFAULT_SECTION);
+
+		/** And save the keyfile */
+		gtkterm_configuration_save_keyfile(self, NULL);
+
+		error = g_error_new (g_quark_from_static_string ("GTKTERM_CONFIGURATION"),
+                             GTKTERM_CONFIGURATION_FILE_CREATED,
+                             _("Configuration file with [default] configuration has been created and saved")
+                             );
+
+		rc = GTKTERM_CONFIGURATION_FILE_CREATED;
+	}
+
+	return gtkterm_configuration_set_status(self, rc, error);
+}
+
+/**
+ * @brief Check if the file exists in the old/new location
+ *
+ * Old location of configuration file was $HOME/.gtktermrc.
+ * New location is $XDG_CONFIG_HOME/.gtktermrc.
+ * If configuration file exists at new location, use that one.
+ * Otherwise, if file exists at old location, move file to new location.
+ *
+ * Version 2.0: Because we have to use gtkterm_conv, the file is always at
+ * the user directory. So we can skip eventually moving the file.
+ *
+ * @param self The configuration class.
+ * 
+ * @param user_data Not used.
+ *
+ * @return The result of the operation.
+ */
+static int gtkterm_configuration_set_config_file (GtkTermConfiguration *self, gpointer user_data) {
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+
+	GFile *config_file_old = g_file_new_build_filename(getenv("HOME"), CONFIGURATION_FILENAME, NULL);
+	priv->config_file = g_file_new_build_filename(g_get_user_config_dir(), CONFIGURATION_FILENAME, NULL);
+
+	if (!g_file_query_exists(priv->config_file, NULL) && g_file_query_exists(config_file_old, NULL))
+		g_file_move(config_file_old, priv->config_file, G_FILE_COPY_NONE, NULL, NULL, NULL, NULL);
+
+	// Check it the config file exists and if not, create one.
+	return gtkterm_configuration_check_configuration_file(self);
+}
+
+/**
+ * @brief  Check if the keyfile is loaded into memory.
+ *
+ * Loads the keyfile and checks if the section we want to access, exists.
+ *
+ * @param self The configuration for which the get the status for.
+ *
+ * @param section The section we want the configuration to read from
+ *
+ * @return: The status of this operation
+ *
+ */
+GtkTermConfigurationState check_keyfile(GtkTermConfiguration *self, char *section) {
+	GError *error = NULL;
+	GtkTermConfigurationState rc = GTKTERM_CONFIGURATION_SUCCESS;
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+
+	/** Load keyfile if it is nog loaded yet */
+	if (priv->key_file == NULL)	{
+
+		rc = gtkterm_configuration_load_keyfile(self, NULL);
+
+		if (!(rc == GTKTERM_CONFIGURATION_SUCCESS || rc == GTKTERM_CONFIGURATION_FILE_CREATED))
+			return rc;	
+	}
+
+	/** Check if the [section] exists in the key file. */
+	if (!g_key_file_has_group(priv->key_file, section))	 {
+        
+		error = g_error_new (g_quark_from_static_string ("GTKTERM_CONFIGURATION"),
+                             GTKTERM_CONFIGURATION_SECTION_UNKNOWN,
+                             _("No [%s] section in configuration file. Section is created."),
+                             section);
+
+		/** we did not find the section so we create it */
+		gtkterm_configuration_default_configuration(self, section);	
+
+		/** Set the dirty flag */
+		priv->config_is_dirty = true;						 
+
+		rc = GTKTERM_CONFIGURATION_SUCCESS;
+	}
+
+	return gtkterm_configuration_set_status (self, rc, error);
+}
+
+/**
+ * @brief Lists all sections in the keyfile.
+ *
+ * @param self The configuration class.
+ *
+ * @param user_data Not used.
+ *
+ * @return The result of the operation.
+ */
+static int gtkterm_configuration_list_config (GtkTermConfiguration *self, gpointer user_data) {
+	size_t nr_of_groups;
+	char **sections;
+	GtkTermConfigurationState rc = GTKTERM_CONFIGURATION_SUCCESS;
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+
+	if ((rc = gtkterm_configuration_load_keyfile(self, user_data)) != GTKTERM_CONFIGURATION_SUCCESS)
+		return rc;
+
+	sections = g_key_file_get_groups (priv->key_file, &nr_of_groups);
+
+	if (sections == NULL)
+		return GTKTERM_CONFIGURATION_SUCCESS;
+
+	g_printf ("Configurations found in keyfile:\n\n");
+	for (int i = 0; i < nr_of_groups; i++)
+		g_printf ("[%s]\n", sections[i]);
+	g_printf ("\n");
+	
+	return gtkterm_configuration_set_status(self, rc, NULL);
+}
+
+/**
+ * @brief Load the key file into memory.
+ *
+ * The keyfile with all sections are loaded into memory.
+ * It is in raw format. All on/off etc are not translated yet.
+ *
+ * @param self The configuration class.
+ *
+ * @param user_data Not used.
+ *
+ * @return The result of the operation.
+ */
+static int gtkterm_configuration_load_keyfile (GtkTermConfiguration *self, gpointer user_data) {
+	GError *error = NULL;
+	GtkTermConfigurationState rc = GTKTERM_CONFIGURATION_SUCCESS;
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+
+	if (priv->config_file == NULL) {
+		rc = gtkterm_configuration_set_config_file (self, NULL);
+
+		if (!(rc == GTKTERM_CONFIGURATION_SUCCESS || rc == GTKTERM_CONFIGURATION_FILE_CREATED))
+			return rc;			
+	}
+
+	priv->key_file = g_key_file_new();
+
+	if (!g_key_file_load_from_file(priv->key_file, g_file_get_path(priv->config_file), G_KEY_FILE_NONE, &error)) {
+
+		g_propagate_error (&error, 
+							g_error_new (g_quark_from_static_string ("GTKTERM_CONFIGURATION"),
+							GTKTERM_CONFIGURATION_FILE_CONFIG_LOAD,
+							_("Failed to load configuration file: %s\n%s"),
+							g_file_get_path(priv->config_file),
+							error->message));
+
+		rc = GTKTERM_CONFIGURATION_FILE_CONFIG_LOAD;
+	}
+
+	return gtkterm_configuration_set_status(self, rc, error);
+}
+
+/**
+ * @brief Save the in momeory keyfile to file).
+ *
+ * The keyfile with all sections saved to file
+ *
+ * @param self The configuration class.
+ *
+ * @param user_data Not used.
+ *
+ * @return The result of the operation.
+ */
+static int gtkterm_configuration_save_keyfile(GtkTermConfiguration *self, gpointer user_data)
+{
+	GError *error = NULL;
+	GtkTermConfigurationState rc = GTKTERM_CONFIGURATION_SUCCESS;	
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+
+	if (priv->key_file == NULL) 	{
+		error = g_error_new (g_quark_from_static_string ("GTKTERM_CONFIGURATION"),
+                             GTKTERM_CONFIGURATION_NO_KEYFILE_LOADED,
+                             _ ("File not saved. No keyfile loaded")
+                             );
+		rc = GTKTERM_CONFIGURATION_NO_KEYFILE_LOADED;
+
+	} else  if (!g_key_file_save_to_file(priv->key_file, g_file_get_path(priv->config_file), &error)){
+		g_propagate_error (&error, 
+							g_error_new (g_quark_from_static_string ("GTKTERM_CONFIGURATION"),
+                          	GTKTERM_CONFIGURATION_FILE_NOT_SAVED,
+                          	_("Failed to save configuration file: %s\n%s"),
+                          	g_file_get_path(priv->config_file),
+						 	error->message));
+
+		rc = GTKTERM_CONFIGURATION_FILE_NOT_SAVED;
+	} else {
+		rc = GTKTERM_CONFIGURATION_FILE_SAVED;
+		error = g_error_new (g_quark_from_static_string ("GTKTERM_CONFIGURATION"),
+                             GTKTERM_CONFIGURATION_FILE_SAVED,
+                             _("Configuration saved")
+                             );
+
+		/** Reset the dirty flag now we saved the keyfile */
+		priv->config_is_dirty = false;							 
+	}
+	return gtkterm_configuration_set_status(self, rc, error);
+}
+
+/**
+ * @brief Print the section to CLI.
+ *
+ * @param self The configuration class.
+ *
+ * @param data Pointer to the section we want to show
+ *
+ * @param user_data Not used.
+ *
+ * @return The result of the operation.
+ */
+static int gtkterm_configuration_print_section(GtkTermConfiguration *self, gpointer data, gpointer user_data)
+{
+	char *section = (char *)data;
+	GtkTermConfigurationState rc;
+	gsize nr_of_strings;
+	char **macrostring;
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+
+	if ((rc = check_keyfile(self, section) != GTKTERM_CONFIGURATION_SUCCESS))
+		return rc;
+
+	g_printf(_("Configuration [%s] loaded from file\n"), section);
+
+	/** Print the serial port items */
+	g_printf(_("\nSerial port settings:\n"));
+	g_printf(_("%-24s : %s\n"), GtkTermConfigurationItems[CONF_ITEM_SERIAL_PORT], g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_PORT], NULL));
+	g_printf(_("%-24s : %ld\n"), GtkTermConfigurationItems[CONF_ITEM_SERIAL_BAUDRATE], (unsigned long)g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_BAUDRATE], NULL));
+	g_printf(_("%-24s : %d\n"), GtkTermConfigurationItems[CONF_ITEM_SERIAL_BITS], g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_BITS], NULL));
+	g_printf(_("%-24s : %d\n"), GtkTermConfigurationItems[CONF_ITEM_SERIAL_STOPBITS], g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_STOPBITS], NULL));
+	g_printf(_("%-24s : %s\n"), GtkTermConfigurationItems[CONF_ITEM_SERIAL_PARITY], g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_PARITY], NULL));
+	g_printf(_("%-24s : %s\n"), GtkTermConfigurationItems[CONF_ITEM_SERIAL_FLOW_CONTROL], g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_FLOW_CONTROL], NULL));
+	g_printf(_("%-24s : %d\n"), GtkTermConfigurationItems[CONF_ITEM_SERIAL_RS485_RTS_TIME_BEFORE_TX], g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_RS485_RTS_TIME_BEFORE_TX], NULL));
+	g_printf(_("%-24s : %d\n"), GtkTermConfigurationItems[CONF_ITEM_SERIAL_RS485_RTS_TIME_AFTER_TX], g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_RS485_RTS_TIME_AFTER_TX], NULL));
+	g_printf(_("%-24s : %s\n"), GtkTermConfigurationItems[CONF_ITEM_SERIAL_DISABLE_PORT_LOCK], g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_DISABLE_PORT_LOCK], NULL));
+
+	/** Print the terminal items */
+	g_printf(_("\nTerminal settings:\n"));
+	g_printf(_("%-24s : %s\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_FONT], g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FONT], NULL));
+	g_printf(_("%-24s : %s\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_RAW_FILENAME], g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_RAW_FILENAME], NULL));
+	g_printf(_("%-24s : %s\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_ECHO], g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_ECHO], NULL));
+	g_printf(_("%-24s : %s\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_AUTO_LF], g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_AUTO_LF], NULL));
+	g_printf(_("%-24s : %s\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_AUTO_CR], g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_AUTO_CR], NULL));	
+	g_printf(_("%-24s : %d\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_WAIT_DELAY], g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_WAIT_DELAY], NULL));
+	g_printf(_("%-24s : %d\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_WAIT_CHAR], g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_WAIT_CHAR], NULL));
+	g_printf(_("%-24s : %s\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_TIMESTAMP], g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_TIMESTAMP], NULL));
+	g_printf(_("%-24s : %s\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_BLOCK_CURSOR], g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BLOCK_CURSOR], NULL));
+	g_printf(_("%-24s : %s\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_SHOW_CURSOR], g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_SHOW_CURSOR], NULL));
+	g_printf(_("%-24s : %d\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_ROWS], g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_ROWS], NULL));
+	g_printf(_("%-24s : %d\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_COLS], g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_COLS], NULL));
+	g_printf(_("%-24s : %d\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_SCROLLBACK], g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_SCROLLBACK], NULL));
+	g_printf(_("%-24s : %s\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_VISUAL_BELL], g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_VISUAL_BELL], NULL));
+	g_printf(_("%-24s : %f\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_RED], g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_RED], NULL));
+	g_printf(_("%-24s : %f\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_BLUE], g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_BLUE], NULL));
+	g_printf(_("%-24s : %f\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_GREEN], g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_GREEN], NULL));
+	g_printf(_("%-24s : %f\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_ALPHA], g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_ALPHA], NULL));
+	g_printf(_("%-24s : %f\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_RED], g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_RED], NULL));
+	g_printf(_("%-24s : %f\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_BLUE], g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_BLUE], NULL));
+	g_printf(_("%-24s : %f\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_GREEN], g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_GREEN], NULL));
+	g_printf(_("%-24s : %f\n"), GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_ALPHA], g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_ALPHA], NULL));
+
+	/** Convert the stringlist to macros. Existing shortcuts will be deleted from convert_string_to_macros */
+	macrostring = g_key_file_get_string_list(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_MACROS], &nr_of_strings, NULL);
+	convert_string_to_macros(macrostring, nr_of_strings);
+	g_strfreev(macrostring);
+
+	/** ... and the macro's */
+	g_printf(_("\nMacros:\n"));
+	g_printf(_(" Nr  Shortcut  Command\n"));
+
+	if (macro_count() == 0)
+		g_printf(_("No macros defined in this section\n"));
+	else
+	{
+		for (int i = 0; i < macro_count(); i++)
+			g_printf("[%2d] %-8s  %s\n", i, macros[i].shortcut, macros[i].action);
+	}
+
+	if ((rc = gtkterm_configuration_validate(self, section)) != GTKTERM_CONFIGURATION_SUCCESS)
+		return rc;
+
+	/** Inverse the return due to the handling return value of the callback */
+	return gtkterm_configuration_set_status(self, rc, NULL);
+}
+
+/**
+ * @brief Remove a section from the GKeyFile.
+ *
+ * If it is the active section then switch back to default.
+ * If it is the default section then create a new 'default' default section
+ *
+ * @param self The configuration class.
+ *
+ * @param data Pointer to the section we want to remove.
+ *
+ * @param user_data Not used.
+ *
+ * @return The result of the operation.
+ */
+static int gtkterm_configuration_remove_section(GtkTermConfiguration *self, gpointer data, gpointer user_data)
+{
+	GtkTermConfigurationState rc = GTKTERM_CONFIGURATION_SUCCESS;
+	char *section = (char *)data;
+	GError *error = NULL;
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+
+	if ((rc = check_keyfile(self, section)) != GTKTERM_CONFIGURATION_SUCCESS)
+		return rc;
+
+	/** If we remove the DEFAULT_SECTION then create a new one */
+	if (!g_strcmp0((const char *)section, (const char *)&DEFAULT_SECTION)) {
+
+		gtkterm_configuration_default_configuration(self, section);
+	}
+	else if (!g_key_file_remove_group(priv->key_file, section, &error))	{
+		
+		/** Remove the group from GKeyFile */
+		g_propagate_error (&error, 
+							g_error_new (g_quark_from_static_string ("GTKTERM_CONFIGURATION"),
+                          	GTKTERM_CONFIGURATION_SECTION_NOT_REMOVED,
+                          	_("Failed to remove section: %s\n%s"),
+                          	section,
+						 	error->message));
+
+
+			rc = GTKTERM_CONFIGURATION_SECTION_NOT_REMOVED;
+	} else {
+		gtkterm_configuration_save_keyfile(self, user_data);
+
+		rc = GTKTERM_CONFIGURATION_SECTION_REMOVED;
+
+		error = g_error_new (g_quark_from_static_string ("GTKTERM_CONFIGURATION"),
+                             GTKTERM_CONFIGURATION_SECTION_REMOVED,
+                             _ ("Section [%s] removed"),
+							 section
+                             );
+	}
+
+	return gtkterm_configuration_set_status(self, rc, error);
+}
+
+/**
+ * @brief Copy the active configuration into [section] of the Key file.
+ *
+ * The pc and tc are the config items from a terminal window. They stay
+ * in memory until an explicite save is given.
+ *
+ * @param self The configuration class.
+ *
+ * @param sect Section we want to copy the config into.
+ *
+ * @param pc The port configuration.
+ *
+ * @param tc Terminal configuration.
+ *
+ * @param user_data Not used.
+ *
+ * @return The result of the operation.
+ */
+static int gtkterm_configuration_copy_section(GtkTermConfiguration *self, gpointer sect, gpointer pc, gpointer tc, gpointer user_data)
+{
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+	port_config_t *port_conf = (port_config_t *)pc;
+	term_config_t *term_conf = (term_config_t *)tc;
+	char *section = (char *)sect;
+
+	char *string = NULL;
+	//	char **string_list = NULL;
+	//	gsize nr_of_strings = 0;
+
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_PORT], port_conf->port);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_BAUDRATE], port_conf->baudrate);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_BITS], port_conf->bits);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_STOPBITS], port_conf->stopbits);
+
+	switch (port_conf->parity) {
+
+		case GTKTERM_SERIAL_PORT_PARITY_NONE:
+			string = g_strdup_printf("none");
+			break;
+		case GTKTERM_SERIAL_PORT_PARITY_ODD:
+			string = g_strdup_printf("odd");
+			break;
+		case GTKTERM_SERIAL_PORT_PARITY_EVEN:
+			string = g_strdup_printf("even");
+			break;
+		default:
+			string = g_strdup_printf("none");
+	}
+
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_PARITY], string);
+	g_free(string);
+
+	switch (port_conf->flow_control) {
+
+		case GTKTERM_SERIAL_PORT_FLOWCONTROL_NONE:
+			string = g_strdup_printf("none");
+			break;
+		case GTKTERM_SERIAL_PORT_FLOWCONTROL_XON_XOFF:
+			string = g_strdup_printf("xon");
+			break;
+		case GTKTERM_SERIAL_PORT_FLOWCONTROL_RTS_CTS:
+			string = g_strdup_printf("rts");
+			break;
+		case GTKTERM_SERIAL_PORT_FLOWCONTROL_RS485_HD:
+			string = g_strdup_printf("rs485");
+			break;
+		default:
+			string = g_strdup_printf("none");
+	}
+
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_FLOW_CONTROL], string);
+	g_free(string);
+
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_WAIT_DELAY], term_conf->delay);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_WAIT_CHAR], term_conf->char_queue);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_RS485_RTS_TIME_BEFORE_TX],
+						   port_conf->rs485_rts_time_before_transmit);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_RS485_RTS_TIME_AFTER_TX],
+						   port_conf->rs485_rts_time_after_transmit);
+
+	g_key_file_set_boolean(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_ECHO], term_conf->echo);
+	g_key_file_set_boolean(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_AUTO_LF], term_conf->auto_lf);
+	g_key_file_set_boolean(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_AUTO_CR], term_conf->auto_cr);	
+	g_key_file_set_boolean(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_DISABLE_PORT_LOCK], port_conf->disable_port_lock);
+
+	string = pango_font_description_to_string(term_conf->font);
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FONT], string);
+	g_free(string);
+
+	/** Macros are an array of strings, so we have to convert it
+	 * All macros ends up in the string_list
+	 */
+	//	string_list = g_malloc ( macro_count () * sizeof (char *) * 2 + 1);
+	//	nr_of_strings = convert_macros_to_string (string_list);
+	//	g_key_file_set_string_list (priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_MACROS], (const char * const*) string_list, nr_of_strings);
+	//	g_free(string_list);
+
+	g_key_file_set_boolean(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_SHOW_CURSOR], term_conf->show_cursor);
+	g_key_file_set_boolean(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_TIMESTAMP], term_conf->timestamp);
+	g_key_file_set_boolean(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BLOCK_CURSOR], term_conf->block_cursor);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_ROWS], term_conf->rows);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_COLS], term_conf->columns);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_SCROLLBACK], term_conf->scrollback);
+	g_key_file_set_boolean(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_VISUAL_BELL], term_conf->visual_bell);
+
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_RED], term_conf->foreground_color.red);
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_GREEN], term_conf->foreground_color.green);
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_BLUE], term_conf->foreground_color.blue);
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_ALPHA], term_conf->foreground_color.alpha);
+
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_RED], term_conf->background_color.red);
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_GREEN], term_conf->background_color.green);
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_BLUE], term_conf->background_color.blue);
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_ALPHA], term_conf->background_color.alpha);
+
+	return gtkterm_configuration_set_status (self, GTKTERM_CONFIGURATION_SUCCESS, NULL);
+}
+
+/**
+ * @brief Load the terminal configuration from keyfile
+ *
+ * Load the terminal configuration from [section] into the term config.
+ * If it does not exists it creates one from the defaults
+ *
+ * @param self The configuration class.
+ *
+ * @param data The section we want to get the config from.
+ *
+ * @param user_data Not used.
+ *
+ * @return The terminal configuration which ends up as the last param in the signal. NULL on error.
+ */
+static term_config_t *gtkterm_configuration_load_terminal_config(GtkTermConfiguration *self, gpointer data, gpointer user_data) {
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+	term_config_t *term_conf;
+	char *section = (char *)data;
+	char *key_str = NULL;
+	int key_value = 0;
+
+	if (check_keyfile(self, section) != GTKTERM_CONFIGURATION_SUCCESS)
+		return NULL;
+
+	term_conf = g_malloc0(sizeof(term_config_t));
+
+	term_conf->delay = g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_WAIT_DELAY], NULL);
+	term_conf->rows = g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_ROWS], NULL);
+	term_conf->columns = g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_COLS], NULL);
+	term_conf->scrollback = g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_SCROLLBACK], NULL);
+
+	key_str = g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BLOCK_CURSOR], NULL);
+	if (key_str != NULL) {
+		term_conf->block_cursor = g_ascii_strcasecmp(key_str, "true") ? false : true;
+
+		g_free(key_str);
+	}
+
+	key_str = g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_SHOW_CURSOR], NULL);
+	if (key_str != NULL) {
+		term_conf->show_cursor = g_ascii_strcasecmp(key_str, "true") ? false : true;
+
+		g_free(key_str);
+	}
+
+	key_str = g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_AUTO_LF], NULL);
+	if (key_str != NULL) {
+		term_conf->auto_lf = g_ascii_strcasecmp(key_str, "true") ? false : true;
+
+		g_free(key_str);
+	}
+
+	key_str = g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_AUTO_CR], NULL);
+	if (key_str != NULL) {
+		term_conf->auto_cr = g_ascii_strcasecmp(key_str, "true") ? false : true;
+
+		g_free(key_str);
+	}	
+
+	key_str = g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_ECHO], NULL);
+	if (key_str != NULL) {
+		term_conf->echo = g_ascii_strcasecmp(key_str, "true") ? false : true;
+		
+		g_free(key_str);
+	}
+
+	key_str = g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_TIMESTAMP], NULL);
+	if (key_str != NULL) {
+		term_conf->timestamp = g_ascii_strcasecmp(key_str, "true") ? false : true;
+
+		g_free(key_str);
+	}
+
+	key_str = g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_VISUAL_BELL], NULL);
+	if (key_str != NULL) {
+		term_conf->visual_bell = g_ascii_strcasecmp(key_str, "true") ? false : true;
+
+		g_free(key_str);
+	}
+
+	key_value = g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_WAIT_CHAR], NULL);
+	term_conf->char_queue = key_value ? (signed char)key_value : -1;
+
+	set_color(&term_conf->foreground_color,
+			  g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_RED], NULL),
+			  g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_GREEN], NULL),
+			  g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_BLUE], NULL),
+			  g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_ALPHA], NULL));
+
+	set_color(&term_conf->background_color,
+			  g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_RED], NULL),
+			  g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_GREEN], NULL),
+			  g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_BLUE], NULL),
+			  g_key_file_get_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_ALPHA], NULL));
+
+	/** The Font is a Pango structure. This only can be added to a terminal
+	 * So we have to convert it.
+	 */
+	// 	g_clear_pointer (term_conf->font, pango_font_description_free);
+	key_str = g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FONT], NULL);
+	term_conf->font = pango_font_description_from_string(key_str);
+	g_free(key_str);
+
+	return term_conf;
+}
+
+/**
+ * @brief Load the portconfiguration from keyfile
+ *
+ * Load the port configuration from [section] into the term config.
+ * If it does not exists it creates one from the defaults
+ *
+ * @param self The configuration class.
+ *
+ * @param data The section we want to get the config from.
+ *
+ * @param user_data Not used.
+ *
+ * @return The port configuration which ends up as the last param in the signal. NULL on error.
+ */
+static port_config_t *gtkterm_configuration_load_serial_config(GtkTermConfiguration *self, gpointer data, gpointer user_data) {
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+	port_config_t *port_conf;
+	char *section = (char *)data;
+	char *key_str = NULL;
+
+	if (check_keyfile(self, section) != GTKTERM_CONFIGURATION_SUCCESS)
+		return NULL;
+
+	port_conf = g_malloc0(sizeof(port_config_t));
+
+	port_conf->port = g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_PORT], NULL);
+	port_conf->baudrate = g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_BAUDRATE], NULL);
+	port_conf->bits = g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_BITS], NULL);
+	port_conf->stopbits = g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_STOPBITS], NULL);
+	port_conf->rs485_rts_time_before_transmit = g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_RS485_RTS_TIME_BEFORE_TX], NULL);
+	port_conf->rs485_rts_time_after_transmit = g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_RS485_RTS_TIME_AFTER_TX], NULL);
+
+	key_str = g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_PARITY], NULL);
+	if (key_str != NULL) {
+		if (!g_ascii_strcasecmp(key_str, "none"))
+			port_conf->parity = GTKTERM_SERIAL_PORT_PARITY_NONE;
+		else if (!g_ascii_strcasecmp(key_str, "odd"))
+			port_conf->parity = GTKTERM_SERIAL_PORT_PARITY_ODD;
+		else if (!g_ascii_strcasecmp(key_str, "even"))
+			port_conf->parity = GTKTERM_SERIAL_PORT_PARITY_EVEN;
+		g_free(key_str);
+	}
+
+	key_str = g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_FLOW_CONTROL], NULL);
+	if (key_str != NULL) {
+		if (!g_ascii_strcasecmp(key_str, "none"))
+			port_conf->flow_control = GTKTERM_SERIAL_PORT_FLOWCONTROL_NONE;
+		else if (!g_ascii_strcasecmp(key_str, "xon"))
+			port_conf->flow_control = GTKTERM_SERIAL_PORT_FLOWCONTROL_XON_XOFF;
+		else if (!g_ascii_strcasecmp(key_str, "rts"))
+			port_conf->flow_control = GTKTERM_SERIAL_PORT_FLOWCONTROL_RTS_CTS;
+		else if (!g_ascii_strcasecmp(key_str, "rs485"))
+			port_conf->flow_control = GTKTERM_SERIAL_PORT_FLOWCONTROL_RS485_HD;
+
+		g_free(key_str);
+	}
+
+	key_str = g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_DISABLE_PORT_LOCK], NULL);
+	if (key_str != NULL) {
+		port_conf->disable_port_lock = g_ascii_strcasecmp(key_str, "true") ? true : false;
+
+		g_free(key_str);
+	}
+
+	return port_conf;
+}
+
+/**
+ * @brief Create a new configuration with defaults.
+ *
+ * @param self The configuration class.
+ *
+ * @param section The section we want to get the config for.
+ *
+ */
+void gtkterm_configuration_default_configuration(GtkTermConfiguration *self, char *section) {
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_PORT], DEFAULT_PORT);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_BAUDRATE], DEFAULT_BAUDRATE);
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_PARITY], DEFAULT_PARITY);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_BITS], DEFAULT_BITS);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_STOPBITS], DEFAULT_STOPBITS);
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_FLOW_CONTROL], DEFAULT_FLOW);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_RS485_RTS_TIME_BEFORE_TX], DEFAULT_DELAY_RS485);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_RS485_RTS_TIME_AFTER_TX], DEFAULT_DELAY_RS485);
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_DISABLE_PORT_LOCK], "false");
+
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_WAIT_CHAR], DEFAULT_CHAR);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_WAIT_DELAY], DEFAULT_DELAY);
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_ECHO], DEFAULT_ECHO);
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_AUTO_LF], "false");
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_AUTO_CR], "false");	
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FONT], DEFAULT_FONT);
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BLOCK_CURSOR], "true");
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_SHOW_CURSOR], "true");
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_TIMESTAMP], "false");
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_ROWS], 80);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_COLS], 25);
+	g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_SCROLLBACK], DEFAULT_SCROLLBACK);
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_VISUAL_BELL], DEFAULT_VISUAL_BELL);
+
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_RED], 0.66);
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_GREEN], 0.66);
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_BLUE], 0.66);
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FOREGROUND_ALPHA], 1);
+
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_RED], 0);
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_GREEN], 0);
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_BLUE], 0);
+	g_key_file_set_double(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_BACKGROUND_ALPHA], 1);
+
+	g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_MACROS], "");
+}
+
+/**
+ * @brief validate the configuration, given by the section.
+ *
+ * If not it creates and new default one and save it to disk.
+ * When it finds an invalid config option it returns with an error
+ * for which item the configuration check fails.
+ *
+ * @param self The configuration class.
+ *
+ * @param section The section we want to validate.
+ *
+ * @return The result of the operation
+ *
+ */
+GtkTermConfigurationState gtkterm_configuration_validate(GtkTermConfiguration *self, char *section) {
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+	GtkTermConfigurationState rc = GTKTERM_CONFIGURATION_SUCCESS;
+	GError *error = NULL;
+	int value;
+	unsigned long lvalue;
+
+	lvalue = g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_BAUDRATE], NULL);
+	switch (lvalue) {
+		case 300:
+		case 600:
+		case 1200:
+		case 2400:
+		case 4800:
+		case 9600:
+		case 19200:
+		case 38400:
+		case 57600:
+		case 115200:
+		case 230400:
+		case 460800:
+		case 576000:
+		case 921600:
+		case 1000000:
+		case 2000000:
+			break;
+
+		default:
+				error = g_error_new (g_quark_from_static_string ("GTKTERM_CONFIGURATION"),
+                             GTKTERM_CONFIGURATION_INVALID_BAUDRATE,
+                             _ ("Baudrate %ld may not be supported by all hardware"),
+							 lvalue
+                             );
+
+				rc =  GTKTERM_CONFIGURATION_INVALID_BAUDRATE;
+				goto validate_exit;
+	}
+
+	value = g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_STOPBITS], NULL);
+	if (value != 1 && value != 2) {
+		
+		error = g_error_new (g_quark_from_static_string ("GTKTERM_CONFIGURATION"),
+                             GTKTERM_CONFIGURATION_INVALID_STOPBITS,
+                             _ ("Invalid number of stopbits: %d\nFalling back to default number of stopbits: %d"),
+							 value,
+							 DEFAULT_STOPBITS
+                             );
+
+		rc = GTKTERM_CONFIGURATION_INVALID_STOPBITS;
+
+		goto validate_exit;
+	}
+
+	value = g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_SERIAL_BITS], NULL);
+	if (value < 5 || value > 8)	{
+		
+		error = g_error_new (g_quark_from_static_string ("GTKTERM_CONFIGURATION"),
+                             GTKTERM_CONFIGURATION_INVALID_BITS,
+                             _ ("Invalid number of bits: %d\nFalling back to default number of bits: %d"),
+							 value,
+							 DEFAULT_BITS
+                             );
+
+		rc = GTKTERM_CONFIGURATION_INVALID_BITS;
+
+		goto validate_exit;		
+	}
+
+	value = g_key_file_get_integer(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_WAIT_DELAY], NULL);
+	if (value < 0 || value > 500) {
+
+		error = g_error_new (g_quark_from_static_string ("GTKTERM_CONFIGURATION"),
+                             GTKTERM_CONFIGURATION_INVALID_DELAY,
+                             _ ("Invalid delay: %d ms\nFalling back to default delay: %d ms"),
+							 value,
+							 DEFAULT_STOPBITS
+                             );
+
+		rc = GTKTERM_CONFIGURATION_INVALID_DELAY;
+
+		goto validate_exit;
+	}
+
+	if (g_key_file_get_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FONT], NULL) == NULL)
+		g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[CONF_ITEM_TERM_FONT], DEFAULT_FONT);
+
+validate_exit:
+	return gtkterm_configuration_set_status (self, rc, error);
+}
+
+/**
+ * @brief Set the config option in the keyfile.
+ *
+ * All option which are given from the CLI are stored into the keyfile with [section]
+ * Options are not saved to disk.
+ *
+ * @param name The configoption we want to set.
+ *
+ * @param value The value for this option.
+ *
+ * @param data The section we want to get the config from.
+ *
+ * @param error Error (not used).
+ *
+ * @return The inversed (0 -> 1, 1 -> 0) result of the operation. Because of the handling of
+ * 	 		the return value from GOptionEntry. GOptionEntry contuinues if callback returns 1.
+ *
+ */
+GtkTermConfigurationState on_set_config_options(const char *name, const char *value, gpointer data, GError **error) {
+
+	int item_counter = 0;
+	char *section = GTKTERM_APP(data)->section;
+	GtkTermConfigurationState rc = GTKTERM_CONFIGURATION_SUCCESS;
+	GtkTermConfiguration *self = GTKTERM_APP(data)->config;
+	GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private(self);
+
+	/** First check and load the keyfile */
+	if ((rc = check_keyfile(self, section)) != GTKTERM_CONFIGURATION_SUCCESS)
+		return rc;
+
+	/**
+	 * Check if we use the long or short option.
+	 * For the long option, the option start at position 3 (--option). So add 2.
+	 * For the short option the option start at positon 2 (-o) so add 1.
+	 */
+	name += strlen(name) > 2 ? 2 : 1;
+
+	/** Search index for the option we want to set */
+	while (item_counter < CONF_ITEM_LAST) {
+		if (!g_strcmp0(name, GtkTermConfigurationItems[item_counter]) ||
+			!g_strcmp0(name, GtkTermCLIShortOption[item_counter]))
+			break;
+
+		item_counter++;
+	}
+
+	switch (item_counter) {
+		case CONF_ITEM_TERM_ECHO:
+		case CONF_ITEM_TERM_AUTO_LF:
+		case CONF_ITEM_TERM_AUTO_CR:		
+		case CONF_ITEM_SERIAL_DISABLE_PORT_LOCK:
+		case CONF_ITEM_SERIAL_PARITY:
+		case CONF_ITEM_SERIAL_FLOW_CONTROL:
+			g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[item_counter], value);
+			break;
+
+		case CONF_ITEM_SERIAL_BAUDRATE:
+			g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[item_counter], atol(value));
+			break;
+
+		case CONF_ITEM_SERIAL_BITS:
+		case CONF_ITEM_SERIAL_STOPBITS:
+		case CONF_ITEM_SERIAL_RS485_RTS_TIME_BEFORE_TX:
+		case CONF_ITEM_SERIAL_RS485_RTS_TIME_AFTER_TX:
+		case CONF_ITEM_TERM_WAIT_CHAR:
+		case CONF_ITEM_TERM_WAIT_DELAY:
+		case CONF_ITEM_TERM_COLS:
+		case CONF_ITEM_TERM_ROWS:				
+			g_key_file_set_integer(priv->key_file, section, GtkTermConfigurationItems[item_counter], atoi(value));
+			break;
+
+		case CONF_ITEM_TERM_RAW_FILENAME:
+		case CONF_ITEM_SERIAL_PORT:
+			/** Check for max path length. Exit if it is to long.
+			 * Note: Serial port is also a path to a device.
+			 */
+			if ((int)strlen(value) < PATH_MAX) {
+				g_key_file_set_string(priv->key_file, section, GtkTermConfigurationItems[item_counter], value);			
+			} else {
+				g_printf(_("Filename to long\n\n"));
+				*error = g_error_new (g_quark_from_static_string ("GTKTERM_CONFIGURATION"),
+                             GTKTERM_CONFIGURATION_FILNAME_TO_LONG,
+                             _ ("Filename to long (%d)"),
+							 (int)strlen(value)
+                             );				
+
+				rc = GTKTERM_CONFIGURATION_FILNAME_TO_LONG;
+			}
+
+			break;
+
+		default:
+			/** We should not get here. */
+			*error = g_error_new (g_quark_from_static_string ("GTKTERM_CONFIGURATION"),
+                            	GTKTERM_CONFIGURATION_UNKNOWN_OPTION,
+                             	_("Unknown option (%s)"),
+							 	name
+                             	);		
+			rc = GTKTERM_CONFIGURATION_UNKNOWN_OPTION;
+			break;
+	}
+
+	if (rc == GTKTERM_CONFIGURATION_SUCCESS)
+		gtkterm_configuration_validate(GTKTERM_APP(data)->config, section);
+
+	/** Set the dirty flag */
+	priv->config_is_dirty = true;
+
+	return (gtkterm_configuration_set_status(self, rc, *error) == GTKTERM_CONFIGURATION_SUCCESS);
+}
+
+/**
+ * @brief Convert the colors RGB to internal color scheme
+ *
+ * @param color The composed color
+ *
+ * @param R The red component
+ *
+ * @param G The green component
+ *
+ * @param B The blue component
+ *
+ * @param A Alpha
+ *
+ */
+//! Convert the colors RGB to internal color scheme
+static void set_color(GdkRGBA *color, float R, float G, float B, float A)
+{
+	color->red = R;
+	color->green = G;
+	color->blue = B;
+	color->alpha = A;
+}
+
+// int load_configuration_from_file(char *section)
+// {
+
+// 	//! First initialize with a default structure.
+// 	//! Not really needed but good practice.
+// 	hard_default_configuration();
+
+// 	/// Convert the stringlist to macros. Existing shortcuts will be delete from convert_string_to_macros
+// 	macrostring = g_key_file_get_string_list (config_object, section, GtkTermConfigurationItems[CONF_ITEM_MACROS], &nr_of_strings, NULL);
+// 	convert_string_to_macros (macrostring, nr_of_strings);
+// 	g_strfreev(macrostring);
+
+// 	return 0;
+// }
+
+/**
+ * @brief  Sets the status and error of the last operation.
+ *
+ * @param self The configuration for which the get the status for.
+ *
+ * @param status The status to be set.
+ * 
+ * @param error The error message (can be NULL)
+ *
+ * @return  The latest status.
+ *
+ */
+GtkTermConfigurationState gtkterm_configuration_set_status (GtkTermConfiguration *self, GtkTermConfigurationState status, GError *error) {
+    GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private (self);
+
+	priv->config_status = status;
+
+	/** If there is a previous error, clear it */
+	if (priv->config_error != NULL)
+		g_error_free (priv->config_error);
+	
+	priv->config_error = error;	
+
+	return status;
+}
+
+/**
+ * @brief  Return the latest status condiation for the file operation.
+ *
+ * @param self The configuration for which the get the status for.
+ *
+ * @return  The latest status.
+ *
+ */
+GtkTermConfigurationState gtkterm_configuration_get_status (GtkTermConfiguration *self) {
+    GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private (self);
+
+	return (priv->config_status);
+}
+
+/**
+ * @brief  Return the latest error for the file operation.
+ *
+ * @param self The configuration for which the get the status for.
+ *
+ * @return  The latest error.
+ *
+ */
+GError *gtkterm_configuration_get_error (GtkTermConfiguration *self) {
+    GtkTermConfigurationPrivate *priv = gtkterm_configuration_get_instance_private (self);
+
+	return (priv->config_error);
+}
\ No newline at end of file
diff --git a/src/gtkterm_configuration.h b/src/gtkterm_configuration.h
new file mode 100644
index 0000000..e5dab08
--- /dev/null
+++ b/src/gtkterm_configuration.h
@@ -0,0 +1,101 @@
+/***********************************************************************
+ * gtkterm_configuration.h
+ *
+ * GTKTerm Software (c) Julien Schmitt
+ *
+ * 
+ * @brief Purpose 
+ *      Load and save configuration file
+ *      - Header file
+ *
+ ***********************************************************************/
+
+#ifndef GTKTERM_CONFIGURATION_H
+#define GTKTERM_CONFIGURATION_H
+
+/**
+ * @brief  Enum items for configuration
+ * 
+ * Define all configuration items which are used
+ * in the resource file. it is an index to ConfigurationItem.
+ * Configuration item names. 
+ */
+enum {
+		CONF_ITEM_SERIAL_PORT,
+		CONF_ITEM_SERIAL_BAUDRATE,
+		CONF_ITEM_SERIAL_BITS,
+		CONF_ITEM_SERIAL_STOPBITS,
+		CONF_ITEM_SERIAL_PARITY,
+		CONF_ITEM_SERIAL_FLOW_CONTROL,
+		CONF_ITEM_TERM_WAIT_DELAY,
+		CONF_ITEM_TERM_WAIT_CHAR,
+		CONF_ITEM_SERIAL_RS485_RTS_TIME_BEFORE_TX,
+		CONF_ITEM_SERIAL_RS485_RTS_TIME_AFTER_TX,
+		CONF_ITEM_TERM_MACROS,
+		CONF_ITEM_TERM_RAW_FILENAME,
+		CONF_ITEM_TERM_ECHO,
+		CONF_ITEM_TERM_AUTO_LF,
+		CONF_ITEM_TERM_AUTO_CR,
+		CONF_ITEM_SERIAL_DISABLE_PORT_LOCK,
+		CONF_ITEM_TERM_FONT,
+		CONF_ITEM_TERM_TIMESTAMP,
+		CONF_ITEM_TERM_BLOCK_CURSOR,
+		CONF_ITEM_TERM_SHOW_CURSOR,
+		CONF_ITEM_TERM_ROWS,
+		CONF_ITEM_TERM_COLS,
+		CONF_ITEM_TERM_SCROLLBACK,
+		CONF_ITEM_TERM_VISUAL_BELL,
+		CONF_ITEM_TERM_FOREGROUND_RED,
+		CONF_ITEM_TERM_FOREGROUND_GREEN,
+		CONF_ITEM_TERM_FOREGROUND_BLUE,
+		CONF_ITEM_TERM_FOREGROUND_ALPHA,
+		CONF_ITEM_TERM_BACKGROUND_RED,
+		CONF_ITEM_TERM_BACKGROUND_GREEN,
+		CONF_ITEM_TERM_BACKGROUND_BLUE,
+		CONF_ITEM_TERM_BACKGROUND_ALPHA,	
+		CONF_ITEM_LAST						/**< Checking as last item in the list.		*/
+};
+
+/**
+ * @brief  Enum config_error id.
+ * 
+ * Many of the gtk_configuration functions return
+ * an error id.
+ */
+typedef enum {
+	GTKTERM_CONFIGURATION_SUCCESS,
+	GTKTERM_CONFIGURATION_FILE_CREATED,	
+	GTKTERM_CONFIGURATION_FILE_CONFIG_LOAD,
+	GTKTERM_CONFIGURATION_FILE_SAVED,
+	GTKTERM_CONFIGURATION_FILE_NOT_SAVED,
+	GTKTERM_CONFIGURATION_NO_KEYFILE_LOADED,
+	GTKTERM_CONFIGURATION_SECTION_REMOVED,
+	GTKTERM_CONFIGURATION_SECTION_NOT_REMOVED,
+	GTKTERM_CONFIGURATION_SECTION_UNKNOWN,
+	GTKTERM_CONFIGURATION_INVALID_BAUDRATE,
+	GTKTERM_CONFIGURATION_INVALID_BITS,
+	GTKTERM_CONFIGURATION_INVALID_STOPBITS,
+	GTKTERM_CONFIGURATION_INVALID_DELAY,
+	GTKTERM_CONFIGURATION_FILNAME_TO_LONG,
+	GTKTERM_CONFIGURATION_UNKNOWN_OPTION,
+	GTKTERM_CONFIGURATION_LAST
+
+} GtkTermConfigurationState;
+
+extern const char GtkTermConfigurationItems [][CONF_ITEM_LENGTH];
+
+G_BEGIN_DECLS
+
+#define GTKTERM_TYPE_CONFIGURATION gtkterm_configuration_get_type ()
+G_DECLARE_FINAL_TYPE (GtkTermConfiguration, gtkterm_configuration, GTKTERM, CONFIGURATION, GObject)
+typedef struct _GtkTermConfiguration GtkTermConfiguration;
+
+GtkTermConfiguration *gtkterm_configuration_new (void);
+
+GtkTermConfigurationState on_set_config_options (const char *, const char *, gpointer,  GError **);
+GtkTermConfigurationState gtkterm_configuration_get_status (GtkTermConfiguration *);
+GError *gtkterm_configuration_get_error (GtkTermConfiguration *);
+
+G_END_DECLS
+
+#endif //GTKTERM_CONFIGURATION
diff --git a/src/gtkterm_defaults.h b/src/gtkterm_defaults.h
new file mode 100644
index 0000000..e9bc2ab
--- /dev/null
+++ b/src/gtkterm_defaults.h
@@ -0,0 +1,46 @@
+#ifndef GTKTERM_DEFAULTS_H
+#define GTKTERM_DEFAULTS_H
+
+/** Defaults for VTE-terminal    */
+#define DEFAULT_FONT            "Monospace 12"
+#define DEFAULT_SCROLLBACK      10000
+#define DEFAULT_DELAY 		    0
+#define DEFAULT_CHAR 		    -1
+#define DEFAULT_DELAY_RS485     30
+#define DEFAULT_ECHO 		    "false"
+#define DEFAULT_VISUAL_BELL     "false"
+
+/** Defaults for serial ports    */
+#define DEFAULT_PORT 	        "/dev/ttyS0"
+#define DEFAULT_BAUDRATE        115200
+#define DEFAULT_PARITY 	        "none"
+#define DEFAULT_BITS 	        8
+#define DEFAULT_STOPBITS        1
+#define DEFAULT_FLOW 	        "none"
+
+/** 
+ * The buffers for receive and transmit are internal buffers for the communication API.
+ * It is not the buffersize for the terminal/serialport communication
+ */
+#define GTKTERM_SERIAL_PORT_RECEIVE_BUFFER_SIZE  8192   /**< Size of the receive buffer for the serial port     */
+#define GTKTERM_SERIAL_PORT_TRANSMIT_BUFFER_SIZE 4096   /**< Size of the transmit buuffer for the serial port   */
+
+#define LINE_FEED               0x0A
+#define POLL_DELAY              100                     /**< in ms (for control signals)                        */
+
+/** Generic defaults            */
+#define BUFFER_LENGTH           256
+#define MAX_SECTION_LENGTH      32
+#define GTKTERM_MESSAGE_LENGTH  128
+#define DEFAULT_SECTION		   "default"		        /**< Default section if not specified	                */
+#define CONFIGURATION_FILENAME ".gtktermrc"		        /**< Name of the resource file                          */
+#define CONF_ITEM_LENGTH		32
+#define DEFAULT_STRING_LEN      32
+
+/** Type of terminal view       */
+#define ASCII_VIEW              0
+#define HEXADECIMAL_VIEW        1
+
+#define BUFFER_SIZE             (128 * 1024)            /**< Size of the buffer between the terminal and port   */
+
+#endif // GTKTERM_DEFAULTS_H
\ No newline at end of file
diff --git a/src/gtkterm_serial_port.c b/src/gtkterm_serial_port.c
new file mode 100644
index 0000000..acc4478
--- /dev/null
+++ b/src/gtkterm_serial_port.c
@@ -0,0 +1,1104 @@
+/***********************************************************************/
+/* serial.c                                                             */
+/* -------                                                             */
+/*           GTKTerm Software                                          */
+/*                      (c) Julien Schmitt                             */
+/*                                                                     */
+/* ------------------------------------------------------------------- */
+/*                                                                     */
+/*   Purpose                                                           */
+/*      Serial port access functions                                   */
+/*                                                                     */
+/*   ChangeLog                                                         */
+/*      - 0.99.7 : Removed auto crlf stuff - (use macros instead)      */
+/*      - 0.99.5 : changed all calls to strerror() by strerror_utf8()  */
+/*      - 0.99.2 : Internationalization                                */
+/*      - 0.98.6 : new sendbreak() function                            */
+/*      - 0.98.1 : lockfile implementation (based on minicom)          */
+/*      - 0.98 : removed IOChannel                                     */
+/*                                                                     */
+/***********************************************************************/
+
+#include <gtk/gtk.h>
+#include <glib.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/file.h>
+#include <signal.h>
+#include <string.h>
+#include <errno.h>
+#include <pwd.h>
+#include <termios.h>
+#include <fcntl.h>
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <config.h>
+#include <glib/gi18n.h>
+#include <glib/gprintf.h>
+#include <glib-unix.h>
+#include <gio/gio.h>
+#include <gio-unix-2.0/gio/gunixinputstream.h> 
+#include <gio-unix-2.0/gio/gunixoutputstream.h> 
+#include <gudev/gudev.h>
+
+#include "gtkterm.h"
+#include "gtkterm_serial_port.h"
+
+#ifdef HAVE_LINUX_SERIAL_H
+#include <linux/serial.h>
+#endif
+
+/** In milliseconds for control signals */
+#define GTKTERM_SERIAL_PORT_CONTROL_POLL_DELAY	100
+
+const char GtkTermSerialPortStateString [][DEFAULT_STRING_LEN] = {
+	"Connected",
+	"Disconnected",
+	"Error"
+};
+
+typedef struct {
+	GUdevClient *udev_client;			/**< The udev client for monitoring the device status 	*/
+    port_config_t *port_conf;			/**< The configuration for the serial port				*/
+    struct termios port_termios;		/**< Saved port termios configuration for this port		*/
+	GOutputStream *output_stream;		/**< The outgoing stream to the device					*/
+    GInputStream *input_stream;			/**< The incomming stream from the device				*/
+    GCancellable *cancellable;			/**< Allowing canceling async operation (reading port)	*/
+    unsigned int control_signal_timeout;/**< Interval to check/update serial control signals	*/
+
+    int port_fd;						/**< The port file descriptor							*/
+	int control_signals;				/**< The last serial signals (updated from the timeout)	*/
+	GtkTermSerialPortState port_status;	/**< State of the serial port							*/
+	GError *port_error;					//*< Last error detected on the port					*/
+
+} GtkTermSerialPortPrivate;
+
+struct _GtkTermSerialPort {
+    GObject parent_instance;
+};
+
+struct _GtkTermSerialPortClass {
+    GObjectClass parent_class;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkTermSerialPort, gtkterm_serial_port, G_TYPE_OBJECT)
+
+enum { 
+	PROP_0, 
+	PROP_PORT_CONFIG,
+	PROP_PORT_STATUS,
+	PROP_PORT_SIGNALS,
+	N_PROPS 
+};
+
+static GParamSpec *gtkterm_serial_port_properties[N_PROPS] = {NULL};
+
+/** Local functions */
+static int gtkterm_serial_port_open (GtkTermSerialPort *);
+static int gtkterm_serial_port_close (GtkTermSerialPort *);
+int gtkterm_serial_port_lock (GtkTermSerialPort *, GError **);
+int gtkterm_serial_port_unlock (GtkTermSerialPort *);
+void gtkterm_serial_port_set_status (GtkTermSerialPort *, GtkTermSerialPortState, GError *);
+static void gtkterm_serial_port_serial_data_received (GObject *, GAsyncResult *, gpointer);
+static int gtkterm_serial_port_serial_data_transmit (GObject *, gpointer, unsigned int, gpointer);
+static int gtkterm_serial_port_control_signals_read (gpointer);
+void gtkterm_serial_port_set_signals (GtkTermSerialPort *, unsigned int);
+
+
+static bool gtkterm_serial_port_handle_usr1 (gpointer);
+static bool gtkterm_serial_port_handle_usr2 (gpointer);
+
+#ifdef HAVE_LINUX_SERIAL_H
+int gtkterm_serial_port_set_custom_speed(int, int);
+#endif
+
+/**
+ * @brief Create a new serial port object.
+ * 
+ * This also binds the parameter to the properties of the serial port.
+ * 
+ * @param port_conf The section for the configuration in this terminal
+ * 
+ * @return The serial_port object.
+ * 
+ */
+GtkTermSerialPort *gtkterm_serial_port_new (port_config_t *port_conf) {
+
+    return g_object_new (GTKTERM_TYPE_SERIAL_PORT, "port_conf", port_conf, NULL);
+}
+
+/**
+ * @brief Opens or closes the serial port.
+ * 
+ * @param self The serial port structure.
+ * 
+ * @param status The new status for this port
+ */
+static inline void gtkterm_serial_port_set(GtkTermSerialPort *self, GtkTermSerialPortStatus status) {
+	if (status == GTKTERM_SERIAL_PORT_OPEN)
+		gtkterm_serial_port_open (self);
+	else
+		gtkterm_serial_port_close (self);	
+}
+
+/**
+ * @brief Based on the action return from uevent we handle to open of close the port
+ * 
+ * Note: This is an inline function. Without inline it wont work!.
+ * 
+ * @param self Pointer to the serial port.
+ * 
+ * @param action The action we are performing with this device.
+ */
+static inline void gtkterm_serial_port_handle(GtkTermSerialPort *self, const char *action) {
+
+	if (g_strcmp0(action, "remove") == 0)
+		gtkterm_serial_port_set (self, GTKTERM_SERIAL_PORT_CLOSE);
+	else if (g_strcmp0 (action, "add") == 0)
+		gtkterm_serial_port_set (self, GTKTERM_SERIAL_PORT_OPEN);
+}
+
+/**
+ * @brief Callback for the uevent signal
+ * 
+ * @param client The udev-client
+ * 
+ * @param action The action it detects
+ * 
+ * @param device The device.
+ * 
+ * @param user_data The GtkTermSerialPort structure.
+ */
+void gtkterm_serial_port_event_udev(GUdevClient *client, const char *action, GUdevDevice *device, gpointer user_data) {
+	GtkTermSerialPort *self = GTKTERM_SERIAL_PORT(user_data);
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);	
+
+	if (!device || !action)
+		return;
+
+
+	if (!g_udev_device_get_device_file(device))
+		return;
+
+	/** Check if the uevent device file matches the port of this configuration */
+	if (g_strcmp0 (g_udev_device_get_device_file(device), priv->port_conf->port) == 0)
+		gtkterm_serial_port_handle (self, action);
+}
+
+extern void gtkterm_serial_port_device_monitor (GtkTermSerialPort *self) {
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);	
+	const char *const subsystems[] = {NULL, NULL};
+
+	/** Create the udev client */
+	priv->udev_client = g_udev_client_new(subsystems);
+
+	/** Get the initial status of the device */
+	if (g_udev_client_query_by_device_file(priv->udev_client, priv->port_conf->port) == NULL) {
+		gtkterm_serial_port_set (self, GTKTERM_SERIAL_PORT_CLOSE);
+	} else {
+		gtkterm_serial_port_set (self, GTKTERM_SERIAL_PORT_OPEN);
+	}
+
+	/** 
+	 * Monitor udev devices
+	 * We add self as parameter so we can access the port configuration if needed.
+	 */
+	g_signal_connect(G_OBJECT(priv->udev_client), "uevent", G_CALLBACK(gtkterm_serial_port_event_udev), self);
+}
+
+static bool gtkterm_serial_port_config (GtkTermSerialPort *self,
+                                    struct termios *termios_p,
+                                    GError **error) {
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+
+    switch (priv->port_conf->baudrate) {
+		case 300:
+			termios_p->c_cflag = B300;
+			break;
+		case 600:
+			termios_p->c_cflag = B600;
+			break;
+		case 1200:
+			termios_p->c_cflag = B1200;
+			break;
+		case 2400:
+			termios_p->c_cflag = B2400;
+			break;
+		case 4800:
+			termios_p->c_cflag = B4800;
+			break;
+		case 9600:
+			termios_p->c_cflag = B9600;
+			break;
+		case 19200:
+			termios_p->c_cflag = B19200;
+			break;
+		case 38400:
+			termios_p->c_cflag = B38400;
+			break;
+		case 57600:
+			termios_p->c_cflag = B57600;
+			break;
+		case 115200:
+			termios_p->c_cflag = B115200;
+			break;
+
+		default:
+#ifdef HAVE_LINUX_SERIAL_H
+			gtkterm_serial_port_set_custom_speed (priv->port_fd, priv->port_conf->baudrate);
+			termios_p->c_cflag |= B38400;
+#else
+			g_propagate_error (
+				error,
+				g_error_new_literal (G_IO_ERROR,
+									G_IO_ERROR_FAILED,
+									_ ("Arbitrary baud rates not supported")));
+			return FALSE;
+#endif
+    }
+
+    switch (priv->port_conf->bits) {
+		case 5:
+			termios_p->c_cflag |= CS5;
+			break;
+		case 6:
+			termios_p->c_cflag |= CS6;
+			break;
+		case 7:
+			termios_p->c_cflag |= CS7;
+			break;
+		case 8:
+			termios_p->c_cflag |= CS8;
+			break;
+		default:
+			g_assert_not_reached ();
+    }
+
+    switch (priv->port_conf->parity) {
+		case GTKTERM_SERIAL_PORT_PARITY_NONE:
+			// Nothing to set
+			break;			
+		case GTKTERM_SERIAL_PORT_PARITY_ODD:
+			termios_p->c_cflag |= PARODD | PARENB;
+			break;			
+		case GTKTERM_SERIAL_PORT_PARITY_EVEN:
+			termios_p->c_cflag |= PARENB;
+			break;
+		default:
+			break;
+    }
+
+    if (priv->port_conf->stopbits == 2)
+        termios_p->c_cflag |= CSTOPB;
+
+	/** set control / enable receiver */
+    termios_p->c_cflag |= CREAD;
+	/** ignore break and framing errors */
+    termios_p->c_iflag = IGNPAR | IGNBRK;
+
+    switch (priv->port_conf->flow_control) {
+		case GTKTERM_SERIAL_PORT_FLOWCONTROL_XON_XOFF:
+			termios_p->c_iflag |= IXON | IXOFF;
+			break;
+		case GTKTERM_SERIAL_PORT_FLOWCONTROL_RTS_CTS:
+			termios_p->c_cflag |= CRTSCTS;
+			break;
+		case GTKTERM_SERIAL_PORT_FLOWCONTROL_RS485_HD:
+		default:
+			termios_p->c_cflag |= CLOCAL;
+			break;
+    }
+
+	/** clear output and local mode */
+    termios_p->c_oflag = 0;
+    termios_p->c_lflag = 0;
+
+    termios_p->c_cc[VTIME] = 0;	 /**< Timeout in deciseconds for noncanonical read 	*/
+    termios_p->c_cc[VMIN] = 1;	 /**< Minimal characters for noncanonical read 		*/
+
+    return TRUE;
+}
+
+/**
+ * @brief Connects to the serial port.
+ *
+ * The settings for this port will be set. If needed port will be locked.
+ *
+ * @param self The configuration class.
+ *
+ * @return The result of the operation.
+ */
+static int gtkterm_serial_port_open (GtkTermSerialPort *self) {
+	GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private(self);	
+    struct termios termios_p;
+    GError *error = NULL;
+
+	/** Handle to cancel async read operaton */
+    priv->cancellable = g_cancellable_new ();
+
+    priv->port_fd = open (priv->port_conf->port, O_RDWR | O_NOCTTY | O_NDELAY);
+    if (priv->port_fd == -1) {
+        error = g_error_new (G_IO_ERROR,
+                             g_io_error_from_errno (errno),
+                             _ ("Cannot open %s: %s"),
+                             priv->port_conf->port,
+                             g_strerror (errno));
+
+        gtkterm_serial_port_set_status (self, GTKTERM_SERIAL_PORT_ERROR, error);
+        return false;
+    }
+
+	/** Lock the port */
+    if (gtkterm_serial_port_lock (self, &error)) {
+        gtkterm_serial_port_close (self);
+        gtkterm_serial_port_set_status (self, GTKTERM_SERIAL_PORT_ERROR, error);
+
+        return false;
+    }
+
+	/** get termios for the file descriptor */
+    tcgetattr (priv->port_fd, &termios_p);
+	/** And back it up */
+    memcpy (&(priv->port_termios), &termios_p, sizeof (struct termios));
+
+    if (!gtkterm_serial_port_config (self, &termios_p, &error)) {
+		gtkterm_serial_port_close (self);
+        gtkterm_serial_port_set_status (self, GTKTERM_SERIAL_PORT_ERROR, error);
+		
+		return false;
+    }
+
+	/** Set the created termios to the file descriptor */
+    tcsetattr (priv->port_fd, TCSANOW, &termios_p);
+
+	/** Flush the in- output data which is not written/read */
+    tcflush (priv->port_fd, TCIOFLUSH);
+
+	/** Set the streams for communicating with the device */
+    priv->input_stream = g_unix_input_stream_new (priv->port_fd, FALSE);
+    priv->output_stream = g_unix_output_stream_new (priv->port_fd, FALSE);
+
+    g_input_stream_read_bytes_async (priv->input_stream,
+                                     GTKTERM_SERIAL_PORT_RECEIVE_BUFFER_SIZE,
+                                     G_PRIORITY_DEFAULT,
+                                     priv->cancellable,
+                                     gtkterm_serial_port_serial_data_received,
+                                     self);
+
+    priv->control_signal_timeout =
+        g_timeout_add (GTKTERM_SERIAL_PORT_CONTROL_POLL_DELAY,
+                       gtkterm_serial_port_control_signals_read,
+                       self);
+
+    gtkterm_serial_port_set_status (self, GTKTERM_SERIAL_PORT_CONNECTED, NULL);
+
+    return true;
+}
+
+/**
+ * @brief Closes the serial port.
+ * 
+ * It check is there is an open port and if yes it closes the port.
+ * Port will also be unlocked (if locked).
+ * 
+ * @param self The Serial Port structure.
+ * 
+ * @return int Result of the operation
+ */
+static int gtkterm_serial_port_close (GtkTermSerialPort *self) {
+	GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private(self);	
+	
+	if(priv->port_fd != -1) {
+
+		/** Set the saved termios back to the port */
+		tcsetattr(priv->port_fd , TCSANOW, &priv->port_termios);
+
+		/** Flush input and output data */
+		tcflush(priv->port_fd , TCOFLUSH);
+		tcflush(priv->port_fd, TCIFLUSH);
+
+        if (priv->cancellable != NULL) {
+            g_cancellable_cancel (priv->cancellable);
+            g_clear_object (&priv->cancellable);
+        }
+
+		/** Unlock the port */
+		gtkterm_serial_port_unlock (self);
+
+		/** Close streams and port **/
+        g_output_stream_close (priv->output_stream, NULL, NULL);
+        g_input_stream_close (priv->input_stream, NULL, NULL);
+		close(priv->port_fd);
+		priv->port_fd = -1;
+
+		if (priv->control_signal_timeout != 0) {
+			g_source_remove (priv->control_signal_timeout);
+			priv->control_signal_timeout = 0;
+		}		
+	}
+
+    gtkterm_serial_port_set_status (self, GTKTERM_SERIAL_PORT_DISCONNECTED, NULL);
+
+	return true;
+}
+
+/**
+ * @brief Convert port config to a string.
+ * 
+ * This is used for setting the configuration in the statusbar and window title.
+ * 
+ * @param self The SerialPort structure
+ * 
+ * @return The port configuration as string.
+ */
+char* gtkterm_serial_port_get_string (GtkTermSerialPort *self)
+{
+	char* msg;
+	char parity;
+	GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private(self);	
+
+	if(priv->port_fd == -1)	{
+		msg = g_strdup(_("No open port"));
+	} else {
+		// 0: none, 1: odd, 2: even
+		switch(priv->port_conf->parity)
+		{
+			case GTKTERM_SERIAL_PORT_PARITY_NONE:
+				parity = 'N';
+				break;
+			case GTKTERM_SERIAL_PORT_PARITY_ODD:
+				parity = 'O';
+				break;
+			case GTKTERM_SERIAL_PORT_PARITY_EVEN:
+				parity = 'E';
+				break;
+			default:
+				parity = 'N';
+		}
+
+		/* "GtkTerm: device  baud-bits-parity-stopbits"  */
+		msg = g_strdup_printf("%.15s  %ld-%d-%c-%d",
+		                      priv->port_conf->port,
+		                      priv->port_conf->baudrate,
+		                      priv->port_conf->bits,
+		                      parity,
+		                      priv->port_conf->stopbits
+		                     );
+	}
+
+	return msg;
+}
+
+/**
+ * @brief  Connect callback functions to signals.
+ *
+ * The callback functions performs the operation on the keyfile or configuration.
+ *
+ * @param object The configuration class object.
+ *
+ */
+static void gtkterm_serial_port_class_constructed(GObject *object) {
+	GtkTermSerialPort *self = GTKTERM_SERIAL_PORT(object);
+
+    gtkterm_signals[SIGNAL_GTKTERM_SERIAL_DATA_RECEIVED] = g_signal_new ("serial-data-received",
+                                                   GTKTERM_TYPE_SERIAL_PORT,
+                                                   G_SIGNAL_RUN_FIRST,
+                                                   0,
+                                                   NULL,
+                                                   NULL,
+                                                   NULL,
+                                                   G_TYPE_NONE,
+                                                   1,
+                                                   G_TYPE_BYTES,
+                                                   0);
+
+	gtkterm_serial_port_device_monitor (self);
+
+    g_signal_connect (self, "serial-data-transmit", G_CALLBACK(gtkterm_serial_port_serial_data_transmit), self);    
+
+	/** Install the user signals */
+	g_unix_signal_add(SIGUSR1, (GSourceFunc) gtkterm_serial_port_handle_usr1, self);
+	g_unix_signal_add(SIGUSR2, (GSourceFunc) gtkterm_serial_port_handle_usr2, self);	
+}
+
+/**
+ * @brief get the property of the GtkTermSerialPort structure
+ * 
+ * This is used to update the properties. For now it is uses
+ * to update the notify.
+ * 
+ * @param object The object.
+ * 
+ * @param prop_id The id of the property to get.
+ * 
+ * @param value The value for the property
+ * 
+ * @param pspec Metadata for property setting.
+ * 
+ */
+static void gtkterm_serial_port_get_property (GObject *object,
+                             unsigned int prop_id,
+                             GValue *value,
+                             GParamSpec *pspec)
+{
+    GtkTermSerialPort *self = GTKTERM_SERIAL_PORT(object);
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+
+    switch (prop_id) {
+    	case PROP_PORT_STATUS:
+        	g_value_set_int (value, priv->port_status);
+        	break;
+
+    	case PROP_PORT_SIGNALS:
+        	g_value_set_int (value, priv->control_signals);
+        	break;		
+
+
+    	default:
+        	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+/**
+ * @brief Set the property of the GtkTermSerialPort structure
+ * 
+ * This is used to initialize the variables when creating a new serial_port
+ * 
+ * @param object The object.
+ * 
+ * @param prop_id The id of the property to set.
+ * 
+ * @param value The value for the property
+ * 
+ * @param pspec Metadata for property setting.
+ * 
+ */
+static void gtkterm_serial_port_set_property (GObject *object,
+                             unsigned int prop_id,
+                             const GValue *value,
+                             GParamSpec *pspec)
+{
+    GtkTermSerialPort *self = GTKTERM_SERIAL_PORT(object);
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+
+    switch (prop_id) {
+    	case PROP_PORT_CONFIG:
+        	priv->port_conf = g_value_get_pointer(value);
+        	break;		
+
+    	default:
+        	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+/**
+ * @brief Remote all pointers when removing the object.
+ * 
+ * @param object The pointer to the serial port object.
+ */
+static void gtkterm_serial_port_finalize (GObject *object) {
+    GtkTermSerialPort *self = GTKTERM_SERIAL_PORT(object);
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+
+	/** Close port, clear error */
+	gtkterm_serial_port_close (self);	
+    g_clear_error (&priv->port_error);
+
+    GObjectClass *object_class = G_OBJECT_CLASS (gtkterm_serial_port_parent_class);
+    object_class->finalize (object);
+}
+
+/**
+ * @brief Initializing the serial_port class
+ * 
+ * Setting the properties and callback functions
+ * 
+ * @param class The serial_portclass
+ * 
+ */
+static void gtkterm_serial_port_class_init (GtkTermSerialPortClass *class) {
+
+  	GObjectClass *object_class = G_OBJECT_CLASS (class);
+    object_class->set_property = gtkterm_serial_port_set_property;
+    object_class->get_property = gtkterm_serial_port_get_property;	
+	object_class->constructed = gtkterm_serial_port_class_constructed;
+	object_class->finalize = gtkterm_serial_port_finalize;	
+
+	/**
+	 *  Parameters to hand over at creation of the object
+	 */
+  	gtkterm_serial_port_properties[PROP_PORT_CONFIG] = g_param_spec_pointer (
+        "port_conf",
+        "port_conf",
+        "port_conf",
+        G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
+
+  	gtkterm_serial_port_properties[PROP_PORT_STATUS] = g_param_spec_int (
+        "port-status",
+        "port-status",
+        "port-status",
+		0,
+		G_MAXINT,
+		0,
+        G_PARAM_READABLE| G_PARAM_STATIC_STRINGS);
+
+  	gtkterm_serial_port_properties[PROP_PORT_SIGNALS] = g_param_spec_int (
+        "port-signals",
+        "port-signals",
+        "port-signals",
+		0,
+		G_MAXINT,
+		0,
+        G_PARAM_READABLE| G_PARAM_STATIC_STRINGS);    				
+
+    g_object_class_install_properties (object_class, N_PROPS, gtkterm_serial_port_properties);
+}
+
+/**
+ * @brief Initialize the serial with the config parameters
+ * 
+ * @param self The port we are initializing.
+ * 
+ */
+static void gtkterm_serial_port_init (GtkTermSerialPort *self) {
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+
+	/** Not yet connected */
+	priv->port_fd = -1;
+	priv->control_signals = 0;
+}
+
+/**
+ * @brief Unlocks the serial port
+ * 
+ * @param self The serial port
+ * 
+ * @return int The result of the lock operation.
+ */
+int gtkterm_serial_port_unlock (GtkTermSerialPort *self) {
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+	int rc = 0;
+
+	if (!priv->port_conf->disable_port_lock)
+		rc = flock(priv->port_fd, LOCK_UN);
+
+	return rc;
+}
+
+/**
+ * @brief Locks the serial port
+ * 
+ * @param self The serial port
+ * 
+ * @param error The error occured when locking the port
+ * 
+ * @return int The result of the lock operation.
+ */
+int gtkterm_serial_port_lock (GtkTermSerialPort *self, GError **error) {
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+	int rc = 0;
+
+	if (!priv->port_conf->disable_port_lock) {
+		rc = flock(priv->port_fd, LOCK_EX | LOCK_NB);
+
+		if (rc) {
+			gtkterm_serial_port_close (self);
+
+			g_propagate_error (error, 
+								g_error_new (G_IO_ERROR, g_io_error_from_errno (errno),
+								_("Can't get lock on port %s: %s"), priv->port_conf->port, g_strerror (errno))
+								);
+		}
+	}
+
+	return rc;	
+}
+
+/**
+ * @brief Set the status of the serial port
+ * 
+ * @param self The serial port
+ * 
+ * @param new_status The new status of the serial port.
+ * 
+ * @param error The port error to set.
+ */
+void gtkterm_serial_port_set_status (GtkTermSerialPort *self, GtkTermSerialPortState new_status, GError *error) {
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+
+	priv->port_status = new_status;
+
+	/** If there is a previous error, clear it */
+	if (priv->port_error != NULL)
+		g_error_free (priv->port_error);
+	
+	priv->port_error = error;
+
+	/** Notify that we have a change on the port */
+	g_object_notify(G_OBJECT(self), "port-status");		
+}
+
+/**
+ * @brief Return the status of the serial port
+ * 
+ * @param self The serial port
+ * 
+ * @return GtkTermSerialPortState The status of the serial port.
+ */
+GtkTermSerialPortState gtkterm_serial_port_get_status (GtkTermSerialPort *self) {
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+
+	return (priv->port_status);
+}
+
+/**
+ * @brief Return the last error which occured.
+ * 
+ * @param self The serial port
+ * 
+ * @return GERrror The pointer to the GError struct
+ */
+GError *gtkterm_serial_port_get_error (GtkTermSerialPort *self) {
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+
+	return (priv->port_error);
+}
+
+/**
+ * @brief Callback for signal where data is transmitted to the output stream of the port
+ * 
+ * If necessary the RS485 signal are set.
+ * 
+ * @param object Not used
+ * 
+ * @param data The string with data to send.
+ * 
+ * @param length The length of the string.
+ * 
+ * @param user_data The serial port struct.
+ * 
+ * @return int The bytes writen to the outputstream
+ */
+static int gtkterm_serial_port_serial_data_transmit (GObject *object, gpointer data, unsigned int length, gpointer user_data) {
+    GtkTermSerialPort *self = GTKTERM_SERIAL_PORT (user_data);
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+    GError *error = NULL;
+    int chars_transmitted = 0;
+
+    /** Check if we have a string > 0 and an active open port */
+    if (length && (priv->port_fd != -1)) {
+
+		/** Are we in RS485 half-duplex mode */
+		if (priv->port_conf->flow_control == GTKTERM_SERIAL_PORT_FLOWCONTROL_RS485_HD) {
+			/* set RTS (start to send) */
+	        gtkterm_serial_port_set_signals (self, 1);
+
+	        if (priv->port_conf->rs485_rts_time_before_transmit > 0)
+	             usleep (priv->port_conf->rs485_rts_time_before_transmit * 1000);
+		}
+
+		chars_transmitted = g_output_stream_write (priv->output_stream, data, length, priv->cancellable, &error);
+
+		if (error != NULL) {
+			if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+				gtkterm_serial_port_close (self);
+	          	gtkterm_serial_port_set_status (self, GTKTERM_SERIAL_PORT_ERROR, error);
+			} else {
+				g_clear_error (&error);
+			}
+
+			return -1;
+		}
+
+		/* RS485 half-duplex mode ? */
+		if (priv->port_conf->flow_control == GTKTERM_SERIAL_PORT_FLOWCONTROL_RS485_HD) {
+			/** Wait till all chars are send */
+			tcdrain (priv->port_fd);
+	
+	        if (priv->port_conf->rs485_rts_time_after_transmit > 0)
+	            usleep (priv->port_conf->rs485_rts_time_after_transmit * 1000);
+
+			/** Reset RTS (end of send, now receiving back) */
+	        gtkterm_serial_port_set_signals (self, 1);
+		}
+	}
+
+	return chars_transmitted;
+}
+
+/**
+ * @brief Callback where data is received from the input stream.
+ * 
+ * Because of the async operation the listener has to restart at the end of this
+ * callback. It isn't a continious loop.
+ * 
+ * @param source The inputstream
+ * 
+ * @param res The result of the async function
+ * 
+ * @param user_data The serial port struct.
+ */
+static void gtkterm_serial_port_serial_data_received (GObject *source, GAsyncResult *res, gpointer user_data) {
+    GtkTermSerialPort *self = GTKTERM_SERIAL_PORT (user_data);
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+    GError *error = NULL;
+
+	/** Read bytes from the inputstream */
+    GBytes *data = g_input_stream_read_bytes_finish (G_INPUT_STREAM (source), res, &error);
+
+    if (error != NULL) {
+        if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+			/** \todo send to terminal window and show in infobar */
+            gtkterm_serial_port_close (self);
+            gtkterm_serial_port_set_status (self, GTKTERM_SERIAL_PORT_DISCONNECTED, NULL);
+        } else {
+            g_clear_error (&error);
+        }
+
+        return;
+    }
+
+	/** Send signal to buffer when new data is arrived */
+    g_signal_emit (self, gtkterm_signals[SIGNAL_GTKTERM_SERIAL_DATA_RECEIVED], 0, data);
+
+	/** Restart listener */
+    g_input_stream_read_bytes_async (priv->input_stream,
+                                     GTKTERM_SERIAL_PORT_RECEIVE_BUFFER_SIZE,
+                                     G_PRIORITY_DEFAULT,
+                                     priv->cancellable,
+                                     gtkterm_serial_port_serial_data_received,
+                                     self);
+}
+
+/**
+ * @brief Handles USR1 signal. It opens the port.
+ * 
+ * @param user_data The serial port structure. Last param when installing the signal
+ * 
+ * @return Continue the signal operation.
+ */
+static bool gtkterm_serial_port_handle_usr1(gpointer user_data) {
+	GtkTermSerialPort *self = GTKTERM_SERIAL_PORT(user_data);
+
+	gtkterm_serial_port_open (self);
+
+	return G_SOURCE_CONTINUE;
+}
+
+/**
+ * @brief Handles USR2 signal. It closes the port.
+ * 
+ * @param user_data The serial port structure. Last param when installing the signal
+ * 
+ * @return Continue the signal operation.
+ */
+static bool gtkterm_serial_port_handle_usr2(gpointer user_data) {
+	GtkTermSerialPort *self = GTKTERM_SERIAL_PORT(user_data);
+
+	gtkterm_serial_port_close (self);
+
+	return G_SOURCE_CONTINUE;
+}
+
+/**
+ * @brief Set the signals for the Serial Port structure.
+ * 
+ * @param self The serial port structure.
+ * 
+ * @param param The signals for the serial port.
+ */
+void gtkterm_serial_port_set_signals (GtkTermSerialPort *self, unsigned int param) {
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+    int stat_;
+
+    if (priv->port_fd == -1)
+        return;
+
+	/** Get the terminal status */
+    if (ioctl (priv->port_fd, TIOCMGET, &stat_) == -1) {
+		GError *error = NULL;
+
+		gtkterm_serial_port_close (self);
+		error = g_error_new (G_IO_ERROR,
+								g_io_error_from_errno (errno),
+								_ ("Control signals read: %s"),
+								g_strerror (errno));
+
+		gtkterm_serial_port_set_status (self, GTKTERM_SERIAL_PORT_ERROR, error);
+
+        return;
+    }
+
+    /** Set the DTR signal */
+    if (param == 0) {
+        if (stat_ & TIOCM_DTR)
+            stat_ &= ~TIOCM_DTR;
+        else
+            stat_ |= TIOCM_DTR;
+
+		/** Failure during setting the signal */
+        if (ioctl (priv->port_fd, TIOCMSET, &stat_) == -1) {
+			GError *error = NULL;
+
+			gtkterm_serial_port_close (self);
+			error = g_error_new (G_IO_ERROR,
+									g_io_error_from_errno (errno),
+									_ ("DTR write failed: %s"),
+									g_strerror (errno));
+
+			gtkterm_serial_port_set_status (self, GTKTERM_SERIAL_PORT_ERROR, error);
+        }
+    }
+    /** Set the RTS signal */
+    else if (param == 1) {
+        if (stat_ & TIOCM_RTS)
+            stat_ &= ~TIOCM_RTS;
+        else
+            stat_ |= TIOCM_RTS;
+			
+        if (ioctl (priv->port_fd, TIOCMSET, &stat_) == -1) {
+   			GError *error = NULL;
+
+			gtkterm_serial_port_close (self);
+			error = g_error_new (G_IO_ERROR,
+									g_io_error_from_errno (errno),
+									_ ("RTS write failed: %s"),
+									g_strerror (errno));
+
+			gtkterm_serial_port_set_status (self, GTKTERM_SERIAL_PORT_ERROR, error);		
+		}
+    }
+}
+
+/**
+ * @brief Get the signals from the Serial Port structure.
+ * 
+ * This is also used for external reading.
+ * 
+ * @param self The serial port to read the signals for.
+ *
+ * @return unsigned int The latest serial port signals
+ */
+unsigned int gtkterm_serial_port_get_signals (GtkTermSerialPort *self) {
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+
+    return priv->control_signals;
+}
+
+/**
+ * @brief Does the actual reading of the serial signals
+ * 
+ * @param self The serial port to read the signals for.
+ *
+ * @return int The terminal status bits.
+ */
+static int gtkterm_serial_port_read_signals (GtkTermSerialPort *self) {
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+    int stat_read;
+
+    if (priv->port_conf->flow_control == GTKTERM_SERIAL_PORT_FLOWCONTROL_RS485_HD) {
+        /** reset RTS (default = receive) */
+        gtkterm_serial_port_set_signals (self, 1);
+    }
+
+	/**
+	 * Check if we have af valid file desciptor and
+	 * if the file destriptor points to a terminal device (tty*)
+	 */
+    if (priv->port_fd != -1 && isatty(priv->port_fd)) {
+		/** Get the terminal statusbits */
+        if (ioctl (priv->port_fd, TIOCMGET, &stat_read) == -1) {
+            /** 
+			 * Ignore EINVAL, as some serial ports genuinely lack these lines
+             * Thanks to Elie De Brauwer on ubuntu launchpad
+			 */
+
+            /** 
+			 * Apparently recently trying this on Linux PTYs fails with ENOTTY
+             * instead, so exempt this as well
+			 */
+            if (errno != EINVAL && errno != ENOTTY) {
+                GError *error = NULL;
+
+                gtkterm_serial_port_close (self);
+                error = g_error_new (G_IO_ERROR,
+                                     g_io_error_from_errno (errno),
+                                     _ ("Control signals read failed: %s"),
+                                     g_strerror (errno));
+
+                gtkterm_serial_port_set_status (self, GTKTERM_SERIAL_PORT_ERROR, error);
+            }
+
+            return -1;
+        }
+
+        return stat_read;
+    }
+
+    return -1;
+}
+
+/**
+ * @brief Reads the serial port signals (DTR, etc)
+ * 
+ * @param data The serial port to read the signals for.
+ *
+ * 
+ * @return int The result of readings.
+ */
+static int gtkterm_serial_port_control_signals_read (gpointer data) {
+    GtkTermSerialPort *self = GTKTERM_SERIAL_PORT (data);
+    GtkTermSerialPortPrivate *priv = gtkterm_serial_port_get_instance_private (self);
+    int control_signals = 0;
+
+    control_signals = gtkterm_serial_port_read_signals (self);
+    if (control_signals < 0) {
+        priv->control_signals = 0;
+
+        return 0;
+    }
+
+	/** 
+	 * If the signals are changed then notify the terminal so the statusbar
+	 * can be updated
+	 */
+    if (control_signals != priv->control_signals) {
+        priv->control_signals = control_signals;
+
+        g_object_notify (G_OBJECT (self), "port-signals");
+    }
+
+    return 1;
+}
+
+#ifdef HAVE_LINUX_SERIAL_H
+/**
+ * @brief Set the custom baudrate for a port
+ * 
+ * This can only be done on Linux systems.
+ * 
+ * @param port_fd File descriptor of the serial port.
+ * 
+ * @param baudrate The baudrate we try so set
+ * 
+ * @return int The result of the change.
+ */
+int gtkterm_serial_port_set_custom_speed(int port_fd, int baudrate) {
+	struct serial_struct serial_conf;
+
+	ioctl(port_fd, TIOCGSERIAL, &serial_conf);
+	serial_conf.custom_divisor = serial_conf.baud_base / baudrate;
+	if(!(serial_conf.custom_divisor))
+		serial_conf.custom_divisor = 1;
+
+	serial_conf.flags &= ~ASYNC_SPD_MASK;
+	serial_conf.flags |= ASYNC_SPD_CUST;
+
+	ioctl(port_fd, TIOCSSERIAL, &serial_conf);
+
+	return 0;
+}
+#endif
diff --git a/src/gtkterm_serial_port.h b/src/gtkterm_serial_port.h
new file mode 100644
index 0000000..6f78b41
--- /dev/null
+++ b/src/gtkterm_serial_port.h
@@ -0,0 +1,82 @@
+/***********************************************************************/
+/* gtkterm_serial_port.h                                                    */
+/* -------                                                             */
+/*           GTKTerm Software                                          */
+/*                      (c) Julien Schmitt                             */
+/*                                                                     */
+/* ------------------------------------------------------------------- */
+/*                                                                     */
+/*   Purpose                                                           */
+/*      Serial port access functions                                   */
+/*      - Header file -                                                */
+/*                                                                     */
+/***********************************************************************/
+
+#ifndef GTKTERM_SERIAL_H_
+#define GTKTERM_SERIAL_H_
+
+typedef enum {
+	GTKTERM_SERIAL_PORT_OPEN,
+	GTKTERM_SERIAL_PORT_CLOSE
+	
+} GtkTermSerialPortStatus;
+
+typedef enum {
+	GTKTERM_SERIAL_PORT_PARITY_NONE,	
+	GTKTERM_SERIAL_PORT_PARITY_EVEN,
+	GTKTERM_SERIAL_PORT_PARITY_ODD
+
+} GtkTermSerialPortParity;
+
+typedef enum {
+	GTKTERM_SERIAL_PORT_FLOWCONTROL_NONE,	
+	GTKTERM_SERIAL_PORT_FLOWCONTROL_XON_XOFF,
+	GTKTERM_SERIAL_PORT_FLOWCONTROL_RTS_CTS,
+	GTKTERM_SERIAL_PORT_FLOWCONTROL_RS485_HD,	
+
+} GtkTermSerialPortFlowControl;
+
+typedef enum {
+    GTKTERM_SERIAL_PORT_CONNECTED,
+    GTKTERM_SERIAL_PORT_DISCONNECTED,
+    GTKTERM_SERIAL_PORT_ERROR
+
+} GtkTermSerialPortState;
+
+/**
+ * @brief The typedef for the serial configuration.
+ *
+ */
+typedef struct {
+
+	char *port;
+	long int baudrate;              			/**< 300 - 600 - 1200 - ... - 2000000 								*/
+	int bits;                   				/**< 5 - 6 - 7 - 8													*/
+	int stopbits;                   			/**< 1 - 2															*/
+	GtkTermSerialPortParity parity;     		/**< 0 : None, 1 : Odd, 2 : Even									*/
+	GtkTermSerialPortFlowControl flow_control;  /**< 0 : None, 1 : Xon/Xoff, 2 : RTS/CTS, 3 : RS485halfduplex		*/
+	int rs485_rts_time_before_transmit; 		/**< Waiting time between RTS onand start to transmit				*/
+	int rs485_rts_time_after_transmit;			/**< Waiting time between end of transmit and RTS on				*/
+	bool disable_port_lock;						/**< Lock the serial port to one terminal (can cause garbage if no)	*/
+
+} port_config_t;
+
+G_BEGIN_DECLS
+
+#define GTKTERM_TYPE_SERIAL_PORT gtkterm_serial_port_get_type ()
+G_DECLARE_FINAL_TYPE (GtkTermSerialPort, gtkterm_serial_port, GTKTERM, SERIAL_PORT, GObject)
+typedef struct _GtkTermSerialPort GtkTermSerialPort;
+
+GtkTermSerialPort *gtkterm_serial_port_new (port_config_t *);
+
+/** Global functions */
+char* gtkterm_serial_port_get_string (GtkTermSerialPort *);
+GtkTermSerialPortState gtkterm_serial_port_get_status (GtkTermSerialPort *);
+unsigned int gtkterm_serial_port_get_signals (GtkTermSerialPort *);
+GError *gtkterm_serial_port_get_error (GtkTermSerialPort *);
+
+extern const char GtkTermSerialPortStateString [][DEFAULT_STRING_LEN];
+
+G_END_DECLS
+
+#endif // GTKTERM_SERIAL_H
diff --git a/src/gtkterm_terminal.c b/src/gtkterm_terminal.c
new file mode 100644
index 0000000..50c902a
--- /dev/null
+++ b/src/gtkterm_terminal.c
@@ -0,0 +1,461 @@
+/***********************************************************************/
+/* terminal.c                                                          */
+/* --------                                                            */
+/*           GTKTerm Software                                          */
+/*                      (c) Julien Schmitt                             */
+/*                                                                     */
+/* ------------------------------------------------------------------- */
+/*                                                                     */
+/*   Purpose                                                           */
+/*      Handles all VTE in/output to/from serial port                  */
+/*                                                                     */
+/*   ChangeLog                                                         */
+/***********************************************************************/
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <sys/stat.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gprintf.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <gio/gio.h>
+#include <pango/pango-font.h>
+
+#include "gtkterm_defaults.h"
+#include "gtkterm_window.h"
+#include "gtkterm_serial_port.h"
+#include "gtkterm_terminal.h"
+#include "gtkterm_buffer.h"
+#include "macros.h"
+#include "gtkterm_configuration.h"
+
+typedef enum  {
+    GTKTERM_TERMINAL_VIEW_TEXT,
+    GGTKTERM_TERMINAL_VIEW_HEX
+
+} GtkTermTerminalView;
+
+typedef struct  {
+    GtkTermBuffer *term_buffer;     /**< Terminal buffer for serial port and terminal                       */
+    GtkTermSerialPort *serial_port; /**< The active serial port for this terminal                           */
+    term_config_t *term_conf;       /**< The configuration loaded from the keyfile                          */
+    port_config_t *port_conf;       /**< Port configuration used in this terminal                           */
+    macro_t       *macros;          /**< \todo convert macros -> object                                     */
+    GtkTermTerminalView view_mode;
+ 
+    char *section;           		/**< Section used in this terminal for configuration from config file   */
+	GtkTerm *app;                   /**< Pointer to the app for getting [section] and keyfile               */
+    GtkTermWindow *main_window;     /**< Pointer to the main window for updating the statusbar on changes   */
+
+} GtkTermTerminalPrivate;
+
+struct _GtkTermTerminal {
+
+    VteTerminal vte_object;         /**< The actual terminal object                                         */
+};
+
+struct _GtkTermTerminalClass {
+
+    VteTerminalClass vte_class; 
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE  (GtkTermTerminal, gtkterm_terminal, VTE_TYPE_TERMINAL)
+
+enum { 
+	PROP_0, 
+	PROP_SECTION,
+	PROP_GTKTERM_APP,
+    PROP_MAIN_WINDOW,
+	N_PROPS 
+};
+
+static GParamSpec *gtkterm_terminal_properties[N_PROPS] = {NULL};
+
+
+void gtkterm_terminal_view_ascii (GtkTermTerminal *, char *, uint);
+void gtkterm_terminal_view_hex (GtkTermTerminal *, char *, uint);
+
+/**
+ * @brief Create a new terminal object.
+ * 
+ * This also binds the parameter to the properties of the terminal.
+ * 
+ * @param section The section for the configuration in this terminal
+ * 
+ * @param gtkterm_app The GTKTerm application
+ * 
+ * @param main_window The main_window this terminal is attached to.
+ * 
+ * @return The terminal object.
+ * 
+ */
+GtkTermTerminal *gtkterm_terminal_new (char *section, GtkTerm *gtkterm_app, GtkTermWindow *main_window) {
+
+    return g_object_new (GTKTERM_TYPE_TERMINAL, "section", section, "app", gtkterm_app, "main_window", main_window, NULL);
+}
+
+/**
+ * @brief Callback when new data from the VTE widget is received.
+ * 
+ * If echo is enabled the string is also send to the buffer. Which will update
+ * the terminal by sending the new data signal.
+ * 
+ * @param widget The VTE widget.
+ * 
+ * @param text The text which is entered
+ * 
+ * @param length The length of the text
+ * 
+ * @param ptr Not used.
+ * 
+ */
+static void gtkterm_terminal_vte_data_received (VteTerminal *widget, char *text, unsigned int length, gpointer ptr) {
+    GtkTermTerminal *self = GTKTERM_TERMINAL(ptr);
+    GtkTermTerminalPrivate *priv = gtkterm_terminal_get_instance_private (self);
+    int chars_transmitted = 0; 
+
+    g_signal_emit(priv->serial_port, gtkterm_signals[SIGNAL_GTKTERM_SERIAL_DATA_TRANSMIT], 0, text, length, &chars_transmitted);
+
+    /** On echo send data to the buffer which will update the terminal */
+    if (chars_transmitted > 0 && priv->term_conf->echo) {
+        /** Convert to GBytes, needed for the buffer */
+        GBytes *data = g_bytes_new (text, chars_transmitted);
+	    
+        /** Send signal to buffer when new data is arrived */
+        g_signal_emit (self, gtkterm_signals[SIGNAL_GTKTERM_VTE_DATA_RECEIVED], 0, data);
+    }
+}
+
+/**
+ * @brief When signalsof the serial port is changed we get a signal and have to update GtkTermWindow.
+ * 
+ * @param object The serial port.
+ * 
+ * @param pspec Not used.
+ * 
+ * @param user_data The active terminal.
+ * 
+ */
+static void gtkterm_terminal_port_signals_changed (GObject *object, GParamSpec *pspec, gpointer user_data) {
+    GtkTermTerminal *self = GTKTERM_TERMINAL(user_data);
+    GtkTermTerminalPrivate *priv = gtkterm_terminal_get_instance_private (self);
+
+    g_signal_emit (priv->main_window, gtkterm_signals[SIGNAL_GTKTERM_SERIAL_SIGNALS_CHANGED], 0, 
+                   gtkterm_serial_port_get_signals (GTKTERM_SERIAL_PORT (object)));  
+}
+
+/**
+ * @brief When the status of the serial port is changed we get a signal and have to update GtkTermWindow.
+ * 
+ * @param object The serial port.
+ * 
+ * @param pspec Not used.
+ * 
+ * @param user_data The active terminal.
+ * 
+ */
+static void gtkterm_terminal_port_status_changed (GObject *object, GParamSpec *pspec, gpointer user_data) {
+    char *serial_string;
+    GError *error;
+    GtkTermTerminal *self = GTKTERM_TERMINAL(user_data);
+    GtkTermTerminalPrivate *priv = gtkterm_terminal_get_instance_private (self);
+    GtkTermSerialPortState status = gtkterm_serial_port_get_status (GTKTERM_SERIAL_PORT (object));
+
+    if (status == GTKTERM_SERIAL_PORT_ERROR) {
+        char *error_string;
+        error = gtkterm_serial_port_get_error (GTKTERM_SERIAL_PORT (object));
+
+        if (error != NULL) 
+            error_string = g_strdup_printf (_("Serial port error : %s"), error->message);
+        else
+            error_string = g_strdup (_("Serial port error : Unknown error"));
+
+        /** \todo convert to notify signal on message... */
+        gtkterm_show_infobar (priv->main_window, error_string, GTK_MESSAGE_ERROR); 
+
+        g_free(error_string);
+    }
+
+	/** Update the statusbar and main window title */
+    serial_string = gtkterm_serial_port_get_string (priv->serial_port);
+    g_signal_emit (priv->main_window, gtkterm_signals[SIGNAL_GTKTERM_TERMINAL_CHANGED], 
+                                      0, 
+                                      priv->section, 
+                                      serial_string, 
+                                      GtkTermSerialPortStateString[status]);    
+    g_free(serial_string);
+}
+
+/**
+ * @brief When the buffer is updated the terminal is notified data new data is available.
+ * 
+ * Depending of the setting the output will be in ASCII for HEX.
+ * 
+ * @param object Not used.
+ * 
+ * @param data The new string of data in the buffer.
+ * 
+ * @param length The length of the new string
+ * 
+ * @param user_data The terminal.
+ * 
+ */
+ static void gtkterm_terminal_buffer_updated (GObject *object, gpointer data, unsigned int length, gpointer user_data) {
+     GtkTermTerminal *self = GTKTERM_TERMINAL(user_data);
+     GtkTermTerminalPrivate *priv = gtkterm_terminal_get_instance_private (self);
+
+    if (priv->view_mode == GTKTERM_TERMINAL_VIEW_TEXT) 
+        gtkterm_terminal_view_ascii (self, data, length);
+    else
+        gtkterm_terminal_view_hex (self, data, length);
+}
+
+/**
+ * @brief Constructs the terminal.
+ * 
+ * Setup signals, initialize terminal etc.
+ * 
+ * @param object The terminal object we are constructing.
+ * 
+ */
+static void gtkterm_terminal_constructed (GObject *object) {
+    GError *error;
+    GtkTermTerminal *self = GTKTERM_TERMINAL(object);
+    GtkTermTerminalPrivate *priv = gtkterm_terminal_get_instance_private (self);
+
+    /** Check if the config file exists, if not it will be created */
+    g_signal_emit(priv->app->config, gtkterm_signals[SIGNAL_GTKTERM_CONFIG_CHECK_FILE], 0);
+
+    if ((gtkterm_configuration_get_status(priv->app->config)) != GTKTERM_CONFIGURATION_SUCCESS) {
+        error = gtkterm_configuration_get_error (priv->app->config);
+        /** \todo: convert to notify on message */        
+	    gtkterm_show_infobar (priv->main_window, error->message, GTK_MESSAGE_INFO); 
+    }
+
+	/** 
+     * Load the configuration from [Section] into the port and terminal config.
+     * Take [section] as input, term/port conf are the pointers to the return values.
+     */
+    g_signal_emit(priv->app->config, gtkterm_signals[SIGNAL_GTKTERM_CONFIG_TERMINAL], 0, priv->section, &priv->term_conf);
+    g_signal_emit(priv->app->config, gtkterm_signals[SIGNAL_GTKTERM_CONFIG_SERIAL], 0, priv->section, &priv->port_conf);
+    
+    /** 
+     * Create the serial port. The buffer will be a propertie, so they can exchange data without
+     * interference of the terminal.
+     */
+    priv->serial_port = gtkterm_serial_port_new (priv->port_conf);
+
+    /** Create a buffer for the terminal */
+    priv->term_buffer = gtkterm_buffer_new (priv->serial_port, self, priv->term_conf);
+
+    g_signal_connect (G_OBJECT(priv->serial_port), "notify::port-status", G_CALLBACK(gtkterm_terminal_port_status_changed), self);
+    g_signal_connect (G_OBJECT(priv->serial_port), "notify::port-signals", G_CALLBACK(gtkterm_terminal_port_signals_changed), self);
+    g_signal_connect (G_OBJECT(priv->term_buffer), "buffer-updated", G_CALLBACK(gtkterm_terminal_buffer_updated), self);    
+
+    /** Send initial notify to update the status bar */
+	g_object_notify(G_OBJECT(priv->serial_port), "port-status");		
+
+  	/**  
+     * Set terminal properties.
+     * \todo: make configurable from the config file
+     */
+	vte_terminal_set_scroll_on_output(VTE_TERMINAL(self), FALSE);
+	vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(self), TRUE);
+	vte_terminal_set_mouse_autohide(VTE_TERMINAL(self), TRUE);
+	vte_terminal_set_backspace_binding(VTE_TERMINAL(self), VTE_ERASE_ASCII_BACKSPACE);
+
+    vte_terminal_set_cursor_shape (VTE_TERMINAL(self), priv->term_conf->block_cursor ? VTE_CURSOR_SHAPE_BLOCK : VTE_CURSOR_SHAPE_IBEAM);
+    vte_terminal_set_font (VTE_TERMINAL (self), priv->term_conf->font);	
+    vte_terminal_set_scrollback_lines (VTE_TERMINAL (self), priv->term_conf->scrollback);
+    vte_terminal_set_audible_bell (VTE_TERMINAL (self), priv->term_conf->visual_bell);
+    vte_terminal_set_color_background (VTE_TERMINAL (self), &priv->term_conf->background_color);
+    vte_terminal_set_color_foreground (VTE_TERMINAL (self), &priv->term_conf->foreground_color);
+    vte_terminal_set_size(VTE_TERMINAL (self), priv->term_conf->columns, priv->term_conf->rows);	
+
+    G_OBJECT_CLASS (gtkterm_terminal_parent_class)->constructed (object);
+}
+
+/**
+ * @brief Called when distroying the terminal
+ * 
+ * This is used to clean up an freeing the variables in the terminal structure.
+ * 
+ * @param object The object.
+ * 
+ */
+static void gtkterm_terminal_dispose (GObject *object) {
+    GtkTermTerminal *self = GTKTERM_TERMINAL(object);
+    GtkTermTerminalPrivate *priv = gtkterm_terminal_get_instance_private (self);	
+	
+    g_free(priv->section);
+    g_free(priv->term_conf);
+    g_free(priv->port_conf);
+}
+
+/**
+ * @brief Set the property of the GtkTermTerminal structure
+ * 
+ * This is used to initialize the variables when creating a new terminal
+ * 
+ * @param object The object.
+ * 
+ * @param prop_id The id of the property to set.
+ * 
+ * @param value The value for the property
+ * 
+ * @param pspec Metadata for property setting.
+ * 
+ */
+static void gtkterm_terminal_set_property (GObject *object,
+                             unsigned int prop_id,
+                             const GValue *value,
+                             GParamSpec *pspec)
+{
+    GtkTermTerminal *self = GTKTERM_TERMINAL(object);
+    GtkTermTerminalPrivate *priv = gtkterm_terminal_get_instance_private (self);
+
+    switch (prop_id) {
+    	case PROP_SECTION:
+        	priv->section = g_value_dup_string (value);
+        	break;
+
+    	case PROP_GTKTERM_APP:
+        	priv->app = g_value_dup_object (value); 
+        	break;
+
+    	case PROP_MAIN_WINDOW:
+        	priv->main_window = g_value_dup_object (value); 
+        	break;			
+
+
+    	default:
+        	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+/**
+ * @brief Initializing the terminal class
+ * 
+ * Setting the properties and callback functions
+ * 
+ * @param class The terminal class
+ * 
+ */
+static void gtkterm_terminal_class_init (GtkTermTerminalClass *class) {
+
+  	GObjectClass *object_class = G_OBJECT_CLASS (class);
+    object_class->set_property = gtkterm_terminal_set_property;
+    object_class->constructed = gtkterm_terminal_constructed;
+  	object_class->dispose = gtkterm_terminal_dispose;	
+
+    /** Connect the serial port */
+  	gtkterm_signals[SIGNAL_GTKTERM_SERIAL_CONNECT] = g_signal_new ("serial-connect",
+                                                GTKTERM_TYPE_SERIAL_PORT,
+                                                G_SIGNAL_RUN_FIRST,
+                                                0,
+                                                NULL,
+                                                NULL,
+                                                NULL,
+                                                G_TYPE_NONE,
+                                                0,
+                                                NULL); 
+
+    /** We received data from the VTE widget and send it to the serial port */
+  	gtkterm_signals[SIGNAL_GTKTERM_SERIAL_DATA_TRANSMIT] = g_signal_new ("serial-data-transmit",
+                                                GTKTERM_TYPE_SERIAL_PORT,
+                                                G_SIGNAL_RUN_FIRST,
+                                                0,
+                                                NULL,
+                                                NULL,
+                                                NULL,
+                                                G_TYPE_INT,
+                                                2,
+                                                G_TYPE_POINTER,
+                                                G_TYPE_INT,
+                                                NULL);                                                 
+
+    gtkterm_signals[SIGNAL_GTKTERM_VTE_DATA_RECEIVED] = g_signal_new ("vte-data-received",
+                                                   GTKTERM_TYPE_TERMINAL,
+                                                   G_SIGNAL_RUN_FIRST,
+                                                   0,
+                                                   NULL,
+                                                   NULL,
+                                                   NULL,
+                                                   G_TYPE_NONE,
+                                                   1,
+                                                   G_TYPE_BYTES,
+                                                   0);
+
+	/** 
+     * Parameters to hand over at creation of the object
+	 * We need the section to load the config from the keyfile.
+     */
+  	gtkterm_terminal_properties[PROP_SECTION] = g_param_spec_string (
+        "section",
+        "section",
+        "section",
+        NULL,
+        G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
+
+  	gtkterm_terminal_properties[PROP_GTKTERM_APP] = g_param_spec_object (
+        "app",
+        "app",
+        "app",
+        GTKTERM_TYPE_APP,
+        G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
+
+  	gtkterm_terminal_properties[PROP_MAIN_WINDOW] = g_param_spec_object (
+        "main_window",
+        "main_window",
+        "main_window",
+        GTKTERM_TYPE_GTKTERM_WINDOW,
+        G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);		        
+
+    g_object_class_install_properties (object_class, N_PROPS, gtkterm_terminal_properties);
+}
+
+/**
+ * @brief Initialize the terminal with the actions, etc.
+ * 
+ * @param self The terminal we are initializing.
+ * 
+ */
+static void gtkterm_terminal_init (GtkTermTerminal *self) {
+    GtkTermTerminalPrivate *priv = gtkterm_terminal_get_instance_private (self);
+
+    priv->view_mode = GTKTERM_TERMINAL_VIEW_TEXT;
+
+    g_signal_connect_after (G_OBJECT (self), "commit", G_CALLBACK (gtkterm_terminal_vte_data_received), self);
+
+}
+
+/**
+ * @brief Outputs a string to the terminal widget in ASCII.
+ * 
+ * @param self The terminal.
+ * 
+ * @param data The string of data we want to show
+ * 
+ * @param length The length of the string
+ * 
+ */
+void gtkterm_terminal_view_ascii (GtkTermTerminal *self, char *data, unsigned int length) {
+
+    vte_terminal_feed (VTE_TERMINAL(self), data, length);
+}
+
+/**
+ * @brief Outputs a string to the terminal widget in HEX layout.
+ * 
+ * @param self The terminal.
+ * 
+ * @param data The string of data we want to show
+ * 
+ * @param length The length of the string
+ * 
+ */
+void gtkterm_terminal_view_hex (GtkTermTerminal *self, char *data, unsigned int length) {
+
+}
diff --git a/src/gtkterm_terminal.h b/src/gtkterm_terminal.h
new file mode 100644
index 0000000..2c533a6
--- /dev/null
+++ b/src/gtkterm_terminal.h
@@ -0,0 +1,57 @@
+/***********************************************************************/
+/* gtkterm_terminal.h                                                  */
+/* --------                                                            */
+/*           GTKTerm Software                                          */
+/*                      (c) Julien Schmitt                             */
+/*                                                                     */
+/* ------------------------------------------------------------------- */
+/*                                                                     */
+/*   Purpose                                                           */
+/*      Handles all VTE in/output to/from serial port                  */
+/*      - Header file -                                                */
+/*                                                                     */
+/***********************************************************************/
+#ifndef GTKTERM_TERMINAL_H
+#define GTKTERM_TERMINAL_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <vte/vte.h>
+
+#include "gtkterm.h"
+
+/**
+ * @brief The typedef for the terminal configuration.
+ *
+ */
+typedef struct {
+	
+	bool block_cursor;			/** Show a block shape cursor	*/
+	bool show_cursor;			/** Show cursor in window. \todo This is not possible, so remove? */
+	char char_queue;            /** character in queue			*/
+	bool echo;               	/** local echo 					*/
+	bool auto_lf;           	/** auto line feed				*/
+	bool auto_cr;           	/** auto return				*/
+	bool timestamp;				/** Show timestamp in output	*/
+	int delay;                  /** end of char delay: in ms	*/
+	int rows;					/** Number of rows in terminal  */
+	int columns;				/** Number of cols in terminal  */
+	int scrollback;				/** Number of scrollback lines  */
+	bool visual_bell;			/**	Visual bell					*/
+	GdkRGBA foreground_color;	/** Terminal Background color	*/
+	GdkRGBA background_color;	/** Terminal Foreground color   */
+	PangoFontDescription *font;	/** Terminal Font				*/
+
+} term_config_t;
+
+G_BEGIN_DECLS
+
+#define GTKTERM_TYPE_TERMINAL gtkterm_terminal_get_type()
+G_DECLARE_FINAL_TYPE (GtkTermTerminal, gtkterm_terminal, GTKTERM, TERMINAL, VteTerminal)
+typedef struct _GtkTermTerminal GtkTermTerminal;
+
+GtkTermTerminal *gtkterm_terminal_new (char *, GtkTerm *, GtkTermWindow *);
+
+G_END_DECLS
+
+#endif // GTKTERM_TERMINAL_H
\ No newline at end of file
diff --git a/src/gtkterm_window.c b/src/gtkterm_window.c
new file mode 100644
index 0000000..9b2beb0
--- /dev/null
+++ b/src/gtkterm_window.c
@@ -0,0 +1,692 @@
+
+#include <gtk/gtk.h>
+#include <vte/vte.h>
+#include <glib/gi18n.h>
+#include <glib/gprintf.h>
+#include <sys/ioctl.h>
+
+#include "config.h"
+#include "gtkterm_defaults.h"
+#include "gtkterm.h"
+#include "gtkterm_window.h"
+#include "gtkterm_terminal.h"
+
+#define SERIAL_SIGNALS    6
+
+/**
+ * @brief MainWindow specific variables here.
+ * 
+ */
+struct _GtkTermWindow {
+  GtkApplicationWindow parent_instance;
+
+  GtkWidget *message;                   /**< Message for the infobar                */
+  GtkWidget *infobar;                   /**< Infobar                                */
+  GtkBox *statusbox;                    /**< Box for statusbar messages             */
+  GtkBox *status_config;                /**< Displays the actual used configuration */
+  GtkWidget *menubutton;                /**< Toolbar                                */
+  GMenuModel *toolmenu;                 /**< Menu                                   */
+  GtkScrolledWindow *scrolled_window;   /**< Make the terminal window scrolled      */
+  GtkTermTerminal *terminal_window;     /**< The terminal window                    */
+  GtkWidget *search_bar;                /**< Searchbar                              */
+  GActionGroup *action_group;           /**< Window action group                    */
+  GtkWidget *status_config_message[3];
+  GtkWidget *status_serial_signal[SERIAL_SIGNALS];  
+  GtkWidget *status_message;
+
+  int width;                            /**< Window width                           */
+  int height;                           /**< Window height                          */
+  bool maximized;                       /**< Window minimized?                      */
+  bool fullscreen;                      /**< Window maximized?                      */
+} ;
+
+G_DEFINE_TYPE (GtkTermWindow, gtkterm_window, GTK_TYPE_APPLICATION_WINDOW)
+
+/** Internal functions            */
+static void gtkterm_window_update_statusbar (GtkTermWindow *, gpointer, gpointer, gpointer, gpointer);
+static void config_status_bar (GtkTermWindow *);
+static void update_statusbar (GtkTermWindow *, gpointer, gpointer, gpointer);
+void set_window_title (GtkTermWindow *, gpointer);
+
+/** Menu callbacks                */
+static void on_gtkterm_about (GSimpleAction *, GVariant *, gpointer);
+static void on_gtkterm_toggle_state (GSimpleAction *, GVariant *, gpointer);
+static void on_gtkterm_toggle_dark (GSimpleAction *, GVariant *, gpointer);
+
+/** Serial signals                */
+static unsigned int signal_flags[] = {TIOCM_DTR, TIOCM_RTS, TIOCM_CTS, TIOCM_CD, TIOCM_DSR, TIOCM_RI};
+static char const *serial_signal[] = {"DTR", "RTS", "CTS", "CD", "DSR", "RI"};
+
+/** Menu definitions and callbacks */
+static GActionEntry gtkterm_window_entries[] = {
+  // { "clear_screen", on_gtkterm_clear_screen, NULL, NULL, NULL },
+  // { "clear_scrollback", on_gtkterm_clear_scrollback, NULL, NULL, NULL },
+  // { "send_raw_file", on_gtkterm_send_raw, NULL, NULL, NULL },  
+  // { "save_raw_file", on_gtkterm_save_raw, NULL, NULL, NULL },
+  // { "copy", on_gtkterm_copy, NULL, NULL, NULL },
+  // { "paste", on_gtkterm_paste, NULL, NULL, NULL },  
+  // { "select_all", on_gtkterm_select_all, NULL, NULL, NULL },
+  // { "log_to_file", on_gtkterm_log_to_file, NULL, NULL, NULL },
+  // { "log_resume", on_gtkterm_log_resume, NULL, NULL, NULL },
+  // { "log_stop", on_gtkterm_log_stop, NULL, NULL, NULL },
+  // { "log_clear", on_gtkterm_log_clear, NULL, NULL, NULL },
+  // { "config_port", on_gtkterm_config_port, NULL, NULL, NULL },
+  // { "config_main_window", on_gtkterm_config_main_window, NULL, NULL, NULL },
+  // { "local_echo", on_gtkterm_local_echo, NULL, NULL, NULL },
+  // { "crlf_auto", on_gtkterm_crlf_auto, NULL, NULL, NULL },
+  // { "timestamp", on_gtkterm_timestamp, NULL, NULL, NULL },
+  // { "macro", on_gtkterm_macros, NULL, NULL, NULL },
+  // { "load_config", on_gtkterm_load_config, NULL, NULL, NULL },
+  // { "save_config", on_gtkterm_save_config, NULL, NULL, NULL },
+  // { "remove_config", on_gtkterm_remove_config, NULL, NULL, NULL },
+  // { "send_break", on_gtkterm_send_break, NULL, NULL, NULL },
+  // { "open_port", on_gtkterm_open_port, NULL, NULL, NULL },
+  // { "close_port", on_gtkterm_close_port, NULL, NULL, NULL },         
+  // { "toggle_DTR", on_gtkterm_toggle_DTR, NULL, NULL, NULL },
+  // { "toggle_RTS", on_gtkterm_toggle_RTS, NULL, NULL, NULL },
+  // { "show_ascii", on_gtkterm_show_ascii, NULL, NULL, NULL },
+  // { "show_hex", on_gtkterm_show_hex, NULL, NULL, NULL },
+  // { "view_hex", on_gtkterm_view_hex, NULL, NULL, NULL },
+  // { "show_index", on_gtkterm_show_index, NULL, NULL, NULL },
+  // { "send_hex_data,", on_gtkterm_send_hex_data, NULL, NULL, NULL },  
+  { "dark", on_gtkterm_toggle_state, NULL, "false", on_gtkterm_toggle_dark}
+};
+
+/** GtkTermWindow definitions and callbacks */
+static GActionEntry win_entries[] = {
+  { "about", on_gtkterm_about, NULL, NULL, NULL }
+};
+
+/** \todo remove and set it with properties. */
+void create_window (GApplication *app, GtkTermWindow *window) {
+  /**
+   * Create a new terminal window and send section and keyfile as parameter
+   * GTKTERM_TERMINAL then can load the right section.
+   */
+  window->terminal_window = gtkterm_terminal_new (GTKTERM_APP(app)->section, GTKTERM_APP(app), window);
+
+  /** Make the VTE window scrollable */
+  gtk_scrolled_window_set_child(window->scrolled_window, GTK_WIDGET(window->terminal_window));
+}
+
+/**
+ * @brief  Shows a message into the Infobar.
+ * 
+ * @param window The window with the infobar property.
+ * 
+ * @param message The message we want to show
+ * 
+ * @param message_type The type of message GTK_MESSAGE_*
+ * 
+ */
+void gtkterm_show_infobar (GtkTermWindow *window, char *message, int message_type) {
+
+  gtk_info_bar_set_message_type (GTK_INFO_BAR(window->infobar), message_type);
+  gtk_label_set_text (GTK_LABEL (window->message), message);
+  gtk_widget_show (window->infobar);
+}
+
+/** \todo rewrite for gtkterm */
+static void open_response_cb (GtkNativeDialog *dialog,
+                  int              response_id,
+                  gpointer         user_data) {
+
+  GtkFileChooserNative *native = user_data;
+  GtkWidget *message_dialog;
+  GFile *file;
+  char *contents;
+  GError *error = NULL;
+
+  if (response_id == GTK_RESPONSE_ACCEPT)
+    {
+      file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (native));
+
+      if (g_file_load_contents (file, NULL, &contents, NULL, NULL, &error))
+        {
+ //         create_window (app);
+ //         g_free (contents);
+        }
+      else
+        {
+          message_dialog = gtk_message_dialog_new (NULL,
+                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                   GTK_MESSAGE_ERROR,
+                                                   GTK_BUTTONS_CLOSE,
+                                                   "Error loading file: \"%s\"",
+                                                   error->message);
+          g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
+          gtk_widget_show (message_dialog);
+          g_error_free (error);
+        }
+    }
+
+  gtk_native_dialog_destroy (GTK_NATIVE_DIALOG (native));
+  g_object_unref (native);
+}
+
+/** \todo rewrite for GTKTerm */
+static void on_gtkterm_send_raw (GSimpleAction *action,
+               GVariant      *parameter,
+               gpointer       user_data) {
+
+  GApplication *app = user_data;
+  GtkFileChooserNative *native;
+
+  native = gtk_file_chooser_native_new ("Open File",
+                                        NULL,
+                                        GTK_FILE_CHOOSER_ACTION_OPEN,
+                                        "_Open",
+                                        "_Cancel");
+
+  g_object_set_data_full (G_OBJECT (native), "gtkterm", g_object_ref (app), g_object_unref);
+  g_signal_connect (native, "response", G_CALLBACK (open_response_cb), native);
+
+  gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
+}
+
+/** \todo rewrite for GTKTerm */
+static void on_gtkterm_toggle_state (GSimpleAction *action,
+                 GVariant      *parameter,
+                 gpointer       user_data) {
+  GVariant *state;
+
+//  show_action_dialog (action);
+
+  state = g_action_get_state (G_ACTION (action));
+  g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
+  g_variant_unref (state);
+}
+
+/** \todo rewrite for GTKTerm */
+static void on_gtkterm_toggle_radio (GSimpleAction *action,
+                GVariant      *parameter,
+                gpointer       user_data) {
+
+//  show_action_infobar (action, parameter, user_data);
+
+  g_action_change_state (G_ACTION (action), parameter);
+}
+
+/**
+ * @brief  Show the About dialog
+ * 
+ * @param action Not used.
+ * 
+ * @param parameter Not used.
+ * 
+ * @param user_data Pointer to the GtkTermWindow.
+ * 
+ */
+static void on_gtkterm_about (GSimpleAction *action,
+                GVariant      *parameter,
+                gpointer       user_data) {
+
+  GtkWidget *window = user_data;
+  char *os_name;
+  char *os_version;
+  GString *s;
+
+  const char *authors[] = {
+    "Julien Schimtt", 
+    "Zach Davis", 
+    "Florian Euchner", 
+    "Stephan Enderlein",
+    "Kevin Picot",
+    "Jens Georg",
+    NULL};
+
+  const char *comments =  _("GTKTerm is a simple GTK+ terminal used to communicate with the serial port.");
+
+  s = g_string_new ("");
+
+  os_name = g_get_os_info (G_OS_INFO_KEY_NAME);
+  os_version = g_get_os_info (G_OS_INFO_KEY_VERSION_ID);
+
+  if (os_name && os_version)
+    g_string_append_printf (s, "OS\t%s %s\n\n", os_name, os_version);
+  
+  g_string_append (s, "System libraries\n");
+  g_string_append_printf (s, "\tGLib\t%d.%d.%d\n",
+                          glib_major_version,
+                          glib_minor_version,
+                          glib_micro_version);
+  
+  g_string_append_printf (s, "\tPango\t%s\n", pango_version_string ());
+  g_string_append_printf (s, "\tGTK \t%d.%d.%d\n", gtk_get_major_version (),
+                          gtk_get_minor_version (), gtk_get_micro_version ());
+
+  GdkTexture *logo = gdk_texture_new_from_resource ("/com/github/jeija/gtkterm/gtkterm_48x48.png");
+
+  gtk_show_about_dialog (GTK_WINDOW (window),
+                         "program-name", "GTKTerm",
+                         "version", PACKAGE_VERSION,
+	                       "copyright", "Copyright © Julien Schimtt",
+	                       "license-type", GTK_LICENSE_LGPL_3_0, 
+	                       "website", "https://github.com/Jeija/gtkterm",
+	                       "website-label", "https://github.com/Jeija/gtkterm",
+                         "comments", "Program to demonstrate GTK functions.",
+                         "authors", authors,
+                         "logo-icon-name", "com.github.jeija.gtkterm",
+                         "title", "GTKTerm",
+                        "comments", comments,
+	                       "logo", logo,
+                         "system-information", s->str,
+                         NULL);
+}
+
+/**
+ * @brief Set the serial signals (DTR etc) in the status bar
+ * 
+ * @param window The GtkTermWindow with the statusbar.
+ * 
+ * @param port_signals The port signals to set.
+ * 
+ * @param user_data Not used.
+ * 
+ */
+static void gtkterm_window_set_signals (GtkTermWindow *window, unsigned int port_signals, gpointer user_data) {
+
+    for (int i = 0; i < SERIAL_SIGNALS; i++) {
+
+        bool active = (port_signals & signal_flags[i]) != 0;
+        gtk_widget_set_sensitive (window->status_serial_signal[i], active);
+    }
+}
+
+/**
+ * @brief Set the statusbar with all relevant fields.
+ * 
+ * @param window The GtkTermWindow with the statusbar.
+ * 
+ */
+void config_status_bar (GtkTermWindow *window) {
+    GtkWidget *label;
+
+    /** Fields for the configuration and port */
+    for (int i = 0; i < 3; i++) {
+        label = gtk_label_new ("");
+        gtk_box_append (GTK_BOX (window->status_config), label);
+        gtk_widget_set_halign (GTK_WIDGET (label), GTK_ALIGN_START);
+        gtk_label_set_width_chars (GTK_LABEL(label), 25);
+        window->status_config_message[i] = label;
+    }
+
+    /** 
+     * Fill in the serial signals
+     * The signals are added at the statusbox so they can glide along when resizing the window
+     */
+    for (int i = 0; i < 6; i++) {
+        label = gtk_label_new (serial_signal[i]);
+        gtk_box_append (GTK_BOX (window->statusbox), label);
+        gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
+        gtk_widget_set_halign (GTK_WIDGET (label), GTK_ALIGN_END);
+        window->status_serial_signal[i] = label;
+    }
+}
+
+/**
+ * @brief Updates the statusbar with the active terminal configuration.
+ * 
+ * @param window The GtkTermWindow with the statusbar.
+ * 
+ * @param section The active section of the terminal
+ * 
+ * @param serial_config_string The connectionstring of the serial port
+ * 
+ * @param serial_status The status of the serial port.
+ * 
+ */
+static void update_statusbar (GtkTermWindow *window, gpointer section, gpointer serial_config_string, gpointer serial_status) {
+  char *msg;
+
+  msg = g_strdup_printf ("[%s]", (char *)section);
+
+  gtk_label_set_text (GTK_LABEL(window->status_config_message[0]), msg);
+  gtk_label_set_label (GTK_LABEL(window->status_config_message[1]), serial_config_string);
+  gtk_label_set_label (GTK_LABEL(window->status_config_message[2]), serial_status); 
+
+  g_free (msg);  
+}
+
+/**
+ * @brief Sets title of the window.
+ * 
+ * The title of the window is concatenated with the serial options
+ * of the active terminal window.
+ * 
+ * @param window The GtkTermWindow for which we set the title
+ * 
+ * @param serial_config_string The connectionstring of the serial port.
+ * 
+ */
+void set_window_title (GtkTermWindow *window, gpointer serial_config_string) {
+
+  char *msg;
+
+  msg = g_strdup_printf ("GtkTerm - %s", (char *)serial_config_string);
+
+  gtk_window_set_title (GTK_WINDOW(window), msg);
+
+  g_free (msg);  
+}
+
+/**
+ * @brief Callbackfunction for updating window title and statusbus
+ * 
+ * @param window The GtkTermWindow which we update
+ * 
+ * @param section The active section of the terminal
+ * 
+ * @param serial_config_string The connectionstring of the serial port
+ * 
+ * @param serial_status The status of the serial port.
+ * 
+ * @param user_data Not used.
+ * 
+ */
+static void gtkterm_window_update_statusbar (GtkTermWindow *window, gpointer section, gpointer serial_config_string, 
+                                            gpointer serial_status, gpointer user_data) {
+
+  set_window_title (window, serial_config_string);
+  update_statusbar (window, section, serial_config_string, serial_status);
+}
+
+/**
+ * @brief Toggles the dark mode setting.
+ * 
+ * @param action The action interface.
+ * 
+ * @param state The new dark-mode setting
+ * 
+ * @param user_data Not used.
+ * 
+ */
+static void on_gtkterm_toggle_dark (GSimpleAction *action,
+                    GVariant      *state,
+                    gpointer       user_data) {
+
+  GtkSettings *settings = gtk_settings_get_default ();
+
+  g_object_set (G_OBJECT (settings),
+                "gtk-application-prefer-dark-theme",
+                g_variant_get_boolean (state),
+                NULL);
+
+  g_simple_action_set_state (action, state);
+}
+
+/**
+ * @brief Toggles the radio option in the menubar
+ * 
+ * @param action The action interface.
+ * 
+ * @param state The new radio setting
+ * 
+ * @param user_data Not used.
+ * 
+ */
+static void on_gtkterm_toggle_radio_state (GSimpleAction *action,
+                    GVariant      *state,
+                    gpointer       user_data) {
+
+  g_simple_action_set_state (action, state);
+}
+
+/** To be implemented */
+static void clicked_cb (GtkWidget *widget, GtkTermWindow *window) {
+
+  gtk_widget_hide (window->infobar);
+}
+
+/**
+ * @brief Stores the setting of the window in the Gnome Settings.
+ * 
+ * @param window The window we store the settings for.
+ * 
+ */
+static void gtkterm_window_store_state (GtkTermWindow *window) {
+
+  GSettings *settings;
+
+  settings = g_settings_new ("com.github.jeija.gtkterm");
+  g_settings_set (settings, "window-size", "(ii)", window->width, window->height);
+  g_settings_set_boolean (settings, "maximized", window->maximized);
+  g_settings_set_boolean (settings, "fullscreen", window->fullscreen);
+  g_object_unref (settings);
+}
+
+/**
+ * @brief Loads the setting of the window from the Gnome Settings.
+ * 
+ * @param window The window we load the settings for.
+ * 
+ */
+static void gtkterm_window_load_state (GtkTermWindow *window) {
+  GSettings *settings;
+
+  settings = g_settings_new ("com.github.jeija.gtkterm");
+  g_settings_get (settings, "window-size", "(ii)", &window->width, &window->height);
+  window->maximized = g_settings_get_boolean (settings, "maximized");
+  window->fullscreen = g_settings_get_boolean (settings, "fullscreen");
+  g_object_unref (settings);
+}
+
+/**
+ * @brief Initialize the window with the actions, tools etc.
+ * 
+ * @param window The window we are initializing.
+ * 
+ */
+static void gtkterm_window_init (GtkTermWindow *window) {
+  
+  GtkWidget *popover;
+
+  window->width = -1;
+  window->height = -1;
+  window->maximized = FALSE;
+  window->fullscreen = FALSE;
+
+  gtk_widget_init_template (GTK_WIDGET (window));
+
+  popover = gtk_popover_menu_new_from_model (window->toolmenu);
+  gtk_menu_button_set_popover (GTK_MENU_BUTTON (window->menubutton), popover);
+
+  window->action_group = G_ACTION_GROUP(g_simple_action_group_new ());                                 
+
+  /** \todo: Rename it */
+  g_action_map_add_action_entries (G_ACTION_MAP (window->action_group),
+                                   win_entries, 
+                                   G_N_ELEMENTS (win_entries),
+                                   window);
+  gtk_widget_insert_action_group (GTK_WIDGET (window), "gtkterm_window", window->action_group);
+  g_action_map_add_action_entries (G_ACTION_MAP (window->action_group),
+                                   win_entries, 
+                                   G_N_ELEMENTS (gtkterm_window_entries),
+                                   window);
+
+  /* 
+   *  This means we have to do 'it by hand not from the UI' and store the GtkLabels for later use.
+   */
+  config_status_bar (window);                               
+}
+
+/**
+ * @brief Constructs the window.
+ * 
+ * @param object The window object we are constructing.
+ * 
+ */
+static void gtkterm_window_constructed (GObject *object) {
+  GtkTermWindow *window = (GtkTermWindow *)object;
+
+  gtkterm_window_load_state (window);
+
+  gtk_window_set_default_size (GTK_WINDOW (window), window->width, window->height); 
+
+  /** 
+   * Create a new terminal window and send section and keyfile as parameter
+   * GTKTERM_TERMINAL then can load the right section.
+   */
+  //window->terminal_window = gtkterm_terminal_new (GTKTERM_APP(app)->section, GTKTERM_APP(app), window);
+
+  /** Make the VTE window scrollable */
+  //gtk_scrolled_window_set_child(window->scrolled_window, GTK_WIDGET(window->terminal_window));  
+
+  /** Connect to the terminal_changed so we can update the statusbar and window title */
+  g_signal_connect (window, "terminal-changed", G_CALLBACK(gtkterm_window_update_statusbar), NULL);	
+  g_signal_connect (window, "serial-signals-changed", G_CALLBACK(gtkterm_window_set_signals), NULL);	   
+
+  if (window->maximized)
+    gtk_window_maximize (GTK_WINDOW (window));
+
+  if (window->fullscreen)
+    gtk_window_fullscreen (GTK_WINDOW (window));
+
+  G_OBJECT_CLASS (gtkterm_window_parent_class)->constructed (object);
+}
+
+/**
+ * @brief Assigns size an position to the widget.
+ * 
+ * @param widget The widget.
+ * 
+ * @param width The width of the widget.
+ *  
+ * @param height The height of the widget.
+ * 
+ * @param baseline  The baseline for this widget.
+ * 
+ */
+static void gtkterm_window_size_allocate (GtkWidget *widget,
+                                       int width,
+                                       int height,
+                                       int baseline) {
+                                        
+  GtkTermWindow *window = (GtkTermWindow *)widget; 
+
+  GTK_WIDGET_CLASS (gtkterm_window_parent_class)->size_allocate (widget,
+                                                                  width,
+                                                                  height,
+                                                                  baseline);
+
+  if (!window->maximized && !window->fullscreen)
+    gtk_window_get_default_size (GTK_WINDOW (window), &window->width, &window->height);
+}
+
+/**
+ * @brief Called when the surface state is changed (min/max).
+ * 
+ * @param widget The widget.
+ * 
+ */
+static void surface_state_changed (GtkWidget *widget) {
+  GtkTermWindow *window = (GtkTermWindow *)widget;
+  GdkToplevelState new_state;
+
+  new_state = gdk_toplevel_get_state (GDK_TOPLEVEL (gtk_native_get_surface (GTK_NATIVE (widget))));
+  window->maximized = (new_state & GDK_TOPLEVEL_STATE_MAXIMIZED) != 0;
+  window->fullscreen = (new_state & GDK_TOPLEVEL_STATE_FULLSCREEN) != 0;
+}
+
+/**
+ * @brief Windows realize.
+ * 
+ * Operations to finish realizing the widget.
+ * 
+ * @param widget The widget.
+ * 
+ */
+static void gtkterm_window_realize (GtkWidget *widget) {
+  GTK_WIDGET_CLASS (gtkterm_window_parent_class)->realize (widget);
+
+  g_signal_connect_swapped (gtk_native_get_surface (GTK_NATIVE (widget)), "notify::state",
+                            G_CALLBACK (surface_state_changed), widget);
+}
+
+/**
+ * @brief Windows unrealize.
+ * 
+ * Operations when removing the widget.
+ * 
+ * @param widget The widget.
+ * 
+ */
+static void gtkterm_window_unrealize (GtkWidget *widget) {
+  g_signal_handlers_disconnect_by_func (gtk_native_get_surface (GTK_NATIVE (widget)),
+                                        surface_state_changed, widget);
+
+  GTK_WIDGET_CLASS (gtkterm_window_parent_class)->unrealize (widget);
+}
+
+/**
+ * @brief Called when distroying the window
+ * 
+ * This is used to clean up an freeing the variables in the window structure.
+ * 
+ * @param object The object.
+ * 
+ */
+static void gtkterm_window_dispose (GObject *object) {
+  GtkTermWindow *window = (GtkTermWindow *)object;
+
+  gtkterm_window_store_state (window);
+
+  G_OBJECT_CLASS (gtkterm_window_parent_class)->dispose (object);
+}
+
+/**
+ * @brief Initializing the window class
+ * 
+ * Setting the signals, the UI and callback functions
+ * 
+ * @param class The window class
+ * 
+ */
+static void gtkterm_window_class_init (GtkTermWindowClass *class) {
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+
+  object_class->constructed = gtkterm_window_constructed;
+  object_class->dispose = gtkterm_window_dispose;
+
+  widget_class->size_allocate = gtkterm_window_size_allocate;
+  widget_class->realize = gtkterm_window_realize;
+  widget_class->unrealize = gtkterm_window_unrealize;
+
+  gtkterm_signals[SIGNAL_GTKTERM_TERMINAL_CHANGED] = g_signal_new ("terminal-changed",
+                                            GTKTERM_TYPE_GTKTERM_WINDOW,
+                                            G_SIGNAL_RUN_FIRST,
+                                            0,
+                                            NULL,
+                                            NULL,
+                                            NULL,
+                                            G_TYPE_NONE,
+                                            3,
+                                            G_TYPE_POINTER,
+                                            G_TYPE_POINTER,
+                                            G_TYPE_POINTER,
+                                            NULL);
+
+  gtkterm_signals[SIGNAL_GTKTERM_SERIAL_SIGNALS_CHANGED] = g_signal_new ("serial-signals-changed",
+                                            GTKTERM_TYPE_GTKTERM_WINDOW,
+                                            G_SIGNAL_RUN_FIRST,
+                                            0,
+                                            NULL,
+                                            NULL,
+                                            NULL,
+                                            G_TYPE_NONE,
+                                            1,
+                                            G_TYPE_INT,
+                                            NULL);                                            
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/com/github/jeija/gtkterm/gtkterm_main.ui");
+  gtk_widget_class_bind_template_child (widget_class, GtkTermWindow, message);
+  gtk_widget_class_bind_template_child (widget_class, GtkTermWindow, menubutton);
+  gtk_widget_class_bind_template_child (widget_class, GtkTermWindow, toolmenu);  
+  gtk_widget_class_bind_template_child (widget_class, GtkTermWindow, infobar);
+  gtk_widget_class_bind_template_child (widget_class, GtkTermWindow, scrolled_window);    
+  gtk_widget_class_bind_template_child (widget_class, GtkTermWindow, statusbox); 
+  gtk_widget_class_bind_template_child (widget_class, GtkTermWindow, status_config);   
+
+  gtk_widget_class_bind_template_callback (widget_class, clicked_cb);
+}
diff --git a/src/gtkterm_window.h b/src/gtkterm_window.h
new file mode 100644
index 0000000..9f5c1ee
--- /dev/null
+++ b/src/gtkterm_window.h
@@ -0,0 +1,22 @@
+#ifndef GTKTERM_WINDOW_H
+#define GTKTERM_WINDOW_H
+
+#include <gio/gio.h>
+#include <glib-object.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gprintf.h>
+
+
+G_BEGIN_DECLS
+
+#define GTKTERM_TYPE_GTKTERM_WINDOW gtkterm_window_get_type()
+G_DECLARE_FINAL_TYPE (GtkTermWindow, gtkterm_window, GTKTERM, WINDOW, GtkApplicationWindow)
+typedef struct _GtkTermWindow GtkTermWindow;
+
+void create_window (GApplication *, GtkTermWindow *);
+void gtkterm_show_infobar (GtkTermWindow *, char *, int);
+
+G_END_DECLS
+
+#endif // GTKTERM_WINDOW_H
\ No newline at end of file
diff --git a/src/i18n.c b/src/i18n.c
deleted file mode 100644
index b99edf6..0000000
--- a/src/i18n.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/***********************************************************************/
-/* i18n.c                                                              */
-/* ------                                                              */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      UTF-8 conversion to print in the console                       */
-/*                                                                     */
-/*   ChangeLog                                                         */
-/*      - 0.99.5 : created strerror_utf8() function                    */
-/*      - 0.99.2 : file creation by Julien                             */
-/*                 function iconv_from_utf8_to_locale is based         */
-/*                 on hddtemp 0.3 source code                          */
-/*                                                                     */
-/***********************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <iconv.h>
-#include <langinfo.h>
-#include <locale.h>
-#include <string.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <glib.h>
-
-#include "i18n.h"
-
-static char *iconv_from_utf8_to_locale(const char *str, const char *fallback_string)
-{
-	const char *charset;
-
-	iconv_t cd;
-	size_t nconv;
-
-	char *buffer, *old_buffer;
-	char *buffer_ptr;
-	char *string_ptr;
-	char *string;
-
-	const size_t buffer_inc = 80; // Increment buffer size in 80 bytes step
-	size_t buffer_size;
-	size_t buffer_size_left;
-	size_t string_size;
-
-	// Get the current charset
-	charset = nl_langinfo(CODESET);
-
-	if(strcmp(charset, "UTF-8") == 0)
-		return g_strdup(str);
-
-	// Open iconv descriptor
-	cd = iconv_open(charset, "UTF-8");
-	if (cd == (iconv_t) -1)
-		return g_strdup(fallback_string);
-
-	// Set up the buffer
-	buffer_size = buffer_size_left = buffer_inc;
-	buffer = (char *) malloc(buffer_size + 1);
-	if (buffer == NULL)
-		return g_strdup(fallback_string);
-	buffer_ptr = buffer;
-	string = g_strdup(str);
-	string_ptr = string;
-	string_size = strlen(string);
-	// Do the conversion
-	while (string_size != 0)
-	{
-		nconv = iconv(cd, &string_ptr, &string_size, &buffer_ptr, &buffer_size_left);
-		if (nconv == (size_t) -1)
-		{
-			if (errno != E2BIG)                 // if translation error
-			{
-				iconv_close(cd);                  // close descriptor
-				free(buffer);                     // free buffer
-				free(string);
-				return g_strdup(fallback_string); // and return fallback string
-			}
-			// increase buffer size
-			buffer_size += buffer_inc;
-			buffer_size_left = buffer_inc;
-			old_buffer = buffer;
-			buffer = (char *) realloc(buffer, buffer_size + 1);
-			if (buffer == NULL)
-			{
-				free(string);
-				return g_strdup(fallback_string);
-			}
-			buffer_ptr = (buffer_ptr - old_buffer) + buffer;
-		}
-	}
-	*buffer_ptr = '\0';
-	iconv_close(cd);
-	free(string);
-
-	return buffer;
-}
-
-int i18n_printf(const char *format, ...)
-{
-	char *new_format;
-	int return_value;
-	va_list args;
-
-	new_format = iconv_from_utf8_to_locale(format, "");
-
-	if(new_format != NULL)
-	{
-		va_start(args, format);
-		return_value = vprintf(new_format, args);
-		va_end(args);
-		free(new_format);
-	}
-	else
-		return_value = 0;
-
-	return return_value;
-}
-
-int i18n_fprintf(FILE *stream, const char *format, ...)
-{
-	char *new_format;
-	int return_value;
-	va_list args;
-
-	new_format = iconv_from_utf8_to_locale(format, "");
-
-	if(new_format != NULL)
-	{
-		va_start(args, format);
-		return_value = vfprintf(stream, new_format, args);
-		va_end(args);
-		free(new_format);
-	}
-	else
-		return_value = 0;
-
-	return return_value;
-}
-
-void i18n_perror(const char *s)
-{
-	char *conv_string;
-	int errno_backup;
-
-	errno_backup = errno;
-
-	conv_string = iconv_from_utf8_to_locale(s, "");
-	if(conv_string != NULL)
-	{
-		fprintf(stderr, "%s: %s\n", conv_string, strerror_utf8(errno_backup));
-		free(conv_string);
-	}
-}
-
-char *strerror_utf8(int errornum)
-{
-	char *utf8error;
-
-	utf8error = g_locale_to_utf8(strerror(errornum), -1, NULL, NULL, NULL);
-
-	return utf8error;
-}
diff --git a/src/i18n.h b/src/i18n.h
deleted file mode 100644
index 0d09c9d..0000000
--- a/src/i18n.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/***********************************************************************/
-/* i18n.h                                                              */
-/* ------                                                              */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      UTF-8 conversion to print in the console                       */
-/*        - Header file -                                              */
-/*                                                                     */
-/***********************************************************************/
-
-#ifndef I18N_H_
-#define I18N_H
-
-#include <stdio.h>
-
-int i18n_printf(const char *, ...);
-int i18n_fprintf(FILE *, const char *, ...);
-void i18n_perror(const char *);
-char *strerror_utf8(int);
-
-#endif
diff --git a/src/interface.c b/src/interface.c
deleted file mode 100644
index 32b8a24..0000000
--- a/src/interface.c
+++ /dev/null
@@ -1,976 +0,0 @@
-/***********************************************************************/
-/* widgets.c                                                           */
-/* ---------                                                           */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Functions for the management of the GUI for the main window    */
-/*                                                                     */
-/*   ChangeLog                                                         */
-/*   (All changes by Julien Schmitt except when explicitly written)    */
-/*                                                                     */
-/*       - 1.01  : The put_hexadecimal partly function rewritten.      */
-/*                 The vte_terminal_get_cursor_position function does  */
-/*                 not return always the actual column.                */
-/*                 Now it uses an internal column-index (virt_col_pos).*/
-/*                 (Willem van den Akker)                              */
-/*      - 0.99.7 : Changed keyboard shortcuts to <ctrl><shift>         */
-/*	            (Ken Peek)                                         */
-/*      - 0.99.6 : Added scrollbar and copy/paste (Zach Davis)         */
-/*                                                                     */
-/*      - 0.99.5 : Make package buildable on pure *BSD by changing the */
-/*                 include to asm/termios.h by sys/ttycom.h            */
-/*                 Print message without converting it into the locale */
-/*                 in show_message()                                   */
-/*                 Set backspace key binding to backspace so that the  */
-/*                 backspace works. It would even be nicer if the      */
-/*                 behaviour of this key could be configured !         */
-/*      - 0.99.4 : - Sebastien Bacher -                                */
-/*                 Added functions for CR LF auto mode                 */
-/*                 Fixed put_text() to have \r\n for the VTE Widget    */
-/*                 Rewritten put_hexadecimal() function                */
-/*                 - Julien -                                          */
-/*                 Modified send_serial to return the actual number of */
-/*                 bytes written, and also only display exactly what   */
-/*                 is written                                          */
-/*      - 0.99.3 : Modified to use a VTE terminal                      */
-/*      - 0.99.2 : Internationalization                                */
-/*      - 0.99.0 : \b byte now handled correctly by the ascii widget   */
-/*                 SUPPR (0x7F) also prints correctly                  */
-/*                 adapted for macros                                  */
-/*                 modified "about" dialog                             */
-/*      - 0.98.6 : fixed possible buffer overrun in hex send           */
-/*                 new "Send break" option                             */
-/*      - 0.98.5 : icons in the menu                                   */
-/*                 bug fixed with local echo and hexadecimal           */
-/*                 modified hexadecimal send separator, and bug fixed  */
-/*      - 0.98.4 : new hexadecimal display / send                      */
-/*      - 0.98.3 : put_text() modified to fit with 0x0D 0x0A           */
-/*      - 0.98.2 : added local echo by Julien                          */
-/*      - 0.98 : file creation by Julien                               */
-/*                                                                     */
-/***********************************************************************/
-
-#include <gtk/gtk.h>
-#if defined (__linux__)
-#  include <asm/termios.h>       /* For control signals */
-#endif
-#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) \
-     || defined (__NetBSD__) || defined (__NetBSD_kernel__) \
-     || defined (__OpenBSD__) || defined (__OpenBSD_kernel__)
-#  include <sys/ttycom.h>        /* For control signals */
-#endif
-#include <vte/vte.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "term_config.h"
-#include "files.h"
-#include "search.h"
-#include "serial.h"
-#include "interface.h"
-#include "buffer.h"
-#include "macros.h"
-#include "auto_config.h"
-#include "logging.h"
-
-#include <config.h>
-#include <glib/gi18n.h>
-
-guint id;
-gboolean echo_on;
-gboolean crlfauto_on;
-gboolean timestamp_on = 0;
-GtkWidget *StatusBar;
-GtkWidget *signals[6];
-static GtkWidget *Hex_Box;
-GtkWidget *searchBar;
-GtkWidget *scrolled_window;
-GtkWidget *Fenetre;
-GtkWidget *popup_menu;
-GtkUIManager *ui_manager;
-GtkAccelGroup *shortcuts;
-GtkActionGroup *action_group;
-GtkWidget *display = NULL;
-
-GtkWidget *Text;
-GtkTextBuffer *buffer;
-GtkTextIter iter;
-
-extern struct configuration_port config;
-
-/* Variables for hexadecimal display */
-static gint bytes_per_line = 16;
-static gchar blank_data[128];
-static guint total_bytes;
-static gboolean show_index = FALSE;
-guint virt_col_pos = 0;
-
-/* Local functions prototype */
-void signals_send_break_callback(GtkAction *action, gpointer data);
-void signals_toggle_DTR_callback(GtkAction *action, gpointer data);
-void signals_toggle_RTS_callback(GtkAction *action, gpointer data);
-void signals_close_port(GtkAction *action, gpointer data);
-void signals_open_port(GtkAction *action, gpointer data);
-void help_about_callback(GtkAction *action, gpointer data);
-gboolean Envoie_car(GtkWidget *, GdkEventKey *, gpointer);
-gboolean control_signals_read(void);
-void echo_toggled_callback(GtkAction *action, gpointer data);
-void CR_LF_auto_toggled_callback(GtkAction *action, gpointer data);
-void timestamp_toggled_callback(GtkAction *action, gpointer data);
-void view_radio_callback(GtkAction *action, gpointer data);
-void view_hexadecimal_chars_radio_callback(GtkAction* action, gpointer data);
-void view_index_toggled_callback(GtkAction *action, gpointer data);
-void view_send_hex_toggled_callback(GtkAction *action, gpointer data);
-void initialize_hexadecimal_display(void);
-gboolean Send_Hexadecimal(GtkWidget *, GdkEventKey *, gpointer);
-gboolean pop_message(void);
-static gchar *translate_menu(const gchar *, gpointer);
-static void Got_Input(VteTerminal *, gchar *, guint, gpointer);
-void edit_copy_callback(GtkAction *action, gpointer data);
-void update_copy_sensivity(VteTerminal *terminal, gpointer data);
-void edit_paste_callback(GtkAction *action, gpointer data);
-void edit_find_callback(GtkAction *action);
-void edit_select_all_callback(GtkAction *action, gpointer data);
-
-/* Menu */
-const GtkActionEntry menu_entries[] =
-{
-	/* Toplevel */
-	{"File", NULL, N_("_File")},
-	{"Edit", NULL, N_("_Edit")},
-	{"Log", NULL, N_("_Log")},
-	{"Configuration", NULL, N_("_Configuration")},
-	{"Signals", NULL, N_("Control _signals")},
-	{"View", NULL, N_("_View")},
-	{"ViewHexadecimalChars", NULL, N_("Hexadecimal _chars")},
-	{"Help", NULL, N_("_Help")},
-
-	/* File menu */
-	{"FileExit", GTK_STOCK_QUIT, NULL, "<shift><control>Q", NULL, gtk_main_quit},
-	{"ClearScreen", GTK_STOCK_CLEAR, N_("_Clear screen"), "<shift><control>L", NULL, G_CALLBACK(clear_buffer)},
-	{"ClearScrollback", GTK_STOCK_CLEAR, N_("_Clear scrollback"), "<shift><control>K", NULL, G_CALLBACK(clear_scrollback)},
-	{"SendFile", GTK_STOCK_JUMP_TO, N_("Send _RAW file"), "<shift><control>R", NULL, G_CALLBACK(send_raw_file)},
-	{"SaveFile", GTK_STOCK_SAVE_AS, N_("_Save RAW file"), "", NULL, G_CALLBACK(save_raw_file)},
-
-	/* Edit menu */
-	{"EditCopy", GTK_STOCK_COPY, NULL, "<shift><control>C", NULL, G_CALLBACK(edit_copy_callback)},
-	{"EditPaste", GTK_STOCK_PASTE, NULL, "<shift><control>V", NULL, G_CALLBACK(edit_paste_callback)},
-	{"EditFind", GTK_STOCK_FIND, NULL, "<shift><control>F", NULL, G_CALLBACK(edit_find_callback)},
-	{"EditSelectAll", GTK_STOCK_SELECT_ALL, NULL, "<shift><control>A", NULL, G_CALLBACK(edit_select_all_callback)},
-
-	/* Log Menu */
-	{"LogToFile", GTK_STOCK_MEDIA_RECORD, N_("To file..."), "", NULL, G_CALLBACK(logging_start)},
-	{"LogPauseResume", GTK_STOCK_MEDIA_PAUSE, NULL, "", NULL, G_CALLBACK(logging_pause_resume)},
-	{"LogStop", GTK_STOCK_MEDIA_STOP, NULL, "", NULL, G_CALLBACK(logging_stop)},
-	{"LogClear", GTK_STOCK_CLEAR, NULL, "", NULL, G_CALLBACK(logging_clear)},
-
-	/* Confuguration Menu */
-	{"ConfigPort", GTK_STOCK_PROPERTIES, N_("_Port"), "<shift><control>S", NULL, G_CALLBACK(Config_Port_Fenetre)},
-	{"ConfigTerminal", GTK_STOCK_PREFERENCES, N_("_Main window"), "", NULL, G_CALLBACK(Config_Terminal)},
-	{"Macros", NULL, N_("_Macros"), NULL, NULL, G_CALLBACK(Config_macros)},
-	{"SelectConfig", GTK_STOCK_OPEN, N_("_Load configuration"), "", NULL, G_CALLBACK(select_config_callback)},
-	{"SaveConfig", GTK_STOCK_SAVE_AS, N_("_Save configuration"), "", NULL, G_CALLBACK(save_config_callback)},
-	{"DeleteConfig", GTK_STOCK_DELETE, N_("_Delete configuration"), "", NULL, G_CALLBACK(delete_config_callback)},
-
-	/* Signals Menu */
-	{"SignalsSendBreak", NULL, N_("Send break"), "<shift><control>B", NULL, G_CALLBACK(signals_send_break_callback)},
-	{"SignalsOpenPort", GTK_STOCK_OPEN, N_("_Open Port"), "F5", NULL, G_CALLBACK(signals_open_port)},
-	{"SignalsClosePort", GTK_STOCK_CLOSE, N_("_Close Port"), "F6", NULL, G_CALLBACK(signals_close_port)},
-	{"SignalsDTR", NULL, N_("Toggle DTR"), "F7", NULL, G_CALLBACK(signals_toggle_DTR_callback)},
-	{"SignalsRTS", NULL, N_("Toggle RTS"), "F8", NULL, G_CALLBACK(signals_toggle_RTS_callback)},
-
-	/* About menu */
-	{"HelpAbout", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK(help_about_callback)}
-};
-
-const GtkToggleActionEntry menu_toggle_entries[] =
-{
-	/* Configuration Menu */
-	{"LocalEcho", NULL, N_("Local _echo"), NULL, NULL, G_CALLBACK(echo_toggled_callback), FALSE},
-	{"CRLFauto", NULL, N_("_CR LF auto"), NULL, NULL, G_CALLBACK(CR_LF_auto_toggled_callback), FALSE},
-	{"Timestamp", NULL, N_("Timestamp"), NULL, NULL, G_CALLBACK(timestamp_toggled_callback), FALSE},
-
-	/* View Menu */
-	{"ViewIndex", NULL, N_("Show _index"), NULL, NULL, G_CALLBACK(view_index_toggled_callback), FALSE},
-	{"ViewSendHexData", NULL, N_("_Send hexadecimal data"), NULL, NULL, G_CALLBACK(view_send_hex_toggled_callback), FALSE}
-};
-
-const GtkRadioActionEntry menu_view_radio_entries[] =
-{
-	{"ViewASCII", NULL, N_("_ASCII"), NULL, NULL, ASCII_VIEW},
-	{"ViewHexadecimal", NULL, N_("_Hexadecimal"), NULL, NULL, HEXADECIMAL_VIEW}
-};
-
-const GtkRadioActionEntry menu_hex_chars_length_radio_entries[] =
-{
-	{"ViewHex8", NULL, "_8", NULL, NULL, 8},
-	{"ViewHex10", NULL, "1_0", NULL, NULL, 10},
-	{"ViewHex16", NULL, "_16", NULL, NULL, 16},
-	{"ViewHex24", NULL, "_24", NULL, NULL, 24},
-	{"ViewHex32", NULL, "_32", NULL, NULL, 32}
-};
-
-static const char *ui_description =
-    "<ui>"
-    "  <menubar name='MenuBar'>"
-    "    <menu action='File'>"
-    "      <menuitem action='ClearScreen'/>"
-    "      <menuitem action='ClearScrollback'/>"
-    "      <menuitem action='SendFile'/>"
-    "      <menuitem action='SaveFile'/>"
-    "      <separator/>"
-    "      <menuitem action='FileExit'/>"
-    "    </menu>"
-    "    <menu action='Edit'>"
-    "      <menuitem action='EditCopy'/>"
-    "      <menuitem action='EditPaste'/>"
-    "      <menuitem action='EditFind'/>"
-    "      <separator/>"
-    "      <menuitem action='EditSelectAll'/>"
-    "    </menu>"
-    "    <menu action='Log'>"
-    "      <menuitem action='LogToFile'/>"
-    "      <menuitem action='LogPauseResume'/>"
-    "      <menuitem action='LogStop'/>"
-    "      <menuitem action='LogClear'/>"
-    "    </menu>"
-    "    <menu action='Configuration'>"
-    "      <menuitem action='ConfigPort'/>"
-    "      <menuitem action='ConfigTerminal'/>"
-    "      <menuitem action='LocalEcho'/>"
-    "      <menuitem action='CRLFauto'/>"
-    "      <menuitem action='Timestamp'/>"
-    "      <menuitem action='Macros'/>"
-    "      <separator/>"
-    "      <menuitem action='SelectConfig'/>"
-    "      <menuitem action='SaveConfig'/>"
-    "      <menuitem action='DeleteConfig'/>"
-    "    </menu>"
-    "    <menu action='Signals'>"
-    "      <menuitem action='SignalsSendBreak'/>"
-    "      <menuitem action='SignalsOpenPort'/>"
-    "      <menuitem action='SignalsClosePort'/>"
-    "      <menuitem action='SignalsDTR'/>"
-    "      <menuitem action='SignalsRTS'/>"
-    "    </menu>"
-    "    <menu action='View'>"
-    "      <menuitem action='ViewASCII'/>"
-    "      <menuitem action='ViewHexadecimal'/>"
-    "      <menu action='ViewHexadecimalChars'>"
-    "        <menuitem action='ViewHex8'/>"
-    "        <menuitem action='ViewHex10'/>"
-    "        <menuitem action='ViewHex16'/>"
-    "        <menuitem action='ViewHex24'/>"
-    "        <menuitem action='ViewHex32'/>"
-    "      </menu>"
-    "      <menuitem action='ViewIndex'/>"
-    "      <separator/>"
-    "      <menuitem action='ViewSendHexData'/>"
-    "    </menu>"
-    "    <menu action='Help'>"
-    "      <menuitem action='HelpAbout'/>"
-    "    </menu>"
-    "  </menubar>"
-    "  <popup name='PopupMenu'>"
-    "    <menuitem action='EditCopy'/>"
-    "    <menuitem action='EditPaste'/>"
-    "    <menuitem action='EditFind'/>"
-    "    <separator/>"
-    "    <menuitem action='EditSelectAll'/>"
-    "  </popup>"
-    "</ui>";
-
-static gchar *translate_menu(const gchar *path, gpointer data)
-{
-	return _(path);
-}
-
-void view_send_hex_toggled_callback(GtkAction *action, gpointer data)
-{
-	if(gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)))
-		gtk_widget_show(GTK_WIDGET(Hex_Box));
-	else
-		gtk_widget_hide(GTK_WIDGET(Hex_Box));
-}
-
-void view_index_toggled_callback(GtkAction *action, gpointer data)
-{
-	show_index = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-	set_view(HEXADECIMAL_VIEW);
-}
-
-void view_hexadecimal_chars_radio_callback(GtkAction* action, gpointer data)
-{
-	gint current_value;
-	current_value = gtk_radio_action_get_current_value(GTK_RADIO_ACTION(action));
-
-	bytes_per_line = current_value;
-	set_view(HEXADECIMAL_VIEW);
-}
-
-void set_view(guint type)
-{
-	GtkAction *action;
-	GtkAction *show_index_action;
-	GtkAction *hex_chars_action;
-
-	show_index_action = gtk_action_group_get_action(action_group, "ViewIndex");
-	hex_chars_action = gtk_action_group_get_action(action_group, "ViewHexadecimalChars");
-
-	clear_display();
-	set_clear_func(clear_display);
-	switch(type)
-	{
-	case ASCII_VIEW:
-		action = gtk_action_group_get_action(action_group, "ViewASCII");
-		gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
-		gtk_action_set_sensitive(show_index_action, FALSE);
-		gtk_action_set_sensitive(hex_chars_action, FALSE);
-		total_bytes = 0;
-		set_display_func(put_text);
-		break;
-	case HEXADECIMAL_VIEW:
-		action = gtk_action_group_get_action(action_group, "ViewHexadecimal");
-		gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
-		gtk_action_set_sensitive(show_index_action, TRUE);
-		gtk_action_set_sensitive(hex_chars_action, TRUE);
-		total_bytes = 0;
-		virt_col_pos = 0;
-		set_display_func(put_hexadecimal);
-		break;
-	default:
-		set_display_func(NULL);
-	}
-	write_buffer();
-}
-
-void view_radio_callback(GtkAction *action, gpointer data)
-{
-	gint current_value;
-	current_value = gtk_radio_action_get_current_value(GTK_RADIO_ACTION(action));
-
-	set_view(current_value);
-}
-
-void Set_local_echo(gboolean echo)
-{
-	GtkAction *action;
-
-	echo_on = echo;
-
-	action = gtk_action_group_get_action(action_group, "LocalEcho");
-	if(action)
-		gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), echo_on);
-}
-
-void echo_toggled_callback(GtkAction *action, gpointer data)
-{
-	echo_on = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION(action));
-	configure_echo(echo_on);
-}
-
-void Set_crlfauto(gboolean crlfauto)
-{
-	GtkAction *action;
-
-	crlfauto_on = crlfauto;
-
-	action = gtk_action_group_get_action(action_group, "CRLFauto");
-	if(action)
-		gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), crlfauto_on);
-}
-
-void CR_LF_auto_toggled_callback(GtkAction *action, gpointer data)
-{
-	crlfauto_on = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION(action));
-	configure_crlfauto(crlfauto_on);
-}
-
-void Set_timestamp(gboolean timestamp)
-{
-	GtkAction *action;
-
-	timestamp_on = timestamp;
-
-	action = gtk_action_group_get_action(action_group, "Timestamp");
-	if(action)
-		gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), timestamp_on);
-}
-
-void timestamp_toggled_callback(GtkAction *action, gpointer data)
-{
-	timestamp_on = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION(action));
-	config.timestamp = timestamp_on ? TRUE : FALSE;
-}
-
-void toggle_logging_pause_resume(gboolean currentlyLogging)
-{
-	GtkAction *action;
-
-	action = gtk_action_group_get_action(action_group, "LogPauseResume");
-
-	if (currentlyLogging)
-	{
-		gtk_action_set_label(action, NULL);
-		gtk_action_set_stock_id(action, GTK_STOCK_MEDIA_PAUSE);
-	}
-	else
-	{
-		gtk_action_set_label(action, _("Resume"));
-		gtk_action_set_stock_id(action, GTK_STOCK_MEDIA_PLAY);
-	}
-}
-
-void toggle_logging_sensitivity(gboolean currentlyLogging)
-{
-	GtkAction *action;
-
-	action = gtk_action_group_get_action(action_group, "LogToFile");
-	gtk_action_set_sensitive(action, !currentlyLogging);
-	action = gtk_action_group_get_action(action_group, "LogPauseResume");
-	gtk_action_set_sensitive(action, currentlyLogging);
-	action = gtk_action_group_get_action(action_group, "LogStop");
-	gtk_action_set_sensitive(action, currentlyLogging);
-	action = gtk_action_group_get_action(action_group, "LogClear");
-	gtk_action_set_sensitive(action, currentlyLogging);
-}
-
-gboolean terminal_button_press_callback(GtkWidget *widget,
-                                        GdkEventButton *event,
-                                        gpointer *data)
-{
-
-	if(event->type == GDK_BUTTON_PRESS &&
-	        event->button == 3 &&
-	        (event->state & gtk_accelerator_get_default_mod_mask()) == 0)
-	{
-		gtk_menu_popup(GTK_MENU(popup_menu), NULL, NULL, NULL, NULL,
-		               event->button, event->time);
-		return TRUE;
-	}
-
-	return FALSE;
-}
-
-void terminal_popup_menu_callback(GtkWidget *widget, gpointer data)
-{
-	gtk_menu_popup(GTK_MENU(popup_menu), NULL, NULL, NULL, NULL,
-	               0, gtk_get_current_event_time());
-}
-
-void create_main_window(void)
-{
-	GtkWidget *menu, *main_vbox, *label;
-	GtkWidget *hex_send_entry;
-	GtkAccelGroup *accel_group;
-	GError *error;
-
-	Fenetre = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-
-	shortcuts = gtk_accel_group_new();
-	gtk_window_add_accel_group(GTK_WINDOW(Fenetre), GTK_ACCEL_GROUP(shortcuts));
-
-	g_signal_connect(GTK_WIDGET(Fenetre), "destroy", (GCallback)gtk_main_quit, NULL);
-	g_signal_connect(GTK_WIDGET(Fenetre), "delete_event", (GCallback)gtk_main_quit, NULL);
-
-	Set_window_title("GTKTerm");
-
-	main_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
-	gtk_container_add(GTK_CONTAINER(Fenetre), main_vbox);
-
-	/* Create the UIManager */
-	ui_manager = gtk_ui_manager_new();
-
-	accel_group = gtk_ui_manager_get_accel_group (ui_manager);
-	gtk_window_add_accel_group (GTK_WINDOW (Fenetre), accel_group);
-
-	/* Create the actions */
-	action_group = gtk_action_group_new("MenuActions");
-	gtk_action_group_set_translate_func(action_group, translate_menu, NULL, NULL);
-
-	gtk_action_group_add_actions(action_group, menu_entries,
-	                             G_N_ELEMENTS (menu_entries),
-	                             Fenetre);
-	gtk_action_group_add_toggle_actions(action_group, menu_toggle_entries,
-	                                    G_N_ELEMENTS (menu_toggle_entries),
-	                                    Fenetre);
-	gtk_action_group_add_radio_actions(action_group, menu_view_radio_entries,
-	                                   G_N_ELEMENTS (menu_view_radio_entries),
-	                                   -1, G_CALLBACK(view_radio_callback),
-	                                   Fenetre);
-	gtk_action_group_add_radio_actions(action_group, menu_hex_chars_length_radio_entries,
-	                                   G_N_ELEMENTS (menu_hex_chars_length_radio_entries),
-	                                   16, G_CALLBACK(view_hexadecimal_chars_radio_callback),
-	                                   Fenetre);
-
-	gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
-
-	/* Load the UI */
-	error = NULL;
-	if(!gtk_ui_manager_add_ui_from_string(ui_manager, ui_description, -1, &error))
-	{
-		g_message ("building menus failed: %s", error->message);
-		g_error_free (error);
-		exit (EXIT_FAILURE);
-	}
-
-	menu = gtk_ui_manager_get_widget (ui_manager, "/MenuBar");
-	gtk_box_pack_start(GTK_BOX(main_vbox), menu, FALSE, TRUE, 0);
-
-	/* create vte window */
-	display = vte_terminal_new();
-
-	/* set terminal properties, these could probably be made user configurable */
-	vte_terminal_set_scroll_on_output(VTE_TERMINAL(display), FALSE);
-	vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(display), TRUE);
-	vte_terminal_set_mouse_autohide(VTE_TERMINAL(display), TRUE);
-	vte_terminal_set_backspace_binding(VTE_TERMINAL(display),
-	                                   VTE_ERASE_ASCII_BACKSPACE);
-
-	clear_display();
-
-	searchBar = search_bar_new(GTK_WINDOW(Fenetre), VTE_TERMINAL(display));
-	gtk_box_pack_start(GTK_BOX(main_vbox), GTK_WIDGET(searchBar), FALSE, FALSE, 0);
-
-	/* make vte window scrollable - inspired by gnome-terminal package */
-	scrolled_window = gtk_scrolled_window_new(NULL, gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (display)));
-
-	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
-	                               GTK_POLICY_AUTOMATIC,
-	                               GTK_POLICY_AUTOMATIC);
-
-	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window),
-	                                    GTK_SHADOW_NONE);
-
-	gtk_container_add(GTK_CONTAINER(scrolled_window), GTK_WIDGET(display));
-
-	gtk_box_pack_start(GTK_BOX(main_vbox), scrolled_window, TRUE, TRUE, 0);
-
-	g_signal_connect(G_OBJECT(display), "button-press-event",
-	                 G_CALLBACK(terminal_button_press_callback), NULL);
-
-	g_signal_connect(G_OBJECT(display), "popup-menu",
-	                 G_CALLBACK(terminal_popup_menu_callback), NULL);
-
-	g_signal_connect(G_OBJECT(display), "selection-changed",
-	                 G_CALLBACK(update_copy_sensivity), NULL);
-	update_copy_sensivity(VTE_TERMINAL(display), NULL);
-
-	popup_menu = gtk_ui_manager_get_widget(ui_manager, "/PopupMenu");
-
-	/* set up logging buttons availability */
-	toggle_logging_pause_resume(FALSE);
-	toggle_logging_sensitivity(FALSE);
-
-	/* send hex char box (hidden when not in use) */
-	Hex_Box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
-	label = gtk_label_new(_("Hexadecimal data to send (separator : ';' or space) : "));
-	gtk_box_pack_start(GTK_BOX(Hex_Box), label, FALSE, FALSE, 5);
-	hex_send_entry = gtk_entry_new();
-	g_signal_connect(GTK_WIDGET(hex_send_entry), "activate", (GCallback)Send_Hexadecimal, NULL);
-	gtk_box_pack_start(GTK_BOX(Hex_Box), hex_send_entry, TRUE, TRUE, 5);
-	gtk_box_pack_start(GTK_BOX(main_vbox), Hex_Box, FALSE, TRUE, 2);
-
-	/* status bar */
-	StatusBar = gtk_statusbar_new();
-	gtk_box_pack_start(GTK_BOX(main_vbox), StatusBar, FALSE, FALSE, 0);
-	id = gtk_statusbar_get_context_id(GTK_STATUSBAR(StatusBar), "Messages");
-
-	label = gtk_label_new("RI");
-	gtk_box_pack_end(GTK_BOX(StatusBar), label, FALSE, TRUE, 5);
-	gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE);
-	signals[0] = label;
-
-	label = gtk_label_new("DSR");
-	gtk_box_pack_end(GTK_BOX(StatusBar), label, FALSE, TRUE, 5);
-	signals[1] = label;
-
-	label = gtk_label_new("CD");
-	gtk_box_pack_end(GTK_BOX(StatusBar), label, FALSE, TRUE, 5);
-	signals[2] = label;
-
-	label = gtk_label_new("CTS");
-	gtk_box_pack_end(GTK_BOX(StatusBar), label, FALSE, TRUE, 5);
-	signals[3] = label;
-
-	label = gtk_label_new("RTS");
-	gtk_box_pack_end(GTK_BOX(StatusBar), label, FALSE, TRUE, 5);
-	signals[4] = label;
-
-	label = gtk_label_new("DTR");
-	gtk_box_pack_end(GTK_BOX(StatusBar), label, FALSE, TRUE, 5);
-	signals[5] = label;
-
-	g_signal_connect_after(GTK_WIDGET(display), "commit", G_CALLBACK(Got_Input), NULL);
-
-	g_timeout_add(POLL_DELAY, (GSourceFunc)control_signals_read, NULL);
-
-	gtk_window_set_default_size(GTK_WINDOW(Fenetre), 750, 550);
-	gtk_widget_show_all(Fenetre);
-	search_bar_hide(searchBar);
-	gtk_widget_hide(GTK_WIDGET(Hex_Box));
-}
-
-void initialize_hexadecimal_display(void)
-{
-	total_bytes = 0;
-	memset(blank_data, ' ', 128);
-	blank_data[bytes_per_line * 3 + 5] = 0;
-}
-
-void put_hexadecimal(gchar *string, guint size)
-{
-	static gchar data[128];
-	static gchar data_byte[6];
-	gint i = 0;
-
-	if(size == 0)
-		return;
-
-	while(i < size)
-	{
-		while(gtk_events_pending()) gtk_main_iteration();
-
-		/* Print hexadecimal characters */
-		data[0] = 0;
-
-		while(virt_col_pos < bytes_per_line && i < size)
-		{
-			gint avance=0;
-			gchar ascii[1];
-
-			if(show_index)
-			{
-				/* First byte on line */
-				if(virt_col_pos == 0)
-				{
-					sprintf(data, "%6d: ", total_bytes);
-					vte_terminal_feed(VTE_TERMINAL(display), data, strlen(data));
-				}
-			}
-
-			sprintf(data_byte, "%02X ", (guchar)string[i]);
-			log_chars(data_byte, 3);
-			vte_terminal_feed(VTE_TERMINAL(display), data_byte, 3);
-
-			avance = (bytes_per_line - virt_col_pos) * 3 + virt_col_pos + 2;
-			/* Move forward */
-			sprintf(data_byte, "%c[%dC", 27, avance);
-			vte_terminal_feed(VTE_TERMINAL(display), data_byte, strlen(data_byte));
-
-			/* Print ascii characters */
-			ascii[0] = (string[i] > 0x1F) ? string[i] : '.';
-			vte_terminal_feed(VTE_TERMINAL(display), ascii, 1);
-
-			/* Move backward */
-			sprintf(data_byte, "%c[%dD", 27, avance + 1);
-			vte_terminal_feed(VTE_TERMINAL(display), data_byte, strlen(data_byte));
-
-			if(virt_col_pos == bytes_per_line / 2 - 1)
-				vte_terminal_feed(VTE_TERMINAL(display), "- ", strlen("- "));
-
-			virt_col_pos++;
-			i++;
-
-			/* End of line ? */
-			if(virt_col_pos == bytes_per_line)
-			{
-				vte_terminal_feed(VTE_TERMINAL(display), "\r\n", 2);
-				total_bytes += virt_col_pos;
-				virt_col_pos = 0;
-			}
-
-		}
-
-	}
-}
-
-void put_text(gchar *string, guint size)
-{
-	log_chars(string, size);
-	vte_terminal_feed(VTE_TERMINAL(display), string, size);
-}
-
-gint send_serial(gchar *string, gint len)
-{
-	gint bytes_written;
-
-	bytes_written = Send_chars(string, len);
-	if(bytes_written > 0)
-	{
-		if(echo_on)
-			put_chars(string, bytes_written, crlfauto_on);
-	}
-
-	return bytes_written;
-}
-
-
-static void Got_Input(VteTerminal *widget, gchar *text, guint length, gpointer ptr)
-{
-	send_serial(text, length);
-}
-
-gboolean Envoie_car(GtkWidget *widget, GdkEventKey *event, gpointer pointer)
-{
-	if(g_utf8_validate(event->string, 1, NULL))
-		send_serial(event->string, 1);
-
-	return FALSE;
-}
-
-
-void help_about_callback(GtkAction *action, gpointer data)
-{
-	gchar *authors[] = {"Julien Schimtt", "Zach Davis", "Florian Euchner", "Stephan Enderlein",
-			    "Kevin Picot", NULL};
-	gchar *comments_program = _("GTKTerm is a simple GTK+ terminal used to communicate with the serial port.");
-	gchar *comments[256];
-	GError *error = NULL;
-	GdkPixbuf *logo = NULL;
-
-	logo = gdk_pixbuf_new_from_resource ("/org/gtk/gtkterm/gtkterm_64x64.png", &error);
-	g_sprintf(comments, "%s\n\n%s", RELEASE_DATE, comments_program);;
-
-	gtk_show_about_dialog(GTK_WINDOW(Fenetre),
-	                      "program-name", "GTKTerm",
-	                      "logo", logo,
-	                      "version", VERSION,
-	                      "comments", comments,
-	                      "copyright", "Copyright © Julien Schimtt",
-	                      "authors", authors,
-	                      "website", "https://github.com/Jeija/gtkterm",
-	                      "website-label", "https://github.com/Jeija/gtkterm",
-	                      "license-type", GTK_LICENSE_LGPL_3_0,
-	                      NULL);
-}
-
-void show_control_signals(int stat)
-{
-	if(stat & TIOCM_RI)
-		gtk_widget_set_sensitive(GTK_WIDGET(signals[0]), TRUE);
-	else
-		gtk_widget_set_sensitive(GTK_WIDGET(signals[0]), FALSE);
-	if(stat & TIOCM_DSR)
-		gtk_widget_set_sensitive(GTK_WIDGET(signals[1]), TRUE);
-	else
-		gtk_widget_set_sensitive(GTK_WIDGET(signals[1]), FALSE);
-	if(stat & TIOCM_CD)
-		gtk_widget_set_sensitive(GTK_WIDGET(signals[2]), TRUE);
-	else
-		gtk_widget_set_sensitive(GTK_WIDGET(signals[2]), FALSE);
-	if(stat & TIOCM_CTS)
-		gtk_widget_set_sensitive(GTK_WIDGET(signals[3]), TRUE);
-	else
-		gtk_widget_set_sensitive(GTK_WIDGET(signals[3]), FALSE);
-	if(stat & TIOCM_RTS)
-		gtk_widget_set_sensitive(GTK_WIDGET(signals[4]), TRUE);
-	else
-		gtk_widget_set_sensitive(GTK_WIDGET(signals[4]), FALSE);
-	if(stat & TIOCM_DTR)
-		gtk_widget_set_sensitive(GTK_WIDGET(signals[5]), TRUE);
-	else
-		gtk_widget_set_sensitive(GTK_WIDGET(signals[5]), FALSE);
-}
-
-void signals_send_break_callback(GtkAction *action, gpointer data)
-{
-	sendbreak();
-	Put_temp_message(_("Break signal sent!"), 800);
-}
-
-void signals_toggle_DTR_callback(GtkAction *action, gpointer data)
-{
-	Set_signals(0);
-}
-
-void signals_toggle_RTS_callback(GtkAction *action, gpointer data)
-{
-	Set_signals(1);
-}
-
-void signals_close_port(GtkAction *action, gpointer data)
-{
-	interface_close_port();
-}
-
-void signals_open_port(GtkAction *action, gpointer data)
-{
-	interface_open_port();
-}
-
-gboolean control_signals_read(void)
-{
-	int state;
-
-	state = lis_sig();
-	if(state >= 0)
-		show_control_signals(state);
-
-	return TRUE;
-}
-
-void Set_status_message(gchar *msg)
-{
-	gtk_statusbar_pop(GTK_STATUSBAR(StatusBar), id);
-	gtk_statusbar_push(GTK_STATUSBAR(StatusBar), id, msg);
-}
-
-void Set_window_title(gchar *msg)
-{
-	gchar* header = g_strdup_printf("GTKTerm - %s", msg);
-	gtk_window_set_title(GTK_WINDOW(Fenetre), header);
-	g_free(header);
-}
-
-void interface_open_port(void)
-{
-	Config_port();
-
-	gchar *message;
-	message = get_port_string();
-	Set_status_message(message);
-	Set_window_title(message);
-	g_free(message);
-}
-
-void interface_close_port(void)
-{
-	Close_port();
-
-	gchar *message;
-	message = get_port_string();
-	Set_status_message(message);
-	Set_window_title(message);
-	g_free(message);
-}
-
-void show_message(gchar *message, gint type_msg)
-{
-	GtkWidget *Fenetre_msg;
-
-	if(type_msg==MSG_ERR)
-	{
-		Fenetre_msg = gtk_message_dialog_new(GTK_WINDOW(Fenetre),
-		                                     GTK_DIALOG_DESTROY_WITH_PARENT,
-		                                     GTK_MESSAGE_ERROR,
-		                                     GTK_BUTTONS_OK,
-		                                     message, NULL);
-	}
-	else if(type_msg==MSG_WRN)
-	{
-		Fenetre_msg = gtk_message_dialog_new(GTK_WINDOW(Fenetre),
-		                                     GTK_DIALOG_DESTROY_WITH_PARENT,
-		                                     GTK_MESSAGE_WARNING,
-		                                     GTK_BUTTONS_OK,
-		                                     message, NULL);
-	}
-	else
-		return;
-
-	gtk_dialog_run(GTK_DIALOG(Fenetre_msg));
-	gtk_widget_destroy(Fenetre_msg);
-}
-
-gboolean Send_Hexadecimal(GtkWidget *widget, GdkEventKey *event, gpointer pointer)
-{
-	guint i;
-	gchar *text, *message, **tokens, *buff;
-	guint scan_val;
-
-	text = (gchar *)gtk_entry_get_text(GTK_ENTRY(widget));
-
-	if(strlen(text) == 0)
-	{
-		message = g_strdup_printf(_("0 byte(s) sent!"));
-		Put_temp_message(message, 1500);
-		gtk_entry_set_text(GTK_ENTRY(widget), "");
-		g_free(message);
-		return FALSE;
-	}
-
-	tokens = g_strsplit_set(text, " ;", -1);
-	buff = g_malloc(g_strv_length(tokens));
-
-	for(i = 0; tokens[i] != NULL; i++)
-	{
-		if(sscanf(tokens[i], "%02X", &scan_val) != 1)
-		{
-			Put_temp_message(_("Improper formatted hex input, 0 bytes sent!"),
-			                 1500);
-			g_free(buff);
-			return FALSE;
-		}
-		buff[i] = scan_val;
-	}
-
-	send_serial(buff, i);
-	g_free(buff);
-
-	message = g_strdup_printf(_("%d byte(s) sent!"), i);
-	Put_temp_message(message, 2000);
-	gtk_entry_set_text(GTK_ENTRY(widget), "");
-	g_strfreev(tokens);
-
-	return FALSE;
-}
-
-void Put_temp_message(const gchar *text, gint time)
-{
-	/* time in ms */
-	gtk_statusbar_push(GTK_STATUSBAR(StatusBar), id, text);
-	g_timeout_add(time, (GSourceFunc)pop_message, NULL);
-}
-
-gboolean pop_message(void)
-{
-	gtk_statusbar_pop(GTK_STATUSBAR(StatusBar), id);
-
-	return FALSE;
-}
-
-void clear_display(void)
-{
-	initialize_hexadecimal_display();
-	if(display)
-		vte_terminal_reset(VTE_TERMINAL(display), TRUE, TRUE);
-}
-
-void edit_copy_callback(GtkAction *action, gpointer data)
-{
-	vte_terminal_copy_clipboard(VTE_TERMINAL(display));
-}
-
-void update_copy_sensivity(VteTerminal *terminal, gpointer data)
-{
-	GtkAction *action;
-	gboolean can_copy;
-
-	can_copy = vte_terminal_get_has_selection(VTE_TERMINAL(terminal));
-
-	action = gtk_action_group_get_action(action_group, "EditCopy");
-	gtk_action_set_sensitive(action, can_copy);
-}
-
-void edit_paste_callback(GtkAction *action, gpointer data)
-{
-	vte_terminal_paste_clipboard(VTE_TERMINAL(display));
-}
-
-void edit_find_callback(GtkAction *action)
-{
-	if (gtk_widget_is_visible(searchBar))
-		search_bar_hide(searchBar);
-	else
-		search_bar_show(searchBar);
-}
-
-void edit_select_all_callback(GtkAction *action, gpointer data)
-{
-	vte_terminal_select_all(VTE_TERMINAL(display));
-}
diff --git a/src/interface.h b/src/interface.h
deleted file mode 100644
index 34dbe20..0000000
--- a/src/interface.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/***********************************************************************/
-/* interface.h                                                           */
-/* ---------                                                           */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Functions for the management of the GUI for the main window    */
-/*      - Header file -                                                */
-/*                                                                     */
-/***********************************************************************/
-
-#ifndef WIDGETS_H_
-#define WIDGETS_H_
-
-#define MSG_WRN 0
-#define MSG_ERR 1
-
-#define ASCII_VIEW 0
-#define HEXADECIMAL_VIEW 1
-
-void create_main_window(void);
-void Set_status_message(gchar *);
-void put_text(gchar *, guint);
-void put_hexadecimal(gchar *, guint);
-void Set_local_echo(gboolean);
-void show_message(gchar *, gint);
-void clear_display(void);
-void set_view(guint);
-void Set_crlfauto(gboolean crlfauto);
-void Set_timestamp(gboolean timestamp);
-gint send_serial(gchar *, gint);
-void Put_temp_message(const gchar *, gint);
-void Set_window_title(gchar *msg);
-void interface_close_port(void);
-void interface_open_port(void);
-
-void toggle_logging_pause_resume(gboolean currentlyLogging);
-void toggle_logging_sensitivity(gboolean currentlyLogging);
-
-extern GtkWidget *Fenetre;
-extern GtkWidget *StatusBar;
-extern guint id;
-extern GtkWidget *Text;
-extern GtkAccelGroup *shortcuts;
-
-#endif
diff --git a/src/logging.c b/src/logging.c
deleted file mode 100644
index 4ff7f6c..0000000
--- a/src/logging.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/***********************************************************************/
-/* logging.h                                                           */
-/* ---------                                                           */
-/*                           GTKTerm Software                          */
-/*                                 (c)                                 */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Log all data that GTKTerm sees to a file                       */
-/*                                                                     */
-/*   ChangeLog                                                         */
-/*       0.99.7 - Logging added (Thanks to Brian Beattie)              */
-/*                                                                     */
-/***********************************************************************/
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <glib.h>
-
-#include "interface.h"
-#include "serial.h"
-#include "buffer.h"
-#include "logging.h"
-
-#include <config.h>
-#include <glib/gi18n.h>
-
-#define MAX_WRITE_ATTEMPTS 5
-
-static gboolean	  Logging;
-static gchar     *LoggingFileName;
-static FILE      *LoggingFile;
-static gchar     *logfile_default = NULL;
-
-static gint OpenLogFile(gchar *filename)
-{
-	gchar *str;
-
-	// open file and start logging
-	if(!filename || (strcmp(filename, "") == 0))
-	{
-		str = g_strdup_printf(_("Filename error\n"));
-		show_message(str, MSG_ERR);
-		g_free(str);
-		g_free(filename);
-		return FALSE;
-	}
-
-	if(LoggingFile != NULL)
-	{
-		fclose(LoggingFile);
-		LoggingFile = NULL;
-		Logging = FALSE;
-	}
-
-	LoggingFileName = filename;
-
-	LoggingFile = fopen(LoggingFileName, "a");
-	if(LoggingFile == NULL)
-	{
-		str = g_strdup_printf(_("Cannot open file %s: %s\n"), LoggingFileName, strerror(errno));
-
-		show_message(str, MSG_ERR);
-		g_free(str);
-		g_free(LoggingFileName);
-	}
-	else
-	{
-		logfile_default = g_strdup(LoggingFileName);
-		Logging = TRUE;
-	}
-
-	return FALSE;
-}
-
-void logging_start(GtkAction *action, gpointer data)
-{
-	GtkWidget *file_select;
-	gint retval;
-
-	file_select = gtk_file_chooser_dialog_new(_("Log file selection"), GTK_WINDOW(Fenetre),
-	              GTK_FILE_CHOOSER_ACTION_SAVE,
-	              GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-	              GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
-	gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(file_select), TRUE);
-
-	if(logfile_default != NULL)
-	{
-		gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(file_select), logfile_default);
-	}
-
-	retval = gtk_dialog_run(GTK_DIALOG(file_select));
-	if(retval == GTK_RESPONSE_OK)
-	{
-		OpenLogFile(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_select)));
-	}
-
-	gtk_widget_destroy(file_select);
-
-	toggle_logging_sensitivity(Logging);
-	toggle_logging_pause_resume(Logging);
-}
-
-void logging_clear(void)
-{
-	if(LoggingFile == NULL)
-	{
-		return;
-	}
-
-	//Reopening with "w" will truncate the file
-	LoggingFile = freopen(LoggingFileName, "w", LoggingFile);
-
-	if (LoggingFile == NULL)
-	{
-		gchar *str = g_strdup_printf(_("Cannot open file %s: %s\n"), LoggingFileName, strerror(errno));
-		show_message(str, MSG_ERR);
-		g_free(str);
-		g_free(LoggingFileName);
-	}
-}
-
-void logging_pause_resume(void)
-{
-	if(LoggingFile == NULL)
-	{
-		return;
-	}
-	if(Logging == TRUE)
-	{
-		Logging = FALSE;
-	}
-	else
-	{
-		Logging = TRUE;
-	}
-	toggle_logging_pause_resume(Logging);
-}
-
-void logging_stop(void)
-{
-	if(LoggingFile == NULL)
-	{
-		return;
-	}
-
-	fclose(LoggingFile);
-	LoggingFile = NULL;
-	Logging = FALSE;
-	g_free(LoggingFileName);
-	LoggingFileName = NULL;
-
-	toggle_logging_sensitivity(Logging);
-	toggle_logging_pause_resume(Logging);
-}
-
-void log_chars(gchar *chars, guint size)
-{
-	guint writeAttempts = 0;
-	guint bytesWritten = 0;
-
-	/* if we are not logging exit */
-	if(LoggingFile == NULL || Logging == FALSE)
-	{
-		return;
-	}
-
-	while (bytesWritten < size)
-	{
-		if (writeAttempts < MAX_WRITE_ATTEMPTS)
-		{
-			bytesWritten += fwrite(&chars[bytesWritten], 1,
-			                       size-bytesWritten, LoggingFile);
-		}
-		else
-		{
-			show_message(_("Failed to log data\n"), MSG_ERR);
-			return;
-		}
-	}
-
-	fflush(LoggingFile);
-}
diff --git a/src/logging.h b/src/logging.h
deleted file mode 100644
index 0856342..0000000
--- a/src/logging.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/***********************************************************************/
-/* logging.h                                                           */
-/* ---------                                                           */
-/*                           GTKTerm Software                          */
-/*                                 (c)                                 */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Log all data that GTKTerm sees to a file                       */
-/*      - Header File -                                                */
-/***********************************************************************/
-
-#ifndef LOGGING_H_
-#define LOGGING_H_
-
-void logging_start(GtkAction *action, gpointer data);
-void logging_pause_resume(void);
-void logging_stop(void);
-void logging_clear(void);
-void log_chars(gchar *chars, guint size);
-
-#endif /* LOGGING_H_ */
diff --git a/src/macros.c b/src/macros.c
index de4b349..217e74d 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -1,19 +1,20 @@
-/***********************************************************************/
-/* macros.c                                                            */
-/* --------                                                            */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Functions for the management of the macros                     */
-/*                                                                     */
-/*   ChangeLog                                                         */
-/*      - 0.99.2 : Internationalization                                */
-/*      - 0.99.0 : file creation by Julien                             */
-/*                                                                     */
-/***********************************************************************/
+/***********************************************************************
+ * macros.c                                                         
+ * --------                                       
+ *           GTKTerm Software                        
+ *                      (c) Julien Schmitt         
+ *                                              
+ * -------------------------------------------------------------------
+ *                                            
+ *   \brief Purpose                                        
+ *      	Functions for the management of the macros  
+ *                                              
+ *   ChangeLog
+ *		- 2.0	 : Add conversion functions to/from string arrays                       
+ *      - 0.99.2 : Internationalization                 
+ *      - 0.99.0 : file creation by Julien
+ *                                                         
+ ***********************************************************************/
 
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
@@ -22,12 +23,13 @@
 #include <string.h>
 #include <stdio.h>
 
-#include "interface.h"
 #include "macros.h"
 
 #include <config.h>
 #include <glib/gi18n.h>
 
+/**\todo: Migrate to GObject */
+
 enum
 {
 	COLUMN_SHORTCUT,
@@ -36,490 +38,103 @@ enum
 };
 
 macro_t *macros = NULL;
-static GtkWidget *window = NULL;
 
-macro_t *get_shortcuts(gint *size)
-{
-	gint i = 0;
+// Number of macro's
+int nr_of_macros = 0;
 
-	if(macros != NULL)
-	{
-		while(macros[i].shortcut != NULL)
-			i++;
-	}
-	*size = i;
-	return macros;
+int macro_count () {
+	return (nr_of_macros);
 }
 
+//! Convert the array of strings to macros
+void convert_string_to_macros (char **string_list, int size) {
+	char **strptr = string_list;
+	
+	// Remove existing macro's
+	remove_shortcuts ();
 
-static void shortcut_callback(gpointer *number)
-{
-	gchar *string;
-	gchar *str;
-	gint i, length;
-	guchar a;
-	guint val_read;
+	if (macros)
+		g_free(macros);
 
-	string = macros[(long)number].action;
-	length = strlen(string);
+	// Allocate memory size. To be sure we use the
+	// size of the array. We only need half.
+	macros = g_malloc(size * sizeof(macro_t));
+	nr_of_macros = 0;
 
-	for(i = 0; i < length; i++)
-	{
-		if(string[i] == '\\')
-		{
-			if(g_unichar_isdigit((gunichar)string[i + 1]))
-			{
-				if((string[i + 1] == '0') && (string[i + 2] != 0))
-				{
-					if(g_unichar_isxdigit((gunichar)string[i + 3]))
-					{
-						str = &string[i + 2];
-						i += 3;
-					}
-					else
-					{
-						str = &string[i + 1];
-						if(g_unichar_isxdigit((gunichar)string[i + 2]))
-							i += 2;
-						else
-							i++;
-					}
-				}
-				else
-				{
-					str = &string[i + 1];
-					if(g_unichar_isxdigit((gunichar)string[i + 2]))
-						i += 2;
-					else
-						i++;
-				}
-				if(sscanf(str, "%02X", &val_read) == 1)
-					a = (guchar)val_read;
-				else
-					a = '\\';
-			}
-			else
-			{
-				switch(string[i + 1])
-				{
-				case 'a':
-					a = '\a';
-					break;
-				case 'b':
-					a = '\b';
-					break;
-				case 't':
-					a = '\t';
-					break;
-				case 'n':
-					a = '\n';
-					break;
-				case 'v':
-					a = '\v';
-					break;
-				case 'f':
-					a = '\f';
-					break;
-				case 'r':
-					a = '\r';
-					break;
-				case '\\':
-					a = '\\';
-					break;
-				default:
-					a = '\\';
-					i--;
-					break;
-				}
-				i++;
-			}
-			send_serial((gchar*)&a, 1);
-		}
-		else
-		{
-			send_serial(&string[i], 1);
-		}
+	// Copy into macro untill end of array
+	while  (*strptr) {
+		macros[nr_of_macros].shortcut = g_strdup(*strptr++);
+		macros[nr_of_macros++].action = g_strdup(*strptr++);
 	}
-
-	str = g_strdup_printf(_("Macro \"%s\" sent !"), macros[(long)number].shortcut);
-	Put_temp_message(str, 800);
-	g_free(str);
 }
 
-void create_shortcuts(macro_t *macro, gint size)
-{
-	macros = g_malloc((size + 1) * sizeof(macro_t));
-	if(macros != NULL)
-	{
-		memcpy(macros, macro, size * sizeof(macro_t));
-		macros[size].shortcut = NULL;
-		macros[size].action = NULL;
-	}
-	else
-		perror("malloc");
-}
+//! Convert the in memory macros to an array of strings
+//! for storage in file
+int convert_macros_to_string (char **string_list) {
+	char **strptr = string_list;
 
-void add_shortcuts(void)
-{
-	long i = 0;
-	guint acc_key;
-	GdkModifierType mod;
+	for (int i = 0; i < nr_of_macros; i++) {
+		*strptr++ = macros[i].shortcut;
+		*strptr++ = macros[i].action;
+	}
 
-	if(macros == NULL)
-		return;
+	//! Must be NULL terminated
+	*strptr++ = NULL;
 
-	while(macros[i].shortcut != NULL)
-	{
-		macros[i].closure = g_cclosure_new_swap(G_CALLBACK(shortcut_callback), (gpointer)i, NULL);
-		gtk_accelerator_parse(macros[i].shortcut, &acc_key, &mod);
-		if(acc_key != 0)
-			gtk_accel_group_connect(shortcuts, acc_key, mod, GTK_ACCEL_MASK, macros[i].closure);
-		i++;
-	}
+	//! Number of strings is 2x the macros (shortcut and action)
+	return (nr_of_macros * 2);
 }
 
 static void macros_destroy(void)
 {
-	gint i = 0;
+	int i = 0;
 
 	if(macros == NULL)
 		return;
 
+	//! Free all macro-member memory
 	while(macros[i].shortcut != NULL)
 	{
 		g_free(macros[i].shortcut);
 		g_free(macros[i].action);
 		/*
-		g_closure_unref(macros[i].closure);
+		    g_closure_unref(macros[i].closure);
 		*/
 		i++;
 	}
+
 	g_free(macros);
 	macros = NULL;
 }
 
-void remove_shortcuts(void)
-{
-	gint i = 0;
-
-	if(macros == NULL)
-		return;
-
-	while(macros[i].shortcut != NULL)
-	{
-		gtk_accel_group_disconnect(shortcuts, macros[i].closure);
-		i++;
-	}
-
-	macros_destroy();
-}
-
-static GtkTreeModel *create_model(void)
+macro_t *get_shortcuts(int *size)
 {
-	gint i = 0;
-	GtkListStore *store;
-	GtkTreeIter iter;
+	int i = 0;
 
-	/* create list store */
-	store = gtk_list_store_new (NUM_COLUMNS,
-	                            G_TYPE_STRING,
-	                            G_TYPE_STRING,
-	                            G_TYPE_BOOLEAN,
-	                            G_TYPE_BOOLEAN);
-
-	/* add data to the list store */
 	if(macros != NULL)
 	{
-		while(1)
-		{
-			if(macros[i].shortcut == NULL)
-				break;
-			gtk_list_store_append (store, &iter);
-			gtk_list_store_set (store, &iter,
-			                    COLUMN_SHORTCUT, macros[i].shortcut,
-			                    COLUMN_ACTION, macros[i].action,
-			                    -1);
-			i++;
-		}
-	}
-
-	return GTK_TREE_MODEL(store);
-}
-
-static gboolean
-shortcut_edited (GtkCellRendererText *cell,
-                 const gchar         *path_string,
-                 const gchar         *new_text,
-                 gpointer             data)
-{
-	GtkTreeModel *model = (GtkTreeModel *)data;
-	GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
-	GtkTreeIter iter;
-
-	gtk_tree_model_get_iter(model, &iter, path);
-
-	gtk_list_store_set(GTK_LIST_STORE(model), &iter, COLUMN_ACTION, new_text, -1);
-	gtk_tree_path_free (path);
-
-	return TRUE;
-}
-
-static void
-add_columns (GtkTreeView *treeview)
-{
-	GtkCellRenderer *renderer;
-	GtkTreeViewColumn *column;
-	GtkTreeModel *model = gtk_tree_view_get_model (treeview);
-
-	renderer = gtk_cell_renderer_text_new ();
-	column = gtk_tree_view_column_new_with_attributes (_("Shortcut"),
-	         renderer,
-	         "text",
-	         COLUMN_SHORTCUT,
-	         NULL);
-	gtk_tree_view_column_set_sort_column_id (column, COLUMN_SHORTCUT);
-	gtk_tree_view_append_column (treeview, column);
-
-	renderer = gtk_cell_renderer_text_new ();
-	g_signal_connect (renderer, "edited", G_CALLBACK(shortcut_edited), model);
-	column = gtk_tree_view_column_new_with_attributes ("Action", renderer, "text", COLUMN_ACTION, NULL);
-	g_object_set(G_OBJECT(renderer), "editable", TRUE, NULL);
-	gtk_tree_view_column_set_sort_column_id (column, COLUMN_ACTION);
-	gtk_tree_view_append_column (treeview, column);
-}
-
-static gint Add_shortcut(GtkWidget *button, gpointer pointer)
-{
-	GtkTreeIter iter;
-	GtkTreeModel *model = (GtkTreeModel *)pointer;
-
-
-	gtk_list_store_append(GTK_LIST_STORE(model), &iter);
-
-	gtk_list_store_set(GTK_LIST_STORE(model), &iter, COLUMN_SHORTCUT, "None", -1);
-
-	return FALSE;
-}
-
-static gboolean Delete_shortcut(GtkWidget *button, gpointer pointer)
-{
-	GtkTreeIter iter;
-	GtkTreeView *treeview = (GtkTreeView *)pointer;
-	GtkTreeModel *model = gtk_tree_view_get_model (treeview);
-	GtkTreeSelection *selection = gtk_tree_view_get_selection (treeview);
-
-	if (gtk_tree_selection_get_selected (selection, NULL, &iter))
-	{
-		gint i;
-		GtkTreePath *path;
-
-		path = gtk_tree_model_get_path(model, &iter);
-		i = gtk_tree_path_get_indices(path)[0];
-		gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
-
-		gtk_tree_path_free (path);
-	}
-
-	return FALSE;
-}
-
-static gboolean Save_shortcuts(GtkWidget *button, gpointer pointer)
-{
-	GtkTreeIter iter;
-	GtkTreeView *treeview = (GtkTreeView *)pointer;
-	GtkTreeModel *model = gtk_tree_view_get_model (treeview);
-	gint i = 0;
-
-	remove_shortcuts();
-
-	if(gtk_tree_model_get_iter_first(model, &iter))
-	{
-		do
-		{
+		while(macros[i].shortcut != NULL)
 			i++;
-		}
-		while(gtk_tree_model_iter_next(model, &iter));
-
-		gtk_tree_model_get_iter_first(model, &iter);
-
-		macros = g_malloc((i + 1) * sizeof(macro_t));
-		i = 0;
-		if(macros != NULL)
-		{
-			do
-			{
-				gtk_tree_model_get(model, &iter, COLUMN_SHORTCUT, &(macros[i].shortcut), \
-				                   COLUMN_ACTION, &(macros[i].action), \
-				                   -1);
-				i++;
-			}
-			while(gtk_tree_model_iter_next(model, &iter));
-
-			macros[i].shortcut = NULL;
-			macros[i].action = NULL;
-		}
 	}
 
-	add_shortcuts();
-
-	return FALSE;
+	*size = i;
+	
+	return macros;
 }
 
-static gboolean key_pressed(GtkWidget *window, GdkEventKey *key, gpointer pointer)
+void remove_shortcuts(void)
 {
-	GtkTreeIter iter;
-	GtkTreeView *treeview = (GtkTreeView *)pointer;
-	GtkTreeModel *model = gtk_tree_view_get_model (treeview);
-	GtkTreeSelection *selection = gtk_tree_view_get_selection (treeview);
-	gchar *str = NULL;
+	int i = 0;
 
-	switch(key->keyval)
-	{
-	case GDK_KEY_Shift_L:
-	case GDK_KEY_Shift_R:
-	case GDK_KEY_Control_L:
-	case GDK_KEY_Control_R:
-	case GDK_KEY_Caps_Lock:
-	case GDK_KEY_Shift_Lock:
-	case GDK_KEY_Meta_L:
-	case GDK_KEY_Meta_R:
-	case GDK_KEY_Alt_L:
-	case GDK_KEY_Alt_R:
-	case GDK_KEY_Super_L:
-	case GDK_KEY_Super_R:
-	case GDK_KEY_Hyper_L:
-	case GDK_KEY_Hyper_R:
-	case GDK_KEY_Mode_switch:
-		return FALSE;
-	default:
-		break;
-	}
+	if(macros == NULL)
+		return;
 
-	if(gtk_tree_selection_get_selected(selection, NULL, &iter))
+	while(macros[i].shortcut != NULL)
 	{
-		gint i;
-		GtkTreePath *path;
-
-		path = gtk_tree_model_get_path(model, &iter);
-		i = gtk_tree_path_get_indices(path)[0];
-		str = gtk_accelerator_name(key->keyval, key->state & ~GDK_MOD2_MASK);
-		gtk_list_store_set(GTK_LIST_STORE (model), &iter, COLUMN_SHORTCUT, str, -1);
-
-		gtk_tree_path_free(path);
-		g_free(str);
-
-		g_signal_handlers_disconnect_by_func(window, G_CALLBACK(key_pressed), pointer);
+//		gtk_accel_group_disconnect(shortcuts, macros[i].closure);
+		i++;
 	}
-	return FALSE;
-}
-
-
-static gboolean Capture_shortcut(GtkWidget *button, gpointer pointer)
-{
-	g_signal_connect_after(window, "key_press_event", G_CALLBACK(key_pressed), pointer);
-
-	return FALSE;
-}
-
-static gboolean Help_screen(GtkWidget *button, gpointer pointer)
-{
-	GtkWidget *Dialog;
-
-	Dialog = gtk_message_dialog_new(pointer,
-	                                GTK_DIALOG_DESTROY_WITH_PARENT,
-	                                GTK_MESSAGE_INFO,
-	                                GTK_BUTTONS_CLOSE,
-	                                _("The \"action\" field of a macro is the data to be sent on the port. Text can be entered, but also special chars, like \\n, \\t, \\r, etc. You can also enter hexadecimal data preceded by a '\\'. The hexadecimal data should not begin with a letter (eg. use \\0FF and not \\FF)\nExamples :\n\t\"Hello\\n\" sends \"Hello\" followed by a Line Feed\n\t\"Hello\\0A\" does the same thing but the LF is entered in hexadecimal"));
-
-	gtk_dialog_run(GTK_DIALOG (Dialog));
-	gtk_widget_destroy(Dialog);
-
-	return FALSE;
-}
-
-
-void Config_macros(GtkAction *action, gpointer data)
-{
-	GtkWidget *vbox, *hbox;
-	GtkWidget *sw;
-	GtkTreeModel *model;
-	GtkWidget *treeview;
-	GtkWidget *button;
-	GtkWidget *separator;
-
-	/* create window, etc */
-	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-	gtk_window_set_title (GTK_WINDOW (window), _("Configure Macros"));
-
-	g_signal_connect (window, "destroy",
-	                  G_CALLBACK (gtk_widget_destroyed), &window);
-	gtk_container_set_border_width (GTK_CONTAINER (window), 8);
-
-	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
-	gtk_container_add (GTK_CONTAINER (window), vbox);
-
-	sw = gtk_scrolled_window_new (NULL, NULL);
-	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
-	                                     GTK_SHADOW_ETCHED_IN);
-	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
-	                                GTK_POLICY_NEVER,
-	                                GTK_POLICY_AUTOMATIC);
-	gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
-
-	/* create tree model */
-	model = create_model ();
-
-	/* create tree view */
-	treeview = gtk_tree_view_new_with_model (model);
-	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
-	gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview),
-	                                 COLUMN_SHORTCUT);
-
-	g_object_unref (model);
-
-	gtk_container_add (GTK_CONTAINER (sw), treeview);
-
-	/* add columns to the tree view */
-	add_columns (GTK_TREE_VIEW (treeview));
-
-	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
-	gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
-	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
-	button = gtk_button_new_with_mnemonic (_("_Add"));
-	g_signal_connect(button, "clicked", G_CALLBACK(Add_shortcut), (gpointer)model);
-	gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
-
-	button = gtk_button_new_with_mnemonic (_("_Delete"));
-	g_signal_connect(button, "clicked", G_CALLBACK(Delete_shortcut), (gpointer)treeview);
-	gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
-
-	button = gtk_button_new_with_mnemonic (_("_Capture Shortcut"));
-	g_signal_connect(button, "clicked", G_CALLBACK(Capture_shortcut), (gpointer)treeview);
-	gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
-
-	separator = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
-	gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, TRUE, 0);
-
-	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
-	gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
-	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
-	button = gtk_button_new_from_stock (GTK_STOCK_HELP);
-	g_signal_connect(button, "clicked", G_CALLBACK(Help_screen), (gpointer)window);
-	gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
-
-	button = gtk_button_new_from_stock (GTK_STOCK_OK);
-	g_signal_connect(button, "clicked", G_CALLBACK(Save_shortcuts), (gpointer)treeview);
-	g_signal_connect_swapped(button, "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window);
-	gtk_box_pack_end (GTK_BOX (hbox), button, TRUE, TRUE, 0);
-
-	button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
-	g_signal_connect_swapped(button, "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window);
-	gtk_box_pack_end (GTK_BOX (hbox), button, TRUE, TRUE, 0);
-
-	gtk_window_set_default_size (GTK_WINDOW(window), 300, 400);
-
-	gtk_widget_show_all(window);
-}
 
+	//! Clean up all macros
+	macros_destroy();
+}
\ No newline at end of file
diff --git a/src/macros.h b/src/macros.h
index 46cbd3f..de72367 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -1,32 +1,41 @@
-/***********************************************************************/
-/* macros.h                                                            */
-/* --------                                                            */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Functions for the management of the macros                     */
-/*      - Header file -                                                */
-/*                                                                     */
-/***********************************************************************/
+/***********************************************************************
+ * macros.h                                                            
+ * --------                                                            
+ *           GTKTerm Software                                          
+ *                      (c) Julien Schmitt                             
+ *                                                                     
+ * ------------------------------------------------------------------- 
+ *                                                                     
+ * \brief Purpose                                                    
+ *        Functions for the management of the macros                   
+ *        - Header file -                                               
+ *                                                                     
+ ***********************************************************************/
 
 #ifndef MACROS_H_
 #define MACROS_H_
 
+/** todo: Migrate to GObject */
+
+//! Define macro structure type
 typedef struct
 {
-	gchar *shortcut;
-	gchar *action;
-	GClosure *closure;
+	char *shortcut;		//!< Shortcut of the macro
+	char *action;		//!< Command to perform
+	GClosure *closure;	//!<
 }
 macro_t;
 
-void Config_macros(GtkAction *action, gpointer data);
-void remove_shortcuts(void);
-void add_shortcuts(void);
-void create_shortcuts(macro_t *, gint);
-macro_t *get_shortcuts(gint *);
+//void config_macros(GtkAction *action, gpointer data);
+void remove_shortcuts(void); 				//!< Remove shortcuts from accel_group and free memory
+void add_shortcuts(void);					//!< 
+macro_t *get_shortcuts(gint *);				//!<
+
+void convert_string_to_macros (char **, int);
+int convert_macros_to_string (char **);
+
+int macro_count ();
+
+extern macro_t *macros;
 
 #endif
diff --git a/src/meson.build b/src/meson.build
index 6786eb5..df0d1fb 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,36 +1,18 @@
-sources = [
-	'buffer.c',
-	'buffer.h',
-	'cmdline.c',
-	'cmdline.h',
-	'device_monitor.c',
-	'device_monitor.h',
-	'files.c',
-	'files.h',
+gtkterm_sources = [
+	'gtkterm_cmdline.c',
 	'gtkterm.c',
-	'i18n.c',
-	'i18n.h',
-	'interface.c',
-	'interface.h',
-	'logging.c',
-	'logging.h',
+	'gtkterm_window.c',
 	'macros.c',
-	'macros.h',
-	'parsecfg.c',
-	'parsecfg.h',
-	'search.c',
-	'search.h',
-	'serial.c',
-	'serial.h',
-	'term_config.c',
-	'term_config.h',
-	'user_signals.c',
-	'user_signals.h',
+	'gtkterm_configuration.c',
+	'gtkterm_serial_port.c',
+	'gtkterm_terminal.c',
+	'gtkterm_buffer.c',
 	gresources
 ]
 
 executable(
-	'gtkterm', sources,
+	'gtkterm', 
+	[gtkterm_sources],
 	export_dynamic : true,
 	dependencies : [
 		gtk_deps,
diff --git a/src/search.c b/src/search.c
deleted file mode 100644
index 05de67d..0000000
--- a/src/search.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/***********************************************************************/
-/* search.c                                                            */
-/* --------                                                            */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Search text from the VTE                                       */
-/*   Written by Tomi Lähteenmäki - lihis@lihis.net                     */
-/*                                                                     */
-/***********************************************************************/
-
-#include "search.h"
-#include <glib/gi18n.h>
-
-#define PCRE2_CODE_UNIT_WIDTH 0
-#include <pcre2.h>
-
-static GtkWindow *parentWindow;
-static VteTerminal *term;
-static GtkWidget *box;
-static GtkWidget *searchBar;
-static GtkWidget *prevImage;
-static GtkWidget *prevButton;
-static GtkWidget *nextImage;
-static GtkWidget *nextButton;
-static VteRegex *regex;
-static GtkWidget *entry;
-
-typedef enum
-{
-	FIND_PREVIOUS,
-	FIND_NEXT
-} FindDirection;
-
-void entry_changed_callback()
-{
-	gboolean sensitive = FALSE;
-
-	if (regex != NULL)
-	{
-		vte_regex_unref(regex);
-		regex = NULL;
-	}
-
-	if (gtk_entry_get_text_length(GTK_ENTRY(entry)))
-		sensitive = TRUE;
-
-	gtk_widget_set_sensitive(prevButton, sensitive);
-	gtk_widget_set_sensitive(nextButton, sensitive);
-}
-
-void search_callback(GtkWidget *widget, gpointer data)
-{
-	(void)widget;
-	FindDirection direction = (FindDirection)GPOINTER_TO_UINT(data);
-
-	if (regex == NULL)
-	{
-		const gchar *pattern = gtk_entry_get_text(GTK_ENTRY(entry));
-		GError *error = NULL;
-		regex = vte_regex_new_for_search(pattern,
-										 strlen(pattern),
-										 PCRE2_MULTILINE | PCRE2_CASELESS,
-										 &error);
-		if (regex == NULL)
-		{
-			GtkDialogFlags flags = GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT;
-			GtkWidget *dialog = gtk_message_dialog_new(parentWindow,
-													   flags,
-													   GTK_MESSAGE_ERROR,
-													   GTK_BUTTONS_OK,
-													   error->message,
-													   NULL);
-			gtk_dialog_run(GTK_DIALOG(dialog));
-			gtk_widget_destroy(dialog);
-			g_error_free(error);
-			return;
-		}
-
-		vte_terminal_search_set_regex(term, regex, 0);
-	}
-
-	if (direction == FIND_PREVIOUS)
-		vte_terminal_search_find_previous(term);
-	else
-		vte_terminal_search_find_next(term);
-}
-
-static gboolean entry_key_press_event_callback(GtkEntry *entry, GdkEventKey *event, GtkWidget *searchBar)
-{
-	guint mask = gtk_accelerator_get_default_mod_mask();
-	gboolean handled = FALSE;
-
-	/*
-	 * Additional search keybindings
-	 * Escape key: Close search toolbar
-	 * Shift + Enter: Go to previous search result
-	 */
-	if ((event->state & mask) == 0)
-	{
-		handled = TRUE;
-		switch (event->keyval)
-		{
-		case GDK_KEY_Escape:
-			search_bar_hide(searchBar);
-			break;
-		default:
-			handled = FALSE;
-			break;
-		}
-	}
-	else if ((event->state & mask) == GDK_SHIFT_MASK &&
-			 (event->keyval == GDK_KEY_Return ||
-			  event->keyval == GDK_KEY_KP_Enter ||
-			  event->keyval == GDK_KEY_ISO_Enter))
-	{
-		handled = TRUE;
-		search_callback(NULL, GUINT_TO_POINTER(FIND_PREVIOUS));
-	}
-
-	return handled;
-}
-
-GtkWidget *search_bar_new(GtkWindow *parent, VteTerminal *terminal)
-{
-	parentWindow = parent;
-	term = terminal;
-	regex = NULL;
-	vte_terminal_search_set_wrap_around(term, TRUE);
-
-	searchBar = gtk_search_bar_new();
-	gtk_search_bar_connect_entry(GTK_SEARCH_BAR(searchBar), GTK_ENTRY(entry));
-	gtk_search_bar_set_search_mode(GTK_SEARCH_BAR(searchBar), FALSE);
-	gtk_search_bar_set_show_close_button(GTK_SEARCH_BAR(searchBar), TRUE);
-
-	box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
-	gtk_style_context_add_class(gtk_widget_get_style_context(box), "linked");
-	gtk_container_add(GTK_CONTAINER(searchBar), box);
-
-	entry = gtk_search_entry_new();
-	gtk_entry_set_width_chars(GTK_ENTRY(entry), 30);
-	gtk_box_pack_start(GTK_BOX(box), entry, FALSE, FALSE, 0);
-	g_signal_connect(entry, "changed", G_CALLBACK(entry_changed_callback), NULL);
-	g_signal_connect(entry, "key-press-event", G_CALLBACK(entry_key_press_event_callback), searchBar);
-
-	prevImage = gtk_image_new_from_icon_name("go-up-symbolic", GTK_ICON_SIZE_MENU);
-	prevButton = gtk_button_new();
-	gtk_button_set_image(GTK_BUTTON(prevButton), prevImage);
-	gtk_box_pack_start(GTK_BOX(box), prevButton, FALSE, FALSE, 0);
-	g_signal_connect(G_OBJECT(prevButton), "clicked", G_CALLBACK(search_callback), GUINT_TO_POINTER(FIND_PREVIOUS));
-	gtk_widget_set_sensitive(prevButton, FALSE);
-
-	nextImage = gtk_image_new_from_icon_name("go-down-symbolic", GTK_ICON_SIZE_MENU);
-	nextButton = gtk_button_new();
-	gtk_button_set_image(GTK_BUTTON(nextButton), nextImage);
-	gtk_box_pack_start(GTK_BOX(box), nextButton, FALSE, FALSE, 0);
-	g_signal_connect(G_OBJECT(nextButton), "clicked", G_CALLBACK(search_callback), GUINT_TO_POINTER(FIND_NEXT));
-	gtk_widget_set_sensitive(nextButton, FALSE);
-
-	return searchBar;
-}
-
-void search_bar_show(GtkWidget *self)
-{
-	gtk_widget_show(self);
-	gtk_search_bar_set_search_mode(GTK_SEARCH_BAR(searchBar), TRUE);
-
-	gtk_widget_grab_focus(entry);
-
-	/* Set Enter key to "press" next button by default */
-	gtk_widget_set_can_default(nextButton, TRUE);
-	gtk_widget_grab_default(nextButton);
-	gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
-}
-
-void search_bar_hide(GtkWidget *self)
-{
-	gtk_widget_hide(self);
-	vte_terminal_search_set_regex(term, NULL, 0);
-	gtk_search_bar_set_search_mode(GTK_SEARCH_BAR(searchBar), FALSE);
-
-	if (regex != NULL)
-	{
-		vte_regex_unref(regex);
-		regex = NULL;
-	}
-}
diff --git a/src/search.h b/src/search.h
deleted file mode 100644
index b6817c2..0000000
--- a/src/search.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/***********************************************************************/
-/* search.h                                                            */
-/* ---------                                                           */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Search text from the VTE                                       */
-/*   Written by Tomi Lähteenmäki - lihis@lihis.net                     */
-/*                                                                     */
-/***********************************************************************/
-
-#ifndef FIND_H
-#define FIND_H
-
-#include <vte/vte.h>
-
-GtkWidget *search_bar_new(GtkWindow *parent, VteTerminal *terminal);
-void search_bar_show(GtkWidget *search_box);
-void search_bar_hide(GtkWidget *search_box);
-
-#endif
diff --git a/src/serial.c b/src/serial.c
deleted file mode 100644
index a7a2eb9..0000000
--- a/src/serial.c
+++ /dev/null
@@ -1,486 +0,0 @@
-/***********************************************************************/
-/* serie.c                                                             */
-/* -------                                                             */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Serial port access functions                                   */
-/*                                                                     */
-/*   ChangeLog                                                         */
-/*      - 0.99.7 : Removed auto crlf stuff - (use macros instead)      */
-/*      - 0.99.5 : changed all calls to strerror() by strerror_utf8()  */
-/*      - 0.99.2 : Internationalization                                */
-/*      - 0.98.6 : new sendbreak() function                            */
-/*      - 0.98.1 : lockfile implementation (based on minicom)          */
-/*      - 0.98 : removed IOChannel                                     */
-/*                                                                     */
-/***********************************************************************/
-
-#include <gtk/gtk.h>
-#include <glib.h>
-#include <termios.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <signal.h>
-#include <string.h>
-#include <errno.h>
-#include <pwd.h>
-
-#include "term_config.h"
-#include "serial.h"
-#include "interface.h"
-#include "files.h"
-#include "buffer.h"
-#include "i18n.h"
-
-#include <config.h>
-#include <glib/gi18n.h>
-
-#ifdef HAVE_LINUX_SERIAL_H
-#include <linux/serial.h>
-#endif
-
-
-struct termios termios_save;
-int serial_port_fd = -1;
-
-guint callback_handler_in, callback_handler_err;
-gboolean callback_activated = FALSE;
-
-extern struct configuration_port config;
-
-gboolean Lis_port(GIOChannel* src, GIOCondition cond, gpointer data)
-{
-	gint bytes_read;
-	static gchar c[BUFFER_RECEPTION];
-	guint i;
-
-	bytes_read = BUFFER_RECEPTION;
-
-	while(bytes_read == BUFFER_RECEPTION)
-	{
-		bytes_read = read(serial_port_fd, c, BUFFER_RECEPTION);
-		if(bytes_read > 0)
-		{
-			put_chars(c, bytes_read, config.crlfauto);
-
-			if(config.car != -1 && waiting_for_char == TRUE)
-			{
-				i = 0;
-				while(i < bytes_read)
-				{
-					if(c[i] == config.car)
-					{
-						waiting_for_char = FALSE;
-						add_input();
-						i = bytes_read;
-					}
-					i++;
-				}
-			}
-		}
-		else if(bytes_read == -1)
-		{
-			if(errno != EAGAIN)
-				perror(config.port);
-		}
-	}
-
-	return TRUE;
-}
-
-gboolean io_err(GIOChannel* src, GIOCondition cond, gpointer data)
-{
-	Close_port();
-	return TRUE;
-}
-
-int Send_chars(char *string, int length)
-{
-	int bytes_written = 0;
-
-	if(serial_port_fd == -1)
-		return 0;
-
-	/* Normally it never happens, but it is better not to segfault ;) */
-	if(length == 0)
-		return 0;
-
-	/* RS485 half-duplex mode ? */
-	if( config.flux==3 )
-	{
-		/* set RTS (start to send) */
-		Set_signals( 1 );
-		if( config.rs485_rts_time_before_transmit>0 )
-			usleep(config.rs485_rts_time_before_transmit*1000);
-	}
-
-	bytes_written = write(serial_port_fd, string, length);
-
-	/* RS485 half-duplex mode ? */
-	if( config.flux==3 )
-	{
-		/* wait all chars are send */
-		tcdrain( serial_port_fd );
-		if( config.rs485_rts_time_after_transmit>0 )
-			usleep(config.rs485_rts_time_after_transmit*1000);
-		/* reset RTS (end of send, now receiving back) */
-		Set_signals( 1 );
-	}
-
-	return bytes_written;
-}
-
-gboolean Config_port(void)
-{
-	struct termios termios_p;
-	gchar *msg = NULL;
-
-	Close_port();
-
-	serial_port_fd = open(config.port, O_RDWR | O_NOCTTY | O_NDELAY);
-
-	if(serial_port_fd == -1)
-	{
-		msg = g_strdup_printf(_("Cannot open %s: %s\n"),
-		                      config.port, strerror_utf8(errno));
-		show_message(msg, MSG_ERR);
-		g_free(msg);
-
-		return FALSE;
-	}
-
-	if(! config.disable_port_lock)
-	{
-	    if(flock(serial_port_fd, LOCK_EX | LOCK_NB) == -1)
-	    {
-		Close_port();
-		msg = g_strdup_printf(_("Cannot lock port! The serial port may currently be in use by another program.\n"));
-		show_message(msg, MSG_ERR);
-		g_free(msg);
-
-		return FALSE;
-		}
-	}
-
-	tcgetattr(serial_port_fd, &termios_p);
-	memcpy(&termios_save, &termios_p, sizeof(struct termios));
-
-	switch(config.vitesse)
-	{
-	case 300:
-		termios_p.c_cflag = B300;
-		break;
-	case 600:
-		termios_p.c_cflag = B600;
-		break;
-	case 1200:
-		termios_p.c_cflag = B1200;
-		break;
-	case 2400:
-		termios_p.c_cflag = B2400;
-		break;
-	case 4800:
-		termios_p.c_cflag = B4800;
-		break;
-	case 9600:
-		termios_p.c_cflag = B9600;
-		break;
-	case 19200:
-		termios_p.c_cflag = B19200;
-		break;
-	case 38400:
-		termios_p.c_cflag = B38400;
-		break;
-	case 57600:
-		termios_p.c_cflag = B57600;
-		break;
-	case 115200:
-		termios_p.c_cflag = B115200;
-		break;
-	case 230400:
-		termios_p.c_cflag = B230400;
-		break;
-	case 460800:
-		termios_p.c_cflag = B460800;
-		break;
-	case 576000:
-		termios_p.c_cflag = B576000;
-		break;
-	case 921600:
-		termios_p.c_cflag = B921600;
-		break;
-	case 1000000:
-		termios_p.c_cflag = B1000000;
-		break;
-	case 1500000:
-		termios_p.c_cflag = B1500000;
-		break;
-	case 2000000:
-		termios_p.c_cflag = B2000000;
-		break;
-
-	default:
-#ifdef HAVE_LINUX_SERIAL_H
-		set_custom_speed(config.vitesse, serial_port_fd);
-		termios_p.c_cflag |= B38400;
-#else
-		Close_port();
-		msg = g_strdup_printf(_("Arbitrary baud rates not supported"));
-		show_message(msg, MSG_ERR);
-		g_free(msg);
-		return FALSE;
-#endif
-	}
-
-	switch(config.bits)
-	{
-	case 5:
-		termios_p.c_cflag |= CS5;
-		break;
-	case 6:
-		termios_p.c_cflag |= CS6;
-		break;
-	case 7:
-		termios_p.c_cflag |= CS7;
-		break;
-	case 8:
-		termios_p.c_cflag |= CS8;
-		break;
-	}
-	switch(config.parite)
-	{
-	case 1:
-		termios_p.c_cflag |= PARODD | PARENB;
-		break;
-	case 2:
-		termios_p.c_cflag |= PARENB;
-		break;
-	default:
-		break;
-	}
-	if(config.stops == 2)
-		termios_p.c_cflag |= CSTOPB;
-	termios_p.c_cflag |= CREAD;
-	termios_p.c_iflag = IGNPAR | IGNBRK;
-	switch(config.flux)
-	{
-	case 1:
-		termios_p.c_iflag |= IXON | IXOFF;
-		break;
-	case 2:
-		termios_p.c_cflag |= CRTSCTS;
-		break;
-	default:
-		termios_p.c_cflag |= CLOCAL;
-		break;
-	}
-	termios_p.c_oflag = 0;
-	termios_p.c_lflag = 0;
-	termios_p.c_cc[VTIME] = 0;
-	termios_p.c_cc[VMIN] = 1;
-	tcsetattr(serial_port_fd, TCSANOW, &termios_p);
-	tcflush(serial_port_fd, TCOFLUSH);
-	tcflush(serial_port_fd, TCIFLUSH);
-
-	callback_handler_in = g_io_add_watch_full(g_io_channel_unix_new(serial_port_fd),
-	                      10,
-	                      G_IO_IN,
-	                      (GIOFunc)Lis_port,
-	                      NULL, NULL);
-
-	callback_handler_err = g_io_add_watch_full(g_io_channel_unix_new(serial_port_fd),
-	                       10,
-	                       G_IO_ERR,
-	                       (GIOFunc)io_err,
-	                       NULL, NULL);
-
-	callback_activated = TRUE;
-
-	Set_local_echo(config.echo);
-
-	return TRUE;
-}
-
-void configure_echo(gboolean echo)
-{
-	config.echo = echo;
-}
-
-void configure_crlfauto(gboolean crlfauto)
-{
-	config.crlfauto = crlfauto;
-}
-
-void Close_port(void)
-{
-	if(serial_port_fd != -1)
-	{
-		if(callback_activated == TRUE)
-		{
-			g_source_remove(callback_handler_in);
-			g_source_remove(callback_handler_err);
-			callback_activated = FALSE;
-		}
-		tcsetattr(serial_port_fd, TCSANOW, &termios_save);
-		tcflush(serial_port_fd, TCOFLUSH);
-		tcflush(serial_port_fd, TCIFLUSH);
-		if(! config.disable_port_lock)
-		{
-			flock(serial_port_fd, LOCK_UN);
-		}
-		close(serial_port_fd);
-		serial_port_fd = -1;
-	}
-}
-
-void Set_signals(guint param)
-{
-	int stat_;
-
-	if(serial_port_fd == -1)
-		return;
-
-	if(ioctl(serial_port_fd, TIOCMGET, &stat_) == -1)
-	{
-		i18n_perror(_("Control signals read"));
-		return;
-	}
-
-	/* DTR */
-	if(param == 0)
-	{
-		if(stat_ & TIOCM_DTR)
-			stat_ &= ~TIOCM_DTR;
-		else
-			stat_ |= TIOCM_DTR;
-		if(ioctl(serial_port_fd, TIOCMSET, &stat_) == -1)
-			i18n_perror(_("DTR write"));
-	}
-	/* RTS */
-	else if(param == 1)
-	{
-		if(stat_ & TIOCM_RTS)
-			stat_ &= ~TIOCM_RTS;
-		else
-			stat_ |= TIOCM_RTS;
-		if(ioctl(serial_port_fd, TIOCMSET, &stat_) == -1)
-			i18n_perror(_("RTS write"));
-	}
-}
-
-int lis_sig(void)
-{
-	static int stat = 0;
-	int stat_read;
-
-	if ( config.flux==3 )
-	{
-		//reset RTS (default = receive)
-		Set_signals( 1 );
-	}
-
-	if(serial_port_fd != -1)
-	{
-		if(ioctl(serial_port_fd, TIOCMGET, &stat_read) == -1)
-		{
-			/* Ignore EINVAL, as some serial ports
-			genuinely lack these lines */
-			/* Thanks to Elie De Brauwer on ubuntu launchpad */
-			if (errno != EINVAL)
-			{
-				i18n_perror(_("Control signals read"));
-				Close_port();
-			}
-
-			return -2;
-		}
-
-		if(stat_read == stat)
-			return -1;
-
-		stat = stat_read;
-
-		return stat;
-	}
-	return -1;
-}
-
-void sendbreak(void)
-{
-	if(serial_port_fd == -1)
-		return;
-	else
-		tcsendbreak(serial_port_fd, 0);
-}
-
-#ifdef HAVE_LINUX_SERIAL_H
-gint set_custom_speed(int speed, int port_fd)
-{
-
-	struct serial_struct ser;
-	int arby;
-
-	ioctl(port_fd, TIOCGSERIAL, &ser);
-	ser.custom_divisor = ser.baud_base / speed;
-	if(!(ser.custom_divisor))
-		ser.custom_divisor = 1;
-
-	arby = ser.baud_base / ser.custom_divisor;
-	ser.flags &= ~ASYNC_SPD_MASK;
-	ser.flags |= ASYNC_SPD_CUST;
-
-	ioctl(port_fd, TIOCSSERIAL, &ser);
-
-	return 0;
-}
-#endif
-
-gchar* get_port_string(void)
-{
-	gchar* msg;
-	gchar parity;
-
-	if(serial_port_fd == -1)
-	{
-		msg = g_strdup(_("No open port"));
-	}
-	else
-	{
-		// 0: none, 1: odd, 2: even
-		switch(config.parite)
-		{
-		case 0:
-			parity = 'N';
-			break;
-		case 1:
-			parity = 'O';
-			break;
-		case 2:
-			parity = 'E';
-			break;
-		default:
-			parity = 'N';
-		}
-
-		/* "GtkTerm: device  baud-bits-parity-stops"  */
-		msg = g_strdup_printf("%.15s  %d-%d-%c-%d",
-		                      config.port,
-		                      config.vitesse,
-		                      config.bits,
-		                      parity,
-		                      config.stops
-		                     );
-	}
-
-	return msg;
-}
diff --git a/src/serial.h b/src/serial.h
deleted file mode 100644
index 916c518..0000000
--- a/src/serial.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/***********************************************************************/
-/* serie.c                                                             */
-/* -------                                                             */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Serial port access functions                                   */
-/*      - Header file -                                                */
-/*                                                                     */
-/***********************************************************************/
-
-#ifndef SERIE_H_
-#define SERIE_H_
-
-extern int serial_port_fd;
-
-int Send_chars(char *, int);
-gboolean Config_port(void);
-void Set_signals(guint);
-int lis_sig(void);
-void Close_port(void);
-void configure_echo(gboolean);
-void configure_crlfauto(gboolean);
-void sendbreak(void);
-gint set_custom_speed(int, int);
-gchar* get_port_string(void);
-
-#define BUFFER_RECEPTION 8192
-#define BUFFER_EMISSION 4096
-#define LINE_FEED 0x0A
-#define POLL_DELAY 100               /* in ms (for control signals) */
-
-#endif
diff --git a/src/term_config.c b/src/term_config.c
deleted file mode 100644
index 97d9554..0000000
--- a/src/term_config.c
+++ /dev/null
@@ -1,1617 +0,0 @@
-/***********************************************************************/
-/* config.c                                                            */
-/* --------                                                            */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Configuration of the serial port                               */
-/*                                                                     */
-/*   ChangeLog                                                         */
-/*      - 0.99.7 : Refactor to use newer gtk widgets                   */
-/*                 Add ability to use arbitrary baud                   */
-/*                 Add rs458 capability - Marc Le Douarain             */
-/*                 Remove auto cr/lf stuff - (use macros instead)      */
-/*      - 0.99.5 : Make the combo list for the device editable         */
-/*      - 0.99.3 : Configuration for VTE terminal                      */
-/*      - 0.99.2 : Internationalization                                */
-/*      - 0.99.1 : fixed memory management bug                         */
-/*                 test if there are devices found                     */
-/*      - 0.99.0 : fixed enormous memory management bug ;-)            */
-/*                 save / read macros                                  */
-/*      - 0.98.5 : font saved in configuration                         */
-/*                 bug fixed in memory management                      */
-/*                 combos set to non editable                          */
-/*      - 0.98.3 : configuration file                                  */
-/*      - 0.98.2 : autodetect existing devices                         */
-/*      - 0.98 : added devfs devices                                   */
-/*                                                                     */
-/***********************************************************************/
-
-#include <gtk/gtk.h>
-#include <termios.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <vte/vte.h>
-#include <glib/gi18n.h>
-
-#include "serial.h"
-#include "term_config.h"
-#include "interface.h"
-#include "parsecfg.h"
-#include "macros.h"
-#include "i18n.h"
-#include "config.h"
-
-
-#define DEVICE_NUMBERS_TO_CHECK 12
-#define CONFIGURATION_FILENAME ".gtktermrc"
-
-gchar *devices_to_check[] =
-{
-	"/dev/ttyS%d",
-	"/dev/tts/%d",
-	"/dev/ttyUSB%d",
-	"/dev/ttyACM%d",
-	"/dev/ttyXRUSB%d",
-	"/dev/usb/tts/%d",
-	NULL
-};
-
-/* Configuration file variables */
-gchar **port;
-gint *speed;
-gint *bits;
-gint *stopbits;
-gchar **parity;
-gchar **flow;
-gint *wait_delay;
-gint *wait_char;
-gint *rts_time_before_tx;
-gint *rts_time_after_tx;
-gint *echo;
-gint *crlfauto;
-gint *timestamp;
-cfgList **macro_list = NULL;
-gchar **font;
-
-gint *block_cursor;
-gint *rows;
-gint *columns;
-gint *scrollback;
-gint *visual_bell;
-gfloat *foreground_red;
-gfloat *foreground_blue;
-gfloat *foreground_green;
-gfloat *foreground_alpha;
-gfloat *background_red;
-gfloat *background_blue;
-gfloat *background_green;
-gfloat *background_alpha;
-
-
-cfgStruct cfg[] =
-{
-	{"port", CFG_STRING, &port},
-	{"speed", CFG_INT, &speed},
-	{"bits", CFG_INT, &bits},
-	{"stopbits", CFG_INT, &stopbits},
-	{"parity", CFG_STRING, &parity},
-	{"flow", CFG_STRING, &flow},
-	{"wait_delay", CFG_INT, &wait_delay},
-	{"wait_char", CFG_INT, &wait_char},
-	{"rs485_rts_time_before_tx", CFG_INT, &rts_time_before_tx},
-	{"rs485_rts_time_after_tx", CFG_INT, &rts_time_after_tx},
-	{"echo", CFG_BOOL, &echo},
-	{"crlfauto", CFG_BOOL, &crlfauto},
-	{"timestamp", CFG_BOOL, &timestamp},
-	{"font", CFG_STRING, &font},
-	{"macros", CFG_STRING_LIST, &macro_list},
-	{"term_block_cursor", CFG_BOOL, &block_cursor},
-	{"term_rows", CFG_INT, &rows},
-	{"term_columns", CFG_INT, &columns},
-	{"term_scrollback", CFG_INT, &scrollback},
-	{"term_visual_bell", CFG_BOOL, &visual_bell},
-	{"term_foreground_red", CFG_FLOAT, &foreground_red},
-	{"term_foreground_blue", CFG_FLOAT, &foreground_blue},
-	{"term_foreground_green", CFG_FLOAT, &foreground_green},
-	{"term_foreground_alpha", CFG_FLOAT, &foreground_alpha},
-	{"term_background_red", CFG_FLOAT, &background_red},
-	{"term_background_blue", CFG_FLOAT, &background_blue},
-	{"term_background_green", CFG_FLOAT, &background_green},
-	{"term_background_alpha", CFG_FLOAT, &background_alpha},
-	{NULL, CFG_END, NULL}
-};
-
-GFile *config_file;
-
-struct configuration_port config;
-display_config_t term_conf;
-
-GtkWidget *Entry;
-
-gint Grise_Degrise(GtkWidget *bouton, gpointer pointeur);
-void read_font_button(GtkFontButton *fontButton);
-void Hard_default_configuration(void);
-void Copy_configuration(int);
-
-static void Select_config(gchar *, void *);
-static void Save_config_file(void);
-static void load_config(GtkDialog *, gint, GtkTreeSelection *);
-static void delete_config(GtkDialog *, gint, GtkTreeSelection *);
-static void save_config(GtkDialog *, gint, GtkWidget *);
-static void really_save_config(GtkDialog *, gint, gpointer);
-static gint remove_section(gchar *, gchar *);
-static gboolean cursor_block(GtkSwitch *, gboolean, gpointer);
-static void Selec_couleur(GdkRGBA *, gfloat, gfloat, gfloat, gfloat);
-void config_fg_color(GtkWidget *button, gpointer data);
-void config_bg_color(GtkWidget *button, gpointer data);
-static void scrollback_set(GtkAdjustment *, gpointer);
-
-extern GtkWidget *display;
-
-void config_file_init(void)
-{
-	/*
-	 * Old location of configuration file was $HOME/.gtktermrc
-	 * New location is $XDG_CONFIG_HOME/.gtktermrc
-	 *
-	 * If configuration file exists at new location, use that one.
-	 * Otherwise, if file exists at old location, move file to new location.
-	 */
-	GFile *config_file_old = g_file_new_build_filename(getenv("HOME"), CONFIGURATION_FILENAME, NULL);
-	config_file = g_file_new_build_filename(g_get_user_config_dir(), CONFIGURATION_FILENAME, NULL);
-
-	if (!g_file_query_exists(config_file, NULL) && g_file_query_exists(config_file_old, NULL))
-		g_file_move(config_file_old, config_file, G_FILE_COPY_NONE, NULL, NULL, NULL, NULL);
-}
-
-void ConfigFlags(void)
-{
-	Set_crlfauto(config.crlfauto);
-	Set_timestamp(config.timestamp);
-}
-
-void Config_Port_Fenetre(GtkAction *action, gpointer data)
-{
-	GtkWidget *Table, *Label, *Bouton_OK, *Bouton_annule,
-	          *Combo, *Dialogue, *Frame, *CheckBouton,
-	          *Spin, *Expander, *ExpanderVbox,
-	          *content_area, *action_area;
-
-	static GtkWidget *Combos[10];
-	GList *liste = NULL;
-	gchar *chaine = NULL;
-	gchar **dev = NULL;
-	GtkAdjustment *adj;
-	struct stat my_stat;
-	gchar *string;
-	int i;
-
-	for(dev = devices_to_check; *dev != NULL; dev++)
-	{
-		for(i = 0; i < DEVICE_NUMBERS_TO_CHECK; i++)
-		{
-			chaine = g_strdup_printf(*dev, i);
-			if(stat(chaine, &my_stat) == 0)
-				liste = g_list_append(liste, chaine);
-		}
-	}
-
-	if(liste == NULL)
-	{
-		show_message(_("No serial devices found!\n"
-		               "\n"
-		               "Searched the following device path patterns:\n"
-		               "\t/dev/ttyS*\n\t/dev/tts/*\n\t/dev/ttyUSB*\n\t/dev/usb/tts/*\n\n"
-		               "Enter a different device path in the 'Port' box.\n"), MSG_WRN);
-	}
-
-	Dialogue = gtk_dialog_new();
-	content_area = gtk_dialog_get_content_area(GTK_DIALOG(Dialogue));
-	action_area = gtk_dialog_get_action_area(GTK_DIALOG(Dialogue));
-	gtk_window_set_title(GTK_WINDOW(Dialogue), _("Configuration"));
-	gtk_window_set_resizable(GTK_WINDOW(Dialogue), FALSE);
-	gtk_container_set_border_width(GTK_CONTAINER(content_area), 5);
-
-	Frame = gtk_frame_new(_("Serial port"));
-	gtk_box_pack_start(GTK_BOX(content_area), Frame, FALSE, TRUE, 5);
-
-	Table = gtk_table_new(4, 3, FALSE);
-	gtk_container_add(GTK_CONTAINER(Frame), Table);
-
-	Label = gtk_label_new(_("Port:"));
-	gtk_table_attach(GTK_TABLE(Table), Label, 0, 1, 0, 1, 0, 0, 10, 5);
-	Label = gtk_label_new(_("Baud Rate:"));
-	gtk_table_attach(GTK_TABLE(Table), Label, 1, 2, 0, 1, 0, 0, 10, 5);
-	Label = gtk_label_new(_("Parity:"));
-	gtk_table_attach(GTK_TABLE(Table), Label, 2, 3, 0, 1, 0, 0, 10, 5);
-
-	// create the devices combo box, and add device strings
-	Combo = gtk_combo_box_text_new_with_entry();
-
-	for(i = 0; i < g_list_length(liste); i++)
-	{
-		gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), g_list_nth_data(liste, i));
-	}
-
-	// try to restore last selected port, if any
-	if(config.port != NULL && config.port[0] != '\0')
-	{
-		GtkWidget *tmp_entry;
-		tmp_entry = gtk_bin_get_child(GTK_BIN(Combo));
-
-		gtk_entry_set_text(GTK_ENTRY(tmp_entry), config.port);
-
-	}
-	else
-	{
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 0);
-	}
-
-
-	// clean up devices strings
-	//g_list_free(liste, (GDestroyNotify)g_free); // only available in glib >= 2.28
-	for(i = 0; i < g_list_length(liste); i++)
-	{
-		g_free(g_list_nth_data(liste, i));
-	}
-	g_list_free(liste);
-	g_free(chaine);
-
-	gtk_table_attach(GTK_TABLE(Table), Combo, 0, 1, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 5, 5);
-	Combos[0] = Combo;
-
-	Combo = gtk_combo_box_text_new_with_entry();
-	gtk_entry_set_max_length(GTK_ENTRY(gtk_bin_get_child (GTK_BIN (Combo))), 10);
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "300");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "600");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "1200");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "2400");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "4800");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "9600");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "19200");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "38400");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "57600");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "115200");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "230400");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "460800");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "576000");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "921600");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "1000000");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "1500000");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "2000000");
-
-	/* set the current choice to the previous setting */
-	switch(config.vitesse)
-	{
-	case 300:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 0);
-		break;
-	case 600:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 1);
-		break;
-	case 1200:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 2);
-		break;
-	case 2400:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 3);
-		break;
-	case 4800:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 4);
-		break;
-	case 9600:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 5);
-		break;
-	case 19200:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 6);
-		break;
-	case 38400:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 7);
-		break;
-	case 57600:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 8);
-		break;
-	case 115200:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 9);
-		break;
-	case 230400:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 10);
-		break;
-	case 460800:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 11);
-		break;
-	case 576000:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 12);
-		break;
-	case 921600:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 13);
-		break;
-	case 1000000:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 14);
-		break;
-	case 2000000:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 15);
-		break;
-	case 0:
-		/* no previous setting, use a default */
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 5);
-	default:
-		/* custom baudrate */
-		string = g_strdup_printf("%d", config.vitesse);
-		gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child (GTK_BIN (Combo))), string);
-		g_free(string);
-	}
-
-	//validate input text (digits only)
-	g_signal_connect(GTK_ENTRY(gtk_bin_get_child (GTK_BIN (Combo))),
-	                 "insert-text",
-	                 G_CALLBACK(check_text_input), isdigit);
-
-	gtk_table_attach(GTK_TABLE(Table), Combo, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 5, 5);
-	Combos[1] = Combo;
-
-	Combo = gtk_combo_box_text_new();
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "none");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "odd");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "even");
-
-	switch(config.parite)
-	{
-	case 0:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 0);
-		break;
-	case 1:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 1);
-		break;
-	case 2:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 2);
-		break;
-	}
-	gtk_table_attach(GTK_TABLE(Table), Combo, 2, 3, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 5, 5);
-	Combos[2] = Combo;
-
-	Label = gtk_label_new(_("Bits:"));
-	gtk_table_attach(GTK_TABLE(Table), Label, 0, 1, 2, 3, 0, 0, 10, 5);
-	Label = gtk_label_new(_("Stopbits:"));
-	gtk_table_attach(GTK_TABLE(Table), Label, 1, 2, 2, 3, 0, 0, 10, 5);
-	Label = gtk_label_new(_("Flow control:"));
-	gtk_table_attach(GTK_TABLE(Table), Label, 2, 3, 2, 3, 0, 0, 10, 5);
-
-	Combo = gtk_combo_box_text_new();
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "5");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "6");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "7");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "8");
-	gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 3);
-
-	if(config.bits >= 5 && config.bits <= 8)
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), config.bits - 5);
-	gtk_table_attach(GTK_TABLE(Table), Combo, 0, 1, 3, 4, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 5, 5);
-	Combos[3] = Combo;
-
-	Combo = gtk_combo_box_text_new();
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "1");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "2");
-	gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 0);
-
-	if(config.stops == 1 || config.stops == 2)
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), config.stops - 1);
-	gtk_table_attach(GTK_TABLE(Table), Combo, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 5, 5);
-	Combos[4] = Combo;
-
-	Combo = gtk_combo_box_text_new();
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "none");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "RTS/CTS");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "Xon/Xoff");
-	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(Combo), "RS485-HalfDuplex(RTS)");
-	gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 0);
-
-	switch(config.flux)
-	{
-	case 0:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 0);
-		break;
-	case 1:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 2);
-		break;
-	case 2:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 1);
-		break;
-	case 3:
-		gtk_combo_box_set_active(GTK_COMBO_BOX(Combo), 3);
-		break;
-	}
-	gtk_table_attach(GTK_TABLE(Table), Combo, 2, 3, 3, 4, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 5, 5);
-	Combos[5] = Combo;
-
-	/* create an expander widget to hide the 'Advanced features' */
-	Expander = gtk_expander_new_with_mnemonic(_("Advanced Configuration Options"));
-	ExpanderVbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
-	gtk_container_add(GTK_CONTAINER(Expander), ExpanderVbox);
-	gtk_container_add(GTK_CONTAINER(content_area), Expander);
-
-	Frame = gtk_frame_new(_("ASCII file transfer"));
-	gtk_container_add(GTK_CONTAINER(ExpanderVbox), Frame);
-
-	Table = gtk_table_new(2, 2, FALSE);
-	gtk_container_add(GTK_CONTAINER(Frame), Table);
-
-	Label = gtk_label_new(_("End of line delay (milliseconds):"));
-	gtk_table_attach_defaults(GTK_TABLE(Table), Label, 0, 1, 0, 1);
-
-	adj = gtk_adjustment_new(0.0, 0.0, 500.0, 10.0, 20.0, 0.0);
-	Spin = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0, 0);
-	gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(Spin), TRUE);
-	gtk_spin_button_set_value(GTK_SPIN_BUTTON(Spin), (gfloat)config.delai);
-	gtk_table_attach(GTK_TABLE(Table), Spin, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 5, 5);
-	Combos[6] = Spin;
-
-	Entry = gtk_entry_new();
-	gtk_entry_set_max_length(GTK_ENTRY(Entry), 1);
-
-	gtk_widget_set_sensitive(GTK_WIDGET(Entry), FALSE);
-	gtk_table_attach(GTK_TABLE(Table), Entry, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 5, 5);
-
-	CheckBouton = gtk_check_button_new_with_label(_("Wait for this special character before passing to next line:"));
-
-	g_signal_connect(GTK_WIDGET(CheckBouton), "clicked", G_CALLBACK(Grise_Degrise), (gpointer)Spin);
-
-	if(config.car != -1)
-	{
-		gtk_entry_set_text(GTK_ENTRY(Entry), &(config.car));
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CheckBouton), TRUE);
-	}
-	gtk_table_attach_defaults(GTK_TABLE(Table), CheckBouton, 0, 1, 1, 2);
-	Combos[7] = CheckBouton;
-
-
-	Frame = gtk_frame_new(_("RS-485 half-duplex parameters (RTS signal used to send)"));
-
-	gtk_container_add(GTK_CONTAINER(ExpanderVbox), Frame);
-
-	Table = gtk_table_new(2, 2, FALSE);
-	gtk_container_add(GTK_CONTAINER(Frame), Table);
-
-	Label = gtk_label_new(_("Time with RTS 'on' before transmit (milliseconds):"));
-	gtk_table_attach_defaults(GTK_TABLE(Table), Label, 0, 1, 0, 1);
-	Label = gtk_label_new(_("Time with RTS 'on' after transmit (milliseconds):"));
-	gtk_table_attach_defaults(GTK_TABLE(Table), Label, 0, 1, 1, 2);
-
-	adj = gtk_adjustment_new(0.0, 0.0, 500.0, 10.0, 20.0, 0.0);
-	Spin = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0, 0);
-	gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(Spin), TRUE);
-	gtk_spin_button_set_value(GTK_SPIN_BUTTON(Spin), (gfloat)config.rs485_rts_time_before_transmit);
-	gtk_table_attach(GTK_TABLE(Table), Spin, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 5, 5);
-	Combos[8] = Spin;
-
-	adj = gtk_adjustment_new(0.0, 0.0, 500.0, 10.0, 20.0, 0.0);
-	Spin = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0, 0);
-	gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(Spin), TRUE);
-	gtk_spin_button_set_value(GTK_SPIN_BUTTON(Spin), (gfloat)config.rs485_rts_time_after_transmit);
-	gtk_table_attach(GTK_TABLE(Table), Spin, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 5, 5);
-	Combos[9] = Spin;
-
-
-	Bouton_OK = gtk_button_new_with_label(_("OK"));
-	gtk_box_pack_start(GTK_BOX(action_area), Bouton_OK, FALSE, TRUE, 0);
-	g_signal_connect(GTK_WIDGET(Bouton_OK), "clicked", G_CALLBACK(Lis_Config), (gpointer)Combos);
-	g_signal_connect_swapped(GTK_WIDGET(Bouton_OK), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_WIDGET(Dialogue));
-	Bouton_annule = gtk_button_new_with_label(_("Cancel"));
-	g_signal_connect_swapped(GTK_WIDGET(Bouton_annule), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_WIDGET(Dialogue));
-	gtk_box_pack_start(GTK_BOX(action_area), Bouton_annule, FALSE, TRUE, 0);
-
-	gtk_widget_show_all(Dialogue);
-}
-
-gint Lis_Config(GtkWidget *bouton, GtkWidget **Combos)
-{
-	gchar *message;
-
-	message = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(Combos[0]));
-	strcpy(config.port, message);
-	g_free(message);
-
-	message = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(Combos[1]));
-	config.vitesse = atoi(message);
-	g_free(message);
-
-	message = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(Combos[3]));
-	config.bits = atoi(message);
-	g_free(message);
-
-	config.delai = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(Combos[6]));
-	config.rs485_rts_time_before_transmit = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(Combos[8]));
-	config.rs485_rts_time_after_transmit = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(Combos[9]));
-
-
-	message = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(Combos[2]));
-	if(!strcmp(message, "odd"))
-		config.parite = 1;
-	else if(!strcmp(message, "even"))
-		config.parite = 2;
-	else
-		config.parite = 0;
-	g_free(message);
-
-	message = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(Combos[4]));
-	config.stops = atoi(message);
-	g_free(message);
-
-	message = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(Combos[5]));
-	if(!strcmp(message, "Xon/Xoff"))
-		config.flux = 1;
-	else if(!strcmp(message, "RTS/CTS"))
-		config.flux = 2;
-	else if(!strncmp(message, "RS485",5))
-		config.flux = 3;
-	else
-		config.flux = 0;
-	g_free(message);
-
-	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Combos[7])))
-	{
-		config.car = *gtk_entry_get_text(GTK_ENTRY(Entry));
-		config.delai = 0;
-	}
-	else
-		config.car = -1;
-
-	Config_port();
-	ConfigFlags();
-
-	message = get_port_string();
-	Set_status_message(message);
-	Set_window_title(message);
-	g_free(message);
-
-	return FALSE;
-}
-
-gint Grise_Degrise(GtkWidget *bouton, gpointer pointeur)
-{
-	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bouton)))
-	{
-		gtk_widget_set_sensitive(GTK_WIDGET(Entry), TRUE);
-		gtk_widget_set_sensitive(GTK_WIDGET(pointeur), FALSE);
-	}
-	else
-	{
-		gtk_widget_set_sensitive(GTK_WIDGET(Entry), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(pointeur), TRUE);
-	}
-	return FALSE;
-}
-
-void clear_scrollback(void){
-    vte_terminal_set_scrollback_lines (VTE_TERMINAL(display), 0);
-    vte_terminal_set_scrollback_lines (VTE_TERMINAL(display), term_conf.scrollback);
-}
-
-void read_font_button(GtkFontButton *fontButton)
-{
-	g_free(term_conf.font);
-	term_conf.font = g_strdup(gtk_font_chooser_get_font(GTK_FONT_CHOOSER(fontButton)));
-
-	if(term_conf.font != NULL)
-		vte_terminal_set_font(VTE_TERMINAL(display), pango_font_description_from_string(term_conf.font));
-}
-
-
-void select_config_callback(GtkAction *action, gpointer data)
-{
-	Select_config(_("Load configuration"), G_CALLBACK(load_config));
-}
-
-void save_config_callback(GtkAction *action, gpointer data)
-{
-	Save_config_file();
-}
-
-void delete_config_callback(GtkAction *action, gpointer data)
-{
-	Select_config(_("Delete configuration"), G_CALLBACK(delete_config));
-}
-
-void Select_config(gchar *title, void *callback)
-{
-	GtkWidget *dialog;
-	GtkWidget *content_area;
-	gint i, max;
-
-	GtkWidget *Frame, *Scroll, *Liste, *Label;
-	gchar *texte_label;
-
-	GtkListStore *Modele_Liste;
-	GtkTreeIter iter_Liste;
-	GtkCellRenderer *renderer;
-	GtkTreeViewColumn *Colonne;
-	GtkTreeSelection *Selection_Liste;
-
-	enum
-	{
-		N_texte,
-		N_COLONNES
-	};
-
-	/* Parse the config file */
-
-	max = cfgParse(g_file_get_path(config_file), cfg, CFG_INI);
-
-	if(max == -1)
-	{
-		show_message(_("Cannot read configuration file!\nConfig file may contain invalid parameter.\n"), MSG_ERR);
-		return;
-	}
-
-	else
-	{
-		gchar *Titre[]= {_("Configurations")};
-
-		dialog = gtk_dialog_new_with_buttons (title,
-		                                      NULL,
-		                                      GTK_DIALOG_DESTROY_WITH_PARENT,
-		                                      "_Cancel",
-		                                      GTK_RESPONSE_NONE,
-		                                      "_OK",
-		                                      GTK_RESPONSE_ACCEPT,
-		                                      NULL);
-
-		content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
-
-		Modele_Liste = gtk_list_store_new(N_COLONNES, G_TYPE_STRING);
-
-		Liste = gtk_tree_view_new_with_model(GTK_TREE_MODEL(Modele_Liste));
-		gtk_tree_view_set_search_column(GTK_TREE_VIEW(Liste), N_texte);
-
-		Selection_Liste = gtk_tree_view_get_selection(GTK_TREE_VIEW(Liste));
-		gtk_tree_selection_set_mode(Selection_Liste, GTK_SELECTION_SINGLE);
-
-		Frame = gtk_frame_new(NULL);
-
-		Scroll = gtk_scrolled_window_new(NULL, NULL);
-		gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(Scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-		gtk_container_add(GTK_CONTAINER(Frame), Scroll);
-		gtk_container_add(GTK_CONTAINER(Scroll), Liste);
-
-		renderer = gtk_cell_renderer_text_new();
-
-		g_object_set(G_OBJECT(renderer), "xalign", (gfloat)0.5, NULL);
-		Colonne = gtk_tree_view_column_new_with_attributes(Titre[0], renderer, "text", 0, NULL);
-		gtk_tree_view_column_set_sort_column_id(Colonne, 0);
-
-		Label=gtk_label_new("");
-		texte_label = g_strdup_printf("<span weight=\"bold\" style=\"italic\">%s</span>", Titre[0]);
-		gtk_label_set_markup(GTK_LABEL(Label), texte_label);
-		g_free(texte_label);
-		gtk_tree_view_column_set_widget(GTK_TREE_VIEW_COLUMN(Colonne), Label);
-		gtk_widget_show(Label);
-
-		gtk_tree_view_column_set_alignment(GTK_TREE_VIEW_COLUMN(Colonne), 0.5f);
-		gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(Colonne), FALSE);
-		gtk_tree_view_append_column(GTK_TREE_VIEW(Liste), Colonne);
-
-
-		for(i = 0; i < max; i++)
-		{
-			gtk_list_store_append(Modele_Liste, &iter_Liste);
-			gtk_list_store_set(Modele_Liste, &iter_Liste, N_texte, cfgSectionNumberToName(i), -1);
-		}
-
-		gtk_widget_set_size_request(GTK_WIDGET(dialog), 200, 200);
-
-		g_signal_connect(GTK_WIDGET(dialog), "response", G_CALLBACK (callback), GTK_TREE_SELECTION(Selection_Liste));
-		g_signal_connect_swapped(GTK_WIDGET(dialog), "response", G_CALLBACK(gtk_widget_destroy), GTK_WIDGET(dialog));
-
-		gtk_box_pack_start (GTK_BOX (content_area), Frame, TRUE, TRUE, 0);
-
-		gtk_widget_show_all (dialog);
-	}
-}
-
-void Save_config_file(void)
-{
-	GtkWidget *dialog, *content_area, *label, *box, *entry;
-
-	dialog = gtk_dialog_new_with_buttons (_("Save configuration"),
-	                                      NULL,
-	                                      GTK_DIALOG_DESTROY_WITH_PARENT,
-	                                      "_Cancel",
-	                                      GTK_RESPONSE_NONE,
-	                                      "_OK",
-	                                      GTK_RESPONSE_ACCEPT,
-	                                      NULL);
-	content_area = gtk_dialog_get_content_area (GTK_DIALOG(dialog));
-
-	gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
-
-	label = gtk_label_new(_("Configuration name: "));
-
-	box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
-	entry = gtk_entry_new();
-	gtk_entry_set_text(GTK_ENTRY(entry), "default");
-	gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
-	gtk_box_pack_start(GTK_BOX(box), label, FALSE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(box), entry, TRUE, TRUE, 0);
-
-	//validate input text (alpha-numeric only)
-	g_signal_connect(GTK_ENTRY(entry),
-	                 "insert-text",
-	                 G_CALLBACK(check_text_input), isalnum);
-	g_signal_connect(GTK_WIDGET(dialog), "response", G_CALLBACK(save_config), GTK_ENTRY(entry));
-	g_signal_connect_swapped(GTK_WIDGET(dialog), "response", G_CALLBACK(gtk_widget_destroy), GTK_WIDGET(dialog));
-
-	gtk_box_pack_start(GTK_BOX(content_area), box, TRUE, FALSE, 5);
-
-	gtk_widget_show_all (dialog);
-}
-
-void really_save_config(GtkDialog *Fenetre, gint id, gpointer data)
-{
-	int max, cfg_num, i;
-	gchar *string = NULL;
-
-	cfg_num = -1;
-
-	if(id == GTK_RESPONSE_ACCEPT)
-	{
-		max = cfgParse(g_file_get_path(config_file), cfg, CFG_INI);
-
-		if(max == -1)
-		{
-			show_message(_("Cannot save configuration file!\nConfig file may contain invalid parameter.\n"), MSG_ERR);
-			return;
-		}
-
-		for(i = 0; i < max; i++)
-		{
-			if(!strcmp((char *)data, cfgSectionNumberToName(i)))
-				cfg_num = i;
-		}
-
-		/* not overwriting */
-		if(cfg_num == -1)
-		{
-			max = cfgAllocForNewSection(cfg, (char *)data);
-			cfg_num = max - 1;
-		}
-		else
-		{
-			if(remove_section(g_file_get_path(config_file), (char *)data) == -1)
-			{
-				show_message(_("Cannot overwrite section!"), MSG_ERR);
-				return;
-			}
-			if(max == cfgParse(g_file_get_path(config_file), cfg, CFG_INI))
-			{
-				show_message(_("Cannot read configuration file!"), MSG_ERR);
-				return;
-			}
-			max = cfgAllocForNewSection(cfg, (char *)data);
-			cfg_num = max - 1;
-		}
-
-		Copy_configuration(cfg_num);
-		cfgDump(g_file_get_path(config_file), cfg, CFG_INI, max);
-
-		string = g_strdup_printf(_("Configuration [%s] saved\n"), (char *)data);
-		show_message(string, MSG_WRN);
-		g_free(string);
-	}
-	else
-		Save_config_file();
-}
-
-void save_config(GtkDialog *Fenetre, gint id, GtkWidget *edit)
-{
-	int max, i;
-	const gchar *config_name;
-
-	if(id == GTK_RESPONSE_ACCEPT)
-	{
-		max = cfgParse(g_file_get_path(config_file), cfg, CFG_INI);
-
-		if(max == -1)
-		{
-			show_message(_("Cannot write configuration file!\nConfig file may contain invalid parameter.\n"), MSG_ERR);
-			return;
-		}
-
-		config_name = gtk_entry_get_text(GTK_ENTRY(edit));
-
-		for(i = 0; i < max; i++)
-		{
-			if(!strcmp(config_name, cfgSectionNumberToName(i)))
-			{
-				GtkWidget *message_dialog;
-				message_dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(Fenetre),
-				                 GTK_DIALOG_DESTROY_WITH_PARENT,
-				                 GTK_MESSAGE_QUESTION,
-				                 GTK_BUTTONS_NONE,
-				                 _("<b>Section [%s] already exists.</b>\n\nDo you want to overwrite it ?"),
-				                 config_name);
-
-				gtk_dialog_add_buttons(GTK_DIALOG(message_dialog),
-				                       "_Cancel",
-				                       GTK_RESPONSE_NONE,
-				                       "_Yes",
-				                       GTK_RESPONSE_ACCEPT,
-				                       NULL);
-
-				if (gtk_dialog_run(GTK_DIALOG(message_dialog)) == GTK_RESPONSE_ACCEPT)
-					really_save_config(Fenetre, GTK_RESPONSE_ACCEPT, (gpointer)config_name);
-
-				gtk_widget_destroy(message_dialog);
-
-				i = max + 1;
-			}
-		}
-		if(i == max) /* Section does not exist */
-			really_save_config(Fenetre, GTK_RESPONSE_ACCEPT, (gpointer)config_name);
-	}
-}
-
-void load_config(GtkDialog *Fenetre, gint id, GtkTreeSelection *Selection_Liste)
-{
-	GtkTreeIter iter;
-	GtkTreeModel *Modele;
-	gchar *txt, *message;
-
-	if(id == GTK_RESPONSE_ACCEPT)
-	{
-		if(gtk_tree_selection_get_selected(Selection_Liste, &Modele, &iter))
-		{
-			gtk_tree_model_get(GTK_TREE_MODEL(Modele), &iter, 0, (gint *)&txt, -1);
-			Load_configuration_from_file(txt);
-			Verify_configuration();
-			Config_port();
-			ConfigFlags();
-			add_shortcuts();
-
-			message = get_port_string();
-			Set_status_message(message);
-			Set_window_title(message);
-			g_free(message);
-		}
-	}
-}
-
-void delete_config(GtkDialog *Fenetre, gint id, GtkTreeSelection *Selection_Liste)
-{
-	GtkTreeIter iter;
-	GtkTreeModel *Modele;
-	gchar *txt;
-
-	if(id == GTK_RESPONSE_ACCEPT)
-	{
-		if(gtk_tree_selection_get_selected(Selection_Liste, &Modele, &iter))
-		{
-			gtk_tree_model_get(GTK_TREE_MODEL(Modele), &iter, 0, (gint *)&txt, -1);
-			if(remove_section(g_file_get_path(config_file), txt) == -1)
-				show_message(_("Cannot delete section!"), MSG_ERR);
-		}
-	}
-}
-
-gint Load_configuration_from_file(gchar *config_name)
-{
-	int max, i, j, k, size;
-	gchar *string = NULL;
-	gchar *str;
-	macro_t *macros = NULL;
-	cfgList *t;
-
-	max = cfgParse(g_file_get_path(config_file), cfg, CFG_INI);
-
-	if(max == -1)
-	{
-		show_message(_("Cannot read configuration file!\nConfig file may contain invalid parameter.\n"), MSG_ERR);
-		return -1;
-	}
-
-	else
-	{
-		for(i = 0; i < max; i++)
-		{
-			if(!strcmp(config_name, cfgSectionNumberToName(i)))
-			{
-				Hard_default_configuration();
-
-				if(port[i] != NULL)
-					strcpy(config.port, port[i]);
-				if(speed[i] != 0)
-					config.vitesse = speed[i];
-				if(bits[i] != 0)
-					config.bits = bits[i];
-				if(stopbits[i] != 0)
-					config.stops = stopbits[i];
-				if(parity[i] != NULL)
-				{
-					if(!g_ascii_strcasecmp(parity[i], "none"))
-						config.parite = 0;
-					else if(!g_ascii_strcasecmp(parity[i], "odd"))
-						config.parite = 1;
-					else if(!g_ascii_strcasecmp(parity[i], "even"))
-						config.parite = 2;
-				}
-				if(flow[i] != NULL)
-				{
-					if(!g_ascii_strcasecmp(flow[i], "none"))
-						config.flux = 0;
-					else if(!g_ascii_strcasecmp(flow[i], "xon"))
-						config.flux = 1;
-					else if(!g_ascii_strcasecmp(flow[i], "rts"))
-						config.flux = 2;
-					else if(!g_ascii_strcasecmp(flow[i], "rs485"))
-						config.flux = 3;
-				}
-
-				config.delai = wait_delay[i];
-
-				if(wait_char[i] != 0)
-					config.car = (signed char)wait_char[i];
-				else
-					config.car = -1;
-
-				config.rs485_rts_time_before_transmit = rts_time_before_tx[i];
-				config.rs485_rts_time_after_transmit = rts_time_after_tx[i];
-
-				if(echo[i] != -1)
-					config.echo = (gboolean)echo[i];
-				else
-					config.echo = FALSE;
-
-				if(crlfauto[i] != -1)
-					config.crlfauto = (gboolean)crlfauto[i];
-				else
-					config.crlfauto = FALSE;
-
-				if(timestamp[i] != -1)
-					config.timestamp = (gboolean)timestamp[i];
-				else
-					config.timestamp = FALSE;
-
-				g_free(term_conf.font);
-				term_conf.font = g_strdup(font[i]);
-
-				t = macro_list[i];
-				size = 0;
-				if(t != NULL)
-				{
-					size++;
-					while(t->next != NULL)
-					{
-						t = t->next;
-						size++;
-					}
-				}
-
-				if(size != 0)
-				{
-					t = macro_list[i];
-					macros = g_malloc(size * sizeof(macro_t));
-					if(macros == NULL)
-					{
-						perror("malloc");
-						return -1;
-					}
-					for(j = 0; j < size; j++)
-					{
-						for(k = 0; k < (strlen(t->str) - 1); k++)
-						{
-							if((t->str[k] == ':') && (t->str[k + 1] == ':'))
-								break;
-						}
-						macros[j].shortcut = g_strndup(t->str, k);
-						str = &(t->str[k + 2]);
-						macros[j].action = g_strdup(str);
-
-						t = t->next;
-					}
-				}
-
-				remove_shortcuts();
-				create_shortcuts(macros, size);
-				g_free(macros);
-
-				if(block_cursor[i] != -1)
-					term_conf.block_cursor = (gboolean)block_cursor[i];
-				else
-					term_conf.block_cursor = TRUE;
-
-				if(rows[i] != 0)
-					term_conf.rows = rows[i];
-
-				if(columns[i] != 0)
-					term_conf.columns = columns[i];
-
-				if(scrollback[i] != 0)
-					term_conf.scrollback = scrollback[i];
-
-				if(visual_bell[i] != -1)
-					term_conf.visual_bell = (gboolean)visual_bell[i];
-				else
-					term_conf.visual_bell = FALSE;
-
-				term_conf.foreground_color.red = foreground_red[i];
-				term_conf.foreground_color.green = foreground_green[i];
-				term_conf.foreground_color.blue = foreground_blue[i];
-				term_conf.foreground_color.alpha = foreground_alpha[i];
-
-				term_conf.background_color.red = background_red[i];
-				term_conf.background_color.green = background_green[i];
-				term_conf.background_color.blue = background_blue[i];
-				term_conf.background_color.alpha = background_alpha[i];
-
-				/* rows and columns are empty when the conf is autogenerate in the
-				   first save; so set term to default */
-				if(rows[i] == 0 || columns[i] == 0)
-				{
-					term_conf.block_cursor = TRUE;
-					term_conf.rows = 80;
-					term_conf.columns = 25;
-					term_conf.scrollback = DEFAULT_SCROLLBACK;
-					term_conf.visual_bell = FALSE;
-
-					term_conf.foreground_color.red = 0.66;
-					term_conf.foreground_color.green = 0.66;
-					term_conf.foreground_color.blue = 0.66;
-					term_conf.foreground_color.alpha = 1;
-
-					term_conf.background_color.red = 0;
-					term_conf.background_color.green = 0;
-					term_conf.background_color.blue = 0;
-					term_conf.background_color.alpha = 1;
-				}
-
-				i = max + 1;
-			}
-		}
-		if(i == max)
-		{
-			string = g_strdup_printf(_("No section \"%s\" in configuration file\n"), config_name);
-			show_message(string, MSG_ERR);
-			g_free(string);
-			return -1;
-		}
-	}
-
-	vte_terminal_set_font(VTE_TERMINAL(display), pango_font_description_from_string(term_conf.font));
-
-	vte_terminal_set_size (VTE_TERMINAL(display), term_conf.rows, term_conf.columns);
-	vte_terminal_set_scrollback_lines (VTE_TERMINAL(display), term_conf.scrollback);
-	vte_terminal_set_color_foreground (VTE_TERMINAL(display), &term_conf.foreground_color);
-	vte_terminal_set_color_background (VTE_TERMINAL(display), &term_conf.background_color);
-	vte_terminal_set_color_background (VTE_TERMINAL(display), &term_conf.background_color);
-	vte_terminal_set_cursor_shape(VTE_TERMINAL(display), term_conf.block_cursor ? VTE_CURSOR_SHAPE_BLOCK : VTE_CURSOR_SHAPE_IBEAM);
-	gtk_widget_queue_draw(display);
-
-	return 0;
-}
-
-void Verify_configuration(void)
-{
-	gchar *string = NULL;
-
-	switch(config.vitesse)
-	{
-	case 300:
-	case 600:
-	case 1200:
-	case 2400:
-	case 4800:
-	case 9600:
-	case 19200:
-	case 38400:
-	case 57600:
-	case 115200:
-	case 230400:
-	case 460800:
-	case 576000:
-	case 921600:
-	case 1000000:
-	case 2000000:
-		break;
-
-	default:
-		string = g_strdup_printf(_("Baudrate %d may not be supported by all hardware"), config.vitesse);
-		show_message(string, MSG_ERR);
-		g_free(string);
-	}
-
-	if(config.stops != 1 && config.stops != 2)
-	{
-		string = g_strdup_printf(_("Invalid number of stop-bits: %d\nFalling back to default number of stop-bits number: %d\n"), config.stops, DEFAULT_STOP);
-		show_message(string, MSG_ERR);
-		config.stops = DEFAULT_STOP;
-		g_free(string);
-	}
-
-	if(config.bits < 5 || config.bits > 8)
-	{
-		string = g_strdup_printf(_("Invalid number of bits: %d\nFalling back to default number of bits: %d\n"), config.bits, DEFAULT_BITS);
-		show_message(string, MSG_ERR);
-		config.bits = DEFAULT_BITS;
-		g_free(string);
-	}
-
-	if(config.delai < 0 || config.delai > 500)
-	{
-		string = g_strdup_printf(_("Invalid delay: %d ms\nFalling back to default delay: %d ms\n"), config.delai, DEFAULT_DELAY);
-		show_message(string, MSG_ERR);
-		config.delai = DEFAULT_DELAY;
-		g_free(string);
-	}
-
-	if(term_conf.font == NULL)
-		term_conf.font = g_strdup_printf(DEFAULT_FONT);
-
-}
-
-gint Check_configuration_file(void)
-{
-	struct stat my_stat;
-	gchar *string = NULL;
-
-	/* is configuration file present ? */
-	if(stat(g_file_get_path(config_file), &my_stat) == 0)
-	{
-		/* If bad configuration file, fallback to _hardcoded_ defaults! */
-		if(Load_configuration_from_file("default") == -1)
-		{
-			Hard_default_configuration();
-			return -1;
-		}
-	}
-
-	/* if not, create it, with the [default] section */
-	else
-	{
-		string = g_strdup_printf(_("Configuration file (%s) with\n[default] configuration has been created.\n"), g_file_get_path(config_file));
-		show_message(string, MSG_WRN);
-		cfgAllocForNewSection(cfg, "default");
-		Hard_default_configuration();
-		Copy_configuration(0);
-		cfgDump(g_file_get_path(config_file), cfg, CFG_INI, 1);
-		g_free(string);
-	}
-	return 0;
-}
-
-void Hard_default_configuration(void)
-{
-	strcpy(config.port, DEFAULT_PORT);
-	config.vitesse = DEFAULT_SPEED;
-	config.parite = DEFAULT_PARITY;
-	config.bits = DEFAULT_BITS;
-	config.stops = DEFAULT_STOP;
-	config.flux = DEFAULT_FLOW;
-	config.delai = DEFAULT_DELAY;
-	config.rs485_rts_time_before_transmit = DEFAULT_DELAY_RS485;
-	config.rs485_rts_time_after_transmit = DEFAULT_DELAY_RS485;
-	config.car = DEFAULT_CHAR;
-	config.echo = DEFAULT_ECHO;
-	config.crlfauto = FALSE;
-	config.timestamp = FALSE;
-  config.disable_port_lock = FALSE;
-
-	term_conf.font = g_strdup_printf(DEFAULT_FONT);
-
-	term_conf.block_cursor = TRUE;
-	term_conf.rows = 80;
-	term_conf.columns = 25;
-	term_conf.scrollback = DEFAULT_SCROLLBACK;
-	term_conf.visual_bell = TRUE;
-
-	Selec_couleur(&term_conf.foreground_color, 0.66, 0.66, 0.66, 1.0);
-	Selec_couleur(&term_conf.background_color, 0, 0, 0, 1.0);
-}
-
-void Copy_configuration(int pos)
-{
-	gchar *string = NULL;
-	macro_t *macros = NULL;
-	gint size, i;
-
-	string = g_strdup(config.port);
-	cfgStoreValue(cfg, "port", string, CFG_INI, pos);
-	g_free(string);
-
-	string = g_strdup_printf("%d", config.vitesse);
-	cfgStoreValue(cfg, "speed", string, CFG_INI, pos);
-	g_free(string);
-
-	string = g_strdup_printf("%d", config.bits);
-	cfgStoreValue(cfg, "bits", string, CFG_INI, pos);
-	g_free(string);
-
-	string = g_strdup_printf("%d", config.stops);
-	cfgStoreValue(cfg, "stopbits", string, CFG_INI, pos);
-	g_free(string);
-
-	switch(config.parite)
-	{
-	case 0:
-		string = g_strdup_printf("none");
-		break;
-	case 1:
-		string = g_strdup_printf("odd");
-		break;
-	case 2:
-		string = g_strdup_printf("even");
-		break;
-	default:
-		string = g_strdup_printf("none");
-	}
-	cfgStoreValue(cfg, "parity", string, CFG_INI, pos);
-	g_free(string);
-
-	switch(config.flux)
-	{
-	case 0:
-		string = g_strdup_printf("none");
-		break;
-	case 1:
-		string = g_strdup_printf("xon");
-		break;
-	case 2:
-		string = g_strdup_printf("rts");
-		break;
-	case 3:
-		string = g_strdup_printf("rs485");
-		break;
-	default:
-		string = g_strdup_printf("none");
-	}
-
-	cfgStoreValue(cfg, "flow", string, CFG_INI, pos);
-	g_free(string);
-
-	string = g_strdup_printf("%d", config.delai);
-	cfgStoreValue(cfg, "wait_delay", string, CFG_INI, pos);
-	g_free(string);
-
-	string = g_strdup_printf("%d", config.car);
-	cfgStoreValue(cfg, "wait_char", string, CFG_INI, pos);
-	g_free(string);
-
-	string = g_strdup_printf("%d", config.rs485_rts_time_before_transmit);
-	cfgStoreValue(cfg, "rs485_rts_time_before_tx", string, CFG_INI, pos);
-	g_free(string);
-	string = g_strdup_printf("%d", config.rs485_rts_time_after_transmit);
-	cfgStoreValue(cfg, "rs485_rts_time_after_tx", string, CFG_INI, pos);
-	g_free(string);
-
-	if(config.echo == FALSE)
-		string = g_strdup_printf("False");
-	else
-		string = g_strdup_printf("True");
-
-	cfgStoreValue(cfg, "echo", string, CFG_INI, pos);
-	g_free(string);
-
-	if(config.crlfauto == FALSE)
-		string = g_strdup_printf("False");
-	else
-		string = g_strdup_printf("True");
-
-	cfgStoreValue(cfg, "crlfauto", string, CFG_INI, pos);
-	g_free(string);
-
-	if(config.timestamp == FALSE)
-		string = g_strdup_printf("False");
-	else
-		string = g_strdup_printf("True");
-
-	cfgStoreValue(cfg, "timestamp", string, CFG_INI, pos);
-	g_free(string);
-
-	string = g_strdup(term_conf.font);
-	cfgStoreValue(cfg, "font", string, CFG_INI, pos);
-	g_free(string);
-
-	macros = get_shortcuts(&size);
-	for(i = 0; i < size; i++)
-	{
-		string = g_strdup_printf("%s::%s", macros[i].shortcut, macros[i].action);
-		cfgStoreValue(cfg, "macros", string, CFG_INI, pos);
-		g_free(string);
-	}
-
-	if(term_conf.block_cursor == FALSE)
-		string = g_strdup_printf("False");
-	else
-		string = g_strdup_printf("True");
-	cfgStoreValue(cfg, "term_block_cursor", string, CFG_INI, pos);
-	g_free(string);
-
-	string = g_strdup_printf("%d", term_conf.rows);
-	cfgStoreValue(cfg, "term_rows", string, CFG_INI, pos);
-	g_free(string);
-
-	string = g_strdup_printf("%d", term_conf.columns);
-	cfgStoreValue(cfg, "term_columns", string, CFG_INI, pos);
-	g_free(string);
-
-	string = g_strdup_printf("%d", term_conf.scrollback);
-	cfgStoreValue(cfg, "term_scrollback", string, CFG_INI, pos);
-	g_free(string);
-
-	if(term_conf.visual_bell == FALSE)
-		string = g_strdup_printf("False");
-	else
-		string = g_strdup_printf("True");
-	cfgStoreValue(cfg, "term_visual_bell", string, CFG_INI, pos);
-	g_free(string);
-
-	string = g_strdup_printf("%f", term_conf.foreground_color.red);
-	cfgStoreValue(cfg, "term_foreground_red", string, CFG_INI, pos);
-	g_free(string);
-	string = g_strdup_printf("%f", term_conf.foreground_color.green);
-	cfgStoreValue(cfg, "term_foreground_green", string, CFG_INI, pos);
-	g_free(string);
-	string = g_strdup_printf("%f", term_conf.foreground_color.blue);
-	cfgStoreValue(cfg, "term_foreground_blue", string, CFG_INI, pos);
-	g_free(string);
-	string = g_strdup_printf("%f", term_conf.foreground_color.alpha);
-	cfgStoreValue(cfg, "term_foreground_alpha", string, CFG_INI, pos);
-	g_free(string);
-
-	string = g_strdup_printf("%f", term_conf.background_color.red);
-	cfgStoreValue(cfg, "term_background_red", string, CFG_INI, pos);
-	g_free(string);
-	string = g_strdup_printf("%f", term_conf.background_color.green);
-	cfgStoreValue(cfg, "term_background_green", string, CFG_INI, pos);
-	g_free(string);
-	string = g_strdup_printf("%f", term_conf.background_color.blue);
-	cfgStoreValue(cfg, "term_background_blue", string, CFG_INI, pos);
-	g_free(string);
-	string = g_strdup_printf("%f", term_conf.background_color.alpha);
-	cfgStoreValue(cfg, "term_background_alpha", string, CFG_INI, pos);
-	g_free(string);
-}
-
-
-gint remove_section(gchar *cfg_file, gchar *section)
-{
-	FILE *f = NULL;
-	char *buffer = NULL;
-	char *buf;
-	long size;
-	gchar *to_search;
-	long i, j, length, sect;
-
-	f = fopen(cfg_file, "r");
-	if(f == NULL)
-	{
-		perror(cfg_file);
-		return -1;
-	}
-
-	fseek(f, 0L, SEEK_END);
-	size = ftell(f);
-	rewind(f);
-
-	buffer = g_malloc(size);
-	if(buffer == NULL)
-	{
-		perror("malloc");
-		return -1;
-	}
-
-	if(fread(buffer, 1, size, f) != size)
-	{
-		perror(cfg_file);
-		fclose(f);
-		return -1;
-	}
-
-	to_search = g_strdup_printf("[%s]", section);
-	length = strlen(to_search);
-
-	/* Search section */
-	for(i = 0; i < size - length; i++)
-	{
-		for(j = 0; j < length; j++)
-		{
-			if(to_search[j] != buffer[i + j])
-				break;
-		}
-		if(j == length)
-			break;
-	}
-
-	if(i == size - length)
-	{
-		i18n_printf(_("Cannot find section %s\n"), to_search);
-		return -1;
-	}
-
-	sect = i;
-
-	/* Search for next section */
-	for(i = sect + length; i < size; i++)
-	{
-		if(buffer[i] == '[')
-			break;
-	}
-
-	f = fopen(cfg_file, "w");
-	if(f == NULL)
-	{
-		perror(cfg_file);
-		return -1;
-	}
-
-	fwrite(buffer, 1, sect, f);
-	buf = buffer + i;
-	fwrite(buf, 1, size - i, f);
-	fclose(f);
-
-	g_free(to_search);
-	g_free(buffer);
-
-	return 0;
-}
-
-
-void Config_Terminal(GtkAction *action, gpointer data)
-{
-	GtkBuilder *builder;
-	builder = gtk_builder_new_from_resource("/org/gtk/gtkterm/config_terminal_dialog.ui");
-
-	GtkWidget *dialog;
-	dialog = GTK_WIDGET(gtk_builder_get_object(builder, "dialog"));
-	gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(Fenetre));
-	gtk_window_set_title(GTK_WINDOW(dialog), _("Main Window"));
-
-	/** Connect signals **/
-	// Font Selection Button
-	GtkWidget *cfg_terminal_font;
-	cfg_terminal_font = GTK_WIDGET(gtk_builder_get_object(builder, "cfg_terminal_font"));
-	g_signal_connect(cfg_terminal_font, "font-set", G_CALLBACK(read_font_button), 0);
-
-	// Scrollback Lines
-	GtkAdjustment *cfg_scrollback_lines;
-	cfg_scrollback_lines = GTK_ADJUSTMENT(gtk_builder_get_object(builder, "cfg_scrollback_lines"));
-	gtk_adjustment_set_value(cfg_scrollback_lines, term_conf.scrollback);
-	g_signal_connect(G_OBJECT(cfg_scrollback_lines), "value_changed", G_CALLBACK(scrollback_set), 0);
-
-	// Show cursor
-	GtkWidget *cfg_block_cursor;
-	cfg_block_cursor = GTK_WIDGET(gtk_builder_get_object(builder, "cfg_block_cursor"));
-	gtk_switch_set_active(GTK_SWITCH(cfg_block_cursor), term_conf.block_cursor);
-	g_signal_connect(cfg_block_cursor, "state_set", G_CALLBACK(cursor_block), 0);
-
-	// Text color
-	GtkWidget *cfg_text_color;
-	cfg_text_color = GTK_WIDGET(gtk_builder_get_object(builder, "cfg_text_color"));
-	gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(cfg_text_color), &term_conf.foreground_color);
-	g_signal_connect(cfg_text_color, "color-set", G_CALLBACK (config_fg_color), 0);
-
-	// Background color
-	GtkWidget *cfg_background_color;
-	cfg_background_color = GTK_WIDGET(gtk_builder_get_object(builder, "cfg_background_color"));
-	gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(cfg_background_color), &term_conf.background_color);
-	g_signal_connect(cfg_background_color, "color-set", G_CALLBACK (config_bg_color), 0);
-
-	// Close button
-	GtkWidget *close;
-	close = GTK_WIDGET(gtk_builder_get_object(builder, "close"));
-	g_signal_connect_swapped(close, "clicked", G_CALLBACK(gtk_widget_destroy), GTK_WIDGET(dialog));
-
-	gtk_widget_show_all(dialog);
-}
-
-gboolean cursor_block(GtkSwitch *ToggleSwitch, gboolean state, gpointer data)
-{
-	term_conf.block_cursor = state;
-	vte_terminal_set_cursor_shape(VTE_TERMINAL(display), term_conf.block_cursor ? VTE_CURSOR_SHAPE_BLOCK : VTE_CURSOR_SHAPE_IBEAM);
-	return FALSE;
-}
-
-void Selec_couleur(GdkRGBA *color, gfloat R, gfloat G, gfloat B, gfloat A)
-{
-	color->red = R;
-	color->green = G;
-	color->blue = B;
-	color->alpha = A;
-}
-
-void config_fg_color(GtkWidget *button, gpointer data)
-{
-	gchar *string;
-
-	gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(button), &term_conf.foreground_color);
-
-	vte_terminal_set_color_foreground (VTE_TERMINAL(display), &term_conf.foreground_color);
-	gtk_widget_queue_draw (display);
-
-	string = g_strdup_printf ("%d", (gint)term_conf.foreground_color.red);
-	cfgStoreValue (cfg, "term_foreground_red", string, CFG_INI, 0);
-	g_free (string);
-	string = g_strdup_printf ("%d", (gint)term_conf.foreground_color.green);
-	cfgStoreValue (cfg, "term_foreground_green", string, CFG_INI, 0);
-	g_free (string);
-	string = g_strdup_printf ("%d", (gint)term_conf.foreground_color.blue);
-	cfgStoreValue (cfg, "term_foreground_blue", string, CFG_INI, 0);
-	g_free (string);
-	string = g_strdup_printf ("%d", (gint)term_conf.foreground_color.alpha);
-	cfgStoreValue (cfg, "term_foreground_alpha", string, CFG_INI, 0);
-	g_free (string);
-}
-
-void config_bg_color(GtkWidget *button, gpointer data)
-{
-	gchar *string;
-
-	gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(button), &term_conf.background_color);
-
-	vte_terminal_set_color_background (VTE_TERMINAL(display), &term_conf.background_color);
-	gtk_widget_queue_draw (display);
-
-	string = g_strdup_printf ("%d", (gint)term_conf.background_color.red);
-	cfgStoreValue (cfg, "term_background_red", string, CFG_INI, 0);
-	g_free (string);
-	string = g_strdup_printf ("%d", (gint)term_conf.background_color.green);
-	cfgStoreValue (cfg, "term_background_green", string, CFG_INI, 0);
-	g_free (string);
-	string = g_strdup_printf ("%d", (gint)term_conf.background_color.blue);
-	cfgStoreValue (cfg, "term_background_blue", string, CFG_INI, 0);
-	g_free (string);
-	string = g_strdup_printf ("%d", (gint)term_conf.background_color.alpha);
-	cfgStoreValue (cfg, "term_background_alpha", string, CFG_INI, 0);
-	g_free (string);
-}
-
-void scrollback_set(GtkAdjustment *Adjustment, gpointer data)
-{
-	gint scrollback = gtk_adjustment_get_value(Adjustment);
-	term_conf.scrollback = scrollback;
-	vte_terminal_set_scrollback_lines (VTE_TERMINAL(display), term_conf.scrollback);
-}
-
-/**
- *  Filter user data entry on a GTK entry
- *
- *  user_data must be a function that takes an int and returns an int
- *  != 0 if the input is valid.  For instance, 'isdigit()'.
- */
-void check_text_input(GtkEditable *editable,
-                      gchar       *new_text,
-                      gint         new_text_length,
-                      gint        *position,
-                      gpointer     user_data)
-{
-	int i;
-	int (*check_func)(int) = NULL;
-
-	if(user_data == NULL)
-	{
-		return;
-	}
-
-	g_signal_handlers_block_by_func(editable,
-	                                (gpointer)check_text_input, user_data);
-	check_func = (int (*)(int))user_data;
-
-	for(i = 0; i < new_text_length; i++)
-	{
-		if(!check_func(new_text[i]))
-			goto invalid_input;
-	}
-
-	gtk_editable_insert_text(editable, new_text, new_text_length, position);
-
-invalid_input:
-	g_signal_handlers_unblock_by_func(editable,
-	                                  (gpointer)check_text_input, user_data);
-	g_signal_stop_emission_by_name(editable, "insert-text");
-}
diff --git a/src/term_config.h b/src/term_config.h
deleted file mode 100644
index 90db030..0000000
--- a/src/term_config.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/***********************************************************************/
-/* config.h                                                            */
-/* --------                                                            */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      Configuration of the serial port                               */
-/*      - Header file -                                                */
-/*                                                                     */
-/***********************************************************************/
-
-#ifndef TERM_CONFIG_H_
-#define TERM_CONFIG_H_
-
-void config_file_init(void);
-void ConfigFlags(void);
-void Config_Port_Fenetre(GtkAction *action, gpointer data);
-gint Lis_Config(GtkWidget *bouton, GtkWidget **Combos);
-void Config_Terminal(GtkAction *action, gpointer data);
-void select_config_callback(GtkAction *action, gpointer data);
-void save_config_callback(GtkAction *action, gpointer data);
-void delete_config_callback(GtkAction *action, gpointer data);
-void Verify_configuration(void);
-gint Load_configuration_from_file(gchar *);
-gint Check_configuration_file(void);
-void check_text_input(GtkEditable *editable,
-                      gchar       *new_text,
-                      gint         new_text_length,
-                      gint        *position,
-                      gpointer     user_data);
-void clear_scrollback(void);
-
-struct configuration_port
-{
-	gchar port[1024];
-	gint vitesse;                // 300 - 600 - 1200 - ... - 2000000
-	gint bits;                   // 5 - 6 - 7 - 8
-	gint stops;                  // 1 - 2
-	gint parite;                 // 0 : None, 1 : Odd, 2 : Even
-	gint flux;                   // 0 : None, 1 : Xon/Xoff, 2 : RTS/CTS, 3 : RS485halfduplex
-	gint delai;                  // end of char delay: in ms
-	gint rs485_rts_time_before_transmit;
-	gint rs485_rts_time_after_transmit;
-	gchar car;                   // caractere attendre
-	gboolean echo;               // echo local
-	gboolean crlfauto;           // line feed auto
-	gboolean timestamp;
-	gboolean disable_port_lock;
-};
-
-typedef struct
-{
-	gboolean block_cursor;
-	gint rows;
-	gint columns;
-	gint scrollback;
-	gboolean visual_bell;
-	GdkRGBA foreground_color;
-	GdkRGBA background_color;
-	gchar *font;
-} display_config_t;
-
-
-#define DEFAULT_FONT "Monospace 12"
-#define DEFAULT_SCROLLBACK 10000
-
-#define DEFAULT_PORT "/dev/ttyS0"
-#define DEFAULT_SPEED 115200
-#define DEFAULT_PARITY 0
-#define DEFAULT_BITS 8
-#define DEFAULT_STOP 1
-#define DEFAULT_FLOW 0
-#define DEFAULT_DELAY 0
-#define DEFAULT_CHAR -1
-#define DEFAULT_DELAY_RS485 30
-#define DEFAULT_ECHO FALSE
-
-#endif
diff --git a/src/user_signals.c b/src/user_signals.c
deleted file mode 100644
index 8605062..0000000
--- a/src/user_signals.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <gtk/gtk.h>
-#include "interface.h"
-
-static gboolean handle_usr1(gpointer user_data)
-{
-	interface_open_port();
-	return G_SOURCE_CONTINUE;
-}
-
-static gboolean handle_usr2(gpointer user_data)
-{
-	interface_close_port();
-	return G_SOURCE_CONTINUE;
-}
-
-void user_signals_catch(void)
-{
-	g_unix_signal_add(SIGUSR1, (GSourceFunc) handle_usr1, NULL);
-	g_unix_signal_add(SIGUSR2, (GSourceFunc) handle_usr2, NULL);
-}
diff --git a/src/user_signals.h b/src/user_signals.h
deleted file mode 100644
index 8b8de3a..0000000
--- a/src/user_signals.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/***********************************************************************/
-/* device_mintor.h                                                     */
-/* ---------                                                           */
-/*           GTKTerm Software                                          */
-/*                      (c) Julien Schmitt                             */
-/*                                                                     */
-/* ------------------------------------------------------------------- */
-/*                                                                     */
-/*   Purpose                                                           */
-/*      React to SIGUSR signals (for scriptability)                    */
-/*                                                                     */
-/***********************************************************************/
-
-#ifndef _USER_SIGNALS
-#define _USER_SIGNALS
-
-void user_signals_catch(void);
-
-#endif

Debdiff

[The following lists of changes regard files as different if they have different names, permissions or owners.]

Files in second set of .debs but not in first

-rw-r--r--  root/root   /usr/lib/debug/.build-id/c1/9af168fa92f211456e0afb6573b422863ef9fa.debug
-rw-r--r--  root/root   /usr/lib/debug/.build-id/f7/7f35fd97a944da9277261bcb7947b35ea02f07.debug
-rw-r--r--  root/root   /usr/lib/debug/.dwz/x86_64-linux-gnu/gtkterm.debug
-rw-r--r--  root/root   /usr/share/glib-2.0/schemas/com.github.jeija.gtkterm.gschema.xml
-rw-r--r--  root/root   /usr/share/locale/de/LC_MESSAGES/GTKTerm.mo
-rw-r--r--  root/root   /usr/share/locale/fr/LC_MESSAGES/GTKTerm.mo
-rw-r--r--  root/root   /usr/share/locale/hu/LC_MESSAGES/GTKTerm.mo
-rw-r--r--  root/root   /usr/share/locale/nl_NL/LC_MESSAGES/GTKTerm.mo
-rw-r--r--  root/root   /usr/share/locale/ru/LC_MESSAGES/GTKTerm.mo
-rw-r--r--  root/root   /usr/share/locale/zh_CN/LC_MESSAGES/GTKTerm.mo
-rwxr-xr-x  root/root   /usr/bin/gtkterm_conv

Files in first set of .debs but not in second

-rw-r--r--  root/root   /usr/lib/debug/.build-id/f8/74e0a06bfc7e443c2759fd724f4e0bf333816c.debug
-rw-r--r--  root/root   /usr/share/locale/de/LC_MESSAGES/gtkterm.mo
-rw-r--r--  root/root   /usr/share/locale/fr/LC_MESSAGES/gtkterm.mo
-rw-r--r--  root/root   /usr/share/locale/hu/LC_MESSAGES/gtkterm.mo
-rw-r--r--  root/root   /usr/share/locale/nl_NL/LC_MESSAGES/gtkterm.mo
-rw-r--r--  root/root   /usr/share/locale/ru/LC_MESSAGES/gtkterm.mo
-rw-r--r--  root/root   /usr/share/locale/zh_CN/LC_MESSAGES/gtkterm.mo

Control files of package gtkterm: lines which differ (wdiff format)

  • Depends: libc6 (>= 2.34), libgdk-pixbuf-2.0-0 (>= 2.25.2), libglib2.0-0 (>= 2.55.1), libgtk-3-0 2.63.1), libgtk-4-1 (>= 3.9.10), 4.0.0), libgudev-1.0-0 (>= 146), libpango-1.0-0 (>= 1.14.0), libvte-2.91-0 (>= 0.45.90) 1.18.0), libvte-2.91-gtk4-0, dconf-gsettings-backend | gsettings-backend

Control files of package gtkterm-dbgsym: lines which differ (wdiff format)

  • Build-Ids: f874e0a06bfc7e443c2759fd724f4e0bf333816c c19af168fa92f211456e0afb6573b422863ef9fa f77f35fd97a944da9277261bcb7947b35ea02f07

More details

Full run details