app: Move save-on-copy URI remembering to the appropriate place

The Save a copy-URI shall only be remembered when the URI has been
entered through the dialog, so move it from file_save() to
file_save_dialog_response(). This is a preparation for the future
where we need to pass TRUE to save_a_copy without the URI being
remembered.
This commit is contained in:
Martin Nordholts 2009-05-04 21:00:41 +02:00
parent 0da1c4cb7c
commit edac194b23
2 changed files with 21 additions and 14 deletions

View File

@ -141,10 +141,29 @@ file_save_dialog_response (GtkWidget *save_dialog,
dialog->save_a_copy,
FALSE))
{
/* Save was successful, now store the URI in a couple of
* places
*/
if (dialog->save_a_copy)
{
g_object_set_data_full (G_OBJECT (dialog->image),
GIMP_FILE_SAVE_A_COPY_URI_KEY,
g_strdup (uri), (GDestroyNotify) g_free);
}
else if (! dialog->save_a_copy &&
strcmp (uri, gimp_image_get_uri (dialog->image)) != 0)
{
/* reset the "save-a-copy" filename on URI Change */
g_object_set_data (G_OBJECT (dialog->image),
GIMP_FILE_SAVE_A_COPY_URI_KEY,
NULL);
}
g_object_set_data_full (G_OBJECT (dialog->image->gimp),
GIMP_FILE_SAVE_LAST_URI_KEY,
g_strdup (uri), (GDestroyNotify) g_free);
/* Handle close-after-saing */
if (dialog)
{
GtkWindow *parent;

View File

@ -154,20 +154,8 @@ file_save (Gimp *gimp,
GimpDocumentList *documents;
GimpImagefile *imagefile;
if (save_a_copy)
if (! save_a_copy)
{
/* remember the "save-a-copy" filename for the next invocation */
g_object_set_data_full (G_OBJECT (image), GIMP_FILE_SAVE_A_COPY_URI_KEY,
g_strdup (uri),
(GDestroyNotify) g_free);
}
else
{
/* reset the "save-a-copy" filename when the image URI changes */
if (strcmp (uri, gimp_image_get_uri (image)))
g_object_set_data (G_OBJECT (image),
GIMP_FILE_SAVE_A_COPY_URI_KEY, NULL);
gimp_image_set_uri (image, uri);
gimp_image_set_save_proc (image, file_proc);