signal `clicked' is invalid for instance `0x8c2230'



foundations of gtk+ development   Listing 3-8


#include <gtk/gtk.h>

static void switch_page(GtkButton*,GtkNotebook*);

int main(int argc,char *argv[])
{
GtkWidget *window,*notebook;
GtkWidget *label1,*label2,*child1,*child2;

gtk_init(&argc,&argv);

window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window),"notebook");
gtk_container_set_border_width(GTK_CONTAINER(window),10);
gtk_widget_set_size_request(window,250,100);

notebook=gtk_notebook_new();
label1=gtk_label_new("page one");
label2=gtk_label_new("page two");
child1=gtk_label_new("go to page 2 to find the answer");
child2=gtk_label_new("go to page 1 to find the answer");


g_signal_connect(G_OBJECT(child1),"clicked",G_CALLBACK(switch_page),(gpointer)
notebook);
g_signal_connect(G_OBJECT(child2),"clicked",G_CALLBACK(switch_page),(gpointer)
notebook);


gtk_notebook_append_page(GTK_NOTEBOOK(notebook),child1,label1);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook),child2,label2);

gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook),GTK_POS_BOTTOM);

gtk_container_add(GTK_CONTAINER(window),notebook);
gtk_widget_show_all(window);

gtk_main();
return 0;
}


static void switch_page(GtkButton *button,GtkNotebook *notebook)
{
gint  page=gtk_notebook_get_current_page(notebook);

if(page == 0)
{
gtk_notebook_set_current_page(notebook,1);
}
else
{
gtk_notebook_set_current_page(notebook,0);
}
}


(notebooks:2971): GLib-GObject-WARNING **: gsignal.c:2295: signal `clicked'
is invalid for instance `0x8c2230'

(notebooks:2971): GLib-GObject-WARNING **: gsignal.c:2295: signal `clicked'
is invalid for instance `0x8c2340'



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