438 lines
17 KiB
C
438 lines
17 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-2003 Spencer Kimball and Peter Mattis
|
|
*
|
|
* 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/>.
|
|
*/
|
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl. */
|
|
|
|
#include "config.h"
|
|
|
|
#include "stamp-pdbgen.h"
|
|
|
|
#include <gegl.h>
|
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
|
|
|
#include "libpikabase/pikabase.h"
|
|
|
|
#include "libpikabase/pikabase.h"
|
|
|
|
#include "pdb-types.h"
|
|
|
|
#include "core/pika-parasites.h"
|
|
#include "core/pika-utils.h"
|
|
#include "core/pika.h"
|
|
#include "core/pikaparamspecs.h"
|
|
|
|
#include "pikapdb.h"
|
|
#include "pikaprocedure.h"
|
|
#include "internal-procs.h"
|
|
|
|
|
|
static PikaValueArray *
|
|
version_invoker (PikaProcedure *procedure,
|
|
Pika *pika,
|
|
PikaContext *context,
|
|
PikaProgress *progress,
|
|
const PikaValueArray *args,
|
|
GError **error)
|
|
{
|
|
PikaValueArray *return_vals;
|
|
gchar *version = NULL;
|
|
|
|
version = g_strdup (PIKA_VERSION);
|
|
|
|
return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
|
|
g_value_take_string (pika_value_array_index (return_vals, 1), version);
|
|
|
|
return return_vals;
|
|
}
|
|
|
|
static PikaValueArray *
|
|
getpid_invoker (PikaProcedure *procedure,
|
|
Pika *pika,
|
|
PikaContext *context,
|
|
PikaProgress *progress,
|
|
const PikaValueArray *args,
|
|
GError **error)
|
|
{
|
|
PikaValueArray *return_vals;
|
|
gint pid = 0;
|
|
|
|
pid = pika_get_pid ();
|
|
|
|
return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
|
|
g_value_set_int (pika_value_array_index (return_vals, 1), pid);
|
|
|
|
return return_vals;
|
|
}
|
|
|
|
static PikaValueArray *
|
|
quit_invoker (PikaProcedure *procedure,
|
|
Pika *pika,
|
|
PikaContext *context,
|
|
PikaProgress *progress,
|
|
const PikaValueArray *args,
|
|
GError **error)
|
|
{
|
|
gboolean success = TRUE;
|
|
gboolean force;
|
|
|
|
force = g_value_get_boolean (pika_value_array_index (args, 0));
|
|
|
|
if (success)
|
|
{
|
|
pika_exit (pika, force);
|
|
}
|
|
|
|
return pika_procedure_get_return_values (procedure, success,
|
|
error ? *error : NULL);
|
|
}
|
|
|
|
static PikaValueArray *
|
|
attach_parasite_invoker (PikaProcedure *procedure,
|
|
Pika *pika,
|
|
PikaContext *context,
|
|
PikaProgress *progress,
|
|
const PikaValueArray *args,
|
|
GError **error)
|
|
{
|
|
gboolean success = TRUE;
|
|
const PikaParasite *parasite;
|
|
|
|
parasite = g_value_get_boxed (pika_value_array_index (args, 0));
|
|
|
|
if (success)
|
|
{
|
|
if (pika_parasite_validate (pika, parasite, error))
|
|
pika_parasite_attach (pika, parasite);
|
|
else
|
|
success = FALSE;
|
|
}
|
|
|
|
return pika_procedure_get_return_values (procedure, success,
|
|
error ? *error : NULL);
|
|
}
|
|
|
|
static PikaValueArray *
|
|
detach_parasite_invoker (PikaProcedure *procedure,
|
|
Pika *pika,
|
|
PikaContext *context,
|
|
PikaProgress *progress,
|
|
const PikaValueArray *args,
|
|
GError **error)
|
|
{
|
|
gboolean success = TRUE;
|
|
const gchar *name;
|
|
|
|
name = g_value_get_string (pika_value_array_index (args, 0));
|
|
|
|
if (success)
|
|
{
|
|
pika_parasite_detach (pika, name);
|
|
}
|
|
|
|
return pika_procedure_get_return_values (procedure, success,
|
|
error ? *error : NULL);
|
|
}
|
|
|
|
static PikaValueArray *
|
|
get_parasite_invoker (PikaProcedure *procedure,
|
|
Pika *pika,
|
|
PikaContext *context,
|
|
PikaProgress *progress,
|
|
const PikaValueArray *args,
|
|
GError **error)
|
|
{
|
|
gboolean success = TRUE;
|
|
PikaValueArray *return_vals;
|
|
const gchar *name;
|
|
PikaParasite *parasite = NULL;
|
|
|
|
name = g_value_get_string (pika_value_array_index (args, 0));
|
|
|
|
if (success)
|
|
{
|
|
parasite = pika_parasite_copy (pika_parasite_find (pika, name));
|
|
|
|
if (! parasite)
|
|
success = FALSE;
|
|
}
|
|
|
|
return_vals = pika_procedure_get_return_values (procedure, success,
|
|
error ? *error : NULL);
|
|
|
|
if (success)
|
|
g_value_take_boxed (pika_value_array_index (return_vals, 1), parasite);
|
|
|
|
return return_vals;
|
|
}
|
|
|
|
static PikaValueArray *
|
|
get_parasite_list_invoker (PikaProcedure *procedure,
|
|
Pika *pika,
|
|
PikaContext *context,
|
|
PikaProgress *progress,
|
|
const PikaValueArray *args,
|
|
GError **error)
|
|
{
|
|
PikaValueArray *return_vals;
|
|
gchar **parasites = NULL;
|
|
|
|
parasites = pika_parasite_list (pika);
|
|
|
|
return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
|
|
g_value_take_boxed (pika_value_array_index (return_vals, 1), parasites);
|
|
|
|
return return_vals;
|
|
}
|
|
|
|
static PikaValueArray *
|
|
temp_file_invoker (PikaProcedure *procedure,
|
|
Pika *pika,
|
|
PikaContext *context,
|
|
PikaProgress *progress,
|
|
const PikaValueArray *args,
|
|
GError **error)
|
|
{
|
|
gboolean success = TRUE;
|
|
PikaValueArray *return_vals;
|
|
const gchar *extension;
|
|
GFile *file = NULL;
|
|
|
|
extension = g_value_get_string (pika_value_array_index (args, 0));
|
|
|
|
if (success)
|
|
{
|
|
file = pika_get_temp_file (pika, extension);
|
|
}
|
|
|
|
return_vals = pika_procedure_get_return_values (procedure, success,
|
|
error ? *error : NULL);
|
|
|
|
if (success)
|
|
g_value_set_object (pika_value_array_index (return_vals, 1), file);
|
|
|
|
return return_vals;
|
|
}
|
|
|
|
void
|
|
register_pika_procs (PikaPDB *pdb)
|
|
{
|
|
PikaProcedure *procedure;
|
|
|
|
/*
|
|
* pika-version
|
|
*/
|
|
procedure = pika_procedure_new (version_invoker);
|
|
pika_object_set_static_name (PIKA_OBJECT (procedure),
|
|
"pika-version");
|
|
pika_procedure_set_static_help (procedure,
|
|
"Returns the host PIKA version.",
|
|
"This procedure returns the version number of the currently running PIKA.",
|
|
NULL);
|
|
pika_procedure_set_static_attribution (procedure,
|
|
"Manish Singh",
|
|
"Manish Singh",
|
|
"1999");
|
|
pika_procedure_add_return_value (procedure,
|
|
pika_param_spec_string ("version",
|
|
"version",
|
|
"PIKA version number",
|
|
FALSE, FALSE, FALSE,
|
|
NULL,
|
|
PIKA_PARAM_READWRITE));
|
|
pika_pdb_register_procedure (pdb, procedure);
|
|
g_object_unref (procedure);
|
|
|
|
/*
|
|
* pika-getpid
|
|
*/
|
|
procedure = pika_procedure_new (getpid_invoker);
|
|
pika_object_set_static_name (PIKA_OBJECT (procedure),
|
|
"pika-getpid");
|
|
pika_procedure_set_static_help (procedure,
|
|
"Returns the PID of the host PIKA process.",
|
|
"This procedure returns the process ID of the currently running PIKA.",
|
|
NULL);
|
|
pika_procedure_set_static_attribution (procedure,
|
|
"Michael Natterer <mitch@gimp.org>",
|
|
"Michael Natterer",
|
|
"2005");
|
|
pika_procedure_add_return_value (procedure,
|
|
g_param_spec_int ("pid",
|
|
"pid",
|
|
"The PID",
|
|
G_MININT32, G_MAXINT32, 0,
|
|
PIKA_PARAM_READWRITE));
|
|
pika_pdb_register_procedure (pdb, procedure);
|
|
g_object_unref (procedure);
|
|
|
|
/*
|
|
* pika-quit
|
|
*/
|
|
procedure = pika_procedure_new (quit_invoker);
|
|
pika_object_set_static_name (PIKA_OBJECT (procedure),
|
|
"pika-quit");
|
|
pika_procedure_set_static_help (procedure,
|
|
"Causes PIKA to exit gracefully.",
|
|
"If there are unsaved images in an interactive PIKA session, the user will be asked for confirmation. If force is TRUE, the application is quit without querying the user to save any dirty images.",
|
|
NULL);
|
|
pika_procedure_set_static_attribution (procedure,
|
|
"Spencer Kimball & Peter Mattis",
|
|
"Spencer Kimball & Peter Mattis",
|
|
"1995-1996");
|
|
pika_procedure_add_argument (procedure,
|
|
g_param_spec_boolean ("force",
|
|
"force",
|
|
"Force PIKA to quit without asking",
|
|
FALSE,
|
|
PIKA_PARAM_READWRITE));
|
|
pika_pdb_register_procedure (pdb, procedure);
|
|
g_object_unref (procedure);
|
|
|
|
/*
|
|
* pika-attach-parasite
|
|
*/
|
|
procedure = pika_procedure_new (attach_parasite_invoker);
|
|
pika_object_set_static_name (PIKA_OBJECT (procedure),
|
|
"pika-attach-parasite");
|
|
pika_procedure_set_static_help (procedure,
|
|
"Add a global parasite.",
|
|
"This procedure attaches a global parasite. It has no return values.",
|
|
NULL);
|
|
pika_procedure_set_static_attribution (procedure,
|
|
"Jay Cox",
|
|
"Jay Cox",
|
|
"1998");
|
|
pika_procedure_add_argument (procedure,
|
|
pika_param_spec_parasite ("parasite",
|
|
"parasite",
|
|
"The parasite to attach",
|
|
PIKA_PARAM_READWRITE));
|
|
pika_pdb_register_procedure (pdb, procedure);
|
|
g_object_unref (procedure);
|
|
|
|
/*
|
|
* pika-detach-parasite
|
|
*/
|
|
procedure = pika_procedure_new (detach_parasite_invoker);
|
|
pika_object_set_static_name (PIKA_OBJECT (procedure),
|
|
"pika-detach-parasite");
|
|
pika_procedure_set_static_help (procedure,
|
|
"Removes a global parasite.",
|
|
"This procedure detaches a global parasite from. It has no return values.",
|
|
NULL);
|
|
pika_procedure_set_static_attribution (procedure,
|
|
"Jay Cox",
|
|
"Jay Cox",
|
|
"1998");
|
|
pika_procedure_add_argument (procedure,
|
|
pika_param_spec_string ("name",
|
|
"name",
|
|
"The name of the parasite to detach.",
|
|
FALSE, FALSE, FALSE,
|
|
NULL,
|
|
PIKA_PARAM_READWRITE));
|
|
pika_pdb_register_procedure (pdb, procedure);
|
|
g_object_unref (procedure);
|
|
|
|
/*
|
|
* pika-get-parasite
|
|
*/
|
|
procedure = pika_procedure_new (get_parasite_invoker);
|
|
pika_object_set_static_name (PIKA_OBJECT (procedure),
|
|
"pika-get-parasite");
|
|
pika_procedure_set_static_help (procedure,
|
|
"Look up a global parasite.",
|
|
"Finds and returns the global parasite that was previously attached.",
|
|
NULL);
|
|
pika_procedure_set_static_attribution (procedure,
|
|
"Jay Cox",
|
|
"Jay Cox",
|
|
"1998");
|
|
pika_procedure_add_argument (procedure,
|
|
pika_param_spec_string ("name",
|
|
"name",
|
|
"The name of the parasite to find",
|
|
FALSE, FALSE, FALSE,
|
|
NULL,
|
|
PIKA_PARAM_READWRITE));
|
|
pika_procedure_add_return_value (procedure,
|
|
pika_param_spec_parasite ("parasite",
|
|
"parasite",
|
|
"The found parasite",
|
|
PIKA_PARAM_READWRITE));
|
|
pika_pdb_register_procedure (pdb, procedure);
|
|
g_object_unref (procedure);
|
|
|
|
/*
|
|
* pika-get-parasite-list
|
|
*/
|
|
procedure = pika_procedure_new (get_parasite_list_invoker);
|
|
pika_object_set_static_name (PIKA_OBJECT (procedure),
|
|
"pika-get-parasite-list");
|
|
pika_procedure_set_static_help (procedure,
|
|
"List all parasites.",
|
|
"Returns a list of all currently attached global parasites.",
|
|
NULL);
|
|
pika_procedure_set_static_attribution (procedure,
|
|
"Marc Lehmann",
|
|
"Marc Lehmann",
|
|
"1999");
|
|
pika_procedure_add_return_value (procedure,
|
|
g_param_spec_boxed ("parasites",
|
|
"parasites",
|
|
"The names of currently attached parasites",
|
|
G_TYPE_STRV,
|
|
PIKA_PARAM_READWRITE));
|
|
pika_pdb_register_procedure (pdb, procedure);
|
|
g_object_unref (procedure);
|
|
|
|
/*
|
|
* pika-temp-file
|
|
*/
|
|
procedure = pika_procedure_new (temp_file_invoker);
|
|
pika_object_set_static_name (PIKA_OBJECT (procedure),
|
|
"pika-temp-file");
|
|
pika_procedure_set_static_help (procedure,
|
|
"Generates a unique temporary file.",
|
|
"Generates a unique file using the temp path supplied in the user's pikarc.",
|
|
NULL);
|
|
pika_procedure_set_static_attribution (procedure,
|
|
"Josh MacDonald",
|
|
"Josh MacDonald",
|
|
"1997");
|
|
pika_procedure_add_argument (procedure,
|
|
pika_param_spec_string ("extension",
|
|
"extension",
|
|
"The extension the file will have",
|
|
TRUE, TRUE, FALSE,
|
|
NULL,
|
|
PIKA_PARAM_READWRITE));
|
|
pika_procedure_add_return_value (procedure,
|
|
g_param_spec_object ("file",
|
|
"file",
|
|
"The new temp file",
|
|
G_TYPE_FILE,
|
|
PIKA_PARAM_READWRITE));
|
|
pika_pdb_register_procedure (pdb, procedure);
|
|
g_object_unref (procedure);
|
|
}
|