[GTK3] Move loose state variables into GuiData struct
This commit is contained in:
parent
a08e1d1c83
commit
89080ef47e
@ -1,11 +0,0 @@
|
|||||||
#ifndef macros_h
|
|
||||||
#define macros_h
|
|
||||||
|
|
||||||
#define str(x) #x
|
|
||||||
#define xstr(x) str(x)
|
|
||||||
#define get_object(id) gtk_builder_get_object(builder, id)
|
|
||||||
#define builder_get(type, id) type(gtk_builder_get_object(builder, id))
|
|
||||||
#define action_set_enabled(map, name, value) g_simple_action_set_enabled(G_SIMPLE_ACTION(g_action_map_lookup_action(G_ACTION_MAP(map), name)), value);
|
|
||||||
#define itoa(val) g_strdup_printf("%i", val)
|
|
||||||
|
|
||||||
#endif /* macros_h */
|
|
763
gtk3/main.c
763
gtk3/main.c
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,8 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
|
#define get_object(id) gtk_builder_get_object(builder, id)
|
||||||
|
#define builder_get(type, id) type(get_object(id))
|
||||||
|
|
||||||
static void print_config_error(GError *error) {
|
static void print_config_error(GError *error) {
|
||||||
if (error == NULL) return;
|
if (error == NULL) return;
|
||||||
|
|
||||||
@ -102,7 +105,7 @@ void on_preferences_realize(GtkWidget *w, gpointer builder_ptr) {
|
|||||||
update_boot_rom_selector(builder);
|
update_boot_rom_selector(builder);
|
||||||
|
|
||||||
// Hook up the static preferences
|
// Hook up the static preferences
|
||||||
gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "rewind_duration_selector"), itoa(config.rewind_duration));
|
gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "rewind_duration_selector"), g_strdup_printf("%i", config.rewind_duration));
|
||||||
gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "dmg_revision_selector"), config.dmg_revision_name);
|
gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "dmg_revision_selector"), config.dmg_revision_name);
|
||||||
gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "sgb_revision_selector"), config.sgb_revision_name);
|
gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "sgb_revision_selector"), config.sgb_revision_name);
|
||||||
gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "cgb_revision_selector"), config.cgb_revision_name);
|
gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "cgb_revision_selector"), config.cgb_revision_name);
|
||||||
@ -114,7 +117,7 @@ void on_preferences_realize(GtkWidget *w, gpointer builder_ptr) {
|
|||||||
gtk_toggle_button_set_active(builder_get(GTK_TOGGLE_BUTTON, "integer_scaling_toggle"), config.use_integer_scaling);
|
gtk_toggle_button_set_active(builder_get(GTK_TOGGLE_BUTTON, "integer_scaling_toggle"), config.use_integer_scaling);
|
||||||
gtk_toggle_button_set_active(builder_get(GTK_TOGGLE_BUTTON, "aspect_ratio_toggle"), config.keep_aspect_ratio);
|
gtk_toggle_button_set_active(builder_get(GTK_TOGGLE_BUTTON, "aspect_ratio_toggle"), config.keep_aspect_ratio);
|
||||||
gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "highpass_filter_selector"), config.high_pass_filter_id);
|
gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "highpass_filter_selector"), config.high_pass_filter_id);
|
||||||
gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "sample_rate_selector"), itoa(config.sample_rate));
|
gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "sample_rate_selector"), g_strdup_printf("%i", config.sample_rate));
|
||||||
|
|
||||||
#if ! NDEBUG
|
#if ! NDEBUG
|
||||||
gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "menubar_override_selector"), config.menubar_override);
|
gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "menubar_override_selector"), config.menubar_override);
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <Core/gb.h>
|
#include <Core/gb.h>
|
||||||
#include "macros.h"
|
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
|
|
||||||
#define SETTINGS_FILE "sameboy-gtk3-settings.ini"
|
#define SETTINGS_FILE "sameboy-gtk3-settings.ini"
|
||||||
|
Loading…
Reference in New Issue
Block a user