Commit graph

24 commits

Author SHA1 Message Date
Sophie Herold
bea6ad018b propertiesView: Disable open folder for non-native
The GTK API only support native files for opening the
parent directory.

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/207>
2023-05-03 16:41:51 +00:00
Sophie Herold
2f9fad47a1 src: Update or add auto generated license headers
Closes #55

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/169>
2023-04-19 20:02:01 +02:00
Sophie Herold
8b3cfd000a cargo: Remove gtk-macros dependency
Using the crate is depreacted. Replaced spawn! macro
with our own spawn function
2023-04-06 21:08:33 +00:00
Sophie Herold
889c818c14 code: Use pub(super) in GObject impl structs
This helps with getting warnings for fields we no longer use

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/143>
2023-03-14 21:25:45 +00:00
Sophie Herold
e93020d9ab propertiesView: Unify localized DateTime format
Closes #43

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/141>
2023-03-14 03:50:22 +00:00
Sophie Herold
42d558d22f propertiesView: Use image dimensions from decoder
This also shows the units for SVG dimensions if not pixels.

Issue #43

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/136>
2023-03-14 02:31:07 +00:00
Sophie Herold
a2a9b4134b propertiesView: Use decoder format
Use the format that we actually used when decoding.
The mime type is usually derived from the file extension
which might not always be correct.

Issue #43

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/132>
2023-03-14 00:50:40 +00:00
Sophie Herold
9b532f93f3 propertiesView: Use strong file reference
This fixes issues with file info not loading.

Closes #96
2023-03-09 23:46:04 +01:00
Christopher Davis
ae41a77521 properties_view: Move expressions to UI files
Currently Loupe leaks expressions created in-code. This
is because expressions need to be unwatched in order to be
dropped. Since we'd need to hold a reference to the watch
ourselves and unwatch them in dispose, our code would
become more cumbersome if we were to try to handle this properly.

This commit moves the expressions on LpPropertiesView to the
UI file, as GTK handles cleaning up the expressions it creates,
without any extra consideration on the app side.
2023-03-05 02:13:41 +00:00
Lubosz Sarnecki
30136f9050 code: Fix some typos.
Fix some typos, mainly in comments with the power of
Builder's spell correction.
2023-02-21 00:19:05 +01:00
Sophie Herold
004ebd5615 cargo: Update dependencies 2023-02-15 17:04:59 +01:00
Sophie Herold
f2357513da 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
2023-01-30 01:08:57 +00:00
Christopher Davis
9d7dae408b properties_view: Use GtkFileLauncher for opening directory
GtkFileLauncher handles opening the containing folder for
us, using the portal when appropriate
2023-01-18 20:21:15 -05:00
Sophie Herold
65808f5894 propertiesView: Show basic EXIF data
Use libgweather to determine the city for EXIF GPS coordinates.
Make ImageMetadata a GObject to use it's properties in UI.
2022-12-12 11:31:27 -05:00
Christopher Davis
d1d53e4f4a properties_view: Use ParamSpec builders for props 2022-11-24 13:06:53 -05:00
Christopher Davis
94086b1650 properties_view: Add comment explaining the purpose of build_dimensions()
Sophie Herold mentioned that it's not entirely clear why we're
loading the image data again here. This comment should explain why
to future readers.
2022-11-23 01:30:14 +00:00
Sophie Herold
3d6564377a cargo: Update dependencies 2022-11-03 00:57:18 +01:00
Christopher Davis
81273c736e general: Update libadwaita-rs
Allows us to clean up our imports a bit.
2022-08-06 00:48:52 -04:00
Christopher Davis
58a77ec9fa properties_view: Only show decimal places when dimensions are fractional 2022-08-05 17:56:07 -04:00
Christopher Davis
36cf667cc8 properties_view: Use glib::format_size() for file size
This handles appropriate localized unit names and rounding for us.
2022-08-05 17:19:47 -04:00
Christopher Davis
37f170b165 general: Name spawned threads
This is for easier debugging in case a panic happens -
instead of dealing with "thread <unnamed> paniced...", etc.,
we get a name relevant to our context.
2022-08-03 19:53:32 -04:00
Christopher Davis
d99215bfd1 general: Use gtk_macros::spawn!()
Makes the code a tad cleaner because we're not manually
getting `glib::MainContext` every time we want to spawn
a future.
2022-08-03 19:37:03 -04:00
Christopher Davis
386b41e482 properties_view: Ignore result of sending SVG metadata across threads
`parse_svg_file_future()` is called in a cancellable async
block. This means that after it's called it can be cancelled,
which drops the receiver. When we fetch the metadata, we try
sending the result to the dropped receiver.

This is expected behavior in this case - the receiver
being gone at the time of sending the metadata is perfectly
valid. However, previously we would cause the thread to panic.
This didn't break anything but made for scary log message.

Since this is expected behavior we can use `_` to tell the
compiler that we don't care about the outcome of sending.
This is valid in this instance because we will only get an
error if the receiver is gone.
2022-08-02 21:15:45 -04:00
Christopher Davis
ba4661031f Implement Properties
Implement a properties sidebar. In order to prevent
the UI from freezing, we use futures to load and cancel
loading file information. We also make use of
`gdk_pixbuf` and `svg_metadata` in order to get the file's
metadata before the file fully loads, meaning there's
little to no delay between changing files and seeing
the metadata for large images.

The properties widget uses expressions and
properties to avoid glue code for setting each label,
allowing us to have a clean separation between UI
and data.
2022-08-02 19:31:44 -04:00