PIKApp/app/pdb/resource-cmds.c

960 lines
42 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 "pdb-types.h"
#include "core/pikabrush.h"
#include "core/pikadatafactory.h"
#include "core/pikagradient.h"
#include "core/pikapalette.h"
#include "core/pikaparamspecs.h"
#include "core/pikapattern.h"
#include "core/pikaresource.h"
#include "text/pikafont.h"
#include "pikapdb.h"
#include "pikapdberror.h"
#include "pikapdb-utils.h"
#include "pikaprocedure.h"
#include "internal-procs.h"
#include "pika-intl.h"
static PikaValueArray *
resource_get_by_name_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
const gchar *type_name;
const gchar *resource_name;
PikaResource *resource = NULL;
type_name = g_value_get_string (pika_value_array_index (args, 0));
resource_name = g_value_get_string (pika_value_array_index (args, 1));
if (success)
{
resource = pika_pdb_get_resource (pika, g_type_from_name (type_name), resource_name,
PIKA_PDB_DATA_ACCESS_READ, error);
if (! resource)
success = FALSE;
}
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), resource);
return return_vals;
}
static PikaValueArray *
resource_get_by_identifiers_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
const gchar *type_name;
const gchar *resource_name;
const gchar *collection;
gboolean is_internal;
PikaResource *resource = NULL;
type_name = g_value_get_string (pika_value_array_index (args, 0));
resource_name = g_value_get_string (pika_value_array_index (args, 1));
collection = g_value_get_string (pika_value_array_index (args, 2));
is_internal = g_value_get_boolean (pika_value_array_index (args, 3));
if (success)
{
resource = pika_pdb_get_resource_by_id (pika, g_type_from_name (type_name),
resource_name, collection, is_internal,
PIKA_PDB_DATA_ACCESS_READ, error);
if (! resource)
success = FALSE;
}
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), resource);
return return_vals;
}
static PikaValueArray *
resource_id_is_valid_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
gint resource_id;
gboolean valid = FALSE;
resource_id = g_value_get_int (pika_value_array_index (args, 0));
if (success)
{
PikaData *data = pika_data_get_by_id (resource_id);
valid = PIKA_IS_DATA (data);
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_boolean (pika_value_array_index (return_vals, 1), valid);
return return_vals;
}
static PikaValueArray *
resource_id_is_brush_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
gint resource_id;
gboolean brush = FALSE;
resource_id = g_value_get_int (pika_value_array_index (args, 0));
if (success)
{
PikaData *data = pika_data_get_by_id (resource_id);
brush = PIKA_IS_BRUSH (data);
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_boolean (pika_value_array_index (return_vals, 1), brush);
return return_vals;
}
static PikaValueArray *
resource_id_is_pattern_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
gint resource_id;
gboolean pattern = FALSE;
resource_id = g_value_get_int (pika_value_array_index (args, 0));
if (success)
{
PikaData *data = pika_data_get_by_id (resource_id);
pattern = PIKA_IS_PATTERN (data);
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_boolean (pika_value_array_index (return_vals, 1), pattern);
return return_vals;
}
static PikaValueArray *
resource_id_is_gradient_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
gint resource_id;
gboolean gradient = FALSE;
resource_id = g_value_get_int (pika_value_array_index (args, 0));
if (success)
{
PikaData *data = pika_data_get_by_id (resource_id);
gradient = PIKA_IS_GRADIENT (data);
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_boolean (pika_value_array_index (return_vals, 1), gradient);
return return_vals;
}
static PikaValueArray *
resource_id_is_palette_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
gint resource_id;
gboolean palette = FALSE;
resource_id = g_value_get_int (pika_value_array_index (args, 0));
if (success)
{
PikaData *data = pika_data_get_by_id (resource_id);
palette = PIKA_IS_PALETTE (data);
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_boolean (pika_value_array_index (return_vals, 1), palette);
return return_vals;
}
static PikaValueArray *
resource_id_is_font_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
gint resource_id;
gboolean font = FALSE;
resource_id = g_value_get_int (pika_value_array_index (args, 0));
if (success)
{
PikaData *data = pika_data_get_by_id (resource_id);
font = PIKA_IS_FONT (data);
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_boolean (pika_value_array_index (return_vals, 1), font);
return return_vals;
}
static PikaValueArray *
resource_get_name_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaResource *resource;
gchar *name = NULL;
resource = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
name = g_strdup (pika_object_get_name (PIKA_OBJECT (resource)));
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_take_string (pika_value_array_index (return_vals, 1), name);
return return_vals;
}
static PikaValueArray *
resource_get_identifiers_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaResource *resource;
gboolean is_internal = FALSE;
gchar *name = NULL;
gchar *collection_id = NULL;
resource = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
pika_data_get_identifiers (PIKA_DATA (resource), &name, &collection_id, &is_internal);
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
{
g_value_set_boolean (pika_value_array_index (return_vals, 1), is_internal);
g_value_take_string (pika_value_array_index (return_vals, 2), name);
g_value_take_string (pika_value_array_index (return_vals, 3), collection_id);
}
return return_vals;
}
static PikaValueArray *
resource_is_editable_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaResource *resource;
gboolean editable = FALSE;
resource = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
editable = pika_data_is_writable (PIKA_DATA (resource));
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_boolean (pika_value_array_index (return_vals, 1), editable);
return return_vals;
}
static PikaValueArray *
resource_duplicate_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaResource *resource;
PikaResource *resource_copy = NULL;
resource = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
PikaDataFactory *factory;
factory = pika_pdb_get_data_factory (pika, G_TYPE_FROM_INSTANCE (resource));
resource_copy = (PikaResource *)
pika_data_factory_data_duplicate (factory, PIKA_DATA (resource));
if (! resource_copy)
success = FALSE;
}
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), resource_copy);
return return_vals;
}
static PikaValueArray *
resource_rename_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaResource *resource;
const gchar *new_name;
resource = g_value_get_object (pika_value_array_index (args, 0));
new_name = g_value_get_string (pika_value_array_index (args, 1));
if (success)
{
if (pika_viewable_is_name_editable (PIKA_VIEWABLE (resource)))
{
pika_object_set_name (PIKA_OBJECT (resource), new_name);
}
else
{
g_set_error (error, PIKA_PDB_ERROR, PIKA_PDB_ERROR_INVALID_ARGUMENT,
_("Resource '%s' is not renamable"),
pika_object_get_name (PIKA_OBJECT (resource)));
success = FALSE;
}
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
resource_delete_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaResource *resource;
resource = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
PikaDataFactory *factory;
factory = pika_pdb_get_data_factory (pika, G_TYPE_FROM_INSTANCE (resource));
if (pika_data_is_deletable (PIKA_DATA (resource)))
success = pika_data_factory_data_delete (factory, PIKA_DATA (resource),
TRUE, error);
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
void
register_resource_procs (PikaPDB *pdb)
{
PikaProcedure *procedure;
/*
* pika-resource-get-by-name
*/
procedure = pika_procedure_new (resource_get_by_name_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-resource-get-by-name");
pika_procedure_set_static_help (procedure,
"Returns a resource with the given name.",
"Returns a resource with the given name.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Jehan",
"Jehan",
"2023");
pika_procedure_add_argument (procedure,
pika_param_spec_string ("type-name",
"type name",
"The name of the resource type",
FALSE, FALSE, TRUE,
NULL,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
pika_param_spec_string ("resource-name",
"resource name",
"The name of the resource",
FALSE, FALSE, TRUE,
NULL,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
pika_param_spec_resource ("resource",
"resource",
"The resource",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-resource-get-by-identifiers
*/
procedure = pika_procedure_new (resource_get_by_identifiers_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-resource-get-by-identifiers");
pika_procedure_set_static_help (procedure,
"Returns the resource contained in a given file with a given name.",
"Returns a resource specifically stored in a given file path, under a given name (a single path may be a collection containing several resources).",
NULL);
pika_procedure_set_static_attribution (procedure,
"Jehan",
"Jehan",
"2023");
pika_procedure_add_argument (procedure,
pika_param_spec_string ("type-name",
"type name",
"The name of the resource type",
FALSE, FALSE, TRUE,
NULL,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
pika_param_spec_string ("resource-name",
"resource name",
"The name of the resource",
FALSE, FALSE, TRUE,
NULL,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
pika_param_spec_string ("collection",
"collection",
"The collection identifier",
FALSE, FALSE, TRUE,
NULL,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_boolean ("is-internal",
"is internal",
"Whether this is the identifier for internal data",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
pika_param_spec_resource ("resource",
"resource",
"The resource",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-resource-id-is-valid
*/
procedure = pika_procedure_new (resource_id_is_valid_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-resource-id-is-valid");
pika_procedure_set_static_help (procedure,
"Returns TRUE if the resource ID is valid.",
"This procedure checks if the given resource ID is valid and refers to an existing resource.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2023");
pika_procedure_add_argument (procedure,
g_param_spec_int ("resource-id",
"resource id",
"The resource ID to check",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_boolean ("valid",
"valid",
"Whether the resource ID is valid",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-resource-id-is-brush
*/
procedure = pika_procedure_new (resource_id_is_brush_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-resource-id-is-brush");
pika_procedure_set_static_help (procedure,
"Returns whether the resource ID is a brush.",
"This procedure returns TRUE if the specified resource ID is a brush.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2023");
pika_procedure_add_argument (procedure,
g_param_spec_int ("resource-id",
"resource id",
"The resource ID",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_boolean ("brush",
"brush",
"TRUE if the resource ID is a brush, FALSE otherwise",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-resource-id-is-pattern
*/
procedure = pika_procedure_new (resource_id_is_pattern_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-resource-id-is-pattern");
pika_procedure_set_static_help (procedure,
"Returns whether the resource ID is a pattern.",
"This procedure returns TRUE if the specified resource ID is a pattern.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2023");
pika_procedure_add_argument (procedure,
g_param_spec_int ("resource-id",
"resource id",
"The resource ID",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_boolean ("pattern",
"pattern",
"TRUE if the resource ID is a pattern, FALSE otherwise",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-resource-id-is-gradient
*/
procedure = pika_procedure_new (resource_id_is_gradient_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-resource-id-is-gradient");
pika_procedure_set_static_help (procedure,
"Returns whether the resource ID is a gradient.",
"This procedure returns TRUE if the specified resource ID is a gradient.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2023");
pika_procedure_add_argument (procedure,
g_param_spec_int ("resource-id",
"resource id",
"The resource ID",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_boolean ("gradient",
"gradient",
"TRUE if the resource ID is a gradient, FALSE otherwise",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-resource-id-is-palette
*/
procedure = pika_procedure_new (resource_id_is_palette_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-resource-id-is-palette");
pika_procedure_set_static_help (procedure,
"Returns whether the resource ID is a palette.",
"This procedure returns TRUE if the specified resource ID is a palette.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2023");
pika_procedure_add_argument (procedure,
g_param_spec_int ("resource-id",
"resource id",
"The resource ID",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_boolean ("palette",
"palette",
"TRUE if the resource ID is a palette, FALSE otherwise",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-resource-id-is-font
*/
procedure = pika_procedure_new (resource_id_is_font_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-resource-id-is-font");
pika_procedure_set_static_help (procedure,
"Returns whether the resource ID is a font.",
"This procedure returns TRUE if the specified resource ID is a font.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2023");
pika_procedure_add_argument (procedure,
g_param_spec_int ("resource-id",
"resource id",
"The resource ID",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_boolean ("font",
"font",
"TRUE if the resource ID is a font, FALSE otherwise",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-resource-get-name
*/
procedure = pika_procedure_new (resource_get_name_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-resource-get-name");
pika_procedure_set_static_help (procedure,
"Returns the resource's name.",
"This procedure returns the resource's name.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2023");
pika_procedure_add_argument (procedure,
pika_param_spec_resource ("resource",
"resource",
"The resource",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
pika_param_spec_string ("name",
"name",
"The resource's name",
FALSE, FALSE, FALSE,
NULL,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-resource-get-identifiers
*/
procedure = pika_procedure_new (resource_get_identifiers_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-resource-get-identifiers");
pika_procedure_set_static_help (procedure,
"Returns a triplet identifying the resource.",
"This procedure returns 2 strings and a boolean. The first string is the resource name, similar to what you would obtain calling 'pika-resource-get-name'. The second is an opaque identifier for the collection this resource belongs to.\n"
"Note: as far as PIKA is concerned, a collection of resource usually corresponds to a single file on disk (which may or may not contain several resources). Therefore the identifier may be derived from the local file path. Nevertheless you should not use this string as such as this is not guaranteed to be always the case. You should consider it as an opaque identifier only to be used again through _'pika-resource-get-by-identifier'.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Jehan",
"Jehan",
"2023");
pika_procedure_add_argument (procedure,
pika_param_spec_resource ("resource",
"resource",
"The resource",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_boolean ("is-internal",
"is internal",
"Whether this is the identifier for internal data",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
pika_param_spec_string ("name",
"name",
"The resource's name",
FALSE, FALSE, FALSE,
NULL,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
pika_param_spec_string ("collection-id",
"collection id",
"The resource's collection identifier",
FALSE, FALSE, FALSE,
NULL,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-resource-is-editable
*/
procedure = pika_procedure_new (resource_is_editable_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-resource-is-editable");
pika_procedure_set_static_help (procedure,
"Whether the resource can be edited.",
"Returns TRUE if you have permission to change the resource.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2023");
pika_procedure_add_argument (procedure,
pika_param_spec_resource ("resource",
"resource",
"The resource",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_boolean ("editable",
"editable",
"TRUE if the resource can be edited",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-resource-duplicate
*/
procedure = pika_procedure_new (resource_duplicate_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-resource-duplicate");
pika_procedure_set_static_help (procedure,
"Duplicates a resource.",
"Returns a copy having a different, unique ID.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2023");
pika_procedure_add_argument (procedure,
pika_param_spec_resource ("resource",
"resource",
"The resource",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
pika_param_spec_resource ("resource-copy",
"resource copy",
"A copy of the resource.",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-resource-rename
*/
procedure = pika_procedure_new (resource_rename_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-resource-rename");
pika_procedure_set_static_help (procedure,
"Renames a resource. When the name is in use, renames to a unique name.",
"Renames a resource. When the proposed name is already used, PIKA generates a unique name.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2023");
pika_procedure_add_argument (procedure,
pika_param_spec_resource ("resource",
"resource",
"The resource",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
pika_param_spec_string ("new-name",
"new name",
"The proposed new name of the resource",
FALSE, FALSE, TRUE,
NULL,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-resource-delete
*/
procedure = pika_procedure_new (resource_delete_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-resource-delete");
pika_procedure_set_static_help (procedure,
"Deletes a resource.",
"Deletes a resource. Returns an error if the resource is not deletable. Deletes the resource's data. You should not use the resource afterwards.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2023");
pika_procedure_add_argument (procedure,
pika_param_spec_resource ("resource",
"resource",
"The resource",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
}