]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkfilesystemunix.c
2.8.2
[~andy/gtk] / gtk / gtkfilesystemunix.c
index 93fcbc0bad06332139f3acfda1a1d3f57595a5ce..403b52129f9bf9a6decdacded20911028b965f89 100644 (file)
@@ -24,6 +24,8 @@
 #include "gtkfilesystemunix.h"
 #include "gtkicontheme.h"
 #include "gtkintl.h"
+#include "gtkstock.h"
+#include "gtkalias.h"
 
 #define XDG_PREFIX _gtk_xdg
 #include "xdgmime/xdgmime.h"
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <pwd.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <stdio.h>
 #include <time.h>
 
 #define BOOKMARKS_FILENAME ".gtk-bookmarks"
-#define BOOKMARKS_TMP_FILENAME ".gtk-bookmarks-XXXXXX"
+
+#define HIDDEN_FILENAME ".hidden"
 
 #define FOLDER_CACHE_LIFETIME 2 /* seconds */
 
@@ -58,14 +63,21 @@ struct _GtkFileSystemUnix
   GObject parent_instance;
 
   GHashTable *folder_hash;
+
+  /* For /afs and /net */
+  struct stat afs_statbuf;
+  struct stat net_statbuf;
+
+  guint have_afs : 1;
+  guint have_net : 1;
 };
 
 /* Icon type, supplemented by MIME type
  */
 typedef enum {
-  ICON_UNDECIDED,
-  ICON_NONE,
-  ICON_REGULAR,        /* Use mime type for icon */
+  ICON_UNDECIDED, /* Only used while we have not yet computed the icon in a struct stat_info_entry */
+  ICON_NONE,      /* "Could not compute the icon type" */
+  ICON_REGULAR,          /* Use mime type for icon */
   ICON_BLOCK_DEVICE,
   ICON_BROKEN_SYMBOLIC_LINK,
   ICON_CHARACTER_DEVICE,
@@ -99,8 +111,10 @@ struct _GtkFileFolderUnix
   GtkFileInfoType types;
   gchar *filename;
   GHashTable *stat_info;
-  unsigned int have_stat : 1;
-  unsigned int have_mime_type : 1;
+  guint have_stat : 1;
+  guint have_mime_type : 1;
+  guint is_network_dir : 1;
+  guint have_hidden : 1;
   time_t asof;
 };
 
@@ -108,10 +122,10 @@ struct stat_info_entry {
   struct stat statbuf;
   char *mime_type;
   IconType icon_type;
+  gboolean hidden;
 };
 
 static const GtkFileInfoType STAT_NEEDED_MASK = (GTK_FILE_INFO_IS_FOLDER |
-                                                GTK_FILE_INFO_IS_HIDDEN |
                                                 GTK_FILE_INFO_MODIFICATION_TIME |
                                                 GTK_FILE_INFO_SIZE);
 
@@ -189,7 +203,12 @@ static gboolean gtk_file_system_unix_insert_bookmark (GtkFileSystem     *file_sy
 static gboolean gtk_file_system_unix_remove_bookmark (GtkFileSystem     *file_system,
                                                      const GtkFilePath *path,
                                                      GError           **error);
-static GSList * gtk_file_system_unix_list_bookmarks  (GtkFileSystem *file_system);
+static GSList * gtk_file_system_unix_list_bookmarks  (GtkFileSystem     *file_system);
+static gchar  * gtk_file_system_unix_get_bookmark_label (GtkFileSystem     *file_system,
+                                                        const GtkFilePath *path);
+static void     gtk_file_system_unix_set_bookmark_label (GtkFileSystem     *file_system,
+                                                        const GtkFilePath *path,
+                                                        const gchar       *label);
 
 static GType gtk_file_folder_unix_get_type   (void);
 static void  gtk_file_folder_unix_class_init (GtkFileFolderUnixClass *class);
@@ -210,9 +229,13 @@ static GtkFilePath *filename_to_path   (const gchar       *filename);
 
 static gboolean     filename_is_root  (const char       *filename);
 
+static gboolean file_is_hidden (GtkFileFolderUnix *folder_unix,
+                               const char        *basename);
+
 static gboolean fill_in_names (GtkFileFolderUnix *folder_unix, GError **error);
-static gboolean fill_in_stats (GtkFileFolderUnix *folder_unix, GError **error);
-static gboolean fill_in_mime_type (GtkFileFolderUnix *folder_unix, GError **error);
+static void fill_in_stats (GtkFileFolderUnix *folder_unix);
+static void fill_in_mime_type (GtkFileFolderUnix *folder_unix);
+static void fill_in_hidden (GtkFileFolderUnix *folder_unix);
 
 static char *       get_parent_dir    (const char       *filename);
 
@@ -306,12 +329,24 @@ gtk_file_system_unix_iface_init   (GtkFileSystemIface *iface)
   iface->insert_bookmark = gtk_file_system_unix_insert_bookmark;
   iface->remove_bookmark = gtk_file_system_unix_remove_bookmark;
   iface->list_bookmarks = gtk_file_system_unix_list_bookmarks;
+  iface->get_bookmark_label = gtk_file_system_unix_get_bookmark_label;
+  iface->set_bookmark_label = gtk_file_system_unix_set_bookmark_label;
 }
 
 static void
 gtk_file_system_unix_init (GtkFileSystemUnix *system_unix)
 {
   system_unix->folder_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+  if (stat ("/afs", &system_unix->afs_statbuf) == 0)
+    system_unix->have_afs = TRUE;
+  else
+    system_unix->have_afs = FALSE;
+
+  if (stat ("/net", &system_unix->net_statbuf) == 0)
+    system_unix->have_net = TRUE;
+  else
+    system_unix->have_net = FALSE;
 }
 
 static void
