You need to get a GtkTreeIter
to the proper row, then use the appropriate (model-specific) setter to change the data.
For instance gtk_list_store_set()
for the GtkListStore model.
There is no need to clear the entire model if you just want to change some of the data, that is very wasteful and slow.
If you really need to change all the data, then sure, clear it.
You don't have to worry about getting the display to refresh; the view listens to events from the model, and automatically knows to refresh when the model changes.
UPDATE:
When changing the data (as described in commment), you don't need to "flush" the old data. The model owns the data, and knows how to keep track of the memory used. You just use the above-mentioned gtk_list_store_set()
call as necessary to put the new desired data in the model. You can do this as often as necessary, and an update frequency of once every few seconds should be no problem at all.
Of course, in such a case, to keep your application (which I assume is single-threaded, for simplicity) responsive, you must have a way to asynchronously trigger an update, perhaps using a timer. Have a look at glib's g_timeout_add()
function to learn how to add a simple global timer.