[anjuta/newproject: 113/114] Use same base type for every AnjutaProjectNode types



commit 4aa9c2da12a62f7a564f964fc84f6b4f23f073b3
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Sun Mar 14 19:58:44 2010 +0100

    Use same base type for every AnjutaProjectNode types

 libanjuta/anjuta-project.c         |   63 +++++++++++------------
 libanjuta/anjuta-project.h         |   26 ++++++----
 libanjuta/interfaces/libanjuta.idl |    8 ++--
 plugins/am-project/am-project.c    |  100 ++++++++++++++++++------------------
 plugins/am-project/am-project.h    |    6 +-
 plugins/am-project/projectparser.c |   12 ++--
 plugins/mk-project/mk-project.c    |   54 ++++++++++----------
 plugins/mk-project/mk-project.h    |    6 +-
 plugins/mk-project/mk-rule.c       |    4 +-
 9 files changed, 141 insertions(+), 138 deletions(-)
---
diff --git a/libanjuta/anjuta-project.c b/libanjuta/anjuta-project.c
index 87a27e3..5f11b3b 100644
--- a/libanjuta/anjuta-project.c
+++ b/libanjuta/anjuta-project.c
@@ -50,9 +50,6 @@
 
 /* convenient shortcut macro the get the AnjutaProjectNode from a GNode */
 #define NODE_DATA(node)  ((node) != NULL ? (AnjutaProjectNodeData *)((node)->data) : NULL)
-#define GROUP_DATA(node)  ((node) != NULL ? (AnjutaProjectGroupData *)((node)->data) : NULL)
-#define TARGET_DATA(node)  ((node) != NULL ? (AnjutaProjectTargetData *)((node)->data) : NULL)
-#define SOURCE_DATA(node)  ((node) != NULL ? (AnjutaProjectSourceData *)((node)->data) : NULL)
 
 
 /* Properties functions
@@ -316,11 +313,11 @@ anjuta_project_node_get_name (const AnjutaProjectNode *node)
 	switch (NODE_DATA (node)->type)
 	{
 	case ANJUTA_PROJECT_GROUP:
-		return g_file_get_basename (GROUP_DATA (node)->directory);
+		return g_file_get_basename (NODE_DATA (node)->file);
 	case ANJUTA_PROJECT_TARGET:
-		return g_strdup (TARGET_DATA (node)->name);
+		return g_strdup (NODE_DATA (node)->name);
 	case ANJUTA_PROJECT_SOURCE:
-		return g_file_get_basename (SOURCE_DATA (node)->file);
+		return g_file_get_basename (NODE_DATA (node)->file);
 	default:
 		return NULL;
 	}
@@ -329,14 +326,14 @@ anjuta_project_node_get_name (const AnjutaProjectNode *node)
 gchar*
 anjuta_project_node_get_uri (AnjutaProjectNode *node)
 {
-	AnjutaProjectGroup *parent;
+	AnjutaProjectNode *parent;
 	GFile *file;
 	gchar *uri;
 	
 	switch (NODE_DATA (node)->type)
 	{
 	case ANJUTA_PROJECT_GROUP:
-		uri = g_file_get_uri (GROUP_DATA (node)->directory);
+		uri = g_file_get_uri (NODE_DATA (node)->file);
 		break;
 	case ANJUTA_PROJECT_TARGET:
 		parent = anjuta_project_node_parent (node);
@@ -345,7 +342,7 @@ anjuta_project_node_get_uri (AnjutaProjectNode *node)
 		g_object_unref (file);
 		break;
 	case ANJUTA_PROJECT_SOURCE:
-		uri = g_file_get_uri (SOURCE_DATA (node)->file);
+		uri = g_file_get_uri (NODE_DATA (node)->file);
 		break;
 	default:
 		uri = NULL;
@@ -358,20 +355,20 @@ anjuta_project_node_get_uri (AnjutaProjectNode *node)
 GFile*
 anjuta_project_node_get_file (AnjutaProjectNode *node)
 {
-	AnjutaProjectGroup *parent;
+	AnjutaProjectNode *parent;
 	GFile *file;
 	
 	switch (NODE_DATA (node)->type)
 	{
 	case ANJUTA_PROJECT_GROUP:
-		file = g_object_ref (GROUP_DATA (node)->directory);
+		file = g_object_ref (NODE_DATA (node)->file);
 		break;
 	case ANJUTA_PROJECT_TARGET:
 		parent = anjuta_project_node_parent (node);
 		file = g_file_get_child (anjuta_project_group_get_directory (parent), anjuta_project_target_get_name (node));
 		break;
 	case ANJUTA_PROJECT_SOURCE:
-		file = g_object_ref (SOURCE_DATA (node)->file);
+		file = g_object_ref (NODE_DATA (node)->file);
 		break;
 	default:
 		file = NULL;
@@ -440,9 +437,9 @@ anjuta_project_node_get_property_value (AnjutaProjectNode *node, AnjutaProjectPr
  *---------------------------------------------------------------------------*/
 
 GFile*
-anjuta_project_group_get_directory (const AnjutaProjectGroup *group)
+anjuta_project_group_get_directory (const AnjutaProjectNode *group)
 {
-	return GROUP_DATA (group)->directory;
+	return NODE_DATA (group)->file;
 }
 
 static gboolean
@@ -450,7 +447,7 @@ anjuta_project_group_compare (GNode *node, gpointer data)
 {
 	GFile *file = *(GFile **)data;
 
-	if ((NODE_DATA(node)->type == ANJUTA_PROJECT_GROUP) && g_file_equal (GROUP_DATA(node)->directory, file))
+	if ((NODE_DATA(node)->type == ANJUTA_PROJECT_GROUP) && g_file_equal (NODE_DATA(node)->file, file))
 	{
 		*(AnjutaProjectNode **)data = node;
 
@@ -462,8 +459,8 @@ anjuta_project_group_compare (GNode *node, gpointer data)
 	}
 }
 
