Browse Source

Split out terminals into seperate clase and make layout more dynamic.

Signed-off-by: Bradley Smith <[email protected]>
Bradley Smith 15 years ago
parent
commit
c538280a05
6 changed files with 375 additions and 134 deletions
  1. 1 1
      src/Makefile.am
  2. 112 0
      src/mssh-terminal.c
  3. 49 0
      src/mssh-terminal.h
  4. 209 118
      src/mssh-window.c
  5. 3 14
      src/mssh-window.h
  6. 1 1
      src/mssh.c

+ 1 - 1
src/Makefile.am

@@ -4,7 +4,7 @@ INCLUDES = $(MSSH_CFLAGS)
 
 bin_PROGRAMS = mssh
 
-mssh_SOURCES = mssh.c mssh-window.c
+mssh_SOURCES = mssh.c mssh-terminal.c mssh-window.c
 mssh_LDADD = $(MSSH_LIBS)
 
 EXTRA_DIST = mssh-window.h

+ 112 - 0
src/mssh-terminal.c

@@ -0,0 +1,112 @@
+#include <string.h>
+#include <stdlib.h>
+
+#include "mssh-terminal.h"
+
+G_DEFINE_TYPE(MSSHTerminal, mssh_terminal, VTE_TYPE_TERMINAL)
+
+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);
+
+GtkWidget* mssh_terminal_new()
+{
+	return g_object_new(MSSH_TYPE_TERMINAL, NULL);
+}
+
+void mssh_terminal_destroy(MSSHTerminal *terminal)
+{
+	free(terminal->hostname);
+}
+
+gboolean mssh_terminal_isactive(MSSHTerminal *terminal)
+{
+	return gtk_check_menu_item_get_active(
+		GTK_CHECK_MENU_ITEM(terminal->menu_item));
+}
+
+void mssh_terminal_start_session(MSSHTerminal *terminal, char *hostname,
+	char **env)
+{
+	char *args[3];
+
+	terminal->hostname = hostname;
+
+	args[0] = strdup("ssh");
+	args[1] = terminal->hostname;
+	args[2] = NULL;
+
+	terminal->menu_item = gtk_check_menu_item_new_with_label(
+		terminal->hostname);
+
+	vte_terminal_fork_command(VTE_TERMINAL(terminal), "ssh", args,
+		env, NULL, FALSE, FALSE, FALSE);
+
+	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
+		terminal->menu_item), TRUE);
+
+	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));
+	}
+}
+
+void mssh_terminal_send_data(MSSHTerminal *terminal, GdkEventKey *event)
+{
+	gboolean dummy;
+
+	if(mssh_terminal_isactive(terminal))
+	{
+		g_signal_emit_by_name(terminal, "key-press-event", event, &dummy);
+	}
+}
+
+static void mssh_terminal_init(MSSHTerminal* 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);
+}
+
+static void mssh_terminal_child_exited(VteTerminal *vte, gpointer data)
+{
+	char msg[] = "\r\n[Child Exited]\r\n";
+
+	MSSHTerminal *terminal = MSSH_TERMINAL(data);
+
+	vte_terminal_feed(vte, msg, strlen(msg));
+
+	g_signal_emit_by_name(terminal, "session-closed");
+}
+
+static gboolean mssh_terminal_focused(GtkWidget *widget,
+	GtkDirectionType dir, gpointer data)
+{
+	MSSHTerminal *terminal = MSSH_TERMINAL(data);
+
+	g_signal_emit_by_name(terminal, "session-focused");
+
+	return FALSE;
+}

+ 49 - 0
src/mssh-terminal.h

