main window not redrawing after dialog closes



In my main window I open a filechooser dialog then close it, set the mouse cursor to Gdk::WATCH, call a function, then change back the cursor. The problem is after the dialog closes the main window does not immediately redraw and the cursor does not immediately change. It's not until my function is nearly finished that these things happen. What could be my problem here? Maybe I'm not understanding the way X events fit in with non-X operations.

my code:

void MainWindow::menu_open()
{
    Gtk::FileChooserDialog dialog(*this, "Open File",
        Gtk::FILE_CHOOSER_ACTION_OPEN);
    dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
    int response = dialog.run();
    dialog.hide();

    if (response == Gtk::RESPONSE_OK)
    {
        // change cursor while working
        get_window()->set_cursor(Gdk::Cursor(Gdk::WATCH));
        _filename = Glib::filename_to_utf8(dialog.get_filename());
        _member_widget->read_from_xml(_filename);
        // enable menu items
        _save->set_sensitive();
        _save_as->set_sensitive();
        _close->set_sensitive();
        _export_to_html->set_sensitive();
        get_window()->set_cursor();
    }
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]