PIKApp/app/core/pikadatafactory.h

131 lines
6.4 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
*
* pikadatafactory.h
* Copyright (C) 2001-2018 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_FACTORY_H__
#define __PIKA_DATA_FACTORY_H__
#include "pikaobject.h"
typedef PikaData * (* PikaDataNewFunc) (PikaContext *context,
const gchar *name);
typedef PikaData * (* PikaDataGetStandardFunc) (PikaContext *context);
typedef void (* PikaDataForeachFunc) (PikaDataFactory *factory,
PikaData *data,
gpointer user_data);
#define PIKA_TYPE_DATA_FACTORY (pika_data_factory_get_type ())
#define PIKA_DATA_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_DATA_FACTORY, PikaDataFactory))
#define PIKA_DATA_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_DATA_FACTORY, PikaDataFactoryClass))
#define PIKA_IS_DATA_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_DATA_FACTORY))
#define PIKA_IS_DATA_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_DATA_FACTORY))
#define PIKA_DATA_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_DATA_FACTORY, PikaDataFactoryClass))
typedef struct _PikaDataFactoryPrivate PikaDataFactoryPrivate;
typedef struct _PikaDataFactoryClass PikaDataFactoryClass;
struct _PikaDataFactory
{
PikaObject parent_instance;
PikaDataFactoryPrivate *priv;
};
struct _PikaDataFactoryClass
{
PikaObjectClass parent_class;
void (* data_init) (PikaDataFactory *factory,
PikaContext *context);
void (* data_refresh) (PikaDataFactory *factory,
PikaContext *context);
void (* data_save) (PikaDataFactory *factory);
void (* data_cancel) (PikaDataFactory *factory);
PikaData * (* data_duplicate) (PikaDataFactory *factory,
PikaData *data);
gboolean (* data_delete) (PikaDataFactory *factory,
PikaData *data,
gboolean delete_from_disk,
GError **error);
};
GType pika_data_factory_get_type (void) G_GNUC_CONST;
void pika_data_factory_data_init (PikaDataFactory *factory,
PikaContext *context,
gboolean no_data);
void pika_data_factory_data_clean (PikaDataFactory *factory);
void pika_data_factory_data_refresh (PikaDataFactory *factory,
PikaContext *context);
void pika_data_factory_data_save (PikaDataFactory *factory);
void pika_data_factory_data_free (PikaDataFactory *factory);
PikaAsyncSet * pika_data_factory_get_async_set (PikaDataFactory *factory);
gboolean pika_data_factory_data_wait (PikaDataFactory *factory);
void pika_data_factory_data_cancel (PikaDataFactory *factory);
gboolean pika_data_factory_has_data_new_func (PikaDataFactory *factory);
PikaData * pika_data_factory_data_new (PikaDataFactory *factory,
PikaContext *context,
const gchar *name);
PikaData * pika_data_factory_data_get_standard (PikaDataFactory *factory,
PikaContext *context);
PikaData * pika_data_factory_data_duplicate (PikaDataFactory *factory,
PikaData *data);
gboolean pika_data_factory_data_delete (PikaDataFactory *factory,
PikaData *data,
gboolean delete_from_disk,
GError **error);
gboolean pika_data_factory_data_save_single (PikaDataFactory *factory,
PikaData *data,
GError **error);
void pika_data_factory_data_foreach (PikaDataFactory *factory,
gboolean skip_internal,
PikaDataForeachFunc callback,
gpointer user_data);
Pika * pika_data_factory_get_pika (PikaDataFactory *factory);
GType pika_data_factory_get_data_type (PikaDataFactory *factory);
PikaContainer * pika_data_factory_get_container (PikaDataFactory *factory);
PikaContainer * pika_data_factory_get_container_obsolete
(PikaDataFactory *factory);
GList * pika_data_factory_get_data_path (PikaDataFactory *factory);
GList * pika_data_factory_get_data_path_writable
(PikaDataFactory *factory);
const GList * pika_data_factory_get_data_path_ext (PikaDataFactory *factory);
#endif /* __PIKA_DATA_FACTORY_H__ */