[anjuta/newproject] am: Use new interface for adding a source in checks



commit d443881c816560c5306174f97c4458e1f984a232
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Thu Sep 9 21:59:09 2010 +0200

    am: Use new interface for adding a source in checks

 libanjuta/anjuta-project.c         |    4 ++++
 plugins/am-project/projectparser.c |   15 +++++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/libanjuta/anjuta-project.c b/libanjuta/anjuta-project.c
index bcaf9fd..a77592e 100644
--- a/libanjuta/anjuta-project.c
+++ b/libanjuta/anjuta-project.c
@@ -280,12 +280,16 @@ anjuta_project_node_append (AnjutaProjectNode *parent, AnjutaProjectNode *node)
 AnjutaProjectNode *
 anjuta_project_node_insert_before (AnjutaProjectNode *parent, AnjutaProjectNode *sibling, AnjutaProjectNode *node)
 {
+	/* node->parent is filled by the new function */
+	if (node->parent != NULL) node->parent = NULL;
 	return g_node_insert_before (parent, sibling, node);
 }
 
 AnjutaProjectNode *
 anjuta_project_node_insert_after (AnjutaProjectNode *parent, AnjutaProjectNode *sibling, AnjutaProjectNode *node)
 {
+	/* node->parent is filled by the new function */
+	if (node->parent != NULL) node->parent = NULL;
 	return g_node_insert_after (parent, sibling, node);
 }
 
diff --git a/plugins/am-project/projectparser.c b/plugins/am-project/projectparser.c
index 20c998b..5997299 100644
--- a/plugins/am-project/projectparser.c
+++ b/plugins/am-project/projectparser.c
@@ -483,6 +483,7 @@ main(int argc, char *argv[])
 {
 	IAnjutaProject *project = NULL;
 	AnjutaProjectNode *node;
+	AnjutaProjectNode *child;
 	AnjutaProjectNode *sibling;
 	AnjutaProjectNode *root = NULL;
 	char **command;
@@ -540,7 +541,7 @@ main(int argc, char *argv[])
 				}
 			}
 
-			root = ianjuta_project_new_root_node (project, file, &error);
+			root = ianjuta_project_new_node (project, NULL, ANJUTA_PROJECT_ROOT, file, NULL, &error);
 			root = ianjuta_project_load_node (project, root, &error);
 			g_object_unref (file);
 		}
@@ -614,18 +615,24 @@ main(int argc, char *argv[])
 				if ((command[4] != NULL) && (g_ascii_strcasecmp (command[4], "before") == 0))
 				{
 					sibling = get_file (project, command[5]);
-					amp_project_add_sibling_source (project, node, file, FALSE, sibling, NULL);
+					child = ianjuta_project_new_node (project, node, ANJUTA_PROJECT_SOURCE, file, NULL, &error);
+					anjuta_project_node_insert_before (node, sibling, child);
+					ianjuta_project_save_node (project, child, NULL);
 					command += 2;
 				}
 				else if ((command[4] != NULL) && (g_ascii_strcasecmp (command[4], "after") == 0))
 				{
 					sibling = get_node (project, root, command[5]);
-					amp_project_add_sibling_source (project, node, file, TRUE, sibling, NULL);
+					child = ianjuta_project_new_node (project, node, ANJUTA_PROJECT_SOURCE, file, NULL, &error);
+					anjuta_project_node_insert_after (node, sibling, child);
+					ianjuta_project_save_node (project, child, NULL);
 					command += 2;
 				}
 				else
 				{
-					ianjuta_project_add_source (project, node, file, NULL);
+					child = ianjuta_project_new_node (project, node, ANJUTA_PROJECT_SOURCE, file, NULL, &error);
+					anjuta_project_node_insert_after (node, NULL, child);
+					ianjuta_project_save_node (project, child, NULL);
 				}
 				g_object_unref (file);
 			}



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