Bläddra i källkod

Get rid of horrible tabs in files.

Signed-off-by: Bradley Smith <[email protected]>
Bradley Smith 15 år sedan
förälder
incheckning
9c9d4dae05
9 ändrade filer med 920 tillägg och 920 borttagningar
  1. 114 114
      src/mssh-gconf.c
  2. 15 15
      src/mssh-gconf.h
  3. 202 202
      src/mssh-pref.c
  4. 10 10
      src/mssh-pref.h
  5. 56 56
      src/mssh-terminal.c
  6. 19 19
      src/mssh-terminal.h
  7. 268 268
      src/mssh-window.c
  8. 20 20
      src/mssh-window.h
  9. 216 216
      src/mssh.c

+ 114 - 114
src/mssh-gconf.c

@@ -5,157 +5,157 @@
 #include "mssh-terminal.h"
 
 void mssh_gconf_notify_font(GConfClient *client, guint cnxn_id,
-	GConfEntry *entry, gpointer data)
+    GConfEntry *entry, gpointer data)
 {
-	GConfValue *value;
-	const gchar *font;
-	int i;
+    GConfValue *value;
+    const gchar *font;
+    int i;
 
-	MSSHWindow *window = MSSH_WINDOW(data);
+    MSSHWindow *window = MSSH_WINDOW(data);
 
-	value = gconf_entry_get_value(entry);
-	font = gconf_value_get_string(value);
+    value = gconf_entry_get_value(entry);
+    font = gconf_value_get_string(value);
 
-	for(i = 0; i < window->terminals->len; i++)
-	{
-		vte_terminal_set_font_from_string(VTE_TERMINAL(g_array_index(
-			window->terminals, MSSHTerminal*, i)), font);
-	}
+    for(i = 0; i < window->terminals->len; i++)
+    {
+        vte_terminal_set_font_from_string(VTE_TERMINAL(g_array_index(
+            window->terminals, MSSHTerminal*, i)), font);
+    }
 }
 
 void mssh_gconf_notify_fg_colour(GConfClient *client, guint cnxn_id,
-	GConfEntry *entry, gpointer data)
+    GConfEntry *entry, gpointer data)
 {
-	GConfValue *value;
-	const gchar *colour_s;
-	GdkVisual *visual = gdk_visual_get_system();
-	GdkColormap *colour_map;
-	GdkColor colour;
-	int i;
-
-	MSSHWindow *window = MSSH_WINDOW(data);
-
-	value = gconf_entry_get_value(entry);
-	colour_s = gconf_value_get_string(value);
-	colour_map = gdk_colormap_new(visual, TRUE);
-	gdk_colormap_alloc_color(colour_map, &colour, TRUE, TRUE);
-
-	gdk_color_parse(colour_s, &colour);
-
-	for(i = 0; i < window->terminals->len; i++)
-	{
-		vte_terminal_set_color_foreground(VTE_TERMINAL(g_array_index(
-			window->terminals, MSSHTerminal*, i)), &colour);
-	}
+    GConfValue *value;
+    const gchar *colour_s;
+    GdkVisual *visual = gdk_visual_get_system();
+    GdkColormap *colour_map;
+    GdkColor colour;
+    int i;
+
+    MSSHWindow *window = MSSH_WINDOW(data);
+
+    value = gconf_entry_get_value(entry);
+    colour_s = gconf_value_get_string(value);
+    colour_map = gdk_colormap_new(visual, TRUE);
+    gdk_colormap_alloc_color(colour_map, &colour, TRUE, TRUE);
+
+    gdk_color_parse(colour_s, &colour);
+
+    for(i = 0; i < window->terminals->len; i++)
+    {
+        vte_terminal_set_color_foreground(VTE_TERMINAL(g_array_index(
+            window->terminals, MSSHTerminal*, i)), &colour);
+    }
 }
 
 void mssh_gconf_notify_bg_colour(GConfClient *client, guint cnxn_id,
-	GConfEntry *entry, gpointer data)
+    GConfEntry *entry, gpointer data)
 {
-	GConfValue *value;
-	const gchar *colour_s;
-	GdkVisual *visual = gdk_visual_get_system();
-	GdkColormap *colour_map;
-	GdkColor colour;
-	int i;
-
-	MSSHWindow *window = MSSH_WINDOW(data);
-
-	value = gconf_entry_get_value(entry);
-	colour_s = gconf_value_get_string(value);
-	colour_map = gdk_colormap_new(visual, TRUE);
-	gdk_colormap_alloc_color(colour_map, &colour, TRUE, TRUE);
-
-	gdk_color_parse(colour_s, &colour);
-
-	for(i = 0; i < window->terminals->len; i++)
-	{
-		vte_terminal_set_color_background(VTE_TERMINAL(g_array_index(
-			window->terminals, MSSHTerminal*, i)), &colour);
-	}
+    GConfValue *value;
+    const gchar *colour_s;
+    GdkVisual *visual = gdk_visual_get_system();
+    GdkColormap *colour_map;
+    GdkColor colour;
+    int i;
+
+    MSSHWindow *window = MSSH_WINDOW(data);
+
+    value = gconf_entry_get_value(entry);
+    colour_s = gconf_value_get_string(value);
+    colour_map = gdk_colormap_new(visual, TRUE);
+    gdk_colormap_alloc_color(colour_map, &colour, TRUE, TRUE);
+
+    gdk_color_parse(colour_s, &colour);
+
+    for(i = 0; i < window->terminals->len; i++)
+    {
+        vte_terminal_set_color_background(VTE_TERMINAL(g_array_index(
+            window->terminals, MSSHTerminal*, i)), &colour);
+    }
 }
 
 void mssh_gconf_notify_columns(GConfClient *client, guint cnxn_id,
-	GConfEntry *entry, gpointer data)
+    GConfEntry *entry, gpointer data)
 {
-	GConfValue *value;
-	int columns;
+    GConfValue *value;
+    int columns;
 
-	MSSHWindow *window = MSSH_WINDOW(data);
+    MSSHWindow *window = MSSH_WINDOW(data);
 
-	value = gconf_entry_get_value(entry);
-	columns = gconf_value_get_int(value);
+    value = gconf_entry_get_value(entry);
+    columns = gconf_value_get_int(value);
 
-	if(columns <= 0)
-	{
-		columns = 1;
-		gconf_client_set_int(client, MSSH_GCONF_KEY_COLUMNS, columns,
-			NULL);
-	}
+    if(columns <= 0)
+    {
+        columns = 1;
+        gconf_client_set_int(client, MSSH_GCONF_KEY_COLUMNS, columns,
+            NULL);
+    }
 
-	window->columns = columns;
-	mssh_window_relayout(window);
+    window->columns = columns;
+    mssh_window_relayout(window);
 }
 
 void mssh_gconf_notify_timeout(GConfClient *client, guint cnxn_id,
-	GConfEntry *entry, gpointer data)
+    GConfEntry *entry, gpointer data)
 {
-	GConfValue *value;
-	int timeout;
+    GConfValue *value;
+    int timeout;
 
-	MSSHWindow *window = MSSH_WINDOW(data);
+    MSSHWindow *window = MSSH_WINDOW(data);
 
-	value = gconf_entry_get_value(entry);
-	timeout = gconf_value_get_int(value);
+    value = gconf_entry_get_value(entry);
+    timeout = gconf_value_get_int(value);
 
-	if(timeout < 0)
-	{
-		timeout = 0;
-		gconf_client_set_int(client, MSSH_GCONF_KEY_TIMEOUT, timeout,
-			NULL);
-	}
+    if(timeout < 0)
+    {
+        timeout = 0;
+        gconf_client_set_int(client, MSSH_GCONF_KEY_TIMEOUT, timeout,
+            NULL);
+    }
 
-	window->timeout = timeout;
-	mssh_window_relayout(window);
+    window->timeout = timeout;
+    mssh_window_relayout(window);
 }
 
 void mssh_gconf_notify_close_ended(GConfClient *client, guint cnxn_id,
-	GConfEntry *entry, gpointer data)
+    GConfEntry *entry, gpointer data)
 {
-	GConfValue *value;
-	gboolean close_ended;
-	int i;
-
-	MSSHWindow *window = MSSH_WINDOW(data);
-
-	value = gconf_entry_get_value(entry);
-	close_ended = gconf_value_get_bool(value);
-
-	window->close_ended_sessions = close_ended;
-
-	if(close_ended)
-	{
-		for(i = 0; i < window->terminals->len; i++)
-		{
-			MSSHTerminal *terminal = g_array_index(window->terminals,
-				MSSHTerminal*, i);
-
-			if(terminal->ended)
-			{
-				mssh_window_session_closed(terminal, window);
-			}
-		}
-	}
+    GConfValue *value;
+    gboolean close_ended;
+    int i;
+
+    MSSHWindow *window = MSSH_WINDOW(data);
+
+    value = gconf_entry_get_value(entry);
+    close_ended = gconf_value_get_bool(value);
+
+    window->close_ended_sessions = close_ended;
+
+    if(close_ended)
+    {
+        for(i = 0; i < window->terminals->len; i++)
+        {
+            MSSHTerminal *terminal = g_array_index(window->terminals,
+                MSSHTerminal*, i);
+
+            if(terminal->ended)
+            {
+                mssh_window_session_closed(terminal, window);
+            }
+        }
+    }
 }
 
 void mssh_gconf_notify_quit_all_ended(GConfClient *client, guint cnxn_id,
-	GConfEntry *entry, gpointer data)
+    GConfEntry *entry, gpointer data)
 {
-	GConfValue *value;
+    GConfValue *value;
 
-	MSSHWindow *window = MSSH_WINDOW(data);
+    MSSHWindow *window = MSSH_WINDOW(data);
 
-	value = gconf_entry_get_value(entry);
+    value = gconf_entry_get_value(entry);
 
-	window->exit_on_all_closed = gconf_value_get_bool(value);
+    window->exit_on_all_closed = gconf_value_get_bool(value);
 }

+ 15 - 15
src/mssh-gconf.h

@@ -3,28 +3,28 @@
 
 #include <gconf/gconf-client.h>
 
