/* 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-1997 Spencer Kimball and Peter Mattis
 *
 * pikaextensionmanager.h
 * Copyright (C) 2018 Jehan <jehan@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_EXTENSION_MANAGER_H__
#define __PIKA_EXTENSION_MANAGER_H__


#include "core/pikaobject.h"


#define PIKA_TYPE_EXTENSION_MANAGER            (pika_extension_manager_get_type ())
#define PIKA_EXTENSION_MANAGER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_EXTENSION_MANAGER, PikaExtensionManager))
#define PIKA_EXTENSION_MANAGER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_EXTENSION_MANAGER, PikaExtensionManagerClass))
#define PIKA_IS_EXTENSION_MANAGER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_EXTENSION_MANAGER))
#define PIKA_IS_EXTENSION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_EXTENSION_MANAGER))
#define PIKA_EXTENSION_MANAGER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_EXTENSION_MANAGER, PikaExtensionManagerClass))


typedef struct _PikaExtensionManagerClass   PikaExtensionManagerClass;
typedef struct _PikaExtensionManagerPrivate PikaExtensionManagerPrivate;

struct _PikaExtensionManager
{
  PikaObject                   parent_instance;

  PikaExtensionManagerPrivate *p;
};

struct _PikaExtensionManagerClass
{
  PikaObjectClass      parent_class;

  void              (* extension_installed) (PikaExtensionManager *manager,
                                             PikaExtension        *extension,
                                             gboolean              is_system_ext);
  void              (* extension_removed)   (PikaExtensionManager *manager,
                                             gchar                *extension_id);
};


GType                  pika_extension_manager_get_type              (void) G_GNUC_CONST;

PikaExtensionManager * pika_extension_manager_new                   (Pika                 *pika);

void                   pika_extension_manager_initialize            (PikaExtensionManager *manager);
void                   pika_extension_manager_exit                  (PikaExtensionManager *manager);

const GList          * pika_extension_manager_get_system_extensions (PikaExtensionManager *manager);
const GList          * pika_extension_manager_get_user_extensions   (PikaExtensionManager *manager);

gboolean               pika_extension_manager_is_running            (PikaExtensionManager *manager,
                                                                     PikaExtension        *extension);
gboolean               pika_extension_manager_can_run               (PikaExtensionManager *manager,
                                                                     PikaExtension        *extension);
gboolean               pika_extension_manager_is_removed            (PikaExtensionManager *manager,
                                                                     PikaExtension        *extension);

gboolean               pika_extension_manager_install               (PikaExtensionManager *manager,
                                                                     PikaExtension        *extension,
                                                                     GError              **error);
gboolean               pika_extension_manager_remove                (PikaExtensionManager *manager,
                                                                     PikaExtension        *extension,
                                                                     GError              **error);
gboolean               pika_extension_manager_undo_remove           (PikaExtensionManager *manager,
                                                                     PikaExtension        *extension,
                                                                     GError              **error);

#endif  /* __PIKA_EXTENSION_MANAGER_H__ */
