Blame SOURCES/nautilus-3.14-delete-shortcut-improvements.patch

0d1f52
From 1fc9e88816691e4ceeb0108d1a30017eef1e7210 Mon Sep 17 00:00:00 2001
0d1f52
From: Carlos Soriano <csoriano@gnome.org>
0d1f52
Date: Thu, 9 Jul 2015 17:15:25 +0200
0d1f52
Subject: [PATCH 1/3] general: add nautilus delete notification
0d1f52
0d1f52
So in the next patch we will able to change the delete
0d1f52
shortcut to just del.
0d1f52
---
0d1f52
 .../nautilus-file-undo-operations.c                |   8 +-
0d1f52
 .../nautilus-file-undo-operations.h                |   4 +
0d1f52
 src/nautilus-notification.ui                       |  82 +++++++++++
0d1f52
 src/nautilus-window-private.h                      |   7 +
0d1f52
 src/nautilus-window.c                              | 164 +++++++++++++++++++--
0d1f52
 src/nautilus.gresource.xml                         |   1 +
0d1f52
 6 files changed, 251 insertions(+), 15 deletions(-)
0d1f52
 create mode 100644 src/nautilus-notification.ui
0d1f52
0d1f52
diff --git a/libnautilus-private/nautilus-file-undo-operations.c b/libnautilus-private/nautilus-file-undo-operations.c
0d1f52
index 717f6f8..c1e9dab 100644
0d1f52
--- a/libnautilus-private/nautilus-file-undo-operations.c
0d1f52
+++ b/libnautilus-private/nautilus-file-undo-operations.c
0d1f52
@@ -186,7 +186,7 @@ nautilus_file_undo_info_class_init (NautilusFileUndoInfoClass *klass)
0d1f52
 	g_object_class_install_properties (oclass, N_PROPERTIES, properties);
0d1f52
 }
0d1f52
 
0d1f52
-static NautilusFileUndoOp
0d1f52
+NautilusFileUndoOp
0d1f52
 nautilus_file_undo_info_get_op_type (NautilusFileUndoInfo *self)