-#define MSSH_GCONF_PATH					"/apps/mssh"
-#define MSSH_GCONF_KEY_FONT				MSSH_GCONF_PATH"/font"
-#define MSSH_GCONF_KEY_FG_COLOUR		MSSH_GCONF_PATH"/fg_colour"
-#define MSSH_GCONF_KEY_BG_COLOUR		MSSH_GCONF_PATH"/bg_colour"
-#define MSSH_GCONF_KEY_COLUMNS			MSSH_GCONF_PATH"/columns"
-#define MSSH_GCONF_KEY_TIMEOUT			MSSH_GCONF_PATH"/timeout"
-#define MSSH_GCONF_KEY_CLOSE_ENDED		MSSH_GCONF_PATH"/close_ended"
-#define MSSH_GCONF_KEY_QUIT_ALL_ENDED	MSSH_GCONF_PATH"/quit_all_ended"
+#define MSSH_GCONF_PATH                 "/apps/mssh"
+#define MSSH_GCONF_KEY_FONT             MSSH_GCONF_PATH"/font"
+#define MSSH_GCONF_KEY_FG_COLOUR        MSSH_GCONF_PATH"/fg_colour"
+#define MSSH_GCONF_KEY_BG_COLOUR        MSSH_GCONF_PATH"/bg_colour"
+#define MSSH_GCONF_KEY_COLUMNS          MSSH_GCONF_PATH"/columns"
+#define MSSH_GCONF_KEY_TIMEOUT          MSSH_GCONF_PATH"/timeout"
+#define MSSH_GCONF_KEY_CLOSE_ENDED      MSSH_GCONF_PATH"/close_ended"
+#define MSSH_GCONF_KEY_QUIT_ALL_ENDED   MSSH_GCONF_PATH"/quit_all_ended"
 
 void mssh_gconf_notify_font(GConfClient *client, guint cnxn_id,
-	GConfEntry *entry, gpointer data);
+    GConfEntry *entry, gpointer data);
 void mssh_gconf_notify_fg_colour(GConfClient *client, guint cnxn_id,
-	GConfEntry *entry, gpointer data);
+    GConfEntry *entry, gpointer data);
 void mssh_gconf_notify_bg_colour(GConfClient *client, guint cnxn_id,
-	GConfEntry *entry, gpointer data);
+    GConfEntry *entry, gpointer data);
 void mssh_gconf_notify_columns(GConfClient *client, guint cnxn_id,
-	GConfEntry *entry, gpointer data);
+    GConfEntry *entry, gpointer data);
 void mssh_gconf_notify_timeout(GConfClient *client, guint cnxn_id,
-	GConfEntry *entry, gpointer data);
+    GConfEntry *entry, gpointer data);
 void mssh_gconf_notify_close_ended(GConfClient *client, guint cnxn_id,
-	GConfEntry *entry, gpointer data);
+    GConfEntry *entry, gpointer data);
 void mssh_gconf_notify_quit_all_ended(GConfClient *client, guint cnxn_id,
-	GConfEntry *entry, gpointer data);
+    GConfEntry *entry, gpointer data);
 
 #endif

+ 202 - 202
src/mssh-pref.c

@@ -11,266 +11,266 @@ G_DEFINE_TYPE(MSSHPref, mssh_pref, GTK_TYPE_WINDOW)
 
 GtkWidget* mssh_pref_new(void)
 {
-	return g_object_new(MSSH_TYPE_PREF, NULL);
+    return g_object_new(MSSH_TYPE_PREF, NULL);
 }
 
 static void mssh_pref_close(GtkWidget *widget, gpointer data)
 {
-	MSSHPref *pref = MSSH_PREF(data);
+    MSSHPref *pref = MSSH_PREF(data);
 
-	gtk_widget_destroy(GTK_WIDGET(pref));
+    gtk_widget_destroy(GTK_WIDGET(pref));
 }
 
 static void mssh_pref_font_select(GtkWidget *widget, gpointer data)
 {
-	GConfClient *client;
-	const gchar *font;
+    GConfClient *client;
+    const gchar *font;
 
-	client = gconf_client_get_default();
+    client = gconf_client_get_default();
 
-	font = gtk_font_button_get_font_name(GTK_FONT_BUTTON(widget));
+    font = gtk_font_button_get_font_name(GTK_FONT_BUTTON(widget));
 
-	gconf_client_set_string(client, MSSH_GCONF_KEY_FONT, font, NULL);
+    gconf_client_set_string(client, MSSH_GCONF_KEY_FONT, font, NULL);
 }
 
 static void mssh_pref_fg_colour_select(GtkWidget *widget, gpointer data)
 {
-	GConfClient *client;
-	GdkColor colour;
-	const gchar *colour_s;
+    GConfClient *client;
+    GdkColor colour;
+    const gchar *colour_s;
 
-	client = gconf_client_get_default();
+    client = gconf_client_get_default();
 
-	gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), &colour);
-	colour_s = gdk_color_to_string(&colour);
+    gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), &colour);
+    colour_s = gdk_color_to_string(&colour);
 
-	gconf_client_set_string(client, MSSH_GCONF_KEY_FG_COLOUR, colour_s,
-		NULL);
+    gconf_client_set_string(client, MSSH_GCONF_KEY_FG_COLOUR, colour_s,
+        NULL);
 }
 
 static void mssh_pref_bg_colour_select(GtkWidget *widget, gpointer data)
 {
-	GConfClient *client;
-	GdkColor colour;
-	const gchar *colour_s;
+    GConfClient *client;
+    GdkColor colour;
+    const gchar *colour_s;
 
-	client = gconf_client_get_default();
+    client = gconf_client_get_default();
 
-	gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), &colour);
-	colour_s = gdk_color_to_string(&colour);
+    gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), &colour);
+    colour_s = gdk_color_to_string(&colour);
 
