GNOME Bugzilla – Bug 774361
F2 pressed a second time should select filename+extension
Last modified: 2017-03-02 11:33:57 UTC
When pressing F2, the popover for renaming appears and the filename is selected, not the dot and not the extension => OK. When pressing F2 again, nothing happens => I would like it to do a CTRL+A, ie selecting the filename + the dot + the extension. In fact, I would like it to toggle between the two selection modes: filename only <-> filename.extension. I miss this behaviour from the previous version in Ubuntu (3.16 I think).
Oh I see, I just tested in old nautilus and it's true. I don't mind putting it back sure.
*** Bug 774436 has been marked as a duplicate of this bug. ***
Created attachment 344931 [details] [review] rename-file-popover-controller: make F2 toggle between selection modes In previous versions of Nautilus, F2 used to switch between selecting the whole filename and selecting the filename up to the extension. This functionality has been lost in some version. This commit brings the functionality back.
Review of attachment 344931 [details] [review]: ::: src/nautilus-rename-file-popover-controller.c @@ +270,3 @@ + MIN (MAX (n_chars, RENAME_ENTRY_MIN_CHARS), + RENAME_ENTRY_MAX_CHARS)); + I decided to not split this, but, basically, it makes the entry sizing consistent between both files and folders.
Created attachment 344932 [details] [review] rename-file-popover-controller: make F2 toggle between selection modes Whoops, forgot to pass the pointer to NAUTILUS_IS_RENAME_FILE_POPOVER_CONTROLLER ().
Created attachment 344933 [details] [review] rename-file-popover-controller: make F2 toggle between selection modes My brain cannot parse boolean expressions, it appears.
Comment on attachment 344933 [details] [review] rename-file-popover-controller: make F2 toggle between selection modes Sorry for the spam, this is a bit broken.
Created attachment 344939 [details] [review] rename-file-popover-controller: make F2 toggle between selection modes In previous versions of Nautilus, F2 used to switch between selecting the whole filename and selecting the filename up to the extension. This functionality has been lost in some version. This commit brings the functionality back.
Review of attachment 344939 [details] [review]: ::: src/nautilus-rename-file-popover-controller.c @@ +42,3 @@ gint closed_handler_id; + + gboolean select_all; can we avoid this with checking if the entry is all selected instead? @@ +265,3 @@ } + n_chars = g_utf8_strlen (display_name, -1); since it's pretty independnet... do you mind to separate it in another patch?
(In reply to Carlos Soriano from comment #9) > ::: src/nautilus-rename-file-popover-controller.c > @@ +42,3 @@ > gint closed_handler_id; > + > + gboolean select_all; > > can we avoid this with checking if the entry is all selected instead? Good idea, I haven’t considered that. > since it's pretty independnet... do you mind to separate it in another patch? Sure.
Created attachment 346914 [details] [review] rename-file-popover-controller: make F2 toggle between selection modes In previous versions of Nautilus, F2 used to switch between selecting the whole filename and selecting the filename up to the extension. This functionality has been lost in some version. This commit brings the functionality back.
Created attachment 346915 [details] [review] rename-file-popover-controller: set entry width for all files The width for the rename popover entry is set if the file is a regular file, which does not include folders, resulting in a narrow entry, despite the name being long. This commit makes the code set the width regardless of the file type.
Created attachment 346916 [details] [review] rename-file-popover-controller: set entry width for all files Didn’t zero-initialize the autofree pointer.
Review of attachment 346916 [details] [review]: +1
I just realized you have a src.gnome.org address. I think it's time to request a GNOME membership.
Review of attachment 346914 [details] [review]: Feel free to commit after this: and thanks! ::: src/nautilus-rename-file-popover-controller.c @@ +139,3 @@ + + g_return_val_if_fail (NAUTILUS_IS_RENAME_FILE_POPOVER_CONTROLLER (user_data), + NautilusRenameFilePopoverController *self; this is fine, but we (as in gtk+, glib etc.) don't usually make this checks for signals from the same class, because the type is expected to be right. You can leave it like this, just pointing out. @@ +158,3 @@ + &start_pos, &end_pos); + + key_event = (GdkEventKey *)event; can you add a comment explaining what we are doing here? It looks pretty cryptic otherwise "aaah so this whole function is just to toggle between selecting just the name or the name with extension!"
Created attachment 346952 [details] [review] rename-file-popover-controller: make F2 toggle between selection modes In previous versions of Nautilus, F2 used to switch between selecting the whole filename and selecting the filename up to the extension. This functionality has been lost in some version. This commit brings the functionality back.
(In reply to Carlos Soriano from comment #16) > Review of attachment 346914 [details] [review] [review]: > > Feel free to commit after this: and thanks! I’ll let the patch stew for a bit, gotta run out. > ::: src/nautilus-rename-file-popover-controller.c > @@ +139,3 @@ > + > + g_return_val_if_fail (NAUTILUS_IS_RENAME_FILE_POPOVER_CONTROLLER > (user_data), > + NautilusRenameFilePopoverController *self; > > this is fine, but we (as in gtk+, glib etc.) don't usually make this checks > for signals from the same class, because the type is expected to be right. > You can leave it like this, just pointing out. Not sure why I added that. This isn’t public API, no real need to do that. I sometimes get overly defensive in my code. :) > @@ +158,3 @@ > + &start_pos, &end_pos); > + > + key_event = (GdkEventKey *)event; > > can you add a comment explaining what we are doing here? It looks pretty > cryptic otherwise "aaah so this whole function is just to toggle between > selecting just the name or the name with extension!"
Created attachment 346956 [details] [review] rename-file-popover-controller: make F2 toggle between selection modes Would have been nice to actually commit the changes. :D
Attachment 346916 [details] pushed as 9becdca - rename-file-popover-controller: set entry width for all files Attachment 346956 [details] pushed as b24def9 - rename-file-popover-controller: make F2 toggle between selection modes