diff --git a/hammond-gtk/src/app.rs b/hammond-gtk/src/app.rs index 124bd30..baa3251 100644 --- a/hammond-gtk/src/app.rs +++ b/hammond-gtk/src/app.rs @@ -1,13 +1,13 @@ #![allow(new_without_default)] +#![allow(unused)] use gio::{ - self, ActionMapExt, ApplicationExt, ApplicationExtManual, ApplicationFlags, SettingsExt, - SimpleAction, SimpleActionExt, + self, ActionMapExt, ApplicationExt, ApplicationExtManual, ApplicationFlags, + SettingsBindFlags, SettingsExt, SimpleAction, SimpleActionExt, }; use glib; use gtk; use gtk::prelude::*; -use gtk::SettingsExt as GtkSettingsExt; use crossbeam_channel::{unbounded, Receiver, Sender}; use hammond_data::Show; @@ -150,9 +150,12 @@ impl App { fn setup_dark_theme(&self) { let gtk_settings = gtk::Settings::get_default().unwrap(); - let enabled = self.settings.get_boolean("dark-theme"); - - gtk_settings.set_property_gtk_application_prefer_dark_theme(enabled); + self.settings.bind( + "dark-theme", + >k_settings, + "gtk-application-prefer-dark-theme", + SettingsBindFlags::DEFAULT, + ); } fn setup_refresh_on_startup(&self) { @@ -187,6 +190,7 @@ impl App { let win = &self.window; let instance = &self.instance; let header = &self.headerbar; + let settings = &self.settings; // Create the `refresh` action. // diff --git a/hammond-gtk/src/prefs.rs b/hammond-gtk/src/prefs.rs index 9924c0e..48f3e1d 100644 --- a/hammond-gtk/src/prefs.rs +++ b/hammond-gtk/src/prefs.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + use gio; use gio::{Settings, SettingsExt}; use gtk; @@ -87,7 +89,7 @@ impl Prefs { let store = gtk::ListStore::new(&[gtk::Type::String]); let mut i = 0; for item in ["Seconds", "Minutes", "Hours", "Days", "Weeks"].iter() { - let row = [&(item) as &ToValue]; + let row: &[&ToValue] = &[item]; if item.to_lowercase() == refresh_p { refresh_pos = i; } @@ -95,7 +97,7 @@ impl Prefs { cleanup_pos = i; } store.insert_with_values(None, &[0], &row); - i += 1 ; + i += 1; } for combo in [self.refresh_type.clone(), self.cleanup_type.clone()].iter() { combo.set_model(Some(&store)); @@ -119,7 +121,7 @@ impl Prefs { })); } - pub fn show(&self, parent: >k::Window) { + pub fn show(&self, parent: >k::ApplicationWindow) { self.dialog.set_transient_for(Some(parent)); self.dialog.set_modal(true); self.dialog.show_all();