PIKApp/libpikathumb/pikathumbnail.h

142 lines
5.5 KiB
C

/* LIBPIKA - The PIKA Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* Thumbnail handling according to the Thumbnail Managing Standard.
* https://specifications.freedesktop.org/thumbnail-spec/
*
* Copyright (C) 2001-2004 Sven Neumann <sven@gimp.org>
* Michael Natterer <mitch@gimp.org>
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
*/
#if !defined (__PIKA_THUMB_H_INSIDE__) && !defined (PIKA_THUMB_COMPILATION)
#error "Only <libpikathumb/pikathumb.h> can be included directly."
#endif
#ifndef __PIKA_THUMBNAIL_H__
#define __PIKA_THUMBNAIL_H__
G_BEGIN_DECLS
#define PIKA_TYPE_THUMBNAIL (pika_thumbnail_get_type ())
#define PIKA_THUMBNAIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_THUMBNAIL, PikaThumbnail))
#define PIKA_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_THUMBNAIL, PikaThumbnailClass))
#define PIKA_IS_THUMBNAIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_THUMBNAIL))
#define PIKA_IS_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_THUMBNAIL))
#define PIKA_THUMBNAIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_THUMBNAIL, PikaThumbnailClass))
typedef struct _PikaThumbnailPrivate PikaThumbnailPrivate;
typedef struct _PikaThumbnailClass PikaThumbnailClass;
/**
* PikaThumbnail:
*
* All members of #PikaThumbnail are private and should only be accessed
* using object properties.
**/
struct _PikaThumbnail
{
GObject parent_instance;
PikaThumbnailPrivate *priv;
/* FIXME MOVE TO PRIVATE */
/*< private >*/
PikaThumbState image_state;
gchar *image_uri;
gchar *image_filename;
gint64 image_filesize;
gint64 image_mtime;
gint image_not_found_errno;
gint image_width;
gint image_height;
gchar *image_type;
gint image_num_layers;
PikaThumbState thumb_state;
PikaThumbSize thumb_size;
gchar *thumb_filename;
gint64 thumb_filesize;
gint64 thumb_mtime;
gchar *image_mimetype;
};
struct _PikaThumbnailClass
{
GObjectClass parent_class;
/* Padding for future expansion */
void (* _pika_reserved1) (void);
void (* _pika_reserved2) (void);
void (* _pika_reserved3) (void);
void (* _pika_reserved4) (void);
void (* _pika_reserved5) (void);
void (* _pika_reserved6) (void);
void (* _pika_reserved7) (void);
void (* _pika_reserved8) (void);
};
GType pika_thumbnail_get_type (void) G_GNUC_CONST;
PikaThumbnail * pika_thumbnail_new (void);
void pika_thumbnail_set_uri (PikaThumbnail *thumbnail,
const gchar *uri);
gboolean pika_thumbnail_set_filename (PikaThumbnail *thumbnail,
const gchar *filename,
GError **error);
gboolean pika_thumbnail_set_from_thumb (PikaThumbnail *thumbnail,
const gchar *filename,
GError **error);
PikaThumbState pika_thumbnail_peek_image (PikaThumbnail *thumbnail);
PikaThumbState pika_thumbnail_peek_thumb (PikaThumbnail *thumbnail,
PikaThumbSize size);
PikaThumbState pika_thumbnail_check_thumb (PikaThumbnail *thumbnail,
PikaThumbSize size);
GdkPixbuf * pika_thumbnail_load_thumb (PikaThumbnail *thumbnail,
PikaThumbSize size,
GError **error);
gboolean pika_thumbnail_save_thumb (PikaThumbnail *thumbnail,
GdkPixbuf *pixbuf,
const gchar *software,
GError **error);
gboolean pika_thumbnail_save_thumb_local (PikaThumbnail *thumbnail,
GdkPixbuf *pixbuf,
const gchar *software,
GError **error);
gboolean pika_thumbnail_save_failure (PikaThumbnail *thumbnail,
const gchar *software,
GError **error);
void pika_thumbnail_delete_failure (PikaThumbnail *thumbnail);
void pika_thumbnail_delete_others (PikaThumbnail *thumbnail,
PikaThumbSize size);
gboolean pika_thumbnail_has_failed (PikaThumbnail *thumbnail);
G_END_DECLS
#endif /* __PIKA_THUMBNAIL_H__ */