child windows creation control



Hi,

I have some buttons connected with the "clicked" signal to a different
callback for each button.
Each callback creates a different window. Since now, I've used this
approximation to control that the child widgets are created only once,
and not as many times as the button is clicked:


/* Declaring local variables */
static GtkWidget *window = NULL;
...

/* Return if window already exists */
if ( window )
{
        gdk_window_raise(GTK_WIDGET(window)->window);
        return;
}

/* Creating window */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
...

[Note: i've set window == NULL in the destroy callbacks]

The problem is I don't like this approximation, because it forces me to
have a 9 "static Gtkwidgets*" declared. (I have 9 buttons with 9
different callbacks).

Is there any other way to control this problem?

Thanks in advance,
	Ignacio



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