eog r4885 - in trunk: . src



Author: friemann
Date: Wed Nov 26 11:21:19 2008
New Revision: 4885
URL: http://svn.gnome.org/viewvc/eog?rev=4885&view=rev

Log:
2008-11-26  Felix Riemann  <friemann svn gnome org>

	* src/eog-jobs.c: (filter_files):
	* src/eog-list-store.c: (eog_list_store_add_files): Try to check
	if a file is supported by content type as well, if the gvfs backend
	could not determine the file type. Fixes bug #562119.


Modified:
   trunk/ChangeLog
   trunk/src/eog-jobs.c
   trunk/src/eog-list-store.c

Modified: trunk/src/eog-jobs.c
==============================================================================
--- trunk/src/eog-jobs.c	(original)
+++ trunk/src/eog-jobs.c	Wed Nov 26 11:21:19 2008
@@ -345,12 +345,26 @@
 
 		if (file != NULL) {
 			file_info = g_file_query_info (file,
-						       G_FILE_ATTRIBUTE_STANDARD_TYPE,
+						       G_FILE_ATTRIBUTE_STANDARD_TYPE","G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
 						       0, NULL, NULL);
 			if (file_info == NULL) {
 				type = G_FILE_TYPE_UNKNOWN;
 			} else {
 				type = g_file_info_get_file_type (file_info);
+
+				/* Workaround for gvfs backends that
+				   don't set the GFileType. */
+				if (G_UNLIKELY (type == G_FILE_TYPE_UNKNOWN)) {
+					const gchar *ctype;
+			
+					ctype = g_file_info_get_content_type (file_info);
+
+					/* If the content type is supported
+					   adjust the file_type */
+					if (eog_image_is_supported_mime_type (ctype))
+						type = G_FILE_TYPE_REGULAR;
+				}
+
 				g_object_unref (file_info);
 			}
 		}

Modified: trunk/src/eog-list-store.c
==============================================================================
--- trunk/src/eog-list-store.c	(original)
+++ trunk/src/eog-list-store.c	Wed Nov 26 11:21:19 2008
@@ -563,12 +563,25 @@
 		GFile *file = (GFile *) it->data;
 
 		file_info = g_file_query_info (file,
-					       G_FILE_ATTRIBUTE_STANDARD_TYPE,
+					       G_FILE_ATTRIBUTE_STANDARD_TYPE","
+					       G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
 					       0, NULL, NULL);
 		if (file_info == NULL) {
 			continue;
 		}
 		file_type = g_file_info_get_file_type (file_info);
+
+		/* Workaround for gvfs backends that don't set the GFileType. */
+		if (G_UNLIKELY (file_type == G_FILE_TYPE_UNKNOWN)) {
+			const gchar *ctype;
+			
+			ctype = g_file_info_get_content_type (file_info);
+
+			/* If the content type is supported adjust file_type */
+			if (eog_image_is_supported_mime_type (ctype))
+				file_type = G_FILE_TYPE_REGULAR;
+		}
+
 		g_object_unref (file_info);
 
 		if (file_type == G_FILE_TYPE_DIRECTORY) {
@@ -582,8 +595,13 @@
 			file_info = g_file_query_info (file,
 						       G_FILE_ATTRIBUTE_STANDARD_TYPE,
 						       0, NULL, NULL);
-			file_type = g_file_info_get_file_type (file_info);
-			g_object_unref (file_info);
+
+			/* If we can't get a file_info,
+			   file_type will stay as G_FILE_TYPE_REGULAR */
+			if (file_info != NULL) {
+				file_type = g_file_info_get_file_type (file_info);
+				g_object_unref (file_info);
+			}
 
 			if (file_type == G_FILE_TYPE_DIRECTORY) {
 				eog_list_store_append_directory (store, file, file_type);



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