[nautilus/gnome-2-28] Revert "Disable Trash/Delete key bindings when appropriate"



commit 74cf60a37bfbc21d9d3fb234db42cb235679296f
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Dec 15 10:00:05 2009 +0100

    Revert "Disable Trash/Delete key bindings when appropriate"
    
    This reverts commit ac73dd5c2159defcc9686f1ecce47059b48e2ccd.
    It causes regressions (see bug 603413)

 src/file-manager/fm-actions.h                   |    3 -
 src/file-manager/fm-directory-view.c            |   69 +++++++++--------------
 src/file-manager/nautilus-directory-view-ui.xml |    3 -
 3 files changed, 27 insertions(+), 48 deletions(-)
---
diff --git a/src/file-manager/fm-actions.h b/src/file-manager/fm-actions.h
index e0162e1..0294ea3 100644
--- a/src/file-manager/fm-actions.h
+++ b/src/file-manager/fm-actions.h
@@ -59,11 +59,8 @@
 #define FM_ACTION_INVERT_SELECTION "Invert Selection"
 #define FM_ACTION_SELECT_PATTERN "Select Pattern"
 #define FM_ACTION_TRASH "Trash"
-#define FM_ACTION_TRASH2 "Trash2"
-#define FM_ACTION_TRASH3 "Trash3"
 #define FM_ACTION_LOCATION_TRASH "LocationTrash"
 #define FM_ACTION_DELETE "Delete"
-#define FM_ACTION_DELETE2 "Delete2"
 #define FM_ACTION_LOCATION_DELETE "LocationDelete"
 #define FM_ACTION_RESTORE_FROM_TRASH "Restore From Trash"
 #define FM_ACTION_LOCATION_RESTORE_FROM_TRASH "LocationRestoreFromTrash"
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index ccb5a3b..b068dc7 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -7031,22 +7031,10 @@ static const GtkActionEntry directory_view_entries[] = {
   /* label, accelerator */       N_("Mo_ve to Trash"), NULL,
   /* tooltip */                  N_("Move each selected item to the Trash"),
                                  G_CALLBACK (action_trash_callback) },
-  /* name, stock id */         { "Trash2", NAUTILUS_ICON_TRASH,
-  /* label, accelerator */       N_("Mo_ve to Trash"), "Delete",
-  /* tooltip */                  N_("Move each selected item to the Trash"),
-                                 G_CALLBACK (action_trash_callback) },
-  /* name, stock id */         { "Trash3", NAUTILUS_ICON_TRASH,
-  /* label, accelerator */       N_("Mo_ve to Trash"), "KP_Delete",
-  /* tooltip */                  N_("Move each selected item to the Trash"),
-                                 G_CALLBACK (action_trash_callback) },
   /* name, stock id */         { "Delete", NULL,
   /* label, accelerator */       N_("_Delete"), "<shift>Delete",
   /* tooltip */                  N_("Delete each selected item, without moving to the Trash"),
                                  G_CALLBACK (action_delete_callback) },
-  /* name, stock id */         { "Delete2", NULL,
-  /* label, accelerator */       N_("_Delete"), "<shift>KP_Delete",
-  /* tooltip */                  N_("Delete each selected item, without moving to the Trash"),
-                                 G_CALLBACK (action_delete_callback) },
   /* name, stock id */         { "Restore From Trash", NULL,
   /* label, accelerator */       N_("_Restore"), NULL,
 				 NULL,
@@ -8396,14 +8384,6 @@ real_update_menus (FMDirectoryView *view)
 	GAppInfo *app;
 	GIcon *app_icon;
 	GtkWidget *menuitem;
- 	gint i;
- 	gchar *trash_actions[] = {FM_ACTION_TRASH,
- 	                          FM_ACTION_TRASH2,
- 	                          FM_ACTION_TRASH3,
- 	                          NULL};
- 	gchar *delete_actions[] = {FM_ACTION_DELETE,
- 	                           FM_ACTION_DELETE2,
- 	                           NULL};
 
 	selection = fm_directory_view_get_selection (view);
 	selection_count = g_list_length (selection);
@@ -8607,31 +8587,27 @@ real_update_menus (FMDirectoryView *view)
 		show_separate_delete_command = show_delete_command_auto_value;
 	}
 	
