After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 770109 - file-operations: refactor deleting operation
file-operations: refactor deleting operation
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-08-18 18:38 UTC by Razvan Chitu
Modified: 2016-08-20 12:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
file-operations: refactor deleting operation (23.94 KB, patch)
2016-08-18 18:38 UTC, Razvan Chitu
none Details | Review
file-operations: refactor deleting operation (19.80 KB, patch)
2016-08-18 20:41 UTC, Razvan Chitu
none Details | Review
file-operations: refactor deleting operation (19.80 KB, patch)
2016-08-19 19:46 UTC, Razvan Chitu
committed Details | Review

Description Razvan Chitu 2016-08-18 18:38:14 UTC
See patch.
Comment 1 Razvan Chitu 2016-08-18 18:38:18 UTC
Created attachment 333583 [details] [review]
file-operations: refactor deleting operation

Both the delete and copy operations in Nautilus deal with deleting files
recursively. Each operation has its own implementation of the same
functionality, mixed with specific logic, like error reporting through dialogs.
In order to remove duplicated code, extract delete logic to a separate function
which can be used by both operations.

Implement a function for deleting files recursively which reports errors and
success through an user provided callback.
Comment 2 Razvan Chitu 2016-08-18 20:41:15 UTC
Created attachment 333590 [details] [review]
file-operations: refactor deleting operation

Both the delete and copy operations in Nautilus deal with deleting files
recursively. Each operation has its own implementation of the same
functionality, mixed with specific logic, like error reporting through dialogs.
In order to remove duplicated code, extract delete logic to a separate function
which can be used by both operations.

Implement a function for deleting files recursively which reports errors and
success through an user provided callback.
Comment 3 Ernestas Kulik 2016-08-19 18:31:55 UTC
Review of attachment 333590 [details] [review]:

Looks good to me otherwise.

::: src/nautilus-file-operations.c
@@ +4110,3 @@
+                                            job->cancellable);
+
+        if (file_type == G_FILE_TYPE_DIRECTORY) {

You mixed the two up here.
Comment 4 Razvan Chitu 2016-08-19 19:46:42 UTC
Created attachment 333693 [details] [review]
file-operations: refactor deleting operation

Both the delete and copy operations in Nautilus deal with deleting files
recursively. Each operation has its own implementation of the same
functionality, mixed with specific logic, like error reporting through dialogs.
In order to remove duplicated code, extract delete logic to a separate function
which can be used by both operations.

Implement a function for deleting files recursively which reports errors and
success through an user provided callback.
Comment 5 Carlos Soriano 2016-08-20 09:30:11 UTC
Review of attachment 333693 [details] [review]:

LGTM!

::: src/nautilus-file-operations.c
@@ +1677,3 @@
+        SourceInfo *source_info;
+        TransferInfo *transfer_info;
+} DeleteData;

this should be part of the job... :/ but it's ok, let's make it part of the operations refactor
Comment 6 Razvan Chitu 2016-08-20 12:07:04 UTC
Attachment 333693 [details] pushed as fe0934f - file-operations: refactor deleting operation