[GTK3] Fix a few problems with the settings

This commit is contained in:
Maximilian Mader 2019-09-29 02:07:33 +02:00
parent 6c5dfece40
commit a83d6eca5b
Signed by: Max
GPG Key ID: F71D56A3151C4FB3
3 changed files with 11 additions and 11 deletions

View File

@ -529,7 +529,7 @@ static void startup(GApplication *app, gpointer user_data_gptr) {
// setup main window // setup main window
main_window = GTK_APPLICATION_WINDOW(gtk_application_window_new(GTK_APPLICATION(app))); main_window = GTK_APPLICATION_WINDOW(gtk_application_window_new(GTK_APPLICATION(app)));
gtk_application_window_set_show_menubar(main_window, true); gtk_application_window_set_show_menubar(main_window, false);
// create our renderer area // create our renderer area
gl_area = GTK_GL_AREA(gtk_gl_area_new()); gl_area = GTK_GL_AREA(gtk_gl_area_new());
@ -575,7 +575,7 @@ static void startup(GApplication *app, gpointer user_data_gptr) {
} }
else { else {
// Attach a custom title bar // Attach a custom title bar
GtkWidget *titlebar = GTK_WIDGET(gtk_builder_get_object(builder, "main_header_bar")); GtkWidget *titlebar = gtkget(GTK_WIDGET, "main_header_bar");
gtk_window_set_titlebar(GTK_WINDOW(main_window), titlebar); gtk_window_set_titlebar(GTK_WINDOW(main_window), titlebar);
// Disable menubar // Disable menubar
@ -809,7 +809,7 @@ static void run(GApplication *app, UserData *user_data) {
const guchar *boot_rom_data; const guchar *boot_rom_data;
gsize boot_rom_size; gsize boot_rom_size;
if (user_data->boot_rom_path) { if (user_data->boot_rom_path != NULL) {
g_print("Trying to load boot ROM from %s\n", user_data->boot_rom_path); g_print("Trying to load boot ROM from %s\n", user_data->boot_rom_path);
if (GB_load_boot_rom(&gb, user_data->boot_rom_path)) { if (GB_load_boot_rom(&gb, user_data->boot_rom_path)) {
g_printerr("Falling back to boot ROM from config\n"); g_printerr("Falling back to boot ROM from config\n");
@ -843,7 +843,7 @@ static void run(GApplication *app, UserData *user_data) {
break; break;
} }
if (config.boot_rom_path != NULL) { if (config.boot_rom_path != NULL && g_strcmp0(config.boot_rom_path, "other") != 0 && g_strcmp0(config.boot_rom_path, "auto") != 0) {
boot_rom_path = g_build_filename(config.boot_rom_path, boot_rom_name, NULL); boot_rom_path = g_build_filename(config.boot_rom_path, boot_rom_name, NULL);
g_print("Trying to load boot ROM from %s\n", boot_rom_path); g_print("Trying to load boot ROM from %s\n", boot_rom_path);

View File

@ -29,9 +29,7 @@ void load_config_from_key_file(config_t *config, GKeyFile *key_file) {
#define EXPAND_GROUP(name, members) \ #define EXPAND_GROUP(name, members) \
group_name = #name; \ group_name = #name; \
if (g_key_file_has_group(key_file, group_name)) { \ members
members \
}
#define EXPAND_GROUP_MEMBER(member, key_type, default_value) \ #define EXPAND_GROUP_MEMBER(member, key_type, default_value) \
config->member = g_key_file_get_##key_type(key_file, group_name, #member, &error); \ config->member = g_key_file_get_##key_type(key_file, group_name, #member, &error); \
@ -148,7 +146,6 @@ int load_settings(void) {
} }
g_error_free(error); g_error_free(error);
return -1;
} }
load_config_from_key_file(&config, key_file); load_config_from_key_file(&config, key_file);
@ -196,7 +193,10 @@ void update_boot_rom_selector(GtkBuilder *builder) {
enum menubar_override get_show_menubar(void) { enum menubar_override get_show_menubar(void) {
if (config.menubar_override == NULL) goto default_value; if (config.menubar_override == NULL) goto default_value;
if (g_strcmp0(config.menubar_override, "show") == 0) { if (g_strcmp0(config.menubar_override, "auto") == 0) {
return MENUBAR_AUTO;
}
else if (g_strcmp0(config.menubar_override, "show") == 0) {
return MENUBAR_SHOW; return MENUBAR_SHOW;
} }
else if (g_strcmp0(config.menubar_override, "hide") == 0) { else if (g_strcmp0(config.menubar_override, "hide") == 0) {

View File

@ -31,13 +31,13 @@
#define EXPAND_CONFIG \ #define EXPAND_CONFIG \
EXPAND_GROUP(Emulation, \ EXPAND_GROUP(Emulation, \
EXPAND_GROUP_MEMBER(boot_rom_path, string, "auto") /* overrides search location for boot ROMs by name */ \ EXPAND_GROUP_MEMBER(boot_rom_path, string, "auto") /* overrides search location for boot ROMs by name */ \
EXPAND_GROUP_MEMBER(rewind_duration, integer, 0) \ EXPAND_GROUP_MEMBER(rewind_duration, integer, 10) \
EXPAND_GROUP_MEMBER(dmg_revision_name, string, "DMG_CPU_C") \ EXPAND_GROUP_MEMBER(dmg_revision_name, string, "DMG_CPU_C") \
EXPAND_GROUP_MEMBER(sgb_revision_name, string, "SGB2") \ EXPAND_GROUP_MEMBER(sgb_revision_name, string, "SGB2") \
EXPAND_GROUP_MEMBER(cgb_revision_name, string, "CPU_CGB_E") \ EXPAND_GROUP_MEMBER(cgb_revision_name, string, "CPU_CGB_E") \
) \ ) \
EXPAND_GROUP(Video, \ EXPAND_GROUP(Video, \
EXPAND_GROUP_MEMBER(shader, string, "NearestNeighbour") \ EXPAND_GROUP_MEMBER(shader, string, "NearestNeighbor") \
EXPAND_GROUP_MEMBER(color_correction_id, string, "emulate_hardware") \ EXPAND_GROUP_MEMBER(color_correction_id, string, "emulate_hardware") \
EXPAND_GROUP_MEMBER(keep_aspect_ratio, boolean, true) \ EXPAND_GROUP_MEMBER(keep_aspect_ratio, boolean, true) \
EXPAND_GROUP_MEMBER(use_integer_scaling, boolean, true) \ EXPAND_GROUP_MEMBER(use_integer_scaling, boolean, true) \