-	gconf_client_set_string(client, MSSH_GCONF_KEY_BG_COLOUR, colour_s,
-		NULL);
+    gconf_client_set_string(client, MSSH_GCONF_KEY_BG_COLOUR, colour_s,
+        NULL);
 }
 
 static void mssh_pref_columns_select(GtkWidget *widget, gpointer data)
 {
-	GConfClient *client;
-	int columns;
+    GConfClient *client;
+    int columns;
 
-	client = gconf_client_get_default();
+    client = gconf_client_get_default();
 
-	columns = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+    columns = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
 
-	gconf_client_set_int(client, MSSH_GCONF_KEY_COLUMNS, columns, NULL);
+    gconf_client_set_int(client, MSSH_GCONF_KEY_COLUMNS, columns, NULL);
 }
 
 static void mssh_pref_timeout_select(GtkWidget *widget, gpointer data)
 {
-	GConfClient *client;
-	int timeout;
+    GConfClient *client;
+    int timeout;
 
-	client = gconf_client_get_default();
+    client = gconf_client_get_default();
 
-	timeout = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+    timeout = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
 
-	gconf_client_set_int(client, MSSH_GCONF_KEY_TIMEOUT, timeout, NULL);
+    gconf_client_set_int(client, MSSH_GCONF_KEY_TIMEOUT, timeout, NULL);
 }
 
 static void mssh_pref_close_check(GtkWidget *widget, gpointer data)
 {
-	GConfClient *client;
-	gboolean close;
+    GConfClient *client;
+    gboolean close;
 
-	client = gconf_client_get_default();
+    client = gconf_client_get_default();
 
-	close = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+    close = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
-	gconf_client_set_bool(client, MSSH_GCONF_KEY_CLOSE_ENDED, close, NULL);
+    gconf_client_set_bool(client, MSSH_GCONF_KEY_CLOSE_ENDED, close, NULL);
 }
 
 static void mssh_pref_exit_check(GtkWidget *widget, gpointer data)
 {
-	GConfClient *client;
-	gboolean close;
+    GConfClient *client;
+    gboolean close;
 
-	client = gconf_client_get_default();
+    client = gconf_client_get_default();
 
-	close = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+    close = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
-	gconf_client_set_bool(client, MSSH_GCONF_KEY_QUIT_ALL_ENDED, close,
-		NULL);
+    gconf_client_set_bool(client, MSSH_GCONF_KEY_QUIT_ALL_ENDED, close,
+        NULL);
 }
 
 static void mssh_pref_init(MSSHPref* pref)
 {
-	GConfClient *client;
-	GConfEntry *entry;
-	GConfValue *value;
-	GdkVisual *visual = gdk_visual_get_system();
-	GdkColormap *colour_map = gdk_colormap_new(visual, TRUE);
-	GdkColor colour;
-	const gchar *colour_s;
-
-	GtkWidget *frame = gtk_vbox_new(FALSE, 5);
-	GtkWidget *notebook = gtk_notebook_new();
-	GtkWidget *content = gtk_vbox_new(FALSE, 4);
-
-	GtkWidget *font_hbox = gtk_hbox_new(FALSE, 10);
-	GtkWidget *font_label = gtk_label_new("Font:");
-	GtkWidget *font_select = gtk_font_button_new();
-
-	GtkWidget *colour_table = gtk_table_new(2, 2, FALSE);
-	GtkWidget *bg_colour_label = gtk_label_new("Background:");
-	GtkWidget *bg_colour_select = gtk_color_button_new();
-	GtkWidget *fg_colour_label = gtk_label_new("Foreground:");
-	GtkWidget *fg_colour_select = gtk_color_button_new();
-
-	GtkWidget *exit_check = gtk_check_button_new_with_label(
-		"Quit after all sessions have ended");
-	GtkWidget *close_check = gtk_check_button_new_with_label(
-		"Close ended sessions");
-
-	GtkWidget *timeout_hbox = gtk_hbox_new(FALSE, 10);
-	GtkWidget *timeout_label1 = gtk_label_new(
-		"Closed ended sessions after");
-	GtkObject *timeout_adj = gtk_adjustment_new(3, 0, 100, 1, 10, 0);
-	GtkWidget *timeout_select = gtk_spin_button_new(
-		GTK_ADJUSTMENT(timeout_adj), 1, 0);
-	GtkWidget *timeout_label2 = gtk_label_new("seconds");
-
-	GtkWidget *columns_hbox = gtk_hbox_new(FALSE, 10);
-	GtkWidget *columns_label = gtk_label_new("Columns:");
-	GtkObject *columns_adj = gtk_adjustment_new(2, 1, 10, 1, 10, 0);
-	GtkWidget *columns_select = gtk_spin_button_new(
-		GTK_ADJUSTMENT(columns_adj), 1, 0);
-
-	GtkWidget *close_hbox = gtk_hbox_new(FALSE, 0);
-	GtkWidget *close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
-
-	gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE);
-	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), content, NULL);
-
-	gtk_box_pack_start(GTK_BOX(font_hbox), font_label, FALSE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(font_hbox), font_select, FALSE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(content), font_hbox, FALSE, TRUE, 0);
-
-	gtk_table_attach(GTK_TABLE(colour_table), bg_colour_label,
-		0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
-	gtk_table_attach(GTK_TABLE(colour_table), bg_colour_select,
-		1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
-	gtk_table_attach(GTK_TABLE(colour_table), fg_colour_label,
-		0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
-	gtk_table_attach(GTK_TABLE(colour_table), fg_colour_select,
-		1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
-	gtk_box_pack_start(GTK_BOX(content), colour_table, FALSE, TRUE, 0);
-
-	gtk_box_pack_start(GTK_BOX(content), exit_check, FALSE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(content), close_check, FALSE, TRUE, 0);
-
-	gtk_box_pack_start(GTK_BOX(timeout_hbox), timeout_label1, FALSE,
-		TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(timeout_hbox), timeout_select, FALSE,
-		TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(timeout_hbox), timeout_label2, FALSE,
-		TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(content), timeout_hbox, FALSE, TRUE, 0);
-
-	gtk_box_pack_start(GTK_BOX(columns_hbox), columns_label, FALSE,
-		TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(columns_hbox), columns_select, FALSE,
-		TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(content), columns_hbox, FALSE, TRUE, 0);
-
-	gtk_box_pack_end(GTK_BOX(close_hbox), close_button, FALSE, TRUE, 0);
-
-	gtk_box_pack_start(GTK_BOX(frame), notebook, TRUE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(frame), close_hbox, FALSE, TRUE, 0);
-
-	gtk_container_add(GTK_CONTAINER(pref), frame);
-
-	g_signal_connect(G_OBJECT(close_button), "clicked",
-		G_CALLBACK(mssh_pref_close), pref);
-
-	gtk_container_set_border_width(GTK_CONTAINER(content), 6);
-	gtk_container_set_border_width(GTK_CONTAINER(pref), 15);
-	gtk_window_set_title(GTK_WINDOW(pref), "Preferences");
-	gtk_window_set_resizable(GTK_WINDOW(pref), FALSE);
-
-	g_signal_connect(G_OBJECT(font_select), "font-set",
-		G_CALLBACK(mssh_pref_font_select), NULL);
-	g_signal_connect(G_OBJECT(fg_colour_select), "color-set",
-		G_CALLBACK(mssh_pref_fg_colour_select), NULL);
-	g_signal_connect(G_OBJECT(bg_colour_select), "color-set",
-		G_CALLBACK(mssh_pref_bg_colour_select), NULL);
-	g_signal_connect(G_OBJECT(columns_select), "value-changed",
-		G_CALLBACK(mssh_pref_columns_select), NULL);
-	g_signal_connect(G_OBJECT(timeout_select), "value-changed",
-		G_CALLBACK(mssh_pref_timeout_select), NULL);
-	g_signal_connect(G_OBJECT(close_check), "toggled",
-		G_CALLBACK(mssh_pref_close_check), NULL);
-	g_signal_connect(G_OBJECT(exit_check), "toggled",
-		G_CALLBACK(mssh_pref_exit_check), NULL);
-
-	client = gconf_client_get_default();
-
-	entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FONT, NULL,
-		TRUE, NULL);
-	value = gconf_entry_get_value(entry);
-	gtk_font_button_set_font_name(GTK_FONT_BUTTON(font_select),
-		gconf_value_get_string(value));
-
-	entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FG_COLOUR, NULL,
-		TRUE, NULL);
-	value = gconf_entry_get_value(entry);
-	colour_s = gconf_value_get_string(value);
-	gdk_colormap_alloc_color(colour_map, &colour, TRUE, TRUE);
-	gdk_color_parse(colour_s, &colour);
-	gtk_color_button_set_color(GTK_COLOR_BUTTON(fg_colour_select),
-		&colour);
-
-	entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR, NULL,
-		TRUE, NULL);
-	value = gconf_entry_get_value(entry);
-	colour_s = gconf_value_get_string(value);
-	gdk_colormap_alloc_color(colour_map, &colour, TRUE, TRUE);
-	gdk_color_parse(colour_s, &colour);
-	gtk_color_button_set_color(GTK_COLOR_BUTTON(bg_colour_select),
-		&colour);
-
-	entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_COLUMNS, NULL,
-		TRUE, NULL);
-	value = gconf_entry_get_value(entry);
-	gtk_spin_button_set_value(GTK_SPIN_BUTTON(columns_select),
-		gconf_value_get_int(value));
-
-	entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_TIMEOUT, NULL,
-		TRUE, NULL);
-	value = gconf_entry_get_value(entry);
-	gtk_spin_button_set_value(GTK_SPIN_BUTTON(timeout_select),
-		gconf_value_get_int(value));
-
-	entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_CLOSE_ENDED,
-		NULL, TRUE, NULL);
-	value = gconf_entry_get_value(entry);
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(close_check),
-		gconf_value_get_bool(value));
-
-	entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_QUIT_ALL_ENDED,
-			NULL, TRUE, NULL);
-	value = gconf_entry_get_value(entry);
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(exit_check),
-		gconf_value_get_bool(value));
+    GConfClient *client;
+    GConfEntry *entry;
+    GConfValue *value;
+    GdkVisual *visual = gdk_visual_get_system();
+    GdkColormap *colour_map = gdk_colormap_new(visual, TRUE);
+    GdkColor colour;
+    const gchar *colour_s;
+
+    GtkWidget *frame = gtk_vbox_new(FALSE, 5);
+    GtkWidget *notebook = gtk_notebook_new();
+    GtkWidget *content = gtk_vbox_new(FALSE, 4);
+
+    GtkWidget *font_hbox = gtk_hbox_new(FALSE, 10);
+    GtkWidget *font_label = gtk_label_new("Font:");
+    GtkWidget *font_select = gtk_font_button_new();
+
+    GtkWidget *colour_table = gtk_table_new(2, 2, FALSE);
+    GtkWidget *bg_colour_label = gtk_label_new("Background:");
+    GtkWidget *bg_colour_select = gtk_color_button_new();
+    GtkWidget *fg_colour_label = gtk_label_new("Foreground:");
+    GtkWidget *fg_colour_select = gtk_color_button_new();
+
+    GtkWidget *exit_check = gtk_check_button_new_with_label(
+        "Quit after all sessions have ended");
+    GtkWidget *close_check = gtk_check_button_new_with_label(
+        "Close ended sessions");
+
+    GtkWidget *timeout_hbox = gtk_hbox_new(FALSE, 10);
+    GtkWidget *timeout_label1 = gtk_label_new(
+        "Closed ended sessions after");
+    GtkObject *timeout_adj = gtk_adjustment_new(3, 0, 100, 1, 10, 0);
+    GtkWidget *timeout_select = gtk_spin_button_new(
+        GTK_ADJUSTMENT(timeout_adj), 1, 0);
+    GtkWidget *timeout_label2 = gtk_label_new("seconds");
+
+    GtkWidget *columns_hbox = gtk_hbox_new(FALSE, 10);
+    GtkWidget *columns_label = gtk_label_new("Columns:");
+    GtkObject *columns_adj = gtk_adjustment_new(2, 1, 10, 1, 10, 0);
+    GtkWidget *columns_select = gtk_spin_button_new(
+        GTK_ADJUSTMENT(columns_adj), 1, 0);
+
+    GtkWidget *close_hbox = gtk_hbox_new(FALSE, 0);
+    GtkWidget *close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
+
+    gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE);
+    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), content, NULL);
+
+    gtk_box_pack_start(GTK_BOX(font_hbox), font_label, FALSE, TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(font_hbox), font_select, FALSE, TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(content), font_hbox, FALSE, TRUE, 0);
+
+    gtk_table_attach(GTK_TABLE(colour_table), bg_colour_label,
+        0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
+    gtk_table_attach(GTK_TABLE(colour_table), bg_colour_select,
+        1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
+    gtk_table_attach(GTK_TABLE(colour_table), fg_colour_label,
+        0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
+    gtk_table_attach(GTK_TABLE(colour_table), fg_colour_select,
+        1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
+    gtk_box_pack_start(GTK_BOX(content), colour_table, FALSE, TRUE, 0);
+
+    gtk_box_pack_start(GTK_BOX(content), exit_check, FALSE, TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(content), close_check, FALSE, TRUE, 0);
+
+    gtk_box_pack_start(GTK_BOX(timeout_hbox), timeout_label1, FALSE,
+        TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(timeout_hbox), timeout_select, FALSE,
+        TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(timeout_hbox), timeout_label2, FALSE,
+        TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(content), timeout_hbox, FALSE, TRUE, 0);
+
+    gtk_box_pack_start(GTK_BOX(columns_hbox), columns_label, FALSE,
+        TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(columns_hbox), columns_select, FALSE,
+        TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(content), columns_hbox, FALSE, TRUE, 0);
+
+    gtk_box_pack_end(GTK_BOX(close_hbox), close_button, FALSE, TRUE, 0);
+
+    gtk_box_pack_start(GTK_BOX(frame), notebook, TRUE, TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(frame), close_hbox, FALSE, TRUE, 0);
+
+    gtk_container_add(GTK_CONTAINER(pref), frame);
+
+    g_signal_connect(G_OBJECT(close_button), "clicked",
+        G_CALLBACK(mssh_pref_close), pref);
+
+    gtk_container_set_border_width(GTK_CONTAINER(content), 6);
+    gtk_container_set_border_width(GTK_CONTAINER(pref), 15);
+    gtk_window_set_title(GTK_WINDOW(pref), "Preferences");
+    gtk_window_set_resizable(GTK_WINDOW(pref), FALSE);
+
+    g_signal_connect(G_OBJECT(font_select), "font-set",
+        G_CALLBACK(mssh_pref_font_select), NULL);
+    g_signal_connect(G_OBJECT(fg_colour_select), "color-set",
+        G_CALLBACK(mssh_pref_fg_colour_select), NULL);
+    g_signal_connect(G_OBJECT(bg_colour_select), "color-set",
+        G_CALLBACK(mssh_pref_bg_colour_select), NULL);
+    g_signal_connect(G_OBJECT(columns_select), "value-changed",
+        G_CALLBACK(mssh_pref_columns_select), NULL);
+    g_signal_connect(G_OBJECT(timeout_select), "value-changed",
+        G_CALLBACK(mssh_pref_timeout_select), NULL);
+    g_signal_connect(G_OBJECT(close_check), "toggled",
+        G_CALLBACK(mssh_pref_close_check), NULL);
+    g_signal_connect(G_OBJECT(exit_check), "toggled",
+        G_CALLBACK(mssh_pref_exit_check), NULL);
+
+    client = gconf_client_get_default();
+
+    entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FONT, NULL,
+        TRUE, NULL);
+    value = gconf_entry_get_value(entry);
+    gtk_font_button_set_font_name(GTK_FONT_BUTTON(font_select),
+        gconf_value_get_string(value));
+
+    entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FG_COLOUR, NULL,
+        TRUE, NULL);
+    value = gconf_entry_get_value(entry);
+    colour_s = gconf_value_get_string(value);
+    gdk_colormap_alloc_color(colour_map, &colour, TRUE, TRUE);
+    gdk_color_parse(colour_s, &colour);
+    gtk_color_button_set_color(GTK_COLOR_BUTTON(fg_colour_select),
+        &colour);
+
+    entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR, NULL,
+        TRUE, NULL);
+    value = gconf_entry_get_value(entry);
+    colour_s = gconf_value_get_string(value);
+    gdk_colormap_alloc_color(colour_map, &colour, TRUE, TRUE);
+    gdk_color_parse(colour_s, &colour);
+    gtk_color_button_set_color(GTK_COLOR_BUTTON(bg_colour_select),
+        &colour);
+
+    entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_COLUMNS, NULL,
+        TRUE, NULL);
+    value = gconf_entry_get_value(entry);
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(columns_select),
+        gconf_value_get_int(value));
+
+    entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_TIMEOUT, NULL,
+        TRUE, NULL);
+    value = gconf_entry_get_value(entry);
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(timeout_select),
+        gconf_value_get_int(value));
+
+    entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_CLOSE_ENDED,
+        NULL, TRUE, NULL);
+    value = gconf_entry_get_value(entry);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(close_check),
+        gconf_value_get_bool(value));
+
+    entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_QUIT_ALL_ENDED,
+            NULL, TRUE, NULL);
+    value = gconf_entry_get_value(entry);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(exit_check),
+        gconf_value_get_bool(value));
 }
 
 static void mssh_pref_class_init(MSSHPrefClass *klass)

