imageView: Use custom slide widget and IndexSet
Use IndexSet to allow direct access by Path and also allow an arbitrary ordering that was not possible with Vec. Also add monitoring of file changes in the directory. Use a custom LpSlidingView instead of AdwCarousel because Carousel was never designed for this job and suffered of bugs. LpSlidingView does not support swiping gestures yet since they currently don't work yet anyways #24. Use a new algorithm to fill the LpSlidingView that is stateless and covers all potential changes in the directory. This not only fixes bugs but would also work with changed sorting orders. This also adds build time template XML validation since it was useful for the refactoring #46. Closes #9, #11, #30, #33, #42
This commit is contained in:
parent
73764810eb
commit
f2357513da
21 changed files with 1010 additions and 553 deletions
10
src/util.rs
10
src/util.rs
|
|
@ -1,10 +1,10 @@
|
|||
use crate::deps::*;
|
||||
|
||||
use anyhow::Context;
|
||||
use gio::prelude::*;
|
||||
|
||||
use anyhow::Context;
|
||||
|
||||
use std::fmt::{Debug, Write};
|
||||
use std::path::Path;
|
||||
|
||||
pub fn get_file_display_name(file: &gio::File) -> Option<String> {
|
||||
let info = query_attributes(file, vec![&gio::FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME]).ok()?;
|
||||
|
|
@ -46,9 +46,9 @@ pub async fn query_attributes_future(
|
|||
.context("Failed to query attributes")
|
||||
}
|
||||
|
||||
pub fn compare_by_name(file_a: &gio::File, file_b: &gio::File) -> std::cmp::Ordering {
|
||||
let name_a = get_file_display_name(file_a).unwrap_or_default();
|
||||
let name_b = get_file_display_name(file_b).unwrap_or_default();
|
||||
pub fn compare_by_name(file_a: &Path, file_b: &Path) -> std::cmp::Ordering {
|
||||
let name_a = file_a.display().to_string();
|
||||
let name_b = file_b.display().to_string();
|
||||
|
||||
let key_a = glib::FilenameCollationKey::from(name_a);
|
||||
let key_b = glib::FilenameCollationKey::from(name_b);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue