diff --git a/podcasts-gtk/resources/gtk/home_view.ui b/podcasts-gtk/resources/gtk/home_view.ui
index 4d018bf..86e34c7 100644
--- a/podcasts-gtk/resources/gtk/home_view.ui
+++ b/podcasts-gtk/resources/gtk/home_view.ui
@@ -3,20 +3,20 @@
Copyright (C) 2017 - 2018
-This file is part of Hammond.
+This file is part of GNOME Podcasts.
-Hammond is free software: you can redistribute it and/or modify
+GNOME Podcasts is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-Hammond is distributed in the hope that it will be useful,
+GNOME Podcasts is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with Hammond. If not, see .
+along with GNOME Podcasts. If not, see .
Authors:
Jordan Petridis
@@ -24,376 +24,302 @@ Tobias Bernard
-->
-
+
-
+
-
diff --git a/podcasts-gtk/src/stacks/home.rs b/podcasts-gtk/src/stacks/home.rs
index ec3492c..86cdfdb 100644
--- a/podcasts-gtk/src/stacks/home.rs
+++ b/podcasts-gtk/src/stacks/home.rs
@@ -34,7 +34,7 @@ impl HomeStack {
let stack = gtk::Stack::new();
let state = State::Empty;
- stack.add_named(&episodes.container, "home");
+ stack.add_named(episodes.container(), "home");
stack.add_named(&empty.container, "empty");
let mut home = HomeStack {
@@ -67,14 +67,14 @@ impl HomeStack {
fn replace_view(&mut self) -> Result<(), Error> {
// Get the container of the view
- let old = &self.episodes.container.clone();
+ let old = &self.episodes.container().clone();
let eps = HomeView::new(self.sender.clone())?;
// Remove the old widget and add the new one
// during this the previous view is removed,
// and the visibile child fallsback to empty view.
self.stack.remove(old);
- self.stack.add_named(&eps.container, "home");
+ self.stack.add_named(eps.container(), "home");
// Keep the previous state.
let s = self.state;
// Set the visible child back to the previous one to avoid
diff --git a/podcasts-gtk/src/widgets/home_view.rs b/podcasts-gtk/src/widgets/home_view.rs
index 442b016..3cdacd5 100644
--- a/podcasts-gtk/src/widgets/home_view.rs
+++ b/podcasts-gtk/src/widgets/home_view.rs
@@ -11,7 +11,7 @@ use podcasts_data::EpisodeWidgetModel;
use app::Action;
use utils::{self, lazy_load_full};
-use widgets::EpisodeWidget;
+use widgets::{BaseView, EpisodeWidget};
use std::cell::Cell;
use std::rc::Rc;
@@ -33,8 +33,7 @@ enum ListSplit {
#[derive(Debug, Clone)]
pub(crate) struct HomeView {
- pub(crate) container: gtk::Box,
- scrolled_window: gtk::ScrolledWindow,
+ view: BaseView,
frame_parent: gtk::Box,
today_box: gtk::Box,
yday_box: gtk::Box,
@@ -50,9 +49,8 @@ pub(crate) struct HomeView {
impl Default for HomeView {
fn default() -> Self {
+ let view = BaseView::default();
let builder = gtk::Builder::new_from_resource("/org/gnome/Podcasts/gtk/home_view.ui");
- let container: gtk::Box = builder.get_object("container").unwrap();
- let scrolled_window: gtk::ScrolledWindow = builder.get_object("scrolled_window").unwrap();
let frame_parent: gtk::Box = builder.get_object("frame_parent").unwrap();
let today_box: gtk::Box = builder.get_object("today_box").unwrap();
let yday_box: gtk::Box = builder.get_object("yday_box").unwrap();
@@ -65,9 +63,10 @@ impl Default for HomeView {
let month_list: gtk::ListBox = builder.get_object("month_list").unwrap();
let rest_list: gtk::ListBox = builder.get_object("rest_list").unwrap();
+ view.add(&frame_parent);
+
HomeView {
- container,
- scrolled_window,
+ view,
frame_parent,
today_box,
yday_box,
@@ -116,10 +115,18 @@ impl HomeView {
};
lazy_load_full(episodes, func, callback);
- view.container.show_all();
+ view.container().show_all();
Ok(view)
}
+ 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.
fn set_vadjustment(&self) -> Result<(), Error> {
let guard = EPISODES_VIEW_VALIGNMENT
@@ -130,7 +137,7 @@ impl HomeView {
// 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.scrolled_window(), &x))
.map_err(From::from);
debug_assert!(res.is_ok());
@@ -144,7 +151,7 @@ impl HomeView {
pub(crate) fn save_alignment(&self) -> Result<(), Error> {
if let Ok(mut guard) = EPISODES_VIEW_VALIGNMENT.lock() {
let adj = self
- .scrolled_window
+ .scrolled_window()
.get_vadjustment()
.ok_or_else(|| format_err!("Could not get the adjustment"))?;
*guard = Some(Fragile::new(adj));