+ 10 - 10
src/mssh-pref.h

@@ -5,24 +5,24 @@
 
 G_BEGIN_DECLS
 
-#define MSSH_TYPE_PREF				mssh_pref_get_type()
-#define MSSH_PREF(obj)				G_TYPE_CHECK_INSTANCE_CAST(obj,\
-	MSSH_TYPE_PREF, MSSHPref)
-#define MSSH_PREF_CLASS(klass)		G_TYPE_CHECK_CLASS_CAST(klass,\
-	MSSH_PREF_TYPE, MSSHPrefClass)
-#define IS_MSSH_PREF(obj)			G_TYPE_CHECK_INSTANCE_TYPE(obj,\
-	MSSH_TYPE_PREF)
+#define MSSH_TYPE_PREF              mssh_pref_get_type()
+#define MSSH_PREF(obj)              G_TYPE_CHECK_INSTANCE_CAST(obj,\
+    MSSH_TYPE_PREF, MSSHPref)
+#define MSSH_PREF_CLASS(klass)      G_TYPE_CHECK_CLASS_CAST(klass,\
+    MSSH_PREF_TYPE, MSSHPrefClass)
+#define IS_MSSH_PREF(obj)           G_TYPE_CHECK_INSTANCE_TYPE(obj,\
+    MSSH_TYPE_PREF)
 #define IS_MSSH_PREF_CLASS(klass) G_TYPE_CHECK_CLASS_TYPE(klass,\
-	MSSH_TYPE_PREF)
+    MSSH_TYPE_PREF)
 
 typedef struct
 {
-	GtkWindow widget;
+    GtkWindow widget;
 } MSSHPref;
 
 typedef struct
 {
-	GtkWindowClass parent_class;
+    GtkWindowClass parent_class;
 } MSSHPrefClass;
 
 GType mssh_pref_get_type(void) G_GNUC_CONST;

+ 56 - 56
src/mssh-terminal.c

@@ -9,120 +9,120 @@ static void mssh_terminal_init(MSSHTerminal* terminal);
 static void mssh_terminal_class_init(MSSHTerminalClass *klass);
 static void mssh_terminal_child_exited(VteTerminal *vte, gpointer data);
 static gboolean mssh_terminal_focused(GtkWidget *widget,
-	GtkDirectionType dir, gpointer data);
+    GtkDirectionType dir, gpointer data);
 
 GtkWidget* mssh_terminal_new()
 {
-	return g_object_new(MSSH_TYPE_TERMINAL, NULL);
+    return g_object_new(MSSH_TYPE_TERMINAL, NULL);
 }
 
 void mssh_terminal_destroy(MSSHTerminal *terminal)
 {
-	free(terminal->hostname);
+    free(terminal->hostname);
 }
 
 gboolean mssh_terminal_isactive(MSSHTerminal *terminal)
 {
-	return gtk_check_menu_item_get_active(
-		GTK_CHECK_MENU_ITEM(terminal->menu_item));
+    return gtk_check_menu_item_get_active(
+        GTK_CHECK_MENU_ITEM(terminal->menu_item));
 }
 
 void mssh_terminal_init_session(MSSHTerminal *terminal, char *hostname)
 {
-	terminal->hostname = hostname;
+    terminal->hostname = hostname;
 
-	terminal->menu_item = gtk_check_menu_item_new_with_label(
-		terminal->hostname);
+    terminal->menu_item = gtk_check_menu_item_new_with_label(
+        terminal->hostname);
 
-	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
-		terminal->menu_item), TRUE);
+    gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
+        terminal->menu_item), TRUE);
 }
 
 void mssh_terminal_start_session(MSSHTerminal *terminal, char **env)
 {
-	char *args[3];
+    char *args[3];
 
-	args[0] = strdup("ssh");
-	args[1] = terminal->hostname;
-	args[2] = NULL;
+    args[0] = strdup("ssh");
+    args[1] = terminal->hostname;
+    args[2] = NULL;
 
-	vte_terminal_fork_command(VTE_TERMINAL(terminal), "ssh", args,
-		env, NULL, FALSE, FALSE, FALSE);
+    vte_terminal_fork_command(VTE_TERMINAL(terminal), "ssh", args,
+        env, NULL, FALSE, FALSE, FALSE);
 
-	free(args[0]);
+    free(args[0]);
 }
 
 void mssh_terminal_send_host(MSSHTerminal *terminal)
 {
-	if(mssh_terminal_isactive(terminal))
-	{
-		vte_terminal_feed_child(VTE_TERMINAL(terminal),
-			terminal->hostname, strlen(terminal->hostname));
-	}
+    if(mssh_terminal_isactive(terminal))
+    {
+        vte_terminal_feed_child(VTE_TERMINAL(terminal),
+            terminal->hostname, strlen(terminal->hostname));
+    }
 }
 
 void mssh_terminal_send_string(MSSHTerminal *terminal, gchar *string)
 {
-	if(mssh_terminal_isactive(terminal))
-	{
-		vte_terminal_feed_child(VTE_TERMINAL(terminal),	string,
-			strlen(string));
-	}
+    if(mssh_terminal_isactive(terminal))
+    {
+        vte_terminal_feed_child(VTE_TERMINAL(terminal), string,
+            strlen(string));
+    }
 }
 
 void mssh_terminal_send_data(MSSHTerminal *terminal, GdkEventKey *event)
 {
-	gboolean dummy;
+    gboolean dummy;
 
-	if(mssh_terminal_isactive(terminal))
-	{
-		g_signal_emit_by_name(terminal, "key-press-event", event, &dummy);
-	}
+    if(mssh_terminal_isactive(terminal))
+    {
+        g_signal_emit_by_name(terminal, "key-press-event", event, &dummy);
+    }
 }
 
 static void mssh_terminal_init(MSSHTerminal* terminal)
 {
-	terminal->started = 0;
-	terminal->ended = 0;
+    terminal->started = 0;
+    terminal->ended = 0;
 
-	g_signal_connect(G_OBJECT(terminal), "child-exited",
-		G_CALLBACK(mssh_terminal_child_exited), terminal);
-	g_signal_connect(G_OBJECT(terminal), "focus-in-event",
-		G_CALLBACK(mssh_terminal_focused), terminal);
+    g_signal_connect(G_OBJECT(terminal), "child-exited",
+        G_CALLBACK(mssh_terminal_child_exited), terminal);
+    g_signal_connect(G_OBJECT(terminal), "focus-in-event",
+        G_CALLBACK(mssh_terminal_focused), terminal);
 }
 
 static void mssh_terminal_class_init(MSSHTerminalClass *klass)
 {
-	klass->session_closed_signal = g_signal_new("session-closed",
-		G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
-		G_STRUCT_OFFSET(MSSHTerminalClass, session_closed), NULL, NULL,
-		g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, NULL);
-
-	klass->session_focused_signal = g_signal_new("session-focused",
-		G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
-		G_STRUCT_OFFSET(MSSHTerminalClass, session_focused), NULL, NULL,
-		g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, NULL);
+    klass->session_closed_signal = g_signal_new("session-closed",
+        G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
+        G_STRUCT_OFFSET(MSSHTerminalClass, session_closed), NULL, NULL,
+        g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, NULL);
+
+    klass->session_focused_signal = g_signal_new("session-focused",
+        G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
+        G_STRUCT_OFFSET(MSSHTerminalClass, session_focused), NULL, NULL,
+        g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, NULL);
 }
 
 static void mssh_terminal_child_exited(VteTerminal *vte, gpointer data)
 {
-	char msg[] = "\r\n[Child Exited]\r\n";
+    char msg[] = "\r\n[Child Exited]\r\n";
 
-	MSSHTerminal *terminal = MSSH_TERMINAL(data);
+    MSSHTerminal *terminal = MSSH_TERMINAL(data);
 
-	terminal->ended = 1;
+    terminal->ended = 1;
 
-	vte_terminal_feed(vte, msg, strlen(msg));
+    vte_terminal_feed(vte, msg, strlen(msg));
 
-	g_signal_emit_by_name(terminal, "session-closed");
+    g_signal_emit_by_name(terminal, "session-closed");
 }
 
 static gboolean mssh_terminal_focused(GtkWidget *widget,
-	GtkDirectionType dir, gpointer data)
+    GtkDirectionType dir, gpointer data)
 {
-	MSSHTerminal *terminal = MSSH_TERMINAL(data);
+    MSSHTerminal *terminal = MSSH_TERMINAL(data);
 
-	g_signal_emit_by_name(terminal, "session-focused");
+    g_signal_emit_by_name(terminal, "session-focused");
 
-	return FALSE;
+    return FALSE;
 }

+ 19 - 19
src/mssh-terminal.h

@@ -6,34 +6,34 @@
 
 G_BEGIN_DECLS
 
-#define MSSH_TYPE_TERMINAL				mssh_terminal_get_type()
-#define MSSH_TERMINAL(obj)				G_TYPE_CHECK_INSTANCE_CAST(obj, \
-	MSSH_TYPE_TERMINAL, MSSHTerminal)
-#define MSSH_TERMINAL_CLASS(klass)		G_TYPE_CHECK_CLASS_CAST(klass, \
-	MSSH_TERMINAL_TYPE, MSSHTerminalClass)
-#define IS_MSSH_TERMINAL(obj)			G_TYPE_CHECK_INSTANCE_TYPE(obj, \
-	MSSH_TYPE_TERMINAL)
-#define IS_MSSH_TERMINAL_CLASS(klass)	G_TYPE_CHECK_CLASS_TYPE(klass, \
-	MSSH_TYPE_TERMINAL)
+#define MSSH_TYPE_TERMINAL              mssh_terminal_get_type()
+#define MSSH_TERMINAL(obj)              G_TYPE_CHECK_INSTANCE_CAST(obj, \
+    MSSH_TYPE_TERMINAL, MSSHTerminal)
+#define MSSH_TERMINAL_CLASS(klass)      G_TYPE_CHECK_CLASS_CAST(klass, \
+    MSSH_TERMINAL_TYPE, MSSHTerminalClass)
+#define IS_MSSH_TERMINAL(obj)           G_TYPE_CHECK_INSTANCE_TYPE(obj, \
+    MSSH_TYPE_TERMINAL)
+#define IS_MSSH_TERMINAL_CLASS(klass)   G_TYPE_CHECK_CLASS_TYPE(klass, \
+    MSSH_TYPE_TERMINAL)
 
 typedef struct
 {
-	VteTerminal vte;
-	GtkWidget *menu_item;
-	char *hostname;
-	int started;
-	int ended;
+    VteTerminal vte;
+    GtkWidget *menu_item;
+    char *hostname;
+    int started;
+    int ended;
 } MSSHTerminal;
 
 typedef struct
 {
-	VteTerminalClass parent_class;
+    VteTerminalClass parent_class;
 
-	guint session_closed_signal;
-	guint session_focused_signal;
+    guint session_closed_signal;
+    guint session_focused_signal;
 
-	void (*session_closed)(MSSHTerminal *terminal);
-	void (*session_focused)(MSSHTerminal *terminal);
+    void (*session_closed)(MSSHTerminal *terminal);
+    void (*session_focused)(MSSHTerminal *terminal);
 } MSSHTerminalClass;
 
 GType mssh_terminal_get_type(void) G_GNUC_CONST;

