Mercurial > geeqie
comparison src/filedata.c @ 1211:e2bbe90b0dcd
most of the metadata options now works
author | nadvornik |
---|---|
date | Sun, 21 Dec 2008 21:20:36 +0000 |
parents | 3ff2aa99108b |
children | 97f30a17dc6b |
comparison
equal
deleted
inserted
replaced
1210:cea120a73843 | 1211:e2bbe90b0dcd |
---|---|
1120 file_data_increment_version(fd); | 1120 file_data_increment_version(fd); |
1121 file_data_send_notification(fd, NOTIFY_TYPE_INTERNAL); | 1121 file_data_send_notification(fd, NOTIFY_TYPE_INTERNAL); |
1122 } | 1122 } |
1123 | 1123 |
1124 | 1124 |
1125 | |
1126 /* | 1125 /* |
1127 * file_data - operates on the given fd | 1126 * file_data - operates on the given fd |
1128 * file_data_sc - operates on the given fd + sidecars - all fds linked via fd->sidecar_files or fd->parent | 1127 * file_data_sc - operates on the given fd + sidecars - all fds linked via fd->sidecar_files or fd->parent |
1129 */ | 1128 */ |
1130 | 1129 |
1636 { | 1635 { |
1637 DEBUG_1("Change checked: no change info: %s", fd->path); | 1636 DEBUG_1("Change checked: no change info: %s", fd->path); |
1638 return ret; | 1637 return ret; |
1639 } | 1638 } |
1640 | 1639 |
1641 if (!isname(fd->path)) | 1640 if (!isname(fd->path) && |
1641 !filter_file_class(fd->extension, FORMAT_CLASS_META)) /* xmp sidecar can be eventually created from scratch */ | |
1642 { | 1642 { |
1643 /* this probably should not happen */ | 1643 /* this probably should not happen */ |
1644 ret |= CHANGE_NO_SRC; | 1644 ret |= CHANGE_NO_SRC; |
1645 DEBUG_1("Change checked: file does not exist: %s", fd->path); | 1645 DEBUG_1("Change checked: file does not exist: %s", fd->path); |
1646 return ret; | 1646 return ret; |
1647 } | 1647 } |
1648 | 1648 |
1649 dir = remove_level_from_path(fd->path); | 1649 dir = remove_level_from_path(fd->path); |
1650 | 1650 |
1651 if (fd->change->type != FILEDATA_CHANGE_DELETE && | 1651 if (fd->change->type != FILEDATA_CHANGE_DELETE && |
1652 fd->change->type != FILEDATA_CHANGE_WRITE_METADATA && | |
1652 !access_file(fd->path, R_OK)) | 1653 !access_file(fd->path, R_OK)) |
1653 { | 1654 { |
1654 ret |= CHANGE_NO_READ_PERM; | 1655 ret |= CHANGE_NO_READ_PERM; |
1655 DEBUG_1("Change checked: no read permission: %s", fd->path); | 1656 DEBUG_1("Change checked: no read permission: %s", fd->path); |
1656 } | 1657 } |
1660 ret |= CHANGE_NO_WRITE_PERM_DIR; | 1661 ret |= CHANGE_NO_WRITE_PERM_DIR; |
1661 DEBUG_1("Change checked: source dir is readonly: %s", fd->path); | 1662 DEBUG_1("Change checked: source dir is readonly: %s", fd->path); |
1662 } | 1663 } |
1663 else if (fd->change->type != FILEDATA_CHANGE_COPY && | 1664 else if (fd->change->type != FILEDATA_CHANGE_COPY && |
1664 fd->change->type != FILEDATA_CHANGE_UNSPECIFIED && | 1665 fd->change->type != FILEDATA_CHANGE_UNSPECIFIED && |
1666 fd->change->type != FILEDATA_CHANGE_WRITE_METADATA && | |
1665 !access_file(fd->path, W_OK)) | 1667 !access_file(fd->path, W_OK)) |
1666 { | 1668 { |
1667 ret |= CHANGE_WARN_NO_WRITE_PERM; | 1669 ret |= CHANGE_WARN_NO_WRITE_PERM; |
1668 DEBUG_1("Change checked: no write permission: %s", fd->path); | 1670 DEBUG_1("Change checked: no write permission: %s", fd->path); |
1669 } | 1671 } |
1670 | 1672 /* WRITE_METADATA is special because it can be configured to silently write to ~/.geeqie/... |
1673 - that means that there are no hard errors and warnings can be disabled | |
1674 */ | |
1675 else if (fd->change->type == FILEDATA_CHANGE_WRITE_METADATA && | |
1676 options->metadata.save_in_image_file && options->metadata.warn_on_write_problems) | |
1677 { | |
1678 if (isname(fd->path) && !access_file(fd->path, W_OK)) | |
1679 { | |
1680 ret |= CHANGE_WARN_NO_WRITE_PERM; | |
1681 DEBUG_1("Change checked: file is readonly: %s", fd->path); | |
1682 } | |
1683 | |
1684 else if (!access_file(dir, W_OK)) | |
1685 { | |
1686 ret |= CHANGE_WARN_NO_WRITE_PERM; | |
1687 DEBUG_1("Change checked: dir is readonly: %s", fd->path); | |
1688 } | |
1689 } | |
1690 | |
1671 if (fd->change->dest) | 1691 if (fd->change->dest) |
1672 { | 1692 { |
1673 gboolean same; | 1693 gboolean same; |
1674 gchar *dest_dir; | 1694 gchar *dest_dir; |
1675 | 1695 |