getting wrong iters when using a TreeModelFilter



hi hi,

this drives me mad. I use a TreModelFilter to hide rows (to show only every,
every 2nd, every 4th,...). When the user presses a key I'd like to change the
content of the model (the real one). I use the code below. The problem is that
when I hide nothing it works, but when e.g. hing every second row and entering
something in the shown 2nd row (which is really the 4th row), the change ends up
in the sencond row too.

Is that a bug or am I missing something. It happens on gtk 2.4.9 and 2.6.1.

full code is available at
http://cvs.sourceforge.net/viewcvs.py/buzztard/buzztard/src/ui/edit/main-page-sequence.c?view=markup

here is the snipped

GtkTreeModelFilter *filtered_store;
GtkTreeModel *store;
GtkTreePath *path;
GtkTreeViewColumn *column;
GtkTreeIter iter;

if((filtered_store=GTK_TREE_MODEL_FILTER(gtk_tree_view_get_model(self->priv->sequence_table)))
&& (store=gtk_tree_model_filter_get_model(filtered_store))
) {
  gtk_tree_view_get_cursor(self->priv->sequence_table,&path,&column);
  if(path && column && gtk_tree_model_get_iter(store,&iter,path)) {
    GList *columns=gtk_tree_view_get_columns(self->priv->sequence_table);
    glong row,track=g_list_index(columns,(gpointer)column)-2;
                                
    g_list_free(columns);
    gtk_tree_model_get(store,&iter,SEQUENCE_TABLE_POS,&row,-1);
    // cursor is at track,row
    gtk_list_store_set(GTK_LIST_STORE(store),&iter,
      SEQUENCE_TABLE_PRE_CT+track,str,-1);
  }
}
-- 
      \|/            Stefan Kost
     <@ @>           private            business
+-oOO-(_)-OOo------------------------------------------------------ - - -  -   -
|       __  Address  Simildenstr. 5     HTWK Leipzig, Fb IMN, Postfach 301166
|      ///           04277 Leipzig      04251 Leipzig
| __  ///            Germany            Germany
| \\\///    Phone    +49341 2253538     +49341 30766101
|  \__/     EMail    st_kost_at_gmx.net kost_at_imn.htwk-leipzig.de
|           WWW      www.sonicpulse.de  www.imn.htwk-leipzig.de/~kost/about.html
===-=-=--=---=---------------------------------- - - -  -    -


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