[nautilus/wip/csoriano/debug: 2/8] files-view: use correct parent when compressing/decompressing
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/csoriano/debug: 2/8] files-view: use correct parent when compressing/decompressing
- Date: Mon, 19 Sep 2016 18:54:51 +0000 (UTC)
commit f016adeee5da8d28f8967ee8df520f60a5c6e1f7
Author: Carlos Soriano <csoriano gnome org>
Date: Thu Sep 15 16:48:57 2016 +0200
files-view: use correct parent when compressing/decompressing
We were using the view as the destination for compression and
decompression.
However, the parent of the files is not always the view. This is the
case in list view when the "allow expand folder" setting is set and the
selection is different than the root location of the view.
To fix it, use a parent of one of the selected files, we assume all
files has the same parent.
https://bugzilla.gnome.org/show_bug.cgi?id=771470
src/nautilus-files-view.c | 43 ++++++++++++++++++++++++++++++++++++-------
1 files changed, 36 insertions(+), 7 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 8b55410..e613a01 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -1172,8 +1172,16 @@ nautilus_files_view_activate_files (NautilusFilesView *view,
if (nautilus_files_view_supports_extract_here (view))
{
- extract_files (view, files_to_extract,
- nautilus_view_get_location (NAUTILUS_VIEW (view)));
+ g_autoptr (GFile) location = NULL;
+ g_autoptr (GFile) parent = NULL;
+
+ location = nautilus_file_get_location (NAUTILUS_FILE (g_list_first (files)->data));
+ /* Get a parent from a random file. We assume all files has a common parent.
+ * But don't assume the parent is the view location, since that's not the
+ * case in list view when expand-folder setting is set
+ */
+ parent = g_file_get_parent (location);
+ extract_files (view, files_to_extract, parent);
}
else
{
@@ -1208,8 +1216,16 @@ nautilus_files_view_activate_file (NautilusFilesView *view,
if (nautilus_files_view_supports_extract_here (view))
{
- extract_files (view, files,
- nautilus_view_get_location (NAUTILUS_VIEW (view)));
+ g_autoptr (GFile) location = NULL;
+ g_autoptr (GFile) parent = NULL;
+
+ location = nautilus_file_get_location (file);
+ /* Get a parent from a random file. We assume all files has a common parent.
+ * But don't assume the parent is the view location, since that's not the
+ * case in list view when expand-folder setting is set
+ */
+ parent = g_file_get_parent (location);
+ extract_files (view, files, parent);
}
else
{
@@ -2055,6 +2071,7 @@ compress_dialog_controller_on_name_accepted (NautilusFileNameWidgetController *c
GList *l;
CompressData *data;
g_autoptr (GFile) output = NULL;
+ g_autoptr (GFile) parent = NULL;
NautilusCompressionFormat compression_format;
AutoarFormat format;
AutoarFilter filter;
@@ -2071,7 +2088,12 @@ compress_dialog_controller_on_name_accepted (NautilusFileNameWidgetController *c
source_files = g_list_reverse (source_files);
name = nautilus_file_name_widget_controller_get_new_name (controller);
- output = g_file_get_child (view->details->location, name);
+ /* Get a parent from a random file. We assume all files has a common parent.
+ * But don't assume the parent is the view location, since that's not the
+ * case in list view when expand-folder setting is set
+ */
+ parent = g_file_get_parent (G_FILE (g_list_first (source_files)->data));
+ output = g_file_get_child (parent, name);
data = g_new (CompressData, 1);
data->view = view;
@@ -6197,13 +6219,20 @@ action_extract_here (GSimpleAction *action,
{
NautilusFilesView *view;
GList *selection;
+ g_autoptr (GFile) location = NULL;
+ g_autoptr (GFile) parent = NULL;
view = NAUTILUS_FILES_VIEW (user_data);
selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
+ location = nautilus_file_get_location (NAUTILUS_FILE (g_list_first (selection)->data));
+ /* Get a parent from a random file. We assume all files has a common parent.
+ * But don't assume the parent is the view location, since that's not the
+ * case in list view when expand-folder setting is set
+ */
+ parent = g_file_get_parent (location);
- extract_files (view, selection,
- nautilus_view_get_location (NAUTILUS_VIEW (view)));
+ extract_files (view, selection, parent);
nautilus_file_list_free (selection);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]