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



Hi,

Here a summary of all planned changes:


IAnjutaProjectManager
=====================

Signals
-------

        void "project_loaded" (GFile *element, gboolean complete, GError *error);

This signal is emitted as soon as a part of the project has been loaded. It could be that some children are not loaded (complete = FALSE), in this case this signal will be emitted again with the child as element argument.

        void "element_added" (GFile *element);
        
        void "element_removed" (GFile *element);
        
        void "element_selected" (GFile *element);


I keep the same signals for the remaining. I will probably change the GFile* argument to a AnjutaProjectNode* but this can wait.


Methods
-------
        
        List<GFile *> ianjuta_project_manager_get_elements (
                IAnjutaProjectManager *manager,
                AnjutaProjectNodeType element_type,
                GError **error);

The element_type value is a integer giving the type of the node. The LSB 12 bits of the value give more details on the node type, it's used only for target at the moment and allow to make the difference between a static library, a program or a shared library by example. The 16 MSB give the node type, root, package, module, group, target or source currently. This function replaces get_targets and get_packages.

        AnjutaProjectNodeType ianjuta_project_manager_get_element_type (
                IAnjutaProjectManager *manager,
                GFile *target,
                GError **error);

This function is a rename of get_target_type. It's working for any node: root, modules, packages, groups, targets and sources.

        GFile* ianjuta_project_manager_get_parent (
                IAnjutaProjectManager *manager,
                GFile *element,
                GError **error);
        
        List<GFile*> ianjuta_project_manager_get_children (
                IAnjutaProjectManager *manager,
                GFile *element,
                GError **error);

You can use this function on all package nodes to get all header files (sources) used by a package.

        
        GFile* ianjuta_project_manager_get_selected (
                IAnjutaProjectManager *manager,
                GError **error);
        
        guint ianjuta_project_manager_get_capabilities (
                IAnjutaProjectManager *manager,
                GError **error);

        GFile* ianjuta_project_manager_add_source (
                IAnjutaProjectManager *manager,
                const gchar *name,
                GFile *default_target,
                GError **error);

        GFile* ianjuta_project_manager_add_source_quiet (
                IAnjutaProjectManager *manager,
                const gchar *name,
                GFile *target,
                GError **error);
        
        List<GFile*> ianjuta_project_manager_add_sources (
                IAnjutaProjectManager *manager,
                List<const gchar*> names,
                GFile *default_target,
                GError **error);
        
        GFile* ianjuta_project_manager_add_target (
                IAnjutaProjectManager *manager,
                const gchar *name,
                GFile *default_group,
                GError **error);
        
        GFile* ianjuta_project_manager_add_group (
                IAnjutaProjectManager *manager,
                const gchar *name,
                GFile *default_group,
                GError **error);
        
        gboolean ianjuta_project_manager_is_open (
                IAnjutaProjectManager *manager,
                GError **error);
        

I have tried to really minize the change in the IAnjutaProjectManager interface. I will probably change it again but in the next cycle.

- The new interface is more general as get_elements, get_packages and get_targets have been merged.
- The new project take care of loading header files for packages.
- Getting these header file is more difficult because they are loaded asynchronously so you need to use the project-loaded signal.




IAnjutaProjectBackend
=====================

Methods
-------

        IAnjutaProject* ianjuta_project_backend_new_project (
                IAnjutaProjectBackend *backend,
                GFile *file,
                GError **error);

        gint ianjuta_project_backend_probe (
                IAnjutaProjectBackend *backend,
                GFile *directory,
                GError **error);


No change here.



IAnjutaProject
==============

Signals
-------

        void ::node_updated (AnjutaProjectNode node);

Emitted when a node is changed on disk, someone should connect on this signal and reload the corresponding node.


Methods
-------
        
        typedef void (*IAnjutaProjectCallback) (
                AnjutaProjectNode *node,
                GError *err,
                gpointer user_data);

        gboolean ianjuta_project_load_node (
                IAnjutaProject *project,
                AnjutaProjectNode *node,
                IAnjutaProjectCallback callback,
                GDestroyNotify destroy,
                gpointer user_data,
                GError **error);

You can connect only on the destroy notification function if you just want to know when the project is fully loaded. I have imagined that it would be nice to pass the node as an additional argument of the destroy notification function. But in this case we need a special typedef for the notification function and I'm afraid it will be a problem for bindings.


        gboolean ianjuta_project_save_node (
                IAnjutaProject *project,
                AnjutaProjectNode *node,
                IAnjutaProjectCallback callback,
                gpointer user_data,
                GError **error);

The save function do not have a destroy notification function because the callback function is called only one time. We could put only a destroy notification and not a callback too. As this callback will have the same use than the destroy notification in the load_node function. But we loose the node argument which is nice.

        AnjutaProjectNode * ianjuta_project_add_node_after (
                IAnjutaProject *project,
                AnjutaProjectNode *parent,
                AnjutaProjectNode *sibling,
                AnjutaProjectNodeType type,
                GFile *file,
                const gchar *name,
                GError *err);

        AnjutaProjectNode * ianjuta_project_add_node_before (
                IAnjutaProject *project,
                AnjutaProjectNode *parent,
                AnjutaProjectNode *sibling,
                AnjutaProjectNodeType type,
                GFile *file,
                const gchar *name,
                GError *err);

        gboolean ianjuta_project_remove_node (
                IAnjutaProject *project,
                AnjutaProjectNode *node,
                GError *err);

        AnjutaProjectProperty *ianjuta_project_set_property (
                IAnjutaProject *project,
                AnjutaProjectNode *node,
                AnjutaProjectProperty *property,
                const gchar *value,
                GError *err);

        gboolean ianjuta_project_remove_property (
                IAnjutaProject *project,
                AnjutaProjectNode *node,
                AnjutaProjectProperty *property,
                GError *err);

        AnjutaProjectNode *ianjuta_project_get_root (
                IAnjutaProject *project,
                GError *err);

        AnjutaProjectNodeInfo* ianjuta_project_get_node_info(
                IAnjutaProject *project,
                GError *err);


Ok, I think I have summarized everything but tell me if I have missed something, it has already arrived in the recent past :(


Then, I have planned to do the changes starting from the top, so changing the project manager interface first. It's more work because we need to improve a bit the gbf am backend plugin to make it search for package header. On the other hand I think it's safer as the changes are small on the top. If someone want to do it, it will be very helpful.


I would like to start changing things in the master branch beginning of november. So we still have 2 weeks to discuss about these changes and the best way to implement them. During this time, I plan to work on the auto tools backend.

One last thing that would be useful is to have python bindings supporting the callback used in this interface.

Best Regards,

Sébastien



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