[PATCH] Show properties of Trash and Home dir correctly



The attached patch fixes http://bugzilla.gnome.org/show_bug.cgi?id=46200
"Trash properties window doesn't show size if viewed before others"

It needs some review, because I'm not completely sure I fix it in the right way.

The problem why the Trash folder and the home folder didn't show size and free space was because nautilus_file_recompute_deep_counts(file) was called with file pointing to x-nautilus-desktop:///trash for the trash folder and x-nautilus-desktop: for the home folder.

Changing original_files to target_files solved the problem for the home dir.

The trash dir still didn't work that's why I made a hack in get_target_file_for_original_file so that i.s.o. trash: just ~/.Trash get's passed into nautilus_file_recompute_deep_counts.

Don't know if nautilus_file_recompute_deep_counts is supposed to work if you put the "trash:" URI in there.

Side effect of this patch is that location in the property window changes from On the desktop to your home directory. Don't know if this is bad because if you select a file in the trash it also says the location is in ~/.Trash

Cheers,

Jaap
Index: fm-properties-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-properties-window.c,v
retrieving revision 1.210
diff -u -r1.210 fm-properties-window.c
--- fm-properties-window.c	22 Feb 2005 08:51:12 -0000	1.210
+++ fm-properties-window.c	22 Feb 2005 22:37:34 -0000
@@ -275,6 +275,7 @@
 	GnomeVFSVolume *volume;
 	GnomeVFSDrive *drive;
 	NautilusDesktopLink *link;
+	char *trash_uri;
 
 	target_file = NULL;
 	if (nautilus_file_has_volume (file)) {
@@ -297,10 +298,15 @@
 		/* map to linked URI for these types of links */
 		uri_to_display = nautilus_desktop_link_get_activation_uri (link);
 		if (uri_to_display) {
-                        target_file = nautilus_file_get (uri_to_display);
-                        g_free (uri_to_display);
-                }
-		
+			if (eel_uri_is_trash (uri_to_display)) {
+				trash_uri = g_strconcat ("file://", g_get_home_dir(), "/.Trash", NULL);
+				target_file = nautilus_file_get (trash_uri);
+				g_free (trash_uri);
+			} else {
+				target_file = nautilus_file_get (uri_to_display);
+			}
+			g_free (uri_to_display);
+		}
 		g_object_unref (link);
         }
 
@@ -1914,7 +1920,7 @@
 	directory_contents_value_field_update (window);
  
 	       
-	for (l = window->details->original_files; l; l = l->next) {
+	for (l = window->details->target_files; l; l = l->next) {
 		file = NAUTILUS_FILE (l->data);
 		nautilus_file_recompute_deep_counts (file);
 		


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