nautilus r13586 - in trunk: . src/file-manager



Author: alexl
Date: Thu Jan 10 15:20:31 2008
New Revision: 13586
URL: http://svn.gnome.org/viewvc/nautilus?rev=13586&view=rev

Log:
2008-01-10  Alexander Larsson  <alexl redhat com>

        * src/file-manager/fm-directory-view.c:
	Use nautilus_file_can_delete() to control sensitivity
	of delete menu item.



Modified:
   trunk/ChangeLog
   trunk/src/file-manager/fm-directory-view.c

Modified: trunk/src/file-manager/fm-directory-view.c
==============================================================================
--- trunk/src/file-manager/fm-directory-view.c	(original)
+++ trunk/src/file-manager/fm-directory-view.c	Thu Jan 10 15:20:31 2008
@@ -6830,9 +6830,11 @@
 		|| nautilus_file_is_desktop_directory (file);
 	is_read_only = fm_directory_view_is_read_only (view);
 
-	can_delete_file = !is_read_only
-		&& !is_special_link
-		&& !is_desktop_or_home_dir;
+	can_delete_file =
+		nautilus_file_can_delete (file) &&
+		!is_read_only &&
+		!is_special_link &&
+		!is_desktop_or_home_dir;
 
 	action = gtk_action_group_get_action (view->details->dir_action_group,
 					      FM_ACTION_LOCATION_CUT);
@@ -6883,6 +6885,21 @@
 	
 }
 
+static gboolean
+can_delete_all (GList *files)
+{
+	NautilusFile *file;
+	GList *l;
+
+	for (l = files; l != NULL; l = l->next) {
+		file = l->data;
+		if (!nautilus_file_can_delete (file)) {
+			return FALSE;
+		}
+	}
+	return TRUE;
+}
+
 static void
 real_update_menus (FMDirectoryView *view)
 {
@@ -6918,10 +6935,12 @@
 	is_read_only = fm_directory_view_is_read_only (view);
 
 	can_create_files = fm_directory_view_supports_creating_files (view);
-	can_delete_files = !is_read_only
-		&& selection_count != 0
-		&& !selection_contains_special_link
-		&& !selection_contains_desktop_or_home_dir;
+	can_delete_files =
+		can_delete_all (selection) &&
+		!is_read_only &&
+		selection_count != 0 &&
+		!selection_contains_special_link &&
+		!selection_contains_desktop_or_home_dir;
 	can_copy_files = selection_count != 0
 		&& !selection_contains_special_link;	
 



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