@@ -0,0 +1,49 @@
+#ifndef __MSSH_TERMINAL_H__
+#define __MSSH_TERMINAL_H__
+
+#include <gtk/gtk.h>
+#include <vte/vte.h>
+
+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)
+
+typedef struct
+{
+	VteTerminal vte;
+	GtkWidget *menu_item;
+	char *hostname;
+} MSSHTerminal;
+
+typedef struct
+{
+	VteTerminalClass parent_class;
+
+	guint session_closed_signal;
+	guint session_focused_signal;
+
+	void (*session_closed)(MSSHTerminal *terminal);
+	void (*session_focused)(MSSHTerminal *terminal);
+} MSSHTerminalClass;
+
+GType mssh_terminal_get_type(void) G_GNUC_CONST;
+
+GtkWidget* mssh_terminal_new(void);
+void mssh_terminal_destroy(MSSHTerminal *terminal);
+gboolean mssh_terminal_isactive(MSSHTerminal *terminal);
+void mssh_terminal_start_session(MSSHTerminal *terminal, char *hostnane,
+	char **env);
+void mssh_terminal_send_host(MSSHTerminal *terminal);
+void mssh_terminal_send_data(MSSHTerminal *terminal, GdkEventKey *event);
+
+G_END_DECLS
+
+#endif /* __MSSH_TERMINAL_H__ */

+ 209 - 118
src/mssh-window.c

@@ -3,200 +3,291 @@
 
 #include <gdk/gdkkeysyms.h>
 
+#include "mssh-terminal.h"
 #include "mssh-window.h"
 
+#include "config.h"
+
+static void mssh_window_sendhost(GtkWidget *widget, gpointer data);
+static void mssh_window_destroy(GtkWidget *widget, gpointer data);
+static gboolean mssh_window_key_press(GtkWidget *widget,
+	GdkEventKey *event, gpointer data);
+static gboolean mssh_window_entry_focused(GtkWidget *widget,
+	GtkDirectionType dir, gpointer data);
+static gboolean mssh_window_session_close(gpointer data);
+static void mssh_window_session_closed(MSSHTerminal *terminal,
+	gpointer data);
+static void mssh_window_session_focused(MSSHTerminal *terminal,
+	gpointer data);
+static void mssh_window_relayout(MSSHWindow *window);
+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);
+
 G_DEFINE_TYPE(MSSHWindow, mssh_window, GTK_TYPE_WINDOW)
 
+struct WinTermPair
+{
+	MSSHWindow *window;
+	MSSHTerminal *terminal;
+};
+
+GtkWidget* mssh_window_new(void)
+{
+	return g_object_new(MSSH_TYPE_WINDOW, NULL);
+}
+
 static void mssh_window_sendhost(GtkWidget *widget, gpointer data)
 {
 	int i;
 
 	MSSHWindow *window = MSSH_WINDOW(data);
 
-	for(i = 0; i < window->num_servers; i++)
+	for(i = 0; i < window->terminals->len; i++)
 	{
-		if(window->terms[i] != NULL)
+		mssh_terminal_send_host(g_array_index(window->terminals,
+			MSSHTerminal*, i));
+	}
+}
+
+static void mssh_window_destroy(GtkWidget *widget, gpointer data)
+{
+	int i;
+
+	MSSHWindow *window = MSSH_WINDOW(data);
+
+	if(window->terminals->len > 0)
+	{
+		GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(window),
+			GTK_DIALOG_DESTROY_WITH_PARENT,	GTK_MESSAGE_QUESTION,
+			GTK_BUTTONS_YES_NO, "%s, %s",
+			"You still have open sessions",
+			"are you sure you wish to quit?");
+
+		if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_YES)
 		{
-			if(gtk_check_menu_item_get_active(
-				GTK_CHECK_MENU_ITEM(window->items[i])))
-			{
-				vte_terminal_feed_child(VTE_TERMINAL(window->terms[i]),
-					window->servers[i], strlen(window->servers[i]));
-			}
+				for(i = 0; i < window->terminals->len; i++)
+				{
+					mssh_terminal_destroy(g_array_index(window->terminals,
+						MSSHTerminal*, i));
+				}
+
+				g_array_free(window->terminals, TRUE);
+
+				gtk_main_quit();
 		}
+
+		gtk_widget_destroy(dialog);
 	}
 }
 
-static void mssh_window_destroy(GtkWidget *widget, gpointer data)
+static gboolean mssh_window_key_press(GtkWidget *widget,
+	GdkEventKey *event, gpointer data)
 {
+	int i;
+
 	MSSHWindow *window = MSSH_WINDOW(data);
 
-	free(window->terms);
-	free(window->items);
-	gtk_main_quit();
+	for(i = 0; i < window->terminals->len; i++)
+	{
+		mssh_terminal_send_data(g_array_index(window->terminals,
+			MSSHTerminal*, i), event);
+	}
+
+	return TRUE;
 }
 
