Index: gastman.c
===================================================================
RCS file: /usr/cvsroot/gastman/gastman.c,v
retrieving revision 1.3
diff -u -r1.3 gastman.c
--- gastman.c	30 Mar 2003 20:35:24 -0000	1.3
+++ gastman.c	27 May 2003 04:00:11 -0000
@@ -1539,7 +1539,7 @@
 		strncpy(host, *argv, sizeof(host) - 1);
 
 	if (strlen(host) || 
-		(!gui_get_user_input("Enter hostname", "Enter the hostname you wish to connect to:", host, sizeof(host) - 1) &&
+		(!gui_get_hostname(host, sizeof(host) - 1) &&
 			strlen(host))) {
 		if (!login(host)) {
 			manage_calls(host);
Index: gastman.h
===================================================================
RCS file: /usr/cvsroot/gastman/gastman.h,v
retrieving revision 1.2
diff -u -r1.2 gastman.h
--- gastman.h	30 Mar 2003 20:35:24 -0000	1.2
+++ gastman.h	27 May 2003 04:00:11 -0000
@@ -45,6 +45,7 @@
 int gui_set_icon(int nformat);
 int gui_status(char *str);
 int gui_get_user_input(char *title, char *msg, char *buf, int buflen);
+int gui_get_hostname(char *buf, int buflen);
 int gui_link(struct gui_object *obj1, struct gui_object *obj2);
 int gui_unlink(struct gui_object *obj1, struct gui_object *obj2);
 int gui_show_chan_menu(void);
Index: gui.c
===================================================================
RCS file: /usr/cvsroot/gastman/gui.c,v
retrieving revision 1.3
diff -u -r1.3 gui.c
--- gui.c	30 Mar 2003 20:35:24 -0000	1.3
+++ gui.c	27 May 2003 04:00:13 -0000
@@ -834,7 +834,7 @@
 int gui_init(int *argc, char **argv[])
 {
 	char *fn = loc_file();
-	int res;
+	int res = 0;
 	if (fn) {
 #ifdef __FreeBSD__
 		if (!(db = dbopen(fn, O_CREAT | O_RDWR, 0664, DB_BTREE, NULL))) {
@@ -852,7 +852,7 @@
 	}
 	gtk_init(argc, argv);
 	srand(time(NULL));
-	return 0;
+	return res;
 }
 
 void dialog_answer(GtkWidget *widget, gpointer data)
@@ -866,6 +866,7 @@
 }
 
 static GtkWidget *entry;
+static GtkWidget *combo;
 static char *outmsg;
 static int outmsglen;
 void entry_answer(GtkWidget *widget, gpointer data)
@@ -879,6 +880,18 @@
 	dialog = NULL;
 }
 
+void combo_answer(GtkWidget *widget, gpointer data)
+{
+	GtkCombo *combo2 = GTK_COMBO(combo);
+	choice = (int)(long)data;
+	if (!choice) {
+		strncpy(outmsg, gtk_entry_get_text(GTK_ENTRY(combo2->entry)), outmsglen - 1);
+	} else
+		strcpy(outmsg, "");
+	gtk_widget_destroy(dialog);
+	dialog = NULL;
+}
+
 static char lastcmd[512];
 
 void command_ready(GtkWidget *widget, gpointer data)
@@ -942,6 +955,89 @@
 		gtk_main_iteration_do(1);
 	if (window)
 		gtk_widget_set_sensitive(window, TRUE);
+	return choice;
+}
+
+int gui_get_hostname(char *buf, int buflen)
+{
+	GtkWidget *button;
+	GtkWidget *tw;
+	GtkWidget *vbox, *hbox;
+	GtkWidget *icon;
+	GList *list = NULL;
+	char *rtext = "GAstman: Enter hostname";
+	int x;
+	int choices = 2;
+	DIR *gastman_dir;
+	struct dirent *gastman_dirent;
+	static char fn[256];
+
+	/* TODO  Abstract filename */
+	snprintf(fn, sizeof(fn), "%s" G_DIR_SEPARATOR_S ".gastman", gui_get_home_dir());
+	gastman_dir = opendir(fn);
+	while (( gastman_dirent = readdir(gastman_dir) )) {
+		char *thedot;
+		if ( gastman_dirent->d_name[0] == '.' )
+			continue;
+		if (( thedot = strstr(gastman_dirent->d_name, ".extens") )) {
+			char *copy;
+			thedot[0] = '\0';
+			copy = alloca(strlen(gastman_dirent->d_name) + 1);
+			if (copy) {
+				strcpy(copy, gastman_dirent->d_name);
+				list = g_list_append(list, copy);
+			}
+		}
+	}
+	closedir(gastman_dir);
+
+	dialog = gtk_dialog_new();
+	tw = gtk_label_new("Enter the hostname you wish to connect to:");
+	gtk_window_set_title(GTK_WINDOW(dialog), rtext);
+	gtk_widget_realize(dialog);
+	fix_icon(dialog->window);
+	gtk_widget_show(tw);
+	vbox = gtk_vbox_new(FALSE, 0);
+	hbox = gtk_hbox_new(FALSE, 0);
+	icon = make_pixmap_from_data(dialog, inkwell_xpm);
+	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 10);
+	gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 10);
+	gtk_box_pack_start(GTK_BOX(vbox), tw, TRUE, TRUE, 15);
+	gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 10);
+	combo = gtk_combo_new();
+	gtk_combo_set_case_sensitive(GTK_COMBO(combo), FALSE);
+	gtk_combo_set_value_in_list(GTK_COMBO(combo), FALSE, FALSE);
+	gtk_combo_set_use_arrows(GTK_COMBO(combo), TRUE);
+	gtk_combo_set_use_arrows_always(GTK_COMBO(combo), TRUE);
+	gtk_combo_set_popdown_strings(GTK_COMBO(combo), list);
+	gtk_box_pack_start(GTK_BOX(vbox), combo, FALSE, FALSE, 5);
+	/* gtk_signal_connect(GTK_OBJECT(GTK_COMBO(combo)), "activate", GTK_SIGNAL_FUNC(combo_answer), (gpointer)(long)0); */
+	choice = -1;
+	
+	for (x=0;x<choices;x++) {
+		button = gtk_button_new_with_label(okcancel[x]);
+		gtk_widget_set_usize(button, 80, 30);
+		gtk_widget_show(button);
+		gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(combo_answer), (gpointer)(long)x);
+		gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), button, FALSE, FALSE, 10);
+	}
+	gtk_widget_grab_focus(combo);
+	if (window)
+		gtk_widget_set_sensitive(window, FALSE);
+	outmsg = buf;
+	outmsglen = buflen;
+	gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
+	gtk_widget_show_all(dialog);
+	/* Block as long as dialog is here */
+	while(dialog) 
+		gtk_main_iteration_do(1);
+	if (window)
+		gtk_widget_set_sensitive(window, TRUE);
+
+	/* Clean up associated memory */
+	g_list_free(list);
+
 	return choice;
 }
 
