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

blocking operation



hi,

In any callback where I want to open a file selection window
which should return a pointer to the file name I want to use
a unique function. Therefore, once the File_Selection Widget 
is shown, the function should block until it is released by
an event like in the following code:

char * dialog_file_name;

void dialog_file_ok_button_clicked( void )
    {
    dialog_file_name = gtk_file_selection_get_filename 
        ( GTK_FILE_SELECTION( Dialog_File_Window ) );
    
    gtk_widget_hide( Dialog_File_Window );

    /* unblock here */
    }

void dialog_file_cancel_button_clicked( void )
    {
    gtk_widget_hide( Dialog_File_Window );
    dialog_file_name = NULL;
    
    /* unblock here */
    }

char * dialog_file_window( void ) 
    {
    if ( Dialog_File_Window == NULL )
        dialog_file_create();    

    if ( dialog_file_lock < 0 )
        {
        dialog_error_window( "FILE_WINDOW_OCCUPIED" );
        return NULL;
        }
    else
        {
        dialog_file_lock = -1;
        gtk_widget_show_all( Dialog_File_Window );
        }
   
    /* block here on something */

    dialog_file_lock = 0;
    return dialog_file_name;
    }

The solution is probably not the best, but I wanted to share
only one object within the application and this is what I found.
I know some blocking things should exist in gtk, but I don't
know what I should look for.

Any hints are very much appreciated,
peterw
-- 
Dr. Peter Wurmsdobler

      CTM - Centre de Transfert des Microtechniques
39, av. de l'Observatoire, BP-1445, 25007 Besancon CEDEX 3
TELEPHONE: +33 3 81 47 70 20  TELECOPIE: +33 3 81 47 70 21
                E-mail: peterw@cetehor.com

                  Ceterum censeo MIRCOSOFTem esse delendam.



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