Re: [anjuta-devel] New project interface and introspection



Hi Abderrahim,

Le 23/09/2010 18:56, Abderrahim Kitouni a écrit :
Sorry for not answering your previous mail, I was too busy.

No problem, I have continue and tried to find a solution.

I see that you're calling
g_object_force_floating which is dangerous (and potentially wrong).
I feel that it should be a unref there (not sure though).

Yes, g_object_force_floating is the "uncommon" function. Why is it wrong ?

When I remove the object from the project tree, the project tree doesn't own it anymore so it cannot keeps a ref on it. On the other hand, I don't want to destroy the node immediately because it can be put in another project tree. If, I don't do it, to move a node I need to do the following.

g_object_ref (node);
anjuta_project_node_remove (node);
anjuta_project_node_insert (parent, node);
g_object_unref (node).

It's possible but more clumsy to write in C.

Anyway, it's working with g_object_force_floating but I'm really not sure it will work in Python. So, I have imagined that I could have to change the C code for this.


That's right, but who would want to keep a reference anyway?

In the IAnjutaProjectManager interface, it could be nice to have a reference on a AnjutaProjectNode, so you can directly access to all node properties.

The second point is that if keeping additional reference is not needed, having a reference count is useless.

I think
it's not a problem, but if we find a use to keeping node references
around, we can add a new signal so anyone having a reference can use the
reference to the proxy or drop the reference altogether.

Sure, but the point of using GObject is to avoid anjuta_node_free in python. If it's replaced by managing one signal, I'm afraid the gain is negative.

Anyway, I think the previous method had some disavantage, so I think the best solution is to keep using GFile in the project manager and use a hash table to link it with the corresponding node. So, when you replace a node with a proxy, you have to change the hash table but the outside doesn't see the difference.

Regards,

Sébastien



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