Gtk-CRITICAL **: IA__gtk_notebook_remove_page: assertion 'GTK_IS_NOTEBOOK (notebook)' failed
#include
2 #include
3 GtkWidget*entry;
4 void notebook_remove(GtkWidget*button,gpointer notebook)
5 {
6 gint page;
7 gchar buffer[20];
8 page=gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
9 snprintf(buffer,20,"It is the %dth page",page);
10 gtk_entry_set_text(GTK_ENTRY(entry),buffer);
11 gtk_notebook_remove_page(GTK_NOTEBOOK(notebook),page);
12 }
13 int main(int argc,char**argv)
14 {
15 GtkWidget*window;
16 GtkWidget*tabel;
17 GtkWidget*notebook;
18 GtkWidget*button;
19 GtkWidget*label;
20 gchar bufferl[40];
21 gint i;
22 gtk_init(&argc,&argv);
23 window=gtk_dialog_new();
24 gtk_window_set_default_size(GTK_WINDOW(window),600,200);
25 notebook=gtk_notebook_new();
26 for(i=0;ivbox),notebook,FALSE,FALSE,0);
33 entry=gtk_entry_new();
34 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),entry,FALSE,FALSE,0);
35 gtk_entry_set_text(GTK_ENTRY(entry),"Nothing happens");
36 button=gtk_button_new_with_mnemonic("remove");
37 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->action_area),button,FALSE,FALSE,0);
38 g_signal_connect_swapped(GTK_OBJECT(button),"clicked",G_CALLBACK(notebook_remove),notebook);
39 button=gtk_button_new_with_label("close app");
40 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->action_area),button,FALSE,FALSE,0);
41 g_signal_connect(GTK_OBJECT(button),"clicked",G_CALLBACK(gtk_main_quit),NULL);
42 gtk_widget_show_all(window);
43 gtk_main();
44 return 0;
45 }
46