gtk_list_store_reorder problem



Hello everyone.  I am currently having a bit of a problem with the
gtk_list_store_reorder function.  After calling this function I am
trying to highlight the new first line in my GtkTreeView.  The following
code seems to work just fine before the reorder call, but produces
unpredictable results afterwards.  The cursor appears at the top of the
list, but a random row seems to be highlighted.  I can't move the
highlighted row using the up and down arrows, just the cursor.  I would
appreciate any insight that anyone might have as to what is going on.
Thanks.

 

void
HighlightFirstRow(GtkWidget *widget) {
 
GtkWidget *treeview;
GtkListStore *list_store;
GtkTreePath *path;
GtkTreeModel *treemodel;
GtkTreeIter iter;
GtkTreeSelection *treeviewselection;
gchar *val;
gboolean bResult;
 
 
        treeview = lookup_widget(widget, "tvView");
 
        treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
        if (treemodel == NULL) {
               return;
        }
 
 
        bResult = gtk_tree_model_get_iter_first(treemodel, &iter);
        if (!bResult) {
               printf("No iter, exiting highlightfirstrow\n");
               return;
        }
 
        path = gtk_tree_model_get_path(treemodel, &iter);
 
        treeviewselection =
gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
        gtk_tree_selection_select_path(treeviewselection, path);
        gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(treeview), path,
NULL, TRUE, 0.0, 0.0);
        gtk_tree_view_set_cursor(GTK_TREE_VIEW(treeview), path, NULL,
TRUE);
 
        gtk_tree_path_free(path);
}

 

 

Alex Levin

CAC Media

Vice President of Technology:

Consumer Electronics Division

alex cacmedia tv

 

 




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