AUDIT: r16779 - gnucash/trunk/src - Bug#506714: Add progress bar to splash; patch from Herbert Thoma <herbie hthoma de>.
Josh Sled
jsled at cvs.gnucash.org
Tue Jan 1 15:07:22 EST 2008
Author: jsled
Date: 2008-01-01 15:07:22 -0500 (Tue, 01 Jan 2008)
New Revision: 16779
Trac: http://svn.gnucash.org/trac/changeset/16779
Modified:
gnucash/trunk/src/bin/gnucash-bin.c
gnucash/trunk/src/gnome-utils/gnc-splash.c
gnucash/trunk/src/gnome-utils/gnc-splash.h
gnucash/trunk/src/gnome-utils/gnc-window.c
Log:
Bug#506714: Add progress bar to splash; patch from Herbert Thoma <herbie hthoma de>.
BP
Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c 2008-01-01 18:56:13 UTC (rev 16778)
+++ gnucash/trunk/src/bin/gnucash-bin.c 2008-01-01 20:07:22 UTC (rev 16779)
@@ -140,7 +140,7 @@
static void
update_message(const gchar *msg)
{
- gnc_update_splash_screen(msg);
+ gnc_update_splash_screen(msg, GNC_SPLASH_PERCENTAGE_UNKNOWN);
g_message(msg);
}
@@ -353,7 +353,7 @@
/* module initializations go here */
len = sizeof(modules) / sizeof(*modules);
for (i = 0; i < len; i++) {
- gnc_update_splash_screen(modules[i].name);
+ gnc_update_splash_screen(modules[i].name, GNC_SPLASH_PERCENTAGE_UNKNOWN);
if (modules[i].optional)
gnc_module_load_optional(modules[i].name, modules[i].version);
else
@@ -464,14 +464,14 @@
scm_c_eval_string("(gnc:main)");
/* Install Price Quote Sources */
- gnc_update_splash_screen(_("Checking Finance::Quote..."));
+ gnc_update_splash_screen(_("Checking Finance::Quote..."), GNC_SPLASH_PERCENTAGE_UNKNOWN);
scm_c_use_module("gnucash price-quotes");
scm_c_eval_string("(gnc:price-quotes-install-sources)");
gnc_hook_run(HOOK_STARTUP, NULL);
if (!nofile && (fn = get_file_to_load())) {
- gnc_update_splash_screen(_("Loading data..."));
+ gnc_update_splash_screen(_("Loading data..."), GNC_SPLASH_PERCENTAGE_UNKNOWN);
gnc_file_open_file(fn);
g_free(fn);
}
Modified: gnucash/trunk/src/gnome-utils/gnc-splash.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-splash.c 2008-01-01 18:56:13 UTC (rev 16778)
+++ gnucash/trunk/src/gnome-utils/gnc-splash.c 2008-01-01 20:07:22 UTC (rev 16779)
@@ -33,6 +33,7 @@
static GtkWidget * splash = NULL;
static GtkWidget * progress = NULL;
+static GtkWidget * progress_bar = NULL;
static int splash_is_initialized = FALSE;
static void
@@ -63,6 +64,7 @@
GtkWidget *pixmap;
GtkWidget *frame;
GtkWidget *vbox;
+ GtkWidget *hbox;
GtkWidget *version;
GtkWidget *separator;
gchar *ver_string, *markup;
@@ -90,6 +92,7 @@
frame = gtk_frame_new (NULL);
vbox = gtk_vbox_new (FALSE, 3);
+ hbox = gtk_hbox_new (FALSE, 3);
#ifdef GNUCASH_SVN
/* Development version */
ver_string = g_strdup_printf(_("Version: GnuCash-%s svn (r%s built %s)"),
@@ -112,16 +115,20 @@
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);
+ gtk_label_set_max_width_chars(GTK_LABEL(progress), 34);
markup = g_markup_printf_escaped(MARKUP_STRING, _("Loading..."));
gtk_label_set_markup(GTK_LABEL(progress), markup);
g_free(markup);
+ progress_bar = gtk_progress_bar_new ();
+
gtk_container_add (GTK_CONTAINER (frame), pixmap);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), version, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), progress, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), progress, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), progress_bar, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (splash), vbox);
gtk_widget_add_events(splash, GDK_BUTTON_PRESS_MASK);
@@ -144,12 +151,13 @@
{
gtk_widget_destroy (splash);
progress = NULL;
+ progress_bar = NULL;
splash = NULL;
}
}
void
-gnc_update_splash_screen (const gchar *string)
+gnc_update_splash_screen (const gchar *string, double percentage)
{
gchar *markup;
@@ -163,7 +171,31 @@
/* make sure new text is up */
while (gtk_events_pending ())
- gtk_main_iteration ();
+ gtk_main_iteration ();
}
}
+
+ if (progress_bar)
+ {
+ if (percentage < 0)
+ {
+ gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar), 0.0);
+ }
+ else
+ {
+ if (percentage <= 100)
+ {
+ gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar),
+ percentage/100);
+ }
+ else
+ {
+ gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress_bar));
+ }
+ }
+
+ /* make sure new status bar is up */
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+ }
}
Modified: gnucash/trunk/src/gnome-utils/gnc-splash.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-splash.h 2008-01-01 18:56:13 UTC (rev 16778)
+++ gnucash/trunk/src/gnome-utils/gnc-splash.h 2008-01-01 20:07:22 UTC (rev 16779)
@@ -25,7 +25,9 @@
void gnc_show_splash_screen (void);
void gnc_destroy_splash_screen (void);
-void gnc_update_splash_screen (const gchar *string);
+void gnc_update_splash_screen (const gchar *string, double percentage);
void gnc_gui_init_splash (void);
+#define GNC_SPLASH_PERCENTAGE_UNKNOWN 101
+
#endif
Modified: gnucash/trunk/src/gnome-utils/gnc-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-window.c 2008-01-01 18:56:13 UTC (rev 16778)
+++ gnucash/trunk/src/gnome-utils/gnc-window.c 2008-01-01 20:07:22 UTC (rev 16779)
@@ -175,7 +175,7 @@
return;
}
- gnc_update_splash_screen(message);
+ gnc_update_splash_screen(message, percentage);
if (percentage < 0) {
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbar), " ");
More information about the gnucash-changes
mailing list