[maemo-commits] [maemo-commits] r19520 - in projects/haf/trunk/gnome-vfs-filechooser-backend: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Nov 25 15:51:18 EET 2009
Author: mordinasillopis
Date: 2009-11-25 15:51:04 +0200 (Wed, 25 Nov 2009)
New Revision: 19520

Modified:
   projects/haf/trunk/gnome-vfs-filechooser-backend/ChangeLog
   projects/haf/trunk/gnome-vfs-filechooser-backend/src/gtkfilesystemgnomevfs.c
Log:
Alban Crequy's patch for NB#147027:
* src/gtkfilesystemgnomevfs.c: check VFAT hidden attribute


Modified: projects/haf/trunk/gnome-vfs-filechooser-backend/ChangeLog
===================================================================
--- projects/haf/trunk/gnome-vfs-filechooser-backend/ChangeLog	2009-11-25 11:12:22 UTC (rev 19519)
+++ projects/haf/trunk/gnome-vfs-filechooser-backend/ChangeLog	2009-11-25 13:51:04 UTC (rev 19520)
@@ -1,3 +1,7 @@
+2009-11-23  Alban Crequy  <alban.crequy at collabora.co.uk>
+ 
+ 	* src/gtkfilesystemgnomevfs.c: check VFAT hidden attribute, NB#147027
+
 2009-07-08  Richard Hult  <richard at imendio.com>
 
 	* Release 1.10.1.

Modified: projects/haf/trunk/gnome-vfs-filechooser-backend/src/gtkfilesystemgnomevfs.c
===================================================================
--- projects/haf/trunk/gnome-vfs-filechooser-backend/src/gtkfilesystemgnomevfs.c	2009-11-25 11:12:22 UTC (rev 19519)
+++ projects/haf/trunk/gnome-vfs-filechooser-backend/src/gtkfilesystemgnomevfs.c	2009-11-25 13:51:04 UTC (rev 19520)
@@ -58,7 +58,14 @@
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
+#include <inttypes.h>
+#include <sys/ioctl.h>
+#include <linux/msdos_fs.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 
+
 #undef PROFILE_FILE_CHOOSER
 #ifdef PROFILE_FILE_CHOOSER
 #define PROFILE_INDENT 4
@@ -3100,6 +3107,25 @@
       else
 	is_hidden = (vfs_info->name && vfs_info->name[0] == '.');
 
+      if (!is_hidden && !is_desktop)
+        {
+          /* If the file is on VFAT and if the hidden attribute is set, we
+           * consider the file to be hidden, Bug #147027 */
+	  char *local_file = gnome_vfs_get_local_path_from_uri (uri);
+	  if (local_file != NULL)
+            {
+              int fd = open (local_file, O_RDONLY);
+              if (fd != -1)
+                {
+                  __u32 attrs;
+                  if (ioctl(fd, FAT_IOCTL_GET_ATTRIBUTES, &attrs) == 0)
+                    is_hidden = attrs & ATTR_HIDDEN ? TRUE : FALSE;
+                  close (fd);
+                }
+	      g_free (local_file);
+            }
+        }
+
       gtk_file_info_set_is_hidden (info, is_hidden);
     }
 

More information about the maemo-commits mailing list