From 6c6cf7a881de1796bc8e43a47eee3e7624a9986a Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Wed, 2 Feb 2011 22:08:52 +0100 Subject: [PATCH] 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. --- app/dialogs/file-save-dialog.c | 33 +++++++++------------------------ app/file/file-save.c | 13 +++++++++++++ 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c index d9e27accf8..6c227bfce8 100644 --- a/app/dialogs/file-save-dialog.c +++ b/app/dialogs/file-save-dialog.c @@ -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); diff --git a/app/file/file-save.c b/app/file/file-save.c index ea1f10a4ef..356cc81b6b 100644 --- a/app/file/file-save.c +++ b/app/file/file-save.c @@ -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); }