[nautilus] application: don't let the 'Quit' menu action also close desktops



commit a270a6a214f582b7da9ab524653b93846d3d7d38
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Apr 25 12:52:26 2012 -0400

    application: don't let the 'Quit' menu action also close desktops
    
    We don't want the quit item on the app menu to close the desktop, if we
    have that preference enabled in GSettings.

 src/nautilus-application.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 9bd4a73..7795024 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -835,17 +835,31 @@ action_help (GSimpleAction *action,
 }
 
 static void
-action_quit (GSimpleAction *action,
+action_kill (GSimpleAction *action,
 	     GVariant *parameter,
 	     gpointer user_data)
 {
 	GtkApplication *application = user_data;
 	GList *windows;
 
+	/* this will also destroy the desktop windows */
 	windows = gtk_application_get_windows (application);
 	g_list_foreach (windows, (GFunc) gtk_widget_destroy, NULL);
 }
 
+static void
+action_quit (GSimpleAction *action,
+	     GVariant *parameter,
+	     gpointer user_data)
+{
+	GtkApplication *application = user_data;
+	GList *windows;
+
+	/* nautilus_window_close() doesn't do anything for desktop windows */
+	windows = gtk_application_get_windows (application);
+	g_list_foreach (windows, (GFunc) nautilus_window_close, NULL);
+}
+
 static GActionEntry app_entries[] = {
 	{ "new-window", action_new_window, NULL, NULL, NULL },
 	{ "connect-to-server", action_connect_to_server, NULL, NULL, NULL },
@@ -853,6 +867,7 @@ static GActionEntry app_entries[] = {
 	{ "about", action_about, NULL, NULL, NULL },
 	{ "help", action_help, NULL, NULL, NULL },
 	{ "quit", action_quit, NULL, NULL, NULL },
+	{ "kill", action_kill, NULL, NULL, NULL },
 };
 
 static void
@@ -1048,7 +1063,7 @@ nautilus_application_local_command_line (GApplication *application,
 	if (kill_shell) {
 		DEBUG ("Killing application, as requested");
 		g_action_group_activate_action (G_ACTION_GROUP (application),
-						"quit", NULL);
+						"kill", NULL);
 		goto out;
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]