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



Hello,
في ث، 12-10-2010 عند 20:49 +0200 ، كتب Sébastien Granjoux:
We can have a different GFile for each source (referring to the same 
file) and then compare only the address (without using g_file_equal) of 
the GFile object to find the node containing exactly the same GFile 
object. The comparison is much faster but I think cleaner solutions 
exist (but perhaps not better is there are other disavantages).
Ok, but that's not the main problem now, will look at it later.


I don't really know. There are only two functions giving problem 
anjuta_project_load_node and anjuta_project_save_node. I think all other 
functions can be implemented synchronously in the GUI thread, so they 
keep their return value.
I prefer it that way, I just wasn't sure it would work. 

In the worst case, if anjuta_project_add_node takes really too much 
time, this function can just create a temporary node so the GUI can have 
a node and play with it and only create the node in save function. It's 
more work for the backend but it's much better to use and I don't think 
it's really needed.
Yes, if it isn't needed for autotools, I doubt it'll be needed for
anything else. If someone needs this, it's their problem ;-p


I propose the following changes:

* void anjuta_project_save_node (IAnjutaProject *project, 
AnjutaProjectNode *node, IAnjutaProjectSaveCallback callback, gpointer 
user_data, GError **err);

with typedef void (*IAnjutaProjectSaveCallback) (AnjutaProjectNode 
*node, gpointer user_data, GError* err);
I'd like to swap the error and user_data parameters. I know it's done
like this in the debugger, but the convention is to have the user_data
last.

The GError** parameter of save_node is completely useless, but added 
automatically by the anjuta idl compiler.
There are too much of these, I'd like to remove them.


We could implement something more complex like in GIO, with GCancellable 
and _finish function. It allows to cancel an operation and the GError is 
not created if not needed, but as it needs to create a GAsyncResult, 
it's probably more work anyway. Moreover I think the GError is almost 
always useful in our case.
I don't think it is much work, GSimpleAsyncResult can do most repetitive
tasks.


* void anjuta_project_load_node (IAnjutaProject *project, 
AnjutaProjectNode *node, IAnjutaProjectLoadCallback callback, gpointer 
user_data, GError **err);

with typedef void (*IAnjutaProjectLoadCallback) (AnjutaProjectNode 
*node, gboolean complete, gpointer user_data, GError* err);

It is a callback, like anjuta_project_save_node, so same remarks apply.

The difference is that the callback can be called several time until 
complete is TRUE. The goal is to already send back data (call the 
callback) even if all nodes are not loaded. I hope it doesn't cause 
troubles for the python bindings.
Well, I'm afraid it does : G-I defines only three types of callbacks:
call: can be called (many times) until the function returns.
async: can be called only once.
notified: can be called (many times) until the corresponding
DestroyNotify is called.

So if we need to be able to call this from python, we need to add a
DestroyNotify. I think it's not that bad.

Note however that the fact we are passing callbacks to virtual functions
is enough to make writing a project backend in python impossible.

* void ::node_changed (gpointer node)

I keep the same signal emitted when the data on the disk are changed. 
The project manager at least need to connect on this signal to call the 
load function.
But for the first time, the project is loaded without waiting for the
signal, right?

What's happen if we have modified the project in Anjuta but get this 
signal before saving the changes? I'm not sure it's very important, 
displaying an error message like the editor seems to much, moreover it 
can give troubles if the changes are originally requested by Anjuta.
I don't think it's very important for now.


Regards,
Abderrahim




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