[gimp] pdb, libgimp: change "filename" to "file" in gimp_pdb_dump()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] pdb, libgimp: change "filename" to "file" in gimp_pdb_dump()
- Date: Wed, 11 Sep 2019 20:38:09 +0000 (UTC)
commit 14af676b51108bc0006d3096d8c358102d9af440
Author: Michael Natterer <mitch gimp org>
Date: Wed Sep 11 22:37:40 2019 +0200
pdb, libgimp: change "filename" to "file" in gimp_pdb_dump()
app/pdb/pdb-cmds.c | 24 +++++++++++-------------
libgimp/gimppdb.c | 9 +--------
libgimp/gimppdb_pdb.c | 6 +++---
libgimp/gimppdb_pdb.h | 2 +-
pdb/groups/pdb.pdb | 12 +++++-------
5 files changed, 21 insertions(+), 32 deletions(-)
---
diff --git a/app/pdb/pdb-cmds.c b/app/pdb/pdb-cmds.c
index 8e48ec57f3..d63e1405a4 100644
--- a/app/pdb/pdb-cmds.c
+++ b/app/pdb/pdb-cmds.c
@@ -101,17 +101,16 @@ pdb_dump_invoker (GimpProcedure *procedure,
GError **error)
{
gboolean success = TRUE;
- const gchar *filename;
+ GFile *file;
- filename = g_value_get_string (gimp_value_array_index (args, 0));
+ file = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
- GFile *file = g_file_new_for_path (filename);
-
- success = gimp_pdb_dump (gimp->pdb, file, error);
-
- g_object_unref (file);
+ if (file)
+ success = gimp_pdb_dump (gimp->pdb, file, error);
+ else
+ success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@@ -1212,12 +1211,11 @@ register_pdb_procs (GimpPDB *pdb)
"Spencer Kimball & Josh MacDonald & Peter Mattis",
"1995-1996");
gimp_procedure_add_argument (procedure,
- gimp_param_spec_string ("filename",
- "filename",
- "The dump filename",
- TRUE, FALSE, TRUE,
- NULL,
- GIMP_PARAM_READWRITE));
+ g_param_spec_object ("file",
+ "file",
+ "The dump filename",
+ G_TYPE_FILE,
+ GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
diff --git a/libgimp/gimppdb.c b/libgimp/gimppdb.c
index 6f665a4987..3e338ff074 100644
--- a/libgimp/gimppdb.c
+++ b/libgimp/gimppdb.c
@@ -374,17 +374,10 @@ gboolean
gimp_pdb_dump_to_file (GimpPDB *pdb,
GFile *file)
{
- gchar *path;
- gboolean success;
-
g_return_val_if_fail (GIMP_IS_PDB (pdb), FALSE);
g_return_val_if_fail (G_IS_FILE (pdb), FALSE);
- path = g_file_get_path (file);
- success = _gimp_pdb_dump (path);
- g_free (path);
-
- return success;
+ return _gimp_pdb_dump (file);
}
/**
diff --git a/libgimp/gimppdb_pdb.c b/libgimp/gimppdb_pdb.c
index 7e9407a4a0..1773afde92 100644
--- a/libgimp/gimppdb_pdb.c
+++ b/libgimp/gimppdb_pdb.c
@@ -61,7 +61,7 @@ _gimp_pdb_temp_name (void)
/**
* _gimp_pdb_dump:
- * @filename: The dump filename.
+ * @file: The dump filename.
*
* Dumps the current contents of the procedural database
*
@@ -72,14 +72,14 @@ _gimp_pdb_temp_name (void)
* Returns: TRUE on success.
**/
gboolean
-_gimp_pdb_dump (const gchar *filename)
+_gimp_pdb_dump (GFile *file)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- G_TYPE_STRING, filename,
+ G_TYPE_FILE, file,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
diff --git a/libgimp/gimppdb_pdb.h b/libgimp/gimppdb_pdb.h
index fbfa9e6d5a..e2ae9d3741 100644
--- a/libgimp/gimppdb_pdb.h
+++ b/libgimp/gimppdb_pdb.h
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
G_GNUC_INTERNAL gchar* _gimp_pdb_temp_name (void);
-G_GNUC_INTERNAL gboolean _gimp_pdb_dump (const gchar *filename);
+G_GNUC_INTERNAL gboolean _gimp_pdb_dump (GFile *file);
G_GNUC_INTERNAL gboolean _gimp_pdb_query (const gchar *name,
const gchar *blurb,
const gchar *help,
diff --git a/pdb/groups/pdb.pdb b/pdb/groups/pdb.pdb
index c40db9ad97..b8ad965ac7 100644
--- a/pdb/groups/pdb.pdb
+++ b/pdb/groups/pdb.pdb
@@ -60,19 +60,17 @@ HELP
$lib_private = 1;
@inargs = (
- { name => 'filename', type => 'string', allow_non_utf8 => 1,
- non_empty => 1,
+ { name => 'file', type => 'file',
desc => 'The dump filename' }
);
%invoke = (
code => <<'CODE'
{
- GFile *file = g_file_new_for_path (filename);
-
- success = gimp_pdb_dump (gimp->pdb, file, error);
-
- g_object_unref (file);
+ if (file)
+ success = gimp_pdb_dump (gimp->pdb, file, error);
+ else
+ success = FALSE;
}
CODE
);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]