Re: [anjuta-devel] ianjuta_project_manager_get_elements



Hi,

Le 28/11/2010 23:05, Abderrahim Kitouni a écrit :
It's probably a good time to implement it correctly : what I actually
need is all sources and all packages used from the current target. What
do you think is the best way to get this?

What is the current target ? The target selected in the run program plugin ?

Anyway, when you have the current target you can call ianjuta_project_manager_get_children then you can call ianjuta_project_manager_get_target_type on all element to check if the type is equal to ANJUTA_PROJECT_SOURCE or ANJUTA_PROJECT_PACKAGE.

I have just seen that ianjuta_project_manager_get_children is not implemented at the moment...

Moreover, it's a quite inefficient too, because to get each type or the children, the project manager has to find the corresponding AnjutaProjectNode. Currently, the project manager has to search for it in the project tree.

I can use a hash table with the GFile as a key but it's possible to have the same source in different targets, you have several AnjutaProjectNode but only one GFile.

I can create several GFile, but I don't like this because it means that you cannot duplicate a GFile or create it from a string.


Getting a AnjutaProjectNode will solve this issue, so I think it's a better solution. I propose to just add "current_project" variable containing a IAnjutaProject pointer on the current project.

In this case, in order to do what you want, you need to.

- You can use ianjuta_project_get_root to get a AnjutaProjectNode and then use anjuta_project_node_traverse to find a target having the right name. - Then you use anjuta_project_node_foreach_children on the target node to get all children which include module since yesterday. - You can check if the children are source or module using anjuta_project_node_get_node_type. - Then to get all packages you need to check all children of the root node with the module type and the name that you already get from the target children. - The package are child node of the module and the corresponding sources are children of the packages.


I think it would be better to add pointer into target child module node pointing to the module object of the root node. So you can just check all children of the module to get the packages and then the sources.


Yes, but I still think that the project manager acts as a good
abstraction of the project api, it should probably be kept (having
access to the actual nodes may be useful, but isn't something most
plugins will want to do.

I think I will keep the project manager plugin. It can be useful if we have several projects.


To summarize, I propose:

1. Add a "current_project" shell value containing a IAnjutaProject pointer.

2. Add a project ianjuta_project_is_loaded. Returning TRUE when the project is fully loaded.

3. Considering target child module node as link to the module node of the root node. So asking children of a target child module will return the children of the root module node.


Regards,

Sébastien



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