mirror of https://github.com/snes9xgit/snes9x.git
Gtk: Thread preferences creation.
This commit is contained in:
parent
a3c0c4621d
commit
95c7fdad1f
|
@ -20,14 +20,23 @@
|
|||
|
||||
#define SAME_AS_GAME _("Same location as current game")
|
||||
|
||||
void snes9x_preferences_open(Snes9xWindow *window, Snes9xConfig *config)
|
||||
{
|
||||
static Snes9xPreferences *preferences = nullptr;
|
||||
static Snes9xPreferences *preferences = nullptr;
|
||||
|
||||
void snes9x_preferences_create(Snes9xConfig *config)
|
||||
{
|
||||
Glib::Thread::create([config] {
|
||||
Snes9xPreferences *new_preferences;
|
||||
new_preferences = new Snes9xPreferences(config);
|
||||
preferences = new_preferences;
|
||||
}, true);
|
||||
}
|
||||
|
||||
void snes9x_preferences_open(Snes9xWindow *window)
|
||||
{
|
||||
if (!preferences)
|
||||
{
|
||||
preferences = new Snes9xPreferences(config);
|
||||
}
|
||||
return;
|
||||
|
||||
auto &config = preferences->config;
|
||||
|
||||
window->pause_from_focus_change ();
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#include "gtk_s9x.h"
|
||||
#include "gtk_builder_window.h"
|
||||
|
||||
void snes9x_preferences_open(Snes9xWindow *window, Snes9xConfig *config);
|
||||
void snes9x_preferences_create(Snes9xConfig *config);
|
||||
void snes9x_preferences_open(Snes9xWindow *window);
|
||||
|
||||
class Snes9xPreferences : public GtkBuilderWindow
|
||||
{
|
||||
|
|
|
@ -78,6 +78,8 @@ Snes9xWindow::Snes9xWindow(Snes9xConfig *config)
|
|||
cairo_owned = false;
|
||||
mouse_grabbed = false;
|
||||
|
||||
snes9x_preferences_create(config);
|
||||
|
||||
if (Gtk::IconTheme::get_default()->has_icon("snes9x"))
|
||||
{
|
||||
window->set_default_icon_name("snes9x");
|
||||
|
@ -86,7 +88,6 @@ Snes9xWindow::Snes9xWindow(Snes9xConfig *config)
|
|||
{
|
||||
auto loader = Gdk::PixbufLoader::create();
|
||||
loader->write((const guint8 *)app_icon, sizeof(app_icon));
|
||||
loader->close();
|
||||
window->set_default_icon(loader->get_pixbuf());
|
||||
}
|
||||
|
||||
|
@ -244,7 +245,7 @@ void Snes9xWindow::connect_signals()
|
|||
});
|
||||
|
||||
get_object<Gtk::MenuItem>("preferences_item")->signal_activate().connect([&] {
|
||||
snes9x_preferences_open(this, config);
|
||||
snes9x_preferences_open(this);
|
||||
});
|
||||
|
||||
get_object<Gtk::MenuItem>("open_netplay_item")->signal_activate().connect([&] {
|
||||
|
|
Loading…
Reference in New Issue