diff --git a/app/pdb/gimprc-cmds.c b/app/pdb/gimprc-cmds.c index a742acb2ef..7f4b502dd6 100644 --- a/app/pdb/gimprc-cmds.c +++ b/app/pdb/gimprc-cmds.c @@ -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 ", + "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 */ diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c index 6f5fb9f54a..d5ca2f7c20 100644 --- a/app/pdb/internal-procs.c +++ b/app/pdb/internal-procs.c @@ -28,7 +28,7 @@ #include "internal-procs.h" -/* 790 procedures registered total */ +/* 791 procedures registered total */ void internal_procs_init (GimpPDB *pdb) diff --git a/libgimp/gimp.def b/libgimp/gimp.def index 9d3c805cfa..5f49b68953 100644 --- a/libgimp/gimp.def +++ b/libgimp/gimp.def @@ -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 diff --git a/libgimp/gimpgimprc_pdb.c b/libgimp/gimpgimprc_pdb.c index 67c5c2dd52..e595b58bc8 100644 --- a/libgimp/gimpgimprc_pdb.c +++ b/libgimp/gimpgimprc_pdb.c @@ -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: * diff --git a/libgimp/gimpgimprc_pdb.h b/libgimp/gimpgimprc_pdb.h index e26ca84c01..4be14ca0ec 100644 --- a/libgimp/gimpgimprc_pdb.h +++ b/libgimp/gimpgimprc_pdb.h @@ -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); diff --git a/tools/pdbgen/pdb/gimprc.pdb b/tools/pdbgen/pdb/gimprc.pdb index 18019a1c68..70e339ac80 100644 --- a/tools/pdbgen/pdb/gimprc.pdb +++ b/tools/pdbgen/pdb/gimprc.pdb @@ -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.'; @@ -243,10 +266,11 @@ CODE @procs = qw(gimprc_query gimprc_set - get_default_comment + get_default_comment get_default_unit get_monitor_resolution - get_theme_dir + get_theme_dir + get_icon_theme_dir get_color_configuration get_module_load_inhibit);