GTK: Allow shutting off button and menu icons.

This commit is contained in:
Brandon Wright 2019-04-16 11:47:35 -05:00
parent 83916eb56d
commit 9c733497fe
5 changed files with 38 additions and 3 deletions

View File

@ -115,6 +115,7 @@ int Snes9xConfig::load_defaults ()
preferences_height = -1; preferences_height = -1;
shader_parameters_width = -1; shader_parameters_width = -1;
shader_parameters_height = -1; shader_parameters_height = -1;
enable_icons = true;
current_display_tab = 0; current_display_tab = 0;
sram_directory.clear (); sram_directory.clear ();
export_directory.clear (); export_directory.clear ();
@ -310,6 +311,7 @@ int Snes9xConfig::save_config_file ()
cf.SetInt (z"ShaderParametersHeight", shader_parameters_height); cf.SetInt (z"ShaderParametersHeight", shader_parameters_height);
cf.SetInt (z"CurrentDisplayTab", current_display_tab); cf.SetInt (z"CurrentDisplayTab", current_display_tab);
outbool (cf, z"UIVisible", ui_visible); outbool (cf, z"UIVisible", ui_visible);
outbool (cf, z"EnableIcons", enable_icons);
if (default_esc_behavior != ESC_TOGGLE_MENUBAR) if (default_esc_behavior != ESC_TOGGLE_MENUBAR)
outbool (cf, z"Fullscreen", 0); outbool (cf, z"Fullscreen", 0);
else else
@ -542,6 +544,7 @@ int Snes9xConfig::load_config_file ()
inint (z"CurrentDisplayTab", current_display_tab); inint (z"CurrentDisplayTab", current_display_tab);
inbool (z"UIVisible", ui_visible); inbool (z"UIVisible", ui_visible);
inbool (z"Fullscreen", fullscreen); inbool (z"Fullscreen", fullscreen);
inbool (z"EnableIcons", enable_icons);
#undef z #undef z
#define z "Netplay::" #define z "Netplay::"

View File

@ -140,6 +140,7 @@ class Snes9xConfig
int num_threads; int num_threads;
bool screensaver_needs_reset; bool screensaver_needs_reset;
bool modal_dialogs; bool modal_dialogs;
bool enable_icons;
bool pointer_is_visible; bool pointer_is_visible;
gint64 pointer_timestamp; gint64 pointer_timestamp;

View File

@ -669,6 +669,11 @@ Snes9xPreferences::move_settings_to_dialog ()
set_spin ("superfx_multiplier", Settings.SuperFXClockMultiplier); set_spin ("superfx_multiplier", Settings.SuperFXClockMultiplier);
set_combo ("splash_background", config->splash_image); set_combo ("splash_background", config->splash_image);
#if GTK_MAJOR_VERSION < 3
gtk_widget_hide (get_widget ("force_enable_icons"));
#endif
set_check ("force_enable_icons", config->enable_icons);
int num_sound_drivers = 0; int num_sound_drivers = 0;
#ifdef USE_PORTAUDIO #ifdef USE_PORTAUDIO
num_sound_drivers++; num_sound_drivers++;
@ -808,6 +813,15 @@ Snes9xPreferences::get_settings_from_dialog ()
if (config->force_inverted_byte_order != get_check ("force_inverted_byte_order")) if (config->force_inverted_byte_order != get_check ("force_inverted_byte_order"))
gfx_needs_restart = true; gfx_needs_restart = true;
config->enable_icons = get_check ("force_enable_icons");
#if GTK_MAJOR_VERSION >= 3
auto settings = gtk_settings_get_default();
g_object_set(settings,
"gtk-menu-images", gui_config->enable_icons,
"gtk_button_images", gui_config->enable_icons,
NULL);
#endif
config->full_screen_on_open = get_check ("full_screen_on_open"); config->full_screen_on_open = get_check ("full_screen_on_open");
Settings.DisplayFrameRate = get_check ("show_frame_rate"); Settings.DisplayFrameRate = get_check ("show_frame_rate");
Settings.DisplayPressedKeys = get_check ("show_pressed_keys"); Settings.DisplayPressedKeys = get_check ("show_pressed_keys");

View File

@ -63,7 +63,10 @@ int main (int argc, char *argv[])
#if GTK_MAJOR_VERSION >= 3 #if GTK_MAJOR_VERSION >= 3
auto settings = gtk_settings_get_default(); auto settings = gtk_settings_get_default();
g_object_set(settings, "gtk-menu-images", true, "gtk_button_images", true, NULL); g_object_set(settings,
"gtk-menu-images", gui_config->enable_icons,
"gtk_button_images", gui_config->enable_icons,
NULL);
#endif #endif
S9xReportControllers (); S9xReportControllers ();

View File

@ -9073,6 +9073,20 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="force_enable_icons">
<property name="label" translatable="yes">Force-enable button and menu icons</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child> <child>
<object class="GtkHBox" id="hbox15"> <object class="GtkHBox" id="hbox15">
<property name="visible">True</property> <property name="visible">True</property>
@ -9112,7 +9126,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -9154,7 +9168,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>