[gimp] pdb, libgimp: mode gimp_temp_name() from fileops.pdb to gimp.pdb
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] pdb, libgimp: mode gimp_temp_name() from fileops.pdb to gimp.pdb
- Date: Sat, 18 Feb 2017 14:09:17 +0000 (UTC)
commit 608070fde33da7eb3421084ad82771ef3005036a
Author: Michael Natterer <mitch gimp org>
Date: Sat Feb 18 15:08:25 2017 +0100
pdb, libgimp: mode gimp_temp_name() from fileops.pdb to gimp.pdb
It has nothing to do with loading/saving images.
app/pdb/fileops-cmds.c | 64 ------------------------------------------
app/pdb/gimp-cmds.c | 64 ++++++++++++++++++++++++++++++++++++++++++
libgimp/gimp_pdb.c | 31 ++++++++++++++++++++
libgimp/gimp_pdb.h | 1 +
libgimp/gimpfileops_pdb.c | 35 +---------------------
libgimp/gimpfileops_pdb.h | 1 -
tools/pdbgen/pdb/fileops.pdb | 40 ++------------------------
tools/pdbgen/pdb/gimp.pdb | 37 +++++++++++++++++++++++-
8 files changed, 136 insertions(+), 137 deletions(-)
---
diff --git a/app/pdb/fileops-cmds.c b/app/pdb/fileops-cmds.c
index 3fe31ea..54e3c8a 100644
--- a/app/pdb/fileops-cmds.c
+++ b/app/pdb/fileops-cmds.c
@@ -408,39 +408,6 @@ file_save_thumbnail_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
-temp_name_invoker (GimpProcedure *procedure,
- Gimp *gimp,
- GimpContext *context,
- GimpProgress *progress,
- const GimpValueArray *args,
- GError **error)
-{
- gboolean success = TRUE;
- GimpValueArray *return_vals;
- const gchar *extension;
- gchar *name = NULL;
-
- extension = g_value_get_string (gimp_value_array_index (args, 0));
-
- if (success)
- {
- GFile *file = gimp_get_temp_file (gimp, extension);
-
- name = g_file_get_path (file);
-
- g_object_unref (file);
- }
-
- return_vals = gimp_procedure_get_return_values (procedure, success,
- error ? *error : NULL);
-
- if (success)
- g_value_take_string (gimp_value_array_index (return_vals, 1), name);
-
- return return_vals;
-}
-
-static GimpValueArray *
register_magic_load_handler_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -899,37 +866,6 @@ register_fileops_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
- * gimp-temp-name
- */
- procedure = gimp_procedure_new (temp_name_invoker);
- gimp_object_set_static_name (GIMP_OBJECT (procedure),
- "gimp-temp-name");
- gimp_procedure_set_static_strings (procedure,
- "gimp-temp-name",
- "Generates a unique filename.",
- "Generates a unique filename using the temp path supplied in the user's
gimprc.",
- "Josh MacDonald",
- "Josh MacDonald",
- "1997",
- NULL);
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_string ("extension",
- "extension",
- "The extension the file will have",
- TRUE, TRUE, FALSE,
- NULL,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_return_value (procedure,
- gimp_param_spec_string ("name",
- "name",
- "The new temp filename",
- FALSE, FALSE, FALSE,
- NULL,
- GIMP_PARAM_READWRITE));
- gimp_pdb_register_procedure (pdb, procedure);
- g_object_unref (procedure);
-
- /*
* gimp-register-magic-load-handler
*/
procedure = gimp_procedure_new (register_magic_load_handler_invoker);
diff --git a/app/pdb/gimp-cmds.c b/app/pdb/gimp-cmds.c
index cc3cd8c..9111415 100644
--- a/app/pdb/gimp-cmds.c
+++ b/app/pdb/gimp-cmds.c
@@ -200,6 +200,39 @@ get_parasite_list_invoker (GimpProcedure *procedure,
return return_vals;
}
+static GimpValueArray *
+temp_name_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *extension;
+ gchar *name = NULL;
+
+ extension = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GFile *file = gimp_get_temp_file (gimp, extension);
+
+ name = g_file_get_path (file);
+
+ g_object_unref (file);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+
+ return return_vals;
+}
+
void
register_gimp_procs (GimpPDB *pdb)
{
@@ -377,4 +410,35 @@ register_gimp_procs (GimpPDB *pdb)
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
+
+ /*
+ * gimp-temp-name
+ */
+ procedure = gimp_procedure_new (temp_name_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-temp-name");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-temp-name",
+ "Generates a unique filename.",
+ "Generates a unique filename using the temp path supplied in the user's
gimprc.",
+ "Josh MacDonald",
+ "Josh MacDonald",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("extension",
+ "extension",
+ "The extension the file will have",
+ TRUE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The new temp filename",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
}
diff --git a/libgimp/gimp_pdb.c b/libgimp/gimp_pdb.c
index 5553cad..2abdb41 100644
--- a/libgimp/gimp_pdb.c
+++ b/libgimp/gimp_pdb.c
@@ -230,3 +230,34 @@ gimp_get_parasite_list (gint *num_parasites)
return parasites;
}
+
+/**
+ * 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)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-temp-name",
+ &nreturn_vals,
+ GIMP_PDB_STRING, extension,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
diff --git a/libgimp/gimp_pdb.h b/libgimp/gimp_pdb.h
index d25f05b..eb217c4 100644
--- a/libgimp/gimp_pdb.h
+++ b/libgimp/gimp_pdb.h
@@ -38,6 +38,7 @@ gboolean gimp_attach_parasite (const GimpParasite *parasite);
gboolean gimp_detach_parasite (const gchar *name);
GimpParasite* gimp_get_parasite (const gchar *name);
gchar** gimp_get_parasite_list (gint *num_parasites);
+gchar* gimp_temp_name (const gchar *extension);
G_END_DECLS
diff --git a/libgimp/gimpfileops_pdb.c b/libgimp/gimpfileops_pdb.c
index 8130a8f..fc8f972 100644
--- a/libgimp/gimpfileops_pdb.c
+++ b/libgimp/gimpfileops_pdb.c
@@ -30,9 +30,9 @@
/**
* SECTION: gimpfileops
* @title: gimpfileops
- * @short_description: File operations (load, save, etc.)
+ * @short_description: Image file operations (load, save, etc.)
*
- * File operations (load, save, etc.)
+ * Image file operations (load, save, etc.)
**/
@@ -254,37 +254,6 @@ gimp_file_save_thumbnail (gint32 image_ID,
}
/**
- * 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)
-{
- GimpParam *return_vals;
- gint nreturn_vals;
- gchar *name = NULL;
-
- return_vals = gimp_run_procedure ("gimp-temp-name",
- &nreturn_vals,
- GIMP_PDB_STRING, extension,
- GIMP_PDB_END);
-
- if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
- name = g_strdup (return_vals[1].data.d_string);
-
- gimp_destroy_params (return_vals, nreturn_vals);
-
- return name;
-}
-
-/**
* gimp_register_magic_load_handler:
* @procedure_name: The name of the procedure to be used for loading.
* @extensions: comma separated list of extensions this handler can load (i.e. \"jpg,jpeg\").
diff --git a/libgimp/gimpfileops_pdb.h b/libgimp/gimpfileops_pdb.h
index f7403d1..88b30c0 100644
--- a/libgimp/gimpfileops_pdb.h
+++ b/libgimp/gimpfileops_pdb.h
@@ -49,7 +49,6 @@ gboolean gimp_file_save (GimpRunMode run_mode,
const gchar *raw_filename);
gboolean gimp_file_save_thumbnail (gint32 image_ID,
const gchar *filename);
-gchar* gimp_temp_name (const gchar *extension);
gboolean gimp_register_magic_load_handler (const gchar *procedure_name,
const gchar *extensions,
const gchar *prefixes,
diff --git a/tools/pdbgen/pdb/fileops.pdb b/tools/pdbgen/pdb/fileops.pdb
index 02eac06..d04f65f 100644
--- a/tools/pdbgen/pdb/fileops.pdb
+++ b/tools/pdbgen/pdb/fileops.pdb
@@ -442,39 +442,6 @@ CODE
);
}
-sub temp_name {
- $blurb = 'Generates a unique filename.';
-
- $help = <<'HELP';
-Generates a unique filename using the temp path supplied in the user's gimprc.
-HELP
-
- &josh_pdb_misc('1997');
-
- @inargs = (
- { name => 'extension', type => 'string',
- allow_non_utf8 => 1, null_ok => 1,
- desc => 'The extension the file will have' }
- );
-
- @outargs = (
- { name => 'name', type => 'string',
- desc => 'The new temp filename' }
- );
-
- %invoke = (
- code => <<'CODE'
-{
- GFile *file = gimp_get_temp_file (gimp, extension);
-
- name = g_file_get_path (file);
-
- g_object_unref (file);
-}
-CODE
- );
-}
-
sub register_magic_load_handler {
$blurb = 'Registers a file load handler procedure.';
@@ -703,7 +670,6 @@ CODE
file_save
file_load_thumbnail
file_save_thumbnail
- temp_name
register_magic_load_handler
register_load_handler
register_save_handler
@@ -711,11 +677,11 @@ CODE
register_file_handler_uri
register_thumbnail_loader);
-%exports = (app => [@procs], lib => [@procs[0..3,5..12]]);
+%exports = (app => [@procs], lib => [@procs[0..3,5..11]]);
$desc = 'File Operations';
$doc_title = 'gimpfileops';
-$doc_short_desc = 'File operations (load, save, etc.)';
-$doc_long_desc = 'File operations (load, save, etc.)';
+$doc_short_desc = 'Image file operations (load, save, etc.)';
+$doc_long_desc = 'Image file operations (load, save, etc.)';
1;
diff --git a/tools/pdbgen/pdb/gimp.pdb b/tools/pdbgen/pdb/gimp.pdb
index 0021161..6efe294 100644
--- a/tools/pdbgen/pdb/gimp.pdb
+++ b/tools/pdbgen/pdb/gimp.pdb
@@ -189,6 +189,38 @@ sub get_parasite_list {
CODE
);
}
+sub temp_name {
+ $blurb = 'Generates a unique filename.';
+
+ $help = <<'HELP';
+Generates a unique filename using the temp path supplied in the user's gimprc.
+HELP
+
+ &josh_pdb_misc('1997');
+
+ @inargs = (
+ { name => 'extension', type => 'string',
+ allow_non_utf8 => 1, null_ok => 1,
+ desc => 'The extension the file will have' }
+ );
+
+ @outargs = (
+ { name => 'name', type => 'string',
+ desc => 'The new temp filename' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GFile *file = gimp_get_temp_file (gimp, extension);
+
+ name = g_file_get_path (file);
+
+ g_object_unref (file);
+}
+CODE
+ );
+}
@headers = qw("core/gimp.h"
@@ -199,9 +231,10 @@ CODE
quit
attach_parasite detach_parasite
get_parasite
- get_parasite_list);
+ get_parasite_list
+ temp_name);
-%exports = (app => [@procs], lib => [@procs[0..1,3..6]]);
+%exports = (app => [@procs], lib => [@procs[0..1,3..7]]);
$desc = 'Miscellaneous';
$doc_title = 'gimp';
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]