changeset 1686:4cb7c2245306

fixes for a built without Exiv2 don't try to access XMP metadata if not compiled with Exiv2 some metadata options are valid without Exiv2, do not disable them
author Vladimir Nadvornik <nadvornik@suse.cz>
date Tue, 30 Jun 2009 20:12:28 +0000
parents 041cdca65160
children fc88516f2993
files src/exif-common.c src/exif.c src/filedata.c src/metadata.c src/preferences.c src/rcfile.c
diffstat 6 files changed, 41 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/exif-common.c	Tue Jun 30 19:53:55 2009 +0000
+++ b/src/exif-common.c	Tue Jun 30 20:12:28 2009 +0000
@@ -619,9 +619,14 @@
 	
 	/* CACHE_TYPE_XMP_METADATA file should exist only if the metadata are
 	 * not writable directly, thus it should contain the most up-to-date version */
+	sidecar_path = NULL;
+
+#ifdef HAVE_EXIV2
+	/* we are not able to handle XMP sidecars without exiv2 */
 	sidecar_path = cache_find_location(CACHE_TYPE_XMP_METADATA, fd->path);
 
 	if (!sidecar_path) sidecar_path = file_data_get_sidecar_path(fd, TRUE);
+#endif
 
 	fd->exif = exif_read(fd->path, sidecar_path, fd->modified_xmp);
 
--- a/src/exif.c	Tue Jun 30 19:53:55 2009 +0000
+++ b/src/exif.c	Tue Jun 30 20:12:28 2009 +0000
@@ -1582,13 +1582,13 @@
 
 gboolean exif_write(ExifData *exif)
 {
-	log_printf("Not compiled with EXIF write support");
+	log_printf("Not compiled with EXIF write support\n");
 	return FALSE;
 }
 
 gboolean exif_write_sidecar(ExifData *exif, gchar *path)
 {
-	log_printf("Not compiled with EXIF write support");
+	log_printf("Not compiled with EXIF write support\n");
 	return FALSE;
 }
 
--- a/src/filedata.c	Tue Jun 30 19:53:55 2009 +0000
+++ b/src/filedata.c	Tue Jun 30 20:12:28 2009 +0000
@@ -1949,7 +1949,11 @@
 			/* If an existing metadata file exists, we will try writing to
 			 * it's location regardless of the user's preference.
 			 */
-			gchar *metadata_path = cache_find_location(CACHE_TYPE_XMP_METADATA, fd->path);
+			gchar *metadata_path = NULL;
+#ifdef HAVE_EXIV2
+			/* but ignore XMP if we are not able to write it */
+			metadata_path = cache_find_location(CACHE_TYPE_XMP_METADATA, fd->path);
+#endif
 			if (!metadata_path) metadata_path = cache_find_location(CACHE_TYPE_METADATA, fd->path);
 			
 			if (metadata_path && !access_file(metadata_path, W_OK))
--- a/src/metadata.c	Tue Jun 30 19:53:55 2009 +0000
+++ b/src/metadata.c	Tue Jun 30 20:12:28 2009 +0000
@@ -457,6 +457,10 @@
 		g_free(metadata_pathl);
 		g_free(metadata_path);
 		}
+
+#ifdef HAVE_EXIV2
+	/* without exiv2: do not delete xmp metadata because we are not able to convert it, 
+	   just ignore it */
 	metadata_path = cache_find_location(CACHE_TYPE_XMP_METADATA, fd->path);
 	if (metadata_path && (!except || strcmp(metadata_path, except) != 0)) 
 		{
@@ -465,6 +469,7 @@
 		g_free(metadata_pathl);
 		g_free(metadata_path);
 		}
+#endif
 }
 
 static gboolean metadata_legacy_read(FileData *fd, GList **keywords, gchar **comment)
--- a/src/preferences.c	Tue Jun 30 19:53:55 2009 +0000
+++ b/src/preferences.c	Tue Jun 30 20:12:28 2009 +0000
@@ -1594,16 +1594,19 @@
 
 	vbox = scrolled_notebook_page(notebook, _("Metadata"));
 
-#ifndef HAVE_EXIV2
-	gtk_widget_set_sensitive(vbox, FALSE);
-#endif
 
 	group = pref_group_new(vbox, FALSE, _("Metadata writing process"), GTK_ORIENTATION_VERTICAL);
+#ifndef HAVE_EXIV2
+	label = pref_label_new(group, _("Warning: Geeqie is built without Exiv2. Some options are disabled."));
+#endif
 	label = pref_label_new(group, _("Metadata are written in the following order. The process ends after first success."));
 	gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
 
 	ct_button = pref_checkbox_new_int(group, _("1) Save metadata in image files, resp. sidecar files, according to the XMP standard"),
 			      options->metadata.save_in_image_file, &c_options->metadata.save_in_image_file);
+#ifndef HAVE_EXIV2
+	gtk_widget_set_sensitive(ct_button, FALSE);
+#endif
 
 	pref_checkbox_new_int(group, _("2) Save metadata in '.metadata' folder, local to image folder (non-standard)"),
 			      options->metadata.enable_metadata_dirs, &c_options->metadata.enable_metadata_dirs);
@@ -1614,6 +1617,9 @@
 	g_free(text);
 
 	group = pref_group_new(vbox, FALSE, _("Step 1: Write to image files"), GTK_ORIENTATION_VERTICAL);
+#ifndef HAVE_EXIV2
+	gtk_widget_set_sensitive(group, FALSE);
+#endif
 
 	hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_SPACE);
 	pref_checkbox_link_sensitivity(ct_button, hbox);
@@ -1628,6 +1634,9 @@
 			      options->metadata.confirm_write, &c_options->metadata.confirm_write);
 
 	group = pref_group_new(vbox, FALSE, _("Step 2 and 3: write to Geeqie private files"), GTK_ORIENTATION_VERTICAL);
+#ifndef HAVE_EXIV2
+	gtk_widget_set_sensitive(group, FALSE);
+#endif
 
 	pref_checkbox_new_int(group, _("Use GQview legacy metadata format (supports only keywords and comments) instead of XMP"),
 			      options->metadata.save_legacy_format, &c_options->metadata.save_legacy_format);
@@ -1640,8 +1649,11 @@
 	pref_checkbox_new_int(group, _("Allow keywords to differ only in case"),
 			      options->metadata.keywords_case_sensitive, &c_options->metadata.keywords_case_sensitive);
 
-	pref_checkbox_new_int(group, _("Write altered image orientation to the metadata"),
+	ct_button = pref_checkbox_new_int(group, _("Write altered image orientation to the metadata"),
 			      options->metadata.write_orientation, &c_options->metadata.write_orientation);
+#ifndef HAVE_EXIV2
+	gtk_widget_set_sensitive(ct_button, FALSE);
+#endif
 
 	group = pref_group_new(vbox, FALSE, _("Auto-save options"), GTK_ORIENTATION_VERTICAL);
 
--- a/src/rcfile.c	Tue Jun 30 19:53:55 2009 +0000
+++ b/src/rcfile.c	Tue Jun 30 20:12:28 2009 +0000
@@ -877,6 +877,14 @@
 
 static void options_parse_global_end(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, gpointer data, GError **error)
 {
+#ifndef HAVE_EXIV2
+	/* some options do not work without exiv2 */
+	options->metadata.save_in_image_file = FALSE;
+	options->metadata.save_legacy_format = TRUE;
+	options->metadata.write_orientation = FALSE;
+	DEBUG_1("compiled without Exiv2 - disabling XMP write support");
+#endif
+
 	/* on startup there are no layout windows and this just loads the editors */
 	layout_editors_reload_all();
 }