mirror of https://github.com/snes9xgit/snes9x.git
GTK+: Various cleanups.
This commit is contained in:
parent
c21539d269
commit
536c6708c3
|
@ -5,5 +5,4 @@ Type=Application
|
|||
Categories=Game;Emulator;
|
||||
MimeType=application/vnd.nintendo.snes.rom;application/x-snes-rom;
|
||||
Exec=snes9x-gtk %F
|
||||
TryExec=snes9x-gtk
|
||||
Icon=snes9x
|
||||
|
|
|
@ -15,19 +15,19 @@
|
|||
#include "gtk_display.h"
|
||||
#include "conffile.h"
|
||||
|
||||
static int directory_exists (const char *directory)
|
||||
static bool directory_exists (std::string str)
|
||||
{
|
||||
DIR *dir;
|
||||
|
||||
dir = opendir (directory);
|
||||
dir = opendir (str.c_str ());
|
||||
|
||||
if (dir)
|
||||
{
|
||||
closedir (dir);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string get_config_dir ()
|
||||
|
@ -53,7 +53,7 @@ std::string get_config_dir ()
|
|||
else
|
||||
config = std::string (env_xdg_config_home) + "/snes9x";
|
||||
|
||||
if (directory_exists (legacy.c_str ()) && !directory_exists(config.c_str ()))
|
||||
if (directory_exists (legacy) && !directory_exists(config))
|
||||
return legacy;
|
||||
|
||||
return config;
|
||||
|
@ -721,11 +721,3 @@ void Snes9xConfig::rebind_keys ()
|
|||
cmd = S9xGetPortCommandT ("{Mouse1 R,Superscope Cursor,Justifier1 Start}");
|
||||
S9xMapButton (BINDING_MOUSE_BUTTON2, cmd, FALSE);
|
||||
}
|
||||
|
||||
void Snes9xConfig::reconfigure ()
|
||||
{
|
||||
rebind_keys ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ class Snes9xConfig
|
|||
int load_config_file ();
|
||||
int save_config_file ();
|
||||
int load_defaults ();
|
||||
void reconfigure ();
|
||||
void rebind_keys ();
|
||||
void flush_joysticks ();
|
||||
void set_joystick_mode (int mode);
|
||||
|
|
|
@ -37,7 +37,7 @@ snes9x_preferences_open (GtkWidget *widget,
|
|||
|
||||
config->set_joystick_mode (JOY_MODE_INDIVIDUAL);
|
||||
|
||||
config->reconfigure ();
|
||||
config->rebind_keys ();
|
||||
window->update_accels ();
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -25,7 +25,6 @@ static gboolean S9xScreenSaverCheckFunc (gpointer data);
|
|||
Snes9xWindow *top_level;
|
||||
Snes9xConfig *gui_config;
|
||||
StateManager state_manager;
|
||||
guint idle_func_id;
|
||||
gint64 frame_clock = -1;
|
||||
gint64 pointer_timestamp = -1;
|
||||
|
||||
|
@ -40,6 +39,9 @@ int main (int argc, char *argv[])
|
|||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
g_set_prgname ("snes9x");
|
||||
g_set_application_name ("Snes9x");
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, SNES9XLOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
@ -63,8 +65,6 @@ int main (int argc, char *argv[])
|
|||
if (!Memory.Init () || !S9xInitAPU ())
|
||||
exit (3);
|
||||
|
||||
g_set_application_name ("Snes9x");
|
||||
|
||||
top_level = new Snes9xWindow (gui_config);
|
||||
|
||||
/* If we're going to fullscreen, do it before showing window to avoid flicker. */
|
||||
|
@ -105,7 +105,7 @@ int main (int argc, char *argv[])
|
|||
top_level->set_menu_item_selected (device_type.c_str ());
|
||||
}
|
||||
|
||||
gui_config->reconfigure ();
|
||||
gui_config->rebind_keys ();
|
||||
top_level->update_accels ();
|
||||
|
||||
Settings.Paused = TRUE;
|
||||
|
@ -276,10 +276,10 @@ static gboolean S9xPauseFunc (gpointer data)
|
|||
}
|
||||
|
||||
/* Resume high-performance callback */
|
||||
idle_func_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
|
||||
S9xIdleFunc,
|
||||
NULL,
|
||||
NULL);
|
||||
g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
|
||||
S9xIdleFunc,
|
||||
NULL,
|
||||
NULL);
|
||||
top_level->update_statusbar ();
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -1420,10 +1420,8 @@ Snes9xWindow::configure_widgets ()
|
|||
{
|
||||
gtk_widget_show (get_widget ("menubar"));
|
||||
|
||||
if (config->statusbar_visible)
|
||||
gtk_widget_show (get_widget ("statusbar"));
|
||||
else
|
||||
gtk_widget_hide (get_widget ("statusbar"));
|
||||
gtk_widget_set_visible (get_widget ("statusbar"),
|
||||
config->statusbar_visible);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1442,10 +1440,8 @@ Snes9xWindow::configure_widgets ()
|
|||
if (config->ui_visible)
|
||||
{
|
||||
gtk_widget_show (get_widget ("menubar"));
|
||||
if (config->statusbar_visible)
|
||||
gtk_widget_show (get_widget ("statusbar"));
|
||||
else
|
||||
gtk_widget_hide (get_widget ("statusbar"));
|
||||
gtk_widget_set_visible (get_widget ("statusbar"),
|
||||
config->statusbar_visible);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue