[gthumb] image metadata provider: set the mime type as well



commit bc206394802aaf70686a4260fcbb03415263135f
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Fri Apr 29 14:40:33 2011 +0200

    image metadata provider: set the mime type as well

 .../image_viewer/gth-metadata-provider-image.c     |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/extensions/image_viewer/gth-metadata-provider-image.c b/extensions/image_viewer/gth-metadata-provider-image.c
index 3d43635..9567b6c 100644
--- a/extensions/image_viewer/gth-metadata-provider-image.c
+++ b/extensions/image_viewer/gth-metadata-provider-image.c
@@ -38,9 +38,6 @@ gth_metadata_provider_image_can_read (GthMetadataProvider  *self,
 				      const char           *mime_type,
 				      char                **attribute_v)
 {
-	if (! g_str_equal (mime_type, "*") && ! _g_mime_type_is_image (mime_type))
-		return FALSE;
-
 	return _g_file_attributes_matches_any_v ("general::format,"
 			                         "general::dimensions,"
 						 "image::width,"
@@ -64,9 +61,7 @@ gth_metadata_provider_image_read (GthMetadataProvider *self,
 	char             *description;
 	int               width;
 	int               height;
-
-	if (! _g_mime_type_is_image (gth_file_data_get_mime_type (file_data)))
-		return;
+	const char       *mime_type = NULL;
 
 	format_recognized = FALSE;
 
@@ -111,6 +106,7 @@ gth_metadata_provider_image_read (GthMetadataProvider *self,
 
 				format_recognized = TRUE;
 				description = "PNG";
+				mime_type = "image/png";
 			}
 
 #if HAVE_LIBJPEG
@@ -140,6 +136,7 @@ gth_metadata_provider_image_read (GthMetadataProvider *self,
 				{
 					format_recognized = TRUE;
 					description = "JPEG";
+					mime_type = "image/jpeg";
 
 					if ((orientation == GTH_TRANSFORM_ROTATE_90)
 					     ||	(orientation == GTH_TRANSFORM_ROTATE_270)
@@ -186,6 +183,9 @@ gth_metadata_provider_image_read (GthMetadataProvider *self,
 		g_file_info_set_attribute_int32 (file_data->info, "frame::width", width);
 		g_file_info_set_attribute_int32 (file_data->info, "frame::height", height);
 
+		if (mime_type != NULL)
+			gth_file_data_set_mime_type (file_data, mime_type);
+
 		size = g_strdup_printf (_("%d Ã? %d"), width, height);
 		g_file_info_set_attribute_string (file_data->info, "general::dimensions", size);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]