mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Prevent "quit without saving" dialog at shutdown when there's no session.
Don't create a session if there isn't one.
This commit is contained in:
parent
a9f0fe2f93
commit
d906ac4136
@ -1615,6 +1615,8 @@ gnc_file_quit (void)
|
||||
{
|
||||
QofSession *session;
|
||||
|
||||
if (!gnc_current_session_exist ())
|
||||
return;
|
||||
gnc_set_busy_cursor (NULL, TRUE);
|
||||
session = gnc_get_current_session ();
|
||||
|
||||
@ -1640,6 +1642,10 @@ gnc_file_set_shutdown_callback (GNCShutdownCB cb)
|
||||
gboolean
|
||||
gnc_file_save_in_progress (void)
|
||||
{
|
||||
QofSession *session = gnc_get_current_session();
|
||||
return (qof_session_save_in_progress(session) || save_in_progress > 0);
|
||||
if (gnc_current_session_exist())
|
||||
{
|
||||
QofSession *session = gnc_get_current_session();
|
||||
return (qof_session_save_in_progress(session) || save_in_progress > 0);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1232,7 +1232,8 @@ gnc_main_window_prompt_for_save (GtkWidget *window)
|
||||
_("If you don't save, changes from the past %d days and %d hours will be discarded.");
|
||||
time64 oldest_change;
|
||||
gint minutes, hours, days;
|
||||
|
||||
if (!gnc_current_session_exist())
|
||||
return FALSE;
|
||||
session = gnc_get_current_session();
|
||||
book = qof_session_get_book(session);
|
||||
filename = qof_session_get_url(session);
|
||||
@ -1363,14 +1364,17 @@ static gboolean
|
||||
gnc_main_window_quit(GncMainWindow *window)
|
||||
{
|
||||
QofSession *session;
|
||||
gboolean needs_save, do_shutdown;
|
||||
|
||||
session = gnc_get_current_session();
|
||||
needs_save = qof_book_session_not_saved(qof_session_get_book(session)) &&
|
||||
!gnc_file_save_in_progress();
|
||||
do_shutdown = !needs_save ||
|
||||
(needs_save && !gnc_main_window_prompt_for_save(GTK_WIDGET(window)));
|
||||
|
||||
gboolean needs_save, do_shutdown = TRUE;
|
||||
if (gnc_current_session_exist())
|
||||
{
|
||||
session = gnc_get_current_session();
|
||||
needs_save =
|
||||
qof_book_session_not_saved(qof_session_get_book(session)) &&
|
||||
!gnc_file_save_in_progress();
|
||||
do_shutdown = !needs_save ||
|
||||
(needs_save &&
|
||||
!gnc_main_window_prompt_for_save(GTK_WIDGET(window)));
|
||||
}
|
||||
if (do_shutdown)
|
||||
{
|
||||
g_timeout_add(250, gnc_main_window_timed_quit, NULL);
|
||||
@ -3758,10 +3762,12 @@ gnc_quartz_should_quit (GtkosxApplication *theApp, GncMainWindow *window)
|
||||
QofSession *session;
|
||||
gboolean needs_save;
|
||||
|
||||
if (!gnc_main_window_all_finish_pending() ||
|
||||
gnc_file_save_in_progress())
|
||||
if (!gnc_current_session_exist() ||
|
||||
!gnc_main_window_all_finish_pending() ||
|
||||
gnc_file_save_in_progress())
|
||||
|
||||
{
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
session = gnc_get_current_session();
|
||||
needs_save = qof_book_session_not_saved(qof_session_get_book(session)) &&
|
||||
|
Loading…
Reference in New Issue
Block a user