PIKApp/libpika/pikaplugin_pdb.c

188 lines
5.9 KiB
C
Raw Normal View History

2023-09-26 00:35:21 +02:00
/* LIBPIKA - The PIKA Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* pikaplugin_pdb.c
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. 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 "pika.h"
#include "pikaplugin_pdb.h"
/**
* _pika_plug_in_help_register:
* @domain_name: The XML namespace of the plug-in's help pages.
* @domain_file: The root URI of the plug-in's help pages.
*
* Register a help path for a plug-in.
*
* This procedure registers user documentation for the calling plug-in
* with the PIKA help system. The domain_uri parameter points to the
* root directory where the plug-in help is installed. For each
* supported language there should be a file called 'pika-help.xml'
* that maps the help IDs to the actual help files.
*
* Returns: TRUE on success.
**/
gboolean
_pika_plug_in_help_register (const gchar *domain_name,
GFile *domain_file)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gboolean success = TRUE;
args = pika_value_array_new_from_types (NULL,
G_TYPE_STRING, domain_name,
G_TYPE_FILE, domain_file,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-plug-in-help-register",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
pika_value_array_unref (return_vals);
return success;
}
/**
* _pika_plug_in_menu_branch_register:
* @menu_path: The sub-menu's menu path.
* @menu_name: The name of the sub-menu.
*
* Register a sub-menu.
*
* This procedure installs a sub-menu which does not belong to any
* procedure. The menu-name should be the untranslated menu label. PIKA
* will look up the translation in the textdomain registered for the
* plug-in.
*
* Returns: TRUE on success.
*
* Since: 2.4
**/
gboolean
_pika_plug_in_menu_branch_register (const gchar *menu_path,
const gchar *menu_name)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gboolean success = TRUE;
args = pika_value_array_new_from_types (NULL,
G_TYPE_STRING, menu_path,
G_TYPE_STRING, menu_name,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-plug-in-menu-branch-register",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
pika_value_array_unref (return_vals);
return success;
}
/**
* _pika_plug_in_set_pdb_error_handler:
* @handler: Who is responsible for handling procedure call errors.
*
* Sets an error handler for procedure calls.
*
* This procedure changes the way that errors in procedure calls are
* handled. By default PIKA will raise an error dialog if a procedure
* call made by a plug-in fails. Using this procedure the plug-in can
* change this behavior. If the error handler is set to
* %PIKA_PDB_ERROR_HANDLER_PLUGIN, then the plug-in is responsible for
* calling pika_get_pdb_error() and handling the error whenever one if
* its procedure calls fails. It can do this by displaying the error
* message or by forwarding it in its own return values.
*
* Returns: TRUE on success.
*
* Since: 2.6
**/
gboolean
_pika_plug_in_set_pdb_error_handler (PikaPDBErrorHandler handler)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gboolean success = TRUE;
args = pika_value_array_new_from_types (NULL,
PIKA_TYPE_PDB_ERROR_HANDLER, handler,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-plug-in-set-pdb-error-handler",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
pika_value_array_unref (return_vals);
return success;
}
/**
* _pika_plug_in_get_pdb_error_handler:
*
* Retrieves the active error handler for procedure calls.
*
* This procedure retrieves the currently active error handler for
* procedure calls made by the calling plug-in. See
* pika_plugin_set_pdb_error_handler() for details.
*
* Returns: Who is responsible for handling procedure call errors.
*
* Since: 2.6
**/
PikaPDBErrorHandler
_pika_plug_in_get_pdb_error_handler (void)
{
PikaValueArray *args;
PikaValueArray *return_vals;
PikaPDBErrorHandler handler = 0;
args = pika_value_array_new_from_types (NULL,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-plug-in-get-pdb-error-handler",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
handler = PIKA_VALUES_GET_ENUM (return_vals, 1);
pika_value_array_unref (return_vals);
return handler;
}