1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 01:12:40 +02:00

pdb: Set image file when using gimp-file-save

gimp_file_save () lets you save an image to
any supported file format, but it did not
update the GimpImage's file or exported
file accordingly. This patch adds code to
do just that, patterned after /app/file/file-save.c's
file_save ().
This commit is contained in:
Alx Sa
2025-06-20 14:27:00 +00:00
parent 53750e2699
commit 5f65133e20
2 changed files with 44 additions and 0 deletions

View File

@@ -285,6 +285,28 @@ file_save_invoker (GimpProcedure *procedure,
gimp_object_get_name (proc),
new_args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) ==
GIMP_PDB_SUCCESS)
{
GimpImage *image =
g_value_get_object (gimp_value_array_index (new_args, 1));
if (! strcmp (gimp_object_get_name (proc), "gimp-xcf-save"))
{
gimp_image_set_file (image, file);
gimp_image_set_imported_file (image, NULL);
gimp_image_clean_all (image);
}
else
{
gimp_image_set_exported_file (image, file);
gimp_image_set_export_proc (image, file_proc);
gimp_image_set_imported_file (image, NULL);
gimp_image_export_clean_all (image);
}
}
gimp_value_array_unref (new_args);
return return_vals;

View File

@@ -306,6 +306,28 @@ HELP
gimp_object_get_name (proc),
new_args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) ==
GIMP_PDB_SUCCESS)
{
GimpImage *image =
g_value_get_object (gimp_value_array_index (new_args, 1));
if (! strcmp (gimp_object_get_name (proc), "gimp-xcf-save"))
{
gimp_image_set_file (image, file);
gimp_image_set_imported_file (image, NULL);
gimp_image_clean_all (image);
}
else
{
gimp_image_set_exported_file (image, file);
gimp_image_set_export_proc (image, file_proc);
gimp_image_set_imported_file (image, NULL);
gimp_image_export_clean_all (image);
}
}
gimp_value_array_unref (new_args);
return return_vals;