diff --git a/hammond-gtk/src/app.rs b/hammond-gtk/src/app.rs index 6267a2c..ac661c0 100644 --- a/hammond-gtk/src/app.rs +++ b/hammond-gtk/src/app.rs @@ -4,6 +4,7 @@ use gio::{ApplicationExt, ApplicationExtManual, ApplicationFlags, Settings, Sett use glib; use gtk; use gtk::prelude::*; +use gtk::SettingsExt as GtkSettingsExt; use hammond_data::{Podcast, Source}; @@ -99,10 +100,18 @@ impl App { } fn setup_timed_callbacks(&self) { + self.setup_dark_theme(); self.setup_refresh_on_startup(); self.setup_auto_refresh(); } + fn setup_dark_theme(&self) { + let settings = gtk::Settings::get_default().unwrap(); + let enabled = self.settings.get_boolean("dark-theme"); + + settings.set_property_gtk_application_prefer_dark_theme(enabled); + } + fn setup_refresh_on_startup(&self) { // Update the feeds right after the Application is initialized. if self.settings.get_boolean("refresh-on-startup") { diff --git a/hammond-gtk/src/main.rs b/hammond-gtk/src/main.rs index cd21890..991358e 100644 --- a/hammond-gtk/src/main.rs +++ b/hammond-gtk/src/main.rs @@ -89,11 +89,5 @@ fn main() { 600, ); - // This set's the app to dark mode. - // It wiil be in the user's preference later. - // Uncomment it to run with the dark theme variant. - // let settings = gtk::Settings::get_default().unwrap(); - // settings.set_property_gtk_application_prefer_dark_theme(true); - App::new().run(); }