--- np2/x11/gtk2/gtk_menu.c	2008/03/13 16:27:39	1.12
+++ np2/x11/gtk2/gtk_menu.c	2011/12/17 14:32:52	1.20
@@ -1,5 +1,3 @@
-/*	$Id: gtk_menu.c,v 1.12 2008/03/13 16:27:39 monaka Exp $	*/
-
 /*
  * Copyright (c) 2004 NONAKA Kimihiro (aw9k-nnk@asahi-net.or.jp)
  * All rights reserved.
@@ -60,6 +58,9 @@
 #include "gtk2/gtk_menu.h"
 #include "gtk2/gtk_keyboard.h"
 
+#ifndef	NSTATSAVE
+#define	NSTATSAVE	10
+#endif
 
 /* normal */
 static void cb_bmpsave(GtkAction *action, gpointer user_data);
@@ -341,6 +342,10 @@ static const gchar *ui_info =
 "   \n"
 "   \n"
 "  \n"
+#if defined(SUPPORT_STATSAVE)
+"  
\n"
+#endif
 "  \n"
 "  \n"
-#if defined(SUPPORT_STATSAVE)
-"  \n"
-#endif
 " \n"
 "\n";
 
@@ -582,9 +562,6 @@ cb_bmpsave(GtkAction *action, gpointer u
 	SCRNBMP bmp = NULL;
 	FILEH fh;
 
-	UNUSED(action);
-	UNUSED(user_data);
-
 	uninstall_idle_process();
 
 	bmp = scrnbmp();
@@ -599,8 +576,10 @@ cb_bmpsave(GtkAction *action, gpointer u
 	if (dialog == NULL)
 		goto end;
 
-	g_object_set(G_OBJECT(dialog), "show-hidden", TRUE, NULL);
+	gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(dialog), TRUE);
 	gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
+	gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog),
+	    TRUE);
 	if (strlen(bmpfilefolder) == 0) {
 		g_strlcpy(bmpfilefolder, modulefile, sizeof(bmpfilefolder));
 		file_cutname(bmpfilefolder);
@@ -632,6 +611,12 @@ cb_bmpsave(GtkAction *action, gpointer u
 	if (utf8) {
 		path = g_filename_from_utf8(utf8, -1, NULL, NULL, NULL);
 		if (path) {
+			gchar *ext = file_getext(path);
+			if (strlen(ext) != 3 || file_cmpname(ext, "bmp")) {
+				gchar *tmp = g_strjoin(".", path, "bmp", NULL);
+				g_free(path);
+				path = tmp;
+			}
 			file_cpyname(bmpfilefolder, path, sizeof(bmpfilefolder));
 			sysmng_update(SYS_UPDATEOSCFG);
 			fh = file_create(path);
@@ -660,9 +645,6 @@ cb_change_font(GtkAction *action, gpoint
 	gchar *utf8, *path;
 	struct stat sb;
 
-	UNUSED(action);
-	UNUSED(user_data);
-
 	uninstall_idle_process();
 
 	dialog = gtk_file_chooser_dialog_new("Open a font file",
@@ -673,7 +655,7 @@ cb_change_font(GtkAction *action, gpoint
 	if (dialog == NULL)
 		goto end;
 
-	g_object_set(G_OBJECT(dialog), "show-hidden", TRUE, NULL);
+	gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(dialog), TRUE);
 	gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
 	utf8 = g_filename_to_utf8(np2cfg.fontfile, -1, NULL, NULL, NULL);
 	if (utf8) {
@@ -726,8 +708,6 @@ cb_diskeject(GtkAction *action, gpointer
 	const gchar *name = gtk_action_get_name(action);
 	guint drive;
 
-	UNUSED(user_data);
-
 	/* name = "disk?eject" */
 	if ((strlen(name) >= 5) && (g_ascii_isdigit(name[4]))) {
 		drive = g_ascii_digit_value(name[4]) - 1;
@@ -748,8 +728,6 @@ cb_diskopen(GtkAction *action, gpointer 
 	const gchar *name = gtk_action_get_name(action);
 	guint drive;
 
-	UNUSED(user_data);
-
 	if ((strlen(name) < 5) || (!g_ascii_isdigit(name[4])))
 		return;
 	drive = g_ascii_digit_value(name[4]) - 1;
@@ -764,7 +742,7 @@ cb_diskopen(GtkAction *action, gpointer 
 	if (dialog == NULL)
 		goto end;
 
-	g_object_set(G_OBJECT(dialog), "show-hidden", TRUE, NULL);
+	gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(dialog), TRUE);
 	gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
 	utf8 = g_filename_to_utf8(fddfolder, -1, NULL, NULL, NULL);
 	if (utf8) {
@@ -851,8 +829,6 @@ cb_ataopen(GtkAction *action, gpointer u
 	const gchar *name = gtk_action_get_name(action);
 	guint channel, drive;
 
-	UNUSED(user_data);
-
 	/* "ata??open" */
 	if ((strlen(name) < 5)
 	 || (!g_ascii_isdigit(name[3]))
@@ -875,7 +851,7 @@ cb_ataopen(GtkAction *action, gpointer u
 	if (dialog == NULL)
 		goto end;
 
-	g_object_set(G_OBJECT(dialog), "show-hidden", TRUE, NULL);
+	gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(dialog), TRUE);
 	gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
 	utf8 = g_filename_to_utf8(hddfolder, -1, NULL, NULL, NULL);
 	if (utf8) {
@@ -928,8 +904,6 @@ cb_ataremove(GtkAction *action, gpointer
 	const gchar *name = gtk_action_get_name(GTK_ACTION(action));
 	guint channel, drive;
 
-	UNUSED(user_data);
-
 	/* "ata??open" */
 	if ((strlen(name) < 5)
 	 || (!g_ascii_isdigit(name[3]))
@@ -954,9 +928,6 @@ cb_atapiopen(GtkAction *action, gpointer
 	gchar *utf8, *path;
 	struct stat sb;
 
-	UNUSED(action);
-	UNUSED(user_data);
-
 	uninstall_idle_process();
 
 	dialog = gtk_file_chooser_dialog_new("Open a ATAPI CD-ROM image",
@@ -967,7 +938,7 @@ cb_atapiopen(GtkAction *action, gpointer
 	if (dialog == NULL)
 		goto end;
 
-	g_object_set(G_OBJECT(dialog), "show-hidden", TRUE, NULL);
+	gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(dialog), TRUE);
 	gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
 	utf8 = g_filename_to_utf8(hddfolder, -1, NULL, NULL, NULL);
 	if (utf8) {
@@ -1022,9 +993,6 @@ static void
 cb_atapiremove(GtkAction *action, gpointer user_data)
 {
 
-	UNUSED(action);
-	UNUSED(user_data);
-
 	sxsi_devclose(0x02);
 }
 #endif	/* SUPPORT_IDEIO */
@@ -1033,9 +1001,6 @@ static void
 cb_midipanic(GtkAction *action, gpointer user_data)
 {
 
-	UNUSED(action);
-	UNUSED(user_data);
-
 	rs232c_midipanic();
 	mpu98ii_midipanic();
 	pc9861k_midipanic();
@@ -1064,9 +1029,6 @@ cb_newdisk(GtkAction *action, gpointer u
 	int kind;
 	int i;
 
-	UNUSED(action);
-	UNUSED(user_data);
-
 	uninstall_idle_process();
 
 	dialog = gtk_file_chooser_dialog_new("Create new disk image file",
@@ -1077,8 +1039,10 @@ cb_newdisk(GtkAction *action, gpointer u
 	if (dialog == NULL)
 		goto end;
 
-	g_object_set(G_OBJECT(dialog), "show-hidden", TRUE, NULL);
+	gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(dialog), TRUE);
 	gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
+	gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog),
+	    TRUE);
 	if (strlen(fddfolder) == 0) {
 		g_strlcpy(fddfolder, modulefile, sizeof(fddfolder));
 		file_cutname(fddfolder);
@@ -1096,7 +1060,7 @@ cb_newdisk(GtkAction *action, gpointer u
 
 	filter[0] = gtk_file_filter_new();
 	if (filter[0]) {
-		gtk_file_filter_set_name(filter[0], "D88 floppy disk image");
+		gtk_file_filter_set_name(filter[0], "D88 floppy disk image (*.d88,*.d98,*.88d,*.98d)");
 		gtk_file_filter_add_pattern(filter[0], "*.[dD]88");
 		gtk_file_filter_add_pattern(filter[0], "*.88[dD]");
 		gtk_file_filter_add_pattern(filter[0], "*.[dD]98");
@@ -1105,19 +1069,19 @@ cb_newdisk(GtkAction *action, gpointer u
 	}
 	filter[1] = gtk_file_filter_new();
 	if (filter[1]) {
-		gtk_file_filter_set_name(filter[1], "Anex86 hard disk image files");
+		gtk_file_filter_set_name(filter[1], "Anex86 hard disk image (*.hdi)");
 		gtk_file_filter_add_pattern(filter[1], "*.[hH][dD][iI]");
 		gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter[1]);
 	}
 	filter[2] = gtk_file_filter_new();
 	if (filter[2]) {
-		gtk_file_filter_set_name(filter[2], "T98 hard disk image files");
+		gtk_file_filter_set_name(filter[2], "T98 hard disk image (*.thd)");
 		gtk_file_filter_add_pattern(filter[2], "*.[tT][hH][dD]");
 		gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter[2]);
 	}
 	filter[3] = gtk_file_filter_new();
 	if (filter[3]) {
-		gtk_file_filter_set_name(filter[3], "T98-Next hard disk image files");
+		gtk_file_filter_set_name(filter[3], "T98-Next hard disk image (*.nhd)");
 		gtk_file_filter_add_pattern(filter[3], "*.[nN][hH][dD]");
 		gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter[3]);
 	}
@@ -1190,9 +1154,6 @@ static void
 cb_reset(GtkAction *action, gpointer user_data)
 {
 
-	UNUSED(action);
-	UNUSED(user_data);
-
 	pccore_cfgupdate();
 	pccore_reset();
 }
@@ -1208,8 +1169,6 @@ cb_sasiopen(GtkAction *action, gpointer 
 	const gchar *name = gtk_action_get_name(action);
 	guint drive;
 
-	UNUSED(user_data);
-
 	if ((strlen(name) < 5) || (!g_ascii_isdigit(name[4])))
 		return;
 	drive = g_ascii_digit_value(name[4]) - 1;
@@ -1224,7 +1183,7 @@ cb_sasiopen(GtkAction *action, gpointer 
 	if (dialog == NULL)
 		goto end;
 
-	g_object_set(G_OBJECT(dialog), "show-hidden", TRUE, NULL);
+	gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(dialog), TRUE);
 	gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
 	utf8 = g_filename_to_utf8(hddfolder, -1, NULL, NULL, NULL);
 	if (utf8) {
@@ -1277,8 +1236,6 @@ cb_sasiremove(GtkAction *action, gpointe
 	const gchar *name = gtk_action_get_name(GTK_ACTION(action));
 	guint drive;
 
-	UNUSED(user_data);
-
 	/* name = "sasi?eject" */
 	if ((strlen(name) >= 5) && (g_ascii_isdigit(name[4]))) {
 		drive = g_ascii_digit_value(name[4]) - 1;
@@ -1297,8 +1254,6 @@ cb_statsave(GtkAction *action, gpointer 
 	char ext[4];
 	guint n;
 
-	UNUSED(user_data);
-
 	/* name = "stat??save" */
 	if ((strlen(name) >= 6)
 	 && (g_ascii_isdigit(name[4]))
@@ -1317,8 +1272,6 @@ cb_statload(GtkAction *action, gpointer 
 	char ext[4];
 	guint n;
 
-	UNUSED(user_data);
-
 	/* name = "stat??load" */
 	if ((strlen(name) >= 6)
 	 && (g_ascii_isdigit(name[4]))
@@ -1336,8 +1289,6 @@ cb_dialog(GtkAction *action, gpointer us
 {
 	const gchar *name = gtk_action_get_name(action);
 
-	UNUSED(user_data);
-
 	if (g_ascii_strcasecmp(name, "configure") == 0) {
 		create_configure_dialog();
 	} else if (g_ascii_strcasecmp(name, "soundopt") == 0) {
@@ -1364,8 +1315,6 @@ cb_clockdisp(GtkToggleAction *action, gp
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2oscfg.DISPCLK & 1) ^ (b ? 1 : 0);
 	if (f) {
 		np2oscfg.DISPCLK ^= 1;
@@ -1381,8 +1330,6 @@ cb_dispvsync(GtkToggleAction *action, gp
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2cfg.DISPSYNC ? 1 : 0) ^ (b ? 1 : 0);
 	if (f) {
 		np2cfg.DISPSYNC = !np2cfg.DISPSYNC;
@@ -1396,8 +1343,6 @@ cb_framedisp(GtkToggleAction *action, gp
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2oscfg.DISPCLK & 2) ^ (b ? 2 : 0);
 	if (f) {
 		np2oscfg.DISPCLK ^= 2;
@@ -1413,8 +1358,6 @@ cb_jastsound(GtkToggleAction *action, gp
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2oscfg.jastsnd ? 1 : 0) ^ (b ? 1 : 0);
 	if (f) {
 		np2oscfg.jastsnd = !np2oscfg.jastsnd;
@@ -1428,8 +1371,6 @@ cb_joyrapid(GtkToggleAction *action, gpo
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2cfg.BTN_RAPID ? 1 : 0) ^ (b ? 1 : 0);
 	if (f) {
 		np2cfg.BTN_RAPID = !np2cfg.BTN_RAPID;
@@ -1443,8 +1384,6 @@ cb_joyreverse(GtkToggleAction *action, g
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2cfg.BTN_MODE ? 1 : 0) ^ (b ? 1 : 0);
 	if (f) {
 		np2cfg.BTN_MODE = !np2cfg.BTN_MODE;
@@ -1458,8 +1397,6 @@ cb_keydisplay(GtkToggleAction *action, g
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2oscfg.keydisp ? 1 : 0) ^ (b ? 1 : 0);
 	if (f) {
 		np2oscfg.keydisp = !np2oscfg.keydisp;
@@ -1478,8 +1415,6 @@ cb_mousemode(GtkToggleAction *action, gp
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2oscfg.MOUSE_SW ? 1 : 0) ^ (b ? 1 : 0);
 	if (f) {
 		mouse_running(MOUSE_XOR);
@@ -1494,8 +1429,6 @@ cb_mouserapid(GtkToggleAction *action, g
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2cfg.MOUSERAPID ? 1 : 0) ^ (b ? 1 : 0);
 	if (f) {
 		np2cfg.MOUSERAPID = !np2cfg.MOUSERAPID;
@@ -1509,8 +1442,6 @@ cb_nowait(GtkToggleAction *action, gpoin
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2oscfg.NOWAIT ? 1 : 0) ^ (b ? 1 : 0);
 	if (f) {
 		np2oscfg.NOWAIT = !np2oscfg.NOWAIT;
@@ -1524,8 +1455,6 @@ cb_realpalettes(GtkToggleAction *action,
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2cfg.RASTER ? 1 : 0) ^ (b ? 1 : 0);
 	if (f) {
 		np2cfg.RASTER = !np2cfg.RASTER;
@@ -1541,8 +1470,6 @@ cb_s98logging(GtkToggleAction *action, g
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (s98logging ? 1 : 0) ^ (b ? 1 : 0);
 	if (f) {
 		s98logging = !s98logging;
@@ -1564,8 +1491,6 @@ cb_seeksound(GtkToggleAction *action, gp
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2cfg.MOTOR ? 1 : 0) ^ (b ? 1 : 0);
 	if (f) {
 		np2cfg.MOTOR = !np2cfg.MOTOR;
@@ -1579,8 +1504,6 @@ cb_softkeyboard(GtkToggleAction *action,
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2oscfg.softkbd ? 1 : 0) ^ (b ? 1 : 0);
 	if (f) {
 		np2oscfg.softkbd = !np2oscfg.softkbd;
@@ -1599,8 +1522,6 @@ cb_toolwindow(GtkToggleAction *action, g
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2oscfg.toolwin ? 1 : 0) ^ (b ? 1 : 0);
 	if (f) {
 		np2oscfg.toolwin = !np2oscfg.toolwin;
@@ -1619,8 +1540,6 @@ cb_xctrlkey(GtkToggleAction *action, gpo
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2cfg.XSHIFT & 2) ^ (b ? 2 : 0);
 	if (f) {
 		np2cfg.XSHIFT ^= 2;
@@ -1635,8 +1554,6 @@ cb_xgrphkey(GtkToggleAction *action, gpo
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2cfg.XSHIFT & 4) ^ (b ? 4 : 0);
 	if (f) {
 		np2cfg.XSHIFT ^= 4;
@@ -1651,8 +1568,6 @@ cb_xshiftkey(GtkToggleAction *action, gp
 	gboolean b = gtk_toggle_action_get_active(action);
 	gboolean f;
 
-	UNUSED(user_data);
-
 	f = (np2cfg.XSHIFT & 1) ^ (b ? 1 : 0);
 	if (f) {
 		np2cfg.XSHIFT ^= 1;
@@ -1810,8 +1725,6 @@ cb_radio(GtkRadioAction *action, GtkRadi
 	guint menu_idx = (guint)GPOINTER_TO_INT(user_data);
 	gint i;
 
-	UNUSED(current);	/* emitted item */
-
 	if (menu_idx < n_radiomenu_entries) {
 		for (i = 0; i < radiomenu_entries[menu_idx].count; i++) {
 			if (radiomenu_entries[menu_idx].entry[i].value == value)
@@ -1839,8 +1752,6 @@ static gboolean
 menubar_timeout(gpointer p)
 {
 
-	UNUSED(p);
-
 	if (menubar_timerid) {
 		g_source_remove(menubar_timerid);
 		menubar_timerid = 0;
@@ -1861,10 +1772,6 @@ static gboolean
 enter_notify_evhandler(GtkWidget *w, GdkEventCrossing *ev, gpointer p)
 {
 
-	UNUSED(w);
-	UNUSED(ev);
-	UNUSED(p);
-
 	if (menubar_timerid) {
 		g_source_remove(menubar_timerid);
 		menubar_timerid = 0;
@@ -1881,10 +1788,6 @@ static gboolean
 leave_notify_evhandler(GtkWidget *w, GdkEventCrossing *ev, gpointer p)
 {
 
-	UNUSED(w);
-	UNUSED(ev);
-	UNUSED(p);
-
 	if (menubar_timerid) {
 		g_source_remove(menubar_timerid);
 		menubar_timerid = 0;
@@ -1897,10 +1800,50 @@ leave_notify_evhandler(GtkWidget *w, Gdk
 	return TRUE;
 }
 
+#if defined(SUPPORT_STATSAVE)
+static void
+create_menu_statsave(GtkUIManager *ui_manager, int num)
+{
+	char *name, *action;
+	guint id;
+	int i;
+
+	if (num <= 0)
+		return;
+
+	/* Save %d */
+	for (i = 0; i < num; i++) {
+		id = gtk_ui_manager_new_merge_id(ui_manager);
+		name = g_strdup_printf("Save %d", i);
+		action = g_strdup_printf("stat%02dsave", i);
+		gtk_ui_manager_add_ui(ui_manager, id, "/MainMenu/Stat",
+		    name, action, GTK_UI_MANAGER_MENUITEM, FALSE);
+		g_free(action);
+		g_free(name);
+	}
+
+	/* separator */
+	id = gtk_ui_manager_new_merge_id(ui_manager);
+	gtk_ui_manager_add_ui(ui_manager, id, "/MainMenu/Stat",
+	    "", "", GTK_UI_MANAGER_SEPARATOR, FALSE);
+
+	/* Load %d */
+	for (i = 0; i < num; i++) {
+		id = gtk_ui_manager_new_merge_id(ui_manager);
+		name = g_strdup_printf("Load %d", i);
+		action = g_strdup_printf("stat%02dload", i);
+		gtk_ui_manager_add_ui(ui_manager, id, "/MainMenu/Stat",
+		    name, action, GTK_UI_MANAGER_MENUITEM, FALSE);
+		g_free(action);
+		g_free(name);
+	}
+}
+#endif
+
 static void
 equip_fddrive(GtkUIManager *ui_manager, guint no)
 {
-	char path[32], name[32], action[32];
+	char *path, *name, *action;
 	guint id;
 
 	if (no >= 4)
@@ -1908,23 +1851,32 @@ equip_fddrive(GtkUIManager *ui_manager, 
 	no++;
 
 	id = gtk_ui_manager_new_merge_id(ui_manager);
-	g_snprintf(name, sizeof(name), "Drive%d", no);
-	g_snprintf(action, sizeof(action), "Drive%dMenu", no);
+	name = g_strdup_printf("Drive%d", no);
+	action = g_strdup_printf("Drive%dMenu", no);
 	gtk_ui_manager_add_ui(ui_manager, id,
 	    "/MainMenu/FDD", name, action, GTK_UI_MANAGER_MENU, FALSE);
+	g_free(action);
+	g_free(name);
+
+	path = g_strdup_printf("/MainMenu/FDD/Drive%d", no);
 
-	g_snprintf(path, sizeof(path), "/MainMenu/FDD/Drive%d", no);
 	id = gtk_ui_manager_new_merge_id(ui_manager);
-	g_snprintf(name, sizeof(name), "Drive%dOpen", no);
-	g_snprintf(action, sizeof(action), "disk%dopen", no);
+	name = g_strdup_printf("Drive%dOpen", no);
+	action = g_strdup_printf("disk%dopen", no);
 	gtk_ui_manager_add_ui(ui_manager, id,
 	    path, name, action, GTK_UI_MANAGER_MENUITEM, FALSE);
+	g_free(action);
+	g_free(name);
 
 	id = gtk_ui_manager_new_merge_id(ui_manager);
-	g_snprintf(name, sizeof(name), "Drive%dEject", no);
-	g_snprintf(action, sizeof(action), "disk%deject", no);
+	name = g_strdup_printf("Drive%dEject", no);
+	action = g_strdup_printf("disk%deject", no);
 	gtk_ui_manager_add_ui(ui_manager, id,
 	    path, name, action, GTK_UI_MANAGER_MENUITEM, FALSE);
+	g_free(action);
+	g_free(name);
+
+	g_free(path);
 }
 
 GtkWidget *
@@ -1960,6 +1912,19 @@ create_menu(void)
 		return NULL;
 	}
 
+#if defined(SUPPORT_STATSAVE)
+	if (np2oscfg.statsave) {
+		create_menu_statsave(menu_hdl.ui_manager, NSTATSAVE);
+	}
+#endif
+	if (np2cfg.fddequip) {
+		for (i = 0; i < 4; i++) {
+			if (np2cfg.fddequip & (1 << i)) {
+				equip_fddrive(menu_hdl.ui_manager, i);
+			}
+		}
+	}
+
 	xmenu_toggle_item(NULL, "dispvsync", np2cfg.DISPSYNC);
 	xmenu_toggle_item(NULL, "joyrapid", np2cfg.BTN_RAPID);
 	xmenu_toggle_item(NULL, "joyreverse", np2cfg.BTN_MODE);
@@ -1989,21 +1954,13 @@ create_menu(void)
 	xmenu_select_screensize(SCREEN_DEFMUL);
 	xmenu_select_soundboard(np2cfg.SOUND_SW);
 
-	if (np2cfg.fddequip) {
-		for (i = 0; i < 4; i++) {
-			if (np2cfg.fddequip & (1 << i)) {
-				equip_fddrive(menu_hdl.ui_manager, i);
-			}
-		}
-	}
-
 	menubar = gtk_ui_manager_get_widget(menu_hdl.ui_manager, "/MainMenu");
 
 	gtk_widget_add_events(menubar, EVENT_MASK);
 	g_signal_connect(GTK_OBJECT(menubar), "enter_notify_event",
-	            GTK_SIGNAL_FUNC(enter_notify_evhandler), NULL);
+	            G_CALLBACK(enter_notify_evhandler), NULL);
 	g_signal_connect(GTK_OBJECT(menubar), "leave_notify_event",
-	            GTK_SIGNAL_FUNC(leave_notify_evhandler), NULL);
+	            G_CALLBACK(leave_notify_evhandler), NULL);
 
 	return menubar;
 }
@@ -2026,7 +1983,7 @@ void
 xmenu_toggle_menu(void)
 {
 
-	if (GTK_WIDGET_VISIBLE(menubar))
+	if (gtk_widget_get_visible(menubar))
 		xmenu_hide();
 	else
 		xmenu_show();