Added "Save Preferences" menu item

This commit is contained in:
robxnano 2022-10-08 16:38:01 +01:00
parent aaf67fd59a
commit c727bc0df7
6 changed files with 22 additions and 2 deletions

View File

@ -396,6 +396,13 @@ static void window_destroyed(void)
gtk_main_quit();
}
// "Save" button clicked
static void cb_save(...)
{
read_settings();
SavePrefs();
}
// "Start" button clicked
static void cb_start(...)
{
@ -462,6 +469,7 @@ static void mn_zap_pram(...)
static GtkItemFactoryEntry menu_items[] = {
{(gchar *)GetString(STR_PREFS_MENU_FILE_GTK), NULL, NULL, 0, "<Branch>"},
{(gchar *)GetString(STR_PREFS_ITEM_START_GTK), "<control>S", G_CALLBACK(cb_start), 0, NULL},
{(gchar *)GetString(STR_PREFS_ITEM_SAVE_GTK), NULL, G_CALLBACK(cb_save), 0, NULL},
{(gchar *)GetString(STR_PREFS_ITEM_ZAP_PRAM_GTK), NULL, G_CALLBACK(mn_zap_pram), 0, NULL},
{(gchar *)GetString(STR_PREFS_ITEM_SEPL_GTK), NULL, NULL, 0, "<Separator>"},
{(gchar *)GetString(STR_PREFS_ITEM_QUIT_GTK), "<control>Q", G_CALLBACK(cb_quit), 0, NULL},
@ -1059,7 +1067,7 @@ static void create_graphics_pane(GtkWidget *top)
}
if (item >= 0)
gtk_combo_box_set_active(GTK_COMBO_BOX(w_frameskip), item);
g_signal_connect(combo, "changed", G_CALLBACK(mn_display), NULL);
g_signal_connect(w_frameskip, "changed", G_CALLBACK(mn_frameskip), NULL);
gtk_table_attach(GTK_TABLE(table), w_frameskip, 1, 2, 1, 2, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
l_display_x = gtk_label_new(GetString(STR_DISPLAY_X_CTRL));

View File

@ -62,6 +62,7 @@ user_string_def platform_strings[] = {
{STR_PREFS_MENU_FILE_GTK, "/_File"},
{STR_PREFS_ITEM_START_GTK, "/File/_Start Basilisk II"},
{STR_PREFS_ITEM_SAVE_GTK, "/File/Save _Preferences"},
{STR_PREFS_ITEM_ZAP_PRAM_GTK, "/File/_Zap PRAM File"},
{STR_PREFS_ITEM_SEPL_GTK, "/File/sepl"},
{STR_PREFS_ITEM_QUIT_GTK, "/File/_Quit Basilisk II"},

View File

@ -53,6 +53,7 @@ enum {
STR_PREFS_MENU_FILE_GTK,
STR_PREFS_ITEM_START_GTK,
STR_PREFS_ITEM_SAVE_GTK,
STR_PREFS_ITEM_ZAP_PRAM_GTK,
STR_PREFS_ITEM_SEPL_GTK,
STR_PREFS_ITEM_QUIT_GTK,

View File

@ -355,6 +355,13 @@ static void window_destroyed(void)
gtk_main_quit();
}
// "Save" button clicked
static void cb_save(...)
{
read_settings();
SavePrefs();
}
// "Start" button clicked
static void cb_start(...)
{
@ -411,6 +418,7 @@ static void mn_zap_pram(...)
static GtkItemFactoryEntry menu_items[] = {
{(gchar *)GetString(STR_PREFS_MENU_FILE_GTK), NULL, NULL, 0, "<Branch>"},
{(gchar *)GetString(STR_PREFS_ITEM_START_GTK), "<control>S", G_CALLBACK(cb_start), 0, NULL},
{(gchar *)GetString(STR_PREFS_ITEM_SAVE_GTK), NULL, G_CALLBACK(cb_save), 0, NULL},
{(gchar *)GetString(STR_PREFS_ITEM_ZAP_PRAM_GTK), NULL, G_CALLBACK(mn_zap_pram), 0, NULL},
{(gchar *)GetString(STR_PREFS_ITEM_SEPL_GTK), NULL, NULL, 0, "<Separator>"},
{(gchar *)GetString(STR_PREFS_ITEM_QUIT_GTK), "<control>Q", G_CALLBACK(cb_quit), 0, NULL},
@ -946,7 +954,7 @@ static void create_graphics_pane(GtkWidget *top)
}
if (item >= 0)
gtk_combo_box_set_active(GTK_COMBO_BOX(w_frameskip), item);
g_signal_connect(combo, "changed", G_CALLBACK(mn_frameskip), NULL);
g_signal_connect(w_frameskip, "changed", G_CALLBACK(mn_frameskip), NULL);
gtk_table_attach(GTK_TABLE(table), w_frameskip, 1, 2, 1, 2, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
l_display_x = gtk_label_new(GetString(STR_DISPLAY_X_CTRL));

View File

@ -64,6 +64,7 @@ user_string_def platform_strings[] = {
{STR_KEYCODE_VENDOR_WARN, "Cannot find vendor '%s' in keycode translation file %s."},
{STR_PREFS_MENU_FILE_GTK, "/_File"},
{STR_PREFS_ITEM_START_GTK, "/File/_Start SheepShaver"},
{STR_PREFS_ITEM_SAVE_GTK, "/File/Save _Preferences"},
{STR_PREFS_ITEM_ZAP_PRAM_GTK, "/File/_Zap PRAM File"},
{STR_PREFS_ITEM_SEPL_GTK, "/File/sepl"},
{STR_PREFS_ITEM_QUIT_GTK, "/File/_Quit SheepShaver"},

View File

@ -58,6 +58,7 @@ enum {
STR_PREFS_MENU_FILE_GTK,
STR_PREFS_ITEM_START_GTK,
STR_PREFS_ITEM_SAVE_GTK,
STR_PREFS_ITEM_ZAP_PRAM_GTK,
STR_PREFS_ITEM_SEPL_GTK,
STR_PREFS_ITEM_QUIT_GTK,