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 786760 - Minor refactorings
Minor refactorings
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-08-24 13:32 UTC by Ernestas Kulik
Modified: 2017-12-01 12:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
vfs-directory: stop poking internal directory state (4.65 KB, patch)
2017-08-24 13:32 UTC, Ernestas Kulik
committed Details | Review
directory: reorganize static functions (12.54 KB, patch)
2017-08-24 13:32 UTC, Ernestas Kulik
committed Details | Review
file: reduce the amount of directory state poking (4.01 KB, patch)
2017-08-24 13:33 UTC, Ernestas Kulik
committed Details | Review
directory: define autoptr cleanup func (1.19 KB, patch)
2017-08-24 13:33 UTC, Ernestas Kulik
committed Details | Review
search-directory: use GLib type-definition macros (25.04 KB, patch)
2017-08-24 13:33 UTC, Ernestas Kulik
committed Details | Review
search-directory: rename method instance parameters (34.59 KB, patch)
2017-08-24 15:11 UTC, Ernestas Kulik
committed Details | Review
file: add private method to get directory (1.73 KB, patch)
2017-08-25 13:36 UTC, Ernestas Kulik
none Details | Review
directory: get file directories from new API (6.70 KB, patch)
2017-08-25 13:37 UTC, Ernestas Kulik
none Details | Review
directory: use public API to get name of the file (2.86 KB, patch)
2017-08-25 13:37 UTC, Ernestas Kulik
none Details | Review
search-directory-file: access file directory using new API (2.45 KB, patch)
2017-08-25 15:32 UTC, Ernestas Kulik
none Details | Review
file: add API to get recency and trash time (2.13 KB, patch)
2017-08-25 15:37 UTC, Ernestas Kulik
none Details | Review
vfs-file: use API to get trash time and recency (2.76 KB, patch)
2017-08-25 15:39 UTC, Ernestas Kulik
none Details | Review
vfs-file: use API to get file directory object (3.32 KB, patch)
2017-08-25 16:25 UTC, Ernestas Kulik
none Details | Review
vfs-file: use API to get file type (1.44 KB, patch)
2017-08-25 16:26 UTC, Ernestas Kulik
none Details | Review
vfs-file: move some vfunc overrides to NautilusFile (6.87 KB, patch)
2017-08-25 16:26 UTC, Ernestas Kulik
none Details | Review
directory: use API to get file directory objects (7.90 KB, patch)
2017-08-25 16:53 UTC, Ernestas Kulik
committed Details | Review
directory: use API to get file names (2.85 KB, patch)
2017-08-25 16:54 UTC, Ernestas Kulik
committed Details | Review
search-directory-file: use API to access file directory objects (2.40 KB, patch)
2017-08-25 16:54 UTC, Ernestas Kulik
committed Details | Review
vfs-file: use API to get file times (4.63 KB, patch)
2017-08-25 16:54 UTC, Ernestas Kulik
committed Details | Review
vfs-file: use API to get file directory objects (3.23 KB, patch)
2017-08-25 16:54 UTC, Ernestas Kulik
committed Details | Review
vfs-file: use API to get file type (1.44 KB, patch)
2017-08-25 16:55 UTC, Ernestas Kulik
committed Details | Review
vfs-file: move some vfunc overrides to NautilusFile (6.87 KB, patch)
2017-08-25 16:55 UTC, Ernestas Kulik
committed Details | Review

Description Ernestas Kulik 2017-08-24 13:32:44 UTC
The patches here reduce the amount of intimacy that some classes have with NautilusDirectory, with the exception of the search-directory one - it was just annoying to see it come up in the results for “git grep "directory->details"”. :p
Comment 1 Ernestas Kulik 2017-08-24 13:32:50 UTC
Created attachment 358340 [details] [review]
vfs-directory: stop poking internal directory state

