[nautilus/wip/antoniof/run-program-context-menu: 63/63] preferences: Drop executable-text-activation setting




commit 889752954a6985b96c51d86493cb57be8acacf3f
Author: António Fernandes <antoniof gnome org>
Date:   Thu Dec 17 14:30:50 2020 +0000

    preferences: Drop executable-text-activation setting
    
    Whe the ASK option gone, the only alternative to the default is RUN.
    
    This option is not safe: it's too easy to accidentally run programs.
    
    Now we have a "Run as a Program" action in the context menu, which is
    available by default (no configuration required) and safe (clearly
    labeled, intentionally chosen).
    
    So, remove the RUN option is no longer necessary, and with it we can
    remove the preference from both the UI and GSettings schemas.
    
    Closes https://gitlab.gnome.org/GNOME/nautilus/-/issues/1700
    Discussed in https://gitlab.gnome.org/GNOME/nautilus/-/issues/443

 data/org.gnome.nautilus.gschema.xml             |  5 --
 src/nautilus-global-preferences.h               |  9 ---
 src/nautilus-mime-actions.c                     | 21 +------
 src/nautilus-preferences-window.c               | 16 ------
 src/resources/ui/nautilus-preferences-window.ui | 76 +------------------------
 5 files changed, 2 insertions(+), 125 deletions(-)
---
diff --git a/data/org.gnome.nautilus.gschema.xml b/data/org.gnome.nautilus.gschema.xml
index 68d234d63..e03127e0b 100644
--- a/data/org.gnome.nautilus.gschema.xml
+++ b/data/org.gnome.nautilus.gschema.xml
@@ -120,11 +120,6 @@
       <summary>Type of click used to launch/open files</summary>
       <description>Possible values are “single” to launch files on a single click, or “double” to launch 
them on a double click.</description>
     </key>
-    <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, and “display” to display them as text 
files.</description>
-    </key>
     <key type="b" name="install-mime-activation">
       <default>true</default>
       <summary>Show the package installer for unknown MIME types</summary>
diff --git a/src/nautilus-global-preferences.h b/src/nautilus-global-preferences.h
index 18a4681a9..8c482f7ce 100644
--- a/src/nautilus-global-preferences.h
+++ b/src/nautilus-global-preferences.h
@@ -48,9 +48,6 @@ typedef enum
 /* Drag and drop preferences */
 #define NAUTILUS_PREFERENCES_OPEN_FOLDER_ON_DND_HOVER          "open-folder-on-dnd-hover"
 
-/* Activating executable text files */
-#define NAUTILUS_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION                "executable-text-activation"
-
 /* Installing new packages when unknown mime type activated */
 #define NAUTILUS_PREFERENCES_INSTALL_MIME_ACTIVATION           "install-mime-activation"
 
@@ -107,12 +104,6 @@ enum
        NAUTILUS_CLICK_POLICY_DOUBLE
 };
 
-enum
-{
-       NAUTILUS_EXECUTABLE_TEXT_LAUNCH,
-       NAUTILUS_EXECUTABLE_TEXT_DISPLAY,
-};
-
 typedef enum
 {
        NAUTILUS_SPEED_TRADEOFF_ALWAYS,
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c
index c947945bb..1a3abff38 100644
--- a/src/nautilus-mime-actions.c
+++ b/src/nautilus-mime-actions.c
@@ -594,26 +594,7 @@ out:
 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;
-        }
-
-        default:
-            return ACTIVATION_ACTION_OPEN_IN_APPLICATION;
-    }
-
+    return ACTIVATION_ACTION_OPEN_IN_APPLICATION;
 }
 
 static ActivationAction
diff --git a/src/nautilus-preferences-window.c b/src/nautilus-preferences-window.c
index d35775428..477078c16 100644
--- a/src/nautilus-preferences-window.c
+++ b/src/nautilus-preferences-window.c
@@ -79,18 +79,6 @@ static const char * const click_behavior_components[] =
 
 static const char * const click_behavior_values[] = {"single", "double", NULL};
 
-static const char * const executable_text_components[] =
-{
-    "scripts_execute_radiobutton", "scripts_view_radiobutton",
-    NULL
-};
-
-static const char * const executable_text_values[] =
-{
-    "launch", "display",
-    NULL
-};
-
 static const char * const recursive_search_components[] =
 {
     "search_recursive_only_this_computer_radiobutton", "search_recursive_all_locations_radiobutton", 
"search_recursive_never_radiobutton", NULL
@@ -476,10 +464,6 @@ static void nautilus_preferences_window_setup(GtkBuilder *builder,
     bind_builder_radio (
         builder, nautilus_preferences, (const char **) click_behavior_components,
         NAUTILUS_PREFERENCES_CLICK_POLICY, (const char **) click_behavior_values);
-    bind_builder_radio (builder, nautilus_preferences,
-                        (const char **) executable_text_components,
-                        NAUTILUS_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION,
-                        (const char **) executable_text_values);
     bind_builder_radio (builder, nautilus_preferences,
                         (const char **) recursive_search_components,
                         NAUTILUS_PREFERENCES_RECURSIVE_SEARCH,
diff --git a/src/resources/ui/nautilus-preferences-window.ui b/src/resources/ui/nautilus-preferences-window.ui
index 54ec7bc96..d538e00c9 100644
--- a/src/resources/ui/nautilus-preferences-window.ui
+++ b/src/resources/ui/nautilus-preferences-window.ui
@@ -592,80 +592,6 @@
                     <property name="position">1</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkBox" id="vbox7">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="orientation">vertical</property>
-                    <property name="spacing">6</property>
-                    <child>
-                      <object class="GtkLabel" id="label_executable_text_files">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Executable Text Files</property>
-                        <property name="xalign">0</property>
-                        <attributes>
-                          <attribute name="weight" value="bold"/>
-                        </attributes>
-                        <accessibility>
-                          <relation type="label-for" target="vbox7"/>
-                        </accessibility>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkRadioButton" id="scripts_view_radiobutton">
-                        <property name="label" translatable="yes">_Display them</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">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkRadioButton" id="scripts_execute_radiobutton">
-                        <property name="label" translatable="yes">_Run them</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_view_radiobutton</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">3</property>
-                      </packing>
-                    </child>
-                    <accessibility>
-                      <relation type="labelled-by" target="label_executable_text_files"/>
-                    </accessibility>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="vbox7-atkobject">
-                        <property name="AtkObject::accessible-role">panel</property>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
                 <child>
                   <object class="GtkBox" id="vbox8">
                     <property name="visible">True</property>
@@ -719,7 +645,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="position">3</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
               </object>


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