Web lists-archives.com

Re: GnomeDesktopThumbnail API replacement




On Wed, 2018-01-17 at 18:15 +0100, Bastien Nocera wrote:
> On Wed, 2018-01-17 at 13:15 +0100, Bastien Nocera wrote:
> > Hey,
> > 
> > I wanted to start a discussion about replacing
> > GnomeDesktopThumbnail
> > with an API that would live in the GLib/GTK+ stack.
> 
> <snip>

From the GLib side of things, my thoughts are that this shouldn’t live
in GLib, since it deals with pixbufs. As long as it integrates with
GIO’s thumbnail attribute support, GLib will be happy.

What about https://wiki.gnome.org/DraftSpecs/ThumbnailerSpec? I don’t
know if the API is entirely relevant (or whether explicitly exposing
the cache over D-Bus makes sense), but there may be some useful ideas
there even if the API as a whole is not a good fit.

What did you have to say about making things free-Unix-specific (or
more Linux specific)?

> > To sum up, here are the questions:
> > - Do we want the API in GTK+ and depending on gdk-pixbuf, even if
> > it's
> > only really meant to be used on "freedesktop" platforms?
> > - Are there specific API entry points that people need besides the
> > current API (including [1]) with async support?
> 
> This is the API that I came up with, which could live in either gdk-
> pixbuf, or GTK+, dependency-wise. It might also be small enough to
> copy/paste although I count 15 users of just the C API in Debian
> Codesearch[1], so it might be worth having in a shared library
> anyway.
> 
> typedef enum {
>     GNOME_DESKTOP_THUMBNAIL_FLAGS_NONE = 0,
>     GNOME_DESKTOP_THUMBNAIL_FLAGS_SAVE,  // Whether to save the
> created (successful or failed) thumbnail to the cache
> } GnomeDesktopThumbnailFlag;
> 
> #define GNOME_DESKTOP_THUMBNAIL_FILE_ATTRIBUTES                 \
>         G_FILE_ATTRIBUTE_THUMBNAIL_PATH ","                     \
>         G_FILE_ATTRIBUTE_THUMBNAILING_FAILED ","                \
>         G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID ","                 \
>         G_FILE_ATTRIBUTE_PREVIEW_ICON ","                       \
>         G_FILE_ATTRIBUTE_TIME_MODIFIED ","                      \
>         G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE
> 
> // About @info:
> // NULL means we'll look it up if necessary, otherwise must include
> // GNOME_DESKTOP_THUMBNAIL_FILE_ATTRIBUTES,
> // G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE will however be used rather
> // than G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE if present
> 
> GdkPixbuf *
> gnome_desktop_thumbnail_generate_thumbnail_sync
> (GnomeDesktopThumbnailFactory  *factory,
>                                                  GFile               
>           *file,       // instead of a URI?
>                                                  GFileInfo           
>           *info,       
>                                                  GnomeDesktopThumbnai
> lFlags     flag,
>                                                  char                
>          **ret_thumbnail_path,
>                                                  GError              
>          **error);

Seems reasonable, though I assume people will typically use the
*_async() version? The *_sync() version should still have a
GCancellable argument. I agree with using a GFile rather than a raw
URI. If this is done as a shared library then you can implement it
using bwrap or D-Bus as you see fit, and change the implementation
later on without problems.

Philip

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-devel-list