mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Handle the splash/lock file warning more the gtk way
If the splash screen is still availabe when the dialog should be displayed, make the splash' window the transient parent for this dialog. In the other case we try to use the front-most main window. While this works well when calling file->open from the menu, there may not be a visible main window yet during startup. Since the user can close the splash before the dialog is due, we may end up with no usable candidate as parent window. In that case the dialog will emit a missing transient parent message on stdout. There's no easy fix for this as users don't want to see an incomplete main window (see old bug 350993).
This commit is contained in:
parent
66817bb997
commit
47d622de61
@ -775,17 +775,16 @@ RESTART:
|
||||
);
|
||||
int rc;
|
||||
|
||||
GtkWindow *parent = gnc_get_splash_screen();
|
||||
if (!parent)
|
||||
parent = GTK_WINDOW(gnc_ui_get_toplevel());
|
||||
|
||||
if (! gnc_uri_is_file_uri (newfile)) /* Hide the db password in error messages */
|
||||
displayname = gnc_uri_normalize_uri ( newfile, FALSE);
|
||||
else
|
||||
displayname = g_strdup (newfile);
|
||||
|
||||
// Bug#467521: on Mac (and maybe Win?), the dialog will appear below the
|
||||
// splash, but is modal, so we can't get rid of the splash... So, get
|
||||
// rid of it now.
|
||||
gnc_destroy_splash_screen();
|
||||
|
||||
dialog = gtk_message_dialog_new(NULL,
|
||||
dialog = gtk_message_dialog_new(parent,
|
||||
0,
|
||||
GTK_MESSAGE_WARNING,
|
||||
GTK_BUTTONS_NONE,
|
||||
@ -820,16 +819,10 @@ RESTART:
|
||||
break;
|
||||
case RESPONSE_READONLY:
|
||||
is_readonly = TRUE;
|
||||
// re-enable the splash screen, file loading and display of
|
||||
// reports may take some time
|
||||
gnc_show_splash_screen();
|
||||
/* user told us to open readonly. We do ignore locks (just as before), but now also force the opening. */
|
||||
qof_session_begin (new_session, newfile, is_readonly, FALSE, TRUE);
|
||||
break;
|
||||
case RESPONSE_OPEN:
|
||||
// re-enable the splash screen, file loading and display of
|
||||
// reports may take some time
|
||||
gnc_show_splash_screen();
|
||||
/* user told us to ignore locks. So ignore them. */
|
||||
qof_session_begin (new_session, newfile, TRUE, FALSE, FALSE);
|
||||
break;
|
||||
|
@ -206,3 +206,8 @@ gnc_update_splash_screen (const gchar *string, double percentage)
|
||||
gtk_main_iteration ();
|
||||
}
|
||||
}
|
||||
|
||||
GtkWindow *gnc_get_splash_screen (void)
|
||||
{
|
||||
return GTK_WINDOW(splash);
|
||||
}
|
||||
|
@ -22,10 +22,12 @@
|
||||
|
||||
#ifndef GNC_SPLASH_H
|
||||
#define GNC_SPLASH_H
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void gnc_show_splash_screen (void);
|
||||
void gnc_destroy_splash_screen (void);
|
||||
void gnc_update_splash_screen (const gchar *string, double percentage);
|
||||
GtkWindow *gnc_get_splash_screen (void);
|
||||
|
||||
#define GNC_SPLASH_PERCENTAGE_UNKNOWN 101
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user