GNOME Bugzilla – Bug 615593
Control-W should close extra pane
Last modified: 2010-04-16 21:26:08 UTC
Control-W currently closes the active slot. When the active pane doesn't have any more slots, the window is closed, even if there is another pane with one or even more slots. Control-W should close the active slot, until there is no slot remaining in the pane. Then it should close the active pane in dual-pane mode, and switch to the other pane. More presses to Control-W close the slots on that pane, until none is left and the window is closed.
Created attachment 158645 [details] [review] proposed patch
Created attachment 158839 [details] [review] second version of the patch Don't switch to next pane on closing of the active pane - this is unnecessary on window close. Instead, the caller of _pane_close() must make sure that he sets a new pane after destroying the currently active pane if he wants to keep the window. Also, changed g_list_length(list) == 0 to list == NULL as the micro-optimization of the day.
Review of attachment 158839 [details] [review]: ::: src/nautilus-window-pane.c @@ +152,3 @@ + if (window->details->active_pane->slots == NULL) { + /* ... close pane if multiple panes are open, or close the window otherwise. */ + if (window->details->panes && window->details->panes->next) { Its a bit weird that you check this here, its done in nautilus_window_get_next_pane too. @@ +156,3 @@ + next_pane = nautilus_window_get_next_pane (NAUTILUS_WINDOW (window)); + nautilus_window_close_pane (pane); + if (next_pane) { With the above check this should always be true, and if it isn't for some reason then we'll get in a weird state, with no next pane but not closing the window. Basically, we should just always call get_next_pane, and if it fails, close the window instead of doing the checks above ourselves.
With that, suitably tested you can commit this.
Pushed to master. Thanks for reviewing.