GeopJr / Tuba

Browse the Fediverse
https://tuba.geopjr.dev/
GNU General Public License v3.0
552 stars 59 forks source link

[Request]: Make TubaViewsMediaViewer into library #976

Closed spazziale closed 3 months ago

spazziale commented 3 months ago

Describe the request

At the moment GNOME does not have a photo viewer as a library. It would be convenient for an app I am experimenting with to have an implementation already done and other apps could benefit from your work ( ex. Flare )

I understand that maintaining an additional library is an extra effort so don't feel obliged ;)

Implementation Details

GeopJr commented 3 months ago

I've discussed this before with other GNOME people, and the conclusion was basically that we don't actually need a generic MediaViewer but a 'ZoomView' instead.

The reason being that a MediaViewer will have to either be extremely bloated and complex to meet everyone's needs or be very minimal requiring everyone to just build their own. Tuba for example needs a MediaViewer that can both play videos and view images, zoom, swipe to dismiss, show animations when you enter or leave, support right clicking to open link or save the attachment and show a thumbnail with a spinner while it downloads the full size media. That's a lot, compared to what Fractal needs, a MediaViewer that can play 1 attachment at a time, swipe to dismiss, enter and leave animations. And an Image Viewer app would only need to load many images, no animations or swipes etc.

While, a ZoomView would be a container that can zoom in and out, with gestures and buttons and would accept a child. That would take care of the most complex part and leave the rest to app authors. The rest being, a GtkOverlay and AdwCarousel (for multiple items)

spazziale commented 3 months ago

True, that seems the best solution. Is it possible to extract it from Tuba or do I close the issue?

GeopJr commented 3 months ago

You can but I wouldn't. It's made explicitly to deal with Tuba's needs (zoom levels, gestures, video playing status, floating buttons, thumbnails...). Instead, since Flare is written in Rust, I'd go straight to Loupe https://gitlab.gnome.org/GNOME/loupe (most of Tuba's implementation was ported from there anyway). Extension manager also has a nice implementation https://github.com/mjakeman/extension-manager/blob/master/src/exm-zoom-picture.c