[gimp] libgimp, PDB: add gimp_get_icon_theme_dir()



commit 0ff7d3ba143ef31f8208d19f439dde6c3f9d3494
Author: Michael Natterer <mitch gimp org>
Date:   Wed Dec 9 23:21:11 2015 +0100

    libgimp, PDB: add gimp_get_icon_theme_dir()

 app/pdb/gimprc-cmds.c       |   46 +++++++++++++++++++++++++++++++++++++++++++
 app/pdb/internal-procs.c    |    2 +-
 libgimp/gimp.def            |    1 +
 libgimp/gimpgimprc_pdb.c    |   30 ++++++++++++++++++++++++++++
 libgimp/gimpgimprc_pdb.h    |    1 +
 tools/pdbgen/pdb/gimprc.pdb |   28 ++++++++++++++++++++++++-
 6 files changed, 105 insertions(+), 3 deletions(-)
---
diff --git a/app/pdb/gimprc-cmds.c b/app/pdb/gimprc-cmds.c
index a742acb..7f4b502 100644
--- a/app/pdb/gimprc-cmds.c
+++ b/app/pdb/gimprc-cmds.c
@@ -196,6 +196,28 @@ get_theme_dir_invoker (GimpProcedure         *procedure,
 }
 
 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,
                                  GimpContext           *context,
@@ -403,6 +425,30 @@ register_gimprc_procs (GimpPDB *pdb)
   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
    */
   procedure = gimp_procedure_new (get_color_configuration_invoker);
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 6f5fb9f..d5ca2f7 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 9d3c805..5f49b68 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 67c5c2d..e595b58 100644
--- a/libgimp/gimpgimprc_pdb.c
+++ b/libgimp/gimpgimprc_pdb.c
@@ -237,6 +237,36 @@ gimp_get_theme_dir (void)
 }
 
 /**
+ * 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:
  *
  * Get a serialized version of the color management configuration.
diff --git a/libgimp/gimpgimprc_pdb.h b/libgimp/gimpgimprc_pdb.h
index e26ca84..4be14ca 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 18019a1..70e339a 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]