26 #include <glib/gi18n.h>
29 #include "gnc-splash.h"
30 #include "core-utils/gnc-version.h"
33 #define MARKUP_STRING "<span size='small'>%s</span>"
34 #define GNC_PREF_SHOW_SPLASH "show-splash-screen"
36 static GtkWidget * splash = NULL;
37 static GtkWidget * progress = NULL;
38 static GtkWidget * progress_bar = NULL;
41 splash_destroy_cb (GtkObject *
object, gpointer user_data)
47 button_press_cb(GtkWidget *widget, GdkEventButton *event, gpointer unused)
49 gnc_destroy_splash_screen();
54 gnc_show_splash_screen (
void)
62 gchar *ver_string, *markup;
67 splash = gtk_window_new (GTK_WINDOW_TOPLEVEL);
68 gtk_window_set_decorated(GTK_WINDOW (splash), FALSE);
69 gtk_window_set_skip_taskbar_hint (GTK_WINDOW (splash), TRUE);
71 g_signal_connect (splash,
"destroy",
72 G_CALLBACK (splash_destroy_cb), NULL);
74 gtk_window_set_title (GTK_WINDOW (splash),
"GnuCash");
75 gtk_window_set_position (GTK_WINDOW (splash), GTK_WIN_POS_CENTER);
81 g_warning (
"can't find splash pixmap");
82 gtk_widget_destroy (splash);
86 frame = gtk_frame_new (NULL);
87 vbox = gtk_vbox_new (FALSE, 3);
88 hbox = gtk_hbox_new (FALSE, 3);
95 ver_string = g_strdup_printf(_(
"Version: GnuCash-%s %s (rev %s built %s)"),
96 VERSION, GNUCASH_SCM, GNUCASH_SCM_REV,
103 ver_string = g_strdup_printf(_(
"Version: GnuCash-%s (rev %s built %s)"),
104 VERSION, GNUCASH_SCM_REV, GNUCASH_BUILD_DATE);
107 version = gtk_label_new(NULL);
108 markup = g_markup_printf_escaped(MARKUP_STRING, ver_string);
109 gtk_label_set_markup(GTK_LABEL(version), markup);
112 separator = gtk_hseparator_new();
114 progress = gtk_label_new(NULL);
119 gtk_label_set_max_width_chars(GTK_LABEL(progress), 34);
120 markup = g_markup_printf_escaped(MARKUP_STRING, _(
"Loading..."));
121 gtk_label_set_markup(GTK_LABEL(progress), markup);
124 progress_bar = gtk_progress_bar_new ();
126 gtk_container_add (GTK_CONTAINER (frame), pixmap);
127 gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
128 gtk_box_pack_start (GTK_BOX (vbox), version, FALSE, FALSE, 0);
129 gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
130 gtk_box_pack_start (GTK_BOX (hbox), progress, TRUE, TRUE, 0);
131 gtk_box_pack_start (GTK_BOX (hbox), progress_bar, FALSE, FALSE, 0);
132 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
133 gtk_container_add (GTK_CONTAINER (splash), vbox);
135 gtk_widget_add_events(splash, GDK_BUTTON_PRESS_MASK);
136 g_signal_connect(splash,
"button_press_event",
137 G_CALLBACK(button_press_cb), NULL);
139 gtk_window_set_auto_startup_notification (FALSE);
140 gtk_widget_show_all (splash);
141 gtk_window_set_auto_startup_notification (TRUE);
144 while (gtk_events_pending ())
145 gtk_main_iteration ();
149 gnc_destroy_splash_screen (
void)
153 gtk_widget_destroy (splash);
161 gnc_update_splash_screen (
const gchar *
string,
double percentage)
167 if (
string && strcmp(
string,
""))
169 markup = g_markup_printf_escaped(MARKUP_STRING,
string);
170 gtk_label_set_markup (GTK_LABEL(progress), markup);
174 while (gtk_events_pending ())
175 gtk_main_iteration ();
183 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar), 0.0);
187 if (percentage <= 100)
189 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar),
194 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress_bar));
199 while (gtk_events_pending ())
200 gtk_main_iteration ();
GtkWidget * gnc_gnome_get_pixmap(const char *name)
Gnome specific utility functions.
Generic api to store and retrieve preferences.
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)