PIKApp/app/plug-in/pikaplugin-context.c

86 lines
2.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
*
* pikaplugin-context.c
*
* 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/>.
*/
#include "config.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gegl.h>
#include "plug-in-types.h"
#include "core/pika.h"
#include "pdb/pikapdbcontext.h"
#include "pikaplugin.h"
#include "pikaplugin-context.h"
#include "pikapluginmanager.h"
gboolean
pika_plug_in_context_push (PikaPlugIn *plug_in)
{
PikaPlugInProcFrame *proc_frame;
PikaContext *parent;
PikaContext *context;
g_return_val_if_fail (PIKA_IS_PLUG_IN (plug_in), FALSE);
proc_frame = pika_plug_in_get_proc_frame (plug_in);
if (proc_frame->context_stack)
parent = proc_frame->context_stack->data;
else
parent = proc_frame->main_context;
context = pika_pdb_context_new (plug_in->manager->pika, parent, FALSE);
proc_frame->context_stack = g_list_prepend (proc_frame->context_stack,
context);
return TRUE;
}
gboolean
pika_plug_in_context_pop (PikaPlugIn *plug_in)
{
PikaPlugInProcFrame *proc_frame;
g_return_val_if_fail (PIKA_IS_PLUG_IN (plug_in), FALSE);
proc_frame = pika_plug_in_get_proc_frame (plug_in);
if (proc_frame->context_stack)
{
PikaContext *context = proc_frame->context_stack->data;
proc_frame->context_stack = g_list_remove (proc_frame->context_stack,
context);
g_object_unref (context);
return TRUE;
}
return FALSE;
}