+ 268 - 268
src/mssh-window.c

@@ -15,14 +15,14 @@ static void mssh_window_sendhost(GtkWidget *widget, gpointer data);
 static void mssh_window_destroy(GtkWidget *widget, gpointer data);
 static void mssh_window_pref(GtkWidget *widget, gpointer data);
 static gboolean mssh_window_key_press(GtkWidget *widget,
-	GdkEventKey *event, gpointer data);
+    GdkEventKey *event, gpointer data);
 static gboolean mssh_window_entry_focused(GtkWidget *widget,
-	GtkDirectionType dir, gpointer data);
+    GtkDirectionType dir, gpointer data);
 static gboolean mssh_window_session_close(gpointer data);
 static void mssh_window_session_focused(MSSHTerminal *terminal,
-	gpointer data);
+    gpointer data);
 static void mssh_window_insert(GtkWidget *widget, gchar *new_text,
-	gint new_text_length, gint *position, gpointer data);
+    gint new_text_length, gint *position, gpointer data);
 static void mssh_window_add_session(MSSHWindow *window, char *hostname);
 static void mssh_window_init(MSSHWindow* window);
 static void mssh_window_class_init(MSSHWindowClass *klass);
@@ -31,352 +31,352 @@ G_DEFINE_TYPE(MSSHWindow, mssh_window, GTK_TYPE_WINDOW)
 
 struct WinTermPair
 {
-	MSSHWindow *window;
-	MSSHTerminal *terminal;
+    MSSHWindow *window;
+    MSSHTerminal *terminal;
 };
 
 GtkWidget* mssh_window_new(void)
 {
-	return g_object_new(MSSH_TYPE_WINDOW, NULL);
+    return g_object_new(MSSH_TYPE_WINDOW, NULL);
 }
 
 static void mssh_window_sendhost(GtkWidget *widget, gpointer data)
 {
-	int i;
+    int i;
 
-	MSSHWindow *window = MSSH_WINDOW(data);
+    MSSHWindow *window = MSSH_WINDOW(data);
 
-	for(i = 0; i < window->terminals->len; i++)
-	{
-		mssh_terminal_send_host(g_array_index(window->terminals,
-			MSSHTerminal*, i));
-	}
+    for(i = 0; i < window->terminals->len; i++)
+    {
+        mssh_terminal_send_host(g_array_index(window->terminals,
+            MSSHTerminal*, i));
+    }
 }
 
 static void mssh_window_destroy(GtkWidget *widget, gpointer data)
 {
-	gtk_main_quit();
+    gtk_main_quit();
 }
 
 static void mssh_window_pref(GtkWidget *widget, gpointer data)
 {
-	MSSHWindow *window = MSSH_WINDOW(data);
-	GtkWidget *pref = mssh_pref_new();
+    MSSHWindow *window = MSSH_WINDOW(data);
+    GtkWidget *pref = mssh_pref_new();
 
-	gtk_window_set_transient_for(GTK_WINDOW(pref), GTK_WINDOW(window));
-	gtk_window_set_modal(GTK_WINDOW(pref), TRUE);
-	gtk_window_set_position(GTK_WINDOW(pref),
-		GTK_WIN_POS_CENTER_ON_PARENT);
+    gtk_window_set_transient_for(GTK_WINDOW(pref), GTK_WINDOW(window));
+    gtk_window_set_modal(GTK_WINDOW(pref), TRUE);
+    gtk_window_set_position(GTK_WINDOW(pref),
+        GTK_WIN_POS_CENTER_ON_PARENT);
 
-	gtk_widget_show_all(pref);
+    gtk_widget_show_all(pref);
 }
 
 static void mssh_window_insert(GtkWidget *widget, gchar *new_text,
-	gint new_text_length, gint *position, gpointer data)
+    gint new_text_length, gint *position, gpointer data)
 {
-	int i;
+    int i;
 
-	MSSHWindow *window = MSSH_WINDOW(data);
+    MSSHWindow *window = MSSH_WINDOW(data);
 
-	for(i = 0; i < window->terminals->len; i++)
-	{
-		mssh_terminal_send_string(g_array_index(window->terminals,
-			MSSHTerminal*, i), new_text);
-	}
+    for(i = 0; i < window->terminals->len; i++)
+    {
+        mssh_terminal_send_string(g_array_index(window->terminals,
+            MSSHTerminal*, i), new_text);
+    }
 
-	g_signal_stop_emission_by_name(G_OBJECT(widget), "insert-text");
+    g_signal_stop_emission_by_name(G_OBJECT(widget), "insert-text");
 }
 
 static gboolean mssh_window_key_press(GtkWidget *widget,
-	GdkEventKey *event, gpointer data)
+    GdkEventKey *event, gpointer data)
 {
-	int i;
+    int i;
 
-	MSSHWindow *window = MSSH_WINDOW(data);
+    MSSHWindow *window = MSSH_WINDOW(data);
 
-	for(i = 0; i < window->terminals->len; i++)
-	{
-		mssh_terminal_send_data(g_array_index(window->terminals,
-			MSSHTerminal*, i), event);
-	}
+    for(i = 0; i < window->terminals->len; i++)
+    {
+        mssh_terminal_send_data(g_array_index(window->terminals,
+            MSSHTerminal*, i), event);
+    }
 
-	return TRUE;
+    return TRUE;
 }
 
 static gboolean mssh_window_entry_focused(GtkWidget *widget,
-	GtkDirectionType dir, gpointer data)
+    GtkDirectionType dir, gpointer data)
 {
-	MSSHWindow *window = MSSH_WINDOW(data);
+    MSSHWindow *window = MSSH_WINDOW(data);
 
-	gtk_window_set_title(GTK_WINDOW(window), PACKAGE_NAME" - All");
+    gtk_window_set_title(GTK_WINDOW(window), PACKAGE_NAME" - All");
 
-	return FALSE;
+    return FALSE;
 }
 
 static gboolean mssh_window_session_close(gpointer data)
 {
-	int i, idx = -1;
-
-	struct WinTermPair *data_pair = (struct WinTermPair*)data;
-
-	for(i = 0; i < data_pair->window->terminals->len; i++)
-	{
-		if(data_pair->terminal == g_array_index(
-			data_pair->window->terminals, MSSHTerminal*, i))
-		{
-			idx = i;
-			break;
-		}
-	}
-
-	if(idx == -1)
-	{
-		fprintf(stderr,
-			"mssh: Fatal Error: Can't find terminal to remove!\n");
-	}
-	else
-	{
-		gtk_widget_destroy(data_pair->terminal->menu_item);
-
-		gtk_container_remove(GTK_CONTAINER(data_pair->window->table),
-			GTK_WIDGET(data_pair->terminal));
-
-		g_array_remove_index(data_pair->window->terminals, idx);
-
-		mssh_window_relayout(data_pair->window);
-	}
-
-	if(data_pair->window->terminals->len == 0 &&
-		data_pair->window->exit_on_all_closed)
-	{
-		mssh_window_destroy(NULL, (void*)data_pair->window);
-	}
-
-	free(data_pair);
-
-	return FALSE;
+    int i, idx = -1;
+
+    struct WinTermPair *data_pair = (struct WinTermPair*)data;
+
+    for(i = 0; i < data_pair->window->terminals->len; i++)
+    {
+        if(data_pair->terminal == g_array_index(
+            data_pair->window->terminals, MSSHTerminal*, i))
+        {
+            idx = i;
+            break;
+        }
+    }
+
+    if(idx == -1)
+    {
+        fprintf(stderr,
+            "mssh: Fatal Error: Can't find terminal to remove!\n");
+    }
+    else
+    {
+        gtk_widget_destroy(data_pair->terminal->menu_item);
+
+        gtk_container_remove(GTK_CONTAINER(data_pair->window->table),
+            GTK_WIDGET(data_pair->terminal));
+
+        g_array_remove_index(data_pair->window->terminals, idx);
+
+        mssh_window_relayout(data_pair->window);
+    }
+
+    if(data_pair->window->terminals->len == 0 &&
+        data_pair->window->exit_on_all_closed)
+    {
+        mssh_window_destroy(NULL, (void*)data_pair->window);
+    }
+
+    free(data_pair);
+
+    return FALSE;
 }
 
 void mssh_window_session_closed(MSSHTerminal *terminal, gpointer data)
 {
-	struct WinTermPair *data_pair = malloc(sizeof(struct WinTermPair));
-	data_pair->terminal = terminal;
-	data_pair->window = MSSH_WINDOW(data);
-
-	if(data_pair->window->close_ended_sessions)
-	{
-		g_timeout_add_seconds(data_pair->window->timeout,
-			mssh_window_session_close, data_pair);
-	}
+    struct WinTermPair *data_pair = malloc(sizeof(struct WinTermPair));
+    data_pair->terminal = terminal;
+    data_pair->window = MSSH_WINDOW(data);
+
+    if(data_pair->window->close_ended_sessions)
+    {
+        g_timeout_add_seconds(data_pair->window->timeout,
+            mssh_window_session_close, data_pair);
+    }
 }
 
 static void mssh_window_session_focused(MSSHTerminal *terminal,
-	gpointer data)
+    gpointer data)
 {
-	char *title;
-	size_t len;
+    char *title;
+    size_t len;
 
-	MSSHWindow *window = MSSH_WINDOW(data);
+    MSSHWindow *window = MSSH_WINDOW(data);
 
-	len = strlen(PACKAGE_NAME" - ") + strlen(terminal->hostname) + 1;
-	title = malloc(len);
+    len = strlen(PACKAGE_NAME" - ") + strlen(terminal->hostname) + 1;
+    title = malloc(len);
 
-	snprintf(title, len, PACKAGE_NAME" - %s", terminal->hostname);
+    snprintf(title, len, PACKAGE_NAME" - %s", terminal->hostname);
 
-	gtk_window_set_title(GTK_WINDOW(window), title);
+    gtk_window_set_title(GTK_WINDOW(window), title);
 
-	free(title);
+    free(title);
 }
 
 void mssh_window_relayout(MSSHWindow *window)
 {
-	GConfClient *client;
-	GConfEntry *entry;
-	int i, len = window->terminals->len;
+    GConfClient *client;
+    GConfEntry *entry;
+    int i, len = window->terminals->len;
     int wcols = window->columns_override ? window->columns_override :
         window->columns;
-	int cols = (len < wcols) ? len : wcols;
-	int rows = (len + 0.5) / cols;
-
-	for(i = 0; i < len; i++)
-	{
-		MSSHTerminal *terminal = g_array_index(window->terminals,
-			MSSHTerminal*, i);
-
-		g_object_ref(terminal);
-		if(GTK_WIDGET(terminal)->parent == GTK_WIDGET(window->table))
-		{
-			gtk_container_remove(GTK_CONTAINER(window->table),
-				GTK_WIDGET(terminal));
-		}
-
-		gtk_table_attach(GTK_TABLE(window->table), GTK_WIDGET(terminal),
-			(i % cols), (i == len - 1) ? cols : (i % cols) + 1, i / cols,
-			(i / cols) + 1,
-			GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 1, 1);
-		g_object_unref(terminal);
-
-		if(!terminal->started)
-		{
-			mssh_terminal_start_session(terminal, window->env);
-			terminal->started = 1;
-		}
-	}
-
-	if(len > 0)
-	{
-		gtk_table_resize(GTK_TABLE(window->table), rows, cols);
-	}
-
-	client = gconf_client_get_default();
-
-	gtk_widget_show_all(GTK_WIDGET(window));
-
-	entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FONT, NULL,
-		TRUE, NULL);
-	mssh_gconf_notify_font(client, 0, entry, window);
-	entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FG_COLOUR, NULL,
-		TRUE, NULL);
-	mssh_gconf_notify_fg_colour(client, 0, entry, window);
-	entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR, NULL,
-		TRUE, NULL);
-	mssh_gconf_notify_bg_colour(client, 0, entry, window);
+    int cols = (len < wcols) ? len : wcols;
+    int rows = (len + 0.5) / cols;
+
+    for(i = 0; i < len; i++)
+    {
+        MSSHTerminal *terminal = g_array_index(window->terminals,
+            MSSHTerminal*, i);
+
+        g_object_ref(terminal);
+        if(GTK_WIDGET(terminal)->parent == GTK_WIDGET(window->table))
+        {
+            gtk_container_remove(GTK_CONTAINER(window->table),
+                GTK_WIDGET(terminal));
+        }
+
+        gtk_table_attach(GTK_TABLE(window->table), GTK_WIDGET(terminal),
+            (i % cols), (i == len - 1) ? cols : (i % cols) + 1, i / cols,
+            (i / cols) + 1,
+            GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 1, 1);
+        g_object_unref(terminal);
+
+        if(!terminal->started)
+        {
+            mssh_terminal_start_session(terminal, window->env);
+            terminal->started = 1;
+        }
+    }
+
+    if(len > 0)
+    {
+        gtk_table_resize(GTK_TABLE(window->table), rows, cols);
+    }
+
+    client = gconf_client_get_default();
+
+    gtk_widget_show_all(GTK_WIDGET(window));
+
+    entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FONT, NULL,
+        TRUE, NULL);
+    mssh_gconf_notify_font(client, 0, entry, window);
+    entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FG_COLOUR, NULL,
+        TRUE, NULL);
+    mssh_gconf_notify_fg_colour(client, 0, entry, window);
+    entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR, NULL,
+        TRUE, NULL);
+    mssh_gconf_notify_bg_colour(client, 0, entry, window);
 }
 
 static void mssh_window_add_session(MSSHWindow *window, char *hostname)
 {
-	MSSHTerminal *terminal = MSSH_TERMINAL(mssh_terminal_new());
+    MSSHTerminal *terminal = MSSH_TERMINAL(mssh_terminal_new());
 
-	g_array_append_val(window->terminals, terminal);
+    g_array_append_val(window->terminals, terminal);
 
-	g_signal_connect(G_OBJECT(terminal), "session-closed",
-		G_CALLBACK(mssh_window_session_closed), window);
-	g_signal_connect(G_OBJECT(terminal), "session-focused",
-		G_CALLBACK(mssh_window_session_focused), window);
+    g_signal_connect(G_OBJECT(terminal), "session-closed",
+        G_CALLBACK(mssh_window_session_closed), window);
+    g_signal_connect(G_OBJECT(terminal), "session-focused",
+        G_CALLBACK(mssh_window_session_focused), window);
 
-	mssh_terminal_init_session(terminal, hostname);
+    mssh_terminal_init_session(terminal, hostname);
 
-	gtk_menu_shell_append(GTK_MENU_SHELL(window->server_menu),
-		terminal->menu_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(window->server_menu),
+        terminal->menu_item);
 }
 
 static void mssh_window_init(MSSHWindow* window)
 {
-	GConfClient *client;
-
-	GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
-	GtkWidget *entry = gtk_entry_new();
-
-	GtkWidget *menu_bar = gtk_menu_bar_new();
-	GtkWidget *file_menu = gtk_menu_new();
-	GtkWidget *edit_menu = gtk_menu_new();
-
-	GtkWidget *file_item = gtk_menu_item_new_with_label("File");
-	GtkWidget *edit_item = gtk_menu_item_new_with_label("Edit");
-	GtkWidget *server_item = gtk_menu_item_new_with_label("Servers");
-
-	GtkWidget *file_quit = gtk_image_menu_item_new_from_stock(
-		GTK_STOCK_QUIT, NULL);
-	GtkWidget *file_sendhost = gtk_image_menu_item_new_with_label(
-		"Send hostname");
-/*	GtkWidget *file_add = gtk_image_menu_item_new_with_label(
-		"Add session");*/
-
-	GtkWidget *edit_pref = gtk_image_menu_item_new_from_stock(
-		GTK_STOCK_PREFERENCES, NULL);
-
-	window->server_menu = gtk_menu_new();
-
-	window->terminals = g_array_new(FALSE, TRUE, sizeof(MSSHTerminal*));
-
-	gtk_menu_item_set_submenu(GTK_MENU_ITEM(file_item), file_menu);
-	gtk_menu_item_set_submenu(GTK_MENU_ITEM(edit_item), edit_menu);
-	gtk_menu_item_set_submenu(GTK_MENU_ITEM(server_item),
-		window->server_menu);
-
-/*	gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_add);*/
-	gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_sendhost);
-	gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_quit);
-	gtk_menu_shell_append(GTK_MENU_SHELL(edit_menu), edit_pref);
-	g_signal_connect(G_OBJECT(file_sendhost), "activate",
-		G_CALLBACK(mssh_window_sendhost), window);
-	g_signal_connect(G_OBJECT(file_quit), "activate",
-		G_CALLBACK(mssh_window_destroy), window);
-	g_signal_connect(G_OBJECT(edit_pref), "activate",
-		G_CALLBACK(mssh_window_pref), window);
-
-	gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), file_item);
-	gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), edit_item);
-	gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), server_item);
-
-	g_signal_connect(G_OBJECT(entry), "key-press-event",
-		G_CALLBACK(mssh_window_key_press), window);
-	g_signal_connect(G_OBJECT(entry), "insert-text",
-		G_CALLBACK(mssh_window_insert), window);
-	g_signal_connect(G_OBJECT(entry), "focus-in-event",
-		G_CALLBACK(mssh_window_entry_focused), window);
-
-	gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, TRUE, 2);
-
-	window->table = gtk_table_new(1, 1, TRUE);
-	gtk_box_pack_start(GTK_BOX(vbox), window->table, TRUE, TRUE, 0);
-
-	gtk_container_add(GTK_CONTAINER(window), vbox);
-
-	gtk_widget_set_size_request(GTK_WIDGET(window), 1024, 768);
-	gtk_window_set_title(GTK_WINDOW(window), PACKAGE_NAME);
-
-	client = gconf_client_get_default();
-
-	gconf_client_add_dir(client, MSSH_GCONF_PATH,
-		GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
-
-	gconf_client_notify_add(client, MSSH_GCONF_KEY_FONT,
-		mssh_gconf_notify_font, window, NULL, NULL);
-	gconf_client_notify_add(client, MSSH_GCONF_KEY_FG_COLOUR,
-		mssh_gconf_notify_fg_colour, window, NULL, NULL);
-	gconf_client_notify_add(client, MSSH_GCONF_KEY_BG_COLOUR,
-		mssh_gconf_notify_bg_colour, window, NULL, NULL);
-	gconf_client_notify_add(client, MSSH_GCONF_KEY_COLUMNS,
-		mssh_gconf_notify_columns, window, NULL, NULL);
-	gconf_client_notify_add(client, MSSH_GCONF_KEY_TIMEOUT,
-		mssh_gconf_notify_timeout, window, NULL, NULL);
-	gconf_client_notify_add(client, MSSH_GCONF_KEY_CLOSE_ENDED,
-		mssh_gconf_notify_close_ended, window, NULL, NULL);
-	gconf_client_notify_add(client, MSSH_GCONF_KEY_QUIT_ALL_ENDED,
-		mssh_gconf_notify_quit_all_ended, window, NULL, NULL);
-
-	gconf_client_notify(client, MSSH_GCONF_KEY_COLUMNS);
-	gconf_client_notify(client, MSSH_GCONF_KEY_TIMEOUT);
-	gconf_client_notify(client, MSSH_GCONF_KEY_CLOSE_ENDED);
-	gconf_client_notify(client, MSSH_GCONF_KEY_QUIT_ALL_ENDED);
+    GConfClient *client;
+
+    GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
+    GtkWidget *entry = gtk_entry_new();
+
+    GtkWidget *menu_bar = gtk_menu_bar_new();
+    GtkWidget *file_menu = gtk_menu_new();
+    GtkWidget *edit_menu = gtk_menu_new();
+
+    GtkWidget *file_item = gtk_menu_item_new_with_label("File");
+    GtkWidget *edit_item = gtk_menu_item_new_with_label("Edit");
+    GtkWidget *server_item = gtk_menu_item_new_with_label("Servers");
+
+    GtkWidget *file_quit = gtk_image_menu_item_new_from_stock(
+        GTK_STOCK_QUIT, NULL);
+    GtkWidget *file_sendhost = gtk_image_menu_item_new_with_label(
+        "Send hostname");
+/*  GtkWidget *file_add = gtk_image_menu_item_new_with_label(
+        "Add session");*/
+
+    GtkWidget *edit_pref = gtk_image_menu_item_new_from_stock(
+        GTK_STOCK_PREFERENCES, NULL);
+
+    window->server_menu = gtk_menu_new();
+
+    window->terminals = g_array_new(FALSE, TRUE, sizeof(MSSHTerminal*));
+
+    gtk_menu_item_set_submenu(GTK_MENU_ITEM(file_item), file_menu);
+    gtk_menu_item_set_submenu(GTK_MENU_ITEM(edit_item), edit_menu);
+    gtk_menu_item_set_submenu(GTK_MENU_ITEM(server_item),
+        window->server_menu);
+
+/*  gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_add);*/
+    gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_sendhost);
+    gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_quit);
+    gtk_menu_shell_append(GTK_MENU_SHELL(edit_menu), edit_pref);
+    g_signal_connect(G_OBJECT(file_sendhost), "activate",
+        G_CALLBACK(mssh_window_sendhost), window);
+    g_signal_connect(G_OBJECT(file_quit), "activate",
+        G_CALLBACK(mssh_window_destroy), window);
+    g_signal_connect(G_OBJECT(edit_pref), "activate",
+        G_CALLBACK(mssh_window_pref), window);
+
+    gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), file_item);
+    gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), edit_item);
+    gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), server_item);
+
+    g_signal_connect(G_OBJECT(entry), "key-press-event",
+        G_CALLBACK(mssh_window_key_press), window);
+    g_signal_connect(G_OBJECT(entry), "insert-text",
+        G_CALLBACK(mssh_window_insert), window);
+    g_signal_connect(G_OBJECT(entry), "focus-in-event",
+        G_CALLBACK(mssh_window_entry_focused), window);
+
+    gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, TRUE, 2);
+
+    window->table = gtk_table_new(1, 1, TRUE);
+    gtk_box_pack_start(GTK_BOX(vbox), window->table, TRUE, TRUE, 0);
+
+    gtk_container_add(GTK_CONTAINER(window), vbox);
+
+    gtk_widget_set_size_request(GTK_WIDGET(window), 1024, 768);
+    gtk_window_set_title(GTK_WINDOW(window), PACKAGE_NAME);
+
+    client = gconf_client_get_default();
+
+    gconf_client_add_dir(client, MSSH_GCONF_PATH,
+        GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
+
+    gconf_client_notify_add(client, MSSH_GCONF_KEY_FONT,
+        mssh_gconf_notify_font, window, NULL, NULL);
+    gconf_client_notify_add(client, MSSH_GCONF_KEY_FG_COLOUR,
+        mssh_gconf_notify_fg_colour, window, NULL, NULL);
+    gconf_client_notify_add(client, MSSH_GCONF_KEY_BG_COLOUR,
+        mssh_gconf_notify_bg_colour, window, NULL, NULL);
+    gconf_client_notify_add(client, MSSH_GCONF_KEY_COLUMNS,
+        mssh_gconf_notify_columns, window, NULL, NULL);
+    gconf_client_notify_add(client, MSSH_GCONF_KEY_TIMEOUT,
+        mssh_gconf_notify_timeout, window, NULL, NULL);
+    gconf_client_notify_add(client, MSSH_GCONF_KEY_CLOSE_ENDED,
+        mssh_gconf_notify_close_ended, window, NULL, NULL);
+    gconf_client_notify_add(client, MSSH_GCONF_KEY_QUIT_ALL_ENDED,
+        mssh_gconf_notify_quit_all_ended, window, NULL, NULL);
+
+    gconf_client_notify(client, MSSH_GCONF_KEY_COLUMNS);
+    gconf_client_notify(client, MSSH_GCONF_KEY_TIMEOUT);
+    gconf_client_notify(client, MSSH_GCONF_KEY_CLOSE_ENDED);
+    gconf_client_notify(client, MSSH_GCONF_KEY_QUIT_ALL_ENDED);
 }
 
 void mssh_window_start_session(MSSHWindow* window, char **env,
-	GArray *hosts, long cols)
+    GArray *hosts, long cols)
 {
-	int i, j, k;
-	int nhosts = hosts->len;
-	int rows = (nhosts / 2) + (nhosts % 2);
+    int i, j, k;
+    int nhosts = hosts->len;
+    int rows = (nhosts / 2) + (nhosts % 2);
 
-	window->env = env;
+    window->env = env;
     window->columns_override = cols;
 
-	for(i = 0; i < rows; i++)
-	{
-		for(j = 0; j < 2; j++)
-		{
-			k = j + i*2;
-			if(k < nhosts)
-			{
-				mssh_window_add_session(window, g_array_index(hosts,
-					char*, k));
-			}
-		}
-	}
-
-	mssh_window_relayout(window);
+    for(i = 0; i < rows; i++)
+    {
+        for(j = 0; j < 2; j++)
+        {
+            k = j + i*2;
+            if(k < nhosts)
+            {
+                mssh_window_add_session(window, g_array_index(hosts,
+                    char*, k));
+            }
+        }
+    }
+
+    mssh_window_relayout(window);
 }
 
 static void mssh_window_class_init(MSSHWindowClass *klass)

