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-thumbnailer.c | |
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-thumbnailer.c')
-rw-r--r-- | tumbler/tumbler-thumbnailer.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/tumbler/tumbler-thumbnailer.c b/tumbler/tumbler-thumbnailer.c index 980db15..588cfa2 100644 --- a/tumbler/tumbler-thumbnailer.c +++ b/tumbler/tumbler-thumbnailer.c @@ -23,6 +23,7 @@ #endif #include <tumbler/tumbler-marshal.h> +#include <tumbler/tumbler-file-info.h> #include <tumbler/tumbler-thumbnailer.h> @@ -136,22 +137,17 @@ tumbler_thumbnailer_class_init (TumblerThumbnailerIface *klass) void -tumbler_thumbnailer_create (TumblerThumbnailer *thumbnailer, - GCancellable *cancellable, - const gchar *uri, - const gchar *mime_hint, - const gchar *flavor) +tumbler_thumbnailer_create (TumblerThumbnailer *thumbnailer, + GCancellable *cancellable, + TumblerFileInfo *info) { g_return_if_fail (TUMBLER_IS_THUMBNAILER (thumbnailer)); - g_return_if_fail (uri != NULL); - g_return_if_fail (mime_hint != NULL); + g_return_if_fail (TUMBLER_IS_FILE_INFO (info)); g_return_if_fail (TUMBLER_THUMBNAILER_GET_IFACE (thumbnailer)->create != NULL); return (*TUMBLER_THUMBNAILER_GET_IFACE (thumbnailer)->create) (thumbnailer, cancellable, - uri, - mime_hint, - flavor); + info); } @@ -197,14 +193,14 @@ tumbler_thumbnailer_get_uri_schemes (TumblerThumbnailer *thumbnailer) TumblerThumbnailer ** tumbler_thumbnailer_array_copy (TumblerThumbnailer **thumbnailers, - gint length) + guint length) { TumblerThumbnailer **copy; - gint n; + guint n; g_return_val_if_fail (thumbnailers != NULL, NULL); - copy = g_new0 (TumblerThumbnailer *, length+1); + copy = g_new0 (TumblerThumbnailer *, length + 1); for (n = 0; n < length; ++n) if (thumbnailers[n] != NULL) @@ -219,9 +215,9 @@ tumbler_thumbnailer_array_copy (TumblerThumbnailer **thumbnailers, void tumbler_thumbnailer_array_free (TumblerThumbnailer **thumbnailers, - gint length) + guint length) { - gint n; + guint n; for (n = 0; thumbnailers != NULL && n < length; ++n) if (thumbnailers[n] != NULL) |