Add reload button functionality

This commit is contained in:
2024-03-02 18:56:02 +01:00
parent 3f5e621b6b
commit 7b931fb033
4 changed files with 158 additions and 105 deletions

View File

@@ -1,5 +1,3 @@
use std::rc::Rc;
use gtk::prelude::*;
use relm4::factory::FactoryVecDeque;
@@ -22,6 +20,7 @@ pub enum SheetListingInput {
ListBoxRowClicked(i32),
Sort,
Shuffle,
ReloadSheets(Vec<Sheet>),
}
#[derive(Debug)]
@@ -82,6 +81,12 @@ impl SimpleComponent for SheetListingModel {
}
SheetListingInput::Sort => sort_sheets(&mut self.sheets),
SheetListingInput::Shuffle => shuffle_sheets(&mut self.sheets),
SheetListingInput::ReloadSheets(sheets) => {
self.sheets.guard().clear();
for sheet_model_type in sheets {
self.sheets.guard().push_back(sheet_model_type);
}
}
}
}
}