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

@ -8,11 +8,9 @@
<object class="GtkOverlay" id="bin_child">
<property name="hexpand">True</property>
<child>
<object class="AdwCarousel" id="carousel">
<property name="interactive">True</property>
<property name="allow-mouse-drag">False</property>
<property name="allow-scroll-wheel">False</property>
<signal name="page-changed" handler="page_changed_cb" swapped="yes"/>
<object class="LpSlidingView" id="sliding_view">
<signal name="notify::current-page" handler="page_changed_cb" swapped="yes"/>
<signal name="target-page-reached" handler="target_page_reached_cb" swapped="yes"/>
</object>
</child>
<child type="overlay">

View file

@ -63,7 +63,11 @@
<property name="title" translatable="yes">Loupe</property>
<binding name="title">
<closure type="gchararray" function="window_title">
<lookup type="LpImageView" name="active-file">image_view</lookup>
<lookup name="path">
<lookup name="image">
<lookup name="current-page">image_view</lookup>
</lookup>
</lookup>
</closure>
</binding>
<property name="content">
@ -187,10 +191,9 @@
</property>
<property name="flap">
<object class="LpPropertiesView" id="properties_view">
<property name="file" bind-source="image_view" bind-property="active-file" bind-flags="sync-create"/>
<binding name="image">
<lookup name="image">
<lookup name="current-page-strict">
<lookup name="current-page">
image_view
</lookup>
</lookup>

View file

@ -2,10 +2,6 @@
<gresources>
<gresource prefix="/org/gnome/Loupe">
<file compressed="true" preprocess="xml-stripblanks">gtk/help_overlay.ui</file>
<file compressed="true" preprocess="xml-stripblanks">gtk/window.ui</file>
<file compressed="true" preprocess="xml-stripblanks">gtk/image_page.ui</file>
<file compressed="true" preprocess="xml-stripblanks">gtk/image_view.ui</file>
<file compressed="true" preprocess="xml-stripblanks">gtk/properties_view.ui</file>
<file>style.css</file>
<file>style-hc.css</file>
</gresource>