[Gnucash-changes] Don't let the window manager delete the last window.

David Hampton hampton at cvs.gnucash.org
Sat Oct 8 14:46:05 EDT 2005


Log Message:
-----------
Don't let the window manager delete the last window.  Instead queue a
shutdown call.

Tags:
----
gnucash-gnome2-dev

Modified Files:
--------------
    gnucash/src/gnome-utils:
        gnc-main-window.c

Revision Data
-------------
Index: gnc-main-window.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/Attic/gnc-main-window.c,v
retrieving revision 1.1.2.23
retrieving revision 1.1.2.24
diff -Lsrc/gnome-utils/gnc-main-window.c -Lsrc/gnome-utils/gnc-main-window.c -u -r1.1.2.23 -r1.1.2.24
--- src/gnome-utils/gnc-main-window.c
+++ src/gnome-utils/gnc-main-window.c
@@ -434,7 +434,12 @@
 
   session = qof_session_get_current_session();
   if (qof_book_not_saved(qof_session_get_book(session))) {
-    return gnc_main_window_prompt_for_save(GTK_WIDGET(window));
+    if (!gnc_main_window_prompt_for_save(GTK_WIDGET(window))) {
+      /* Tell gnucash to shutdown cleanly */
+      g_idle_add((GSourceFunc)gnc_shutdown, 0);
+    }
+    /* Cancel the window deletion. It'll happen on the just queued shutdown. */
+    return TRUE;
   }
 
   dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW(window),
@@ -455,7 +460,11 @@
   response = gtk_dialog_run (GTK_DIALOG (dialog));
   gtk_widget_destroy(dialog);
 
-  return (response != GTK_RESPONSE_OK);
+  if (response == GTK_RESPONSE_OK) {
+    /* Tell gnucash to shutdown cleanly */
+    g_idle_add((GSourceFunc)gnc_shutdown, 0);
+  }
+  return TRUE;
 }
 
 


More information about the gnucash-changes mailing list