154 lines
6.2 KiB
C
154 lines
6.2 KiB
C
/* PIKA - Photo and Image Kooker Application
|
|
* a rebranding of The GNU Image Manipulation Program (created with heckimp)
|
|
* A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
|
|
*
|
|
* Original copyright, applying to most contents (license remains unchanged):
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
*
|
|
* pikadata.h
|
|
* Copyright (C) 2001 Michael Natterer <mitch@gimp.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 3 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, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef __PIKA_DATA_H__
|
|
#define __PIKA_DATA_H__
|
|
|
|
|
|
#include "pikaresource.h"
|
|
|
|
|
|
typedef enum
|
|
{
|
|
PIKA_DATA_ERROR_OPEN, /* opening data file failed */
|
|
PIKA_DATA_ERROR_READ, /* reading data file failed */
|
|
PIKA_DATA_ERROR_WRITE, /* writing data file failed */
|
|
PIKA_DATA_ERROR_DELETE /* deleting data file failed */
|
|
} PikaDataError;
|
|
|
|
|
|
#define PIKA_TYPE_DATA (pika_data_get_type ())
|
|
#define PIKA_DATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_DATA, PikaData))
|
|
#define PIKA_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_DATA, PikaDataClass))
|
|
#define PIKA_IS_DATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_DATA))
|
|
#define PIKA_IS_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_DATA))
|
|
#define PIKA_DATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_DATA, PikaDataClass))
|
|
|
|
|
|
typedef struct _PikaDataPrivate PikaDataPrivate;
|
|
typedef struct _PikaDataClass PikaDataClass;
|
|
|
|
struct _PikaData
|
|
{
|
|
PikaResource parent_instance;
|
|
|
|
PikaDataPrivate *priv;
|
|
};
|
|
|
|
struct _PikaDataClass
|
|
{
|
|
PikaResourceClass parent_class;
|
|
|
|
/* signals */
|
|
void (* dirty) (PikaData *data);
|
|
|
|
/* virtual functions */
|
|
gboolean (* save) (PikaData *data,
|
|
GOutputStream *output,
|
|
GError **error);
|
|
const gchar * (* get_extension) (PikaData *data);
|
|
void (* copy) (PikaData *data,
|
|
PikaData *src_data);
|
|
PikaData * (* duplicate) (PikaData *data);
|
|
gint (* compare) (PikaData *data1,
|
|
PikaData *data2);
|
|
};
|
|
|
|
|
|
GType pika_data_get_type (void) G_GNUC_CONST;
|
|
|
|
gint pika_data_get_id (PikaData *data);
|
|
PikaData * pika_data_get_by_id (gint id);
|
|
|
|
gboolean pika_data_save (PikaData *data,
|
|
GError **error);
|
|
|
|
void pika_data_dirty (PikaData *data);
|
|
void pika_data_clean (PikaData *data);
|
|
gboolean pika_data_is_dirty (PikaData *data);
|
|
|
|
void pika_data_freeze (PikaData *data);
|
|
void pika_data_thaw (PikaData *data);
|
|
gboolean pika_data_is_frozen (PikaData *data);
|
|
|
|
gboolean pika_data_delete_from_disk (PikaData *data,
|
|
GError **error);
|
|
|
|
const gchar * pika_data_get_extension (PikaData *data);
|
|
|
|
void pika_data_set_file (PikaData *data,
|
|
GFile *file,
|
|
gboolean writable,
|
|
gboolean deletable);
|
|
GFile * pika_data_get_file (PikaData *data);
|
|
void pika_data_set_image (PikaData *data,
|
|
PikaImage *image,
|
|
gboolean writable,
|
|
gboolean deletable);
|
|
PikaImage * pika_data_get_image (PikaData *data);
|
|
|
|
void pika_data_create_filename (PikaData *data,
|
|
GFile *dest_dir);
|
|
|
|
void pika_data_set_folder_tags (PikaData *data,
|
|
GFile *top_directory);
|
|
|
|
const gchar * pika_data_get_mime_type (PikaData *data);
|
|
|
|
gboolean pika_data_is_writable (PikaData *data);
|
|
gboolean pika_data_is_deletable (PikaData *data);
|
|
|
|
void pika_data_set_mtime (PikaData *data,
|
|
gint64 mtime);
|
|
gint64 pika_data_get_mtime (PikaData *data);
|
|
|
|
gboolean pika_data_is_copyable (PikaData *data);
|
|
void pika_data_copy (PikaData *data,
|
|
PikaData *src_data);
|
|
|
|
gboolean pika_data_is_duplicatable (PikaData *data);
|
|
PikaData * pika_data_duplicate (PikaData *data);
|
|
|
|
void pika_data_make_internal (PikaData *data,
|
|
const gchar *collection);
|
|
gboolean pika_data_is_internal (PikaData *data);
|
|
|
|
gint pika_data_compare (PikaData *data1,
|
|
PikaData *data2);
|
|
gboolean pika_data_identify (PikaData *data,
|
|
const gchar *name,
|
|
const gchar *collection_id,
|
|
gboolean is_internal);
|
|
void pika_data_get_identifiers (PikaData *data,
|
|
gchar **name,
|
|
gchar **collection_id,
|
|
gboolean *is_internal);
|
|
|
|
#define PIKA_DATA_ERROR (pika_data_error_quark ())
|
|
|
|
GQuark pika_data_error_quark (void) G_GNUC_CONST;
|
|
|
|
|
|
#endif /* __PIKA_DATA_H__ */
|