After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 735514 - Ctrl+W should close the window if there are no tabs
Ctrl+W should close the window if there are no tabs
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
3.13.x
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2014-08-27 12:59 UTC by Paolo Bonzini
Modified: 2014-08-28 21:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to implement the feature (995 bytes, patch)
2014-08-28 09:46 UTC, Paolo Bonzini
accepted-commit_now Details | Review
same patch, now with a commit message (1.78 KB, patch)
2014-08-28 10:24 UTC, Paolo Bonzini
none Details | Review
patch after jessevdk's review (3.10 KB, patch)
2014-08-28 10:42 UTC, Paolo Bonzini
committed Details | Review

Description Paolo Bonzini 2014-08-27 12:59:10 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.
Comment 1 Paolo Bonzini 2014-08-28 09:46:56 UTC
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.
Comment 2 Ignacio Casal Quinteiro (nacho) 2014-08-28 09:48:04 UTC
Review of attachment 284667 [details] [review]:

Patch looks good.
Comment 3 jessevdk@gmail.com 2014-08-28 09:50:33 UTC
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.
Comment 4 Paolo Bonzini 2014-08-28 10:24:13 UTC
Created attachment 284671 [details] [review]
same patch, now with a commit message
Comment 5 Paolo Bonzini 2014-08-28 10:26:33 UTC
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.
Comment 6 jessevdk@gmail.com 2014-08-28 10:29:22 UTC
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.
Comment 7 Paolo Bonzini 2014-08-28 10:42:12 UTC
Created attachment 284675 [details] [review]
patch after jessevdk's review
Comment 8 Paolo Borelli 2014-08-28 18:32:31 UTC
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
Comment 9 jessevdk@gmail.com 2014-08-28 18:36:05 UTC
Review of attachment 284675 [details] [review]:

Yep, looks good to me
Comment 10 Paolo Borelli 2014-08-28 21:03:45 UTC
Thanks for the patch! I love patches with just "-" signs :-)