diff options
author | António Fernandes <antoniof@gnome.org> | 2020-12-17 13:18:58 +0000 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2021-02-06 18:20:10 +0000 |
commit | 64326f0331a3df62708d87868bc8e7dab0f8597e (patch) | |
tree | f1faa1fb9e55bfd3f07c9a1d3b6f4afb854e0321 /src/nautilus-mime-actions.c | |
parent | 0584f6cb93b26d2052e3214ce5894656ea79be27 (diff) | |
download | nautilus-64326f0331a3df62708d87868bc8e7dab0f8597e.tar.gz |
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
Diffstat (limited to 'src/nautilus-mime-actions.c')
-rw-r--r-- | src/nautilus-mime-actions.c | 106 |
1 files changed, 1 insertions, 105 deletions
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c index cb2d4ea57..c947945bb 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; } } |