No doubt I'm missing something stunningly obvious - but...
I have a textview. I need to do some heavy processing on the text which takes several seconds (or a couple of minutes), so I'd like a progress bar.
Every reference I can find suggests I need to make it:
Code:
pbar = gtk_progress_bar_new ();
//gtk_progress_bar_set_text ((GtkProgressBar *) pbar, "Spell-checking entire text");
gtk_widget_show (pbar);
while (g_main_context_iteration(NULL, FALSE));
and then I need to update it in a loop. I have one conveniently which changes on a percentage basis...
Code:
if (((100*gtk_text_iter_get_line(&start))/lines_in_buffer) > last_percent)
{
last_percent = (100*gtk_text_iter_get_line(&start))/lines_in_buffer;
gtk_progress_bar_set_fraction ((GtkProgressBar *) pbar, (double)last_percent/100);
while (g_main_context_iteration(NULL, FALSE));
printf("%c%c%c%c%d%% ", 0x08, 0x08, 0x08, 0x08, last_percent);
fflush(stdout);
{
This last part is working; the percentage increases on the console and the screen updates through the process - but the progress box never appears.
What am I doing stupid? I see that most of the examples use either threads or a progress box which is part of the main window, but in my innocence I had foolishly assumed that a progress box is such a useful thing that it would be a self-contained window in and of itself - do I have to get all complicated?
Thanks,
Neil