Hello there!

I'm writing a GTK+ application in C. In my application I'm running two
commands that take a bit of time; in order to not make it appear that the
program has just frozen, I am wanting to do the following:

1) run the dialog, which has a spinner widget
2) add to the dialog area a message that says what the first command does
3) run the first command
4) add a message saying that the second command is running
5) run the second command
6) add a done message
7) allow the user to click "Ok" to close (or maybe delay for a second and
close)

Additionally, I am creating this dialog within a callback (as it is
supposed to appear when the user clicks the "Next" button in the main
application).

However, my problem is that the dialog only appears after everything has
been executed and the callback finishes execution. Here's what I'm running:

{
...
    diag = create_progress_spinner_dialog(window, &box);
    /*gtk_widget_set_can_focus(diag, TRUE);*/
    /*gtk_window_set_modal(GTK_WINDOW(diag), TRUE);*/
    /*gtk_window_set_transient_for(GTK_WINDOW(diag), GTK_WINDOW(window));*/
    /*gtk_widget_show_all(diag);*/

    gtk_box_pack_start(GTK_BOX(box), gtk_label_new("Formatting..."), TRUE,
TRUE, 10);
    gtk_widget_show_all(diag);
    format_target_device(info->target_device, fs_choice);

    gtk_box_pack_start(GTK_BOX(box), gtk_label_new("Mounting..."), TRUE,
TRUE, 10);
    gtk_widget_show_all(diag);
    mount_target_device(info->target_device);

    gtk_box_pack_start(GTK_BOX(box), gtk_label_new("Done!"), TRUE, TRUE,
20);
    gtk_widget_show_all(diag);

    gtk_notebook_next_page(GTK_NOTEBOOK(globals->notebook));

    push_stack(globals->pages, 1);
    set_next_hb_title(globals);
}

As you can see by the comments, I tried quite a few things with no success.
However, if I put the gtk_dialog_run in there and it will appear but it
obviously blocks execution which isn't helpful to me. I'm really not sure
where to go from here; any help would be greatly appreciated.

Thanks!
-- 
Jim

---------------------------------------------------
James Heald
Computer Science Undergraduate
California Polytechnic State University
james.r.he...@calpoly.edu
(510) 303-1458
_______________________________________________
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to