From 3cee5b978aed0475d1e13859986e42e87bdb2b3f Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Thu, 9 Aug 2018 08:40:42 +0300 Subject: [PATCH] ShowWidget: make base view field publick There is no point to re-export BaseView's methods. --- podcasts-gtk/src/stacks/populated.rs | 10 +++++----- podcasts-gtk/src/widgets/show.rs | 10 +--------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/podcasts-gtk/src/stacks/populated.rs b/podcasts-gtk/src/stacks/populated.rs index a1add7a..fa956df 100644 --- a/podcasts-gtk/src/stacks/populated.rs +++ b/podcasts-gtk/src/stacks/populated.rs @@ -39,7 +39,7 @@ impl PopulatedStack { let container = gtk::Box::new(gtk::Orientation::Horizontal, 0); stack.add_named(populated.container(), "shows"); - stack.add_named(show.container(), "widget"); + stack.add_named(show.view.container(), "widget"); container.add(&stack); container.show_all(); @@ -88,10 +88,10 @@ impl PopulatedStack { } pub(crate) fn replace_widget(&mut self, pd: Arc) -> Result<(), Error> { - let old = self.show.container().clone(); + let old = self.show.view.container().clone(); // Get the ShowWidget vertical alignment - let vadj = self.show.get_vadjustment(); + let vadj = self.show.view.get_vadjustment(); let new = match self.show.show_id() { // If the previous show was the same, restore the alignment Some(id) if id == pd.id() => ShowWidget::new(pd, self.sender.clone(), vadj), @@ -101,7 +101,7 @@ impl PopulatedStack { self.show = new; self.stack.remove(&old); - self.stack.add_named(self.show.container(), "widget"); + self.stack.add_named(self.show.view.container(), "widget"); // The current visible child might change depending on // removal and insertion in the gtk::Stack, so we have @@ -113,7 +113,7 @@ impl PopulatedStack { } pub(crate) fn update_widget(&mut self) -> Result<(), Error> { - let old = self.show.container().clone(); + let old = self.show.view.container().clone(); let id = self.show.show_id(); if id.is_none() { return Ok(()); diff --git a/podcasts-gtk/src/widgets/show.rs b/podcasts-gtk/src/widgets/show.rs index 5748a9b..7351d92 100644 --- a/podcasts-gtk/src/widgets/show.rs +++ b/podcasts-gtk/src/widgets/show.rs @@ -20,7 +20,7 @@ use std::sync::Arc; #[derive(Debug, Clone)] pub(crate) struct ShowWidget { - view: BaseView, + pub(crate) view: BaseView, cover: gtk::Image, description: gtk::Label, episodes: gtk::ListBox, @@ -89,14 +89,6 @@ impl ShowWidget { debug_assert!(res.is_ok()); } - pub(crate) fn container(&self) -> >k::Box { - self.view.container() - } - - pub(crate) fn get_vadjustment(&self) -> Option { - self.view.get_vadjustment() - } - /// Set the show cover. fn set_cover(&self, pd: &Arc) -> Result<(), Error> { utils::set_image_from_path(&self.cover, pd.id(), 256)