[gvfs] g_vfs_backend_afc_set_info_from_afcinfo: set content type even if matcher is NULL



commit 7900fd49cb10286976d5472645f69313692454c8
Author: Nikias Bassen <nikias gmx li>
Date:   Mon Mar 15 14:39:34 2010 +0100

    g_vfs_backend_afc_set_info_from_afcinfo: set content type even if matcher is NULL
    
    https://bugzilla.gnome.org/show_bug.cgi?id=612536

 daemon/gvfsbackendafc.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index c056718..2b7744a 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -781,6 +781,7 @@ g_vfs_backend_afc_set_info_from_afcinfo (GVfsBackendAfc *self,
           else if (g_str_equal (afcinfo[i+1], "S_IFDIR"))
             {
               type = G_FILE_TYPE_DIRECTORY;
+              content_type = g_strdup ("inode/directory");
             }
           else if (g_str_equal (afcinfo[i+1], "S_IFLNK"))
             {
@@ -825,6 +826,15 @@ g_vfs_backend_afc_set_info_from_afcinfo (GVfsBackendAfc *self,
         }
     }
 
+  if (content_type == NULL)
+    content_type = g_content_type_guess (basename, NULL, 0, NULL);
+  
+  if (content_type)
+    {
+      g_file_info_set_content_type (info, content_type);
+      g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, content_type);
+    }
+
   /* and set some additional info */
   g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_UID, getuid ());
   g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_GID, getgid ());
@@ -838,13 +848,10 @@ g_vfs_backend_afc_set_info_from_afcinfo (GVfsBackendAfc *self,
     {
       if (type == G_FILE_TYPE_DIRECTORY)
         {
-          content_type = g_strdup ("inode/directory");
           icon = g_themed_icon_new ("folder");
         }
       else
         {
-          if (content_type == NULL)
-            content_type = g_content_type_guess (basename, NULL, 0, NULL);
           if (content_type)
             {
               icon = g_content_type_get_icon (content_type);
@@ -853,12 +860,6 @@ g_vfs_backend_afc_set_info_from_afcinfo (GVfsBackendAfc *self,
             }
         }
 
-      if (content_type)
-        {
-          g_file_info_set_content_type (info, content_type);
-          g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, content_type);
-        }
-
       if (icon == NULL)
         icon = g_themed_icon_new ("text-x-generic");
 



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