+ 20 - 20
src/mssh-window.h

@@ -8,40 +8,40 @@
 
 G_BEGIN_DECLS
 
-#define MSSH_TYPE_WINDOW			mssh_window_get_type()
-#define MSSH_WINDOW(obj)			G_TYPE_CHECK_INSTANCE_CAST(obj,\
-	MSSH_TYPE_WINDOW, MSSHWindow)
-#define MSSH_WINDOW_CLASS(klass)	G_TYPE_CHECK_CLASS_CAST(klass,\
-	MSSH_WINDOW_TYPE, MSSHWindowClass)
-#define IS_MSSH_WINDOW(obj)			G_TYPE_CHECK_INSTANCE_TYPE(obj,\
-	MSSH_TYPE_WINDOW)
+#define MSSH_TYPE_WINDOW            mssh_window_get_type()
+#define MSSH_WINDOW(obj)            G_TYPE_CHECK_INSTANCE_CAST(obj,\
+    MSSH_TYPE_WINDOW, MSSHWindow)
+#define MSSH_WINDOW_CLASS(klass)    G_TYPE_CHECK_CLASS_CAST(klass,\
+    MSSH_WINDOW_TYPE, MSSHWindowClass)
+#define IS_MSSH_WINDOW(obj)         G_TYPE_CHECK_INSTANCE_TYPE(obj,\
+    MSSH_TYPE_WINDOW)
 #define IS_MSSH_WINDOW_CLASS(klass) G_TYPE_CHECK_CLASS_TYPE(klass,\
