[nautilus/gtk3-breakage: 19/19] application: respect the 'exit-with-last-window' setting.



commit 7edc6646da9a503b42fddcc395f409fe27b67575
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Oct 27 16:33:07 2010 +0200

    application: respect the 'exit-with-last-window' setting.
    
    If it's set, we quit immediately.

 src/nautilus-application.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 4f931f1..c1eae73 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -741,10 +741,15 @@ nautilus_application_create_desktop_windows (NautilusApplication *application)
 	NautilusDesktopWindow *window;
 	GtkWidget *selection_widget;
 	int screens, i;
+	gboolean exit_with_last_window;
 
 	display = gdk_display_get_default ();
 	screens = gdk_display_get_n_screens (display);
 
+	exit_with_last_window =
+		g_settings_get_boolean (nautilus_preferences,
+					NAUTILUS_PREFERENCES_EXIT_WITH_LAST_WINDOW);
+
 	for (i = 0; i < screens; i++) {
 		selection_widget = get_desktop_manager_selection (display, i);
 		if (selection_widget != NULL) {
@@ -766,8 +771,13 @@ nautilus_application_create_desktop_windows (NautilusApplication *application)
 			nautilus_application_desktop_windows =
 				g_list_prepend (nautilus_application_desktop_windows, window);
 
-			gtk_application_add_window (GTK_APPLICATION (application),
-						    GTK_WINDOW (window));
+			/* don't add the desktop windows to the GtkApplication hold toplevels
+			 * if we should exit when the last window is closed.
+			 */
+			if (!exit_with_last_window) {
+				gtk_application_add_window (GTK_APPLICATION (application),
+							    GTK_WINDOW (window));
+			}
 		}
 	}
 }



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