mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add confirmation of Main Window close when more than one
If you have more than one Gnucash window open is is very easy to close the wrong window with the 'x' and in doing so change your saved pages. The way to save the configuration of all windows and pages is to use 'File->Quit'.
This commit is contained in:
@@ -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. */
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
<summary>Print checks from multiple accounts</summary>
|
||||
<description>This dialog is presented if you try to print checks from multiple accounts at the same time.</description>
|
||||
</key>
|
||||
<key name="closing-window-question" type="i">
|
||||
<default>0</default>
|
||||
<summary>Confirm Window Close</summary>
|
||||
<description>This dialog is presented when there is more than one window.</description>
|
||||
</key>
|
||||
<key name="inv-entry-mod" type="i">
|
||||
<default>0</default>
|
||||
<summary>Commit changes to a invoice entry</summary>
|
||||
@@ -107,6 +112,11 @@
|
||||
<summary>Print checks from multiple accounts</summary>
|
||||
<description>This dialog is presented if you try to print checks from multiple accounts at the same time.</description>
|
||||
</key>
|
||||
<key name="closing-window-question" type="i">
|
||||
<default>0</default>
|
||||
<summary>Confirm Window Close</summary>
|
||||
<description>This dialog is presented when there is more than one window.</description>
|
||||
</key>
|
||||
<key name="inv-entry-mod" type="i">
|
||||
<default>0</default>
|
||||
<summary>Commit changes to a invoice entry</summary>
|
||||
|
||||
Reference in New Issue
Block a user