GNOME Bugzilla – Bug 735514
Ctrl+W should close the window if there are no tabs
Last modified: 2014-08-28 21:04:00 UTC
gedit is the only app i use where ctrl+w, ctrl+q and alt+f4 are all necessary to use the app. In particular, alt+f4 is the only way to get rid of a window if i press ctrl+n instead of ctrl+t. An extra Ctrl+W press could close the window after closing the last tab. It is easy for the user to understand what happened, and once you know it you don't have to learn another shortcut.
Created attachment 284667 [details] [review] patch to implement the feature It turns out that this feature was actually already supported, but only on OS X. In _gedit_cmd_file_close the #ifdef is useless, since it will never be reached when tab != NULL disables the action. The patch then only has to remove that condition from update_actions_sensitivity.
Review of attachment 284667 [details] [review]: Patch looks good.
Review of attachment 284667 [details] [review]: In gedit-window.c, I think it's better to just remove the whole ifdef, and never make the close action insensitive.
Created attachment 284671 [details] [review] same patch, now with a commit message
jessevdk, I thought about it but in the end did not do it because: - for closing/saving/print-previewing, I'm not really sure how to test it and it should be rare. Perhaps for saving it should set a flag close-after-save, but this would be a separate and larger patch - for print preview, it is confusing that you close the entire document instead of just the print preview window - for saving error, I think it's better to get the user's attention.
I see. Then I think the OS X special ifdef is wrong, and should be removed instead, so that it's properly insensitive for those states on OSX as well.
Created attachment 284675 [details] [review] patch after jessevdk's review
Review of attachment 284675 [details] [review]: This looks good to me. Jesse can you confirm this is correct on osx too? If yes, please push
Review of attachment 284675 [details] [review]: Yep, looks good to me
Thanks for the patch! I love patches with just "-" signs :-)