-	for (i = 0; trash_actions[i]; ++i) {
-		action = gtk_action_group_get_action (view->details->dir_action_group, trash_actions[i]);
+	action = gtk_action_group_get_action (view->details->dir_action_group,
+					      FM_ACTION_TRASH);
+	g_object_set (action,
+		      "label", label,
+		      "tooltip", tip,
+		      "icon-name", all_selected_items_in_trash (view) ?
+					NAUTILUS_ICON_DELETE : NAUTILUS_ICON_TRASH_FULL,
+		      NULL);
+	gtk_action_set_sensitive (action, can_delete_files);
+
+	action = gtk_action_group_get_action (view->details->dir_action_group,
+					      FM_ACTION_DELETE);
+	gtk_action_set_visible (action, show_separate_delete_command);
+	
+	if (show_separate_delete_command) {
 		g_object_set (action,
-			      "label", label,
-			      "tooltip", tip,
-			      "icon-name", all_selected_items_in_trash (view) ?
-					NAUTILUS_ICON_DELETE :
-					NAUTILUS_ICON_TRASH_FULL,
+			      "label", _("_Delete"),
+			      "icon-name", NAUTILUS_ICON_DELETE,
 			      NULL);
-		gtk_action_set_sensitive (action, can_delete_files);
-	}
-
-	for (i = 0; delete_actions[i]; ++i) {
-		action = gtk_action_group_get_action (view->details->dir_action_group,
-						      delete_actions[i]);
-		gtk_action_set_visible (action, show_separate_delete_command);
-		
-		if (show_separate_delete_command) {
-			g_object_set (action,
-				      "label", _("_Delete"),
-				      "icon-name", NAUTILUS_ICON_DELETE,
-				      NULL);
-		}
-		gtk_action_set_sensitive (action, can_delete_files);
 	}
+	gtk_action_set_sensitive (action, can_delete_files);
 
 
 	action = gtk_action_group_get_action (view->details->dir_action_group,
@@ -10468,6 +10444,7 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass)
 {
 	GtkWidgetClass *widget_class;
 	GtkScrolledWindowClass *scrolled_window_class;
+	GtkBindingSet *binding_set;
 
 	widget_class = GTK_WIDGET_CLASS (klass);
 	scrolled_window_class = GTK_SCROLLED_WINDOW_CLASS (klass);
@@ -10631,6 +10608,14 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass)
 			      eel_marshal_BOOLEAN__VOID,
 			      G_TYPE_BOOLEAN, 0);
 	
+	binding_set = gtk_binding_set_by_class (klass);
+	gtk_binding_entry_add_signal (binding_set, GDK_Delete, 0,
+				      "trash", 0);
+	gtk_binding_entry_add_signal (binding_set, GDK_KP_Delete, 0,
+				      "trash", 0);
+	gtk_binding_entry_add_signal (binding_set, GDK_KP_Delete, GDK_SHIFT_MASK,
+				      "delete", 0);
+
 	klass->trash = real_trash;
 	klass->delete = real_delete;
 }
diff --git a/src/file-manager/nautilus-directory-view-ui.xml b/src/file-manager/nautilus-directory-view-ui.xml
index 56d6d93..e4dfb29 100644
--- a/src/file-manager/nautilus-directory-view-ui.xml
+++ b/src/file-manager/nautilus-directory-view-ui.xml
@@ -3,9 +3,6 @@
 <accelerator action="OpenCloseParent"/>
 <accelerator action="PropertiesAccel"/>
 <accelerator action="RenameSelectAll"/>
-<accelerator action="Trash2"/>
-<accelerator action="Trash3"/>
-<accelerator action="Delete2"/>
 <menubar name="MenuBar">
 	<menu action="File">
 		<placeholder name="New Items Placeholder">



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