Fix some style issues

This commit is contained in:
Zander Brown 2018-06-07 19:12:56 +01:00 committed by Jordan Petridis
parent f56fac6877
commit bce80cca0b
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
2 changed files with 11 additions and 4 deletions

View File

@ -216,6 +216,15 @@ impl App {
action!(win, "quit", clone!(instance => move |_, _| instance.quit())); action!(win, "quit", clone!(instance => move |_, _| instance.quit()));
self.instance.set_accels_for_action("win.quit", &["<primary>q"]); self.instance.set_accels_for_action("win.quit", &["<primary>q"]);
action!(
win,
"preferences",
clone!(win, settings => move |_, _| {
let dialog = Prefs::new(&settings);
dialog.show(&win);
})
);
// Create the menu action // Create the menu action
action!(win, "menu",clone!(header => move |_, _| header.open_menu())); action!(win, "menu",clone!(header => move |_, _| header.open_menu()));
// Bind the hamburger menu button to `F10` // Bind the hamburger menu button to `F10`

View File

@ -87,8 +87,7 @@ impl Prefs {
let cleanup_p = settings.get_string("cleanup-age-period").unwrap(); let cleanup_p = settings.get_string("cleanup-age-period").unwrap();
let mut cleanup_pos = 0; let mut cleanup_pos = 0;
let store = gtk::ListStore::new(&[gtk::Type::String]); let store = gtk::ListStore::new(&[gtk::Type::String]);
let mut i = 0; for (i, item) in ["Seconds", "Minutes", "Hours", "Days", "Weeks"].iter().enumerate() {
for item in ["Seconds", "Minutes", "Hours", "Days", "Weeks"].iter() {
let row: &[&ToValue] = &[item]; let row: &[&ToValue] = &[item];
if item.to_lowercase() == refresh_p { if item.to_lowercase() == refresh_p {
refresh_pos = i; refresh_pos = i;
@ -97,9 +96,8 @@ impl Prefs {
cleanup_pos = i; cleanup_pos = i;
} }
store.insert_with_values(None, &[0], &row); store.insert_with_values(None, &[0], &row);
i += 1;
} }
for combo in [self.refresh_type.clone(), self.cleanup_type.clone()].iter() { for combo in &[self.refresh_type.clone(), self.cleanup_type.clone()] {
combo.set_model(Some(&store)); combo.set_model(Some(&store));
let renderer = gtk::CellRendererText::new(); let renderer = gtk::CellRendererText::new();
combo.pack_start(&renderer, true); combo.pack_start(&renderer, true);