193{
194 GncWindow *window;
195 GtkWidget *progressbar;
196 double curr_fraction;
197
198 window = progress_bar_hack_window;
199 if (window == NULL)
200 return;
201
202 progressbar = gnc_window_get_progressbar (window);
203 if (progressbar == NULL)
204 {
205 DEBUG(
"no progressbar in hack-window" );
206 return;
207 }
208
209 curr_fraction =
210 round(gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(progressbar)) * 100.0);
211
212 if (percentage >= 0 && percentage <= 100 &&
213 round(percentage) == curr_fraction)
214 return;
215
216 gnc_update_splash_screen(message, percentage);
217
218 if (percentage < 0)
219 {
220 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbar), " ");
221 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar), 0.0);
222 if (GNC_WINDOW_GET_IFACE(window)->ui_set_sensitive != NULL)
223 GNC_WINDOW_GET_IFACE(window)->ui_set_sensitive(window, TRUE);
224 }
225 else
226 {
227 if (message && *message)
228 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbar), message);
229 if ((percentage == 0.0) &&
230 (GNC_WINDOW_GET_IFACE(window)->ui_set_sensitive != NULL))
231 GNC_WINDOW_GET_IFACE(window)->ui_set_sensitive(window, FALSE);
232 if (percentage <= 100.0)
233 {
234 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar),
235 percentage / 100.0);
236 }
237 else
238 {
239 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progressbar));
240 }
241 }
242
243
244 while (gtk_events_pending ())
245 gtk_main_iteration ();
246}
#define DEBUG(format, args...)
Print a debugging message.