mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-10-06 09:32:41 +02:00
Fix file extension issue when "Saving As..." for guillotine
Original issue: #8581 1. When an image with a non-xcf format is loaded, within GIMP core it qualifies as an imported file. (See gimp_image_get_imported_file function) 2. But the guillotine plugin cannot propagate this information. It can only set the file path on the new image it creates, and it uses the file extension of the original imported file. 3. But since the filename is set by the plugin is the actual filename not imported filename, the gimpsavedialog.c module cannot differentiate it. This results in the incorrect file extension being set in the "gimp_save_dialog_set_image" function. This issue can actually be present in other plugins as well that generate new images which has to be checked.
This commit is contained in:
committed by
Jehan
parent
da1c7574d8
commit
57ee6e13ab
@@ -237,6 +237,7 @@ guillotine (gint32 image_ID,
|
||||
GString *new_filename;
|
||||
gchar *fileextension;
|
||||
gchar *fileindex;
|
||||
gchar *fileindex_with_xcf_extension;
|
||||
gint pos;
|
||||
|
||||
if (new_image == -1)
|
||||
@@ -263,13 +264,19 @@ guillotine (gint32 image_ID,
|
||||
/* show the rough coordinates of the image in the title */
|
||||
fileindex = g_strdup_printf (format, x, y);
|
||||
|
||||
/* preparation to replace original image extension with GIMP default
|
||||
see issue #8581 for details */
|
||||
fileindex_with_xcf_extension = g_strdup_printf ("%s.xcf", fileindex);
|
||||
g_free (fileindex);
|
||||
|
||||
/* get the position of the file extension - last . in filename */
|
||||
fileextension = strrchr (new_filename->str, '.');
|
||||
pos = fileextension - new_filename->str;
|
||||
|
||||
/* insert the coordinates before the extension */
|
||||
g_string_insert (new_filename, pos, fileindex);
|
||||
g_free (fileindex);
|
||||
g_string_truncate (new_filename, pos);
|
||||
g_string_insert (new_filename, pos, fileindex_with_xcf_extension);
|
||||
g_free (fileindex_with_xcf_extension);
|
||||
|
||||
gimp_image_set_filename (new_image, new_filename->str);
|
||||
g_string_free (new_filename, TRUE);
|
||||
|
Reference in New Issue
Block a user