ShowsView: make base view field publick

There is no point to re-export BaseView's methods.
This commit is contained in:
Jordan Petridis 2018-08-09 08:49:28 +03:00
parent 3cee5b978a
commit 9a1b2d0150
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
2 changed files with 8 additions and 13 deletions

View File

@ -38,7 +38,7 @@ impl PopulatedStack {
let show = Rc::new(ShowWidget::default());
let container = gtk::Box::new(gtk::Orientation::Horizontal, 0);
stack.add_named(populated.container(), "shows");
stack.add_named(populated.view.container(), "shows");
stack.add_named(show.view.container(), "widget");
container.add(&stack);
container.show_all();
@ -70,7 +70,7 @@ impl PopulatedStack {
}
pub(crate) fn replace_shows(&mut self) -> Result<(), Error> {
let old = &self.populated.container().clone();
let old = &self.populated.view.container().clone();
debug!("Name: {:?}", WidgetExt::get_name(old));
self.populated
@ -81,7 +81,8 @@ impl PopulatedStack {
let pop = ShowsView::new(self.sender.clone());
self.populated = pop;
self.stack.remove(old);
self.stack.add_named(self.populated.container(), "shows");
self.stack
.add_named(self.populated.view.container(), "shows");
old.destroy();
Ok(())

View File

@ -22,7 +22,7 @@ lazy_static! {
#[derive(Debug, Clone)]
pub(crate) struct ShowsView {
view: BaseView,
pub(crate) view: BaseView,
flowbox: gtk::FlowBox,
}
@ -66,14 +66,6 @@ impl ShowsView {
});
}
pub(crate) fn container(&self) -> &gtk::Box {
self.view.container()
}
pub(crate) fn scrolled_window(&self) -> &gtk::ScrolledWindow {
self.view.scrolled_window()
}
/// Set scrolled window vertical adjustment.
fn set_vadjustment(&self) -> Result<(), Error> {
let guard = SHOWS_VIEW_VALIGNMENT
@ -84,7 +76,7 @@ impl ShowsView {
// Copy the vertical scrollbar adjustment from the old view into the new one.
let res = fragile
.try_get()
.map(|x| utils::smooth_scroll_to(self.scrolled_window(), &x))
.map(|x| utils::smooth_scroll_to(self.view.scrolled_window(), &x))
.map_err(From::from);
debug_assert!(res.is_ok());
@ -98,6 +90,7 @@ impl ShowsView {
pub(crate) fn save_alignment(&self) -> Result<(), Error> {
if let Ok(mut guard) = SHOWS_VIEW_VALIGNMENT.lock() {
let adj = self
.view
.scrolled_window()
.get_vadjustment()
.ok_or_else(|| format_err!("Could not get the adjustment"))?;
@ -114,6 +107,7 @@ fn populate_flowbox(shows: &Rc<ShowsView>) -> Result<(), Error> {
let podcasts = dbqueries::get_podcasts_filter(&ignore)?;
let constructor = move |parent| ShowsChild::new(&parent).child;
// FIXME: We are, possibly,leaking the strong ref here
let callback = clone!(shows => move || {
shows.set_vadjustment()
.map_err(|err| error!("Failed to set ShowsView Alignment: {}", err))