Update gtk108

This commit is contained in:
daleclack 2021-09-17 11:04:05 +08:00
parent 4891c36536
commit ca67793ac5
3 changed files with 6 additions and 11 deletions

View File

@ -66,9 +66,5 @@ MyWin * MyWin::create(){
void MyWin::btnprefs_clicked(){ void MyWin::btnprefs_clicked(){
auto prefs=MyPrefs::create(*this); auto prefs=MyPrefs::create(*this);
prefs->present(); prefs->present();
prefs->signal_hide().connect(sigc::bind(sigc::mem_fun(*this,&MyWin::on_hide_window),prefs)); prefs->signal_hide().connect(sigc::bind(sigc::ptr_fun(on_hide_window),prefs));
}
void MyWin::on_hide_window(Gtk::Window* window){
delete window;
} }

View File

@ -17,5 +17,8 @@ class MyWin : public Gtk::Window{
//Signal Handlers //Signal Handlers
void btnprefs_clicked(); void btnprefs_clicked();
void on_hide_window(Gtk::Window* window);
}; };
static inline void on_hide_window(Gtk::Window* window){
delete window;
}

View File

@ -1,9 +1,5 @@
#include "MyWin.hh" #include "MyWin.hh"
void on_hide(Gtk::Window* window){
delete window;
}
int main(int argc,char **argv){ int main(int argc,char **argv){
//Initalize env //Initalize env
Glib::setenv("GSETTINGS_SCHEMA_DIR",".",false); Glib::setenv("GSETTINGS_SCHEMA_DIR",".",false);
@ -11,7 +7,7 @@ int main(int argc,char **argv){
//Create a application and run //Create a application and run
auto app=Gtk::Application::create(argc,argv,"org.gtk.daleclack"); auto app=Gtk::Application::create(argc,argv,"org.gtk.daleclack");
auto window=MyWin::create(); auto window=MyWin::create();
window->signal_hide().connect(sigc::bind(sigc::ptr_fun(on_hide),window)); window->signal_hide().connect(sigc::bind(sigc::ptr_fun(on_hide_window),window));
return app->run(*window); return app->run(*window);
} }