@@ -370,7 +405,7 @@ gtk_file_system_unix_get_folder (GtkFileSystem     *file_system,
   GtkFileFolderUnix *folder_unix;
   const char *filename;
   char *filename_copy;
-  time_t now = time (NULL);
+  gboolean set_asof = FALSE;
 
   system_unix = GTK_FILE_SYSTEM_UNIX (file_system);
 
@@ -384,8 +419,8 @@ gtk_file_system_unix_get_folder (GtkFileSystem     *file_system,
   if (folder_unix)
     {
       g_free (filename_copy);
-      if (now - folder_unix->asof >= FOLDER_CACHE_LIFETIME &&
-         folder_unix->stat_info)
+      if (folder_unix->stat_info &&
+         time (NULL) - folder_unix->asof >= FOLDER_CACHE_LIFETIME)
        {
 #if 0
          g_print ("Cleaning out cached directory %s\n", filename);
@@ -394,6 +429,8 @@ gtk_file_system_unix_get_folder (GtkFileSystem     *file_system,
          folder_unix->stat_info = NULL;
          folder_unix->have_mime_type = FALSE;
          folder_unix->have_stat = FALSE;
+         folder_unix->have_hidden = FALSE;
+         set_asof = TRUE;
        }
 
       g_object_ref (folder_unix);
@@ -402,31 +439,45 @@ gtk_file_system_unix_get_folder (GtkFileSystem     *file_system,
     }
   else
     {
-      if (!g_file_test (filename, G_FILE_TEST_IS_DIR))
+      struct stat statbuf;
+      int result;
+      int code;
+      int my_errno;
+
+      code = my_errno = 0; /* shut up GCC */
+
+      result = stat (filename, &statbuf);
+
+      if (result == 0)
        {
-         int save_errno = errno;
-         gchar *filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+         if (!S_ISDIR (statbuf.st_mode))
+           {
+             result = -1;
+             code = GTK_FILE_SYSTEM_ERROR_NOT_FOLDER;
+             my_errno = ENOTDIR;
+           }
+       }
+      else
+       {
+         my_errno = errno;
 
-         /* If g_file_test() returned FALSE but not due to an error, it means
-          * that the filename is not a directory.
-          */
-         if (save_errno == 0)
-           /* ENOTDIR */
-           g_set_error (error,
-                        GTK_FILE_SYSTEM_ERROR,
-                        GTK_FILE_SYSTEM_ERROR_NOT_FOLDER,
-                        _("%s: %s"),
-                        filename_utf8 ? filename_utf8 : "???",
-                        g_strerror (ENOTDIR));
+         if (my_errno == ENOENT)
+           code = GTK_FILE_SYSTEM_ERROR_NONEXISTENT;
          else
-           g_set_error (error,
-                        GTK_FILE_SYSTEM_ERROR,
-                        GTK_FILE_SYSTEM_ERROR_NONEXISTENT,
-                        _("error getting information for '%s': %s"),
-                        filename_utf8 ? filename_utf8 : "???",
-                        g_strerror (save_errno));
-
-         g_free (filename_utf8);
+           code = GTK_FILE_SYSTEM_ERROR_FAILED;
+       }
+
+      if (result != 0)
+       {
+         gchar *display_name = g_filename_display_name (filename);
+         g_set_error (error,
+                      GTK_FILE_SYSTEM_ERROR,
+                      code,
+                      _("Error getting information for '%s': %s"),
+                      display_name,
+                      g_strerror (my_errno));
+
+         g_free (display_name);
          g_free (filename_copy);
          return NULL;
        }
@@ -436,25 +487,34 @@ gtk_file_system_unix_get_folder (GtkFileSystem     *file_system,
       folder_unix->filename = filename_copy;
       folder_unix->types = types;
       folder_unix->stat_info = NULL;
-      folder_unix->asof = now;
       folder_unix->have_mime_type = FALSE;
       folder_unix->have_stat = FALSE;
+      folder_unix->have_hidden = FALSE;
+      set_asof = TRUE;
+         
+      if ((system_unix->have_afs &&
+          system_unix->afs_statbuf.st_dev == statbuf.st_dev &&
+          system_unix->afs_statbuf.st_ino == statbuf.st_ino) ||
+         (system_unix->have_net &&
+          system_unix->net_statbuf.st_dev == statbuf.st_dev &&
+          system_unix->net_statbuf.st_ino == statbuf.st_ino))
+       folder_unix->is_network_dir = TRUE;
+      else
+       folder_unix->is_network_dir = FALSE;
 
       g_hash_table_insert (system_unix->folder_hash,
                           folder_unix->filename,
                           folder_unix);
     }
 
-  if ((types & STAT_NEEDED_MASK) && !fill_in_stats (folder_unix, error))
-    {
-      g_object_unref (folder_unix);
-      return NULL;
-    }
-  if ((types & GTK_FILE_INFO_MIME_TYPE) && !fill_in_mime_type (folder_unix, error))
-    {
-      g_object_unref (folder_unix);
-      return NULL;
-    }
+  if ((types & STAT_NEEDED_MASK) != 0)
+    fill_in_stats (folder_unix);
+
+  if ((types & GTK_FILE_INFO_MIME_TYPE) != 0)
+    fill_in_mime_type (folder_unix);
+
+  if (set_asof)
+    folder_unix->asof = time (NULL);
 
   return GTK_FILE_FOLDER (folder_unix);
 }
@@ -468,6 +528,7 @@ gtk_file_system_unix_create_folder (GtkFileSystem     *file_system,
   const char *filename;
   gboolean result;
   char *parent, *tmp;
+  int save_errno = errno;
 
   system_unix = GTK_FILE_SYSTEM_UNIX (file_system);
 
@@ -476,20 +537,21 @@ gtk_file_system_unix_create_folder (GtkFileSystem     *file_system,
   g_return_val_if_fail (g_path_is_absolute (filename), FALSE);
 
   tmp = remove_trailing_slash (filename);
+  errno = 0;
   result = mkdir (tmp, 0777) == 0;
+  save_errno = errno;
   g_free (tmp);
 
   if (!result)
     {
-      int save_errno = errno;
-      gchar *filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+      gchar *display_name = g_filename_display_name (filename);
       g_set_error (error,
                   GTK_FILE_SYSTEM_ERROR,
                   GTK_FILE_SYSTEM_ERROR_NONEXISTENT,
-                  _("error creating directory '%s': %s"),
-                  filename_utf8 ? filename_utf8 : "???",
+                  _("Error creating directory '%s': %s"),
+                  display_name,
                   g_strerror (save_errno));
-      g_free (filename_utf8);
+      g_free (display_name);
       return FALSE;
     }
 
@@ -574,7 +636,7 @@ static gchar *
 gtk_file_system_unix_volume_get_display_name (GtkFileSystem       *file_system,
                                              GtkFileSystemVolume *volume)
 {
-  return g_strdup (_("Filesystem")); /* Same as Nautilus */
+  return g_strdup (_("File System")); /* Same as Nautilus */
 }
 
 static IconType
@@ -588,10 +650,14 @@ get_icon_type_from_stat (struct stat *statp)
     return ICON_CHARACTER_DEVICE;
   else if (S_ISDIR (statp->st_mode))
     return ICON_DIRECTORY;
+#ifdef S_ISFIFO
   else if (S_ISFIFO (statp->st_mode))
     return  ICON_FIFO;
+#endif
+#ifdef S_ISSOCK
   else if (S_ISSOCK (statp->st_mode))
     return ICON_SOCKET;
+#endif
   else
     return ICON_REGULAR;
 }
@@ -609,14 +675,14 @@ get_icon_type (const char *filename,
       if (errno != ENOENT || lstat (filename, &statbuf) != 0)
        {
          int save_errno = errno;
-         gchar *filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+         gchar *display_name = g_filename_display_name (filename);
          g_set_error (error,
                       GTK_FILE_SYSTEM_ERROR,
                       GTK_FILE_SYSTEM_ERROR_NONEXISTENT,
-                      _("error getting information for '%s': %s"),
-                      filename_utf8 ? filename_utf8 : "???",
+                      _("Error getting information for '%s': %s"),
+                      display_name,
                       g_strerror (save_errno));
-         g_free (filename_utf8);
+         g_free (display_name);
 
          return ICON_NONE;
        }
@@ -694,6 +760,45 @@ get_cached_icon (GtkWidget   *widget,
   return element->pixbuf ? g_object_ref (element->pixbuf) : NULL;
 }
 
+/* Renders a fallback icon from the stock system */
+static GdkPixbuf *
+get_fallback_icon (GtkWidget *widget,
+                  IconType   icon_type,
+                  GError   **error)
+{
+  const char *stock_name;
+  GdkPixbuf *pixbuf;
+
+  switch (icon_type)
+    {
+    case ICON_BLOCK_DEVICE:
+      stock_name = GTK_STOCK_HARDDISK;
+      break;
+
+    case ICON_DIRECTORY:
+      stock_name = GTK_STOCK_DIRECTORY;
+      break;
+
+    case ICON_EXECUTABLE:
+      stock_name = GTK_STOCK_EXECUTE;
+      break;
+
+    default:
+      stock_name = GTK_STOCK_FILE;
+      break;
+    }
+
+  pixbuf = gtk_widget_render_icon (widget, stock_name, GTK_ICON_SIZE_SMALL_TOOLBAR, NULL);
+  if (!pixbuf)
+    g_set_error (error,
+                GTK_FILE_SYSTEM_ERROR,
+                GTK_FILE_SYSTEM_ERROR_FAILED,
+                _("Could not get a stock icon for %s"),
+                stock_name);
+
+  return pixbuf;
+}
+
 static GdkPixbuf *
 gtk_file_system_unix_volume_render_icon (GtkFileSystem        *file_system,
                                         GtkFileSystemVolume  *volume,
@@ -701,8 +806,16 @@ gtk_file_system_unix_volume_render_icon (GtkFileSystem        *file_system,
                                         gint                  pixel_size,
                                         GError              **error)
 {
-  /* FIXME: set the GError if we can't load the icon */
-  return get_cached_icon (widget, "gnome-fs-blockdev", pixel_size);
+  GdkPixbuf *pixbuf;
+
+  pixbuf = get_cached_icon (widget, "gnome-dev-harddisk", pixel_size);
+  if (pixbuf)
+    return pixbuf;
+
+  pixbuf = get_fallback_icon (widget, ICON_BLOCK_DEVICE, error);
+  g_assert (pixbuf != NULL);
+
+  return pixbuf;
 }
 
 static char *
@@ -1039,8 +1152,11 @@ gtk_file_system_unix_filename_to_path (GtkFileSystem *file_system,
   return filename_to_path (filename);
 }
 
+/* Returns the name of the icon to be used for a path which is known to be a
+ * directory.  This can vary for Home, Desktop, etc.
+ */
 static const char *
-get_icon_for_directory (const char *path)
+get_icon_name_for_directory (const char *path)
 {
   static char *desktop_path = NULL;
 
@@ -1058,33 +1174,32 @@ get_icon_for_directory (const char *path)
     return "gnome-fs-directory";
 }
 
-static GdkPixbuf *
-gtk_file_system_unix_render_icon (GtkFileSystem     *file_system,
-                                 const GtkFilePath *path,
-                                 GtkWidget         *widget,
-                                 gint               pixel_size,
-                                 GError           **error)
+/* Computes our internal icon type based on a path name; also returns the MIME
+ * type in case we come up with ICON_REGULAR.
+ */
+static IconType
+get_icon_type_from_path (GtkFileSystemUnix *system_unix,
+                        const GtkFilePath *path,
+                        const char       **mime_type)
 {
   const char *filename;
-  IconType icon_type;
-  const char *mime_type = NULL;
   char *dirname;
-  GtkFileSystemUnix *system_unix;
   GtkFileFolderUnix *folder_unix;
+  IconType icon_type;
 
-  system_unix = GTK_FILE_SYSTEM_UNIX (file_system);
   filename = gtk_file_path_get_string (path);
   dirname = g_path_get_dirname (filename);
   folder_unix = g_hash_table_lookup (system_unix->folder_hash, dirname);
   g_free (dirname);
 
-  if (folder_unix)
+  *mime_type = NULL;
+
+  if (folder_unix && folder_unix->have_stat)
     {
       char *basename;
       struct stat_info_entry *entry;
 
-      if (!fill_in_stats (folder_unix, error))
-       return NULL;
+      g_assert (folder_unix->stat_info != NULL);
 
       basename = g_path_get_basename (filename);
       entry = g_hash_table_lookup (folder_unix->stat_info, basename);
@@ -1092,100 +1207,146 @@ gtk_file_system_unix_render_icon (GtkFileSystem     *file_system,
       if (entry)
        {
          if (entry->icon_type == ICON_UNDECIDED)
-           entry->icon_type = get_icon_type_from_stat (&entry->statbuf);
+           {
+             entry->icon_type = get_icon_type_from_stat (&entry->statbuf);
+             g_assert (entry->icon_type != ICON_UNDECIDED);
+           }
          icon_type = entry->icon_type;
          if (icon_type == ICON_REGULAR)
            {
-             (void)fill_in_mime_type (folder_unix, NULL);
-             mime_type = entry->mime_type;
+             fill_in_mime_type (folder_unix);
+             *mime_type = entry->mime_type;
            }
+
+         return icon_type;
        }
-      else
-       icon_type = ICON_NONE;
     }
-  else
-    {
-#if 0
-      g_print ("No folder open for %s\n", filename);
-#endif
 
-      icon_type = get_icon_type (filename, error);
-      if (icon_type == ICON_REGULAR)
-       mime_type = xdg_mime_get_mime_type_for_file (filename);
-    }
+  icon_type = get_icon_type (filename, NULL);
+  if (icon_type == ICON_REGULAR)
+    *mime_type = xdg_mime_get_mime_type_for_file (filename);
 
+  return icon_type;
+}
 
-  /* FIXME: this function should not return NULL without setting the GError; we
-   * should perhaps provide a "never fails" generic stock icon for when all else
-   * fails.
-   */
+/* Renders an icon for a non-ICON_REGULAR file */
+static GdkPixbuf *
+get_special_icon (IconType           icon_type,
+                 const GtkFilePath *path,
+                 GtkWidget         *widget,
+                 gint               pixel_size)
+{
+  const char *name;
 
-  if (icon_type == ICON_NONE)
-    return NULL;
+  g_assert (icon_type != ICON_REGULAR);
 
-  if (icon_type != ICON_REGULAR)
+  switch (icon_type)
     {
-      const char *name;
+    case ICON_BLOCK_DEVICE:
+      name = "gnome-fs-blockdev";
+      break;
+    case ICON_BROKEN_SYMBOLIC_LINK:
+      name = "gnome-fs-symlink";
+      break;
+    case ICON_CHARACTER_DEVICE:
+      name = "gnome-fs-chardev";
+      break;
+    case ICON_DIRECTORY: {
+      const char *filename;
+
+      filename = gtk_file_path_get_string (path);
+      name = get_icon_name_for_directory (filename);
+      break;
+      }
+    case ICON_EXECUTABLE:
+      name ="gnome-fs-executable";
+      break;
+    case ICON_FIFO:
+      name = "gnome-fs-fifo";
+      break;
+    case ICON_SOCKET:
+      name = "gnome-fs-socket";
+      break;
+    default:
+      g_assert_not_reached ();
+      return NULL;
+    }
 
-      switch (icon_type)
-       {
-       case ICON_BLOCK_DEVICE:
-          name = "gnome-fs-blockdev";
-         break;
-       case ICON_BROKEN_SYMBOLIC_LINK:
-         name = "gnome-fs-symlink";
-         break;
-       case ICON_CHARACTER_DEVICE:
-         name = "gnome-fs-chardev";
-         break;
-       case ICON_DIRECTORY:
-         name = get_icon_for_directory (filename);
-         break;
-       case ICON_EXECUTABLE:
-         name ="gnome-fs-executable";
-         break;
-       case ICON_FIFO:
-         name = "gnome-fs-fifo";
-         break;
-       case ICON_SOCKET:
-         name = "gnome-fs-socket";
-         break;
-       default:
-         g_assert_not_reached ();
-         return NULL;
-       }
+  return get_cached_icon (widget, name, pixel_size);
+}
 
-      return get_cached_icon (widget, name, pixel_size);
-    }
+static GdkPixbuf *
+get_icon_for_mime_type (GtkWidget  *widget,
+                       const char *mime_type,
+                       gint        pixel_size)
+{
+  const char *separator;
+  GString *icon_name;
+  GdkPixbuf *pixbuf;
 
-  if (mime_type)
-    {
-      const char *separator;
-      GString *icon_name;
-      GdkPixbuf *pixbuf;
-
-      separator = strchr (mime_type, '/');
-      if (!separator)
-       return NULL;
-
-      icon_name = g_string_new ("gnome-mime-");
-      g_string_append_len (icon_name, mime_type, separator - mime_type);
-      g_string_append_c (icon_name, '-');
-      g_string_append (icon_name, separator + 1);
-      pixbuf = get_cached_icon (widget, icon_name->str, pixel_size);
-      g_string_free (icon_name, TRUE);
-      if (pixbuf)
-       return pixbuf;
-
-      icon_name = g_string_new ("gnome-mime-");
-      g_string_append_len (icon_name, mime_type, separator - mime_type);
-      pixbuf = get_cached_icon (widget, icon_name->str, pixel_size);
-      g_string_free (icon_name, TRUE);
-      if (pixbuf)
-       return pixbuf;
-    }
+  separator = strchr (mime_type, '/');
+  if (!separator)
+    return NULL; /* maybe we should return a GError with "invalid MIME-type" */
+
+  icon_name = g_string_new ("gnome-mime-");
+  g_string_append_len (icon_name, mime_type, separator - mime_type);
+  g_string_append_c (icon_name, '-');
+  g_string_append (icon_name, separator + 1);
+  pixbuf = get_cached_icon (widget, icon_name->str, pixel_size);
+  g_string_free (icon_name, TRUE);
+  if (pixbuf)
+    return pixbuf;
+
+  icon_name = g_string_new ("gnome-mime-");
+  g_string_append_len (icon_name, mime_type, separator - mime_type);
+  pixbuf = get_cached_icon (widget, icon_name->str, pixel_size);
+  g_string_free (icon_name, TRUE);
+
+  return pixbuf;
+}
+
+static GdkPixbuf *
+gtk_file_system_unix_render_icon (GtkFileSystem     *file_system,
+                                 const GtkFilePath *path,
+                                 GtkWidget         *widget,
+                                 gint               pixel_size,
+                                 GError           **error)
+{
+  GtkFileSystemUnix *system_unix;
+  IconType icon_type;
+  const char *mime_type;
+  GdkPixbuf *pixbuf;
+
+  system_unix = GTK_FILE_SYSTEM_UNIX (file_system);
+
+  icon_type = get_icon_type_from_path (system_unix, path, &mime_type);
+
+  switch (icon_type) {
+  case ICON_NONE:
+    goto fallback;
+
+  case ICON_REGULAR:
+    pixbuf = get_icon_for_mime_type (widget, mime_type, pixel_size);
+    break;
+
+  default:
+    pixbuf = get_special_icon (icon_type, path, widget, pixel_size);
+  }
+
+  if (pixbuf)
+    goto out;
+
+ fallback:
 
-  return get_cached_icon (widget, "gnome-fs-regular", pixel_size);
+  pixbuf = get_cached_icon (widget, "gnome-fs-regular", pixel_size);
+  if (pixbuf)
+    goto out;
+
+  pixbuf = get_fallback_icon (widget, icon_type, error);
+
+ out:
+
+  return pixbuf;
 }
 
 static void
@@ -1219,13 +1380,12 @@ is_local_uri (const char *uri)
 }
 
 static char *
-bookmark_get_filename (gboolean tmp_file)
+bookmark_get_filename (void)
 {
   char *filename;
 
-  filename = g_build_filename (g_get_home_dir (),
-                              tmp_file ? BOOKMARKS_TMP_FILENAME : BOOKMARKS_FILENAME,
-                              NULL);
+  filename = g_build_filename (g_get_home_dir (), 
+                              BOOKMARKS_FILENAME, NULL);
   g_assert (filename != NULL);
   return filename;
 }
@@ -1237,7 +1397,7 @@ bookmark_list_read (GSList **bookmarks, GError **error)
   gchar *contents;
   gboolean result = FALSE;
 
-  filename = bookmark_get_filename (FALSE);
+  filename = bookmark_get_filename ();
   *bookmarks = NULL;
 
   if (g_file_get_contents (filename, &contents, NULL, error))
@@ -1271,79 +1431,41 @@ bookmark_list_read (GSList **bookmarks, GError **error)
 }
 
 static gboolean
-bookmark_list_write (GSList *bookmarks, GError **error)
+bookmark_list_write (GSList  *bookmarks, 
+                    GError **error)
 {
-  char *tmp_filename;
+  GSList *l;
+  GString *string;
   char *filename;
-  gboolean result = TRUE;
-  FILE *file;
-  int fd;
-  int saved_errno;
-
-  /* First, write a temporary file */
+  GError *tmp_error = NULL;
+  gboolean result;
 
-  tmp_filename = bookmark_get_filename (TRUE);
-  filename = bookmark_get_filename (FALSE);
+  string = g_string_new ("");
 
-  fd = g_mkstemp (tmp_filename);
-  if (fd == -1)
+  for (l = bookmarks; l; l = l->next)
     {
-      saved_errno = errno;
-      goto io_error;
+      g_string_append (string, l->data);
+      g_string_append_c (string, '\n');
     }
 
-  if ((file = fdopen (fd, "w")) != NULL)
-    {
-      GSList *l;
-
-      for (l = bookmarks; l; l = l->next)
-       if (fputs (l->data, file) == EOF
-           || fputs ("\n", file) == EOF)
-         {
-           saved_errno = errno;
-           goto io_error;
-         }
+  filename = bookmark_get_filename ();
 
-      if (fclose (file) == EOF)
-       {
-         saved_errno = errno;
-         goto io_error;
-       }
+  result = g_file_set_contents (filename, string->str, -1, &tmp_error);
 
-      if (rename (tmp_filename, filename) == -1)
-       {
-         saved_errno = errno;
-         goto io_error;
-       }
+  g_free (filename);
+  g_string_free (string, TRUE);
 
-      result = TRUE;
-      goto out;
-    }
-  else
+  if (!result)
     {
-      saved_errno = errno;
-
-      /* fdopen() failed, so we can't do much error checking here anyway */
-      close (fd);
+      g_set_error (error,
+                  GTK_FILE_SYSTEM_ERROR,
+                  GTK_FILE_SYSTEM_ERROR_FAILED,
+                  _("Bookmark saving failed: %s"),
+                  tmp_error->message);
+      
+      g_error_free (tmp_error);
     }
 
- io_error:
-
-  g_set_error (error,
-              GTK_FILE_SYSTEM_ERROR,
-              GTK_FILE_SYSTEM_ERROR_FAILED,
-              _("Bookmark saving failed (%s)"),
-              g_strerror (saved_errno));
-  result = FALSE;
-
-  if (fd != -1)
-    unlink (tmp_filename); /* again, not much error checking we can do here */
-
- out:
-
-  g_free (filename);
-  g_free (tmp_filename);
-
   return result;
 }
 
@@ -1376,15 +1498,24 @@ gtk_file_system_unix_insert_bookmark (GtkFileSystem     *file_system,
 
   for (l = bookmarks; l; l = l->next)
     {
-      const char *bookmark;
+      char *bookmark, *space;
 
       bookmark = l->data;
-      if (strcmp (bookmark, uri) == 0)
+      
+      space = strchr (bookmark, ' ');
+      if (space)
+       *space = '\0';
+      if (strcmp (bookmark, uri) != 0)
+       {
+         if (space)
+           *space = ' ';
+       }
+      else
        {
          g_set_error (error,
                       GTK_FILE_SYSTEM_ERROR,
                       GTK_FILE_SYSTEM_ERROR_ALREADY_EXISTS,
-                      "%s already exists in the bookmarks list",
+                      _("'%s' already exists in the bookmarks list"),
                       uri);
          goto out;
        }
@@ -1424,10 +1555,19 @@ gtk_file_system_unix_remove_bookmark (GtkFileSystem     *file_system,
 
   for (l = bookmarks; l; l = l->next)
     {
-      const char *bookmark;
+      char *bookmark, *space;
 
-      bookmark = l->data;
-      if (strcmp (bookmark, uri) == 0)
+      bookmark = (char *)l->data;
+      space = strchr (bookmark, ' ');
+      if (space)
+       *space = '\0';
+
+      if (strcmp (bookmark, uri) != 0)
+       {
+         if (space)
+           *space = ' ';
+       }
+      else
        {
          g_free (l->data);
          bookmarks = g_slist_remove_link (bookmarks, l);
@@ -1436,7 +1576,8 @@ gtk_file_system_unix_remove_bookmark (GtkFileSystem     *file_system,
          if (bookmark_list_write (bookmarks, error))
            {
              result = TRUE;
-             g_signal_emit_by_name (file_system, "bookmarks-changed", 0);
+
+             g_signal_emit_by_name (file_system, "bookmarks-changed", 0);            
            }
 
          goto out;
@@ -1446,7 +1587,7 @@ gtk_file_system_unix_remove_bookmark (GtkFileSystem     *file_system,
   g_set_error (error,
               GTK_FILE_SYSTEM_ERROR,
               GTK_FILE_SYSTEM_ERROR_NONEXISTENT,
-              "%s does not exist in the bookmarks list",
+              _("'%s' does not exist in the bookmarks list"),
               uri);
 
  out:
@@ -1471,12 +1612,15 @@ gtk_file_system_unix_list_bookmarks (GtkFileSystem *file_system)
 
   for (l = bookmarks; l; l = l->next)
     {
-      const char *name;
+      char *bookmark, *space;
 
-      name = l->data;
+      bookmark = (char *)l->data;
+      space = strchr (bookmark, ' ');
+      if (space)
+       *space = '\0';
 
-      if (is_local_uri (name))
-       result = g_slist_prepend (result, gtk_file_system_unix_uri_to_path (file_system, name));
+      if (is_local_uri (bookmark))
+       result = g_slist_prepend (result, gtk_file_system_unix_uri_to_path (file_system, bookmark));
     }
 
   bookmark_list_free (bookmarks);
@@ -1485,6 +1629,92 @@ gtk_file_system_unix_list_bookmarks (GtkFileSystem *file_system)
   return result;
 }
 
+static gchar *
+gtk_file_system_unix_get_bookmark_label (GtkFileSystem     *file_system,
+                                        const GtkFilePath *path)
+{
+  GSList *labels;
+  gchar *label;
+  GSList *l;
+  char *bookmark, *space, *uri;
+  
+  labels = NULL;
+  label = NULL;
+
+  uri = gtk_file_system_path_to_uri (file_system, path);
+  bookmark_list_read (&labels, NULL);
+
+  for (l = labels; l && !label; l = l->next) 
+    {
+      bookmark = (char *)l->data;
+      space = strchr (bookmark, ' ');
+      if (!space)
+       continue;
+
+      *space = '\0';
+
+      if (strcmp (uri, bookmark) == 0)
+       label = g_strdup (space + 1);
+    }
+
+  bookmark_list_free (labels);
+  g_free (uri);
+
+  return label;
+}
+
+static void
+gtk_file_system_unix_set_bookmark_label (GtkFileSystem     *file_system,
+                                        const GtkFilePath *path,
+                                        const gchar       *label)
+{
+  GSList *labels;
+  GSList *l;
+  gchar *bookmark, *space, *uri;
+  gboolean found;
+
+  labels = NULL;
+
+  uri = gtk_file_system_path_to_uri (file_system, path);
+  bookmark_list_read (&labels, NULL);
+
+  found = FALSE;
+  for (l = labels; l && !found; l = l->next) 
+    {
+      bookmark = (gchar *)l->data;
+      space = strchr (bookmark, ' ');
+      if (space)
+       *space = '\0';
+
+      if (strcmp (bookmark, uri) != 0)
+       {
+         if (space)
+           *space = ' ';
+       }
+      else
+       {
+         g_free (bookmark);
+         
+         if (label && *label)
+           l->data = g_strdup_printf ("%s %s", uri, label);
+         else
+           l->data = g_strdup (uri);
+
+         found = TRUE;
+         break;
+       }
+    }
+
+  if (found)
+    {
+      if (bookmark_list_write (labels, NULL))
+       g_signal_emit_by_name (file_system, "bookmarks-changed", 0);
+    }
+  
+  bookmark_list_free (labels);
+  g_free (uri);
+}
+
 /*
  * GtkFileFolderUnix
  */
@@ -1569,103 +1799,219 @@ gtk_file_folder_unix_finalize (GObject *object)
   folder_parent_class->finalize (object);
 }
 
+/* Creates a GtkFileInfo for "/" by stat()ing it */
 static GtkFileInfo *
-gtk_file_folder_unix_get_info (GtkFileFolder      *folder,
-                              const GtkFilePath  *path,
-                              GError            **error)
+file_info_for_root_with_error (const char  *root_name,
+                              GError     **error)
 {
-  GtkFileFolderUnix *folder_unix = GTK_FILE_FOLDER_UNIX (folder);
+  struct stat statbuf;
   GtkFileInfo *info;
-  gchar *dirname, *basename;
-  const char *filename;
-  struct stat_info_entry *entry;
-  gboolean file_must_exist;
-  GtkFileInfoType types;
 
-  if (!path)
+  if (stat (root_name, &statbuf) != 0)
     {
-      struct stat buf;
+      int saved_errno;
 
-      g_return_val_if_fail (filename_is_root (folder_unix->filename), NULL);
+      saved_errno = errno; 
+      g_set_error (error,
+                  GTK_FILE_SYSTEM_ERROR,
+                  GTK_FILE_SYSTEM_ERROR_FAILED,
+                  _("Error getting information for '/': %s"),
+                  g_strerror (saved_errno));
 
-      if (stat (folder_unix->filename, &buf) != 0)
-       return NULL;
+      return NULL;
+    }
 
-      info = gtk_file_info_new ();
-      gtk_file_info_set_display_name (info, "/");
-      gtk_file_info_set_is_folder (info, TRUE);
-      gtk_file_info_set_is_hidden (info, FALSE);
-      gtk_file_info_set_mime_type (info, "x-directory/normal");
-      gtk_file_info_set_modification_time (info, buf.st_mtime);
-      gtk_file_info_set_size (info, buf.st_size);
+  info = gtk_file_info_new ();
+  gtk_file_info_set_display_name (info, "/");
+  gtk_file_info_set_is_folder (info, TRUE);
+  gtk_file_info_set_is_hidden (info, FALSE);
+  gtk_file_info_set_mime_type (info, "x-directory/normal");
+  gtk_file_info_set_modification_time (info, statbuf.st_mtime);
+  gtk_file_info_set_size (info, statbuf.st_size);
 
-      return info;
-    }
+  return info;
+}
 
-  filename = gtk_file_path_get_string (path);
-  g_return_val_if_fail (filename != NULL, NULL);
-  g_return_val_if_fail (g_path_is_absolute (filename), NULL);
+static gboolean
+stat_with_error (const char   *filename,
+                struct stat  *statbuf,
+                GError      **error)
+{
+  if (stat (filename, statbuf) == -1 &&
+      (errno != ENOENT || lstat (filename, statbuf) == -1))
+    {
+      int saved_errno;
+      int code;
+      char *display_name;
 
-  dirname = get_parent_dir (filename);
-  g_return_val_if_fail (strcmp (dirname, folder_unix->filename) == 0, NULL);
-  g_free (dirname);
+      saved_errno = errno;
 
-  basename = g_path_get_basename (filename);
-  types = folder_unix->types;
-  file_must_exist = (types & ~GTK_FILE_INFO_DISPLAY_NAME) != 0;
-  entry = file_must_exist
-    ? g_hash_table_lookup (folder_unix->stat_info, basename)
-    : NULL;
-  /* basename freed later.  */
+      if (saved_errno == ENOENT)
+       code = GTK_FILE_SYSTEM_ERROR_NONEXISTENT;
+      else
+       code = GTK_FILE_SYSTEM_ERROR_FAILED;
 
-  if (!file_must_exist || entry)
-    {
-      info = gtk_file_info_new ();
-    }
-  else
-    {
-      gchar *filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+      display_name = g_filename_display_name (filename);
       g_set_error (error,
                   GTK_FILE_SYSTEM_ERROR,
-                  GTK_FILE_SYSTEM_ERROR_NONEXISTENT,
-                  _("error getting information for '%s'"),
-                  filename_utf8 ? filename_utf8 : "???");
-      g_free (filename_utf8);
-      info = NULL;
-      types = 0;
+                  code,
+                  _("Error getting information for '%s': %s"),
+                  display_name,
+                  g_strerror (saved_errno));
+
+      g_free (display_name);
+      return FALSE;
     }
 
+  return TRUE;
+}
+
+/* Creates a new GtkFileInfo from the specified data */
+static GtkFileInfo *
+create_file_info (GtkFileFolderUnix *folder_unix,
+                  const char        *filename,
+                 const char        *basename,
+                 GtkFileInfoType    types,
+                 struct stat       *statbuf,
+                 const char        *mime_type)
+{
+  GtkFileInfo *info;
+
+  info = gtk_file_info_new ();
+  
   if (types & GTK_FILE_INFO_DISPLAY_NAME)
     {
-      gchar *display_name = g_filename_to_utf8 (basename, -1, NULL, NULL, NULL);
-      if (!display_name)
-       display_name = g_strescape (basename, NULL);
-
+      gchar *display_name = g_filename_display_basename (filename);
       gtk_file_info_set_display_name (info, display_name);
-
       g_free (display_name);
     }
 
   if (types & GTK_FILE_INFO_IS_HIDDEN)
-    gtk_file_info_set_is_hidden (info, basename[0] == '.');
+    {
+      if (file_is_hidden (folder_unix, basename))
+       gtk_file_info_set_is_hidden (info, TRUE);
+    }
 
   if (types & GTK_FILE_INFO_IS_FOLDER)
-    gtk_file_info_set_is_folder (info, S_ISDIR (entry->statbuf.st_mode));
+    gtk_file_info_set_is_folder (info, S_ISDIR (statbuf->st_mode));
 
   if (types & GTK_FILE_INFO_MIME_TYPE)
-    gtk_file_info_set_mime_type (info, entry->mime_type);
+    gtk_file_info_set_mime_type (info, mime_type);
 
   if (types & GTK_FILE_INFO_MODIFICATION_TIME)
-    gtk_file_info_set_modification_time (info, entry->statbuf.st_mtime);
+    gtk_file_info_set_modification_time (info, statbuf->st_mtime);
 
   if (types & GTK_FILE_INFO_SIZE)
-    gtk_file_info_set_size (info, (gint64)entry->statbuf.st_size);
-
-  g_free (basename);
+    gtk_file_info_set_size (info, (gint64) statbuf->st_size);
 
   return info;
 }
 
+static struct stat_info_entry *
+create_stat_info_entry_and_emit_add (GtkFileFolderUnix *folder_unix,
+                                    const char        *filename,
+                                    const char        *basename,
+                                    struct stat       *statbuf)
+{
+  GSList *paths;
+  GtkFilePath *path;
+  struct stat_info_entry *entry;
+
+  entry = g_new0 (struct stat_info_entry, 1);
+
+  if ((folder_unix->types & STAT_NEEDED_MASK) != 0)
+    entry->statbuf = *statbuf;
+
+  if ((folder_unix->types & GTK_FILE_INFO_MIME_TYPE) != 0)
+    entry->mime_type = g_strdup (xdg_mime_get_mime_type_for_file (filename));
+
+  g_hash_table_insert (folder_unix->stat_info,
+                      g_strdup (basename),
+                      entry);
+
+  path = gtk_file_path_new_dup (filename);
+  paths = g_slist_append (NULL, path);
+  g_signal_emit_by_name (folder_unix, "files-added", paths);
+  gtk_file_path_free (path);
+  g_slist_free (paths);
+
+  return entry;
+}
+
+static GtkFileInfo *
+gtk_file_folder_unix_get_info (GtkFileFolder      *folder,
+                              const GtkFilePath  *path,
+                              GError            **error)
+{
+  GtkFileFolderUnix *folder_unix = GTK_FILE_FOLDER_UNIX (folder);
+  GtkFileInfo *info;
+  gchar *dirname, *basename;
+  const char *filename;
+  GtkFileInfoType types;
+  struct stat statbuf;
+  const char *mime_type;
+
+  /* Get_info for "/" */
+  if (!path)
+    {
+      g_return_val_if_fail (filename_is_root (folder_unix->filename), NULL);
+      return file_info_for_root_with_error (folder_unix->filename, error);
+    }
+
+  /* Get_info for normal files */
+
+  filename = gtk_file_path_get_string (path);
+  g_return_val_if_fail (filename != NULL, NULL);
+  g_return_val_if_fail (g_path_is_absolute (filename), NULL);
+
+  dirname = get_parent_dir (filename);
+  g_return_val_if_fail (strcmp (dirname, folder_unix->filename) == 0, NULL);
+  g_free (dirname);
+
+  basename = g_path_get_basename (filename);
+  types = folder_unix->types;
+
+  if (folder_unix->have_stat)
+    {
+      struct stat_info_entry *entry;
+
+      g_assert (folder_unix->stat_info != NULL);
+      entry = g_hash_table_lookup (folder_unix->stat_info, basename);
+
+      if (!entry)
+       {
+         if (!stat_with_error (filename, &statbuf, error))
+           {
+             g_free (basename);
+             return NULL;
+           }
+
+         entry = create_stat_info_entry_and_emit_add (folder_unix, filename, basename, &statbuf);
+       }
+
+      info = create_file_info (folder_unix, filename, basename, types, &entry->statbuf, entry->mime_type);
+      g_free (basename);
+      return info;
+    }
+  else
+    {
+      if (!stat_with_error (filename, &statbuf, error))
+       {
+         g_free (basename);
+         return NULL;
+       }
+
+      if ((types & GTK_FILE_INFO_MIME_TYPE) != 0)
+       mime_type = xdg_mime_get_mime_type_for_file (filename);
+      else
+       mime_type = NULL;
+
+      info = create_file_info (folder_unix, filename, basename, types, &statbuf, mime_type);
+      g_free (basename);
+      return info;
+    }
+}
+
 
 static void
 cb_list_children (gpointer key, gpointer value, gpointer user_data)
@@ -1698,6 +2044,7 @@ gtk_file_folder_unix_list_children (GtkFileFolder  *folder,
       l->data = filename_to_path (fullname);
       g_free (fullname);
     }
+
   return TRUE;
 }
 
@@ -1723,26 +2070,33 @@ fill_in_names (GtkFileFolderUnix *folder_unix, GError **error)
   if (folder_unix->stat_info)
     return TRUE;
 
-#if 0
-  g_print ("Reading directory %s\n", folder_unix->filename);
-#endif
-
-  folder_unix->stat_info = g_hash_table_new_full (g_str_hash, g_str_equal,
-                                                 (GDestroyNotify)g_free,
-                                                 (GDestroyNotify)free_stat_info_entry);
   dir = g_dir_open (folder_unix->filename, 0, error);
   if (!dir)
     return FALSE;
 
+  folder_unix->stat_info = g_hash_table_new_full (g_str_hash, g_str_equal,
+                                                 (GDestroyNotify) g_free,
+                                                 (GDestroyNotify) free_stat_info_entry);
+
   while (TRUE)
     {
-      const gchar *basename = g_dir_read_name (dir);
+      struct stat_info_entry *entry;
+      const gchar *basename;
+
+      basename = g_dir_read_name (dir);
       if (!basename)
        break;
 
+      entry = g_new0 (struct stat_info_entry, 1);
+      if (folder_unix->is_network_dir)
+       {
+         entry->statbuf.st_mode = S_IFDIR;
+         entry->mime_type = g_strdup ("x-directory/normal");
+       }
+
       g_hash_table_insert (folder_unix->stat_info,
                           g_strdup (basename),
-                          g_new0 (struct stat_info_entry, 1));
+                          entry);
     }
 
   g_dir_close (dir);
@@ -1771,24 +2125,21 @@ cb_fill_in_stats (gpointer key, gpointer value, gpointer user_data)
 }
 
 
-static gboolean
-fill_in_stats (GtkFileFolderUnix *folder_unix, GError **error)
+static void
+fill_in_stats (GtkFileFolderUnix *folder_unix)
 {
   if (folder_unix->have_stat)
-    return TRUE;
+    return;
 
-  if (!fill_in_names (folder_unix, error))
-    return FALSE;
+  if (!fill_in_names (folder_unix, NULL))
+    return;
 
-#if 0
-  g_print ("Stating directory %s\n", folder_unix->filename);
-#endif
-  g_hash_table_foreach_remove (folder_unix->stat_info,
-                              cb_fill_in_stats,
-                              folder_unix);
+  if (!folder_unix->is_network_dir)
+    g_hash_table_foreach_remove (folder_unix->stat_info,
+                                cb_fill_in_stats,
+                                folder_unix);
 
   folder_unix->have_stat = TRUE;
-  return TRUE;
 }
 
 
@@ -1809,21 +2160,60 @@ cb_fill_in_mime_type (gpointer key, gpointer value, gpointer user_data)
   return FALSE;
 }
 
-static gboolean
-fill_in_mime_type (GtkFileFolderUnix *folder_unix, GError **error)
+static void
+fill_in_mime_type (GtkFileFolderUnix *folder_unix)
 {
   if (folder_unix->have_mime_type)
-    return TRUE;
+    return;
 
-#if 0
-  g_print ("Getting mime types for directory %s\n", folder_unix->filename);
-#endif
-  g_hash_table_foreach_remove (folder_unix->stat_info,
-                              cb_fill_in_mime_type,
-                              folder_unix);
+  if (!folder_unix->have_stat)
+    return;
+
+  g_assert (folder_unix->stat_info != NULL);
+
+  if (!folder_unix->is_network_dir)
+    g_hash_table_foreach_remove (folder_unix->stat_info,
+                                cb_fill_in_mime_type,
+                                folder_unix);
 
   folder_unix->have_mime_type = TRUE;
-  return TRUE;
+}
+
+static void
+fill_in_hidden (GtkFileFolderUnix *folder_unix)
+{
+  gchar *hidden_file;
+  gchar *contents;
+  
+  if (folder_unix->have_hidden)
+    return;
+
+  hidden_file = g_build_filename (folder_unix->filename, HIDDEN_FILENAME, NULL);
+
+  if (g_file_get_contents (hidden_file, &contents, NULL, NULL))
+    {
+      gchar **lines; 
+      int i;
+      
+      lines = g_strsplit (contents, "\n", -1);
+      for (i = 0; lines[i]; i++)
+       {
+         if (lines[i][0])
+           {
+             struct stat_info_entry *entry;
+             
+             entry = g_hash_table_lookup (folder_unix->stat_info, lines[i]);
+             if (entry != NULL)
+               entry->hidden = TRUE;
+           }
+       }
+      
+      g_strfreev (lines);
+      g_free (contents);
+    }
+
+  g_free (hidden_file);
+  folder_unix->have_hidden = TRUE;
 }
 
 static GtkFilePath *
@@ -1844,3 +2234,28 @@ filename_is_root (const char *filename)
 
   return (after_root != NULL && *after_root == '\0');
 }
+
+static gboolean
+file_is_hidden (GtkFileFolderUnix *folder_unix,
+               const char        *basename)
+{
+ struct stat_info_entry *entry;
+
+  if (basename[0] == '.' || basename[strlen (basename) - 1] == '~')
+    return TRUE;
+  if (folder_unix->have_stat)
+    {
+      fill_in_hidden (folder_unix);
+      
+      entry = g_hash_table_lookup (folder_unix->stat_info, basename);
+  
+      if (entry)
+       return entry->hidden;
+    }
+
+  return FALSE;
+}
+
+#define __GTK_FILE_SYSTEM_UNIX_C__
+#include "gtkaliasdef.c"