comparison src/filedata.c @ 1662:7a4034d32503

warn if another operation is performed on a file with unsaved metadata
author nadvornik
date Sun, 28 Jun 2009 09:08:25 +0000
parents 8b2ba0e1fc09
children ece97f3f2305
comparison
equal deleted inserted replaced
1661:28863300018a 1662:7a4034d32503
1853 } 1853 }
1854 1854
1855 dir = remove_level_from_path(fd->path); 1855 dir = remove_level_from_path(fd->path);
1856 1856
1857 if (fd->change->type != FILEDATA_CHANGE_DELETE && 1857 if (fd->change->type != FILEDATA_CHANGE_DELETE &&
1858 fd->change->type != FILEDATA_CHANGE_MOVE && /* the unsaved metadata should survive move and rename operations */
1859 fd->change->type != FILEDATA_CHANGE_RENAME &&
1860 fd->change->type != FILEDATA_CHANGE_WRITE_METADATA &&
1861 fd->modified_xmp)
1862 {
1863 ret |= CHANGE_WARN_UNSAVED_META;
1864 DEBUG_1("Change checked: unsaved metadata: %s", fd->path);
1865 }
1866
1867 if (fd->change->type != FILEDATA_CHANGE_DELETE &&
1858 fd->change->type != FILEDATA_CHANGE_WRITE_METADATA && 1868 fd->change->type != FILEDATA_CHANGE_WRITE_METADATA &&
1859 !access_file(fd->path, R_OK)) 1869 !access_file(fd->path, R_OK))
1860 { 1870 {
1861 ret |= CHANGE_NO_READ_PERM; 1871 ret |= CHANGE_NO_READ_PERM;
1862 DEBUG_1("Change checked: no read permission: %s", fd->path); 1872 DEBUG_1("Change checked: no read permission: %s", fd->path);
2127 { 2137 {
2128 if (result->len > 0) g_string_append(result, ", "); 2138 if (result->len > 0) g_string_append(result, ", ");
2129 g_string_append(result, _("source and destination have different extension")); 2139 g_string_append(result, _("source and destination have different extension"));
2130 } 2140 }
2131 2141
2142 if (error & CHANGE_WARN_UNSAVED_META)
2143 {
2144 if (result->len > 0) g_string_append(result, ", ");
2145 g_string_append(result, _("there are unsaved metadata changes for the file"));
2146 }
2147
2132 return g_string_free(result, FALSE); 2148 return g_string_free(result, FALSE);
2133 } 2149 }
2134 2150
2135 gint file_data_verify_ci_list(GList *list, gchar **desc, gboolean with_sidecars) 2151 gint file_data_verify_ci_list(GList *list, gchar **desc, gboolean with_sidecars)
2136 { 2152 {