GNOME Bugzilla – Bug 767265
Interface for "New Document" should be same as "New folder" interface
Last modified: 2018-07-21 21:56:32 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)
*** Bug 770622 has been marked as a duplicate of this bug. ***
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.
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.
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.
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"
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.
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
(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.
*** Bug 757600 has been marked as a duplicate of this bug. ***
Hi Thomas. Any update on the patch? This issue has been reported again on GitLab https://gitlab.gnome.org/GNOME/nautilus/issues/101
I haven't looked at the issue since my last post, maybe I could try again
This has been reported once again on GitLab. https://gitlab.gnome.org/GNOME/nautilus/issues/524 Let's track it there instead. Closing here.