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:
parent
8bcf89ba00
commit
c5c2dce069
2 changed files with 7 additions and 6 deletions
1
news.d/47.2/fixed-call-style-manager-too-early
Normal file
1
news.d/47.2/fixed-call-style-manager-too-early
Normal file
|
|
@ -0,0 +1 @@
|
|||
Don't call style manager in application constructor since this is too early. Do it in startup instead. Without this fix, GTK 4.17.0 will terminate the app on startup.
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue