window: Support dropping multiple files

This allows to scroll through all dropped files.
No further images from directories are loaded in
this mode.

Closes #35
This commit is contained in:
Sophie Herold 2023-04-18 01:52:06 +02:00
parent e710419a22
commit aca49427a1
4 changed files with 53 additions and 53 deletions

View file

@ -70,12 +70,18 @@ impl Default for LpFileModel {
impl LpFileModel {
/// Create with a single element
pub fn from_file(file: &gio::File) -> Self {
pub fn from_file(file: gio::File) -> Self {
Self::from_files(vec![file])
}
pub fn from_files(files: Vec<gio::File>) -> Self {
let model = Self::default();
{
let mut vec = model.imp().files.borrow_mut();
vec.insert(file.uri(), file.clone());
for file in files {
vec.insert(file.uri(), file);
}
}
model