Re: Is this OK?



On Thursday 01 August 2002 01:08, vladimir wrote:

void kstudentnew_quit_cb (GtkWidget *widget, gpointer callback_data)
{
    gtk_widget_destroy ((GtkWidget *)callback_data);/* destroy main
    window */
}

Can I cast callback_data like this? Main window is not main for app, but
for entry dialog for some data. When user cancel this window it calls
this callback. Is there cleaner way, or can go with this one?

You can do it like this, although it would probably be better to use the 
predefined macros, which also have the advantage that they check whether the 
pointer cast really points to a structure of the appropriate type (which is 
invaluable when you try to find a bug where the pointer contains bogus data).

=> GTK_WIDGET(callback_data)

Cheers
-Tim





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