ShowWidget: make base view field publick
There is no point to re-export BaseView's methods.
This commit is contained in:
parent
c0dca6ab9a
commit
3cee5b978a
@ -39,7 +39,7 @@ impl PopulatedStack {
|
|||||||
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.container(), "shows");
|
||||||
stack.add_named(show.container(), "widget");
|
stack.add_named(show.view.container(), "widget");
|
||||||
container.add(&stack);
|
container.add(&stack);
|
||||||
container.show_all();
|
container.show_all();
|
||||||
|
|
||||||
@ -88,10 +88,10 @@ impl PopulatedStack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn replace_widget(&mut self, pd: Arc<Show>) -> Result<(), Error> {
|
pub(crate) fn replace_widget(&mut self, pd: Arc<Show>) -> Result<(), Error> {
|
||||||
let old = self.show.container().clone();
|
let old = self.show.view.container().clone();
|
||||||
|
|
||||||
// Get the ShowWidget vertical alignment
|
// 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() {
|
let new = match self.show.show_id() {
|
||||||
// If the previous show was the same, restore the alignment
|
// If the previous show was the same, restore the alignment
|
||||||
Some(id) if id == pd.id() => ShowWidget::new(pd, self.sender.clone(), vadj),
|
Some(id) if id == pd.id() => ShowWidget::new(pd, self.sender.clone(), vadj),
|
||||||
@ -101,7 +101,7 @@ impl PopulatedStack {
|
|||||||
|
|
||||||
self.show = new;
|
self.show = new;
|
||||||
self.stack.remove(&old);
|
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
|
// The current visible child might change depending on
|
||||||
// removal and insertion in the gtk::Stack, so we have
|
// 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> {
|
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();
|
let id = self.show.show_id();
|
||||||
if id.is_none() {
|
if id.is_none() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|||||||
@ -20,7 +20,7 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub(crate) struct ShowWidget {
|
pub(crate) struct ShowWidget {
|
||||||
view: BaseView,
|
pub(crate) view: BaseView,
|
||||||
cover: gtk::Image,
|
cover: gtk::Image,
|
||||||
description: gtk::Label,
|
description: gtk::Label,
|
||||||
episodes: gtk::ListBox,
|
episodes: gtk::ListBox,
|
||||||
@ -89,14 +89,6 @@ impl ShowWidget {
|
|||||||
debug_assert!(res.is_ok());
|
debug_assert!(res.is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn container(&self) -> >k::Box {
|
|
||||||
self.view.container()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn get_vadjustment(&self) -> Option<Adjustment> {
|
|
||||||
self.view.get_vadjustment()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set the show cover.
|
/// Set the show cover.
|
||||||
fn set_cover(&self, pd: &Arc<Show>) -> Result<(), Error> {
|
fn set_cover(&self, pd: &Arc<Show>) -> Result<(), Error> {
|
||||||
utils::set_image_from_path(&self.cover, pd.id(), 256)
|
utils::set_image_from_path(&self.cover, pd.id(), 256)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user