diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index 354ce3c80c..d416a3e362 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -67,6 +67,7 @@
#include "gnc-ui-util.h"
#include "gnc-uri-utils.h"
#include "gnc-version.h"
+#include "gnc-warnings.h"
#include "gnc-window.h"
#include "gnc-prefs.h"
#include "option-util.h"
@@ -1423,6 +1424,32 @@ gnc_main_window_delete_event (GtkWidget *window,
if (already_dead)
return TRUE;
+ if (g_list_length (active_windows) > 1)
+ {
+ gint response;
+ GtkWidget *dialog;
+ gchar *message = _("This window is closing and will not be restored.");
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_NONE,
+ "%s", _("Close Window?"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog),
+ "%s", message);
+
+ gtk_dialog_add_buttons (GTK_DIALOG(dialog),
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_OK"), GTK_RESPONSE_YES,
+ (gchar *)NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_YES);
+ response = gnc_dialog_run (GTK_DIALOG(dialog), GNC_PREF_WARN_CLOSING_WINDOW_QUESTION);
+ gtk_widget_destroy (dialog);
+
+ if (response == GTK_RESPONSE_CANCEL)
+ return TRUE;
+ }
+
if (!gnc_main_window_finish_pending(GNC_MAIN_WINDOW(window)))
{
/* Don't close the window. */
diff --git a/gnucash/gschemas/org.gnucash.warnings.gschema.xml.in b/gnucash/gschemas/org.gnucash.warnings.gschema.xml.in
index fd404c18f3..cc85417a40 100644
--- a/gnucash/gschemas/org.gnucash.warnings.gschema.xml.in
+++ b/gnucash/gschemas/org.gnucash.warnings.gschema.xml.in
@@ -9,6 +9,11 @@
Print checks from multiple accounts
This dialog is presented if you try to print checks from multiple accounts at the same time.
+
+ 0
+ Confirm Window Close
+ This dialog is presented when there is more than one window.
+
0
Commit changes to a invoice entry
@@ -107,6 +112,11 @@
Print checks from multiple accounts
This dialog is presented if you try to print checks from multiple accounts at the same time.
+
+ 0
+ Confirm Window Close
+ This dialog is presented when there is more than one window.
+
0
Commit changes to a invoice entry