Re: [anjuta-devel] Change project property interface



Hi Abderrahim,


Le 09/11/2011 23:09, Abderrahim Kitouni a écrit :
AnjutaProjectProperty *ianjuta_project_set_property (AnjutaProjectNode
*parent, const gchar *id, const gchar *value); (transfer none)

I think this is really nice, but this wouldn't allow one to set a map
property, would it?

Yes, it is needed to add a map property.

Do we need to add a set_map_property? (I also like
the symmetry with anjuta_project_node_get_property and
anjuta_project_node_get_map_property. The same goes for
anjuta_project_property_new below.

As I have defined it the anjuta_project_property_new already take a name argument so it could be considered as anjuta_project_map_property_new. I think it's better to keep it as anjuta_project_property_new as the name is simple enough.

Then, for set and get functions here 3 new proposals.

1. Have only ianjuta_project_set_property (AnjutaProjectNode *parent, const gchar *id, const gchar *value) and a map property should use a value with the form "name=value".
- It means that such property couldn't include a character = in the name.
- It's not problem for autotools it could be an issue for another format.
+ It stay quite simple

2. Have only ianjuta_project_set_property (AnjutaProjectNode *parent, const gchar *id, const gchar *value, const gchar *name) and non map
property can pass a NULL name.
+ No limitation on property name
+ It stay quite simple
- One additional argument.

3. Have bother functions ianjuta_project_set_property (AnjutaProjectNode *parent, const gchar *id, const gchar *value) and ianjuta_project_set_map_property (AnjutaProjectNode *parent, const gchar *id, const gchar *value, const gchar *name)
+ No limitation on property name
- Two functions

I will do the same for all related public functions: ianjuta_project_set_property, ianjuta_project_remove_property, anjuta_project_node_get_property.

I think it's better to anjuta_project_property_new as it is (like solution 2).


* I'd prefer to have the list owned by the node, so I don't really like
this.

Well, it doesn't means that the list is not owned by the node, all node could get a reference on it. I think it's done by default with a python list. Anyway, I will keep it as it is.


* Regarding having something shared between all the objects of the same
type, they could be put in the AnjutaProjectNodeClass struct. This is
used in gtk, so I think it should work well with introspection. We
should probably test it first. The method would then be
void anjuta_project_node_class_insert_property_info (
         AnjutaProjectNodeClass *klass,
         AnjutaProjectPropertyInfo *info);

Yes, but it's not a class object at least in the autotools backend. I mean the difference between two node could be only this list of properties.

This list is read only, so the nodes don't need to own it and can keep only a reference on it.


I think a property info could be considered constant and thus doesn't
need setters.

Ok.

Property could use setters. Getters are not strictly
necessary but may be a good idea for symmetry.

It's as you want. Let's say I will try to make all this changes first, then if you need setter or getters you can ask them to me or add them directly.


I think it is enough to add a note in the documentation comments stating
that this function should only be used by backend implementation.

Ok.


Regards,

Sébastien



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