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 767265 - Interface for "New Document" should be same as "New folder" interface
Interface for "New Document" should be same as "New folder" interface
Status: RESOLVED INCOMPLETE
Product: nautilus
Classification: Core
Component: File and Folder Operations
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 757600 770622 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-06-05 13:35 UTC by Megh Parikh
Modified: 2018-07-21 21:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
display rename popover after creating new file (2.12 KB, patch)
2017-02-09 17:11 UTC, Anoop Chandu
needs-work Details | Review
show the popover just after creating a file from template (2.19 KB, patch)
2017-04-14 09:39 UTC, Thomas Montaigu
none Details | Review
patch to show a promt similar to the new folder prompt when creating a file from template (14.69 KB, patch)
2017-04-20 19:07 UTC, Thomas Montaigu
needs-work Details | Review

Description Megh Parikh 2016-06-05 13:35:54 UTC
Currently if you select "New folder" from context menu you are shown a prompt where you enter the folder name. But if you select one of the "New Document" entries, a file is created with the name and if you start typing searching starts. Instead a prompt for the filename should be displayed or at least the behaviour that that file is created in "rename mode" should be restored.

(for those who don't know you can create files in the ~/Templates folder and they will appear in the "New Document" menu)
Comment 1 Muthu Kumar 2016-09-06 09:47:49 UTC
*** Bug 770622 has been marked as a duplicate of this bug. ***
Comment 2 Anoop Chandu 2017-02-09 17:11:48 UTC
Created attachment 345351 [details] [review]
display rename popover after creating new file

This patch will display popover when a file is created from context menu by selecting a template. This is done by calling real_action_rename function after selecting new file.
Comment 3 Carlos Soriano 2017-02-28 13:26:14 UTC
Review of attachment 345351 [details] [review]:

Hey! Thanks for the patch.
The code is weak to races, what happens if another file is aknowledged when a template is created? You will rename all of those files.
The only thing I can see to do here is a having a GFile as the last template used, and if that data is not NULL then do the renaming on it and clean up.
Comment 4 Thomas Montaigu 2017-04-14 09:39:24 UTC
Created attachment 349861 [details] [review]
show the popover just after creating a file from template

Hello, this is my solution.

The approach is to use the fact that when a file is created the NautilusView
automatically selects it.

I had to add a check on the name to see of the user actually changed the name before pressing 'enter' or clicking 'rename'.
Without this check, is the user accept to keep the original name the popover wouldn't popup if he tried to create some more files from a template, unless the view was refreshed.

It's kinda hard to explain, but if you open Nautilus, go into a directory and :
- select a file, press F2 or use context menu to rename, press enter or click 'Rename' without changing the name.
- select another file and do the same thing
- press F5, you may see that the 2 files on which you did the operations above are now highlighted

However it doesn't seem to happen 100% of the time.
Comment 5 Carlos Soriano 2017-04-20 07:47:22 UTC
Review of attachment 349861 [details] [review]:

Hey Thomas, thanks for the patch!

However the logic on it seems not correct. The code says "pop up the rename popover if only one file changed", that seems different that what we want "ask for the name of the template before creation"
Comment 6 Thomas Montaigu 2017-04-20 19:07:37 UTC
Created attachment 350161 [details] [review]
patch to show a promt similar to the new folder prompt when creating a file from template

Hi, thanks for the review

I made this new patch according to what you said.
Now, when creating a file from a template, a prompt like the new folder one will show up and ask for the name of the new file before creating it.

It involves more modifications compared to my last patch.

I created a NewFileDialogController class(gobject?) which is heavely inspired from the NewFolderDialogController (not to say it is almost a pure copy/paste) and I'm not sure if it's the best way.
Comment 7 Carlos Soriano 2017-04-21 08:13:33 UTC
Review of attachment 350161 [details] [review]:

Hey! Let's review just the logic for now.

Why a new controller if you end up using the same code? Cannot you reuse the folder-dialog?

Also, be careful with using tabs instead of spaces and the general style and aligment.

Also the commit message is missing, take a look at our commit messages guidelines at wiki.gnome.org/Newcomers/SubmitPatch
Comment 8 Thomas Montaigu 2017-04-22 13:14:59 UTC
(In reply to Carlos Soriano from comment #7)
> Review of attachment 350161 [details] [review] [review]:
> 
> Hey! Let's review just the logic for now.
> 
> Why a new controller if you end up using the same code? Cannot you reuse the
> folder-dialog?
> 

I guess I can, I tried to add a gboolean to the nautilus_new_folder_dialog_controller_new() to set the label, dialog title and the editable region depending on if we want a New File or New folder dialog but again it doesn't feel right.

Moreover if I do the above, the "name_is_valid" method of NautilusFileNameWidgetController will still get overidden and I don't want that to happen if the dialog is used to create a new file.
Comment 9 António Fernandes 2017-08-29 15:47:30 UTC
*** Bug 757600 has been marked as a duplicate of this bug. ***
Comment 10 António Fernandes 2017-11-04 18:19:34 UTC
Hi Thomas. Any update on the patch?

This issue has been reported again on GitLab https://gitlab.gnome.org/GNOME/nautilus/issues/101
Comment 11 Thomas Montaigu 2017-11-06 22:37:07 UTC
I haven't looked at the issue since my last post, maybe I could try again
Comment 12 António Fernandes 2018-07-21 21:56:32 UTC
This has been reported once again on GitLab. https://gitlab.gnome.org/GNOME/nautilus/issues/524

Let's track it there instead. Closing here.