[Glade-users] (no subject)



On Wed, 2003-11-19 at 18:40, Simon Charles wrote:

Any idea why this doesn't work (the lookup_widget lines give a warning
' assignment from incompatible pointer type' when it is compiled using
-Wall -ansi.  I thought a pointer to ANY object in a window could be
passed to lookup_widget()?

void
on_button4_s4a_prev_clicked            (GtkButton       *button,
                                        gpointer         user_data)
{
#ifdef DEBUG_GUI_EVENTS
        fprintf(stdout,"GUI button event \"button4_s4a_prev_clicked \"
received. %s %d\n", __FILE__, __LINE__);
#endif

        GtkNotebook *notebook;
        notebook=lookup_widget(GTK_WIDGET(main_window), "notebook");
        gtk_notebook_set_current_page(notebook, 4);

lookup_widget() returns a GtkWidget* and you're assigning it to a
GtkNotebook*, a pointer to a different type, which is why the compiler
may complain.

You can do:

  notebook=GTK_NOTEBOOK (lookup_widget(GTK_WIDGET(main_window),
"notebook"));

or simply:

  notebook= (GtkNotebook*)(lookup_widget(GTK_WIDGET(main_window),
"notebook"));

I think that will fix it.

Damon






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