app: Move import and export URI updates to file_save()

We should handle import-URI and export-URI at a lower level so
e.g. the import URI is reset when gimp_dnd_xds_save_image() is
used.

This change also simplifies unit testing.
This commit is contained in:
Martin Nordholts 2011-02-02 22:08:52 +01:00
parent 1702822720
commit 6c6cf7a881
2 changed files with 22 additions and 24 deletions

View File

@ -194,36 +194,21 @@ file_save_dialog_response (GtkWidget *save_dialog,
FALSE))
{
/* Save was successful, now store the URI in a couple of
* places
* places that depend on it being the user that made a
* save. Lower-level URI management is handled in
* file_save()
*/
if (dialog->save_a_copy)
gimp_image_set_save_a_copy_uri (dialog->image, uri);
if (! dialog->export)
{
g_object_set_data_full (G_OBJECT (dialog->image->gimp),
GIMP_FILE_SAVE_LAST_URI_KEY,
g_strdup (uri), (GDestroyNotify) g_free);
/* Forget the import source when we save. We interpret a
* save as that the user is not interested in being able
* to quickly export back to the original any longer
*/
gimp_image_set_imported_uri (dialog->image, NULL);
}
g_object_set_data_full (G_OBJECT (dialog->image->gimp),
GIMP_FILE_SAVE_LAST_URI_KEY,
g_strdup (uri), (GDestroyNotify) g_free);
else
{
g_object_set_data_full (G_OBJECT (dialog->image->gimp),
GIMP_FILE_EXPORT_LAST_URI_KEY,
g_strdup (uri), (GDestroyNotify) g_free);
/* Remeber the last entered Export URI for the image. We
* only need to do this explicitly when exporting. It
* happens implicitly when saving since the GimpObject name
* of a GimpImage is the last-save URI
*/
gimp_image_set_exported_uri (dialog->image, uri);
}
g_object_set_data_full (G_OBJECT (dialog->image->gimp),
GIMP_FILE_EXPORT_LAST_URI_KEY,
g_strdup (uri), (GDestroyNotify) g_free);
/* make sure the menus are updated with the keys we've just set */
gimp_image_flush (dialog->image);

View File

@ -160,10 +160,23 @@ file_save (Gimp *gimp,
gimp_image_set_uri (image, uri);
gimp_image_set_save_proc (image, file_proc);
/* Forget the import source when we save. We interpret a
* save as that the user is not interested in being able
* to quickly export back to the original any longer
*/
gimp_image_set_imported_uri (image, NULL);
gimp_image_clean_all (image);
}
else if (export)
{
/* Remeber the last entered Export URI for the image. We
* only need to do this explicitly when exporting. It
* happens implicitly when saving since the GimpObject name
* of a GimpImage is the last-save URI
*/
gimp_image_set_exported_uri (image, uri);
gimp_image_export_clean_all (image);
}