[file-roller/wip/jtojnar/engrampa-backports: 6/21] nautilus: Support extracting multiple archives simultaneously with “Archive to…”




commit 722af3bf7779a2fa79e9f4fc2dc1c12edd5cd209
Author: Jan Tojnar <jtojnar gmail com>
Date:   Tue Jul 26 17:39:33 2022 +0200

    nautilus: Support extracting multiple archives simultaneously with “Archive to…”
    
    Based on https://github.com/mate-desktop/engrampa/commit/9422315606cd5a8c396bcccbd6a8d8b88a7ad8f8
    
    Co-Authored-By: ZenWalker <scow riseup net>

 nautilus/nautilus-fileroller.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/nautilus/nautilus-fileroller.c b/nautilus/nautilus-fileroller.c
index d10e83e1..bed8fc72 100644
--- a/nautilus/nautilus-fileroller.c
+++ b/nautilus/nautilus-fileroller.c
@@ -38,26 +38,27 @@ extract_to_callback (NautilusMenuItem *item,
                     gpointer          user_data)
 {
        GList            *files;
+       GList            *scan;
        NautilusFileInfo *file;
-       char             *uri, *default_dir;
+       g_autofree char *default_dir = NULL;
        GString          *cmd;
-       g_autofree char *quoted_uri = NULL;
        g_autofree char *quoted_default_dir = NULL;
 
        files = g_object_get_data (G_OBJECT (item), "files");
        file = files->data;
 
-       uri = nautilus_file_info_get_uri (file);
        default_dir = nautilus_file_info_get_parent_uri (file);
-
-       quoted_uri = g_shell_quote (uri);
        quoted_default_dir = g_shell_quote (default_dir);
 
        cmd = g_string_new ("file-roller");
-       g_string_append_printf (cmd,
-                               " --default-dir=%s --extract %s",
-                               quoted_default_dir,
-                               quoted_uri);
+       g_string_append_printf (cmd, " --default-dir=%s --extract", quoted_default_dir);
+
+       for (scan = files; scan; scan = scan->next) {
+               NautilusFileInfo *file = scan->data;
+               g_autofree char *uri = nautilus_file_info_get_uri (file);
+               g_autofree char *quoted_uri = g_shell_quote (uri);
+               g_string_append_printf (cmd, " %s", quoted_uri);
+       }
 
 #ifdef DEBUG
        g_print ("EXEC: %s\n", cmd->str);
@@ -66,8 +67,6 @@ extract_to_callback (NautilusMenuItem *item,
        g_spawn_command_line_async (cmd->str, NULL);
 
        g_string_free (cmd, TRUE);
-       g_free (default_dir);
-       g_free (uri);
 }
 
 


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