-	MSSH_TYPE_WINDOW)
+    MSSH_TYPE_WINDOW)
 
 typedef struct
 {
-	GtkWindow widget;
-	GtkWidget *table;
-	GtkWidget *server_menu;
-	GArray *terminals;
-	char **env;
-	int columns;
-	int columns_override;
-	int timeout;
-	gboolean close_ended_sessions;
-	gboolean exit_on_all_closed;
+    GtkWindow widget;
+    GtkWidget *table;
+    GtkWidget *server_menu;
+    GArray *terminals;
+    char **env;
+    int columns;
+    int columns_override;
+    int timeout;
+    gboolean close_ended_sessions;
+    gboolean exit_on_all_closed;
 } MSSHWindow;
 
 typedef struct
 {
-	GtkWindowClass parent_class;
+    GtkWindowClass parent_class;
 } MSSHWindowClass;
 
 GType mssh_window_get_type(void) G_GNUC_CONST;
 
 GtkWidget* mssh_window_new(void);
 void mssh_window_start_session(MSSHWindow* window, char **env,
-	GArray *hosts, long cols);
+    GArray *hosts, long cols);
 void mssh_window_relayout(MSSHWindow *window);
 void mssh_window_session_closed(MSSHTerminal *terminal, gpointer data);
 

+ 216 - 216
src/mssh.c

@@ -9,33 +9,33 @@
 #include "config.h"
 #include "mssh-window.h"
 
-#define CONFFILE	".mssh_clusters"
-#define PKGINFO		PACKAGE_NAME " " VERSION
-#define COPYRIGHT	"Copyright (C) 2009 Bradley Smith <[email protected]>"
+#define CONFFILE    ".mssh_clusters"
+#define PKGINFO     PACKAGE_NAME " " VERSION
+#define COPYRIGHT   "Copyright (C) 2009 Bradley Smith <[email protected]>"
 
 static void on_mssh_destroy(GtkWidget *widget, gpointer data)
 {
-	gtk_widget_hide(widget);
-	gtk_main_quit();
+    gtk_widget_hide(widget);
+    gtk_main_quit();
 }
 
 void usage(const char *argv0)
 {
-	fprintf(stderr, "%s\n", PKGINFO);
-	fprintf(stderr, "%s\n", COPYRIGHT);
-	fprintf(stderr, "An ssh client to issue the same commands to multiple servers\n\n");
-	fprintf(stderr, "Usage: %s [OPTION]... (-a ALIAS | HOSTS)\n\n",
-		argv0);
-	fprintf(stderr,
-		"  -a, --alias=ALIAS    Open hosts associated with named alias\n");
+    fprintf(stderr, "%s\n", PKGINFO);
+    fprintf(stderr, "%s\n", COPYRIGHT);
+    fprintf(stderr, "An ssh client to issue the same commands to multiple servers\n\n");
+    fprintf(stderr, "Usage: %s [OPTION]... (-a ALIAS | HOSTS)\n\n",
+        argv0);
+    fprintf(stderr,
+        "  -a, --alias=ALIAS    Open hosts associated with named alias\n");
     fprintf(stderr,
         "  -c, --columns=NUM    Override gconf for number of columns\n");
-	fprintf(stderr,
-		"  -h, --help           Display this help and exit\n");
-	fprintf(stderr,
-		"  -V, --version        Output version information and exit\n");
-	fprintf(stderr, "\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT);
-	exit(EXIT_FAILURE);
+    fprintf(stderr,
+        "  -h, --help           Display this help and exit\n");
+    fprintf(stderr,
+        "  -V, --version        Output version information and exit\n");
+    fprintf(stderr, "\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT);
+    exit(EXIT_FAILURE);
 }
 
 static char *fgetline(FILE *stream)
@@ -48,7 +48,7 @@ static char *fgetline(FILE *stream)
     if((buf = malloc(len)) == NULL)
     {
         perror("malloc");
-		exit(EXIT_FAILURE);
+        exit(EXIT_FAILURE);
     }
 
     while((c = fgetc(stream)) != EOF)
@@ -59,7 +59,7 @@ static char *fgetline(FILE *stream)
             if((buf = realloc(buf, len)) == NULL)
             {
                 perror("realloc");
-				exit(EXIT_FAILURE);
+                exit(EXIT_FAILURE);
             }
         }
         if(c == '\n')
@@ -73,223 +73,223 @@ static char *fgetline(FILE *stream)
         }
     }
 
