From: Paolo Bonzini <bonzini@gnu.org>
Subject: [PATCH] Let Ctrl+W close the window if there are no tabs

gedit is one of very few apps 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.

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.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index 85e5063..f4057d0 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -1886,10 +1886,7 @@ _gedit_cmd_file_close (GSimpleAction *action,
 
 	if (active_tab == NULL)
 	{
-#ifdef OS_OSX
-		/* Close the window on OS X */
 		gtk_widget_destroy (GTK_WIDGET (window));
-#endif
 		return;
 	}
 
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index d8de113..85c90a7 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -633,7 +633,6 @@ update_actions_sensitivity (GeditWindow *window)
 	g_simple_action_set_enabled (G_SIMPLE_ACTION (action), TRUE);
 #else
 	g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
-	                             (tab != NULL) &&
 	                             (state != GEDIT_TAB_STATE_CLOSING) &&
 	                             (state != GEDIT_TAB_STATE_SAVING) &&
 	                             (state != GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW) &&
