application: Call style_manager from startup

It was called from app constructed before. That's too early since since
GTK/Adw is not initialized yet. This is treated as an error in GTK
4.17.0 and terminates the app on startup.

Closes #423
This commit is contained in:
Sophie Herold 2024-11-11 17:05:37 +01:00
parent 8bcf89ba00
commit c5c2dce069
2 changed files with 7 additions and 6 deletions

View file

@ -56,27 +56,27 @@ mod imp {
type ParentType = adw::Application;
}
// Overrides GObject vfuncs
impl ObjectImpl for LpApplication {
fn constructed(&self) {
let obj = self.obj();
self.parent_constructed();
// Force dark theme
obj.style_manager()
.set_color_scheme(adw::ColorScheme::PreferDark);
// Set up the actions
obj.setup_actions();
}
}
// Overrides GApplication vfuncs
impl ApplicationImpl for LpApplication {
fn startup(&self) {
log::trace!("Startup");
self.parent_startup();
// Force dark theme
self.obj()
.style_manager()
.set_color_scheme(adw::ColorScheme::PreferDark);
LpShyBin::ensure_type();
gtk::Window::set_default_icon_name(config::APP_ID);
}