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 772588 - regular-file-function: reword the function name
regular-file-function: reword the function name
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: File Search Interface
unspecified
Other All
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-10-07 18:37 UTC by Neha Yadav
Modified: 2016-11-03 10:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
regular-file-function: reword the function name (6.43 KB, patch)
2016-10-07 18:37 UTC, Neha Yadav
none Details | Review
regular-file-function: reword the function name (6.43 KB, patch)
2016-10-08 15:16 UTC, Neha Yadav
none Details | Review
regular-file-function: reword the function name (1.16 KB, patch)
2016-10-27 08:58 UTC, Neha Yadav
none Details | Review
Add function nautilus_file_is_regular_file (1.04 KB, patch)
2016-11-03 07:37 UTC, Neha Yadav
none Details | Review
regular-file-function: reword the function name (1.04 KB, patch)
2016-11-03 07:39 UTC, Neha Yadav
committed Details | Review

Description Neha Yadav 2016-10-07 18:37:03 UTC
In commit we reword the "not file is directory" to
"file is regular file"

The problem is that there are some files available which contain
"!nautilus_file_is_directory" which not look good in file.

To fix this issue we used the already available function, that is
"nautilus_file_is_regular_file()" which is exactly equal to the
function "!nautilus_file_is_directory()"
Comment 1 Neha Yadav 2016-10-07 18:37:13 UTC
Created attachment 337196 [details] [review]
regular-file-function: reword the function name
Comment 2 Neha Yadav 2016-10-08 15:16:55 UTC
Created attachment 337231 [details] [review]
regular-file-function: reword the function name

In commit we reword the "not file is directory" to
"file is regular file"

The problem is that there are some files available which contain
"!nautilus_file_is_directory" which not look good in file.

To fix this issue we used the already available function, that is
"nautilus_file_is_regular_file()" which is exactly equal to the
function "!nautilus_file_is_directory()"
Comment 3 Ernestas Kulik 2016-10-13 14:04:05 UTC
Review of attachment 337231 [details] [review]:

I do not think the code reads any better with your changes (and is likely incorrect).

Judging by the diff, more often than not, the code only works with directories, so checking if the file is a regular file does not necessarily have the same effect.

You and Carlos were discussing this, so I propose we wait for his input (maybe I am wrong about something, too), but I just wanted to express my thoughts on this.

::: src/nautilus-file.c
@@ +7796,3 @@
            nautilus_file_can_execute (file) &&
            nautilus_file_is_executable (file) &&
+           nautilus_file_is_regular_file (file);

Quite honestly, I think this is the only place in code, where checking if the file is a regular file makes sense.
Comment 4 Neha Yadav 2016-10-13 16:39:49 UTC
Even I feel that I did some mistake and in following commit I really did silly mistake.

::: src/nautilus-properties-window.c
@@ -3435,7 +3435,7 @@ update_permissions (NautilusPropertiesWindow *window,
 
         if (!apply_to_both_folder_and_dir &&
             ((nautilus_file_is_directory (file) && !is_folder) ||
-             (!nautilus_file_is_directory (file) && is_folder)))
+             (nautilus_file_is_regular_file (file) && is_folder)))

These conditions will never satisfy :( I don't know why I wrote this
Comment 5 Ernestas Kulik 2016-10-13 17:06:55 UTC
(In reply to Neha Yadav from comment #4)
> These conditions will never satisfy :( I don't know why I wrote this

They will, do not worry. It goes through the list of files, for which the properties are being displayed, and checks whether the permission change should be applied. You can change permissions for files and folders separately, if you have a mixture of both selected.

Time has forgotten about the code for the properties window and it is quite messy. You did not make the mistake you think you made.

Sorry if I sounded a bit harsh in my review. I try to wear my serious hat when commenting on Bugzilla. :)
Comment 6 Carlos Soriano 2016-10-25 08:35:12 UTC
Review of attachment 337231 [details] [review]:

Ernestas is right, only that one makes sense to convert to *_is_regular_file
Comment 7 Neha Yadav 2016-10-27 08:58:54 UTC
Created attachment 338588 [details] [review]
regular-file-function: reword the function name

In commit we reword the "not file is directory" to
"file is regular file"

The problem is that there is a file available which contain
"!nautilus_file_is_directory" which not look good in file.

To fix this issue we used the different function, that is
"nautilus_file_is_regular_file()" which is exactly equal to the
function "!nautilus_file_is_directory()"
Comment 8 Ernestas Kulik 2016-11-03 06:03:11 UTC
Review of attachment 338588 [details] [review]:

It ended up being extremely short. :|

The only nitpicking I want to do is wrt the commit message:

The subject line should say what file has been touched (in this case, just “file”);
the two functions are not exactly antonyms of each other, so the body needs rewriting (e.g. “now that we have the API, we can check if the file is a regular file where needed and not check if it is not a directory”).
Comment 9 Neha Yadav 2016-11-03 07:32:29 UTC
I am very bad in writing commit messages :/
Comment 10 Neha Yadav 2016-11-03 07:37:16 UTC
Created attachment 339010 [details] [review]
Add function nautilus_file_is_regular_file
Comment 11 Neha Yadav 2016-11-03 07:39:34 UTC
Created attachment 339011 [details] [review]
regular-file-function: reword the function name


The problem is that there is a file available which contain "!nautilus_file_is_directory" which not look good in file.
    
Now we have the API, we can check if the file is a regular file
where needed and not check if it is not a directory.
Comment 12 Carlos Soriano 2016-11-03 10:40:31 UTC
Review of attachment 339011 [details] [review]:

Excellent, thanks!
Comment 13 Carlos Soriano 2016-11-03 10:43:53 UTC
Attachment 339011 [details] pushed as 3d50cea - regular-file-function: reword the function name