-AnjutaProjectGroup *
-anjuta_project_group_get_node_from_file (const AnjutaProjectGroup *root, GFile *directory)
+AnjutaProjectNode *
+anjuta_project_group_get_node_from_file (const AnjutaProjectNode *root, GFile *directory)
 {
 	GFile *data;
 	
@@ -473,11 +470,11 @@ anjuta_project_group_get_node_from_file (const AnjutaProjectGroup *root, GFile *
 	return (data == directory) ? NULL : (AnjutaProjectNode *)data;
 }
 
-AnjutaProjectGroup *
+AnjutaProjectNode *
 anjuta_project_group_get_node_from_uri (const AnjutaProjectNode *root, const gchar *uri)
 {
 	GFile *file = g_file_new_for_uri (uri);
-	AnjutaProjectGroup *node;
+	AnjutaProjectNode *node;
 
 	node = anjuta_project_group_get_node_from_file (root, file);
 	g_object_unref (file);
@@ -490,7 +487,7 @@ anjuta_project_target_compare (GNode *node, gpointer data)
 {
 	const gchar *name = *(gchar **)data;
 
-	if ((NODE_DATA(node)->type == ANJUTA_PROJECT_TARGET) && (strcmp (TARGET_DATA(node)->name, name) == 0))
+	if ((NODE_DATA(node)->type == ANJUTA_PROJECT_TARGET) && (strcmp (NODE_DATA(node)->name, name) == 0))
 	{
 		*(AnjutaProjectNode **)data = node;
 
@@ -502,15 +499,15 @@ anjuta_project_target_compare (GNode *node, gpointer data)
 	}
 }
 
-AnjutaProjectTarget *
-anjuta_project_target_get_node_from_name (const AnjutaProjectGroup *parent, const gchar *name)
+AnjutaProjectNode *
+anjuta_project_target_get_node_from_name (const AnjutaProjectNode *parent, const gchar *name)
 {
 	const gchar *data;
 	
 	data = name;
 	g_node_traverse	((GNode *)parent, G_PRE_ORDER, G_TRAVERSE_ALL, 2, anjuta_project_target_compare, &data);
 
-	return (data == name) ? NULL : (AnjutaProjectTarget *)data;
+	return (data == name) ? NULL : (AnjutaProjectNode *)data;
 }
 
 static gboolean
@@ -518,7 +515,7 @@ anjuta_project_source_compare (GNode *node, gpointer data)
 {
 	GFile *file = *(GFile **)data;
 
-	if ((NODE_DATA(node)->type == ANJUTA_PROJECT_SOURCE) && g_file_equal (SOURCE_DATA(node)->file, file))
+	if ((NODE_DATA(node)->type == ANJUTA_PROJECT_SOURCE) && g_file_equal (NODE_DATA(node)->file, file))
 	{
 		*(AnjutaProjectNode **)data = node;
 
@@ -530,7 +527,7 @@ anjuta_project_source_compare (GNode *node, gpointer data)
 	}
 }
 
-AnjutaProjectSource *
+AnjutaProjectNode *
 anjuta_project_source_get_node_from_file (const AnjutaProjectNode *parent, GFile *file)
 {
 	GFile *data;
@@ -541,11 +538,11 @@ anjuta_project_source_get_node_from_file (const AnjutaProjectNode *parent, GFile
 	return (data == file) ? NULL : (AnjutaProjectNode *)data;
 }
 
-AnjutaProjectSource *
+AnjutaProjectNode *
 anjuta_project_source_get_node_from_uri (const AnjutaProjectNode *parent, const gchar *uri)
 {
 	GFile *file = g_file_new_for_uri (uri);
-	AnjutaProjectSource *node;
+	AnjutaProjectNode *node;
 
 	node = anjuta_project_source_get_node_from_file (parent, file);
 	g_object_unref (file);
@@ -557,24 +554,24 @@ anjuta_project_source_get_node_from_uri (const AnjutaProjectNode *parent, const
  *---------------------------------------------------------------------------*/
 
 const gchar *
-anjuta_project_target_get_name (const AnjutaProjectTarget *target)
+anjuta_project_target_get_name (const AnjutaProjectNode *target)
 {
-	return TARGET_DATA (target)->name;
+	return NODE_DATA (target)->name;
 }
 
 AnjutaProjectTargetType
-anjuta_project_target_get_type (const AnjutaProjectTarget *target)
+anjuta_project_target_get_type (const AnjutaProjectNode *target)
 {
-	return TARGET_DATA (target)->type;
+	return NODE_DATA (target)->target_type;
 }
 
 /* Source access functions
  *---------------------------------------------------------------------------*/
 
 GFile*
-anjuta_project_source_get_file (const AnjutaProjectSource *source)
+anjuta_project_source_get_file (const AnjutaProjectNode *source)
 {
-	return SOURCE_DATA (source)->file;
+	return NODE_DATA (source)->file;
 }
 
 /* Target type functions
diff --git a/libanjuta/anjuta-project.h b/libanjuta/anjuta-project.h
index 3967036..6998495 100644
--- a/libanjuta/anjuta-project.h
+++ b/libanjuta/anjuta-project.h
@@ -94,8 +94,12 @@ typedef struct
 {
 	AnjutaProjectNodeType type;
 	AnjutaProjectPropertyList *properties;
+	GFile *file;
+	gchar *name;
+	AnjutaProjectTargetType target_type;
 } AnjutaProjectNodeData;
 
+#if 0
 typedef struct {
 	AnjutaProjectNodeData node;
 	GFile *directory;
@@ -111,12 +115,14 @@ typedef struct {
 	AnjutaProjectNodeData node;
 	GFile *file;
 } AnjutaProjectSourceData;
+#endif
 
 typedef GNode AnjutaProjectNode;
+#if 0
 typedef GNode AnjutaProjectGroup;
 typedef GNode AnjutaProjectTarget;
 typedef GNode AnjutaProjectSource;
-
+#endif
 
 #define ANJUTA_PROJECT_NODE_DATA(node)  ((node) != NULL ? (AnjutaProjectNodeData *)((node)->data) : NULL)
 
@@ -156,18 +162,18 @@ GFile *anjuta_project_node_get_file (AnjutaProjectNode *node);
 AnjutaProjectPropertyList *anjuta_project_node_get_property_list (AnjutaProjectNode *node);
 const gchar *anjuta_project_node_get_property_value (AnjutaProjectNode *node, AnjutaProjectProperty prop);
 
-AnjutaProjectGroup *anjuta_project_group_get_node_from_file (const AnjutaProjectGroup *root, GFile *directory);
-AnjutaProjectTarget *anjuta_project_target_get_node_from_name (const AnjutaProjectGroup *parent, const gchar *name);
-AnjutaProjectSource *anjuta_project_source_get_node_from_file (const AnjutaProjectNode *parent, GFile *file);
-AnjutaProjectGroup *anjuta_project_group_get_node_from_uri (const AnjutaProjectGroup *root, const gchar *uri);
-AnjutaProjectSource *anjuta_project_source_get_node_from_uri (const AnjutaProjectNode *parent, const gchar *uri);
+AnjutaProjectNode *anjuta_project_group_get_node_from_file (const AnjutaProjectNode *root, GFile *directory);
+AnjutaProjectNode *anjuta_project_target_get_node_from_name (const AnjutaProjectNode *parent, const gchar *name);
+AnjutaProjectNode *anjuta_project_source_get_node_from_file (const AnjutaProjectNode *parent, GFile *file);
+AnjutaProjectNode *anjuta_project_group_get_node_from_uri (const AnjutaProjectNode *root, const gchar *uri);
+AnjutaProjectNode *anjuta_project_source_get_node_from_uri (const AnjutaProjectNode *parent, const gchar *uri);
 
-GFile *anjuta_project_group_get_directory (const AnjutaProjectGroup *group);
+GFile *anjuta_project_group_get_directory (const AnjutaProjectNode *group);
 
-const gchar *anjuta_project_target_get_name (const AnjutaProjectTarget *target);
-AnjutaProjectTargetType anjuta_project_target_get_type (const AnjutaProjectTarget *target);
+const gchar *anjuta_project_target_get_name (const AnjutaProjectNode *target);
+AnjutaProjectTargetType anjuta_project_target_get_type (const AnjutaProjectNode *target);
 
-GFile *anjuta_project_source_get_file (const AnjutaProjectSource *source);
+GFile *anjuta_project_source_get_file (const AnjutaProjectNode *source);
 
 const gchar *anjuta_project_target_type_name (const AnjutaProjectTargetType type);
 const gchar *anjuta_project_target_type_mime (const AnjutaProjectTargetType type);
diff --git a/libanjuta/interfaces/libanjuta.idl b/libanjuta/interfaces/libanjuta.idl
index f5a67ce..16581d4 100644
--- a/libanjuta/interfaces/libanjuta.idl
+++ b/libanjuta/interfaces/libanjuta.idl
@@ -3147,7 +3147,7 @@ interface IAnjutaProject
 	*
 	* Returns: The new group or NULL on error.
 	*/
-	AnjutaProjectGroup* get_root ();
+	AnjutaProjectNode* get_root ();
 
 	/*
 	 * ianjuta_project_get_packages
@@ -3171,7 +3171,7 @@ interface IAnjutaProject
 	*
 	* Returns: The new group or NULL on error.
 	*/
-	AnjutaProjectGroup* add_group (AnjutaProjectGroup *parent, const gchar *name);
+	AnjutaProjectNode* add_group (AnjutaProjectNode *parent, const gchar *name);
 
 	/**
 	* ianjuta_project_add_target:
@@ -3185,7 +3185,7 @@ interface IAnjutaProject
 	*
 	* Returns: The new target or NULL on error.
 	*/
-	AnjutaProjectTarget* add_target (AnjutaProjectGroup *parent, const gchar *name, AnjutaProjectTargetType type);
+	AnjutaProjectNode* add_target (AnjutaProjectNode *parent, const gchar *name, AnjutaProjectTargetType type);
 
 	/**
 	* ianjuta_project_add_source:
@@ -3198,7 +3198,7 @@ interface IAnjutaProject
 	*
 	* Returns: The new source or NULL on error.
 	*/
-	AnjutaProjectSource* add_source (AnjutaProjectTarget *parent, GFile *file);
+	AnjutaProjectNode* add_source (AnjutaProjectNode *parent, GFile *file);
 
 	/**
 	* ianjuta_project_remove_node:
diff --git a/plugins/am-project/am-project.c b/plugins/am-project/am-project.c
index 6f04166..0b345d8 100644
--- a/plugins/am-project/am-project.c
+++ b/plugins/am-project/am-project.c
@@ -87,7 +87,7 @@ typedef enum {
 typedef struct _AmpGroupData AmpGroupData;
 
 struct _AmpGroupData {
-	AnjutaProjectGroupData base;		/* Common node data */
+	AnjutaProjectNodeData base;		/* Common node data */
 	gboolean dist_only;			/* TRUE if the group is distributed but not built */
 	GFile *makefile;				/* GFile corresponding to group makefile */
 	AnjutaTokenFile *tfile;		/* Corresponding Makefile */
@@ -110,7 +110,7 @@ typedef enum _AmpTargetFlag
 typedef struct _AmpTargetData AmpTargetData;
 
 struct _AmpTargetData {
-	AnjutaProjectTargetData base;
+	AnjutaProjectNodeData base;
 	gchar *install;
 	gint flags;
 	GList* tokens;
@@ -119,7 +119,7 @@ struct _AmpTargetData {
 typedef struct _AmpSourceData AmpSourceData;
 
 struct _AmpSourceData {
-	AnjutaProjectSourceData base;
+	AnjutaProjectNodeData base;
 	AnjutaToken* token;
 };
 
@@ -713,9 +713,9 @@ amp_group_new (GFile *file, gboolean dist_only)
 	g_return_val_if_fail (file != NULL, NULL);
 	
 	group = g_slice_new0(AmpGroupData); 
-	group->base.node.type = ANJUTA_PROJECT_GROUP;
-	group->base.node.properties = amp_get_group_property_list();
-	group->base.directory = g_object_ref (file);
+	group->base.type = ANJUTA_PROJECT_GROUP;
+	group->base.properties = amp_get_group_property_list();
+	group->base.file = g_object_ref (file);
 	group->dist_only = dist_only;
 
     return g_node_new (group);
@@ -727,8 +727,8 @@ amp_group_free (AmpGroup *node)
     AmpGroupData *group = (AmpGroupData *)node->data;
 	gint i;
 	
-	if (group->base.directory) g_object_unref (group->base.directory);
-	anjuta_project_property_foreach (group->base.node.properties, (GFunc)amp_property_free, NULL);
+	if (group->base.file) g_object_unref (group->base.file);
+	anjuta_project_property_foreach (group->base.properties, (GFunc)amp_property_free, NULL);
 	if (group->tfile) anjuta_token_file_free (group->tfile);
 	if (group->makefile) g_object_unref (group->makefile);
 	for (i = 0; i < AM_GROUP_TOKEN_LAST; i++)
@@ -773,10 +773,10 @@ amp_target_new (const gchar *name, AnjutaProjectTargetType type, const gchar *in
     AmpTargetData *target = NULL;
 
 	target = g_slice_new0(AmpTargetData); 
-	target->base.node.type = ANJUTA_PROJECT_TARGET;
-	target->base.node.properties = amp_get_target_property_list(type);
+	target->base.type = ANJUTA_PROJECT_TARGET;
+	target->base.properties = amp_get_target_property_list(type);
 	target->base.name = g_strdup (name);
-	target->base.type = type;
+	target->base.target_type = type;
 	target->install = g_strdup (install);
 	target->flags = flags;
 
@@ -789,7 +789,7 @@ amp_target_free (AmpTarget *node)
     AmpTargetData *target = AMP_TARGET_DATA (node);
 	
     g_free (target->base.name);
-	anjuta_project_property_foreach (target->base.node.properties, (GFunc)amp_property_free, NULL);
+	anjuta_project_property_foreach (target->base.properties, (GFunc)amp_property_free, NULL);
     g_free (target->install);
     g_slice_free (AmpTargetData, target);
 
@@ -805,8 +805,8 @@ amp_source_new (GFile *file)
     AmpSourceData *source = NULL;
 
 	source = g_slice_new0(AmpSourceData); 
-	source->base.node.type = ANJUTA_PROJECT_SOURCE;
-	source->base.node.properties = amp_get_source_property_list();
+	source->base.type = ANJUTA_PROJECT_SOURCE;
+	source->base.properties = amp_get_source_property_list();
 	source->base.file = g_object_ref (file);
 
     return g_node_new (source);
@@ -818,7 +818,7 @@ amp_source_free (AmpSource *node)
     AmpSourceData *source = AMP_SOURCE_DATA (node);
 	
     g_object_unref (source->base.file);
-	anjuta_project_property_foreach (source->base.node.properties, (GFunc)amp_property_free, NULL);
+	anjuta_project_property_foreach (source->base.properties, (GFunc)amp_property_free, NULL);
     g_slice_free (AmpSourceData, source);
 
 	g_node_destroy (node);
@@ -907,7 +907,7 @@ group_hash_foreach_monitor (gpointer key,
 	AmpGroup *group_node = value;
 	AmpProject *project = user_data;
 
-	monitor_add (project, AMP_GROUP_DATA(group_node)->base.directory);
+	monitor_add (project, AMP_GROUP_DATA(group_node)->base.file);
 }
 
 static void
@@ -938,7 +938,7 @@ amp_dump_node (AnjutaProjectNode *g_node)
 	
 	switch (AMP_NODE_DATA (g_node)->type) {
 		case ANJUTA_PROJECT_GROUP:
-			name = g_file_get_uri (AMP_GROUP_DATA (g_node)->base.directory);
+			name = g_file_get_uri (AMP_GROUP_DATA (g_node)->base.file);
 			DEBUG_PRINT ("GROUP: %s", name);
 			break;
 		case ANJUTA_PROJECT_TARGET:
@@ -1144,14 +1144,14 @@ amp_project_load_config (AmpProject *project, AnjutaToken *arg_list)
 }
 
 static void
-find_target (AnjutaProjectTarget *node, gpointer data)
+find_target (AnjutaProjectNode *node, gpointer data)
 {
 	if (AMP_NODE_DATA (node)->type == ANJUTA_PROJECT_TARGET)
 	{
 		if (strcmp (AMP_TARGET_DATA (node)->base.name, *(gchar **)data) == 0)
 		{
 			/* Find target, return node value in pointer */
-			*(AnjutaProjectTarget **)data = node;
+			*(AnjutaProjectNode **)data = node;
 
 			return;
 		}
@@ -1159,7 +1159,7 @@ find_target (AnjutaProjectTarget *node, gpointer data)
 }
 
 static void
-find_canonical_target (AnjutaProjectTarget *node, gpointer data)
+find_canonical_target (AnjutaProjectNode *node, gpointer data)
 {
 	if (AMP_NODE_DATA (node)->type == ANJUTA_PROJECT_TARGET)
 	{
@@ -1168,7 +1168,7 @@ find_canonical_target (AnjutaProjectTarget *node, gpointer data)
 		if (strcmp (canon_name, *(gchar **)data) == 0)
 		{
 			/* Find target, return node value in pointer */
-			*(AnjutaProjectTarget **)data = node;
+			*(AnjutaProjectNode **)data = node;
 			g_free (canon_name);
 
 			return;
@@ -1178,7 +1178,7 @@ find_canonical_target (AnjutaProjectTarget *node, gpointer data)
 }
 
 static AnjutaToken*
-project_load_target (AmpProject *project, AnjutaToken *name, AnjutaTokenType token_type, AnjutaToken *list, AnjutaProjectGroup *parent, GHashTable *orphan_properties)
+project_load_target (AmpProject *project, AnjutaToken *name, AnjutaTokenType token_type, AnjutaToken *list, AnjutaProjectNode *parent, GHashTable *orphan_properties)
 {
 	AnjutaToken *arg;
 	AnjutaProjectTargetType type = NULL;
@@ -1291,11 +1291,11 @@ project_load_target (AmpProject *project, AnjutaToken *name, AnjutaTokenType tok
 }
 
 static AnjutaToken*
-project_load_sources (AmpProject *project, AnjutaToken *name, AnjutaToken *list, AnjutaProjectGroup *parent, GHashTable *orphan_properties)
+project_load_sources (AmpProject *project, AnjutaToken *name, AnjutaToken *list, AnjutaProjectNode *parent, GHashTable *orphan_properties)
 {
 	AnjutaToken *arg;
 	AmpGroupData *group = AMP_GROUP_DATA (parent);
-	GFile *parent_file = g_object_ref (group->base.directory);
+	GFile *parent_file = g_object_ref (group->base.file);
 	gchar *target_id = NULL;
 	AmpTargetPropertyBuffer *orphan = NULL;
 
@@ -1316,7 +1316,7 @@ project_load_sources (AmpProject *project, AnjutaToken *name, AnjutaToken *list,
 		find = target_id;
 		DEBUG_PRINT ("search for canonical %s", target_id);
 		anjuta_project_node_children_foreach (parent, find_canonical_target, &find);
-		parent = (gchar *)find != target_id ? (AnjutaProjectTarget *)find : NULL;
+		parent = (gchar *)find != target_id ? (AnjutaProjectNode *)find : NULL;
 
 		/* Get orphan buffer if there is no target */
 		if (parent == NULL)
@@ -1377,11 +1377,11 @@ project_load_sources (AmpProject *project, AnjutaToken *name, AnjutaToken *list,
 }
 
 static AnjutaToken*
-project_load_data (AmpProject *project, AnjutaToken *name, AnjutaToken *list, AnjutaProjectGroup *parent, GHashTable *orphan_properties)
+project_load_data (AmpProject *project, AnjutaToken *name, AnjutaToken *list, AnjutaProjectNode *parent, GHashTable *orphan_properties)
 {
 	AnjutaProjectTargetType type = NULL;
 	gchar *install;
-	AnjutaProjectTarget *target;
+	AnjutaProjectNode *target;
 	gchar *target_id;
 	gpointer find;
 	gint flags;
@@ -1425,13 +1425,13 @@ project_load_data (AmpProject *project, AnjutaToken *name, AnjutaToken *list, An
 	}
 	else
 	{
-		target = (AnjutaProjectTarget *)find;
+		target = (AnjutaProjectNode *)find;
 	}
 	g_free (target_id);
 
 	if (target)
 	{
-		GFile *parent_file = g_object_ref (AMP_GROUP_DATA (parent)->base.directory);
+		GFile *parent_file = g_object_ref (AMP_GROUP_DATA (parent)->base.file);
 		
 		for (arg = anjuta_token_first_word (list); arg != NULL; arg = anjuta_token_next_word (arg))
 		{
@@ -1460,7 +1460,7 @@ project_load_data (AmpProject *project, AnjutaToken *name, AnjutaToken *list, An
 }
 
 static AnjutaToken*
-project_load_target_properties (AmpProject *project, AnjutaToken *name, AnjutaTokenType type, AnjutaToken *list, AnjutaProjectGroup *parent, GHashTable *orphan_properties)
+project_load_target_properties (AmpProject *project, AnjutaToken *name, AnjutaTokenType type, AnjutaToken *list, AnjutaProjectNode *parent, GHashTable *orphan_properties)
 {
 	AmpGroupData *group = AMP_GROUP_DATA (parent);
 	gchar *target_id = NULL;
@@ -1485,7 +1485,7 @@ project_load_target_properties (AmpProject *project, AnjutaToken *name, AnjutaTo
 		find = target_id;
 		DEBUG_PRINT ("search for canonical %s", target_id);
 		anjuta_project_node_children_foreach (parent, find_canonical_target, &find);
-		parent = (gchar *)find != target_id ? (AnjutaProjectTarget *)find : NULL;
+		parent = (gchar *)find != target_id ? (AnjutaProjectNode *)find : NULL;
 
 		/* Get orphan buffer if there is no target */
 		if (parent == NULL)
@@ -1535,7 +1535,7 @@ project_load_target_properties (AmpProject *project, AnjutaToken *name, AnjutaTo
 }
 
 static AnjutaToken*
-project_load_group_properties (AmpProject *project, AnjutaToken *token, AnjutaTokenType type, AnjutaToken *list, AnjutaProjectGroup *parent)
+project_load_group_properties (AmpProject *project, AnjutaToken *token, AnjutaTokenType type, AnjutaToken *list, AnjutaProjectNode *parent)
 {
 	AmpGroupData *group = AMP_GROUP_DATA (parent);
 	gchar *value;
@@ -1576,7 +1576,7 @@ project_load_subdirs (AmpProject *project, AnjutaToken *list, AmpGroup *parent,
 			gchar *group_id;
 			AmpGroup *group;
 
-			subdir = g_file_resolve_relative_path (AMP_GROUP_DATA (parent)->base.directory, value);
+			subdir = g_file_resolve_relative_path (AMP_GROUP_DATA (parent)->base.file, value);
 			
 			/* Look for already existing group */
 			group_id = g_file_get_uri (subdir);
@@ -1611,7 +1611,7 @@ remove_config_file (gpointer data, GObject *object, gboolean is_last_ref)
 }
 
 static AmpGroup*
-project_load_makefile (AmpProject *project, GFile *file, AnjutaProjectGroup *parent, gboolean dist_only)
+project_load_makefile (AmpProject *project, GFile *file, AnjutaProjectNode *parent, gboolean dist_only)
 {
 	const gchar **filename;
 	AmpGroup *group;
@@ -1977,7 +1977,7 @@ amp_project_add_sibling_group (AmpProject  *project,
 	}
 
 	/* Check that the new group doesn't already exist */
-	directory = g_file_get_child (AMP_GROUP_DATA (parent)->base.directory, name);
+	directory = g_file_get_child (AMP_GROUP_DATA (parent)->base.file, name);
 	uri = g_file_get_uri (directory);
 	if (g_hash_table_lookup (project->groups, uri) != NULL)
 	{
@@ -2399,7 +2399,7 @@ amp_project_add_sibling_source (AmpProject  *project, AmpTarget *target, GFile *
 	if (AMP_NODE_DATA (target)->type != ANJUTA_PROJECT_TARGET) return NULL;
 	
 	group = (AmpGroup *)(target->parent);
-	relative_name = g_file_get_relative_path (AMP_GROUP_DATA (group)->base.directory, file);
+	relative_name = g_file_get_relative_path (AMP_GROUP_DATA (group)->base.file, file);
 
 	/* Add in Makefile.am */
 
@@ -2587,11 +2587,11 @@ foreach_node_move (AnjutaProjectNode *g_node, gpointer data)
 	switch (AMP_NODE_DATA (g_node)->type)
 	{
 	case ANJUTA_PROJECT_GROUP:
-		relative = get_relative_path (old_root_file, AMP_GROUP_DATA (g_node)->base.directory);
+		relative = get_relative_path (old_root_file, AMP_GROUP_DATA (g_node)->base.file);
 		new_file = g_file_resolve_relative_path (project->root_file, relative);
 		g_free (relative);
-		g_object_unref (AMP_GROUP_DATA (g_node)->base.directory);
-		AMP_GROUP_DATA (g_node)->base.directory = new_file;
+		g_object_unref (AMP_GROUP_DATA (g_node)->base.file);
+		AMP_GROUP_DATA (g_node)->base.file = new_file;
 
 		g_hash_table_insert (project->groups, g_file_get_uri (new_file), g_node);
 		break;
@@ -2767,7 +2767,7 @@ amp_project_get_node_id (AmpProject *project, const gchar *path)
 	switch (AMP_NODE_DATA (node)->type)
 	{
 		case ANJUTA_PROJECT_GROUP:
-			return g_file_get_uri (AMP_GROUP_DATA (node)->base.directory);
+			return g_file_get_uri (AMP_GROUP_DATA (node)->base.file);
 		case ANJUTA_PROJECT_TARGET:
 		case ANJUTA_PROJECT_SOURCE:
 			return g_base64_encode ((guchar *)&node, sizeof (node));
@@ -2863,20 +2863,20 @@ amp_project_set_property (AmpProject *project, AmpPropertyType type, const gchar
 /* Implement IAnjutaProject
  *---------------------------------------------------------------------------*/
 
-static AnjutaProjectGroup* 
-iproject_add_group (IAnjutaProject *obj, AnjutaProjectGroup *parent,  const gchar *name, GError **err)
+static AnjutaProjectNode* 
+iproject_add_group (IAnjutaProject *obj, AnjutaProjectNode *parent,  const gchar *name, GError **err)
 {
 	return amp_project_add_group (AMP_PROJECT (obj), AMP_GROUP (parent), name, err);
 }
 
-static AnjutaProjectSource* 
-iproject_add_source (IAnjutaProject *obj, AnjutaProjectGroup *parent,  GFile *file, GError **err)
+static AnjutaProjectNode* 
+iproject_add_source (IAnjutaProject *obj, AnjutaProjectNode *parent,  GFile *file, GError **err)
 {
 	return amp_project_add_source (AMP_PROJECT (obj), AMP_TARGET (parent), file, err);
 }
 
-static AnjutaProjectTarget* 
-iproject_add_target (IAnjutaProject *obj, AnjutaProjectGroup *parent,  const gchar *name,  AnjutaProjectTargetType type, GError **err)
+static AnjutaProjectNode* 
+iproject_add_target (IAnjutaProject *obj, AnjutaProjectNode *parent,  const gchar *name,  AnjutaProjectTargetType type, GError **err)
 {
 	return amp_project_add_target (AMP_PROJECT (obj), AMP_GROUP (parent), name, type, err);
 }
@@ -2923,7 +2923,7 @@ iproject_get_packages (IAnjutaProject *obj, GError **err)
 	return packages;
 }
 
-static AnjutaProjectGroup* 
+static AnjutaProjectNode* 
 iproject_get_root (IAnjutaProject *obj, GError **err)
 {
 	return amp_project_get_root (AMP_PROJECT (obj));
@@ -2992,7 +2992,7 @@ iproject_iface_init(IAnjutaProjectIface* iface)
 GFile*
 amp_group_get_directory (AmpGroup *group)
 {
-	return AMP_GROUP_DATA (group)->base.directory;
+	return AMP_GROUP_DATA (group)->base.file;
 }
 
 GFile*
@@ -3004,7 +3004,7 @@ amp_group_get_makefile (AmpGroup *group)
 gchar *
 amp_group_get_id (AmpGroup *group)
 {
-	return g_file_get_uri (AMP_GROUP_DATA (group)->base.directory);
+	return g_file_get_uri (AMP_GROUP_DATA (group)->base.file);
 }
 
 /* Target access functions
@@ -3019,7 +3019,7 @@ amp_target_get_name (AmpTarget *target)
 AnjutaProjectTargetType
 amp_target_get_type (AmpTarget *target)
 {
-	return AMP_TARGET_DATA (target)->base.type;
+	return AMP_TARGET_DATA (target)->base.target_type;
 }
 
 gchar *
diff --git a/plugins/am-project/am-project.h b/plugins/am-project/am-project.h
index 606ef19..8667d9c 100644
--- a/plugins/am-project/am-project.h
+++ b/plugins/am-project/am-project.h
@@ -49,9 +49,9 @@ struct _AmpProjectClass {
 	GObjectClass parent_class;
 };
 
-typedef AnjutaProjectGroup AmpGroup;
-typedef AnjutaProjectTarget AmpTarget;
-typedef AnjutaProjectSource AmpSource;
+typedef AnjutaProjectNode AmpGroup;
+typedef AnjutaProjectNode AmpTarget;
+typedef AnjutaProjectNode AmpSource;
 typedef struct _AmpProperty AmpProperty;
 
 typedef enum {
diff --git a/plugins/am-project/projectparser.c b/plugins/am-project/projectparser.c
index 57d4615..d259886 100644
--- a/plugins/am-project/projectparser.c
+++ b/plugins/am-project/projectparser.c
@@ -65,9 +65,9 @@ void print (const gchar *message, ...)
 	fputc('\n', output_stream);
 }
 
-void list_target (IAnjutaProject *project, AnjutaProjectTarget *target, gint indent, const gchar *path)
+void list_target (IAnjutaProject *project, AnjutaProjectNode *target, gint indent, const gchar *path)
 {
-	AnjutaProjectSource *source;
+	AnjutaProjectNode *source;
 	guint count = 0;
 	GFile *root;
 
@@ -91,10 +91,10 @@ void list_target (IAnjutaProject *project, AnjutaProjectTarget *target, gint ind
 	}
 }
 
-void list_group (IAnjutaProject *project, AnjutaProjectGroup *group, gint indent, const gchar *path)
+void list_group (IAnjutaProject *project, AnjutaProjectNode *group, gint indent, const gchar *path)
 {
 	AnjutaProjectNode *node;
-	AnjutaProjectGroup *parent;
+	AnjutaProjectNode *parent;
 	guint count;
 	gchar *rel_path;
 	
@@ -242,9 +242,9 @@ get_node (IAnjutaProject *project, const char *path)
 }
 
 static GFile *
-get_file (AnjutaProjectTarget *target, const char *id)
+get_file (AnjutaProjectNode *target, const char *id)
 {
-	AnjutaProjectGroup *group = (AnjutaProjectGroup *)anjuta_project_node_parent (target);
+	AnjutaProjectNode *group = (AnjutaProjectNode *)anjuta_project_node_parent (target);
 	
 	return g_file_resolve_relative_path (anjuta_project_group_get_directory (group), id);
 }
diff --git a/plugins/mk-project/mk-project.c b/plugins/mk-project/mk-project.c
index 496994f..c0da31b 100644
--- a/plugins/mk-project/mk-project.c
+++ b/plugins/mk-project/mk-project.c
@@ -80,7 +80,7 @@ typedef enum {
 typedef struct _MkpGroupData MkpGroupData;
 
 struct _MkpGroupData {
-	AnjutaProjectGroupData base;		/* Common node data */
+	AnjutaProjectNodeData base;		/* Common node data */
 	gboolean dist_only;			/* TRUE if the group is distributed but not built */
 	GFile *makefile;				/* GFile corresponding to group makefile */
 	AnjutaTokenFile *tfile;		/* Corresponding Makefile */
@@ -102,7 +102,7 @@ typedef enum _MkpTargetFlag
 typedef struct _MkpTargetData MkpTargetData;
 
 struct _MkpTargetData {
-	AnjutaProjectTargetData base;
+	AnjutaProjectNodeData base;
 	gchar *install;
 	gint flags;
 	GList* tokens;
@@ -111,7 +111,7 @@ struct _MkpTargetData {
 typedef struct _MkpSourceData MkpSourceData;
 
 struct _MkpSourceData {
-	AnjutaProjectSourceData base;
+	AnjutaProjectNodeData base;
 	AnjutaToken* token;
 };
 
@@ -313,8 +313,8 @@ mkp_group_new (GFile *file)
 	g_return_val_if_fail (file != NULL, NULL);
 	
 	group = g_slice_new0(MkpGroupData); 
-	group->base.node.type = ANJUTA_PROJECT_GROUP;
-	group->base.directory = g_object_ref (file);
+	group->base.type = ANJUTA_PROJECT_GROUP;
+	group->base.file = g_object_ref (file);
 
     return g_node_new (group);
 }
@@ -325,7 +325,7 @@ mkp_group_free (MkpGroup *node)
     MkpGroupData *group = (MkpGroupData *)node->data;
 	gint i;
 	
-	if (group->base.directory) g_object_unref (group->base.directory);
+	if (group->base.file) g_object_unref (group->base.file);
 	if (group->tfile) anjuta_token_file_free (group->tfile);
 	if (group->makefile) g_object_unref (group->makefile);
 	for (i = 0; i < AM_GROUP_TOKEN_LAST; i++)
@@ -369,10 +369,10 @@ mkp_target_new (const gchar *name, AnjutaProjectTargetType type)
     MkpTargetData *target = NULL;
 
 	target = g_slice_new0(MkpTargetData);
-	target->base.node.type = ANJUTA_PROJECT_TARGET;
+	target->base.type = ANJUTA_PROJECT_TARGET;
 	target->base.name = g_strdup (name);
 	if (type == NULL) type = (AnjutaProjectTargetType)&MkpTargetTypes[0];
-	target->base.type = type;
+	target->base.target_type = type;
 
     return g_node_new (target);
 }
@@ -398,7 +398,7 @@ mkp_source_new (GFile *file)
     MkpSourceData *source = NULL;
 
 	source = g_slice_new0(MkpSourceData); 
-	source->base.node.type = ANJUTA_PROJECT_SOURCE;
+	source->base.type = ANJUTA_PROJECT_SOURCE;
 	source->base.file = g_object_ref (file);
 
     return g_node_new (source);
@@ -498,7 +498,7 @@ group_hash_foreach_monitor (gpointer key,
 	MkpGroup *group_node = value;
 	MkpProject *project = user_data;
 
-	monitor_add (project, MKP_GROUP_DATA(group_node)->base.directory);
+	monitor_add (project, MKP_GROUP_DATA(group_node)->base.file);
 }
 
 static void
@@ -529,7 +529,7 @@ mkp_dump_node (AnjutaProjectNode *g_node)
 	
 	switch (MKP_NODE_DATA (g_node)->type) {
 		case ANJUTA_PROJECT_GROUP:
-			name = g_file_get_uri (MKP_GROUP_DATA (g_node)->base.directory);
+			name = g_file_get_uri (MKP_GROUP_DATA (g_node)->base.file);
 			DEBUG_PRINT ("GROUP: %s", name);
 			break;
 		case ANJUTA_PROJECT_TARGET:
@@ -586,14 +586,14 @@ project_node_destroy (MkpProject *project, AnjutaProjectNode *g_node)
 }
 
 static void
-find_target (AnjutaProjectTarget *node, gpointer data)
+find_target (AnjutaProjectNode *node, gpointer data)
 {
 	if (MKP_NODE_DATA (node)->type == ANJUTA_PROJECT_TARGET)
 	{
 		if (strcmp (MKP_TARGET_DATA (node)->base.name, *(gchar **)data) == 0)
 		{
 			/* Find target, return node value in pointer */
-			*(AnjutaProjectTarget **)data = node;
+			*(AnjutaProjectNode **)data = node;
 
 			return;
 		}
@@ -754,7 +754,7 @@ mkp_project_get_node_id (MkpProject *project, const gchar *path)
 	switch (MKP_NODE_DATA (node)->type)
 	{
 		case ANJUTA_PROJECT_GROUP:
-			return g_file_get_uri (MKP_GROUP_DATA (node)->base.directory);
+			return g_file_get_uri (MKP_GROUP_DATA (node)->base.file);
 		case ANJUTA_PROJECT_TARGET:
 		case ANJUTA_PROJECT_SOURCE:
 			return g_base64_encode ((guchar *)&node, sizeof (node));
@@ -820,7 +820,7 @@ mkp_project_get_token_location (MkpProject *project, AnjutaTokenFileLocation *lo
 GFile*
 mkp_group_get_directory (MkpGroup *group)
 {
-	return MKP_GROUP_DATA (group)->base.directory;
+	return MKP_GROUP_DATA (group)->base.file;
 }
 
 GFile*
@@ -832,7 +832,7 @@ mkp_group_get_makefile (MkpGroup *group)
 gchar *
 mkp_group_get_id (MkpGroup *group)
 {
-	return g_file_get_uri (MKP_GROUP_DATA (group)->base.directory);
+	return g_file_get_uri (MKP_GROUP_DATA (group)->base.file);
 }
 
 /* Target access functions
@@ -847,7 +847,7 @@ mkp_target_get_name (MkpTarget *target)
 AnjutaProjectTargetType
 mkp_target_get_type (MkpTarget *target)
 {
-	return MKP_TARGET_DATA (target)->base.type;
+	return MKP_TARGET_DATA (target)->base.target_type;
 }
 
 gchar *
@@ -1175,11 +1175,11 @@ mkp_project_move (MkpProject *project, const gchar *path)
 	{
 		MkpGroup *group = (MkpGroup *)value;
 		
-		relative = get_relative_path (old_root_file, MKP_GROUP_DATA (group)->base.directory);
+		relative = get_relative_path (old_root_file, MKP_GROUP_DATA (group)->base.file);
 		new_file = g_file_resolve_relative_path (project->root_file, relative);
 		g_free (relative);
-		g_object_unref (MKP_GROUP_DATA (group)->base.directory);
-		MKP_GROUP_DATA (group)->base.directory = new_file;
+		g_object_unref (MKP_GROUP_DATA (group)->base.file);
+		MKP_GROUP_DATA (group)->base.file = new_file;
 
 		g_hash_table_insert (project->groups, g_file_get_uri (new_file), group);
 	}
@@ -1216,20 +1216,20 @@ mkp_project_new (void)
 /* Implement IAnjutaProject
  *---------------------------------------------------------------------------*/
 
-static AnjutaProjectGroup* 
-iproject_add_group (IAnjutaProject *obj, AnjutaProjectGroup *parent,  const gchar *name, GError **err)
+static AnjutaProjectNode* 
+iproject_add_group (IAnjutaProject *obj, AnjutaProjectNode *parent,  const gchar *name, GError **err)
 {
 	return NULL;
 }
 
-static AnjutaProjectSource* 
-iproject_add_source (IAnjutaProject *obj, AnjutaProjectTarget *parent,  GFile *file, GError **err)
+static AnjutaProjectNode* 
+iproject_add_source (IAnjutaProject *obj, AnjutaProjectNode *parent,  GFile *file, GError **err)
 {
 	return NULL;
 }
 
-static AnjutaProjectTarget* 
-iproject_add_target (IAnjutaProject *obj, AnjutaProjectGroup *parent,  const gchar *name,  AnjutaProjectTargetType type, GError **err)
+static AnjutaProjectNode* 
+iproject_add_target (IAnjutaProject *obj, AnjutaProjectNode *parent,  const gchar *name,  AnjutaProjectTargetType type, GError **err)
 {
 	return NULL;
 }
@@ -1252,7 +1252,7 @@ iproject_get_packages (IAnjutaProject *obj, GError **err)
 	return NULL;
 }
 
-static AnjutaProjectGroup* 
+static AnjutaProjectNode* 
 iproject_get_root (IAnjutaProject *obj, GError **err)
 {
 	return mkp_project_get_root (MKP_PROJECT (obj));
diff --git a/plugins/mk-project/mk-project.h b/plugins/mk-project/mk-project.h
index b1d4b88..2367c16 100644
--- a/plugins/mk-project/mk-project.h
+++ b/plugins/mk-project/mk-project.h
@@ -50,9 +50,9 @@ struct _MkpProjectClass {
 	GObjectClass parent_class;
 };
 
-typedef AnjutaProjectGroup MkpGroup;
-typedef AnjutaProjectTarget MkpTarget;
-typedef AnjutaProjectSource MkpSource;
+typedef AnjutaProjectNode MkpGroup;
+typedef AnjutaProjectNode MkpTarget;
+typedef AnjutaProjectNode MkpSource;
 typedef struct _MkpProperty MkpProperty;
 typedef struct _MkpVariable MkpVariable;
 typedef struct _MkpRule MkpRule;
diff --git a/plugins/mk-project/mk-rule.c b/plugins/mk-project/mk-rule.c
index cbad543..09d440c 100644
--- a/plugins/mk-project/mk-rule.c
+++ b/plugins/mk-project/mk-rule.c
@@ -72,7 +72,7 @@ mkp_rule_free (MkpRule *rule)
  * return target, else free target and return a newly allocated source name */
 
 gchar *
-mkp_project_find_source (MkpProject *project, gchar *target, AnjutaProjectGroup *parent, guint backtrack)
+mkp_project_find_source (MkpProject *project, gchar *target, AnjutaProjectNode *parent, guint backtrack)
 {
 	GFile *child;
 	gboolean exist;
@@ -264,7 +264,7 @@ mkp_project_add_rule (MkpProject *project, AnjutaToken *group)
  *---------------------------------------------------------------------------*/
 
 void
-mkp_project_enumerate_targets (MkpProject *project, AnjutaProjectGroup *parent)
+mkp_project_enumerate_targets (MkpProject *project, AnjutaProjectNode *parent)
 {
 	GHashTableIter iter;
 	gpointer key;



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