From c727bc0df74430e0e42c0e7046fce50b185fb9c0 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 8 Oct 2022 16:38:01 +0100 Subject: [PATCH] Added "Save Preferences" menu item --- BasiliskII/src/Unix/prefs_editor_gtk.cpp | 10 +++++++++- BasiliskII/src/Unix/user_strings_unix.cpp | 1 + BasiliskII/src/Unix/user_strings_unix.h | 1 + SheepShaver/src/Unix/prefs_editor_gtk.cpp | 10 +++++++++- SheepShaver/src/Unix/user_strings_unix.cpp | 1 + SheepShaver/src/Unix/user_strings_unix.h | 1 + 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/BasiliskII/src/Unix/prefs_editor_gtk.cpp b/BasiliskII/src/Unix/prefs_editor_gtk.cpp index 8dc1f4e2..5d9cd700 100644 --- a/BasiliskII/src/Unix/prefs_editor_gtk.cpp +++ b/BasiliskII/src/Unix/prefs_editor_gtk.cpp @@ -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, ""}, {(gchar *)GetString(STR_PREFS_ITEM_START_GTK), "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, ""}, {(gchar *)GetString(STR_PREFS_ITEM_QUIT_GTK), "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)); diff --git a/BasiliskII/src/Unix/user_strings_unix.cpp b/BasiliskII/src/Unix/user_strings_unix.cpp index 7cccb7af..ae3ab128 100644 --- a/BasiliskII/src/Unix/user_strings_unix.cpp +++ b/BasiliskII/src/Unix/user_strings_unix.cpp @@ -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"}, diff --git a/BasiliskII/src/Unix/user_strings_unix.h b/BasiliskII/src/Unix/user_strings_unix.h index 36384e25..88d28b56 100644 --- a/BasiliskII/src/Unix/user_strings_unix.h +++ b/BasiliskII/src/Unix/user_strings_unix.h @@ -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, diff --git a/SheepShaver/src/Unix/prefs_editor_gtk.cpp b/SheepShaver/src/Unix/prefs_editor_gtk.cpp index 76c57436..9d4d47cf 100644 --- a/SheepShaver/src/Unix/prefs_editor_gtk.cpp +++ b/SheepShaver/src/Unix/prefs_editor_gtk.cpp @@ -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, ""}, {(gchar *)GetString(STR_PREFS_ITEM_START_GTK), "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, ""}, {(gchar *)GetString(STR_PREFS_ITEM_QUIT_GTK), "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)); diff --git a/SheepShaver/src/Unix/user_strings_unix.cpp b/SheepShaver/src/Unix/user_strings_unix.cpp index 3d8a2aa2..1376ef47 100644 --- a/SheepShaver/src/Unix/user_strings_unix.cpp +++ b/SheepShaver/src/Unix/user_strings_unix.cpp @@ -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"}, diff --git a/SheepShaver/src/Unix/user_strings_unix.h b/SheepShaver/src/Unix/user_strings_unix.h index 026904b1..8ddf9c79 100644 --- a/SheepShaver/src/Unix/user_strings_unix.h +++ b/SheepShaver/src/Unix/user_strings_unix.h @@ -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,