Bug 727854 - Export file type should not be based on filename extension

Keep the export proc acound in the image (just as we keep around
the save proc), and use it when exporting again.
This commit is contained in:
Michael Natterer 2014-07-02 14:24:02 +02:00
parent 189c329a2c
commit 3dbae5e4d9
5 changed files with 28 additions and 5 deletions

View File

@ -299,13 +299,14 @@ file_save_cmd_callback (GtkAction *action,
case GIMP_SAVE_MODE_EXPORT:
case GIMP_SAVE_MODE_OVERWRITE:
{
const gchar *uri = NULL;
GimpPlugInProcedure *export_proc;
gboolean overwrite = FALSE;
const gchar *uri = NULL;
GimpPlugInProcedure *export_proc = NULL;
gboolean overwrite = FALSE;
if (save_mode == GIMP_SAVE_MODE_EXPORT)
{
uri = gimp_image_get_exported_uri (image);
uri = gimp_image_get_exported_uri (image);
export_proc = gimp_image_get_export_proc (image);
if (! uri)
{
@ -323,7 +324,7 @@ file_save_cmd_callback (GtkAction *action,
overwrite = TRUE;
}
if (uri)
if (uri && ! export_proc)
{
export_proc =
file_procedure_find (image->gimp->plug_in_manager->export_procs,

View File

@ -38,6 +38,7 @@ struct _GimpImagePrivate
GimpPlugInProcedure *load_proc; /* procedure used for loading */
GimpPlugInProcedure *save_proc; /* last save procedure used */
GimpPlugInProcedure *export_proc; /* last export procedure used */
gchar *display_name; /* display basename */
gchar *display_path; /* display full path */

View File

@ -2206,6 +2206,23 @@ gimp_image_get_save_proc (const GimpImage *image)
return GIMP_IMAGE_GET_PRIVATE (image)->save_proc;
}
void
gimp_image_set_export_proc (GimpImage *image,
GimpPlugInProcedure *proc)
{
g_return_if_fail (GIMP_IS_IMAGE (image));
GIMP_IMAGE_GET_PRIVATE (image)->export_proc = proc;
}
GimpPlugInProcedure *
gimp_image_get_export_proc (const GimpImage *image)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
return GIMP_IMAGE_GET_PRIVATE (image)->export_proc;
}
void
gimp_image_set_resolution (GimpImage *image,
gdouble xresolution,

View File

@ -163,6 +163,9 @@ void gimp_image_set_save_proc (GimpImage *image,
GimpPlugInProcedure * gimp_image_get_save_proc (const GimpImage *image);
void gimp_image_saved (GimpImage *image,
const gchar *uri);
void gimp_image_set_export_proc (GimpImage *image,
GimpPlugInProcedure *proc);
GimpPlugInProcedure * gimp_image_get_export_proc (const GimpImage *image);
void gimp_image_exported (GimpImage *image,
const gchar *uri);

View File

@ -198,6 +198,7 @@ file_save (Gimp *gimp,
* of a GimpImage is the last-save URI
*/
gimp_image_set_exported_uri (image, uri);
gimp_image_set_export_proc (image, file_proc);
/* An image can not be considered both exported and imported
* at the same time, so stop consider it as imported now