[nautilus/mr/81] general: Remove external bulk rename



commit ca8e5e1f3fca5f2d5a30fddd30b21e0dbed610fa
Author: Carlos Soriano <csoriano gnome org>
Date:   Mon Feb 12 15:24:49 2018 +0100

    general: Remove external bulk rename
    
    In these years, I never heard any tool actually using it. Moreover, now
    we offer batch rename ourselves, so let's focus our efforts on that.

 data/org.gnome.nautilus.gschema.xml |  5 --
 src/nautilus-files-view.c           | 93 ++++++-------------------------------
 src/nautilus-global-preferences.h   |  3 --
 3 files changed, 13 insertions(+), 88 deletions(-)
---
diff --git a/data/org.gnome.nautilus.gschema.xml b/data/org.gnome.nautilus.gschema.xml
index 6dbcf9fa0..324bef0e5 100644
--- a/data/org.gnome.nautilus.gschema.xml
+++ b/data/org.gnome.nautilus.gschema.xml
@@ -196,11 +196,6 @@
       <summary>What viewer should be used when searching</summary>
       <description>When searching Nautilus will switch to the type of view in this setting.</description>
     </key>
-    <key type="ay" name="bulk-rename-tool">
-      <default>[]</default>
-      <summary>Bulk rename utility</summary>
-      <description>If set, Nautilus will append URIs of selected files and treat the result as a command 
line for bulk renaming. Bulk rename applications can register themselves in this key by setting the key to a 
space-separated string of their executable name and any command line options. If the executable name is not 
set to a full path, it will be searched for in the search path.</description>
-    </key>
     <key type="b" name="open-folder-on-dnd-hover">
       <default>true</default>
       <summary>Whether to open the hovered folder after a timeout when drag and drop operation</summary>
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index db5e4797c..6107d074c 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -3060,26 +3060,6 @@ nautilus_files_view_set_selection (NautilusView *nautilus_files_view,
     }
 }
 
-static char *
-get_bulk_rename_tool ()
-{
-    char *bulk_rename_tool;
-    g_settings_get (nautilus_preferences, NAUTILUS_PREFERENCES_BULK_RENAME_TOOL, "^ay", &bulk_rename_tool);
-    return g_strstrip (bulk_rename_tool);
-}
-
-static gboolean
-have_bulk_rename_tool ()
-{
-    char *bulk_rename_tool;
-    gboolean have_tool;
-
-    bulk_rename_tool = get_bulk_rename_tool ();
-    have_tool = ((bulk_rename_tool != NULL) && (*bulk_rename_tool != '\0'));
-    g_free (bulk_rename_tool);
-    return have_tool;
-}
-
 static void
 nautilus_files_view_destroy (GtkWidget *object)
 {
@@ -6116,38 +6096,6 @@ action_paste_files_into (GSimpleAction *action,
     }
 }
 
-static void
-invoke_external_bulk_rename_utility (NautilusFilesView *view,
-                                     GList             *selection)
-{
-    GString *cmd;
-    char *parameter;
-    char *quoted_parameter;
-    char *bulk_rename_tool;
-    GList *walk;
-    NautilusFile *file;
-
-    /* assemble command line */
-    bulk_rename_tool = get_bulk_rename_tool ();
-    cmd = g_string_new (bulk_rename_tool);
-    g_free (bulk_rename_tool);
-    for (walk = selection; walk; walk = walk->next)
-    {
-        file = walk->data;
-        parameter = nautilus_file_get_uri (file);
-        quoted_parameter = g_shell_quote (parameter);
-        g_free (parameter);
-        cmd = g_string_append (cmd, " ");
-        cmd = g_string_append (cmd, quoted_parameter);
-        g_free (quoted_parameter);
-    }
-
-    /* spawning and error handling */
-    nautilus_launch_application_from_command (gtk_widget_get_screen (GTK_WIDGET (view)),
-                                              cmd->str, FALSE, NULL);
-    g_string_free (cmd, TRUE);
-}
-
 static void
 real_action_rename (NautilusFilesView *view)
 {
@@ -6164,27 +6112,20 @@ real_action_rename (NautilusFilesView *view)
         /* If there is more than one file selected, invoke a batch renamer */
         if (selection->next != NULL)
         {
-            if (have_bulk_rename_tool ())
-            {
-                invoke_external_bulk_rename_utility (view, selection);
-            }
-            else
-            {
-                GdkCursor *cursor;
-                GdkDisplay *display;
+            GdkCursor *cursor;
+            GdkDisplay *display;
 
-                display = gtk_widget_get_display (GTK_WIDGET (nautilus_files_view_get_window (view)));
-                cursor = gdk_cursor_new_from_name (display, "progress");
-                gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (nautilus_files_view_get_window 
(view))),
-                                       cursor);
-                g_object_unref (cursor);
+            display = gtk_widget_get_display (GTK_WIDGET (nautilus_files_view_get_window (view)));
+            cursor = gdk_cursor_new_from_name (display, "progress");
+            gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (nautilus_files_view_get_window 
(view))),
+                                   cursor);
+            g_object_unref (cursor);
 
-                dialog = nautilus_batch_rename_dialog_new (selection,
-                                                           nautilus_files_view_get_model (view),
-                                                           nautilus_files_view_get_window (view));
+            dialog = nautilus_batch_rename_dialog_new (selection,
+                                                       nautilus_files_view_get_model (view),
+                                                       nautilus_files_view_get_window (view));
 
-                gtk_widget_show (GTK_WIDGET (dialog));
-            }
+            gtk_widget_show (GTK_WIDGET (dialog));
         }
         else
         {
@@ -7407,16 +7348,8 @@ real_update_actions_state (NautilusFilesView *view)
                                          "rename");
     if (selection_count > 1)
     {
-        if (have_bulk_rename_tool ())
-        {
-            g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
-                                         have_bulk_rename_tool ());
-        }
-        else
-        {
-            g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
-                                         nautilus_file_can_rename_files (selection));
-        }
+        g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                     nautilus_file_can_rename_files (selection));
     }
     else
     {
diff --git a/src/nautilus-global-preferences.h b/src/nautilus-global-preferences.h
index 15de914d6..89e6b2045 100644
--- a/src/nautilus-global-preferences.h
+++ b/src/nautilus-global-preferences.h
@@ -135,9 +135,6 @@ typedef enum
        NAUTILUS_SIMPLE_SEARCH_BAR
 } NautilusSearchBarMode;
 
-/* bulk rename utility */
-#define NAUTILUS_PREFERENCES_BULK_RENAME_TOOL              "bulk-rename-tool"
-
 /* Lockdown */
 #define NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE         "disable-command-line"
 


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