-GtkWidget* mssh_window_new(void)
+static gboolean mssh_window_entry_focused(GtkWidget *widget,
+	GtkDirectionType dir, gpointer data)
 {
-	return g_object_new(MSSH_TYPE_WINDOW, NULL);
+	MSSHWindow *window = MSSH_WINDOW(data);
+
+	gtk_window_set_title(GTK_WINDOW(window), PACKAGE_NAME" - All");
+
+	return FALSE;
 }
 
-gboolean key_press(GtkWidget *widget, GdkEventKey *event,
-	gpointer user_data)
+static gboolean mssh_window_session_close(gpointer data)
 {
-	int i;
-	gboolean dummy;
+	int i, idx = -1;
 
-	MSSHWindow *window = MSSH_WINDOW(user_data);
+	struct WinTermPair *data_pair = (struct WinTermPair*)data;
 
-	for(i = 0; i < window->num_servers; i++)
+	for(i = 0; i < data_pair->window->terminals->len; i++)
 	{
-		if(window->terms[i] != NULL)
+		if(data_pair->terminal == g_array_index(
+			data_pair->window->terminals, MSSHTerminal*, i))
 		{
-			if(gtk_check_menu_item_get_active(
-				GTK_CHECK_MENU_ITEM(window->items[i])))
-			{
-				g_signal_emit_by_name(window->terms[i], "key-press-event",
-					event, &dummy);
-			}
+			idx = i;
+			break;
 		}
 	}
 
-	return TRUE;
+	if(idx == -1)
+	{
+		fprintf(stderr,
+			"mssh: Fatal Error: Can't find terminal to remove!\n");
+	}
+	else
+	{
+		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);
+	}
+
+	free(data_pair);
+
+	return FALSE;
 }
 
-void vte_child_exited(VteTerminal *vte, gpointer user_data)
+static void mssh_window_session_closed(MSSHTerminal *terminal,
+	gpointer data)
 {
-	int i;
-	char data[] = "\n[Child Exited]";
-	MSSHWindow *window = MSSH_WINDOW(user_data);
-	vte_terminal_feed(vte, data, strlen(data));
+	struct WinTermPair *data_pair = malloc(sizeof(struct WinTermPair));
+	data_pair->terminal = terminal;
+	data_pair->window = MSSH_WINDOW(data);
+
+	g_timeout_add_seconds(2, mssh_window_session_close, data_pair);
+}
 
