diff --git a/hammond-gtk/src/stacks/content.rs b/hammond-gtk/src/stacks/content.rs index 6ac8189..c4d6265 100644 --- a/hammond-gtk/src/stacks/content.rs +++ b/hammond-gtk/src/stacks/content.rs @@ -22,7 +22,7 @@ impl Content { pub fn new(sender: &Sender) -> Result, Error> { let stack = gtk::Stack::new(); let home = Rc::new(RefCell::new(HomeStack::new(sender.clone())?)); - let shows = Rc::new(RefCell::new(ShowStack::new(sender.clone())?)); + let shows = Rc::new(RefCell::new(ShowStack::new(sender.clone()))); stack.add_titled(&home.borrow().get_stack(), "home", "New"); stack.add_titled(&shows.borrow().get_stack(), "shows", "Shows"); diff --git a/hammond-gtk/src/stacks/populated.rs b/hammond-gtk/src/stacks/populated.rs index d192b4f..0ae2670 100644 --- a/hammond-gtk/src/stacks/populated.rs +++ b/hammond-gtk/src/stacks/populated.rs @@ -31,10 +31,10 @@ pub struct PopulatedStack { } impl PopulatedStack { - pub fn new(sender: Sender) -> Result { + pub fn new(sender: Sender) -> PopulatedStack { let stack = gtk::Stack::new(); let state = PopulatedState::View; - let populated = ShowsView::new(sender.clone())?; + let populated = ShowsView::new(sender.clone()); let show = Rc::new(ShowWidget::default()); let container = gtk::Box::new(gtk::Orientation::Horizontal, 0); @@ -43,16 +43,14 @@ impl PopulatedStack { container.add(&stack); container.show_all(); - let show = PopulatedStack { + PopulatedStack { container, stack, populated, show, state, sender, - }; - - Ok(show) + } } pub fn update(&mut self) { @@ -80,7 +78,7 @@ impl PopulatedStack { .map_err(|err| error!("Failed to set episodes_view allignment: {}", err)) .ok(); - let pop = ShowsView::new(self.sender.clone())?; + let pop = ShowsView::new(self.sender.clone()); self.populated = pop; self.stack.remove(old); self.stack.add_named(&self.populated.container, "shows"); diff --git a/hammond-gtk/src/stacks/show.rs b/hammond-gtk/src/stacks/show.rs index 7c52c6c..ff89330 100644 --- a/hammond-gtk/src/stacks/show.rs +++ b/hammond-gtk/src/stacks/show.rs @@ -29,8 +29,8 @@ pub struct ShowStack { } impl ShowStack { - pub fn new(sender: Sender) -> Result { - let populated = Rc::new(RefCell::new(PopulatedStack::new(sender.clone())?)); + pub fn new(sender: Sender) -> Self { + let populated = Rc::new(RefCell::new(PopulatedStack::new(sender.clone()))); let empty = EmptyView::new(); let stack = gtk::Stack::new(); let state = ShowState::Empty; @@ -46,8 +46,9 @@ impl ShowStack { sender, }; - show.determine_state()?; - Ok(show) + let res = show.determine_state(); + debug_assert!(res.is_ok()); + show } pub fn get_stack(&self) -> gtk::Stack { diff --git a/hammond-gtk/src/widgets/shows_view.rs b/hammond-gtk/src/widgets/shows_view.rs index 59cfef8..35f2c51 100644 --- a/hammond-gtk/src/widgets/shows_view.rs +++ b/hammond-gtk/src/widgets/shows_view.rs @@ -43,24 +43,23 @@ impl Default for ShowsView { } impl ShowsView { - pub fn new(sender: Sender) -> Result, Error> { + pub fn new(sender: Sender) -> Rc { let pop = Rc::new(ShowsView::default()); pop.init(sender); // Populate the flowbox with the Shows. - populate_flowbox(&pop)?; - Ok(pop) + let res = populate_flowbox(&pop); + debug_assert!(res.is_ok()); + pop } pub fn init(&self, sender: Sender) { self.flowbox.connect_child_activated(move |_, child| { - on_child_activate(child, &sender) - .map_err(|err| error!("Error along flowbox child activation: {}", err)) - .ok(); + let res = on_child_activate(child, &sender); + debug_assert!(res.is_ok()); }); } /// Set scrolled window vertical adjustment. - #[allow(unused)] fn set_vadjustment(&self) -> Result<(), Error> { let guard = SHOWS_VIEW_VALIGNMENT .lock()