-	if(c == EOF)
-	{
-		free(buf);
-		return NULL;
-	}
+    if(c == EOF)
+    {
+        free(buf);
+        return NULL;
+    }
 
     return buf;
 }
 
 void append_alias(char *alias, GArray *hosts, GData **aliases, int lineno)
 {
-	int i;
-	GArray *fetched;
-
-	if((fetched = g_datalist_get_data(aliases, alias)) == NULL)
-	{
-		printf("Line %d: Alias '%s' not defined\n", lineno, alias);
-		exit(EXIT_FAILURE);
-	}
-
-	for(i = 0; i < fetched->len; i++)
-	{
-		g_array_append_val(hosts, g_array_index(fetched, char*, i));
-	}
+    int i;
+    GArray *fetched;
+
+    if((fetched = g_datalist_get_data(aliases, alias)) == NULL)
+    {
+        printf("Line %d: Alias '%s' not defined\n", lineno, alias);
+        exit(EXIT_FAILURE);
+    }
+
+    for(i = 0; i < fetched->len; i++)
+    {
+        g_array_append_val(hosts, g_array_index(fetched, char*, i));
+    }
 }
 
 GData **parse_aliases(char *conffile)
 {
-	FILE *file;
-	char *line;
-	int lineno = 0;
-
-	GData **aliases = malloc(sizeof(GData*));
-	g_datalist_init(aliases);
-
-	if((file = fopen(conffile, "r")) == NULL)
-		return aliases;
-
-	while((line = fgetline(file)) != NULL)
-	{
-		char *sep, *alias, *hoststr, *tmp;
-		GArray *hosts;
-
-		lineno++;
-
-		if(strcmp(line, "") == 0)
-			continue;
-
-		if((sep = strchr(line, ':')) == NULL)
-		{
-			printf("Line %d: Failed to parse line '%s'\n", lineno, line);
-			exit(EXIT_FAILURE);
-		}
-
-		*sep = '\0';
-		alias = line;
-		hoststr = sep + 1;
-
-		if((tmp = strtok(hoststr, " ")) == NULL)
-		{
-			printf("Line %d: Alias '%s' specifies no hosts\n", lineno,
-				alias);
-			exit(EXIT_FAILURE);
-		}
-
-		hosts = g_array_new(FALSE, TRUE, sizeof(char*));
-
-		do
-		{
-			if(tmp[0] == '[' && tmp[strlen(tmp) - 1] == ']')
-			{
-				tmp++;
-				tmp[strlen(tmp) - 1] = '\0';
-				append_alias(tmp, hosts, aliases, lineno);
-			}
-			else
-				g_array_append_val(hosts, tmp);
-		}
-		while((tmp = strtok(NULL, " ")) != NULL);
-
-		g_datalist_set_data(aliases, alias, hosts);
-	}
-
-	return aliases;
+    FILE *file;
+    char *line;
+    int lineno = 0;
+
+    GData **aliases = malloc(sizeof(GData*));
+    g_datalist_init(aliases);
+
+    if((file = fopen(conffile, "r")) == NULL)
+        return aliases;
+
+    while((line = fgetline(file)) != NULL)
+    {
+        char *sep, *alias, *hoststr, *tmp;
+        GArray *hosts;
+
+        lineno++;
+
+        if(strcmp(line, "") == 0)
+            continue;
+
+        if((sep = strchr(line, ':')) == NULL)
+        {
+            printf("Line %d: Failed to parse line '%s'\n", lineno, line);
+            exit(EXIT_FAILURE);
+        }
+
+        *sep = '\0';
+        alias = line;
+        hoststr = sep + 1;
+
+        if((tmp = strtok(hoststr, " ")) == NULL)
+        {
+            printf("Line %d: Alias '%s' specifies no hosts\n", lineno,
+                alias);
+            exit(EXIT_FAILURE);
+        }
+
+        hosts = g_array_new(FALSE, TRUE, sizeof(char*));
+
+        do
+        {
+            if(tmp[0] == '[' && tmp[strlen(tmp) - 1] == ']')
+            {
+                tmp++;
+                tmp[strlen(tmp) - 1] = '\0';
+                append_alias(tmp, hosts, aliases, lineno);
+            }
+            else
+                g_array_append_val(hosts, tmp);
+        }
+        while((tmp = strtok(NULL, " ")) != NULL);
+
+        g_datalist_set_data(aliases, alias, hosts);
+    }
+
+    return aliases;
 }
 
 int main(int argc, char* argv[], char* env[])
 {
-	GtkWidget* window;
-	int c, option_index = 0;
-	char *home, *conffile;
+    GtkWidget* window;
+    int c, option_index = 0;
+    char *home, *conffile;
     long cols = 0;
-	GData **aliases = NULL;
-	GArray *hosts = NULL;
-
-	static struct option long_options[] =
-	{
-		{"alias",	required_argument,	0, 'a'},
-		{"columns",	required_argument,	0, 'c'},
-		{"help",	no_argument,		0, 'h'},
-		{"version",	no_argument,		0, 'V'},
-		{0, 0, 0, 0}
-	};
-
-	if((home = getenv("HOME")) != NULL)
-	{
-		int len = strlen(home) + strlen(CONFFILE) + 2;
-
-		conffile = malloc(len);
-		snprintf(conffile, len, "%s/%s", home, CONFFILE);
-
-		aliases = parse_aliases(conffile);
-		free(conffile);
-	}
-	else
-	{
-		fprintf(stderr,
-			"Warning: $HOME not set, not reading config file\n");
-	}
-
-	for(;;)
-	{
-		c = getopt_long(argc, argv, "a:c:hV", long_options, &option_index);
-
-		if(c == -1)
-			break;
-
-		switch(c)
-		{
-		case 'a':
-			if(aliases && (hosts = g_datalist_get_data(aliases,
-				optarg)) == NULL)
-			{
-				fprintf(stderr, "Alias '%s' not found\n\n", optarg);
-				usage(argv[0]);
-			}
-			break;
+    GData **aliases = NULL;
+    GArray *hosts = NULL;
+
+    static struct option long_options[] =
+    {
+        {"alias",   required_argument,  0, 'a'},
+        {"columns", required_argument,  0, 'c'},
+        {"help",    no_argument,        0, 'h'},
+        {"version", no_argument,        0, 'V'},
+        {0, 0, 0, 0}
+    };
+
+    if((home = getenv("HOME")) != NULL)
+    {
+        int len = strlen(home) + strlen(CONFFILE) + 2;
+
+        conffile = malloc(len);
+        snprintf(conffile, len, "%s/%s", home, CONFFILE);
+
+        aliases = parse_aliases(conffile);
+        free(conffile);
+    }
+    else
+    {
+        fprintf(stderr,
+            "Warning: $HOME not set, not reading config file\n");
+    }
+
+    for(;;)
+    {
+        c = getopt_long(argc, argv, "a:c:hV", long_options, &option_index);
+
+        if(c == -1)
+            break;
+
+        switch(c)
+        {
+        case 'a':
+            if(aliases && (hosts = g_datalist_get_data(aliases,
+                optarg)) == NULL)
+            {
+                fprintf(stderr, "Alias '%s' not found\n\n", optarg);
+                usage(argv[0]);
+            }
+            break;
         case 'c':
             errno = 0;
             cols = strtol(optarg, NULL, 10);
             if(cols <= 0 || errno != 0)
             {
-				fprintf(stderr, "Invalid number of columns '%s'\n\n",
+                fprintf(stderr, "Invalid number of columns '%s'\n\n",
                     optarg);
-				usage(argv[0]);
+                usage(argv[0]);
             }
             break;
-		case 'h':
-			usage(argv[0]);
-			break;
-		case 'V':
-			printf("%s\n\n", PKGINFO);
-			printf("%s\n\n", COPYRIGHT);
-			printf("Redistribution and use in source and binary forms, with or without\n");
-			printf("modification, are permitted provided that the following conditions are met:\n");
-			printf("\n");
-			printf("    1. Redistributions of source code must retain the copyright notice,\n");
-			printf("       this list of conditions and the following disclaimer.\n");
-			printf("    2. Redistributions in binary form must reproduce the copyright notice,\n");
-			printf("       this list of conditions and the following disclaimer in the\n");
-			printf("       documentation and/or other materials provided with the distribution.\n");
-			printf("    3. The name of the author may not be used to endorse or promote\n");
-			printf("       products derived from this software without specific prior written\n");
-			printf("       permission.\n");
-			printf("\n");
-			printf("THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n");
-			printf("IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n");
-			printf("OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN\n");
-			printf("NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n");
-			printf("SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\n");
-			printf("TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n");
-			printf("PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n");
-			printf("LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n");
-			printf("NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n");
-			printf("SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n");
-
-			exit(EXIT_SUCCESS);
-			break;
-		case '?':
-			printf("\n");
-			usage(argv[0]);
-			exit(EXIT_FAILURE);
-			break;
-		default:
-			abort();
-		}
-	}
-
-	if(hosts == NULL)
-	{
-		hosts = g_array_new(FALSE, TRUE, sizeof(char*));
-		if (optind < argc)
-		{
-			while (optind < argc)
-			{
-				char *host = strdup(argv[optind++]);
-				g_array_append_val(hosts, host);
-			}
-		}
-		else
-		{
-			fprintf(stderr, "No hosts specified\n\n");
-			usage(argv[0]);
-		}
-	}
-
-	gtk_init(&argc, &argv);
-
-	window = GTK_WIDGET(mssh_window_new());
-
-	g_signal_connect(G_OBJECT(window), "destroy",
-		G_CALLBACK(on_mssh_destroy), NULL);
-
-	mssh_window_start_session(MSSH_WINDOW(window), env, hosts, cols);
-
-	gtk_widget_show_all(window);
-	gtk_main();
-
-	return 0;
+        case 'h':
+            usage(argv[0]);
+            break;
+        case 'V':
+            printf("%s\n\n", PKGINFO);
+            printf("%s\n\n", COPYRIGHT);
+            printf("Redistribution and use in source and binary forms, with or without\n");
+            printf("modification, are permitted provided that the following conditions are met:\n");
+            printf("\n");
+            printf("    1. Redistributions of source code must retain the copyright notice,\n");
+            printf("       this list of conditions and the following disclaimer.\n");
+            printf("    2. Redistributions in binary form must reproduce the copyright notice,\n");
+            printf("       this list of conditions and the following disclaimer in the\n");
+            printf("       documentation and/or other materials provided with the distribution.\n");
+            printf("    3. The name of the author may not be used to endorse or promote\n");
+            printf("       products derived from this software without specific prior written\n");
+            printf("       permission.\n");
+            printf("\n");
+            printf("THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n");
+            printf("IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n");
+            printf("OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN\n");
+            printf("NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n");
+            printf("SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\n");
+            printf("TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n");
+            printf("PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n");
+            printf("LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n");
+            printf("NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n");
+            printf("SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n");
+
+            exit(EXIT_SUCCESS);
+            break;
+        case '?':
+            printf("\n");
+            usage(argv[0]);
+            exit(EXIT_FAILURE);
+            break;
+        default:
+            abort();
+        }
+    }
+
+    if(hosts == NULL)
+    {
+        hosts = g_array_new(FALSE, TRUE, sizeof(char*));
+        if (optind < argc)
+        {
+            while (optind < argc)
+            {
+                char *host = strdup(argv[optind++]);
+                g_array_append_val(hosts, host);
+            }
+        }
+        else
+        {
+            fprintf(stderr, "No hosts specified\n\n");
+            usage(argv[0]);
+        }
+    }
+
+    gtk_init(&argc, &argv);
+
+    window = GTK_WIDGET(mssh_window_new());
+
+    g_signal_connect(G_OBJECT(window), "destroy",
+        G_CALLBACK(on_mssh_destroy), NULL);
+
+    mssh_window_start_session(MSSH_WINDOW(window), env, hosts, cols);
+
+    gtk_widget_show_all(window);
+    gtk_main();
+
+    return 0;
 }