ShowsView: make base view field publick
There is no point to re-export BaseView's methods.
This commit is contained in:
parent
5d467a22d0
commit
85aaaf80ac
@ -38,7 +38,7 @@ impl PopulatedStack {
|
|||||||
let show = Rc::new(ShowWidget::default());
|
let show = Rc::new(ShowWidget::default());
|
||||||
let container = gtk::Box::new(gtk::Orientation::Horizontal, 0);
|
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");
|
stack.add_named(show.view.container(), "widget");
|
||||||
container.add(&stack);
|
container.add(&stack);
|
||||||
container.show_all();
|
container.show_all();
|
||||||
@ -70,7 +70,7 @@ impl PopulatedStack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn replace_shows(&mut self) -> Result<(), Error> {
|
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));
|
debug!("Name: {:?}", WidgetExt::get_name(old));
|
||||||
|
|
||||||
self.populated
|
self.populated
|
||||||
@ -81,7 +81,8 @@ impl PopulatedStack {
|
|||||||
let pop = ShowsView::new(self.sender.clone());
|
let pop = ShowsView::new(self.sender.clone());
|
||||||
self.populated = pop;
|
self.populated = pop;
|
||||||
self.stack.remove(old);
|
self.stack.remove(old);
|
||||||
self.stack.add_named(self.populated.container(), "shows");
|
self.stack
|
||||||
|
.add_named(self.populated.view.container(), "shows");
|
||||||
|
|
||||||
old.destroy();
|
old.destroy();
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@ -22,7 +22,7 @@ lazy_static! {
|
|||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub(crate) struct ShowsView {
|
pub(crate) struct ShowsView {
|
||||||
view: BaseView,
|
pub(crate) view: BaseView,
|
||||||
flowbox: gtk::FlowBox,
|
flowbox: gtk::FlowBox,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,14 +66,6 @@ impl ShowsView {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn container(&self) -> >k::Box {
|
|
||||||
self.view.container()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn scrolled_window(&self) -> >k::ScrolledWindow {
|
|
||||||
self.view.scrolled_window()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set scrolled window vertical adjustment.
|
/// Set scrolled window vertical adjustment.
|
||||||
fn set_vadjustment(&self) -> Result<(), Error> {
|
fn set_vadjustment(&self) -> Result<(), Error> {
|
||||||
let guard = SHOWS_VIEW_VALIGNMENT
|
let guard = SHOWS_VIEW_VALIGNMENT
|
||||||
@ -84,7 +76,7 @@ impl ShowsView {
|
|||||||
// Copy the vertical scrollbar adjustment from the old view into the new one.
|
// Copy the vertical scrollbar adjustment from the old view into the new one.
|
||||||
let res = fragile
|
let res = fragile
|
||||||
.try_get()
|
.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);
|
.map_err(From::from);
|
||||||
|
|
||||||
debug_assert!(res.is_ok());
|
debug_assert!(res.is_ok());
|
||||||
@ -98,6 +90,7 @@ impl ShowsView {
|
|||||||
pub(crate) fn save_alignment(&self) -> Result<(), Error> {
|
pub(crate) fn save_alignment(&self) -> Result<(), Error> {
|
||||||
if let Ok(mut guard) = SHOWS_VIEW_VALIGNMENT.lock() {
|
if let Ok(mut guard) = SHOWS_VIEW_VALIGNMENT.lock() {
|
||||||
let adj = self
|
let adj = self
|
||||||
|
.view
|
||||||
.scrolled_window()
|
.scrolled_window()
|
||||||
.get_vadjustment()
|
.get_vadjustment()
|
||||||
.ok_or_else(|| format_err!("Could not get the adjustment"))?;
|
.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 podcasts = dbqueries::get_podcasts_filter(&ignore)?;
|
||||||
|
|
||||||
let constructor = move |parent| ShowsChild::new(&parent).child;
|
let constructor = move |parent| ShowsChild::new(&parent).child;
|
||||||
|
// FIXME: We are, possibly,leaking the strong ref here
|
||||||
let callback = clone!(shows => move || {
|
let callback = clone!(shows => move || {
|
||||||
shows.set_vadjustment()
|
shows.set_vadjustment()
|
||||||
.map_err(|err| error!("Failed to set ShowsView Alignment: {}", err))
|
.map_err(|err| error!("Failed to set ShowsView Alignment: {}", err))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user