gnome-utils r8037 - in trunk/baobab: . src



Author: pborelli
Date: Sat Aug 30 17:16:15 2008
New Revision: 8037
URL: http://svn.gnome.org/viewvc/gnome-utils?rev=8037&view=rev

Log:
2008-08-30  Paolo Borelli  <pborelli katamail com>

	* src/baobab-scan.c: Skip all subdirs of ~/.gvfs in order to avoid
	scanning gvfs fuse mounts as local files. It would be cool to have
	a less hackish way to do it.



Modified:
   trunk/baobab/ChangeLog
   trunk/baobab/src/baobab-scan.c

Modified: trunk/baobab/src/baobab-scan.c
==============================================================================
--- trunk/baobab/src/baobab-scan.c	(original)
+++ trunk/baobab/src/baobab-scan.c	Sat Aug 30 17:16:15 2008
@@ -153,6 +153,35 @@
 	return ret;
 }
 
+static gboolean
+is_in_dot_gvfs (GFile *file)
+{
+	static GFile *dot_gvfs_dir = NULL;
+	GFile *parent;
+	gboolean res = FALSE;
+
+	if (dot_gvfs_dir == NULL)
+	{
+		gchar *dot_gvfs;
+
+		dot_gvfs = g_build_filename (g_get_home_dir (), ".gvfs", NULL);
+
+		dot_gvfs_dir = g_file_new_for_path (dot_gvfs);
+
+		g_free (dot_gvfs);
+	}
+
+	parent = g_file_get_parent (file);
+
+	if (parent != NULL)
+	{
+		res = g_file_equal (parent, dot_gvfs_dir);
+		g_object_unref (parent);
+	}
+
+	return res;
+}
+
 static struct allsizes
 loopdir (GFile *file,
 	 GFileInfo *info,
@@ -184,7 +213,13 @@
 	/* Skip the virtual file systems */
 	if (is_virtual_filesystem (file))
  		goto exit;
- 
+
+	/* FIXME: skip dirs in ~/.gvfs. It would be better to have a way
+	 * to check if a file is a FUSE mountpoint instead of just
+	 * hardcoding .gvfs */
+	if (is_in_dot_gvfs (file))
+		goto exit;
+
 	parse_name = g_file_get_parse_name (file);	
 
 	if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SIZE))



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