[nautilus/wip/antoniof/run-program-context-menu] mime-actions: Drop ACTIVATION_ACTION_ASK
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/run-program-context-menu] mime-actions: Drop ACTIVATION_ACTION_ASK
- Date: Thu, 17 Dec 2020 16:27:45 +0000 (UTC)
commit 86ec650a1c972ee8ba19302839b4d872a9a9e985
Author: António Fernandes <antoniof gnome org>
Date: Thu Dec 17 13:18:58 2020 +0000
mime-actions: Drop ACTIVATION_ACTION_ASK
There is an option in Preferences which enables a dialog asking users
what they intend to do when they double-click an executable text file:
open as a text file or run as a program?
The dialog asking that question has known design problems, but they
remain unaddressed, which is not surprising because it's non-default.
Now, with the new menu item added in the last commit, the two options
("Open" and "Run as a Program") are both available by default in the
context menu, so there is no need to ask the question in a dialog.
Remove the option, the dialog, and the related code.
Closes https://bugzilla.gnome.org/show_bug.cgi?id=598671
Part of https://gitlab.gnome.org/GNOME/nautilus/-/issues/1700
data/org.gnome.nautilus.gschema.xml | 2 +-
src/nautilus-global-preferences.h | 1 -
src/nautilus-mime-actions.c | 106 +-----------------------
src/nautilus-preferences-window.c | 4 +-
src/resources/ui/nautilus-preferences-window.ui | 17 ----
5 files changed, 4 insertions(+), 126 deletions(-)
---
diff --git a/data/org.gnome.nautilus.gschema.xml b/data/org.gnome.nautilus.gschema.xml
index 941812ea8..3fd69cbad 100644
--- a/data/org.gnome.nautilus.gschema.xml
+++ b/data/org.gnome.nautilus.gschema.xml
@@ -127,7 +127,7 @@
<key name="executable-text-activation" enum="org.gnome.nautilus.ActivationChoice">
<default>'display'</default>
<summary>What to do with executable text files when activated</summary>
- <description>What to do with executable text files when they are activated (single or double clicked).
Possible values are “launch” to launch them as programs, “ask” to ask what to do via a dialog, and “display”
to display them as text files.</description>
+ <description>What to do with executable text files when they are activated (single or double clicked).
Possible values are “launch” to launch them as programs, and “display” to display them as text
files.</description>
</key>
<key type="b" name="install-mime-activation">
<default>true</default>
diff --git a/src/nautilus-global-preferences.h b/src/nautilus-global-preferences.h
index e7e497e3e..324946f3d 100644
--- a/src/nautilus-global-preferences.h
+++ b/src/nautilus-global-preferences.h
@@ -114,7 +114,6 @@ enum
{
NAUTILUS_EXECUTABLE_TEXT_LAUNCH,
NAUTILUS_EXECUTABLE_TEXT_DISPLAY,
- NAUTILUS_EXECUTABLE_TEXT_ASK
};
typedef enum
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c
index 26468c597..bd9068db0 100644
--- a/src/nautilus-mime-actions.c
+++ b/src/nautilus-mime-actions.c
@@ -46,7 +46,6 @@
typedef enum
{
- ACTIVATION_ACTION_ASK,
ACTIVATION_ACTION_LAUNCH,
ACTIVATION_ACTION_LAUNCH_IN_TERMINAL,
ACTIVATION_ACTION_OPEN_IN_VIEW,
@@ -221,10 +220,6 @@ struct
/* Number of seconds until cancel dialog shows up */
#define DELAY_UNTIL_CANCEL_MSECS 5000
-#define RESPONSE_RUN 1000
-#define RESPONSE_DISPLAY 1001
-#define RESPONSE_RUN_IN_TERMINAL 1002
-
#define SILENT_WINDOW_OPEN_LIMIT 5
#define SILENT_OPEN_LIMIT 5
@@ -597,17 +592,9 @@ out:
}
static ActivationAction
-get_executable_text_file_action (GtkWindow *parent_window,
- NautilusFile *file)
+get_default_executable_text_file_action (void)
{
- GtkDialog *dialog;
- char *file_name;
- char *prompt;
- char *detail;
int preferences_value;
- int response;
-
- g_assert (nautilus_file_contains_text (file));
preferences_value = g_settings_get_enum (nautilus_preferences,
NAUTILUS_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION);
@@ -623,86 +610,10 @@ get_executable_text_file_action (GtkWindow *parent_window,
return ACTIVATION_ACTION_OPEN_IN_APPLICATION;
}
- case NAUTILUS_EXECUTABLE_TEXT_ASK:
- {
- }
- break;
-
default:
- /* Complain non-fatally, since preference data can't be trusted */
- g_warning ("Unknown value %d for NAUTILUS_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION",
- preferences_value);
- }
-
-
- file_name = nautilus_file_get_display_name (file);
- prompt = g_strdup_printf (_("Do you want to run “%s”, or display its contents?"),
- file_name);
- detail = g_strdup_printf (_("“%s” is an executable text file."),
- file_name);
- g_free (file_name);
-
- dialog = eel_create_question_dialog (prompt,
- detail,
- _("Run in _Terminal"), RESPONSE_RUN_IN_TERMINAL,
- _("_Display"), RESPONSE_DISPLAY,
- parent_window);
- gtk_dialog_add_button (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL);
- gtk_dialog_add_button (dialog, _("_Run"), RESPONSE_RUN);
- gtk_dialog_set_default_response (dialog, GTK_RESPONSE_CANCEL);
- gtk_widget_show (GTK_WIDGET (dialog));
-
- g_free (prompt);
- g_free (detail);
-
- response = gtk_dialog_run (dialog);
- gtk_widget_destroy (GTK_WIDGET (dialog));
-
- switch (response)
- {
- case RESPONSE_RUN:
- {
- return ACTIVATION_ACTION_LAUNCH;
- }
-
- case RESPONSE_RUN_IN_TERMINAL:
- {
- return ACTIVATION_ACTION_LAUNCH_IN_TERMINAL;
- }
-
- case RESPONSE_DISPLAY:
- {
return ACTIVATION_ACTION_OPEN_IN_APPLICATION;
- }
-
- default:
- return ACTIVATION_ACTION_DO_NOTHING;
}
-}
-
-static ActivationAction
-get_default_executable_text_file_action (void)
-{
- int preferences_value;
-
- preferences_value = g_settings_get_enum (nautilus_preferences,
- NAUTILUS_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION);
- switch (preferences_value)
- {
- case NAUTILUS_EXECUTABLE_TEXT_LAUNCH:
- {
- return ACTIVATION_ACTION_LAUNCH;
- }
-
- case NAUTILUS_EXECUTABLE_TEXT_DISPLAY:
- {
- return ACTIVATION_ACTION_OPEN_IN_APPLICATION;
- }
- case NAUTILUS_EXECUTABLE_TEXT_ASK:
- default:
- return ACTIVATION_ACTION_ASK;
- }
}
static ActivationAction
@@ -1443,15 +1354,6 @@ activate_files (ActivateParameters *parameters)
}
action = get_activation_action (file);
- if (action == ACTIVATION_ACTION_ASK)
- {
- /* Special case for executable text files, since it might be
- * dangerous & unexpected to launch these.
- */
- pause_activation_timed_cancel (parameters);
- action = get_executable_text_file_action (parameters->parent_window, file);
- unpause_activation_timed_cancel (parameters);
- }
switch (action)
{
@@ -1490,12 +1392,6 @@ activate_files (ActivateParameters *parameters)
g_assert_not_reached ();
}
break;
-
- case ACTIVATION_ACTION_ASK:
- {
- g_assert_not_reached ();
- }
- break;
}
}
diff --git a/src/nautilus-preferences-window.c b/src/nautilus-preferences-window.c
index d75d9dcfa..58504823d 100644
--- a/src/nautilus-preferences-window.c
+++ b/src/nautilus-preferences-window.c
@@ -84,12 +84,12 @@ static const char * const click_behavior_values[] = {"single", "double", NULL};
static const char * const executable_text_components[] =
{
"scripts_execute_radiobutton", "scripts_view_radiobutton",
- "scripts_confirm_radiobutton", NULL
+ NULL
};
static const char * const executable_text_values[] =
{
- "launch", "display", "ask",
+ "launch", "display",
NULL
};
diff --git a/src/resources/ui/nautilus-preferences-window.ui b/src/resources/ui/nautilus-preferences-window.ui
index 066b15733..adc90fdc3 100644
--- a/src/resources/ui/nautilus-preferences-window.ui
+++ b/src/resources/ui/nautilus-preferences-window.ui
@@ -651,23 +651,6 @@
<property name="position">3</property>
</packing>
</child>
- <child>
- <object class="GtkRadioButton" id="scripts_confirm_radiobutton">
- <property name="label" translatable="yes">_Ask what to do</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="halign">start</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">scripts_execute_radiobutton</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">4</property>
- </packing>
- </child>
<accessibility>
<relation type="labelled-by" target="label12"/>
</accessibility>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]