[Glade-users] Getting pointer to GtkWindow

Tristan Van Berkom tristan.van.berkom at gmail.com
Sun Jan 22 19:07:22 EST 2006


David Sveningsson wrote:

>
> Do I have to typecast it then? It give a warning: "assignment from 
> incompatible pointer type" when I assign the return value from 
> glade_xml_get_widget.

Typicly you will declare everything as `GtkWidget *' and then only
cast them when using their functions; like:

GtkWidget *window;

if ((window = glade_xml_get_widget (xml, "toplevel")) != NULL) {
    gtk_window_present (GTK_WINDOW (window));
}

Since so many functions take `GtkWidget *' as an argument, its
generally easier to just declare everything `GtkWidget *'
(less casting all in all then doing it backwards).

Cheers,
                                         -Tristan



More information about the Glade-users mailing list