diff src/metadata.c @ 1567:c776b1310ca6

added an option to write image orientation to the metadata
author nadvornik
date Sun, 26 Apr 2009 09:01:35 +0000
parents ddb7aefb45cb
children 678009e94efe
line wrap: on
line diff
--- a/src/metadata.c	Sat Apr 25 22:08:09 2009 +0000
+++ b/src/metadata.c	Sun Apr 26 09:01:35 2009 +0000
@@ -189,6 +189,24 @@
 	return FALSE;
 }
 
+gboolean metadata_write_revert(FileData *fd, const gchar *key)
+{
+	if (!fd->modified_xmp) return FALSE;
+	
+	g_hash_table_remove(fd->modified_xmp, key);
+	
+	if (g_hash_table_size(fd->modified_xmp) == 0)
+		{
+		metadata_write_queue_remove(fd);
+		}
+	else
+		{
+		/* reread the metadata to restore the original value */
+		file_data_increment_version(fd);
+		file_data_send_notification(fd, NOTIFY_REREAD);
+		}
+}
+
 gboolean metadata_write_list(FileData *fd, const gchar *key, const GList *values)
 {
 	if (!fd->modified_xmp)
@@ -231,6 +249,13 @@
 	return ret;
 }
 
+gboolean metadata_write_int(FileData *fd, const gchar *key, guint64 value)
+{
+	gchar string[50];
+	
+	g_snprintf(string, sizeof(string), "%ld", value);
+	return metadata_write_string(fd, key, string);
+}
 
 /*
  *-------------------------------------------------------------------