|
|
6a4a9c |
From 67c7bdbf8757c51d3b1bc1f5c40eaeddef9e3a89 Mon Sep 17 00:00:00 2001
|
|
|
6a4a9c |
From: Anubhav Tyagi <tyagianubhav619@gmail.com>
|
|
|
6a4a9c |
Date: Sat, 17 Jul 2021 12:39:20 +0530
|
|
|
6a4a9c |
Subject: [PATCH] files-view: Store selected files list for compressing
|
|
|
6a4a9c |
|
|
|
6a4a9c |
The selected files list is chosen after the user confirmed the compress
|
|
|
6a4a9c |
operation in the compress-dialog which may result in files other than
|
|
|
6a4a9c |
chosen file being compressed.
|
|
|
6a4a9c |
|
|
|
6a4a9c |
Store the list of selected files when the user chooses the "Compress"
|
|
|
6a4a9c |
option from the menu, to avoid that
|
|
|
6a4a9c |
|
|
|
6a4a9c |
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1900
|
|
|
6a4a9c |
|
|
|
6a4a9c |
|
|
|
6a4a9c |
(cherry picked from commit 6c7eacd20302046521e89dd28240c6b0193ba942)
|
|
|
6a4a9c |
---
|
|
|
6a4a9c |
src/nautilus-files-view.c | 37 +++++++++++++++++++++++++++----------
|
|
|
6a4a9c |
1 file changed, 27 insertions(+), 10 deletions(-)
|
|
|
6a4a9c |
|
|
|
6a4a9c |
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
|
|
|
6a4a9c |
index 378e6bdba..b4a91226b 100644
|
|
|
6a4a9c |
--- a/src/nautilus-files-view.c
|
|
|
6a4a9c |
+++ b/src/nautilus-files-view.c
|
|
|
6a4a9c |
@@ -302,6 +302,12 @@ typedef struct
|
|
|
6a4a9c |
NautilusDirectory *directory;
|
|
|
6a4a9c |
} FileAndDirectory;
|
|
|
6a4a9c |
|
|
|
6a4a9c |
+typedef struct
|
|
|
6a4a9c |
+{
|
|
|
6a4a9c |
+ NautilusFilesView *view;
|
|
|
6a4a9c |
+ GList *selection;
|
|
|
6a4a9c |
+} CompressCallbackData;
|
|
|
6a4a9c |
+
|
|
|
6a4a9c |
/* forward declarations */
|
|
|
6a4a9c |
|
|
|
6a4a9c |
static gboolean display_selection_info_idle_callback (gpointer data);
|
|
|
6a4a9c |
@@ -2217,9 +2223,9 @@ static void
|
|
|
6a4a9c |
compress_dialog_controller_on_name_accepted (NautilusFileNameWidgetController *controller,
|
|
|
6a4a9c |
gpointer user_data)
|
|
|
6a4a9c |
{
|
|
|
6a4a9c |
+ CompressCallbackData *callback_data = user_data;
|
|
|
6a4a9c |
NautilusFilesView *view;
|
|
|
6a4a9c |
g_autofree gchar *name = NULL;
|
|
|
6a4a9c |
- GList *selection;
|
|
|
6a4a9c |
GList *source_files = NULL;
|
|
|
6a4a9c |
GList *l;
|
|
|
6a4a9c |
CompressData *data;
|
|
|
6a4a9c |
@@ -2230,12 +2236,10 @@ compress_dialog_controller_on_name_accepted (NautilusFileNameWidgetController *c
|
|
|
6a4a9c |
AutoarFormat format;
|
|
|
6a4a9c |
AutoarFilter filter;
|
|
|
6a4a9c |
|
|
|
6a4a9c |
- view = NAUTILUS_FILES_VIEW (user_data);
|
|
|
6a4a9c |
+ view = NAUTILUS_FILES_VIEW (callback_data->view);
|
|
|
6a4a9c |
priv = nautilus_files_view_get_instance_private (view);
|
|
|
6a4a9c |
|
|
|
6a4a9c |
- selection = nautilus_files_view_get_selection_for_file_transfer (view);
|
|
|
6a4a9c |
-
|
|
|
6a4a9c |
- for (l = selection; l != NULL; l = l->next)
|
|
|
6a4a9c |
+ for (l = callback_data->selection; l != NULL; l = l->next)
|
|
|
6a4a9c |
{
|
|
|
6a4a9c |
source_files = g_list_prepend (source_files,
|
|
|
6a4a9c |
nautilus_file_get_location (l->data));
|
|
|
6a4a9c |
@@ -2302,7 +2306,6 @@ compress_dialog_controller_on_name_accepted (NautilusFileNameWidgetController *c
|
|
|
6a4a9c |
compress_done,
|
|
|
6a4a9c |
data);
|
|
|
6a4a9c |
|
|
|
6a4a9c |
- nautilus_file_list_free (selection);
|
|
|
6a4a9c |
g_list_free_full (source_files, g_object_unref);
|
|
|
6a4a9c |
g_clear_object (&priv->compress_controller);
|
|
|
6a4a9c |
}
|
|
|
6a4a9c |
@@ -2320,6 +2323,12 @@ compress_dialog_controller_on_cancelled (NautilusNewFolderDialogController *cont
|
|
|
6a4a9c |
g_clear_object (&priv->compress_controller);
|
|
|
6a4a9c |
}
|
|
|
6a4a9c |
|
|
|
6a4a9c |
+static void
|
|
|
6a4a9c |
+compress_callback_data_free (CompressCallbackData *data)
|
|
|
6a4a9c |
+{
|
|
|
6a4a9c |
+ nautilus_file_list_free (data->selection);
|
|
|
6a4a9c |
+ g_free (data);
|
|
|
6a4a9c |
+}
|
|
|
6a4a9c |
|
|
|
6a4a9c |
static void
|
|
|
6a4a9c |
nautilus_files_view_compress_dialog_new (NautilusFilesView *view)
|
|
|
6a4a9c |
@@ -2328,6 +2337,7 @@ nautilus_files_view_compress_dialog_new (NautilusFilesView *view)
|
|
|
6a4a9c |
NautilusFilesViewPrivate *priv;
|
|
|
6a4a9c |
g_autolist (NautilusFile) selection = NULL;
|
|
|
6a4a9c |
g_autofree char *common_prefix = NULL;
|
|
|
6a4a9c |
+ CompressCallbackData *data;
|
|
|
6a4a9c |
|
|
|
6a4a9c |
priv = nautilus_files_view_get_instance_private (view);
|
|
|
6a4a9c |
|
|
|
6a4a9c |
@@ -2365,10 +2375,17 @@ nautilus_files_view_compress_dialog_new (NautilusFilesView *view)
|
|
|
6a4a9c |
containing_directory,
|
|
|
6a4a9c |
common_prefix);
|
|
|
6a4a9c |
|
|
|
6a4a9c |
- g_signal_connect (priv->compress_controller,
|
|
|
6a4a9c |
- "name-accepted",
|
|
|
6a4a9c |
- (GCallback) compress_dialog_controller_on_name_accepted,
|
|
|
6a4a9c |
- view);
|
|
|
6a4a9c |
+ data = g_new0 (CompressCallbackData, 1);
|
|
|
6a4a9c |
+ data->view = view;
|
|
|
6a4a9c |
+ data->selection = nautilus_files_view_get_selection_for_file_transfer (view);
|
|
|
6a4a9c |
+
|
|
|
6a4a9c |
+ g_signal_connect_data (priv->compress_controller,
|
|
|
6a4a9c |
+ "name-accepted",
|
|
|
6a4a9c |
+ (GCallback) compress_dialog_controller_on_name_accepted,
|
|
|
6a4a9c |
+ data,
|
|
|
6a4a9c |
+ (GClosureNotify) compress_callback_data_free,
|
|
|
6a4a9c |
+ G_CONNECT_AFTER);
|
|
|
6a4a9c |
+
|
|
|
6a4a9c |
g_signal_connect (priv->compress_controller,
|
|
|
6a4a9c |
"cancelled",
|
|
|
6a4a9c |
(GCallback) compress_dialog_controller_on_cancelled,
|
|
|
6a4a9c |
--
|
|
|
6a4a9c |
2.31.1
|
|
|
6a4a9c |
|