libgimp, PDB: add gimp_get_icon_theme_dir()

This commit is contained in:
Michael Natterer 2015-12-09 23:21:11 +01:00
parent 8d2ededbf2
commit 0ff7d3ba14
6 changed files with 105 additions and 3 deletions

View File

@ -195,6 +195,28 @@ get_theme_dir_invoker (GimpProcedure *procedure,
return return_vals;
}
static GimpValueArray *
get_icon_theme_dir_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
GimpValueArray *return_vals;
gchar *icon_theme_dir = NULL;
GFile *file = gimp_get_icon_theme_dir (gimp);
if (file)
icon_theme_dir = g_file_get_path (file);
return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
g_value_take_string (gimp_value_array_index (return_vals, 1), icon_theme_dir);
return return_vals;
}
static GimpValueArray *
get_color_configuration_invoker (GimpProcedure *procedure,
Gimp *gimp,
@ -402,6 +424,30 @@ register_gimprc_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-get-icon-theme-dir
*/
procedure = gimp_procedure_new (get_icon_theme_dir_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-get-icon-theme-dir");
gimp_procedure_set_static_strings (procedure,
"gimp-get-icon-theme-dir",
"Get the directory of the current icon theme.",
"Returns a copy of the current icon theme dir.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2015",
NULL);
gimp_procedure_add_return_value (procedure,
gimp_param_spec_string ("icon-theme-dir",
"icon theme dir",
"The icon theme dir",
FALSE, FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-get-color-configuration
*/

View File

@ -28,7 +28,7 @@
#include "internal-procs.h"
/* 790 procedures registered total */
/* 791 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)

View File

@ -325,6 +325,7 @@ EXPORTS
gimp_get_color_configuration
gimp_get_default_comment
gimp_get_default_unit
gimp_get_icon_theme_dir
gimp_get_module_load_inhibit
gimp_get_monitor_resolution
gimp_get_parasite

View File

@ -236,6 +236,36 @@ gimp_get_theme_dir (void)
return theme_dir;
}
/**
* gimp_get_icon_theme_dir:
*
* Get the directory of the current icon theme.
*
* Returns a copy of the current icon theme dir.
*
* Returns: The icon theme dir.
*
* Since: 2.10
**/
gchar *
gimp_get_icon_theme_dir (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *icon_theme_dir = NULL;
return_vals = gimp_run_procedure ("gimp-get-icon-theme-dir",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
icon_theme_dir = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return icon_theme_dir;
}
/**
* _gimp_get_color_configuration:
*

View File

@ -40,6 +40,7 @@ GimpUnit gimp_get_default_unit (void);
gboolean gimp_get_monitor_resolution (gdouble *xres,
gdouble *yres);
gchar* gimp_get_theme_dir (void);
gchar* gimp_get_icon_theme_dir (void);
G_GNUC_INTERNAL gchar* _gimp_get_color_configuration (void);
gchar* gimp_get_module_load_inhibit (void);

View File

@ -193,6 +193,29 @@ CODE
);
}
sub get_icon_theme_dir {
$blurb = 'Get the directory of the current icon theme.';
$help = 'Returns a copy of the current icon theme dir.';
&mitch_pdb_misc('2015', '2.10');
@outargs = (
{ name => 'icon_theme_dir', type => 'string',
desc => 'The icon theme dir' }
);
%invoke = (
code => <<'CODE'
{
GFile *file = gimp_get_icon_theme_dir (gimp);
if (file)
icon_theme_dir = g_file_get_path (file);
}
CODE
);
}
sub get_color_configuration {
$blurb = 'Get a serialized version of the color management configuration.';
$help = 'Returns a string that can be deserialized into a GimpColorConfig object representing the current color management configuration.';
@ -247,6 +270,7 @@ CODE
get_default_unit
get_monitor_resolution
get_theme_dir
get_icon_theme_dir
get_color_configuration
get_module_load_inhibit);