This commit moves some NautilusVFSDirectory vfunc overrides to
NautilusDirectory, as they directly access NautilusDirectoryDetails
fields.
Comment 2 Ernestas Kulik 2017-08-24 13:32:58 UTC
Created attachment 358341 [details] [review]
directory: reorganize static functions
Comment 3 Ernestas Kulik 2017-08-24 13:33:06 UTC
Created attachment 358342 [details] [review]
file: reduce the amount of directory state poking

This commit refactors some functions to use the public NautilusDirectory
API.
Comment 4 Ernestas Kulik 2017-08-24 13:33:13 UTC
Created attachment 358343 [details] [review]
directory: define autoptr cleanup func

If any derived classes have one of their own defined, the compiler will
start spewing warnings.
Comment 5 Ernestas Kulik 2017-08-24 13:33:22 UTC
Created attachment 358344 [details] [review]
search-directory: use GLib type-definition macros
Comment 6 Carlos Soriano 2017-08-24 13:57:46 UTC
Review of attachment 358340 [details] [review]:

Yeah
Comment 7 Carlos Soriano 2017-08-24 13:58:20 UTC
Review of attachment 358341 [details] [review]:

sure
Comment 8 Carlos Soriano 2017-08-24 14:00:06 UTC
Review of attachment 358342 [details] [review]:

nice
Comment 9 Carlos Soriano 2017-08-24 14:00:31 UTC
Review of attachment 358343 [details] [review]:

ah yes
Comment 10 Carlos Soriano 2017-08-24 14:02:21 UTC
Review of attachment 358344 [details] [review]:

Finally!

