[gimp] libgimp: add gimp_pdb_temp_procedure_name() and hide the PDB wrapper
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: add gimp_pdb_temp_procedure_name() and hide the PDB wrapper
- Date: Tue, 6 Aug 2019 22:20:17 +0000 (UTC)
commit 64d880f1feb27eb9efc34b5060e19afef8cb3b47
Author: Michael Natterer <mitch gimp org>
Date: Wed Aug 7 00:19:38 2019 +0200
libgimp: add gimp_pdb_temp_procedure_name() and hide the PDB wrapper
libgimp/gimp.def | 1 +
libgimp/gimpbrushselect.c | 9 +++++++--
libgimp/gimpfontselect.c | 9 +++++++--
libgimp/gimpgradientselect.c | 9 +++++++--
libgimp/gimppaletteselect.c | 9 +++++++--
libgimp/gimppatternselect.c | 9 +++++++--
libgimp/gimppdb.c | 40 ++++++++++++++++++++++++++++++++++++++++
libgimp/gimppdb.h | 3 +++
libgimp/gimppdb_pdb.c | 4 ++--
libgimp/gimppdb_pdb.h | 2 +-
libgimp/gimpprogress.c | 5 ++++-
pdb/groups/pdb.pdb | 2 +-
12 files changed, 87 insertions(+), 15 deletions(-)
---
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index 3afdfd4bf5..cde1c480c4 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -630,6 +630,7 @@ EXPORTS
gimp_pdb_run_procedure_valist
gimp_pdb_set_data
gimp_pdb_temp_name
+ gimp_pdb_temp_procedure_name
gimp_pencil
gimp_plug_in_add_menu_branch
gimp_plug_in_add_temp_procedure
diff --git a/libgimp/gimpbrushselect.c b/libgimp/gimpbrushselect.c
index 36fe44a79e..7c8be9a3d2 100644
--- a/libgimp/gimpbrushselect.c
+++ b/libgimp/gimpbrushselect.c
@@ -74,10 +74,15 @@ gimp_brush_select_new (const gchar *title,
gpointer data,
GDestroyNotify data_destroy)
{
- GimpPlugIn *plug_in = gimp_get_plug_in ();
- gchar *brush_callback = gimp_pdb_temp_name ();
+ GimpPlugIn *plug_in = gimp_get_plug_in ();
+ gchar *brush_callback;
GimpBrushData *brush_data;
+ if (plug_in)
+ brush_callback = gimp_pdb_temp_procedure_name (gimp_get_pdb ());
+ else
+ brush_callback = gimp_pdb_temp_name ();
+
brush_data = g_slice_new0 (GimpBrushData);
brush_data->brush_callback = brush_callback;
diff --git a/libgimp/gimpfontselect.c b/libgimp/gimpfontselect.c
index 90ec08eeb3..cdfca3c446 100644
--- a/libgimp/gimpfontselect.c
+++ b/libgimp/gimpfontselect.c
@@ -65,10 +65,15 @@ gimp_font_select_new (const gchar *title,
gpointer data,
GDestroyNotify data_destroy)
{
- GimpPlugIn *plug_in = gimp_get_plug_in ();
- gchar *font_callback = gimp_pdb_temp_name ();
+ GimpPlugIn *plug_in = gimp_get_plug_in ();
+ gchar *font_callback;
GimpFontData *font_data;
+ if (plug_in)
+ font_callback = gimp_pdb_temp_procedure_name (gimp_get_pdb ());
+ else
+ font_callback = gimp_pdb_temp_name ();
+
font_data = g_slice_new0 (GimpFontData);
font_data->font_callback = font_callback;
diff --git a/libgimp/gimpgradientselect.c b/libgimp/gimpgradientselect.c
index 80bfc5dc35..4268b31b56 100644
--- a/libgimp/gimpgradientselect.c
+++ b/libgimp/gimpgradientselect.c
@@ -68,10 +68,15 @@ gimp_gradient_select_new (const gchar *title,
gpointer data,
GDestroyNotify data_destroy)
{
- GimpPlugIn *plug_in = gimp_get_plug_in ();
- gchar *gradient_callback = gimp_pdb_temp_name ();
+ GimpPlugIn *plug_in = gimp_get_plug_in ();
+ gchar *gradient_callback;
GimpGradientData *gradient_data;
+ if (plug_in)
+ gradient_callback = gimp_pdb_temp_procedure_name (gimp_get_pdb ());
+ else
+ gradient_callback = gimp_pdb_temp_name ();
+
gradient_data = g_slice_new0 (GimpGradientData);
gradient_data->gradient_callback = gradient_callback;
diff --git a/libgimp/gimppaletteselect.c b/libgimp/gimppaletteselect.c
index 61d07dfc5c..4d4b5e9faf 100644
--- a/libgimp/gimppaletteselect.c
+++ b/libgimp/gimppaletteselect.c
@@ -66,10 +66,15 @@ gimp_palette_select_new (const gchar *title,
gpointer data,
GDestroyNotify data_destroy)
{
- GimpPlugIn *plug_in = gimp_get_plug_in ();
- gchar *palette_callback = gimp_pdb_temp_name ();
+ GimpPlugIn *plug_in = gimp_get_plug_in ();
+ gchar *palette_callback;
GimpPaletteData *palette_data;
+ if (plug_in)
+ palette_callback = gimp_pdb_temp_procedure_name (gimp_get_pdb ());
+ else
+ palette_callback = gimp_pdb_temp_name ();
+
palette_data = g_slice_new0 (GimpPaletteData);
palette_data->palette_callback = palette_callback;
diff --git a/libgimp/gimppatternselect.c b/libgimp/gimppatternselect.c
index 9e7ab6c5f7..197bdbe0d0 100644
--- a/libgimp/gimppatternselect.c
+++ b/libgimp/gimppatternselect.c
@@ -69,10 +69,15 @@ gimp_pattern_select_new (const gchar *title,
gpointer data,
GDestroyNotify data_destroy)
{
- GimpPlugIn *plug_in = gimp_get_plug_in ();
- gchar *pattern_callback = gimp_pdb_temp_name ();
+ GimpPlugIn *plug_in = gimp_get_plug_in ();
+ gchar *pattern_callback;
GimpPatternData *pattern_data;
+ if (plug_in)
+ pattern_callback = gimp_pdb_temp_procedure_name (gimp_get_pdb ());
+ else
+ pattern_callback = gimp_pdb_temp_name ();
+
pattern_data = g_slice_new0 (GimpPatternData);
pattern_data->pattern_callback = pattern_callback;
diff --git a/libgimp/gimppdb.c b/libgimp/gimppdb.c
index 8764152656..26121b1371 100644
--- a/libgimp/gimppdb.c
+++ b/libgimp/gimppdb.c
@@ -284,6 +284,29 @@ gimp_pdb_run_procedure_array (GimpPDB *pdb,
return return_values;
}
+/**
+ * gimp_pdb_temp_procedure_name:
+ * @pdb: the #GimpPDB object.
+ *
+ * Generates a unique temporary PDB name.
+ *
+ * This function generates a temporary PDB entry name that is
+ * guaranteed to be unique.
+ *
+ * Returns: (transfer full): A unique temporary name for a temporary
+ * PDB entry. The returned value must be freed with
+ * g_free().
+ *
+ * Since: 3.0
+ **/
+gchar *
+gimp_pdb_temp_procedure_name (GimpPDB *pdb)
+{
+ g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL);
+
+ return _gimp_pdb_temp_name ();
+}
+
GQuark
_gimp_pdb_error_quark (void)
{
@@ -293,6 +316,23 @@ _gimp_pdb_error_quark (void)
/* Cruft API */
+/**
+ * gimp_pdb_temp_name:
+ *
+ * Generates a unique temporary PDB name.
+ *
+ * This procedure generates a temporary PDB entry name that is
+ * guaranteed to be unique.
+ *
+ * Returns: (transfer full): A unique temporary name for a temporary PDB entry.
+ * The returned value must be freed with g_free().
+ **/
+gchar *
+gimp_pdb_temp_name (void)
+{
+ return _gimp_pdb_temp_name ();
+}
+
/**
* gimp_pdb_proc_exists:
* @procedure_name: The procedure name.
diff --git a/libgimp/gimppdb.h b/libgimp/gimppdb.h
index b589755559..059cd69d29 100644
--- a/libgimp/gimppdb.h
+++ b/libgimp/gimppdb.h
@@ -85,9 +85,12 @@ GimpValueArray * gimp_pdb_run_procedure_array (GimpPDB *pdb,
const gchar *procedure_name,
const GimpValueArray *arguments);
+gchar * gimp_pdb_temp_procedure_name (GimpPDB *pdb);
+
/* Cruft API */
+gchar * gimp_pdb_temp_name (void);
gboolean gimp_pdb_proc_exists (const gchar *procedure_name);
gboolean gimp_pdb_proc_info (const gchar *procedure_name,
gchar **blurb,
diff --git a/libgimp/gimppdb_pdb.c b/libgimp/gimppdb_pdb.c
index aacac1ebd1..ea62ff87af 100644
--- a/libgimp/gimppdb_pdb.c
+++ b/libgimp/gimppdb_pdb.c
@@ -25,7 +25,7 @@
#include "gimp.h"
/**
- * gimp_pdb_temp_name:
+ * _gimp_pdb_temp_name:
*
* Generates a unique temporary PDB name.
*
@@ -36,7 +36,7 @@
* The returned value must be freed with g_free().
**/
gchar *
-gimp_pdb_temp_name (void)
+_gimp_pdb_temp_name (void)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
diff --git a/libgimp/gimppdb_pdb.h b/libgimp/gimppdb_pdb.h
index 6c9ce95077..c0f2321145 100644
--- a/libgimp/gimppdb_pdb.h
+++ b/libgimp/gimppdb_pdb.h
@@ -32,7 +32,7 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gchar* gimp_pdb_temp_name (void);
+G_GNUC_INTERNAL gchar* _gimp_pdb_temp_name (void);
gboolean gimp_pdb_dump (const gchar *filename);
gboolean gimp_pdb_query (const gchar *name,
const gchar *blurb,
diff --git a/libgimp/gimpprogress.c b/libgimp/gimpprogress.c
index e5acb4f9a1..dfdbe35d40 100644
--- a/libgimp/gimpprogress.c
+++ b/libgimp/gimpprogress.c
@@ -88,7 +88,10 @@ gimp_progress_install_vtable (const GimpProgressVtable *vtable,
plug_in = gimp_get_plug_in ();
- progress_callback = gimp_pdb_temp_name ();
+ if (plug_in)
+ progress_callback = gimp_pdb_temp_procedure_name (gimp_get_pdb ());
+ else
+ progress_callback = gimp_pdb_temp_name ();
progress_data = g_slice_new0 (GimpProgressData);
diff --git a/pdb/groups/pdb.pdb b/pdb/groups/pdb.pdb
index 4f017b5191..ef919aef40 100644
--- a/pdb/groups/pdb.pdb
+++ b/pdb/groups/pdb.pdb
@@ -27,7 +27,7 @@ HELP
&andy_pdb_misc('1998');
@outargs = (
- { name => 'temp_name', type => 'string',
+ { name => 'temp_name', type => 'string', wrap => 1,
desc => 'A unique temporary name for a temporary PDB entry' }
);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]