0d1f52
 {
0d1f52
 	return self->priv->op_type;
0d1f52
@@ -965,6 +965,12 @@ struct _NautilusFileUndoInfoTrashDetails {
0d1f52
 	GHashTable *trashed;
0d1f52
 };
0d1f52
 
0d1f52
+GList *
0d1f52
+nautilus_file_undo_info_trash_get_files (NautilusFileUndoInfoTrash *self)
0d1f52
+{
0d1f52
+        return g_hash_table_get_keys (self->priv->trashed);
0d1f52
+}
0d1f52
+
0d1f52
 static void
0d1f52
 trash_strings_func (NautilusFileUndoInfo *info,
0d1f52
 		    gchar **undo_label,
0d1f52
diff --git a/libnautilus-private/nautilus-file-undo-operations.h b/libnautilus-private/nautilus-file-undo-operations.h
0d1f52
index 5a3953f..06db117 100644
0d1f52
--- a/libnautilus-private/nautilus-file-undo-operations.h
0d1f52
+++ b/libnautilus-private/nautilus-file-undo-operations.h
0d1f52
@@ -95,6 +95,8 @@ void nautilus_file_undo_info_get_strings (NautilusFileUndoInfo *self,
0d1f52
 					  gchar **undo_description,
0d1f52
 					  gchar **redo_label,
0d1f52
 					  gchar **redo_description);
0d1f52
+NautilusFileUndoOp nautilus_file_undo_info_get_op_type (NautilusFileUndoInfo *self);
0d1f52
+
0d1f52
 
0d1f52
 /* copy/move/duplicate/link/restore from trash */
0d1f52
 #define NAUTILUS_TYPE_FILE_UNDO_INFO_EXT         (nautilus_file_undo_info_ext_get_type ())
0d1f52
@@ -206,6 +208,8 @@ GType nautilus_file_undo_info_trash_get_type (void) G_GNUC_CONST;
0d1f52
 NautilusFileUndoInfo *nautilus_file_undo_info_trash_new (gint item_count);
0d1f52
 void nautilus_file_undo_info_trash_add_file (NautilusFileUndoInfoTrash *self,
0d1f52
 					     GFile                     *file);
0d1f52
+GList *nautilus_file_undo_info_trash_get_files (NautilusFileUndoInfoTrash *self);
0d1f52
+
0d1f52
 
0d1f52
 /* recursive permissions */
0d1f52
 #define NAUTILUS_TYPE_FILE_UNDO_INFO_REC_PERMISSIONS         (nautilus_file_undo_info_rec_permissions_get_type ())
0d1f52
diff --git a/src/nautilus-notification.ui b/src/nautilus-notification.ui
0d1f52
new file mode 100644
0d1f52
index 0000000..bef7a0b
0d1f52
--- /dev/null
0d1f52
+++ b/src/nautilus-notification.ui
0d1f52
@@ -0,0 +1,82 @@
0d1f52
+
0d1f52
+<interface>
0d1f52
+  <object class="GtkOverlay" id="main_view">
0d1f52
+    <property name="visible">True</property>
0d1f52
+    <child>
0d1f52
+      <object class="NautilusNotebook" id="notebook">
0d1f52
+        <property name="visible">True</property>
0d1f52
+        <property name="show-tabs">False</property>
0d1f52
+        <property name="show-border">False</property>
0d1f52
+      </object>
0d1f52
+    </child>
0d1f52
+    <child type="overlay">
0d1f52
+      <object class="GtkRevealer" id="notification_delete">
0d1f52
+        <property name="visible">True</property>
0d1f52
+        <property name="can_focus">False</property>
0d1f52
+        <property name="halign">center</property>
0d1f52
+        <property name="valign">start</property>
0d1f52
+        <property name="transition_duration">100</property>
0d1f52
+        <child>
0d1f52
+          <object class="GtkFrame">
0d1f52
+            <property name="visible">True</property>
0d1f52
+            <property name="can_focus">False</property>
0d1f52
+            <child>
0d1f52
+              <object class="GtkBox">
0d1f52
+                <property name="visible">True</property>
0d1f52
+                <property name="can_focus">False</property>
0d1f52
+                <property name="margin_start">12</property>
0d1f52
+                <property name="margin_end">4</property>
0d1f52
+                <child>
0d1f52
+                  <object class="GtkLabel" id="notification_delete_label">
0d1f52
+                    <property name="visible">True</property>
0d1f52
+                    <property name="can_focus">False</property>
0d1f52
+                    <property name="max_width_chars">50</property>
0d1f52
+                    <property name="ellipsize">middle</property>
0d1f52
+                    <property name="margin_end">30</property>
0d1f52
+                  </object>
0d1f52
+                </child>
0d1f52
+                <child>
0d1f52
+                  <object class="GtkButton" id="notification_delete_undo">
0d1f52
+                    <property name="label" translatable="yes">Undo</property>
0d1f52
+                    <property name="visible">True</property>
0d1f52
+                    <property name="can_focus">True</property>
0d1f52
+                    <property name="receives_default">True</property>
0d1f52
+                    <property name="no_show_all">True</property>
0d1f52
+                    <property name="margin_end">6</property>
0d1f52
+                    <style>
0d1f52
+                      <class name="text-button"/>
0d1f52
+                    </style>
0d1f52
+                  </object>
0d1f52
+                </child>
0d1f52
+                <child>
0d1f52
+                  <object class="GtkButton" id="notification_delete_close">
0d1f52
+                    <property name="visible">True</property>
0d1f52
+                    <property name="can_focus">True</property>
0d1f52
+                    <property name="receives_default">True</property>
0d1f52
+                    <property name="relief">none</property>
0d1f52
+                    <property name="focus_on_click">False</property>
0d1f52
+                    <child>
0d1f52
+                      <object class="GtkImage">
0d1f52
+                        <property name="visible">True</property>
0d1f52
+                        <property name="can_focus">False</property>
0d1f52
+                        <property name="icon_name">window-close-symbolic</property>
0d1f52
+                        <property name="icon_size">2</property>
0d1f52
+                      </object>
0d1f52
+                    </child>
0d1f52
+                    <style>
0d1f52
+                      <class name="image-button"/>
0d1f52
+                    </style>
0d1f52
+                  </object>
0d1f52
+                </child>
0d1f52
+              </object>
0d1f52
+            </child>
0d1f52
+            <style>
0d1f52
+              <class name="app-notification"/>
0d1f52
+            </style>
0d1f52
+          </object>
0d1f52
+        </child>
0d1f52
+      </object>
0d1f52
+    </child>
0d1f52
+  </object>
0d1f52
+</interface>
0d1f52
+
0d1f52
diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
0d1f52
index 5531d8e..050c021 100644
0d1f52
--- a/src/nautilus-window-private.h
0d1f52
+++ b/src/nautilus-window-private.h
0d1f52
@@ -72,6 +72,13 @@ struct NautilusWindowDetails
0d1f52
 
0d1f52
         guint sidebar_width_handler_id;
0d1f52
         guint bookmarks_id;
0d1f52
+
0d1f52
+	/* Notifications */
0d1f52
+        GtkWidget *notification_delete;
0d1f52
+        GtkWidget *notification_delete_label;
0d1f52
+        GtkWidget *notification_delete_close;
0d1f52
+        GtkWidget *notification_delete_undo;
0d1f52
+	guint notification_delete_timeout_id;
0d1f52
 };
0d1f52
 
0d1f52
 /* window geometry */
0d1f52
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
0d1f52
index 38dea35..7b4d864 100644
0d1f52
--- a/src/nautilus-window.c
0d1f52
+++ b/src/nautilus-window.c
0d1f52
@@ -59,6 +59,8 @@
0d1f52
 #include <libnautilus-private/nautilus-file-utilities.h>
0d1f52
 #include <libnautilus-private/nautilus-file-attributes.h>
0d1f52
 #include <libnautilus-private/nautilus-file-operations.h>
0d1f52
+#include <libnautilus-private/nautilus-file-undo-operations.h>
0d1f52
+#include <libnautilus-private/nautilus-file-undo-manager.h>
0d1f52
 #include <libnautilus-private/nautilus-global-preferences.h>
0d1f52
 #include <libnautilus-private/nautilus-metadata.h>
0d1f52
 #include <libnautilus-private/nautilus-profile.h>
0d1f52
@@ -90,6 +92,8 @@ static void use_extra_mouse_buttons_changed          (gpointer
0d1f52
  */
0d1f52
 #define UPPER_MOUSE_LIMIT 14
0d1f52
 
0d1f52
+#define NOTIFICATION_TIMEOUT 6 //s
0d1f52
+
0d1f52
 enum {
0d1f52
 	PROP_DISABLE_CHROME = 1,
0d1f52
 	NUM_PROPERTIES,
0d1f52
@@ -1392,12 +1396,12 @@ notebook_create_window_cb (GtkNotebook *notebook,
0d1f52
 	return GTK_NOTEBOOK (new_window->details->notebook);
0d1f52
 }
0d1f52
 
0d1f52
-static GtkWidget *
0d1f52
-create_notebook (NautilusWindow *window)
0d1f52
+static void
0d1f52
+connect_notebook (NautilusWindow *window)
0d1f52
 {
0d1f52
 	GtkWidget *notebook;
0d1f52
 
0d1f52
-	notebook = g_object_new (NAUTILUS_TYPE_NOTEBOOK, NULL);
0d1f52
+	notebook = window->details->notebook;
0d1f52
 	g_signal_connect (notebook, "tab-close-request",
0d1f52
 			  G_CALLBACK (notebook_tab_close_requested),
0d1f52
 			  window);
0d1f52
@@ -1419,17 +1423,124 @@ create_notebook (NautilusWindow *window)
0d1f52
 	g_signal_connect_after (notebook, "button-press-event",
0d1f52
 				G_CALLBACK (notebook_button_press_cb),
0d1f52
 				window);
0d1f52
+}
0d1f52
+
0d1f52
+static void
0d1f52
+nautilus_window_on_notification_delete_undo_clicked (GtkWidget  *notification,
0d1f52
+                                                     gpointer    user_data)
0d1f52
+{
0d1f52
+	NautilusWindow *window;
0d1f52
+
0d1f52
+	window = NAUTILUS_WINDOW (user_data);
0d1f52
+
0d1f52
+	if (window->details->notification_delete_timeout_id != 0) {
0d1f52
+		g_source_remove (window->details->notification_delete_timeout_id);
0d1f52
+		window->details->notification_delete_timeout_id = 0;
0d1f52
+	}
0d1f52
+
0d1f52
+	gtk_revealer_set_reveal_child (GTK_REVEALER (window->details->notification_delete), FALSE);
0d1f52
+	nautilus_file_undo_manager_undo (GTK_WINDOW (window));
0d1f52
+}
0d1f52
+
0d1f52
+static void
0d1f52
+nautilus_window_on_notification_delete_close_clicked (GtkWidget  *notification,
0d1f52
+                                                      gpointer    user_data)
0d1f52
+{
0d1f52
+	NautilusWindow *window;
0d1f52
+
0d1f52
+	window = NAUTILUS_WINDOW (user_data);
0d1f52
+
0d1f52
+	if (window->details->notification_delete_timeout_id != 0) {
0d1f52
+		g_source_remove (window->details->notification_delete_timeout_id);
0d1f52
+		window->details->notification_delete_timeout_id = 0;
0d1f52
+	}
0d1f52
+
0d1f52
+	gtk_revealer_set_reveal_child (GTK_REVEALER (window->details->notification_delete), FALSE);
0d1f52
+}
0d1f52
+
0d1f52
+static gboolean
0d1f52
+nautilus_window_on_notification_delete_timeout (gpointer user_data)
0d1f52
+{
0d1f52
+	NautilusWindow *window;
0d1f52
+
0d1f52
+	window = NAUTILUS_WINDOW (user_data);
0d1f52
+
0d1f52
+	if (window->details->notification_delete_timeout_id != 0) {
0d1f52
+		g_source_remove (window->details->notification_delete_timeout_id);
0d1f52
+		window->details->notification_delete_timeout_id = 0;
0d1f52
+	}
0d1f52
+
0d1f52
+	gtk_revealer_set_reveal_child (GTK_REVEALER (window->details->notification_delete), FALSE);
0d1f52
 
0d1f52
-	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
0d1f52
-	gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
0d1f52
-	gtk_widget_show (notebook);
0d1f52
-	gtk_container_set_border_width (GTK_CONTAINER (notebook), 0);
0d1f52
+	return FALSE;
0d1f52
+}
0d1f52
+
0d1f52
+static char *
0d1f52
+nautilus_window_notification_delete_get_label (NautilusFileUndoInfo *undo_info,
0d1f52
+                                               GList *files)
0d1f52
+{
0d1f52
+	gchar *file_label;
0d1f52
+	gchar *label;
0d1f52
+	gint length;
0d1f52
+
0d1f52
+	length = g_list_length (files);
0d1f52
+	if (length == 1) {
0d1f52
+		file_label = g_file_get_basename (files->data);
0d1f52
+	        /* Translators: only one item has been deleted and %s is its name. */
0d1f52
+		label = g_strdup_printf (_("“%s” deleted"), file_label);
0d1f52
+        	g_free (file_label);
0d1f52
+	} else {
0d1f52
+	        /* Translators: one or more items might have been deleted, and %d
0d1f52
+	         * is the count. */
0d1f52
+		label = g_strdup_printf (ngettext ("%d file deleted", "%d files deleted", length), length);
0d1f52
+	}
0d1f52
 
0d1f52
-	gtk_box_pack_start (GTK_BOX (window->details->main_view),
0d1f52
-			    notebook,
0d1f52
-			    TRUE, TRUE, 0);
0d1f52
+	return label;
0d1f52
+}
0d1f52
 
0d1f52
-	return notebook;
0d1f52
+static void
0d1f52
+nautilus_window_on_undo_changed (NautilusFileUndoManager *manager,
0d1f52
+                                 NautilusWindow          *window)
0d1f52
+{
0d1f52
+	NautilusFileUndoInfo *undo_info;
0d1f52
+	NautilusFileUndoManagerState state;
0d1f52
+	int transition_durantion;
0d1f52
+	gchar *label;
0d1f52
+	GList *files;
0d1f52
+
0d1f52
+	/* Hide it inmediatily so we can animate the new notification. */
0d1f52
+	transition_durantion = gtk_revealer_get_transition_duration (GTK_REVEALER (window->details->notification_delete));
0d1f52
+	gtk_revealer_set_transition_duration (GTK_REVEALER (window->details->notification_delete), 0);
0d1f52
+	gtk_revealer_set_reveal_child (GTK_REVEALER (window->details->notification_delete), FALSE);
0d1f52
+	gtk_revealer_set_transition_duration (GTK_REVEALER (window->details->notification_delete), transition_durantion);
0d1f52
+	if (window->details->notification_delete_timeout_id != 0) {
0d1f52
+		g_source_remove (window->details->notification_delete_timeout_id);
0d1f52
+		window->details->notification_delete_timeout_id = 0;
0d1f52
+	}
0d1f52
+
0d1f52
+	undo_info = nautilus_file_undo_manager_get_action ();
0d1f52
+	state = nautilus_file_undo_manager_get_state ();
0d1f52
+
0d1f52
+	if (undo_info != NULL &&
0d1f52
+            state == NAUTILUS_FILE_UNDO_MANAGER_STATE_UNDO &&
0d1f52
+            nautilus_file_undo_info_get_op_type (undo_info) == NAUTILUS_FILE_UNDO_OP_MOVE_TO_TRASH &&
0d1f52
+            !NAUTILUS_IS_DESKTOP_WINDOW (window)) {
0d1f52
+		files = nautilus_file_undo_info_trash_get_files (NAUTILUS_FILE_UNDO_INFO_TRASH (undo_info));
0d1f52
+
0d1f52
+		/* Don't pop up a notification if user canceled the operation or the focus
0d1f52
+		 * is not in the this window. This is an easy way to know from which window
0d1f52
+		 * was the delete operation made */
0d1f52
+		if (g_list_length (files) > 0 && gtk_window_has_toplevel_focus (GTK_WINDOW (window))) {
0d1f52
+			label = nautilus_window_notification_delete_get_label (undo_info, files);
0d1f52
+			gtk_label_set_markup (GTK_LABEL (window->details->notification_delete_label), label);
0d1f52
+			gtk_revealer_set_reveal_child (GTK_REVEALER (window->details->notification_delete), TRUE);
0d1f52
+			window->details->notification_delete_timeout_id = g_timeout_add_seconds (NOTIFICATION_TIMEOUT,
0d1f52
+			                                                                         nautilus_window_on_notification_delete_timeout,
0d1f52
+			                                                                         window);
0d1f52
+			g_free (label);
0d1f52
+		}
0d1f52
+		g_list_free (files);
0d1f52
+	}
0d1f52
 }
0d1f52
 
0d1f52
 static void
0d1f52
@@ -1439,6 +1550,7 @@ nautilus_window_constructed (GObject *self)
0d1f52
 	GtkWidget *grid;
0d1f52
 	NautilusWindowSlot *slot;
0d1f52
 	NautilusApplication *application;
0d1f52
+        GtkBuilder *builder;
0d1f52
 
0d1f52
 	window = NAUTILUS_WINDOW (self);
0d1f52
 
0d1f52
@@ -1476,13 +1588,30 @@ nautilus_window_constructed (GObject *self)
0d1f52
 	gtk_container_add (GTK_CONTAINER (grid), window->details->content_paned);
0d1f52
 	gtk_widget_show (window->details->content_paned);
0d1f52
 
0d1f52
-	window->details->main_view = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
0d1f52
+        g_type_ensure (NAUTILUS_TYPE_NOTEBOOK);
0d1f52
+        builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/nautilus-notification.ui");
0d1f52
+
0d1f52
+	window->details->main_view = GTK_WIDGET (gtk_builder_get_object (builder, "main_view"));
0d1f52
 	gtk_paned_pack2 (GTK_PANED (window->details->content_paned), window->details->main_view,
0d1f52
 			 TRUE, FALSE);
0d1f52
 	gtk_widget_show (window->details->main_view);
0d1f52
 
0d1f52
-	window->details->notebook = create_notebook (window);
0d1f52
-	nautilus_window_set_initial_window_geometry (window);
0d1f52
+        window->details->notebook = GTK_WIDGET (gtk_builder_get_object (builder, "notebook"));
0d1f52
+	connect_notebook (window);
0d1f52
+	window->details->notification_delete = GTK_WIDGET (gtk_builder_get_object (builder, "notification_delete"));
0d1f52
+	window->details->notification_delete_label = GTK_WIDGET (gtk_builder_get_object (builder, "notification_delete_label"));
0d1f52
+	window->details->notification_delete_undo = GTK_WIDGET (gtk_builder_get_object (builder, "notification_delete_undo"));
0d1f52
+	window->details->notification_delete_close = GTK_WIDGET (gtk_builder_get_object (builder, "notification_delete_close"));
0d1f52
+
0d1f52
+        g_object_unref (builder);
0d1f52
+
0d1f52
+	g_signal_connect_object (window->details->notification_delete_close, "clicked",
0d1f52
+	                         G_CALLBACK (nautilus_window_on_notification_delete_close_clicked), window, 0);
0d1f52
+	g_signal_connect_object (window->details->notification_delete_undo, "clicked",
0d1f52
+	                         G_CALLBACK (nautilus_window_on_notification_delete_undo_clicked), window, 0);nautilus_window_set_initial_window_geometry (window);
0d1f52
+
0d1f52
+        g_signal_connect_after (nautilus_file_undo_manager_get (), "undo-changed",
0d1f52
+                                 G_CALLBACK (nautilus_window_on_undo_changed), self);
0d1f52
 
0d1f52
 	slot = nautilus_window_open_slot (window, 0);
0d1f52
 	nautilus_window_set_active_slot (window, slot);
0d1f52
@@ -1604,6 +1733,13 @@ nautilus_window_finalize (GObject *object)
0d1f52
 		window->details->sidebar_width_handler_id = 0;
0d1f52
 	}
0d1f52
 
0d1f52
+        if (window->details->notification_delete_timeout_id != 0) {
0d1f52
+		g_source_remove (window->details->notification_delete_timeout_id);
0d1f52
+		window->details->notification_delete_timeout_id = 0;
0d1f52
+	}
0d1f52
+
0d1f52
+        g_signal_handlers_disconnect_by_data (nautilus_file_undo_manager_get (), window);
0d1f52
+
0d1f52
 	g_clear_object (&window->details->ui_manager);
0d1f52
 
0d1f52
 	/* nautilus_window_close() should have run */
0d1f52
diff --git a/src/nautilus.gresource.xml b/src/nautilus.gresource.xml
0d1f52
index 37a5bbf..0abdeb0 100644
0d1f52
--- a/src/nautilus.gresource.xml
0d1f52
+++ b/src/nautilus.gresource.xml
0d1f52
@@ -8,6 +8,7 @@
0d1f52
     <file>nautilus-directory-view-ui.xml</file>
0d1f52
     <file>nautilus-list-view-ui.xml</file>
0d1f52
     <file>nautilus-shell-ui.xml</file>
0d1f52
+    <file>nautilus-notification.ui</file>
0d1f52
     <file>nautilus-app-menu.ui</file>
0d1f52
     <file alias="icons/thumbnail_frame.png">../icons/thumbnail_frame.png</file>
0d1f52
     <file alias="icons/filmholes.png">../icons/filmholes.png</file>
0d1f52
-- 
0d1f52
2.5.0
0d1f52
0d1f52
From 32608e0ea470cdbe05bd3d2e3b3588cbe9ba39bc Mon Sep 17 00:00:00 2001
0d1f52
From: Carlos Soriano <csoriano@gnome.org>
0d1f52
Date: Thu, 9 Jul 2015 17:18:28 +0200
0d1f52
Subject: [PATCH 2/3] view: change delete shortcut
0d1f52
0d1f52
To just the del key.
0d1f52
---
0d1f52
 src/nautilus-view.c | 2 +-
0d1f52
 1 file changed, 1 insertion(+), 1 deletion(-)
0d1f52
0d1f52
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
0d1f52
index 20590c4..b729339 100644
0d1f52
--- a/src/nautilus-view.c
0d1f52
+++ b/src/nautilus-view.c
0d1f52
@@ -7208,7 +7208,7 @@ static const GtkActionEntry directory_view_entries[] = {
0d1f52
   /* tooltip */                  NULL,
0d1f52
 				 G_CALLBACK (action_rename_select_all_callback) },
0d1f52
   /* name, stock id */         { NAUTILUS_ACTION_TRASH, NULL,
0d1f52
-  /* label, accelerator */       N_("Mo_ve to Trash"), "<control>Delete",
0d1f52
+  /* label, accelerator */       N_("Mo_ve to Trash"), "Delete",
0d1f52
   /* tooltip */                  N_("Move each selected item to the Trash"),
0d1f52
 				 G_CALLBACK (action_trash_callback) },
0d1f52
   /* name, stock id */         { NAUTILUS_ACTION_DELETE, NULL,
0d1f52
-- 
0d1f52
2.5.0
0d1f52
0d1f52
From 10bc4b82d158ba93ee179bbb0f7231fa44299876 Mon Sep 17 00:00:00 2001
0d1f52
From: Carlos Soriano <csoriano@gnome.org>
0d1f52
Date: Fri, 10 Jul 2015 17:14:27 +0200
0d1f52
Subject: [PATCH 3/3] application: add a warning for the move to trash shortcut
0d1f52
0d1f52
Since we changed it, better so warn the user in case he use
0d1f52
the old shortcut.
0d1f52
---
0d1f52
 libnautilus-private/nautilus-global-preferences.h  |  3 ++
0d1f52
 .../org.gnome.nautilus.gschema.xml.in              |  5 +++
0d1f52
 src/nautilus-application-actions.c                 | 46 ++++++++++++++++++++++
0d1f52
 src/nautilus-move-to-trash-shortcut-changed.ui     | 24 +++++++++++
0d1f52
 src/nautilus-view.c                                |  4 --
0d1f52
 src/nautilus.gresource.xml                         |  1 +
0d1f52
 6 files changed, 79 insertions(+), 4 deletions(-)
0d1f52
 create mode 100644 src/nautilus-move-to-trash-shortcut-changed.ui
0d1f52
0d1f52
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
0d1f52
index 5ec3e08..3cef2a3 100644
0d1f52
--- a/libnautilus-private/nautilus-global-preferences.h
0d1f52
+++ b/libnautilus-private/nautilus-global-preferences.h
0d1f52
@@ -159,6 +159,9 @@ typedef enum
0d1f52
 /* Recent files */
0d1f52
 #define NAUTILUS_PREFERENCES_RECENT_FILES_ENABLED          "remember-recent-files"
0d1f52
 
0d1f52
+/* Move to trash shorcut changed dialog */
0d1f52
+#define NAUTILUS_PREFERENCES_SHOW_MOVE_TO_TRASH_SHORTCUT_CHANGED_DIALOG "show-move-to-trash-shortcut-changed-dialog"
0d1f52
+
0d1f52
 
0d1f52
 void nautilus_global_preferences_init                      (void);
0d1f52
 char *nautilus_global_preferences_get_default_folder_viewer_preference_as_iid (void);
0d1f52
diff --git a/libnautilus-private/org.gnome.nautilus.gschema.xml.in b/libnautilus-private/org.gnome.nautilus.gschema.xml.in
0d1f52
index ba344a2..71d94b8 100644
0d1f52
--- a/libnautilus-private/org.gnome.nautilus.gschema.xml.in
0d1f52
+++ b/libnautilus-private/org.gnome.nautilus.gschema.xml.in
0d1f52
@@ -104,6 +104,11 @@
0d1f52
       <_summary>Use extra mouse button events in Nautilus' browser window</_summary>
0d1f52
       <_description>For users with mice that have "Forward" and "Back" buttons, this key will determine if any action is taken inside of Nautilus when either is pressed.</_description>
0d1f52
     </key>
0d1f52
+    <key name="show-move-to-trash-shortcut-changed-dialog" type="b">
0d1f52
+      <default>true</default>
0d1f52
+      <_summary>Show a warning dialog for the change of the shorcut for move to trash</_summary>
0d1f52
+      <_description>Show a warning dialog for the change of the shorcut for move to trash from control + delete to just delete.</_description>
0d1f52
+    </key>
0d1f52
     <key name="mouse-forward-button" type="i">
0d1f52
       <default>9</default>
0d1f52
       <_summary>Mouse button to activate the "Forward" command in browser window</_summary>
0d1f52
diff --git a/src/nautilus-application-actions.c b/src/nautilus-application-actions.c
0d1f52
index e346d61..b759b7a 100644
0d1f52
--- a/src/nautilus-application-actions.c
0d1f52
+++ b/src/nautilus-application-actions.c
0d1f52
@@ -21,6 +21,7 @@
0d1f52
 
0d1f52
 #include "nautilus-application-actions.h"
0d1f52
 
0d1f52
+#include "nautilus-global-preferences.h"
0d1f52
 #include "nautilus-desktop-window.h"
0d1f52
 #include "nautilus-file-management-properties.h"
0d1f52
 
0d1f52
@@ -233,6 +234,49 @@ action_search (GSimpleAction *action,
0d1f52
 	g_object_unref (location);
0d1f52
 }
0d1f52
 
0d1f52
+static void
0d1f52
+got_it_clicked (GtkDialog *dialog,
0d1f52
+                gint       response_id,
0d1f52
+                gpointer   user_data)
0d1f52
+{
0d1f52
+	g_settings_set_boolean (nautilus_preferences,
0d1f52
+                                NAUTILUS_PREFERENCES_SHOW_MOVE_TO_TRASH_SHORTCUT_CHANGED_DIALOG,
0d1f52
+                                FALSE);
0d1f52
+}
0d1f52
+
0d1f52
+static void
0d1f52
+action_show_move_to_trash_shortcut_changed_dialog (GSimpleAction *action,
0d1f52
+                                                   GVariant      *parameter,
0d1f52
+                                                   gpointer       user_data)
0d1f52
+{
0d1f52
+        GtkApplication *app;
0d1f52
+	GtkWindow *window;
0d1f52
+	GtkWindow *dialog;
0d1f52
+	GtkBuilder *builder;
0d1f52
+	gboolean show_dialog_preference;
0d1f52
+
0d1f52
+	app =  GTK_APPLICATION (user_data);
0d1f52
+	show_dialog_preference = g_settings_get_boolean (nautilus_preferences,
0d1f52
+	                                                 NAUTILUS_PREFERENCES_SHOW_MOVE_TO_TRASH_SHORTCUT_CHANGED_DIALOG);
0d1f52
+	if (show_dialog_preference) {
0d1f52
+		builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/nautilus-move-to-trash-shortcut-changed.ui");
0d1f52
+		dialog = GTK_WINDOW (gtk_builder_get_object (builder, "move_to_trash_shortcut_changed_dialog"));
0d1f52
+
0d1f52
+	        window = gtk_application_get_active_window (app);
0d1f52
+		gtk_window_set_transient_for (dialog, window);
0d1f52
+	  	g_signal_connect (dialog, "response",
0d1f52
+                                  G_CALLBACK (got_it_clicked),
0d1f52
+                                  window);
0d1f52
+
0d1f52
+		gtk_widget_show (GTK_WIDGET (dialog));
0d1f52
+		gtk_dialog_run(GTK_DIALOG (dialog));
0d1f52
+		gtk_widget_destroy (GTK_WIDGET (dialog));
0d1f52
+
0d1f52
+	  	g_object_unref (builder);
0d1f52
+	}
0d1f52
+}
0d1f52
+
0d1f52
+
0d1f52
 static GActionEntry app_entries[] = {
0d1f52
 	{ "new-window", action_new_window, NULL, NULL, NULL },
0d1f52
 	{ "connect-to-server", action_connect_to_server, NULL, NULL, NULL },
0d1f52
@@ -246,6 +290,7 @@ static GActionEntry app_entries[] = {
0d1f52
 	{ "kill", action_kill, NULL, NULL, NULL },
0d1f52
 	{ "open-desktop", action_open_desktop, NULL, NULL, NULL },
0d1f52
 	{ "close-desktop", action_close_desktop, NULL, NULL, NULL },
0d1f52
+	{ "show-move-to-trash-shortcut-changed-dialog", action_show_move_to_trash_shortcut_changed_dialog, NULL, NULL, NULL },
0d1f52
 };
0d1f52
 
0d1f52
 void
0d1f52
@@ -259,6 +304,7 @@ nautilus_init_application_actions (NautilusApplication *app)
0d1f52
 					 app_entries, G_N_ELEMENTS (app_entries),
0d1f52
 					 app);
0d1f52
 	gtk_application_add_accelerator (GTK_APPLICATION (app), "F10", "win.gear-menu", NULL);
0d1f52
+	gtk_application_add_accelerator (GTK_APPLICATION (app), "<control>Delete", "app.show-move-to-trash-shortcut-changed-dialog", NULL);
0d1f52
 
0d1f52
 	builder = gtk_builder_new ();
0d1f52
 	gtk_builder_add_from_resource (builder, "/org/gnome/nautilus/nautilus-app-menu.ui", &error);
0d1f52
diff --git a/src/nautilus-move-to-trash-shortcut-changed.ui b/src/nautilus-move-to-trash-shortcut-changed.ui
0d1f52
new file mode 100644
0d1f52
index 0000000..7074b41
0d1f52
--- /dev/null
0d1f52
+++ b/src/nautilus-move-to-trash-shortcut-changed.ui
0d1f52
@@ -0,0 +1,24 @@
0d1f52
+
0d1f52
+
0d1f52
+<interface>
0d1f52
+  <requires lib="gtk+" version="3.12"/>
0d1f52
+  <object class="GtkMessageDialog" id="move_to_trash_shortcut_changed_dialog">
0d1f52
+    <property name="resizable">False</property>
0d1f52
+    <property name="modal">True</property>
0d1f52
+    <property name="window_position">center-on-parent</property>
0d1f52
+    <property name="destroy_with_parent">True</property>
0d1f52
+    <property name="type_hint">dialog</property>
0d1f52
+    <property name="text" translatable="yes">Delete Shortcuts Have Changed</property>
0d1f52
+    <property name="secondary_text" translatable="yes">With the latest version of Files, you no longer need to hold Ctrl to delete—the Delete key will work when pressed on its own.</property>
0d1f52
+    <child type="action">
0d1f52
+      <object class="GtkButton" id="button_got_it">
0d1f52
+        <property name="label" translatable="yes">Got it</property>
0d1f52
+        <property name="visible">True</property>
0d1f52
+      </object>
0d1f52
+    </child>
0d1f52
+    <action-widgets>
0d1f52
+      <action-widget response="ok">button_got_it</action-widget>
0d1f52
+    </action-widgets>
0d1f52
+  </object>
0d1f52
+</interface>
0d1f52
+
0d1f52
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
0d1f52
index b729339..60eb29e 100644
0d1f52
--- a/src/nautilus-view.c
0d1f52
+++ b/src/nautilus-view.c
0d1f52
@@ -9851,10 +9851,6 @@ nautilus_view_class_init (NautilusViewClass *klass)
0d1f52
 	g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
0d1f52
 
0d1f52
 	binding_set = gtk_binding_set_by_class (klass);
0d1f52
-	gtk_binding_entry_add_signal (binding_set, GDK_KEY_Delete, GDK_CONTROL_MASK,
0d1f52
-				      "trash", 0);
0d1f52
-	gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Delete, GDK_CONTROL_MASK,
0d1f52
-				      "trash", 0);
0d1f52
 	gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Delete, GDK_SHIFT_MASK,
0d1f52
 				      "delete", 0);
0d1f52
 }
0d1f52
diff --git a/src/nautilus.gresource.xml b/src/nautilus.gresource.xml
0d1f52
index 0abdeb0..c6f42dc 100644
0d1f52
--- a/src/nautilus.gresource.xml
0d1f52
+++ b/src/nautilus.gresource.xml
0d1f52
@@ -10,6 +10,7 @@
0d1f52
     <file>nautilus-shell-ui.xml</file>
0d1f52
     <file>nautilus-notification.ui</file>
0d1f52
     <file>nautilus-app-menu.ui</file>
0d1f52
+    <file>nautilus-move-to-trash-shortcut-changed.ui</file>
0d1f52
     <file alias="icons/thumbnail_frame.png">../icons/thumbnail_frame.png</file>
0d1f52
     <file alias="icons/filmholes.png">../icons/filmholes.png</file>
0d1f52
     <file alias="icons/knob.png">../icons/knob.png</file>
0d1f52
-- 
0d1f52
2.5.0
0d1f52