Re: [anjuta-devel] Change project property interface



Hello Sébastien,

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

So here is a new proposal. We define the following

Thanks for taking the time to think about this, I think it's going in
the right direction, but I'd rather push it further. See below for my
remarks.


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

Does the name really need to be here (rather than in the info)?

 
struct _AnjutaProjectNode
{
      GInitiallyUnowned parent_instance;

      /*< private >*/
      AnjutaProjectNode       *next;
      AnjutaProjectNode *prev;
      AnjutaProjectNode       *parent;
      AnjutaProjectNode *children;

Are the following also considered private? If not, there should be a /*< public >*/
here.
        
      AnjutaProjectNodeType type;
      AnjutaProjectNodeState state;

      GList *properties_info;
      GList *properties;

Since the memory management of these two lists are done by subclasses,
I'd rather replace them with virtual methods.


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

I'm afraid this won't work with introspection. If we really need fast
comparison, we should use GQuark instead, but that's probably not worth
the trouble.


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

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

The problem with this is that introspection doesn't really like ad-hoc
subclassing; we can probably get it to work, but I'd rather find
something else. In what cases it might be interesting to use a
PropertyInfo 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.

Another change I'd like is to have IAnjutaProject's methods dealing with
properties take the property id instead of a pointer to the property.


Thanks and regards,
Abderrahim




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