Re: [anjuta-devel] Change project property interface



Hi Abderrahim,


Le 07/11/2011 22:39, Abderrahim Kitouni a écrit :
I think there is a misunderstanding here: I've never wanted to remove
ianjuta_project_set_property nor to make
anjuta_project_node_set_property a public API. I just wanted to make
clear the difference between the two. But I'm now convinced that freeing
the backend specific data in ianjuta_project_set_property is not really
a bad idea.

Ok.

Ok, I will call it data like in GList.
I'd rather take a name that makes it clear that it's backend-specific
data.

Ok, so user_data looks better.


I was thinking about something similar. So I think we've come to an
agreement.

I will do the following changes:


* Change the following functions of IAnjutaProject interface (I think nobody use them so I think it's not an issue to break the compatibility)

AnjutaProjectProperty *ianjuta_project_set_property (AnjutaProjectNode *parent, const gchar *id, const gchar *value); (transfer none)

gboolean ianjuta_project_remove_property (AnjutaProjectNode *parent, const gchar *id);



* Change the following types:

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

struct _AnjutaProjectPropertyInfo
{
        const gchar *id;
        AnjutaProjectValueType type;
        AnjutaProjectPropertyFlags flags;
        const gchar *description;
        AnjutaProjectProperty *default;
        gpointer user_data;
}

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;
};



* Have the following function in anjuta-project.h

GType anjuta_project_property_get_type (void);

AnjutaProjectProperty *anjuta_project_property_new (
        const gchar *value,
        const gchar *name,
        AnjutaProjectPropertyInfo *info);
AnjutaProjectProperty * anjuta_project_property_copy (
        AnjutaProjectProperty *prop);
void anjuta_project_property_free (
        AnjutaProjectProperty *prop);

GType anjuta_project_property_info_get_type (void);
AnjutaProjectPropertyInfo *anjuta_project_property_info_new (
        const gchar *id,
        AnjutaProjectValueType type,
        AnjutaProjectPropertyFlags flags,
        const gchar *description,
        const gchar *value);
AnjutaProjectPropertyInfo * anjuta_project_property_info_copy (
        AnjutaProjectPropertyInfo *prop);
void anjuta_project_property_info_free (
        AnjutaProjectPropertyInfo *prop);

GList *anjuta_project_node_get_properties_info (
        AnjutaProjectNode *node);
GList *anjuta_project_node_get_properties (
        AnjutaProjectNode *node);
AnjutaProjectProperty *anjuta_project_node_get_property (
        AnjutaProjectNode *node,
        const gchar *id);
AnjutaProjectProperty *anjuta_project_node_get_map_property (
        AnjutaProjectNode *node,
        const gchar *id, const gchar *name);
AnjutaProjectPropertyInfo *anjuta_project_node_get_property_info (
        AnjutaProjectNode *node,
        const gchar *id);

AnjutaProjectProperty *anjuta_project_node_insert_property (
        AnjutaProjectNode *node,
        AnjutaProjectPropertyInfo *info,
        AnjutaProjectProperty *property);
gboolean anjuta_project_node_remove_property (
        AnjutaProjectNode *node,
        AnjutaProjectProperty *property);
void anjuta_project_node_insert_property_info (
        AnjutaProjectNode *node,
        AnjutaProjectPropertyInfo *info);


Is it ok to do at least all this?


Then a few other questions and remarks.

* The anjuta_project_node_insert_property_info is perhaps not very useful because at least in the autotools backend. The properties infos list constant and shared but all node of the same type. So it will be rather

void anjuta_project_node_insert_property_info (
        AnjutaProjectNode *node,
        GList *info);

Anyway, one backend could use a custom list for each node.


* Do I need to add set and get function for all attributes of property and property info object?


* Some function of the anjuta-project.h are "public" and can be used by any plugin by example anjuta_project_node_get_property. While other are "private" and are usable by a backend plugin only by example anjuta_project_node_insert_property (other plugins have to use ianjuta_project_set_property instead).

I think I need at least to separate them in the header file. But do you think we need to move them to a separate header or do you have a better idea to make this different more clear? By the way, I don't know if it's clear for you.


Regards,

Sébastien



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