-	for(i = 0; i < window->num_servers; i++)
+static void mssh_window_session_focused(MSSHTerminal *terminal,
+	gpointer data)
+{
+	char *title;
+	size_t len;
+
+	MSSHWindow *window = MSSH_WINDOW(data);
+
+	len = strlen(PACKAGE_NAME" - ") + strlen(terminal->hostname) + 1;
+	title = malloc(len);
+
+	snprintf(title, len, PACKAGE_NAME" - %s", terminal->hostname);
+
+	gtk_window_set_title(GTK_WINDOW(window), title);
+
+	free(title);
+}
+
+static void mssh_window_relayout(MSSHWindow *window)
+{
+	int i, len = window->terminals->len;
+
+	for(i = 0; i < len; i++)
 	{
-		if(window->terms[i] == GTK_WIDGET(vte))
+		MSSHTerminal *terminal = g_array_index(window->terminals,
+			MSSHTerminal*, i);
+
+		g_object_ref(terminal);
+		if(GTK_WIDGET(terminal)->parent == GTK_WIDGET(window->table))
 		{
-			window->terms[i] = NULL;
-			break;
+			gtk_container_remove(GTK_CONTAINER(window->table),
+				GTK_WIDGET(terminal));
 		}
+
+		gtk_table_attach(GTK_TABLE(window->table), GTK_WIDGET(terminal),
+			(i % 2), (i == len - 1) ? 2 : (i % 2) + 1, i / 2, (i / 2) + 1,
+			GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 2, 2);
+		g_object_unref(terminal);
 	}
+
+	gtk_table_resize(GTK_TABLE(window->table), ((len + 1) / 2), 2);
+}
+
+static void mssh_window_add_session(MSSHWindow *window, char *hostname)
+{
+	MSSHTerminal *terminal = MSSH_TERMINAL(mssh_terminal_new());
+
+	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);
+
+	mssh_terminal_start_session(terminal, hostname, window->env);
+
+	gtk_menu_shell_append(GTK_MENU_SHELL(window->server_menu),
+		terminal->menu_item);
 }
 
 static void mssh_window_init(MSSHWindow* window)
 {
-	GtkAccelGroup *accel_group;
+	GtkAccelGroup *accel_group = gtk_accel_group_new();
+	GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
+	GtkWidget *entry = gtk_entry_new();
 
-	accel_group = gtk_accel_group_new();
-	window->vbox = gtk_vbox_new(FALSE, 0);
-	window->entry = gtk_entry_new();
-	window->menu_bar = gtk_menu_bar_new();
-	window->server_menu = gtk_menu_new();
-	window->file_menu = gtk_menu_new();
-	window->server_item = gtk_menu_item_new_with_label("Servers");
-	window->file_item = gtk_menu_item_new_with_label("File");
-	window->file_quit = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT,
-		NULL);
-	window->file_sendhost = gtk_image_menu_item_new_with_label(
+	GtkWidget *menu_bar = gtk_menu_bar_new();
+	GtkWidget *file_menu = gtk_menu_new();
+
+	GtkWidget *server_item = gtk_menu_item_new_with_label("Servers");
+	GtkWidget *file_item = gtk_menu_item_new_with_label("File");
+
+	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");
 
-	gtk_menu_item_set_submenu(GTK_MENU_ITEM(window->file_item),
-		window->file_menu);
-	gtk_menu_item_set_submenu(GTK_MENU_ITEM(window->server_item),
+	window->server_menu = gtk_menu_new();
+
+	gtk_menu_item_set_submenu(GTK_MENU_ITEM(file_item), file_menu);
+	gtk_menu_item_set_submenu(GTK_MENU_ITEM(server_item),
 		window->server_menu);
 
-	gtk_menu_shell_append(GTK_MENU_SHELL(window->file_menu),
-		window->file_sendhost);
-	gtk_menu_shell_append(GTK_MENU_SHELL(window->file_menu),
-		window->file_quit);
-	g_signal_connect(G_OBJECT(window->file_sendhost), "activate",
+	gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_sendhost);
+	gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_quit);
+	g_signal_connect(G_OBJECT(file_sendhost), "activate",
 		G_CALLBACK(mssh_window_sendhost), window);
-	g_signal_connect(G_OBJECT(window->file_quit), "activate",
+	g_signal_connect(G_OBJECT(file_quit), "activate",
 		G_CALLBACK(mssh_window_destroy), window);
-	gtk_widget_add_accelerator(window->file_quit, "activate", accel_group,
+	gtk_widget_add_accelerator(file_quit, "activate", accel_group,
 		GDK_W, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
 	gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
 
-	gtk_menu_bar_append(GTK_MENU_BAR(window->menu_bar),
-		window->file_item);
-	gtk_menu_bar_append(GTK_MENU_BAR(window->menu_bar),
-		window->server_item);
+	gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), file_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), "focus-in-event",
+		G_CALLBACK(mssh_window_entry_focused), window);
 
-	g_signal_connect(G_OBJECT(window->entry), "key-press-event",
-		G_CALLBACK(key_press), window);
+	gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, TRUE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, TRUE, 2);
 
-	gtk_box_pack_start(GTK_BOX(window->vbox), window->menu_bar,
-		FALSE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(window->vbox), window->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), window->vbox);
+	gtk_container_add(GTK_CONTAINER(window), vbox);
 
 	gtk_widget_set_size_request(GTK_WIDGET(window), 1024, 768);
-	gtk_window_set_title(GTK_WINDOW(window), "MSSH");
+	gtk_window_set_title(GTK_WINDOW(window), PACKAGE_NAME);
 }
 
