From 5e7e7edf596533dd3bd519c9da2bceeecedab74c Mon Sep 17 00:00:00 2001 From: Joshua Sled Date: Thu, 2 Aug 2007 23:48:04 +0000 Subject: [PATCH] Bug#457944: Keep splash screen during file loading. - do not destroy the splash screen during file loading - display which reports are rendered in the progress field of the splash screen Patch from Herbert Thoma git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16378 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/bin/gnucash-bin.c | 1 - src/gnome-utils/gnc-file.c | 3 --- src/gnome-utils/gnc-splash.c | 20 ++++++++++++++------ src/gnome-utils/gnc-window.c | 3 +++ 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/bin/gnucash-bin.c b/src/bin/gnucash-bin.c index 2f6ece6fce..38bf7029e8 100644 --- a/src/bin/gnucash-bin.c +++ b/src/bin/gnucash-bin.c @@ -470,7 +470,6 @@ inner_main (void *closure, int argc, char **argv) if (!nofile && (fn = get_file_to_load())) { gnc_update_splash_screen(_("Loading data...")); - gnc_destroy_splash_screen(); gnc_file_open_file(fn); g_free(fn); } diff --git a/src/gnome-utils/gnc-file.c b/src/gnome-utils/gnc-file.c index 9dc3035a5b..9301812ad0 100644 --- a/src/gnome-utils/gnc-file.c +++ b/src/gnome-utils/gnc-file.c @@ -191,7 +191,6 @@ show_session_error (QofBackendError io_error, const char *fmt, *label; gint response; - gnc_destroy_splash_screen(); /* Just in case */ if (NULL == newfile) { newfile = _("(null)"); } switch (io_error) @@ -668,8 +667,6 @@ gnc_post_file_open (const char * filename) ); int rc; - gnc_destroy_splash_screen(); /* Just in case */ - dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_WARNING, diff --git a/src/gnome-utils/gnc-splash.c b/src/gnome-utils/gnc-splash.c index a3d438b395..2cadc5c415 100644 --- a/src/gnome-utils/gnc-splash.c +++ b/src/gnome-utils/gnc-splash.c @@ -108,6 +108,11 @@ gnc_show_splash_screen (void) separator = gtk_hseparator_new(); progress = gtk_label_new(NULL); + /* the set_max_width avoids "bumping" of the splash screen + if a long string is given in gnc_update_splash_screen(); + presumably it would be better to inhibit size change of the + top level container, but I don't know how to do this */ + gtk_label_set_max_width_chars(GTK_LABEL(progress), 50); markup = g_markup_printf_escaped(MARKUP_STRING, _("Loading...")); gtk_label_set_markup(GTK_LABEL(progress), markup); g_free(markup); @@ -150,12 +155,15 @@ gnc_update_splash_screen (const gchar *string) if (progress) { - markup = g_markup_printf_escaped(MARKUP_STRING, string); - gtk_label_set_markup (GTK_LABEL(progress), markup); - g_free (markup); + if(string && strcmp(string, "")) + { + markup = g_markup_printf_escaped(MARKUP_STRING, string); + gtk_label_set_markup (GTK_LABEL(progress), markup); + g_free (markup); - /* make sure new text is up */ - while (gtk_events_pending ()) - gtk_main_iteration (); + /* make sure new text is up */ + while (gtk_events_pending ()) + gtk_main_iteration (); + } } } diff --git a/src/gnome-utils/gnc-window.c b/src/gnome-utils/gnc-window.c index 6dda302233..fe46d9f3b5 100644 --- a/src/gnome-utils/gnc-window.c +++ b/src/gnome-utils/gnc-window.c @@ -29,6 +29,7 @@ #include "gnc-engine.h" #include "gnc-plugin-page.h" #include "gnc-window.h" +#include "gnc-splash.h" static QofLogModule log_module = GNC_MOD_GUI; @@ -174,6 +175,8 @@ gnc_window_show_progress (const char *message, double percentage) return; } + gnc_update_splash_screen(message); + if (percentage < 0) { gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbar), " "); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar), 0.0);