Mapped home button to switch the stack to the grid containing the flowbox.

This commit is contained in:
Jordan Petridis 2017-10-16 01:46:12 +03:00
parent a8084e1bdf
commit c98c7d00df
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
3 changed files with 14 additions and 8 deletions

View File

@ -86,6 +86,7 @@ pub fn latest_dl(connection: &SqliteConnection, limit: u32) -> Result<()> {
Ok(())
}
// TODO: Right unit test
fn get_dl_folder(pd: &Podcast) -> Result<String> {
// It might be better to make it a hash of the title
let dl_fold = format!("{}/{}", DL_DIR.to_str().unwrap(), pd.title());
@ -122,6 +123,7 @@ fn get_episode(connection: &SqliteConnection, ep: &mut Episode, dl_folder: &str)
}
// pub fn cache_image(pd: &Podcast) -> Option<String> {
// TODO: Right unit test
// TODO: Refactor
pub fn cache_image(title: &str, image_uri: Option<&str>) -> Option<String> {
if let Some(url) = image_uri {

View File

@ -49,7 +49,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkGrid">
<object class="GtkGrid" id="grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_homogeneous">True</property>
@ -102,9 +102,6 @@
<property name="title" translatable="yes">page0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="titlebar">

View File

@ -141,11 +141,21 @@ fn main() {
let header: gtk::HeaderBar = header_build.get_object("headerbar1").unwrap();
window.set_titlebar(&header);
// Adapted copy of the way gnome-music does albumview
let flowbox: gtk::FlowBox = builder.get_object("flowbox1").unwrap();
let grid: gtk::Grid = builder.get_object("grid").unwrap();
let refresh_button: gtk::Button = header_build.get_object("refbutton").unwrap();
// TODO: Have a small dropdown menu
let _add_button: gtk::Button = header_build.get_object("addbutton").unwrap();
let _search_button: gtk::Button = header_build.get_object("searchbutton").unwrap();
let _home_button: gtk::Button = header_build.get_object("homebutton").unwrap();
// TODO: make it a back arrow button, that will hide when appropriate,
// and add a StackSwitcher when more views are added.
let home_button: gtk::Button = header_build.get_object("homebutton").unwrap();
let grid_clone = grid.clone();
let stack_clone = stack.clone();
home_button.connect_clicked(move |_| stack_clone.set_visible_child(&grid_clone));
// FIXME: This locks the ui atm.
refresh_button.connect_clicked(|_| {
@ -159,9 +169,6 @@ fn main() {
Inhibit(false)
});
// Adapted copy of the way gnome-music does albumview
let flowbox: gtk::FlowBox = builder.get_object("flowbox1").unwrap();
let db = hammond_data::establish_connection();
// let pd_model = create_and_fill_tree_store(&db, &builder);
let pd_model = create_and_fill_list_store(&db, &builder);