Re: [anjuta-devel] Search Dialog in Anjuta 3.2?



Hi Johannes,


Le 10/02/2012 21:58, Johannes Schmid a écrit :
I have a problem implementing the find in files dialog currently. I have
a IAnjutaProjectNodeChooser and I want all children (source files) of
the selected node.

Given anjuta as an example project:
Selected node: anjuta (main dir) ->  give me all source files in anjuta
project
Selected node: anjuta/plugins/document-manager ->  give me only files in
document-manager
How can I do this?

It's difficult to do currently.

I think one solution would be:
1. Call ianjuta_project_manager_get_children with the GFile that you get from the IAnjutaProjectNodeChooser. 2. I'm quite sure, this will return only the direct children, so then you will have to call it again on all the children until you get NULL. 3. Then, you need to call ianjuta_project_manager_get_target_type to check that all these nodes are source files.

It's not convenient for sure.


I have not changed the project manager API currently because I prefer to get some real use case to avoid defining something new that is difficult to use. So, I'm agree to change it but I don't know exactly what is the best solutions

1. Just add the necessary function to IAnjutaProjectManager like
List<GFile *> ianjuta_project_manager_get_all_children (
                GFile *parent,
                AnjutaProjectNodeType type);
This function to get all children of the parent recursively with the defined type.
+ I think it's exactly what you need.
- It's difficult to get several type of node at the same time (target and source by example) but I don't know if it's really useful. - a GFile could eventually corresponds to several project node (by example a source used in several targets)


2. Return an AnjutaProjectNode from IAnjutaProjectNodeChooser
The chooser button should be able to return the real project node, then you can use all functions defined in libanjuta/anjuta-project.h + You are sure to use the right node and we don't need a search to find the node corresponding to the GFile.
+ You can do more things with a AnjutaProjectNode.
- For the moment the AnjutaProjectNode is used only by backend plugin. Using them elsewhere will make this API public and more difficult to change.
- The API is more complex too.
                

I think I would prefer the solution 1. Do you have other ideas?


One more thing, I have written the AnjutaProjectNodeChooser button in order to choose a parent for a new project node. By example if you use ANJUTA_PROJECT_SOURCE, you will get all nodes allowed as parent of a source file. There is one exception, if you use ANJUTA_PROJECT_ROOT, you will get all project nodes, it is used for properties. In your case, using ANJUTA_PROJECT_SOURCE by example means that you cannot select a group in autotools project.


Regards,

Sébastien



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