App: Make sure to quit on delete event.

Since 9a76c6428a I've noticed
the applciation does not quit properly, and then it's unable
to be launched again till it's killed manually.

This patch is an attept to correct/workaroud that by calling
explcitly gio::ApplicationExt::quit().
This commit is contained in:
Jordan Petridis 2018-08-06 01:01:21 +03:00
parent c27f5ec02e
commit 4fa973007d
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6

View File

@ -87,10 +87,24 @@ impl App {
window.set_title("Podcasts");
let weak_s = settings.downgrade();
let weak_app = application.downgrade();
window.connect_delete_event(move |window, _| {
weak_s
.upgrade()
.map(|settings| WindowGeometry::from_window(&window).write(&settings));
let app = match weak_app.upgrade() {
Some(a) => a,
None => return Inhibit(false),
};
let settings = match weak_s.upgrade() {
Some(s) => s,
None => return Inhibit(false),
};
info!("Savign window position");
WindowGeometry::from_window(&window).write(&settings);
info!("Application is exiting");
app.quit();
Inhibit(false)
});