# HG changeset patch # User nadvornik # Date 1246180105 0 # Node ID c5c7e19fbb2385a6ff278130a86d8d22cc5ab0d1 # Parent d27275bc008ab7ee84855f5b2bb34f3c36f2a523 warn if another operation is performed on a file with unsaved metadata diff -r d27275bc008a -r c5c7e19fbb23 src/filedata.c --- a/src/filedata.c Sun Jun 28 08:49:28 2009 +0000 +++ b/src/filedata.c Sun Jun 28 09:08:25 2009 +0000 @@ -1863,6 +1863,16 @@ dir = remove_level_from_path(fd->path); if (fd->change->type != FILEDATA_CHANGE_DELETE && + fd->change->type != FILEDATA_CHANGE_MOVE && /* the unsaved metadata should survive move and rename operations */ + fd->change->type != FILEDATA_CHANGE_RENAME && + fd->change->type != FILEDATA_CHANGE_WRITE_METADATA && + fd->modified_xmp) + { + ret |= CHANGE_WARN_UNSAVED_META; + DEBUG_1("Change checked: unsaved metadata: %s", fd->path); + } + + if (fd->change->type != FILEDATA_CHANGE_DELETE && fd->change->type != FILEDATA_CHANGE_WRITE_METADATA && !access_file(fd->path, R_OK)) { @@ -2137,6 +2147,12 @@ g_string_append(result, _("source and destination have different extension")); } + if (error & CHANGE_WARN_UNSAVED_META) + { + if (result->len > 0) g_string_append(result, ", "); + g_string_append(result, _("there are unsaved metadata changes for the file")); + } + return g_string_free(result, FALSE); } diff -r d27275bc008a -r c5c7e19fbb23 src/typedefs.h --- a/src/typedefs.h Sun Jun 28 08:49:28 2009 +0000 +++ b/src/typedefs.h Sun Jun 28 09:08:25 2009 +0000 @@ -157,14 +157,15 @@ CHANGE_WARN_NO_WRITE_PERM = 1 << 1, CHANGE_WARN_SAME = 1 << 2, CHANGE_WARN_CHANGED_EXT = 1 << 3, - CHANGE_ERROR_MASK = (~0) << 4, /* the values below are fatal errors */ - CHANGE_NO_READ_PERM = 1 << 4, - CHANGE_NO_WRITE_PERM_DIR = 1 << 5, - CHANGE_NO_DEST_DIR = 1 << 6, - CHANGE_NO_WRITE_PERM_DEST_DIR = 1 << 7, - CHANGE_NO_WRITE_PERM_DEST = 1 << 8, - CHANGE_DEST_EXISTS = 1 << 9, - CHANGE_NO_SRC = 1 << 10, + CHANGE_WARN_UNSAVED_META = 1 << 4, + CHANGE_ERROR_MASK = (~0) << 8, /* the values below are fatal errors */ + CHANGE_NO_READ_PERM = 1 << 8, + CHANGE_NO_WRITE_PERM_DIR = 1 << 9, + CHANGE_NO_DEST_DIR = 1 << 10, + CHANGE_NO_WRITE_PERM_DEST_DIR = 1 << 11, + CHANGE_NO_WRITE_PERM_DEST = 1 << 12, + CHANGE_DEST_EXISTS = 1 << 13, + CHANGE_NO_SRC = 1 << 14, CHANGE_GENERIC_ERROR = 1 << 16 } ChangeError;