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-thumbnail-flavor.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-thumbnail-flavor.h')
-rw-r--r-- | tumbler/tumbler-thumbnail-flavor.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tumbler/tumbler-thumbnail-flavor.h b/tumbler/tumbler-thumbnail-flavor.h new file mode 100644 index 0000000..f442166 --- /dev/null +++ b/tumbler/tumbler-thumbnail-flavor.h @@ -0,0 +1,57 @@ +/* vi:set et ai sw=2 sts=2 ts=2: */ +/*- + * Copyright (c) 2009 Jannis Pohlmann <jannis@xfce.org> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#if !defined (TUMBLER_INSIDE_TUMBLER_H) && !defined (TUMBLER_COMPILATION) +#error "Only <tumbler/tumbler.h> may be included directly. This file might disappear or change contents." +#endif + +#ifndef __TUMBLER_THUMBNAIL_FLAVOR_H__ +#define __TUMBLER_THUMBNAIL_FLAVOR_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define TUMBLER_TYPE_THUMBNAIL_FLAVOR (tumbler_thumbnail_flavor_get_type ()) +#define TUMBLER_THUMBNAIL_FLAVOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUMBLER_TYPE_THUMBNAIL_FLAVOR, TumblerThumbnailFlavor)) +#define TUMBLER_THUMBNAIL_FLAVOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUMBLER_TYPE_THUMBNAIL_FLAVOR, TumblerThumbnailFlavorClass)) +#define TUMBLER_IS_THUMBNAIL_FLAVOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUMBLER_TYPE_THUMBNAIL_FLAVOR)) +#define TUMBLER_IS_THUMBNAIL_FLAVOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUMBLER_TYPE_THUMBNAIL_FLAVOR) +#define TUMBLER_THUMBNAIL_FLAVOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUMBLER_TYPE_THUMBNAIL_FLAVOR, TumblerThumbnailFlavorClass)) + +typedef struct _TumblerThumbnailFlavorPrivate TumblerThumbnailFlavorPrivate; +typedef struct _TumblerThumbnailFlavorClass TumblerThumbnailFlavorClass; +typedef struct _TumblerThumbnailFlavor TumblerThumbnailFlavor; + +GType tumbler_thumbnail_flavor_get_type (void) G_GNUC_CONST; + +TumblerThumbnailFlavor *tumbler_thumbnail_flavor_new (const gchar *name, + gint width, + gint height) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +TumblerThumbnailFlavor *tumbler_thumbnail_flavor_new_normal (void) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +TumblerThumbnailFlavor *tumbler_thumbnail_flavor_new_large (void) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +const gchar *tumbler_thumbnail_flavor_get_name (TumblerThumbnailFlavor *flavor); +void tumbler_thumbnail_flavor_get_size (TumblerThumbnailFlavor *flavor, + gint *width, + gint *height); + +G_END_DECLS + +#endif /* !__TUMBLER_THUMBNAIL_FLAVOR_H__ */ |