[Xfce4-commits] <thunar:master> Fast read content type of unreadable files (bug #9553).

Nick Schermer noreply at xfce.org
Wed Dec 5 20:48:01 CET 2012


Updating branch refs/heads/master
         to f5e96de026544d26ae9d0ea45bb818949491c03f (commit)
       from cc8b35bf6448b84e809428c97af7d73d21deee42 (commit)

commit f5e96de026544d26ae9d0ea45bb818949491c03f
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Dec 5 20:45:47 2012 +0100

    Fast read content type of unreadable files (bug #9553).
    
    Some files that were not readable locked the interface
    (/proc/kmsg as root for example). So only do fast-type-checking
    (no reading).

 thunar/thunar-file.c        |    6 ++++--
 thunarx/thunarx-file-info.h |    3 ---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index f267cb9..a2a4504 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -2257,7 +2257,9 @@ thunar_file_get_content_type (ThunarFile *file)
         {
           /* async load the content-type */
           info = g_file_query_info (file->gfile,
-                                    THUNARX_FILE_INFO_MIME_NAMESPACE,
+                                    thunar_file_is_readable (file) ?
+                                        G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE :
+                                        G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
                                     G_FILE_QUERY_INFO_NONE,
                                     NULL, &err);
 
@@ -2279,7 +2281,7 @@ thunar_file_get_content_type (ThunarFile *file)
 
           /* always provide a fallback */
           if (file->content_type == NULL)
-            file->content_type = g_strdup ("unknown");
+            file->content_type = g_strdup ("application/octet-stream");
         }
 
       bailout:
diff --git a/thunarx/thunarx-file-info.h b/thunarx/thunarx-file-info.h
index 304089a..36c6670 100644
--- a/thunarx/thunarx-file-info.h
+++ b/thunarx/thunarx-file-info.h
@@ -49,9 +49,6 @@ G_BEGIN_DECLS;
   "unix::gid,unix::uid,unix::mode," \
   "metadata::emblems"
 
-#define THUNARX_FILE_INFO_MIME_NAMESPACE \
-  "standard::content-type"
-
 
 
 /**


More information about the Xfce4-commits mailing list