PIKApp/libpika/pikapikarc_pdb.c

303 lines
8.7 KiB
C

/* LIBPIKA - The PIKA Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* pikapikarc_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"
/**
* SECTION: pikapikarc
* @title: pikapikarc
* @short_description: Interactions with settings from pikarc.
*
* Interactions with settings from pikarc.
**/
/**
* pika_pikarc_query:
* @token: The token to query for.
*
* Queries the pikarc file parser for information on a specified token.
*
* This procedure is used to locate additional information contained in
* the pikarc file considered extraneous to the operation of PIKA.
* Plug-ins that need configuration information can expect it will be
* stored in the user pikarc file and can use this procedure to
* retrieve it. This query procedure will return the value associated
* with the specified token. This corresponds _only_ to entries with
* the format: (&lt;token&gt; &lt;value&gt;). The value must be a
* string. Entries not corresponding to this format will cause warnings
* to be issued on pikarc parsing and will not be queryable.
*
* Returns: (transfer full): The value associated with the queried token.
* The returned value must be freed with g_free().
**/
gchar *
pika_pikarc_query (const gchar *token)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gchar *value = NULL;
args = pika_value_array_new_from_types (NULL,
G_TYPE_STRING, token,
G_TYPE_NONE);
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-pikarc-query",
args);
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
value = PIKA_VALUES_DUP_STRING (return_vals, 1);
pika_value_array_unref (return_vals);
return value;
}
/**
* pika_pikarc_set:
* @token: The token to add or modify.
* @value: The value to set the token to.
*
* Sets a pikarc token to a value and saves it in the pikarc.
*
* This procedure is used to add or change additional information in
* the pikarc file that is considered extraneous to the operation of
* PIKA. Plug-ins that need configuration information can use this
* function to store it, and pika_pikarc_query() to retrieve it. This
* will accept _only_ string values in UTF-8 encoding.
*
* Returns: TRUE on success.
**/
gboolean
pika_pikarc_set (const gchar *token,
const gchar *value)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gboolean success = TRUE;
args = pika_value_array_new_from_types (NULL,
G_TYPE_STRING, token,
G_TYPE_STRING, value,
G_TYPE_NONE);
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-pikarc-set",
args);
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_get_default_comment:
*
* Get the default image comment as specified in the Preferences.
*
* Returns a copy of the default image comment.
*
* Returns: (transfer full): Default image comment.
* The returned value must be freed with g_free().
**/
gchar *
pika_get_default_comment (void)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gchar *comment = NULL;
args = pika_value_array_new_from_types (NULL,
G_TYPE_NONE);
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-get-default-comment",
args);
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
comment = PIKA_VALUES_DUP_STRING (return_vals, 1);
pika_value_array_unref (return_vals);
return comment;
}
/**
* pika_get_default_unit:
*
* Get the default unit (taken from the user's locale).
*
* Returns the default unit's integer ID.
*
* Returns: (transfer none): Default unit.
*
* Since: 2.4
**/
PikaUnit
pika_get_default_unit (void)
{
PikaValueArray *args;
PikaValueArray *return_vals;
PikaUnit unit_id = PIKA_UNIT_PIXEL;
args = pika_value_array_new_from_types (NULL,
G_TYPE_NONE);
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-get-default-unit",
args);
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
unit_id = PIKA_VALUES_GET_INT (return_vals, 1);
pika_value_array_unref (return_vals);
return unit_id;
}
/**
* pika_get_monitor_resolution:
* @xres: (out): X resolution.
* @yres: (out): Y resolution.
*
* Get the monitor resolution as specified in the Preferences.
*
* Returns the resolution of the monitor in pixels/inch. This value is
* taken from the Preferences (or the windowing system if this is set
* in the Preferences) and there's no guarantee for the value to be
* reasonable.
*
* Returns: TRUE on success.
**/
gboolean
pika_get_monitor_resolution (gdouble *xres,
gdouble *yres)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gboolean success = TRUE;
args = pika_value_array_new_from_types (NULL,
G_TYPE_NONE);
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-get-monitor-resolution",
args);
pika_value_array_unref (args);
*xres = 0.0;
*yres = 0.0;
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
if (success)
{
*xres = PIKA_VALUES_GET_DOUBLE (return_vals, 1);
*yres = PIKA_VALUES_GET_DOUBLE (return_vals, 2);
}
pika_value_array_unref (return_vals);
return success;
}
/**
* _pika_get_color_configuration:
*
* Get a serialized version of the color management configuration.
*
* Returns a string that can be deserialized into a PikaColorConfig
* object representing the current color management configuration.
*
* Returns: (transfer full): Serialized color management configuration.
* The returned value must be freed with g_free().
*
* Since: 2.4
**/
gchar *
_pika_get_color_configuration (void)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gchar *config = NULL;
args = pika_value_array_new_from_types (NULL,
G_TYPE_NONE);
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-get-color-configuration",
args);
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
config = PIKA_VALUES_DUP_STRING (return_vals, 1);
pika_value_array_unref (return_vals);
return config;
}
/**
* pika_get_module_load_inhibit:
*
* Get the list of modules which should not be loaded.
*
* Returns a copy of the list of modules which should not be loaded.
*
* Returns: (transfer full): The list of modules.
* The returned value must be freed with g_free().
**/
gchar *
pika_get_module_load_inhibit (void)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gchar *load_inhibit = NULL;
args = pika_value_array_new_from_types (NULL,
G_TYPE_NONE);
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-get-module-load-inhibit",
args);
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
load_inhibit = PIKA_VALUES_DUP_STRING (return_vals, 1);
pika_value_array_unref (return_vals);
return load_inhibit;
}