pdb, libgimp: change "filename" to "file" in gimp_pdb_dump()

This commit is contained in:
Michael Natterer 2019-09-11 22:37:40 +02:00
parent 6468fa06c7
commit 14af676b51
5 changed files with 21 additions and 32 deletions

View file

@ -101,17 +101,16 @@ pdb_dump_invoker (GimpProcedure *procedure,
GError **error) GError **error)
{ {
gboolean success = TRUE; 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) if (success)
{ {
GFile *file = g_file_new_for_path (filename); if (file)
success = gimp_pdb_dump (gimp->pdb, file, error); success = gimp_pdb_dump (gimp->pdb, file, error);
else
g_object_unref (file); success = FALSE;
} }
return gimp_procedure_get_return_values (procedure, success, return gimp_procedure_get_return_values (procedure, success,
@ -1212,11 +1211,10 @@ register_pdb_procs (GimpPDB *pdb)
"Spencer Kimball & Josh MacDonald & Peter Mattis", "Spencer Kimball & Josh MacDonald & Peter Mattis",
"1995-1996"); "1995-1996");
gimp_procedure_add_argument (procedure, gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("filename", g_param_spec_object ("file",
"filename", "file",
"The dump filename", "The dump filename",
TRUE, FALSE, TRUE, G_TYPE_FILE,
NULL,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure); g_object_unref (procedure);

View file

@ -374,17 +374,10 @@ gboolean
gimp_pdb_dump_to_file (GimpPDB *pdb, gimp_pdb_dump_to_file (GimpPDB *pdb,
GFile *file) GFile *file)
{ {
gchar *path;
gboolean success;
g_return_val_if_fail (GIMP_IS_PDB (pdb), FALSE); g_return_val_if_fail (GIMP_IS_PDB (pdb), FALSE);
g_return_val_if_fail (G_IS_FILE (pdb), FALSE); g_return_val_if_fail (G_IS_FILE (pdb), FALSE);
path = g_file_get_path (file); return _gimp_pdb_dump (file);
success = _gimp_pdb_dump (path);
g_free (path);
return success;
} }
/** /**

View file

@ -61,7 +61,7 @@ _gimp_pdb_temp_name (void)
/** /**
* _gimp_pdb_dump: * _gimp_pdb_dump:
* @filename: The dump filename. * @file: The dump filename.
* *
* Dumps the current contents of the procedural database * Dumps the current contents of the procedural database
* *
@ -72,14 +72,14 @@ _gimp_pdb_temp_name (void)
* Returns: TRUE on success. * Returns: TRUE on success.
**/ **/
gboolean gboolean
_gimp_pdb_dump (const gchar *filename) _gimp_pdb_dump (GFile *file)
{ {
GimpValueArray *args; GimpValueArray *args;
GimpValueArray *return_vals; GimpValueArray *return_vals;
gboolean success = TRUE; gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL, args = gimp_value_array_new_from_types (NULL,
G_TYPE_STRING, filename, G_TYPE_FILE, file,
G_TYPE_NONE); G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (), return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),

View file

@ -33,7 +33,7 @@ G_BEGIN_DECLS
G_GNUC_INTERNAL gchar* _gimp_pdb_temp_name (void); 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, G_GNUC_INTERNAL gboolean _gimp_pdb_query (const gchar *name,
const gchar *blurb, const gchar *blurb,
const gchar *help, const gchar *help,

View file

@ -60,19 +60,17 @@ HELP
$lib_private = 1; $lib_private = 1;
@inargs = ( @inargs = (
{ name => 'filename', type => 'string', allow_non_utf8 => 1, { name => 'file', type => 'file',
non_empty => 1,
desc => 'The dump filename' } desc => 'The dump filename' }
); );
%invoke = ( %invoke = (
code => <<'CODE' code => <<'CODE'
{ {
GFile *file = g_file_new_for_path (filename); if (file)
success = gimp_pdb_dump (gimp->pdb, file, error); success = gimp_pdb_dump (gimp->pdb, file, error);
else
g_object_unref (file); success = FALSE;
} }
CODE CODE
); );