diff options
author | Jannis Pohlmann <jannis@xfce.org> | 2009-10-27 03:13:42 +0100 |
---|---|---|
committer | Jannis Pohlmann <jannis@xfce.org> | 2009-10-27 03:13:42 +0100 |
commit | ae5d1fcdbd406efa945a9ff631991bc08b1fa31e (patch) | |
tree | 378f5aea375c541221a62fe6ed468c383d6c0dcc /tumbler/tumbler-cache.h | |
parent | 7a1e43d0806ec976eb2872209affb3d8a0dad7d0 (diff) | |
download | tumbler-ae5d1fcdbd406efa945a9ff631991bc08b1fa31e.tar.gz |
Massive refactoring to support flavors properly.
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.
Diffstat (limited to 'tumbler/tumbler-cache.h')
-rw-r--r-- | tumbler/tumbler-cache.h | 73 |
1 files changed, 40 insertions, 33 deletions
diff --git a/tumbler/tumbler-cache.h b/tumbler/tumbler-cache.h index 7e42539..49f18ff 100644 --- a/tumbler/tumbler-cache.h +++ b/tumbler/tumbler-cache.h @@ -25,7 +25,8 @@ #ifndef __TUMBLER_CACHE_H__ #define __TUMBLER_CACHE_H__ -#include <glib-object.h> +#include <tumbler/tumbler-thumbnail.h> +#include <tumbler/tumbler-thumbnail-flavor.h> G_BEGIN_DECLS @@ -44,42 +45,48 @@ struct _TumblerCacheIface /* signals */ /* virtual methods */ - GList *(*get_thumbnails) (TumblerCache *cache, - const gchar *uri); - void (*cleanup) (TumblerCache *cache, - const gchar *uri, - guint64 since); - void (*delete) (TumblerCache *cache, - const GStrv uris); - void (*copy) (TumblerCache *cache, - const GStrv from_uris, - const GStrv to_uris); - void (*move) (TumblerCache *cache, - const GStrv from_uris, - const GStrv to_uris); - gboolean (*is_thumbnail) (TumblerCache *cache, - const gchar *uri); + TumblerThumbnail *(*get_thumbnail) (TumblerCache *cache, + const gchar *uri, + TumblerThumbnailFlavor *flavor); + void (*cleanup) (TumblerCache *cache, + const gchar *uri, + guint64 since); + void (*delete) (TumblerCache *cache, + const GStrv uris); + void (*copy) (TumblerCache *cache, + const GStrv from_uris, + const GStrv to_uris); + void (*move) (TumblerCache *cache, + const GStrv from_uris, + const GStrv to_uris); + gboolean (*is_thumbnail) (TumblerCache *cache, + const gchar *uri); + GList *(*get_flavors) (TumblerCache *cache); }; -GType tumbler_cache_get_type (void) G_GNUC_CONST; +GType tumbler_cache_get_type (void) G_GNUC_CONST; -TumblerCache *tumbler_cache_get_default (void) G_GNUC_WARN_UNUSED_RESULT; +TumblerCache *tumbler_cache_get_default (void) G_GNUC_WARN_UNUSED_RESULT; -GList *tumbler_cache_get_thumbnails (TumblerCache *cache, - const gchar *uri) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; -void tumbler_cache_cleanup (TumblerCache *cache, - const gchar *uri_prefix, - guint64 since); -void tumbler_cache_delete (TumblerCache *cache, - const GStrv uris); -void tumbler_cache_copy (TumblerCache *cache, - const GStrv from_uris, - const GStrv to_uris); -void tumbler_cache_move (TumblerCache *cache, - const GStrv from_uris, - const GStrv to_uris); -gboolean tumbler_cache_is_thumbnail (TumblerCache *cache, - const gchar *uri); +TumblerThumbnail *tumbler_cache_get_thumbnail (TumblerCache *cache, + const gchar *uri, + TumblerThumbnailFlavor *flavor) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +void tumbler_cache_cleanup (TumblerCache *cache, + const gchar *uri_prefix, + guint64 since); +void tumbler_cache_delete (TumblerCache *cache, + const GStrv uris); +void tumbler_cache_copy (TumblerCache *cache, + const GStrv from_uris, + const GStrv to_uris); +void tumbler_cache_move (TumblerCache *cache, + const GStrv from_uris, + const GStrv to_uris); +gboolean tumbler_cache_is_thumbnail (TumblerCache *cache, + const gchar *uri); +GList *tumbler_cache_get_flavors (TumblerCache *cache) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +TumblerThumbnailFlavor *tumbler_cache_get_flavor (TumblerCache *cache, + const gchar *name) G_GNUC_WARN_UNUSED_RESULT; G_END_DECLS |