Delay showing window until ::activate
Bit of a hack as we are still creating the window in ::startup but it's good compromise Pass the arguments to GApplication so we can be launched as a service
This commit is contained in:
parent
008404ffb3
commit
4072ffd8cb
@ -20,6 +20,7 @@ use widgets::appnotif::{InAppNotification, UndoState};
|
|||||||
use widgets::player;
|
use widgets::player;
|
||||||
use widgets::{about_dialog, mark_all_notif, remove_show_notif};
|
use widgets::{about_dialog, mark_all_notif, remove_show_notif};
|
||||||
|
|
||||||
|
use std::env;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
@ -78,9 +79,8 @@ impl App {
|
|||||||
|
|
||||||
let window = gtk::ApplicationWindow::new(application);
|
let window = gtk::ApplicationWindow::new(application);
|
||||||
window.set_title("Hammond");
|
window.set_title("Hammond");
|
||||||
window.connect_delete_event(clone!(application, settings => move |window, _| {
|
window.connect_delete_event(clone!(settings => move |window, _| {
|
||||||
WindowGeometry::from_window(&window).write(&settings);
|
WindowGeometry::from_window(&window).write(&settings);
|
||||||
application.quit();
|
|
||||||
Inhibit(false)
|
Inhibit(false)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -285,15 +285,21 @@ impl App {
|
|||||||
info!("CONNECT STARTUP RUN");
|
info!("CONNECT STARTUP RUN");
|
||||||
let app = Self::new(&application);
|
let app = Self::new(&application);
|
||||||
Self::init(&app);
|
Self::init(&app);
|
||||||
|
info!("Init complete");
|
||||||
|
application.connect_activate(clone!(app => move |_| {
|
||||||
|
info!("GApplication::activate");
|
||||||
app.window.show_all();
|
app.window.show_all();
|
||||||
app.window.activate();
|
app.window.activate();
|
||||||
}));
|
}));
|
||||||
|
}));
|
||||||
|
|
||||||
// Weird magic I copy-pasted that sets the Application Name in the Shell.
|
// Weird magic I copy-pasted that sets the Application Name in the Shell.
|
||||||
glib::set_application_name("Hammond");
|
glib::set_application_name("Hammond");
|
||||||
glib::set_prgname(Some("Hammond"));
|
glib::set_prgname(Some("Hammond"));
|
||||||
// We need out own org.gnome.Hammon icon
|
// We need out own org.gnome.Hammon icon
|
||||||
gtk::Window::set_default_icon_name("multimedia-player");
|
gtk::Window::set_default_icon_name("multimedia-player");
|
||||||
ApplicationExtManual::run(&application, &[]);
|
let args: Vec<String> = env::args().collect();
|
||||||
|
ApplicationExtManual::run(&application, &args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user