-void mssh_window_new_session(MSSHWindow* window, char **env,
-	int num_servers, char **servers)
+void mssh_window_start_session(MSSHWindow* window, char **env, int nhosts,
+	char **servers)
 {
-	char *args[3] = { NULL, NULL, NULL };
 	int i, j, k;
-	int rows = num_servers/2 + num_servers%2;
+	int rows = (nhosts / 2) + (nhosts % 2);
 
 	window->env = env;
-	window->num_servers = num_servers;
-	window->servers = servers;
-
-	window->items = malloc(sizeof(GtkWidget) * num_servers);
-	window->terms = malloc(sizeof(GtkWidget) * num_servers);
-	memset(window->items, 0, sizeof(GtkWidget) * num_servers);
-	memset(window->terms, 0, sizeof(GtkWidget) * num_servers);
-
-	args[0] = strdup("ssh");
-
-	window->table = gtk_table_new(rows, 2, TRUE);
-	gtk_box_pack_start(GTK_BOX(window->vbox), window->table,
-		TRUE, TRUE, 0);
+	window->terminals = g_array_new(FALSE, TRUE, sizeof(MSSHTerminal*));
 
 	for(i = 0; i < rows; i++)
 	{
 		for(j = 0; j < 2; j++)
 		{
 			k = j + i*2;
-			if(k < num_servers)
+			if(k < nhosts)
 			{
-				args[1] = window->servers[k];
-				window->terms[k] = vte_terminal_new();
-				g_signal_connect(G_OBJECT(window->terms[k]),
-					"child-exited", G_CALLBACK(vte_child_exited), window);
-				vte_terminal_fork_command(VTE_TERMINAL(window->terms[k]),
-					"ssh", args, window->env, NULL, FALSE, FALSE,
-					FALSE);
-				if((k == num_servers - 1) && (num_servers % 2 == 1))
-				{
-					gtk_table_attach(GTK_TABLE(window->table),
-						window->terms[k], j, j+2, i, i+1,
-						GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 2,
-						2);
-				}
-				else
-				{
-					gtk_table_attach(GTK_TABLE(window->table),
-						window->terms[k], j, j+1, i, i+1,
-						GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 2,
-						2);
-				}
-
-				window->items[k] = gtk_check_menu_item_new_with_label(
-					window->servers[k]);
-				gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
-					window->items[k]), TRUE);
-				gtk_menu_shell_append(GTK_MENU_SHELL(window->server_menu),
-					window->items[k]);
+				mssh_window_add_session(window, servers[k]);
 			}
 		}
 	}
 
-	free(args[0]);
+	mssh_window_relayout(window);
 }
 
 static void mssh_window_class_init(MSSHWindowClass *klass)

+ 3 - 14
src/mssh-window.h

@@ -19,21 +19,10 @@ G_BEGIN_DECLS
 typedef struct
 {
 	GtkWindow widget;
-	GtkWidget *vbox;
-	GtkWidget *entry;
 	GtkWidget *table;
-	GtkWidget *menu_bar;
 	GtkWidget *server_menu;
-	GtkWidget *file_menu;
-	GtkWidget *server_item;
-	GtkWidget *file_item;
-	GtkWidget *file_sendhost;
-	GtkWidget *file_quit;
+	GArray *terminals;
 	char **env;
-	char **servers;
-	int num_servers;
-	GtkWidget **items;
-	GtkWidget **terms;
 } MSSHWindow;
 
 typedef struct
@@ -44,8 +33,8 @@ typedef struct
 GType mssh_window_get_type(void) G_GNUC_CONST;
 
 GtkWidget* mssh_window_new(void);
-void mssh_window_new_session(MSSHWindow* window, char **env,
-	int num_servers, char **servers);
+void mssh_window_start_session(MSSHWindow* window, char **env, int nhosts,
+	char **servers);
 
 G_END_DECLS
 

+ 1 - 1
src/mssh.c

@@ -116,7 +116,7 @@ int main(int argc, char* argv[], char* env[])
 	g_signal_connect(G_OBJECT(window), "destroy",
 		G_CALLBACK(on_mssh_destroy), NULL);
 
-	mssh_window_new_session(MSSH_WINDOW(window), env, nhosts, hosts);
+	mssh_window_start_session(MSSH_WINDOW(window), env, nhosts, hosts);
 
 	gtk_widget_show_all(window);
 	gtk_main();