PIKApp/app/pdb/message-cmds.c

195 lines
7.6 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 <string.h>
#include <gegl.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "libpikabase/pikabase.h"
#include "pdb-types.h"
#include "core/pika.h"
#include "core/pikaparamspecs.h"
#include "plug-in/pikaplugin.h"
#include "plug-in/pikapluginmanager.h"
#include "pikapdb.h"
#include "pikaprocedure.h"
#include "internal-procs.h"
#include "pika-intl.h"
static PikaValueArray *
message_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
const gchar *message;
message = g_value_get_string (pika_value_array_index (args, 0));
if (success)
{
const gchar *domain = NULL;
if (pika->plug_in_manager->current_plug_in)
domain = pika_plug_in_get_undo_desc (pika->plug_in_manager->current_plug_in);
pika_show_message (pika, G_OBJECT (progress), PIKA_MESSAGE_WARNING,
domain, message);
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
message_get_handler_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
PikaValueArray *return_vals;
gint handler = 0;
handler = pika->message_handler;
return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
g_value_set_enum (pika_value_array_index (return_vals, 1), handler);
return return_vals;
}
static PikaValueArray *
message_set_handler_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
gint handler;
handler = g_value_get_enum (pika_value_array_index (args, 0));
if (success)
{
pika->message_handler = handler;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
void
register_message_procs (PikaPDB *pdb)
{
PikaProcedure *procedure;
/*
* pika-message
*/
procedure = pika_procedure_new (message_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-message");
pika_procedure_set_static_help (procedure,
"Displays a dialog box with a message.",
"Displays a dialog box with a message. Useful for status or error reporting. The message must be in UTF-8 encoding.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Manish Singh",
"Manish Singh",
"1998");
pika_procedure_add_argument (procedure,
pika_param_spec_string ("message",
"message",
"Message to display in the dialog",
FALSE, FALSE, FALSE,
NULL,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-message-get-handler
*/
procedure = pika_procedure_new (message_get_handler_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-message-get-handler");
pika_procedure_set_static_help (procedure,
"Returns the current state of where warning messages are displayed.",
"This procedure returns the way g_message warnings are displayed. They can be shown in a dialog box or printed on the console where pika was started.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Manish Singh",
"Manish Singh",
"1998");
pika_procedure_add_return_value (procedure,
g_param_spec_enum ("handler",
"handler",
"The current handler type",
PIKA_TYPE_MESSAGE_HANDLER_TYPE,
PIKA_MESSAGE_BOX,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-message-set-handler
*/
procedure = pika_procedure_new (message_set_handler_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-message-set-handler");
pika_procedure_set_static_help (procedure,
"Controls where warning messages are displayed.",
"This procedure controls how g_message warnings are displayed. They can be shown in a dialog box or printed on the console where pika was started.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Manish Singh",
"Manish Singh",
"1998");
pika_procedure_add_argument (procedure,
g_param_spec_enum ("handler",
"handler",
"The new handler type",
PIKA_TYPE_MESSAGE_HANDLER_TYPE,
PIKA_MESSAGE_BOX,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
}