gtk_table and undefined behaviour?



Hello,

I try to create a dynamic table and attach labels and entry-boxes to it.
But if try, there are strange things happening, either new buttons are appearing 
 in the dialog-box, wherein I try to do that, or there is just the following message:

(lingoteach:6221): Gtk-CRITICAL **: file gtktable.c: line 579 (gtk_table_attach): 
assertion `child->parent == NULL' failed

I do not know, what is wrong, so it would be nice, If someone of you 
can help.

Here is the code:
---
translation_question = gtk_dialog_new_with_buttons("Foo", NULL,
                                                                                GTK_DIALOG_MODAL,
                                                                                GTK_STOCK_OK,
                                                                                NULL);
head_label = gtk_label_new("Please fill in the translation languages.");
/* let's get the languages */
for(language_node = language_file->parent->children;
       language_node != NULL; language_node = language_node->next){
    if(language_node->name ||
       g_strcasecmp(language_node->name, "language") == 0){
      _no += 1;
      label_text = xmlGetProp(language_node, "id");
      printf(" %s\n", label_text); /* debug stuff */
      trans_label[_no] = gtk_label_new(label_text); 
    }
}
table = gtk_table_new(_no, 2, TRUE);  
/* now we place all in the table */
gtk_table_attach_defaults(GTK_TABLE(table), head_label,
                                                    0, 2, 0, 1);

for(counter = 1; counter <= _no; counter++){
  gtk_table_attach_defaults(GTK_TABLE(table), trans_label[counter],
                                                       0, 1, counter, (counter+1));
  gtk_table_attach_defaults(GTK_TABLE(table), trans_entry[counter],
                                                        1, 2, counter, (counter+1));
}
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(translation_question)->vbox),
                                    table);
gtk_widget_show_all(translation_question);

----

Thanks for help

Attachment: pgpmPCQCDzDEE.pgp
Description: PGP signature



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