comparison src/filedata.c @ 1677:c5c7e19fbb23

warn if another operation is performed on a file with unsaved metadata
author nadvornik
date Sun, 28 Jun 2009 09:08:25 +0000
parents b874e5697fbf
children 59c72fd324ce
comparison
equal deleted inserted replaced
1676:d27275bc008a 1677:c5c7e19fbb23
1861 } 1861 }
1862 1862
1863 dir = remove_level_from_path(fd->path); 1863 dir = remove_level_from_path(fd->path);
1864 1864
1865 if (fd->change->type != FILEDATA_CHANGE_DELETE && 1865 if (fd->change->type != FILEDATA_CHANGE_DELETE &&
1866 fd->change->type != FILEDATA_CHANGE_MOVE && /* the unsaved metadata should survive move and rename operations */
1867 fd->change->type != FILEDATA_CHANGE_RENAME &&
1868 fd->change->type != FILEDATA_CHANGE_WRITE_METADATA &&
1869 fd->modified_xmp)
1870 {
1871 ret |= CHANGE_WARN_UNSAVED_META;
1872 DEBUG_1("Change checked: unsaved metadata: %s", fd->path);
1873 }
1874
1875 if (fd->change->type != FILEDATA_CHANGE_DELETE &&
1866 fd->change->type != FILEDATA_CHANGE_WRITE_METADATA && 1876 fd->change->type != FILEDATA_CHANGE_WRITE_METADATA &&
1867 !access_file(fd->path, R_OK)) 1877 !access_file(fd->path, R_OK))
1868 { 1878 {
1869 ret |= CHANGE_NO_READ_PERM; 1879 ret |= CHANGE_NO_READ_PERM;
1870 DEBUG_1("Change checked: no read permission: %s", fd->path); 1880 DEBUG_1("Change checked: no read permission: %s", fd->path);
2135 { 2145 {
2136 if (result->len > 0) g_string_append(result, ", "); 2146 if (result->len > 0) g_string_append(result, ", ");
2137 g_string_append(result, _("source and destination have different extension")); 2147 g_string_append(result, _("source and destination have different extension"));
2138 } 2148 }
2139 2149
2150 if (error & CHANGE_WARN_UNSAVED_META)
2151 {
2152 if (result->len > 0) g_string_append(result, ", ");
2153 g_string_append(result, _("there are unsaved metadata changes for the file"));
2154 }
2155
2140 return g_string_free(result, FALSE); 2156 return g_string_free(result, FALSE);
2141 } 2157 }
2142 2158
2143 gint file_data_verify_ci_list(GList *list, gchar **desc, gboolean with_sidecars) 2159 gint file_data_verify_ci_list(GList *list, gchar **desc, gboolean with_sidecars)
2144 { 2160 {