Complete major sheet refactoring
Now using books etc is far easier
This commit is contained in:
@@ -4,7 +4,9 @@ use relm4::factory::FactoryVecDeque;
|
||||
use relm4::RelmListBoxExt;
|
||||
use relm4::{gtk, ComponentParts, ComponentSender, SimpleComponent};
|
||||
|
||||
use super::sheet_model::{OnQueryUpdate, SheetModel, SheetModelType};
|
||||
use crate::sheet::Sheet;
|
||||
|
||||
use super::sheet_model::{OnQueryUpdate, SheetModel};
|
||||
|
||||
pub struct SheetListingModel {
|
||||
sheets: FactoryVecDeque<SheetModel>,
|
||||
@@ -18,12 +20,12 @@ pub enum SheetListingInput {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SheetModelSelected {
|
||||
pub sheet_model_type: SheetModelType,
|
||||
pub sheet: Sheet,
|
||||
}
|
||||
|
||||
#[relm4::component(pub)]
|
||||
impl SimpleComponent for SheetListingModel {
|
||||
type Init = Vec<SheetModelType>;
|
||||
type Init = Vec<Sheet>;
|
||||
type Input = SheetListingInput;
|
||||
type Output = SheetModelSelected;
|
||||
|
||||
@@ -65,10 +67,10 @@ impl SimpleComponent for SheetListingModel {
|
||||
self.sheets.broadcast(OnQueryUpdate { query });
|
||||
}
|
||||
SheetListingInput::ListBoxRowClicked(index) => {
|
||||
let x = self.sheets.get(index as usize).unwrap();
|
||||
let sheet_model = self.sheets.get(index as usize).unwrap();
|
||||
sender
|
||||
.output(SheetModelSelected {
|
||||
sheet_model_type: x.sheet_model_type.clone(),
|
||||
sheet: sheet_model.sheet.clone(),
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
|
Reference in New Issue
Block a user