0

Every second the content of the table in the gtk is updated,But after a while table content remains unchanged until the mouse moves on the table. The amount that changes in table is buf variable, which is of the type of time.

    store = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview_circuit));

    gtk_tree_model_foreach(GTK_TREE_MODEL(store),
                           (GtkTreeModelForeachFunc) foreach_func,
                           &rr_list);
    if (rr_list != NULL)
    {
        GtkTreePath *path;

        path = gtk_tree_row_reference_get_path((GtkTreeRowReference*) rr_list->data);

        if (path)
        {
            GtkTreeIter iter;

            if (gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path))
            {
                char buf[10];
                format_sec_time(buf, ci->circuit_age);
                gtk_list_store_set(GTK_LIST_STORE(store), &iter,
                                   COL_ID, ci->circ_id,
                                   COL_PURPOSE, purpose[ci->purpose],
                                   COL_STATE, states[ci->state],
                                   COL_CREATION_TIME, ci->creation_time,
                                   COL_TIMER, buf,
                                   -1);
            }
        }
    }
    else
    {
        AddTreeViewCircuit(ci);
    }

    g_list_foreach(rr_list, (GFunc) gtk_tree_row_reference_free, NULL);
    g_list_free(rr_list);
}

1 Answers1

0

It should update, more code is needed to check the claim. As a workaround, you can force the treeview to redraw after the update(s).

Add:

gtk_widget_queue_draw(GTK_WIDGET(treeview_circuit));

after gtk_list_store_set.

José Fonte
  • 4,016
  • 2
  • 16
  • 28