33 #include "gnc-splash.h" 35 static QofLogModule log_module = GNC_MOD_GUI;
37 G_DEFINE_INTERFACE (GncWindow, gnc_window, G_TYPE_OBJECT)
40 gnc_window_default_init (GncWindowInterface *klass)
49 gnc_window_get_gtk_window (GncWindow *window)
51 g_return_val_if_fail(GNC_WINDOW (window), NULL);
54 g_return_val_if_fail(GNC_WINDOW_GET_IFACE (window)->get_gtk_window, NULL);
56 return GNC_WINDOW_GET_IFACE (window)->get_gtk_window (window);
60 gnc_window_get_statusbar (GncWindow *window)
62 g_return_val_if_fail(GNC_WINDOW (window), NULL);
65 g_return_val_if_fail(GNC_WINDOW_GET_IFACE (window)->get_statusbar, NULL);
67 return GNC_WINDOW_GET_IFACE (window)->get_statusbar (window);
71 gnc_window_get_progressbar (GncWindow *window)
73 g_return_val_if_fail(GNC_WINDOW (window), NULL);
76 if (GNC_WINDOW_GET_IFACE (window)->get_progressbar == NULL)
79 return GNC_WINDOW_GET_IFACE (window)->get_progressbar (window);
83 gnc_window_get_menubar (GncWindow *window)
85 g_return_val_if_fail (GNC_WINDOW(window), NULL);
88 if (GNC_WINDOW_GET_IFACE(window)->get_menubar == NULL)
91 return GNC_WINDOW_GET_IFACE(window)->get_menubar (window);
95 gnc_window_get_toolbar (GncWindow *window)
97 g_return_val_if_fail (GNC_WINDOW(window), NULL);
100 if (GNC_WINDOW_GET_IFACE(window)->get_toolbar == NULL)
103 return GNC_WINDOW_GET_IFACE(window)->get_toolbar (window);
107 gnc_window_get_menubar_model (GncWindow *window)
109 g_return_val_if_fail (GNC_WINDOW(window), NULL);
112 if (GNC_WINDOW_GET_IFACE(window)->get_menubar_model == NULL)
115 return GNC_WINDOW_GET_IFACE(window)->get_menubar_model (window);
119 gnc_window_get_accel_group (GncWindow *window)
121 g_return_val_if_fail (GNC_WINDOW(window), NULL);
124 if (GNC_WINDOW_GET_IFACE(window)->get_accel_group == NULL)
127 return GNC_WINDOW_GET_IFACE(window)->get_accel_group (window);
134 gnc_window_update_status (GncWindow *window,
GncPluginPage *page)
136 GtkWidget *statusbar;
137 const gchar *message;
139 g_return_if_fail(GNC_WINDOW (window));
141 statusbar = gnc_window_get_statusbar (window);
143 gtk_statusbar_pop(GTK_STATUSBAR(statusbar), 0);
144 gtk_statusbar_push(GTK_STATUSBAR(statusbar), 0, message ? message :
" ");
148 gnc_window_set_status (GncWindow *window,
GncPluginPage *page,
149 const gchar *message)
151 g_return_if_fail(GNC_WINDOW (window));
152 g_return_if_fail(GNC_PLUGIN_PAGE (page));
155 gnc_window_update_status (window, page);
167 static GncWindow *progress_bar_hack_window = NULL;
173 gnc_window_set_progressbar_window (GncWindow *window)
177 g_return_if_fail(GNC_WINDOW (window));
180 progress_bar_hack_window = window;
185 gnc_window_get_progressbar_window (
void)
187 return progress_bar_hack_window;
192 gnc_window_show_progress (
const char *message,
double percentage)
195 GtkWidget *progressbar;
196 double curr_fraction;
198 window = progress_bar_hack_window;
202 progressbar = gnc_window_get_progressbar (window);
203 if (progressbar == NULL)
205 DEBUG(
"no progressbar in hack-window" );
210 round(gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(progressbar)) * 100.0);
212 if (percentage >= 0 && percentage <= 100 &&
213 round(percentage) == curr_fraction)
216 gnc_update_splash_screen(message, percentage);
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);
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)
234 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar),
239 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progressbar));
244 while (gtk_events_pending ())
245 gtk_main_iteration ();
The instance data structure for a content plugin.
void gnc_plugin_page_set_statusbar_text(GncPluginPage *page, const char *name)
Set the statusbar text associated with this page.
#define DEBUG(format, args...)
Print a debugging message.
Functions that are supported by all types of windows.
Functions for adding plugins to a GnuCash window.
const gchar * gnc_plugin_page_get_statusbar_text(GncPluginPage *page)
Retrieve the statusbar text associated with this page.
All type declarations for the whole Gnucash engine.