Duplication in treeview/liststore?



Hi,
I am quite new to gtk+ & certainly gtk+ 2.0, so this is quite likely caused
by an oversight.
I created a liststore, a treeview, set the treeview reorderable then added
some data in the list. That greeted me with a segfault when dragging in
(debian woodies) 2.0.2, so i got the sid packages (gtk2.0 2.0.5-1; glib2.0
2.0.4-2; atk1.0 1.0.2-1; pango1.0 1.0.3-2). Now im joyfully dragging away
like a big baby (yes, i do utter the word 'wee' when doing so), but once
every few drags all characters in the view go fruitcake for a sec and then a
new instance of the row i was dragging around appears at the top of the list.

Here are the relevant portions of code:

enum
{
  NUMBER_COLUMN,
  WORD_COLUMN,
  TYPE_COLUMN,
  LINK_COLUMN,
  EXPL_COLUMN,
  N_COLUMNS
};

void
create_function (...)
{
  ...
  gui->wordliststore = gtk_list_store_new (N_COLUMNS, G_TYPE_UINT,
G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING);
  ...
  gui->wordlistview = gtk_tree_view_new_with_model (GTK_TREE_MODEL
(gui->wordliststore));
  gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW
(gui->wordlistview)), GTK_SELECTION_MULTIPLE);
  gtk_object_set (GTK_OBJECT (gui->wordlistview), "reorderable", TRUE, NULL);
  ...
  <columns are added here>
  ...
}

void
add_function (...number;word;type;link;explanation...)
{
  GtkTreeIter iter;
  gtk_list_store_append (gui->wordliststore, &iter);
  gtk_list_store_set (gui->wordliststore, &iter,
                      NUMBER_COLUMN, number,
                      WORD_COLUMN, word,
                      TYPE_COLUMN, type,
                      LINK_COLUMN, link,
                      EXPL_COLUMN, explanation,
                      -1);
}


What am i missing?

             Yours,
                   Luc Verhaegen.





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