2000-06-08 18:10:03 +00:00
|
|
|
/* LIBGIMP - The GIMP Library
|
2003-07-03 00:47:26 +00:00
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
2000-06-08 18:10:03 +00:00
|
|
|
*
|
2011-03-08 13:58:56 +01:00
|
|
|
* gimp_pdb.c
|
2000-06-08 18:10:03 +00:00
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2000-06-08 18:10:03 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-17 22:28:01 +00:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2000-06-08 18:10:03 +00:00
|
|
|
*
|
|
|
|
* 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
|
2009-01-17 22:28:01 +00:00
|
|
|
* License along with this library. If not, see
|
2018-07-11 23:27:07 +02:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2000-06-08 18:10:03 +00:00
|
|
|
*/
|
|
|
|
|
2007-01-09 10:52:47 +00:00
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
2000-06-08 18:10:03 +00:00
|
|
|
|
2002-05-13 23:30:23 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-06-08 18:10:03 +00:00
|
|
|
#include "gimp.h"
|
|
|
|
|
2010-07-07 11:43:10 +02:00
|
|
|
|
|
|
|
/**
|
2019-07-31 10:04:43 +02:00
|
|
|
* SECTION: gimp
|
2011-03-08 13:58:56 +01:00
|
|
|
* @title: gimp
|
2010-07-07 11:43:10 +02:00
|
|
|
* @short_description: Miscellaneous procedures
|
|
|
|
*
|
|
|
|
* Miscellaneous procedures not fitting in any category.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
2000-08-24 23:06:53 +00:00
|
|
|
/**
|
|
|
|
* gimp_version:
|
|
|
|
*
|
2006-12-22 09:49:36 +00:00
|
|
|
* Returns the host GIMP version.
|
2000-08-24 23:06:53 +00:00
|
|
|
*
|
|
|
|
* This procedure returns the version number of the currently running
|
2006-12-22 09:49:36 +00:00
|
|
|
* GIMP.
|
2000-08-24 23:06:53 +00:00
|
|
|
*
|
2006-12-22 09:49:36 +00:00
|
|
|
* Returns: GIMP version number.
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2000-06-08 18:10:03 +00:00
|
|
|
gchar *
|
|
|
|
gimp_version (void)
|
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2000-06-08 18:10:03 +00:00
|
|
|
gchar *version = NULL;
|
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
args = gimp_value_array_new_from_types (G_TYPE_NONE);
|
2000-06-08 18:10:03 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-version",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2000-06-08 18:10:03 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
version = g_value_dup_string (gimp_value_array_index (return_vals, 1));
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2000-06-08 18:10:03 +00:00
|
|
|
|
|
|
|
return version;
|
|
|
|
}
|
2005-07-24 23:34:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_getpid:
|
|
|
|
*
|
2006-12-22 09:49:36 +00:00
|
|
|
* Returns the PID of the host GIMP process.
|
2005-07-24 23:34:25 +00:00
|
|
|
*
|
2006-12-22 09:49:36 +00:00
|
|
|
* This procedure returns the process ID of the currently running GIMP.
|
2005-07-24 23:34:25 +00:00
|
|
|
*
|
|
|
|
* Returns: The PID.
|
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.4
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2005-07-24 23:34:25 +00:00
|
|
|
gint
|
|
|
|
gimp_getpid (void)
|
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-07-24 23:34:25 +00:00
|
|
|
gint pid = 0;
|
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
args = gimp_value_array_new_from_types (G_TYPE_NONE);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-getpid",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2005-07-24 23:34:25 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
pid = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
2005-07-24 23:34:25 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2005-07-24 23:34:25 +00:00
|
|
|
|
|
|
|
return pid;
|
|
|
|
}
|
2011-03-08 14:31:04 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_attach_parasite:
|
|
|
|
* @parasite: The parasite to attach.
|
|
|
|
*
|
|
|
|
* Add a global parasite.
|
|
|
|
*
|
|
|
|
* This procedure attaches a global parasite. It has no return values.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.8
|
2011-03-08 14:31:04 +01:00
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_attach_parasite (const GimpParasite *parasite)
|
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2011-03-08 14:31:04 +01:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_PARASITE,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
g_value_set_boxed (gimp_value_array_index (args, 0), parasite);
|
2011-03-08 14:31:04 +01:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-attach-parasite",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2011-03-08 14:31:04 +01:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2011-03-08 14:31:04 +01:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_detach_parasite:
|
|
|
|
* @name: The name of the parasite to detach.
|
|
|
|
*
|
|
|
|
* Removes a global parasite.
|
|
|
|
*
|
|
|
|
* This procedure detaches a global parasite from. It has no return
|
|
|
|
* values.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.8
|
2011-03-08 14:31:04 +01:00
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_detach_parasite (const gchar *name)
|
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2011-03-08 14:31:04 +01:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
args = gimp_value_array_new_from_types (G_TYPE_STRING,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
g_value_set_string (gimp_value_array_index (args, 0), name);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-detach-parasite",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2011-03-08 14:31:04 +01:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
2011-03-08 14:31:04 +01:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2011-03-08 14:31:04 +01:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_get_parasite:
|
|
|
|
* @name: The name of the parasite to find.
|
|
|
|
*
|
|
|
|
* Look up a global parasite.
|
|
|
|
*
|
|
|
|
* Finds and returns the global parasite that was previously attached.
|
|
|
|
*
|
|
|
|
* Returns: The found parasite.
|
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.8
|
2011-03-08 14:31:04 +01:00
|
|
|
**/
|
|
|
|
GimpParasite *
|
|
|
|
gimp_get_parasite (const gchar *name)
|
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2011-03-08 14:31:04 +01:00
|
|
|
GimpParasite *parasite = NULL;
|
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
args = gimp_value_array_new_from_types (G_TYPE_STRING,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
g_value_set_string (gimp_value_array_index (args, 0), name);
|
2011-03-08 14:31:04 +01:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-get-parasite",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2011-03-08 14:31:04 +01:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
parasite = g_value_dup_boxed (gimp_value_array_index (return_vals, 1));
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2011-03-08 14:31:04 +01:00
|
|
|
|
|
|
|
return parasite;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_get_parasite_list:
|
|
|
|
* @num_parasites: The number of attached parasites.
|
|
|
|
*
|
|
|
|
* List all parasites.
|
|
|
|
*
|
|
|
|
* Returns a list of all currently attached global parasites.
|
|
|
|
*
|
2019-07-30 20:54:53 +02:00
|
|
|
* Returns: The names of currently attached parasites. The returned
|
|
|
|
* value must be freed with g_strfreev().
|
2011-03-08 14:31:04 +01:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.8
|
2011-03-08 14:31:04 +01:00
|
|
|
**/
|
|
|
|
gchar **
|
|
|
|
gimp_get_parasite_list (gint *num_parasites)
|
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2011-03-08 14:31:04 +01:00
|
|
|
gchar **parasites = NULL;
|
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
args = gimp_value_array_new_from_types (G_TYPE_NONE);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-get-parasite-list",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2011-03-08 14:31:04 +01:00
|
|
|
|
|
|
|
*num_parasites = 0;
|
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
2011-03-08 14:31:04 +01:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
*num_parasites = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
|
|
|
parasites = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
|
2011-03-08 14:31:04 +01:00
|
|
|
}
|
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2011-03-08 14:31:04 +01:00
|
|
|
|
|
|
|
return parasites;
|
|
|
|
}
|
2017-02-18 15:08:25 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_temp_name:
|
|
|
|
* @extension: The extension the file will have.
|
|
|
|
*
|
|
|
|
* Generates a unique filename.
|
|
|
|
*
|
|
|
|
* Generates a unique filename using the temp path supplied in the
|
|
|
|
* user's gimprc.
|
|
|
|
*
|
|
|
|
* Returns: The new temp filename.
|
|
|
|
**/
|
|
|
|
gchar *
|
|
|
|
gimp_temp_name (const gchar *extension)
|
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2017-02-18 15:08:25 +01:00
|
|
|
gchar *name = NULL;
|
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
args = gimp_value_array_new_from_types (G_TYPE_STRING,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
g_value_set_string (gimp_value_array_index (args, 0), extension);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-temp-name",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2017-02-18 15:08:25 +01:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
|
2017-02-18 15:08:25 +01:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2017-02-18 15:08:25 +01:00
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|