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:
Sophie Herold 2023-01-23 01:10:15 +01:00 • committed by Christopher Davis
parent 73764810eb
commit f2357513da
21 changed files with 1010 additions and 553 deletions

View file

@ -1,59 +0,0 @@
From b2c52f258757e37a74a95c109431f6af8cda8f91 Mon Sep 17 00:00:00 2001
From: Sophie Herold <sophie@hemio.de>
Date: Wed, 7 Dec 2022 17:42:06 +0100
Subject: [PATCH] carousel: give new child a snap_point immediately
Fixes #457, #597
---
src/adw-carousel.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/adw-carousel.c b/src/adw-carousel.c
index 47ea9475..5a9816f9 100644
--- a/src/adw-carousel.c
+++ b/src/adw-carousel.c
@@ -1207,6 +1207,8 @@ adw_carousel_insert (AdwCarousel *self,
{
ChildInfo *info;
GList *next_link = NULL;
+ double snap_point = 0;
+ GList *children;
g_return_if_fail (ADW_IS_CAROUSEL (self));
g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -1214,7 +1216,8 @@ adw_carousel_insert (AdwCarousel *self,
info = g_new0 (ChildInfo, 1);
info->widget = widget;
- info->size = 0;
+ // set a minimal size to give child it's own snap_point from the beginning
+ info->size = 0.00001;
info->adding = TRUE;
if (position >= 0)
@@ -1230,6 +1233,22 @@ adw_carousel_insert (AdwCarousel *self,
gtk_widget_set_parent (widget, GTK_WIDGET (self));
}
+ // work around this usually happening in measure which can be too late
+ for (children = self->children; children; children = children->next) {
+ ChildInfo *child_info = children->data;
+
+ child_info->snap_point = snap_point + child_info->size - 1;
+
+ snap_point += child_info->size;
+
+ if (child_info == self->animation_target_child)
+ adw_spring_animation_set_value_to (ADW_SPRING_ANIMATION (self->animation),
+ child_info->snap_point);
+ }
+
+ // start animation from correct size
+ info->size = 0;
+
gtk_widget_queue_allocate (GTK_WIDGET (self));
animate_child_resize (self, info, 1, self->reveal_duration);
--
GitLab

View file

@ -91,22 +91,6 @@
}
]
},
/* Use patched libadwaita version to test the fix */
{
"name": "libadwaita",
"buildsystem": "meson",
"sources": [
{
"type": "git",
"url": "https://gitlab.gnome.org/GNOME/libadwaita.git",
"branch": "main"
},
{
"type": "patch",
"path": "libadwaita-issue-597.patch"
}
]
},
{
"name" : "loupe",
"builddir" : true,