GNOME Bugzilla – Bug 772856
Ctrl+N forgets current directory
Last modified: 2016-11-26 15:53:33 UTC
Once upon a time, Ctrl+N would open a new window in the same directory, similar to how Ctrl+T works. (Also Ctrl+N on Windows Explorer.) However, that broke around v3.20 – now all windows opened with Ctrl+N start at $HOME instead. nautilus 3.22.x
Created attachment 337595 [details] [review] application: Launch new window in the current directory When pressing Control+N, Nautilus should open the new window in the same location as the current open one and fallback to the home directory otherwise.
(In reply to Mantas Mikulėnas from comment #0) > However, that broke around v3.20 – now all windows opened with Ctrl+N start > at $HOME instead. Are you sure? I have tried 3.14.1 in Jessie and it behaves the same way. The code also suggests that it has been that way since at least 2012.
(In reply to Ernestas Kulik from comment #2) > (In reply to Mantas Mikulėnas from comment #0) > > However, that broke around v3.20 – now all windows opened with Ctrl+N start > > at $HOME instead. > > Are you sure? I have tried 3.14.1 in Jessie and it behaves the same way. > The code also suggests that it has been that way since at least 2012. I can reproduce the bug in 3.20 and master.
(In reply to Felipe Borges from comment #3) > (In reply to Ernestas Kulik from comment #2) > > (In reply to Mantas Mikulėnas from comment #0) > > > However, that broke around v3.20 – now all windows opened with Ctrl+N start > > > at $HOME instead. > > > > Are you sure? I have tried 3.14.1 in Jessie and it behaves the same way. > > The code also suggests that it has been that way since at least 2012. > > I can reproduce the bug in 3.20 and master. Yes, but that is not what I am asking.
Review of attachment 337595 [details] [review]: Sure. As discussed over IRC, the action should be split for use from the shell and the application itself (so that the home dir is always opened when opening a new window from the shell). ::: src/nautilus-application.c @@ +707,2 @@ GtkApplication *application = user_data; + GFile *current_location; g_autoptr is preferred.
Created attachment 337755 [details] [review] application: Launch new window in the current directory When pressing Control+N, Nautilus should open the new window in the same location as the current open one and fallback to the home directory otherwise.
Review of attachment 337755 [details] [review]: Oops, sorry, missed one thing. ::: src/nautilus-application.c @@ +708,3 @@ + g_autoptr (GFile) current_location; + + slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (gtk_application_get_active_window (application))); This crashes Nautilus when the action is invoked with no active window.
Created attachment 337756 [details] [review] application: use default screen with no active window Opening a new window emits critical warnings if no active window is present in real_open_location_full(). A default screen should be used in that case instead of trying to get it from the window unconditionally.
Comment on attachment 337756 [details] [review] application: use default screen with no active window Attachment 337756 [details] pushed as 301e427 - application: use default screen with no active window
(In reply to Ernestas Kulik from comment #7) > This crashes Nautilus when the action is invoked with no active window. It still does. My patch above fixes a warning in a different place.
Created attachment 337785 [details] [review] application: Launch new window in the current directory When pressing Control+N, Nautilus should open the new window in the same location as the current open one and fallback to the home directory otherwise.
Review of attachment 337785 [details] [review]: LGTM
Comment on attachment 337785 [details] [review] application: Launch new window in the current directory Attachment 337785 [details] pushed as 43bd93e - application: Launch new window in the current directory
Created attachment 337793 [details] [review] application: add “clone-window” action Opening a new window from the shell should open the home directory, as the intent of the user is not clear and it is thus the safest assumption (it preserves the old behavior). This requires splitting the “new-window” action in half: “new-window” for use from the shell and “clone-window” for use from the application.
Review of attachment 337793 [details] [review]: Ok, thanks! ::: src/nautilus-application.c @@ +734,3 @@ + current_view = nautilus_window_slot_get_current_view (active_slot); + + if (nautilus_view_is_searching (current_view)) split this change in a different patch and explain the reasoning of why you think we should not open another search but rather the home directory. In overall I agree with it, so just commit it after splitting it and explaining it.
Also I believe you are preparing a new patch for changing the ctrl+N behaviour to clone, right?
(In reply to Carlos Soriano from comment #16) > Also I believe you are preparing a new patch for changing the ctrl+N > behaviour to clone, right? Well, I stuffed it all in a single patch, but I will split this off now as well.
(In reply to Ernestas Kulik from comment #17) > (In reply to Carlos Soriano from comment #16) > > Also I believe you are preparing a new patch for changing the ctrl+N > > behaviour to clone, right? > > Well, I stuffed it all in a single patch, but I will split this off now as > well. I cannot see it, where in the patch it changed the ctrln shortcut to thr clone window action?
ctrln + clone action is fine as a single patch, but the non-searching thing is a different change on behaviour, not related to opening a window with the current location. (btw bugzilla is the worst on phone :/)
Review of attachment 337793 [details] [review]: ::: src/resources/gtk/menus.ui @@ +3,3 @@ <section> <item> + <attribute name="action">app.clone-window</attribute> I change the accelerator here. Well, rather, the action associated with it.
Created attachment 337852 [details] [review] application: add “clone-window” action Opening a new window from the shell should open the home directory, as the intent of the user is not clear and it is thus the safest assumption (it preserves the old behavior). This requires splitting the “new-window” action in half: “new-window” for use from the shell and “clone-window” for use from the application.
(In reply to Carlos Soriano from comment #15) > split this change in a different patch and explain the reasoning of why you > think we should not open another search but rather the home directory. The thing is that it crashes, because there is no view to go back to. This is sort of a workaround, but a real fix would be rigging up some sort of deep window copying (in the spirit of a true clone).
(In reply to Ernestas Kulik from comment #20) > Review of attachment 337793 [details] [review] [review]: > > ::: src/resources/gtk/menus.ui > @@ +3,3 @@ > <section> > <item> > + <attribute name="action">app.clone-window</attribute> > > I change the accelerator here. Well, rather, the action associated with it. oh sorry... just saw it, lacked some context (which I couldn't check on phone), damm bugzilla splinter...
(In reply to Ernestas Kulik from comment #22) > (In reply to Carlos Soriano from comment #15) > > split this change in a different patch and explain the reasoning of why you > > think we should not open another search but rather the home directory. > > The thing is that it crashes, because there is no view to go back to. This > is sort of a workaround, but a real fix would be rigging up some sort of > deep window copying (in the spirit of a true clone). oh of course...stupid me. This should be fixed also, making the file name having the original file. But that's a different issue.
Review of attachment 337852 [details] [review]: LGTM thanks!
Created attachment 338422 [details] [review] application: open home directory on new window if searching Opening a new window in the search view results in a crash, because the new window does not have a view for the initial location. That can be worked around by pointing the new window to the home directory.
Created attachment 338725 [details] [review] application: open home directory on new window if searching Opening a new window in the search view results in a crash, because the new window does not have a view for the initial location. That can be worked around by pointing the new window to the home directory.
Review of attachment 338725 [details] [review]: ::: src/nautilus-application.c @@ +730,3 @@ active_window = NAUTILUS_WINDOW (gtk_application_get_active_window (application)); active_slot = nautilus_window_get_active_slot (active_window); + current_view = nautilus_window_slot_get_current_view (active_slot); What if the view is NULL?
Created attachment 339016 [details] [review] application: open home directory on new window if searching Opening a new window in the search view results in a crash, because the new window does not have a view for the initial location. That can be worked around by pointing the new window to the home directory.
Review of attachment 339016 [details] [review]: Feel free to commit with that changed if that's the case of your intentions. Thanks! ::: src/nautilus-application.c @@ +734,1 @@ + if (current_view != NULL && you mean current_view == NULL right?
(In reply to Carlos Soriano from comment #30) > you mean current_view == NULL right? Oh my god, yes.
(In reply to Ernestas Kulik from comment #31) > (In reply to Carlos Soriano from comment #30) > > you mean current_view == NULL right? > > Oh my god, yes. Wait, no, I do not. We want the view to not be null if we are checking if it is in search.
Review of attachment 339016 [details] [review]: ay :D :D :D
I didn't failed, I did it on purpose to test your skills
Attachment 337852 [details] pushed as 37d6da0 - application: add “clone-window” action Attachment 339016 [details] pushed as 9106fab - application: open home directory on new window if searching
*** Bug 343672 has been marked as a duplicate of this bug. ***