[nautilus] nautilus-view: show a warning if the user control + delete
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] nautilus-view: show a warning if the user control + delete
- Date: Mon, 16 Feb 2015 18:46:19 +0000 (UTC)
commit 966a879012b53933eee4328cc9475a78289deeb0
Author: Carlos Soriano <csoriano gnome org>
Date: Mon Feb 16 17:58:47 2015 +0100
nautilus-view: show a warning if the user control + delete
Now that we changed the shorcut for move to trash to Delete, we need
to inform the user when he tries to use the old shorcut.
We allow to disable the dialog for next times with a checkbutton in
the dialog.
libnautilus-private/nautilus-global-preferences.h | 3 +
.../org.gnome.nautilus.gschema.xml.in | 5 ++
src/nautilus-view.c | 47 +++++++++++++++++++-
src/nautilus.gresource.xml | 1 +
4 files changed, 55 insertions(+), 1 deletions(-)
---
diff --git a/libnautilus-private/nautilus-global-preferences.h
b/libnautilus-private/nautilus-global-preferences.h
index 5ec3e08..6474f7a 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -160,6 +160,9 @@ typedef enum
#define NAUTILUS_PREFERENCES_RECENT_FILES_ENABLED "remember-recent-files"
+/* Move to trash shorcut changed dialog */
+#define NAUTILUS_PREFERENCES_SHOW_MOVE_TO_TRASH_SHORCUT_CHANGED_DIALOG
"show-move-to-trash-shorcut-changed-dialog"
+
void nautilus_global_preferences_init (void);
char *nautilus_global_preferences_get_default_folder_viewer_preference_as_iid (void);
diff --git a/libnautilus-private/org.gnome.nautilus.gschema.xml.in
b/libnautilus-private/org.gnome.nautilus.gschema.xml.in
index b57a9c6..7f8dcf9 100644
--- a/libnautilus-private/org.gnome.nautilus.gschema.xml.in
+++ b/libnautilus-private/org.gnome.nautilus.gschema.xml.in
@@ -101,6 +101,11 @@
<_summary>Show the package installer for unknown mime types</_summary>
<_description>Whether to show the user a package installer dialog in case an unknown mime type is
opened, in order to search for an application to handle it.</_description>
</key>
+ <key name="show-move-to-trash-shorcut-changed-dialog" type="b">
+ <default>true</default>
+ <_summary>Show a warning dialog for the change of the shorcut for move to trash</_summary>
+ <_description>Show a warning dialog for the change of the shorcut for move to trash from control +
delete to just delete.</_description>
+ </key>
<key name="mouse-use-extra-buttons" type="b">
<default>true</default>
<_summary>Use extra mouse button events in Nautilus' browser window</_summary>
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 54587ac..6a701d0 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -923,6 +923,45 @@ action_open_file_and_close_window (GSimpleAction *action,
}
static void
+got_it_clicked (GtkDialog *dialog,
+ gint response_id,
+ gpointer user_data)
+{
+ g_settings_set_boolean (nautilus_preferences,
+ NAUTILUS_PREFERENCES_SHOW_MOVE_TO_TRASH_SHORCUT_CHANGED_DIALOG,
+ FALSE);
+}
+
+static void
+action_show_move_to_trash_shorcut_changed_dialog (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ NautilusView *view;
+ GtkWindow *dialog;
+ GtkBuilder *builder;
+ gboolean show_dialog_preference;
+
+ view = (NautilusView *) user_data;
+ show_dialog_preference = g_settings_get_boolean (nautilus_preferences,
+
NAUTILUS_PREFERENCES_SHOW_MOVE_TO_TRASH_SHORCUT_CHANGED_DIALOG);
+ if (show_dialog_preference) {
+ builder = gtk_builder_new_from_resource
("/org/gnome/nautilus/nautilus-move-to-trash-shorcut-changed.ui");
+ dialog = (GtkWindow *) gtk_builder_get_object (builder,
"move_to_trash_shorcut_changed_dialog");
+
+ gtk_window_set_transient_for (dialog, (GtkWindow *) nautilus_view_get_window (view));
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (got_it_clicked),
+ view);
+
+ gtk_widget_show ((GtkWidget *) dialog);
+ gtk_dialog_run((GtkDialog *) dialog);
+ gtk_widget_destroy ((GtkWidget *) dialog);
+
+ g_object_unref (builder);
+ }
+}
+static void
action_open_item_location (GSimpleAction *action,
GVariant *state,
gpointer user_data)
@@ -5582,7 +5621,9 @@ const GActionEntry view_entries[] = {
/* Only accesible by shorcuts */
{ "select-pattern", action_select_pattern },
{ "invert-selection", action_invert_selection },
- { "open-file-and-close-window", action_open_file_and_close_window }
+ { "open-file-and-close-window", action_open_file_and_close_window },
+ /* Warning dialog for the change of the shorcut to move to trash */
+ { "show-move-to-trash-shorcut-changed-dialog", action_show_move_to_trash_shorcut_changed_dialog }
};
static gboolean
@@ -7524,6 +7565,10 @@ nautilus_view_init (NautilusView *view)
nautilus_application_add_accelerator (app, "view.invert-selection", "<shift><control>i");
nautilus_application_add_accelerator (app, "view.open-file-and-close-window", "<control><shift>Down");
+ /* Show a warning dialog to inform the user that the shorcut for move to trash
+ * changed */
+ nautilus_application_add_accelerator (app, "view.show-move-to-trash-shorcut-changed-dialog",
"<control>Delete");
+
nautilus_profile_end (NULL);
}
diff --git a/src/nautilus.gresource.xml b/src/nautilus.gresource.xml
index 1bdb66c..fd792e3 100644
--- a/src/nautilus.gresource.xml
+++ b/src/nautilus.gresource.xml
@@ -9,6 +9,7 @@
<file>nautilus-toolbar-action-menu.xml</file>
<file>nautilus-view-context-menus.xml</file>
<file>nautilus-progress-info-widget.xml</file>
+ <file>nautilus-move-to-trash-shorcut-changed.ui</file>
<file alias="icons/thumbnail_frame.png">../icons/thumbnail_frame.png</file>
<file alias="icons/filmholes.png">../icons/filmholes.png</file>
<file alias="icons/knob.png">../icons/knob.png</file>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]