[anjuta-devel] Change project property interface



Hi Abderrahim,


I remember that we have discussed about improving the project properties API.

So here is a new proposal. We define the following

struct _AnjutaProjectProperty
{
        gchar *value;
        gchar *name;
        AnjutaProjectPropertyInfo *info;
}

struct _AnjutaProjectPropertyInfo
{
        AnjutaProjectProperty base;
        const gchar *id;
        AnjutaProjectValueType type;
        AnjutaProjectPropertyFlags flags;
        const gchar *description;
}

struct _AnjutaProjectNode
{
        GInitiallyUnowned parent_instance;

        /*< private >*/
        AnjutaProjectNode       *next;
        AnjutaProjectNode *prev;
        AnjutaProjectNode       *parent;
        AnjutaProjectNode *children;
        
        AnjutaProjectNodeType type;
        AnjutaProjectNodeState state;

        GList *properties_info;
        GList *properties;
        GFile *file;
        gchar *name;
};

It's quite similar to what is already existing. The properties are still not GObject. The difference is that there is now two types a property type and a property info type.

A property info represents one possible attribute. By example a program target has a CFLAGS property info. Each node has a list of possible attribute. This list is read only and so can be shared by all nodes of the same type.

A property represents a custom value for defined property, by example the value of the CFLAGS variable for a particular target. Each node includes a list a custom values with a pointer to the corresponding property info. The name parameters is used to represent hash table only.

The id parameter of the property info uses GLib g_intern_string function, so we don't need to use string comparison.

As a property info include some default value it can be handle as a property.

Backend could derive their own property and property info type to add more information.

Properties are set using ianjuta_project_set_property and deleted using ianjuta_project_remove_property so the backend can handle the memory allocation as needed. But the properties should provide the structure defined so they can read in a general way.


Comparing to the current code, there is few changes. We will need perhaps additional function to handle property info but that's all.


Regards,

Sébastien



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