Closing windows in GTK

Hi everybody,

        I am developing a GUI and don't know which is the correct way to close windows
through callbacks. My application looks like this:



typedef struct _menuRadio{

        GtkWidget *entry;
        GtkWidget *entry2;
} menuRadio;


//*******Here come callbacks

void action1(GtkWidget *boton, menuRadio *info){

//Here I:
// 1) catch the text from the widgets within info structure
// 2) call an external function
// 3) should close the window that generated the callback --> this is my question


void action2( [...]){



//Now GUI components

GtkWidget * menu_1(){
        static menuRadio data;  //Here I store the info generated by the user
        GtkWidget *window, *textEntry1, ... ;


        textEntry1 = gtk_entry_new();
        data.entry1 = textEntry1;


        //Here the button that will generate the callback

        button = gtk_button_new_with_label("Aceptar");   
        g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(crearTbf), (gpointer) &data);                


int main(int argc, char **argv)
        GtkWidget *window;

        gtk_init(&argc, &argv);

        //Creamos el menu principal
        window = main_menu();



//**************END OF CODE*****************************************

I suppose that the way to do this is passing to the callback the window as a parameter, and inside the 
callback use
gtk_window_hide() or similar. But as I am sending to the callback the structure I have named "data" in my 
code: how can
I send the current window as a parameter too? First of all, is this the correct way to do this?

When GTK shows windows, is assigned any kind of id to them? I mean, that way I could obtain a reference 
instead of passing
them as parameters to the callbacks...

Thank you very much,


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