Re: GtkTreeStore and row deletion

On Wed, Sep 2, 2009 at 2:26 PM, <pwieser trychlos org> wrote:
As I considered this rather as a waste of efforts, I am currently
trying to suppress this GSList as the GtkTreeModel is actually all
I need to manage all edition operations. But in this mode, the object
reference has to be owned by the row.

My problem is when the row is deleted. The only option I have found is :
1/ first retrieve the object attached to the row, and g_object_unref() it,
2/ only after that, ask the tree model to delete the row

This is not very elegant, especially in a event-oriented environment.
E.g., when emptying the view, I have first to walk through all the tree,
g_object_unref-ing all objects, before being able to call gtk_tree_store_clear().

I don't fully get the problem you are describing.  If I understand it
correctly, you have a tree model where each node points to a GObject.
Isn't it the case that when a row is destroyed that contains a
G_TYPE_OBJECT column, this will unref the value in that column?

PS: if there is no other solution, don't you think that adding a gtk_tree_model_row_about_to_delete() 
before each g_node_destroy()
could do the trick in a future version ?

That said, yes the current row-deleted signal has its issues and in a
future version we will certainly be adding a "pre-row-deleted" signal
of some sort.



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