ComboBox and TreeView issues



Hi everybody.
I obtain the following errors when launching my application that contains a
notebook, and in one of its page there are three combobox with the associated
treeviews:

(when opening the tab)
barcode_buttons[2561]: GLIB CRITICAL ** Gtk - gtk_tree_store_get_path: assertion
`iter->user_data != NULL' failed
barcode_buttons[2561]: GLIB CRITICAL ** Gtk - gtk_tree_store_get_path: assertion
`iter->user_data != NULL' failed
barcode_buttons[2561]: GLIB CRITICAL ** Gtk - gtk_tree_store_get_path: assertion
`iter->user_data != NULL' failed

(when closing the tab)
barcode_buttons[2561]: GLIB CRITICAL ** GLib-GObject - g_object_unref: assertion
`G_IS_OBJECT (object)' failed
barcode_buttons[2561]: GLIB CRITICAL ** GLib-GObject - g_object_get_data:
assertion `G_IS_OBJECT (object)' failed
barcode_buttons[2561]: GLIB WARNING ** Gtk - gtktreemodel.c:1949: bad row
reference, proxy has no outstanding row references
barcode_buttons[2561]: GLIB CRITICAL ** GLib-GObject - g_object_get_data:
assertion `G_IS_OBJECT (object)' failed
barcode_buttons[2561]: GLIB WARNING ** Gtk - gtktreemodel.c:1949: bad row
reference, proxy has no outstanding row references

What they means?

I use the following code to create a model for the tree:

GtkTreeModel *
190    create_model ( void ) {
191
192    GtkTreeIter iter;
193    GtkTreeStore *store = NULL;
194    GtkTreeSelection *select = NULL;
195    GtkWidget *treeview = NULL;
196    ll *tmp = top->ref->first;
197
198    store = gtk_tree_store_new(NUM_COL, G_TYPE_STRING);
199
200    gtk_tree_store_append(store, &iter, NULL);
201    gtk_tree_store_set(store, &iter,
202          STRING_COL, "<Nothing>",
203          -1);
204
205    while (tmp != NULL) {
206       gtk_tree_store_append(store, &iter, NULL);
207       gtk_tree_store_set(store, &iter,
208             STRING_COL, tmp->contenuto,
209             -1);
210       tmp = tmp->next;
211       }
212
213    treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
214    select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
215    gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
216
217    return GTK_TREE_MODEL(store);
218 }

and this one to create a text renderer:

void add_renderer ( GtkComboBox *combo ) {
273
274    GtkCellRenderer *render = NULL;
275    GtkTreePath *path = NULL;
276    GtkTreeModel *mod = NULL;
277    GtkTreeIter iter;
278
279    render = gtk_cell_renderer_text_new();
280    gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), render, TRUE);
281    gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), render,
282          "text", STRING_COL,
283          NULL);
284
285    path = gtk_tree_path_new_from_indices(0, 1, -1);
286    mod = gtk_combo_box_get_model(combo);
287    gtk_tree_model_get_iter(mod, &iter, path);
288    gtk_tree_path_free(path);
289    gtk_combo_box_set_active_iter(combo, &iter);
290
291 }

then I use this code to get data from the combobox:

369    result = gtk_combo_box_get_active_iter(GTK_COMBO_BOX(c.dataCombo),
&iter);
370    model = gtk_combo_box_get_model(GTK_COMBO_BOX(c.dataCombo));
371    gtk_tree_model_get(model, &iter,
372          STRING_COL, &tf.data,
373          -1);
374    printf("Getted data: %s\n", tf.data);
375    g_object_unref(model);

Thanks in advance,

Omar

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



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