summaryrefslogtreecommitdiff
path: root/tumbler/tumbler-thumbnail.c
Commit message (Collapse)AuthorAgeFilesLines
* Use microsecond precision for last modification timeGaël Bonithon2021-12-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the file system allows it, this prevents Tumbler from believing that the original file has not been modified since the last time the thumbnail was created, when in fact modifications have taken place in the second that the thumbnail was created. The time of last modification is stored internally in a `gdouble`, and written to the PNG thumbnail in `%.6f` format. This complies well with the Freedesktop specification [1], as the stat command returns this format when invoked as `stat -c%.6Y file`, although it is likely that the specification was written with the idea that this value be an integer. The extraction of the thumbnail information is done via `g_ascii_strtod()`, so an integer or less precision is not a problem. As for a code expecting to find an integer, it is likely to simply ignore the decimal part, as Tumbler used to do by extracting the information via `atol()`. It is possible, however, that an error will be found if a more complete extractor is used, such as `strtol()`. The changes this causes to the exposed Tumbler APIs should also be inconsequential, as it is a conversion to a higher type. This should therefore result in implicit conversions, except perhaps for `tumbler_file_info_get_mtime()`, if its return value is explicitly stored in a `gint64`. [1] https://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html#CREATION Fixes #15, see !20 for more details.
* Fix compilation warningsGaël Bonithon2021-11-101-28/+2
|
* Fix a bunch of compiler warnings.Jannis Pohlmann2009-10-271-13/+0
|
* Massive refactoring to support flavors properly.Jannis Pohlmann2009-10-271-59/+9
| | | | | | | | | | | | | | | | | | | | | Refactor the entire code to use TumblerFileInfo instead of separate URI/MIME/flavor arrays. We now support flavors which means that applications can request "normal" and "large" thumbnails and thus have more control over what is created. This simplifies the code in a lot of places. We now use a real GObject class called TumblerThumbnailFlavor instead of a fixed-size enum. Cache backends can return as many flavors as they want, each consisting of a name, a width and a height. As a consequence, we can also get rid of the configure flags to enable/disable normal, large and cropped thumbnails. The default cache plugin shipped with Tumbler only supports "normal" (128x128px) and "large" (256x256px). Optimize the code a little bit. We now load the TunarFileInfo and ThunarThumbnail only *once* for each URI instead of loading them once in the scheduler and again in thumbnailer plugins. This needs careful testing. I might have introduced a few memory leaks here and there, plus new bugs... you never know.
* Add TumblerColorspace enum, rename save_pixbuf() to save_image_data().Jannis Pohlmann2009-10-211-9/+9
| | | | Also fixed the coding style here and there.
* Replaced GdkPixbuf APIs with TumblerImageDataJannis Pohlmann2009-10-211-2/+1
| | | | | | | Conflicts: plugins/font-thumbnailer/font-thumbnailer.c plugins/pixbuf-thumbnailer/pixbuf-thumbnailer.c
* Fixed a glitch, checking for the wrong function pointerPhilip Van Hoof2009-10-081-1/+1
| | | | Signed-off-by: Jannis Pohlmann <jannis@xfce.org>
* Add tumbler_thumbnail_save_file() to save thumbnails from source files.Jannis Pohlmann2009-06-251-0/+19
| | | | | | | | | This is especially useful for plugins that execute external commands such as "convert". They can just let these commands write to a certain file which they then pass to tumbler_thumbnail_save_file() to make sure it's stored in a way the corresponding cache plugin supports. It is an alternative to tumbler_thumbnail_save_pixbuf().
* Cleanup, remove private structs and use G_DEFINE_TYPE where possible.Jannis Pohlmann2009-06-171-12/+15
| | | | This commit also contains a few fixes though.
* Add plugin interface for cache and thumbnailer implementations.Jannis Pohlmann2009-06-081-0/+208
| | | | | | | | | | | | | | | | | | | | | This is a major refactoring of the source code. Amongst others, the classes TumblerProviderFactory, TumblerThumbnailer, TumblerAbstractThumbnailer, TumblerThumbnailerProvider, TumblerCache, TumblerCacheProvider and TumblerFileInfo have been added. From now on tumbler supports different storage backends and thumbnailers as plugins. Storage backends have to implement TumblerCache, thumbnailers have to implement TumblerThumbnailer. Plugins have to implement three methods: tumbler_plugin_initialize(), tumbler_plugin_shutdown() and tumbler_plugin_get_types(). The latter is expected to return a list of provider types for cache or thumbnailer implementations. Two example plugins have been added, one for the XDG thumbnail cache and one for a GdkPixbuf based thumbnailer. The code of tumblerd was updated to reflect these changes in libtumbler.
* Improve threshold scheduler, thumbnail info and builtin thumbnailer.Jannis Pohlmann2009-06-051-211/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Depend on libpng 1.2 and make gdk-pixbuf a hard dependency. Remove tumbler/tumbler-thumbnail.{c,h}. Move all related functions into TumblerThumbnailInfo. Improve the generation of tumbler-marshal.{c,h}, so that they can be included in the library and be used by others. Improve TumblerThumbnailInfo and TumblerPNGThumbnailInfo. The interface now has functions to save fail thumbnails and pixbufs for all supported thumbnail flavors. It can also check whether there are invalid/outdated flavors. It also knows about the GFile's and sizes of all flavors. Specialized thumbnailers can use TumblerThumbnailInfo to check if they need to do something and if so, what they need to do. Once they have a GdkPixbuf ready, they can just hand it over to the TumblerThumbnailInfo and don't have to worry about saving. Also improve TumblerPNGThumbnailInfo, which is an implementation of TumblerThumbnailInfo that supports the thumbnail cache defined in the Thumbnail Managing Standard. The built-in pixbuf thumbnailer is almost completely implemented now. However, it doesn't support cropped thumbnails yet. This commit also adds a new method tumbler_scheduler_emit_uri_error() which can be used to emit an error for only one URI. Finally, it includes a few code cleanups.
* Add API docs for tumbler (not tumblerd) using GTK-Doc.Jannis Pohlmann2009-05-221-0/+9
|
* Add error domain, TumblerThumbnailFlavor and thumbnail helper functions.Jannis Pohlmann2009-05-221-0/+202
This commit adds the TUMBLER_ERROR_DOMAIN and TUMBLER_ERROR defines and a TumblerErrorEnum with currently only containing TUMBLER_ERROR_FAILED. Also new is the TumblerThumbnailFlavor enum type, together with a few utility functions related to creating thumbnails: - tumbler_thumbnail_get_flavors() returns all flavors supported by the current build of tumbler, - tumbler_thumbnail_flavor_get_size() returns the size corresponding to a flavor (e.g. 128 for TUMBLER_THUMBNAIL_FLAVOR_NORMAL), - tumbler_thumbnail_flavor_get_directory() returns a GFile pointing to the flavor directory (e.g. $HOME/.thumbnails/normal/ for TUMBLER_THUMBNAIL_FLAVOR_NORMAL), - tumbler_thumbnail_get_file() returns a GFile pointing to the thumbnail destination file of an URI and a flavor, - tumbler_thumbnail_create_and_open_file() tries to create such a GFile and also tries to open it for writing, returning the GFileOutputStream if possible.