Usually we change to "self" when porting to the new declarations. Can you do that?
Comment 11 Ernestas Kulik 2017-08-24 14:59:44 UTC
(In reply to Carlos Soriano from comment #10)
> Review of attachment 358344 [details] [review] [review]:
> 
> Finally!
> 
> Usually we change to "self" when porting to the new declarations. Can you do
> that?

I’ve actually never heard of that, but sure, for consistency.
Comment 12 Ernestas Kulik 2017-08-24 15:11:25 UTC
Created attachment 358353 [details] [review]
search-directory: rename method instance parameters

The new standard around here is “self”.
Comment 13 Carlos Soriano 2017-08-24 15:34:24 UTC
Review of attachment 358353 [details] [review]:

Looks good now!

Just as a small comment, usually "self" is not used for the public API, but for the implementation. I like it in the public API as you did though, and usually I do it that way as well.
Comment 14 Ernestas Kulik 2017-08-24 16:42:36 UTC
Attachment 358340 [details] pushed as c02a1f4 - vfs-directory: stop poking internal directory state
Attachment 358341 [details] pushed as 98f3b91 - directory: reorganize static functions
Attachment 358342 [details] pushed as 97cb796 - file: reduce the amount of directory state poking
Attachment 358343 [details] pushed as 2f76227 - directory: define autoptr cleanup func
Attachment 358344 [details] pushed as aff4e92 - search-directory: use GLib type-definition macros
Attachment 358353 [details] pushed as 17a4f43 - search-directory: rename method instance parameters
Comment 15 Ernestas Kulik 2017-08-25 13:36:54 UTC
Created attachment 358401 [details] [review]
file: add private method to get directory

This is to be used instead of accessing the directory directly.
Comment 16 Ernestas Kulik 2017-08-25 13:37:03 UTC
Created attachment 358402 [details] [review]
directory: get file directories from new API

Another attempt at reducing the amount of internal state accessing.
Comment 17 Ernestas Kulik 2017-08-25 13:37:12 UTC
Created attachment 358403 [details] [review]
directory: use public API to get name of the file

This additionally removes some redundant assertions to avoid needless
string copies.
Comment 18 Ernestas Kulik 2017-08-25 13:37:49 UTC
Some more patches here.
Comment 19 Ernestas Kulik 2017-08-25 15:32:41 UTC
Created attachment 358412 [details] [review]
search-directory-file: access file directory using new API
Comment 20 Ernestas Kulik 2017-08-25 15:37:34 UTC
Created attachment 358413 [details] [review]
file: add API to get recency and trash time
Comment 21 Ernestas Kulik 2017-08-25 15:39:17 UTC
Created attachment 358414 [details] [review]
vfs-file: use API to get trash time and recency
Comment 22 Carlos Soriano 2017-08-25 15:42:13 UTC
Review of attachment 358401 [details] [review]:

Sure, just a nitpick for future: this is a case where splitting patches doesn't make much sense, because there is no use of this API.
Comment 23 Carlos Soriano 2017-08-25 15:43:23 UTC
Review of attachment 358402 [details] [review]:

LGTM!
Comment 24 Carlos Soriano 2017-08-25 15:46:17 UTC
Review of attachment 358403 [details] [review]:

+1
Comment 25 Carlos Soriano 2017-08-25 15:51:59 UTC
Review of attachment 358412 [details] [review]:

yes!
Comment 26 Carlos Soriano 2017-08-25 15:52:59 UTC
Review of attachment 358413 [details] [review]:

I'm starting to get you now...
Comment 27 Carlos Soriano 2017-08-25 15:53:45 UTC
Review of attachment 358414 [details] [review]:

+1
Comment 28 Ernestas Kulik 2017-08-25 16:25:58 UTC
Created attachment 358421 [details] [review]
vfs-file: use API to get file directory object
Comment 29 Ernestas Kulik 2017-08-25 16:26:06 UTC
Created attachment 358422 [details] [review]
vfs-file: use API to get file type
Comment 30 Ernestas Kulik 2017-08-25 16:26:14 UTC
Created attachment 358423 [details] [review]
vfs-file: move some vfunc overrides to NautilusFile

Some method overrides are only accessing the private data of the parent
class, so those might as well live in the parent class.
Comment 31 Carlos Soriano 2017-08-25 16:30:50 UTC
Review of attachment 358421 [details] [review]:

It's good, except that the ownership in the gets shouldn't be duplicated.
Comment 32 Carlos Soriano 2017-08-25 16:31:20 UTC
Review of attachment 358422 [details] [review]:

+1
Comment 33 Ernestas Kulik 2017-08-25 16:53:37 UTC
Created attachment 358424 [details] [review]
directory: use API to get file directory objects

Another attempt at reducing the amount of internal state accessing.
Comment 34 Ernestas Kulik 2017-08-25 16:54:18 UTC
Created attachment 358425 [details] [review]
directory: use API to get file names

This additionally removes some redundant assertions to avoid needless
string copies.
Comment 35 Ernestas Kulik 2017-08-25 16:54:29 UTC
Created attachment 358426 [details] [review]
search-directory-file: use API to access file directory objects
Comment 36 Ernestas Kulik 2017-08-25 16:54:39 UTC
Created attachment 358427 [details] [review]
vfs-file: use API to get file times

Additionally this adds new API for trash times and recencies.
Comment 37 Ernestas Kulik 2017-08-25 16:54:49 UTC
Created attachment 358428 [details] [review]
vfs-file: use API to get file directory objects
Comment 38 Ernestas Kulik 2017-08-25 16:55:10 UTC
Created attachment 358429 [details] [review]
vfs-file: use API to get file type
Comment 39 Ernestas Kulik 2017-08-25 16:55:24 UTC
Created attachment 358430 [details] [review]
vfs-file: move some vfunc overrides to NautilusFile

Some method overrides are only accessing the private data of the parent
class, so those might as well live in the parent class.
Comment 40 Ernestas Kulik 2017-12-01 11:59:39 UTC
Attachment 358424 [details] pushed as 364a359 - directory: use API to get file directory objects
Attachment 358425 [details] pushed as d56e570 - directory: use API to get file names
Attachment 358426 [details] pushed as 7ba0a40 - search-directory-file: use API to access file directory objects
Attachment 358427 [details] pushed as 3aab6e9 - vfs-file: use API to get file times
Attachment 358428 [details] pushed as 1cea755 - vfs-file: use API to get file directory objects
Attachment 358429 [details] pushed as 2470d82 - vfs-file: use API to get file type
Attachment 358430 [details] pushed as cbcbb3a - vfs-file: move some vfunc overrides to NautilusFile