[anjuta] Replace GbfProject with AnjutaProject



commit 05491a667a92bc5fbc0135bd344a691d81d2c217
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Fri Jan 1 10:21:21 2010 +0100

    Replace GbfProject with AnjutaProject

 libanjuta/Makefile.am                       |    5 +-
 libanjuta/anjuta-project.c                  |  364 +++++++++++
 libanjuta/anjuta-project.h                  |  140 +++++
 libanjuta/interfaces/libanjuta.idl          |  254 +++++++-
 libanjuta/libanjuta.h                       |    1 +
 plugins/build-basic-autotools/executer.c    |    4 +-
 plugins/class-gen/plugin.c                  |    6 +-
 plugins/debug-manager/start.c               |    9 +-
 plugins/file-wizard/file.c                  |    7 +-
 plugins/gbf-am/gbf-am-project.c             |  438 +++++++++++++-
 plugins/gbf-am/gbf-am-project.h             |   15 +-
 plugins/gbf-am/plugin.c                     |   20 +-
 plugins/gbf-mkfile/gbf-mkfile-project.c     |   22 +
 plugins/gbf-mkfile/gbf-mkfile-project.h     |    3 +
 plugins/gbf-mkfile/plugin.c                 |   15 +-
 plugins/glade/plugin.c                      |    5 +-
 plugins/project-manager/gbf-project-model.c |  306 ++++++----
 plugins/project-manager/gbf-project-model.h |   23 +-
 plugins/project-manager/gbf-project-util.c  |  216 ++++---
 plugins/project-manager/gbf-project-util.h  |   51 +-
 plugins/project-manager/gbf-project-view.c  |   54 +-
 plugins/project-manager/gbf-project-view.h  |   13 +-
 plugins/project-manager/gbf-tree-data.c     |   73 ++-
 plugins/project-manager/gbf-tree-data.h     |   35 +-
 plugins/project-manager/plugin.c            |  870 ++++++++++++---------------
 plugins/project-manager/plugin.h            |    5 +-
 plugins/run-program/parameters.c            |    2 +-
 plugins/search/search-replace_backend.c     |    2 +-
 plugins/symbol-db/plugin.c                  |    4 +-
 plugins/symbol-db/test-queries/Makefile.am  |    1 +
 30 files changed, 2064 insertions(+), 899 deletions(-)
---
diff --git a/libanjuta/Makefile.am b/libanjuta/Makefile.am
index a3f7d2d..6d683ea 100644
--- a/libanjuta/Makefile.am
+++ b/libanjuta/Makefile.am
@@ -79,7 +79,10 @@ libanjuta_la_SOURCES= \
 	gbf-project.c \
 	gbf-project.h \
 	anjuta-command-queue.c \
-	anjuta-command-queue.h
+	anjuta-command-queue.h \
+	anjuta-project.c \
+	anjuta-project.h
+
 
 if HAVE_PLUGIN_GLADE
 
diff --git a/libanjuta/anjuta-project.c b/libanjuta/anjuta-project.c
new file mode 100644
index 0000000..556fd4e
--- /dev/null
+++ b/libanjuta/anjuta-project.c
@@ -0,0 +1,364 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta-project.c
+ * Copyright (C) Sébastien Granjoux 2009 <seb sfo free fr>
+ * 
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "anjuta-project.h"
+
+#include "anjuta-debug.h"
+
+#include <string.h>
+
+/**
+ * SECTION:anjuta-project
+ * @title: Anjuta project
+ * @short_description: Anjuta project
+ * @see_also: 
+ * @stability: Unstable
+ * @include: libanjuta/anjuta-project.h
+ * 
+ * A project in Anjuta is represented by a tree. There are three kinds of node.
+ * 
+ * A source node represents a source file. These are lead of the tree, a source
+ * node cannot have children.
+ *
+ * A target node represents an object file defined explicitely.
+ * There are different kinds of target: program, library...
+ * A target have as children all source needed to build it.
+ *
+ * A group node is used to group several target or source, it can represent
+ * a directory by example. The root node of the project is a group node
+ * representing the project directory.
+ *
+ * All these nodes are base objects. They have derived in each project backend
+ * to provide more specific information.
+ */ 
+
+/* 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)
+
+
+/* Node access functions
+ *---------------------------------------------------------------------------*/
+
+AnjutaProjectNode *
+anjuta_project_node_parent(AnjutaProjectNode *node)
+{
+	return node->parent;
+}
+
+AnjutaProjectNode *
+anjuta_project_node_first_child(AnjutaProjectNode *node)
+{
+	return g_node_first_child (node);
+}
+
+AnjutaProjectNode *
+anjuta_project_node_last_child(AnjutaProjectNode *node)
+{
+	return g_node_last_child (node);
+}
+
+AnjutaProjectNode *
+anjuta_project_node_next_sibling (AnjutaProjectNode *node)
+{
+	return g_node_next_sibling (node);
+}
+
+AnjutaProjectNode *
+anjuta_project_node_prev_sibling (AnjutaProjectNode *node)
+{
+	return g_node_prev_sibling (node);
+}
+
+AnjutaProjectNode *anjuta_project_node_nth_child (AnjutaProjectNode *node, guint n)
+{
+	return g_node_nth_child (node, n);
+}
+
+typedef struct
+{
+	AnjutaProjectNodeFunc func;
+	gpointer data;
+} AnjutaProjectNodePacket;
+
+static gboolean
+anjuta_project_node_traverse_func (GNode *node, gpointer data)
+{
+	AnjutaProjectNodePacket *pack = (AnjutaProjectNodePacket *)data;
+	
+	pack->func ((AnjutaProjectNode *)node, pack->data);
+
+	return FALSE;
+}
+
+void
+anjuta_project_node_all_foreach (AnjutaProjectNode *node, AnjutaProjectNodeFunc func, gpointer data)
+{
+    AnjutaProjectNodePacket pack = {func, data};
+	
+	/* POST_ORDER is important when deleting the node, children has to be
+	 * deleted first */
+	g_node_traverse (node, G_POST_ORDER, G_TRAVERSE_ALL, -1, anjuta_project_node_traverse_func, &pack);
+}
+
+void
+anjuta_project_node_children_foreach (AnjutaProjectNode *node, AnjutaProjectNodeFunc func, gpointer data)
+{
+	g_node_children_foreach (node, G_TRAVERSE_ALL, func, data);
+}
+
+AnjutaProjectNode *
+anjuta_project_node_append (AnjutaProjectNode *parent, AnjutaProjectNode *node)
+{
+	return g_node_append (parent, node);
+}
+
+AnjutaProjectNode *
+anjuta_project_node_insert_before (AnjutaProjectNode *parent, AnjutaProjectNode *sibling, AnjutaProjectNode *node)
+{
+	return g_node_insert_before (parent, sibling, node);
+}
+
+AnjutaProjectNode *
+anjuta_project_node_insert_after (AnjutaProjectNode *parent, AnjutaProjectNode *sibling, AnjutaProjectNode *node)
+{
+	return g_node_insert_after (parent, sibling, node);
+}
+
+AnjutaProjectNode *
+anjuta_project_node_prepend (AnjutaProjectNode *parent, AnjutaProjectNode *node)
+{
+	return g_node_prepend (parent, node);
+}
+
+
+AnjutaProjectNodeType
+anjuta_project_node_get_type (const AnjutaProjectNode *node)
+{
+	return NODE_DATA (node)->type;
+}
+
+gchar *
+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);
+	case ANJUTA_PROJECT_TARGET:
+		return g_strdup (TARGET_DATA (node)->name);
+	case ANJUTA_PROJECT_SOURCE:
+		return g_file_get_basename (SOURCE_DATA (node)->file);
+	default:
+		return NULL;
+	}
+}
+
+gchar*
+anjuta_project_node_get_uri (AnjutaProjectNode *node)
+{
+	AnjutaProjectGroup *parent;
+	GFile *file;
+	gchar *uri;
+	
+	switch (NODE_DATA (node)->type)
+	{
+	case ANJUTA_PROJECT_GROUP:
+		uri = g_file_get_uri (GROUP_DATA (node)->directory);
+		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));
+		uri = g_file_get_uri (file);
+		g_object_unref (file);
+		break;
+	case ANJUTA_PROJECT_SOURCE:
+		uri = g_file_get_uri (SOURCE_DATA (node)->file);
+		break;
+	default:
+		uri = NULL;
+		break;
+	}
+
+	return uri;
+}
+
+/* Group access functions
+ *---------------------------------------------------------------------------*/
+
+GFile*
+anjuta_project_group_get_directory (const AnjutaProjectGroup *group)
+{
+	return GROUP_DATA (group)->directory;
+}
+
+static gboolean
+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))
+	{
+		*(AnjutaProjectNode **)data = node;
+
+		return TRUE;
+	}
+	else
+	{
+		return FALSE;
+	}
+}
+
+AnjutaProjectGroup *
+anjuta_project_group_get_node_from_file (const AnjutaProjectGroup *root, GFile *directory)
+{
+	GFile *data;
+	
+	data = directory;
+	g_node_traverse	(root, G_PRE_ORDER, G_TRAVERSE_ALL, -1, anjuta_project_group_compare, &data);
+
+	return (data == directory) ? NULL : (AnjutaProjectNode *)data;
+}
+
+AnjutaProjectGroup *
+anjuta_project_group_get_node_from_uri (const AnjutaProjectNode *root, const gchar *uri)
+{
+	GFile *file = g_file_new_for_uri (uri);
+	AnjutaProjectGroup *node;
+
+	node = anjuta_project_group_get_node_from_file (root, file);
+	g_object_unref (file);
+
+	return node;
+}
+
+static gboolean
+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))
+	{
+		*(AnjutaProjectNode **)data = node;
+
+		return TRUE;
+	}
+	else
+	{
+		return FALSE;
+	}
+}
+
+AnjutaProjectTarget *
+anjuta_project_target_get_node_from_name (const AnjutaProjectGroup *parent, const gchar *name)
+{
+	const gchar *data;
+	
+	data = name;
+	g_node_traverse	(parent, G_PRE_ORDER, G_TRAVERSE_ALL, 2, anjuta_project_target_compare, &data);
+
+	return (data == name) ? NULL : (AnjutaProjectTarget *)data;
+}
+
+static gboolean
+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))
+	{
+		*(AnjutaProjectNode **)data = node;
+
+		return TRUE;
+	}
+	else
+	{
+		return FALSE;
+	}
+}
+
+AnjutaProjectSource *
+anjuta_project_source_get_node_from_file (const AnjutaProjectNode *parent, GFile *file)
+{
+	GFile *data;
+	
+	data = file;
+	g_node_traverse	(parent, G_PRE_ORDER, G_TRAVERSE_ALL, 2, anjuta_project_source_compare, &data);
+
+	return (data == file) ? NULL : (AnjutaProjectNode *)data;
+}
+
+AnjutaProjectSource *
+anjuta_project_source_get_node_from_uri (const AnjutaProjectNode *parent, const gchar *uri)
+{
+	GFile *file = g_file_new_for_uri (uri);
+	AnjutaProjectSource *node;
+
+	node = anjuta_project_source_get_node_from_file (parent, file);
+	g_object_unref (file);
+
+	return node;
+}
+
+/* Target access functions
+ *---------------------------------------------------------------------------*/
+
+const gchar *
+anjuta_project_target_get_name (const AnjutaProjectTarget *target)
+{
+	return TARGET_DATA (target)->name;
+}
+
+AnjutaProjectTargetType
+anjuta_project_target_get_type (const AnjutaProjectTarget *target)
+{
+	return TARGET_DATA (target)->type;
+}
+
+/* Source access functions
+ *---------------------------------------------------------------------------*/
+
+GFile*
+anjuta_project_source_get_file (const AnjutaProjectSource *source)
+{
+	return SOURCE_DATA (source)->file;
+}
+
+/* Target type functions
+ *---------------------------------------------------------------------------*/
+
+const gchar *
+anjuta_project_target_type_name (const AnjutaProjectTargetType type)
+{
+	return type->name;
+}
+
+const gchar *   
+anjuta_project_target_type_mime (const AnjutaProjectTargetType type)
+{
+	return type->mime_type;
+}
+
+AnjutaProjectTargetClass
+anjuta_project_target_type_class (const AnjutaProjectTargetType type)
+{
+	return type->base;
+}
diff --git a/libanjuta/anjuta-project.h b/libanjuta/anjuta-project.h
new file mode 100644
index 0000000..0cd9294
--- /dev/null
+++ b/libanjuta/anjuta-project.h
@@ -0,0 +1,140 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta-project.h
+ * Copyright (C) Sébastien Granjoux 2009 <seb sfo free fr>
+ * 
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _ANJUTA_PROJECT_H_
+#define _ANJUTA_PROJECT_H_
+
+#include <glib.h>
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define ANJUTA_IS_PROJECT_GROUP(obj) (((AnjutaProjectNodeData *)obj->data)->type == ANJUTA_PROJECT_GROUP)
+#define ANJUTA_IS_PROJECT_TARGET(obj) (((AnjutaProjectNodeData *)obj->data)->type == ANJUTA_PROJECT_TARGET)
+#define ANJUTA_IS_PROJECT_NODE(obj) (1)
+
+typedef enum
+{
+	ANJUTA_PROJECT_UNKNOWN,
+	ANJUTA_PROJECT_GROUP,
+	ANJUTA_PROJECT_TARGET,
+	ANJUTA_PROJECT_SOURCE,
+	ANJUTA_PROJECT_VARIABLE
+} AnjutaProjectNodeType;
+	
+typedef enum
+{
+	ANJUTA_TARGET_UNKNOWN,
+	ANJUTA_TARGET_SHAREDLIB,
+	ANJUTA_TARGET_STATICLIB,
+	ANJUTA_TARGET_EXECUTABLE,
+	ANJUTA_TARGET_PYTHON,
+	ANJUTA_TARGET_JAVA,
+	ANJUTA_TARGET_LISP,
+	ANJUTA_TARGET_HEADER,
+	ANJUTA_TARGET_MAN,
+	ANJUTA_TARGET_INFO,
+	ANJUTA_TARGET_GENERIC,
+	ANJUTA_TARGET_DATA,
+	ANJUTA_TARGET_EXTRA,
+	ANJUTA_TARGET_INTLTOOL,
+	ANJUTA_TARGET_CONFIGURE,
+	ANJUTA_TARGET_IDL,
+	ANJUTA_TARGET_MKENUMS,
+	ANJUTA_TARGET_GENMARSHAL
+} AnjutaProjectTargetClass;
+
+typedef struct 
+{
+	gchar *name;
+	AnjutaProjectTargetClass base;
+	gchar *mime_type;
+} AnjutaProjectTargetInformation;
+
+typedef AnjutaProjectTargetInformation* AnjutaProjectTargetType;
+
+typedef struct
+{
+	AnjutaProjectNodeType type;
+} AnjutaProjectNodeData;
+
+typedef struct {
+	AnjutaProjectNodeData node;
+	GFile *directory;
+} AnjutaProjectGroupData;
+
+typedef struct {
+	AnjutaProjectNodeData node;
+	gchar *name;
+	AnjutaProjectTargetType type;
+} AnjutaProjectTargetData;
+
+typedef struct {
+	AnjutaProjectNodeData node;
+	GFile *file;
+} AnjutaProjectSourceData;
+
+typedef GNode AnjutaProjectNode;
+typedef GNode AnjutaProjectGroup;
+typedef GNode AnjutaProjectTarget;
+typedef GNode AnjutaProjectSource;
+
+#define ANJUTA_PROJECT_NODE_DATA(node)  ((node) != NULL ? (AnjutaProjectNodeData *)((node)->data) : NULL)
+
+typedef void (*AnjutaProjectNodeFunc) (AnjutaProjectNode *node, gpointer data);
+
+AnjutaProjectNode *anjuta_project_node_parent (AnjutaProjectNode *node);
+AnjutaProjectNode *anjuta_project_node_first_child (AnjutaProjectNode *node);
+AnjutaProjectNode *anjuta_project_node_last_child (AnjutaProjectNode *node);
+AnjutaProjectNode *anjuta_project_node_next_sibling (AnjutaProjectNode *node);
+AnjutaProjectNode *anjuta_project_node_prev_sibling (AnjutaProjectNode *node);
+AnjutaProjectNode *anjuta_project_node_nth_child (AnjutaProjectNode *node, guint n);
+
+AnjutaProjectNode *anjuta_project_node_append (AnjutaProjectNode *parent, AnjutaProjectNode *node);
+AnjutaProjectNode *anjuta_project_node_prepend (AnjutaProjectNode *parent, AnjutaProjectNode *node);
+AnjutaProjectNode *anjuta_project_node_insert_before (AnjutaProjectNode *parent, AnjutaProjectNode *sibling, AnjutaProjectNode *node);
+AnjutaProjectNode *anjuta_project_node_insert_after (AnjutaProjectNode *parent, AnjutaProjectNode *sibling, AnjutaProjectNode *node);
+
+void anjuta_project_node_all_foreach (AnjutaProjectNode *node, AnjutaProjectNodeFunc func, gpointer data);
+void anjuta_project_node_children_foreach (AnjutaProjectNode *node, AnjutaProjectNodeFunc func, gpointer data);
+
+AnjutaProjectNodeType anjuta_project_node_get_type (const AnjutaProjectNode *node);
+gchar *anjuta_project_node_get_name (const AnjutaProjectNode *node);
+gchar *anjuta_project_node_get_uri (AnjutaProjectNode *node);
+
+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);
+
+GFile *anjuta_project_group_get_directory (const AnjutaProjectGroup *group);
+
+const gchar *anjuta_project_target_get_name (const AnjutaProjectTarget *target);
+AnjutaProjectTargetType anjuta_project_target_get_type (const AnjutaProjectTarget *target);
+
+GFile *anjuta_project_source_get_file (const AnjutaProjectSource *source);
+
+const gchar *anjuta_project_target_type_name (const AnjutaProjectTargetType type);
+const gchar *anjuta_project_target_type_mime (const AnjutaProjectTargetType type);
+AnjutaProjectTargetClass anjuta_project_target_type_class (const AnjutaProjectTargetType type);
+
+G_END_DECLS
+
+#endif
diff --git a/libanjuta/interfaces/libanjuta.idl b/libanjuta/interfaces/libanjuta.idl
index 0fca726..4365d36 100644
--- a/libanjuta/interfaces/libanjuta.idl
+++ b/libanjuta/interfaces/libanjuta.idl
@@ -3033,6 +3033,199 @@ interface IAnjutaTerminal
 }
 
 /**
+ * SECTION:ianjuta-project
+ * @title: IAnjutaProject
+ * @short_description: Interface implemented by project backend
+ * @see_also: 
+ * @stability: Unstable
+ * @include: libanjuta/interfaces/ianjuta-project-backend.h
+ * 
+ * This is the new interface that is replacing Gnome Build.
+ */
+interface IAnjutaProject
+{
+	#include <libanjuta/anjuta-project.h>
+	#include <gtk/gtk.h>
+
+	/* Types */
+	enum Error
+	{
+		ERROR_SUCCESS = 0,
+		ERROR_DOESNT_EXIST,
+		ERROR_ALREADY_EXISTS,
+		ERROR_VALIDATION_FAILED,
+		ERROR_PROJECT_MALFORMED,
+		ERROR_GENERAL_FAILURE
+	}
+
+	enum Probe
+		PROBE_FILES = 10,
+		PROBE_MAKE_FILES = 100,
+		PROBE_PROJECT_FILES = 200
+	}
+
+	enum Capabilities
+	{
+		CAN_ADD_NONE	= 0,
+		CAN_ADD_GROUP	= 1 << 0,
+		CAN_ADD_TARGET	= 1 << 1,
+		CAN_ADD_SOURCE	= 1 << 2,
+		HAS_PACKAGES	= 1 << 3
+	}
+	
+	/* Signals */
+	
+	/**
+	* IAnjutaProject::project_updated:
+	* @obj: Self
+	* 
+	* This signal is emitted when the project is changed.
+	*/
+	void ::project_updated ();
+
+	/**
+	 * ianjuta_project_load:
+	 * @obj: Self
+	 * @file: Project directory
+	 * @err: Error propagation and reporting
+	 *
+	 * Load a project
+	 *
+	 * Return value: TRUE is loaded without errors
+	 */
+	gboolean load (GFile *file);
+
+	/**
+	 * ianjuta_project_refresh:
+	 * @obj: Self
+	 * @err: Error propagation and reporting
+	 *
+	 * Reload the current project
+	 *
+	 * Return value: TRUE is loaded without errors
+	 */
+	gboolean refresh ();
+
+	/**
+	* ianjuta_project_get_capabilities:
+	* @obj: Self
+	* @err: Error propagation and reporting.
+	*
+	* Returns the capabilites of project whether it can add group, target
+	* sources etc.
+	*
+	* Returns: Supported capabilites.
+	*/
+	guint get_capabilities ();
+
+	/*
+	 * ianjuta_project_get_target_types
+	 * @obj: Self
+	 * @err: Error propagation and reporting.
+	 *
+	 * Returns: the list of supported target types
+	 */
+	List<AnjutaProjectTargetType> get_target_types();
+	
+	/**
+	* ianjuta_project_configure:
+	* @obj: Self
+	* @err: Error propagation and reporting.
+	*
+	* Return a widget that can be use to set any options needed by the project
+	*
+	* Returns: A GtkWidget
+	*/
+	GtkWidget* configure ();
+	
+	/**
+	* ianjuta_project_get_root:
+	* @obj: Self
+	* @err: Error propagation and reporting.
+	*
+	* Get the root node of the project (always a group)
+	*
+	* Returns: The new group or NULL on error.
+	*/
+	AnjutaProjectGroup* get_root ();
+
+	/*
+	 * ianjuta_project_get_packages
+	 * @obj: Self
+	 * @err: Error propagation and reporting.
+	 *
+	 * Returns: the list of pkg-config packages that the current project
+	 * requires in it's configure.ac. Can be NULL if there is no project
+	 * opened currently or no package is required.
+	 */
+	List<gchar*> get_packages();
+	
+	/**
+	* ianjuta_project_add_group:
+	* @obj: Self
+	* @parent: parent group
+	* @name: new group name
+	* @err: Error propagation and reporting.
+	*
+	* Create a new group, parent can be NULL.
+	*
+	* Returns: The new group or NULL on error.
+	*/
+	AnjutaProjectGroup* add_group (AnjutaProjectGroup *parent, const gchar *name);
+
+	/**
+	* ianjuta_project_add_target:
+	* @obj: Self
+	* @parent: parent group
+	* @name: new target name
+	* @type: new target type
+	* @err: Error propagation and reporting.
+	*
+	* Create a new target, parent cannot be NULL
+	*
+	* Returns: The new target or NULL on error.
+	*/
+	AnjutaProjectTarget* add_target (AnjutaProjectGroup *parent, const gchar *name, AnjutaProjectTargetType type);
+
+	/**
+	* ianjuta_project_add_source:
+	* @obj: Self
+	* @parent: parent target
+	* @file: source file
+	* @err: Error propagation and reporting.
+	*
+	* Create a new source, parent cannot be NULL
+	*
+	* Returns: The new source or NULL on error.
+	*/
+	AnjutaProjectSource* add_source (AnjutaProjectTarget *parent, GFile *file);
+
+	/**
+	* ianjuta_project_remove_node:
+	* @obj: Self
+	* @node: node to configure
+	* @err: Error propagation and reporting.
+	*
+	* Remove a node (a group, a target or a source) from the project.
+	*
+	* Returns: TRUE if the node has been removed
+	*/
+	gboolean remove_node (AnjutaProjectNode *node);
+
+	/**
+	* ianjuta_project_configure_node:
+	* @obj: Self
+	* @node: node to configure
+	* @err: Error propagation and reporting.
+	*
+	* Return a widget that can be use to set any options needed by this node
+	*
+	* Returns: A GtkWidget
+	*/
+	GtkWidget* configure_node (AnjutaProjectNode *node);
+}
+
+/**
  * SECTION:ianjuta-project-backend
  * @title: IAnjutaProjectBackend
  * @short_description: Interface for creating new project
@@ -3043,7 +3236,7 @@ interface IAnjutaTerminal
  */
 interface IAnjutaProjectBackend
 {
-	#include <libanjuta/gbf-project.h>
+	#include "ianjuta-project.h"
 	
 	/**
 	 * ianjuta_project_backend_new_project:
@@ -3054,7 +3247,22 @@ interface IAnjutaProjectBackend
 	 *
 	 * Return value: An object derived from GbfProject
 	 */
-	GbfProject* new_project ();
+	IAnjutaProject* new_project ();
+
+	
+	/**
+	 * ianjuta_project_backend_probe:
+	 * @obj: Self
+	 * @file: Project directory
+	 * @err: Error propagation and reporting
+	 *
+	 * Check if the directory contains a project supported by this
+	 * backend
+	 *
+	 * Return value: 0 if the project is invalid and > 0 if the
+	 * project is valid. 
+	 */
+	gint probe (GFile *directory);
 }
 
 /**
@@ -3068,6 +3276,10 @@ interface IAnjutaProjectBackend
  */
 interface IAnjutaProjectManager
 {
+
+	#include <libanjuta/anjuta-project.h>
+	#include <libanjuta/interfaces/ianjuta-project.h>
+	
 	/**
 	* IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI
 	*
@@ -3082,30 +3294,6 @@ interface IAnjutaProjectManager
 	*/
 	#define CURRENT_URI		"project_manager_current_uri"
 
-	enum ElementType
-	{
-		UNKNOWN,
-		SOURCE,
-		TARGET,
-		GROUP
-	}
-	
-	enum TargetType
-	{
-		TARGET_UNKNOWN,
-		TARGET_SHAREDLIB,
-		TARGET_STATICLIB,
-		TARGET_EXECUTABLE
-	}
-	
-	enum Capabilities
-	{
-		CAN_ADD_NONE     = 0,
-		CAN_ADD_GROUP    = 1 << 0,
-		CAN_ADD_TARGET   = 1 << 1,
-		CAN_ADD_SOURCE   = 1 << 2
-	}
-	
 	// Signals
 	
 	/**
@@ -3150,7 +3338,7 @@ interface IAnjutaProjectManager
 	*
 	* Returns: fixme
 	*/
-	ElementType get_element_type (const gchar *element_uri);
+	AnjutaProjectNodeType get_element_type (const gchar *element_uri);
 	
 	/**
 	* ianjuta_project_manager_get_elements:
@@ -3162,7 +3350,7 @@ interface IAnjutaProjectManager
 	* 
 	* Returns: fixme
 	*/
-	List<const gchar*> get_elements (ElementType element_type);
+	List<const gchar*> get_elements (AnjutaProjectNodeType element_type);
 	
 	/**
 	* ianjuta_project_manager_get_target_type:
@@ -3174,7 +3362,7 @@ interface IAnjutaProjectManager
 	* 
 	* Returns: fixme
 	*/
-	TargetType get_target_type (const gchar *target_uri);
+	AnjutaProjectTargetClass get_target_type (const gchar *target_uri);
 	
 	/**
 	* ianjuta_project_manager_get_targets:
@@ -3186,7 +3374,7 @@ interface IAnjutaProjectManager
 	* 
 	* Returns: fixme
 	*/
-	List<const gchar*> get_targets (TargetType target_type);
+	List<const gchar*> get_targets (AnjutaProjectTargetClass target_type);
 	
 	/**
 	* ianjuta_project_manager_get_parent:
@@ -3229,7 +3417,7 @@ interface IAnjutaProjectManager
 	* 
 	* fixme
 	*/
-	gchar* get_selected_id (ElementType element_type);
+	gchar* get_selected_id (AnjutaProjectNodeType element_type);
 	
 	/**
 	* ianjuta_project_manager_get_capabilities:
@@ -3241,7 +3429,7 @@ interface IAnjutaProjectManager
 	*
 	* Returns: Supported capabilites.
 	*/
-	Capabilities get_capabilities ();
+	guint get_capabilities ();
 
 	/**
 	* ianjuta_project_manager_add_source:
@@ -3268,7 +3456,7 @@ interface IAnjutaProjectManager
 	*
 	* Returns: element ID. Must be freed when no longer required.
 	*/
-	gchar* add_source_quiet (const gchar *source_uri_to_add, const gchar *target_id);
+	gchar* add_source_quiet (const gchar *source_uri_to_add, const gchar *target_uri);
 	
 	/**
 	* ianjuta_project_manager_add_sources:
diff --git a/libanjuta/libanjuta.h b/libanjuta/libanjuta.h
index fd0b75b..64d8f1c 100644
--- a/libanjuta/libanjuta.h
+++ b/libanjuta/libanjuta.h
@@ -50,5 +50,6 @@
 #include <libanjuta/anjuta-async-notify.h>
 #include <libanjuta/anjuta-sync-command.h>
 #include <libanjuta/gbf-project.h>
+#include <libanjuta/anjuta-project.h>
 
 #endif
diff --git a/plugins/build-basic-autotools/executer.c b/plugins/build-basic-autotools/executer.c
index 45284ff..87bbcd2 100644
--- a/plugins/build-basic-autotools/executer.c
+++ b/plugins/build-basic-autotools/executer.c
@@ -64,8 +64,8 @@ get_program_parameters (BasicAutotoolsPlugin *plugin,
 		g_return_val_if_fail (pm != NULL, FALSE);
 		exec_targets =
 		ianjuta_project_manager_get_targets (pm, 
-							 IANJUTA_PROJECT_MANAGER_TARGET_EXECUTABLE,
-											 NULL);
+							ANJUTA_TARGET_EXECUTABLE,
+                            NULL);
 		if (!exec_targets)
 		{
 			anjuta_util_dialog_error(GTK_WINDOW (ANJUTA_PLUGIN(plugin)->shell),
diff --git a/plugins/class-gen/plugin.c b/plugins/class-gen/plugin.c
index c1a8bf1..f178601 100644
--- a/plugins/class-gen/plugin.c
+++ b/plugins/class-gen/plugin.c
@@ -447,8 +447,8 @@ iwizard_activate (IAnjutaWizard *wiz, G_GNUC_UNUSED GError **err)
 	AnjutaClassGenPlugin *cg_plugin;
 	gchar *user_name;
 	gchar *user_email;
-	IAnjutaProjectManagerCapabilities caps =
-		IANJUTA_PROJECT_MANAGER_CAN_ADD_NONE;
+	IAnjutaProjectCapabilities caps =
+		IANJUTA_PROJECT_CAN_ADD_NONE;
 	
 	cg_plugin = ANJUTA_PLUGIN_CLASS_GEN (wiz);
 
@@ -481,7 +481,7 @@ iwizard_activate (IAnjutaWizard *wiz, G_GNUC_UNUSED GError **err)
 			caps = ianjuta_project_manager_get_capabilities (manager, NULL);
 	}
 
-	if((caps & IANJUTA_PROJECT_MANAGER_CAN_ADD_SOURCE) == FALSE)
+	if((caps & IANJUTA_PROJECT_CAN_ADD_SOURCE) == FALSE)
 	{
 		cg_window_set_add_to_project (cg_plugin->window, FALSE);
 		cg_window_enable_add_to_project (cg_plugin->window, FALSE);
diff --git a/plugins/debug-manager/start.c b/plugins/debug-manager/start.c
index 8a80c37..542f80e 100644
--- a/plugins/debug-manager/start.c
+++ b/plugins/debug-manager/start.c
@@ -36,6 +36,7 @@
 /*#define DEBUG*/
 #include <libanjuta/anjuta-debug.h>
 #include <libanjuta/resources.h>
+#include <libanjuta/anjuta-project.h>
 #include <libanjuta/interfaces/ianjuta-project-manager.h>
 #include <libanjuta/interfaces/ianjuta-document-manager.h>
 #include <libanjuta/interfaces/ianjuta-builder.h>
@@ -208,12 +209,12 @@ get_source_directories (AnjutaPlugin *plugin)
 		{
 			slibs_dirs =
 				ianjuta_project_manager_get_targets (pm,
-					IANJUTA_PROJECT_MANAGER_TARGET_SHAREDLIB,
-												  NULL);
+					ANJUTA_TARGET_SHAREDLIB,
+				    NULL);
 			libs_dirs =
 				ianjuta_project_manager_get_targets (pm,
-					IANJUTA_PROJECT_MANAGER_TARGET_STATICLIB,
-												  NULL);
+					ANJUTA_TARGET_STATICLIB,
+				    NULL);
 		}
 	}
 	slibs_dirs = g_list_reverse (slibs_dirs);
diff --git a/plugins/file-wizard/file.c b/plugins/file-wizard/file.c
index 9349652..3c95607 100644
--- a/plugins/file-wizard/file.c
+++ b/plugins/file-wizard/file.c
@@ -36,6 +36,7 @@
 #include <libanjuta/interfaces/ianjuta-document-manager.h>
 #include <libanjuta/interfaces/ianjuta-macro.h>
 #include <libanjuta/interfaces/ianjuta-file.h>
+#include <libanjuta/interfaces/ianjuta-project.h>
 #include <libanjuta/interfaces/ianjuta-project-manager.h>
 #include <libanjuta/interfaces/ianjuta-vcs.h>
 
@@ -125,8 +126,8 @@ void
 display_new_file(AnjutaFileWizardPlugin *plugin,
 				 IAnjutaDocumentManager *docman)
 {
-	IAnjutaProjectManagerCapabilities caps =
-		IANJUTA_PROJECT_MANAGER_CAN_ADD_NONE;
+	IAnjutaProjectCapabilities caps =
+		IANJUTA_PROJECT_CAN_ADD_NONE;
 	
 	if (!nfg)
 		if (!create_new_file_dialog (docman))
@@ -147,7 +148,7 @@ display_new_file(AnjutaFileWizardPlugin *plugin,
 	                  G_CALLBACK(on_add_to_project_toggled),
 	                  nfg);
 	
-	if ((caps & IANJUTA_PROJECT_MANAGER_CAN_ADD_SOURCE) == FALSE) {
+	if ((caps & IANJUTA_PROJECT_CAN_ADD_SOURCE) == FALSE) {
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (nfg->add_to_project),
 									  FALSE);
 		gtk_widget_set_sensitive (nfg->add_to_project, FALSE);
diff --git a/plugins/gbf-am/gbf-am-project.c b/plugins/gbf-am/gbf-am-project.c
index 1a26eb8..eb5a018 100644
--- a/plugins/gbf-am/gbf-am-project.c
+++ b/plugins/gbf-am/gbf-am-project.c
@@ -134,6 +134,7 @@ struct _GbfAmProjectParseData {
 	GString            *error;
 };
 
+#define GBF_NODE_DATA(node)  ((node) != NULL ? (AmpGroupData *)((node)->data) : 
 
 /* ----- Script spawning data types and constants ----- */
 
@@ -179,6 +180,77 @@ enum {
 
 static GbfProject *parent_class;
 
+/* Target types
+ *---------------------------------------------------------------------------*/
+
+typedef struct {
+	AnjutaProjectTargetInformation base;
+	const gchar *detail;
+} GbfAmTargetInformation;
+
+static GbfAmTargetInformation GbfAmTargetTypes[] = {
+	{{N_("Unknown"), ANJUTA_TARGET_UNKNOWN,
+	"text/plain"}, NULL},
+
+	{{N_("Program"), ANJUTA_TARGET_EXECUTABLE,
+	"application/x-executable"}, "program"},
+
+	{{N_("Static Library"), ANJUTA_TARGET_STATICLIB,
+	"application/x-archive"}, "static_lib"},
+	
+	{{N_("Shared Library"), ANJUTA_TARGET_SHAREDLIB,
+	"application/x-sharedlib"}, "shared_lib"},
+
+	{{N_("Man Documentation"), ANJUTA_TARGET_MAN,
+	"text/x-troff-man"}, "man"},
+
+	{{N_("Miscellaneous Data"), ANJUTA_TARGET_DATA,
+	"application/octet-stream"}, "data"},
+
+	{{N_("Script"), ANJUTA_TARGET_EXECUTABLE,
+	"text/x-shellscript"}, "script"},
+
+	{{N_("Info Documentation"), ANJUTA_TARGET_INFO,
+	"application/x-tex-info"}, "info"},
+
+	{{N_("Lisp Module"), ANJUTA_TARGET_LISP,
+	"text/plain"}, "lisp"},
+	
+	{{N_("Header Files"), ANJUTA_TARGET_HEADER,
+	"text/x-chdr"}, "headers"},
+
+	{{N_("Java Module"), ANJUTA_TARGET_JAVA,
+	"application/x-java"}, "java"},
+
+	{{N_("Python Module"), ANJUTA_TARGET_PYTHON,
+	"application/x-python"}, "python"},
+
+	{{N_("Generic rule"), ANJUTA_TARGET_GENERIC,
+	"text/plain"}, "generic_rule"},
+	
+	{{N_("Extra target"), ANJUTA_TARGET_EXTRA,
+	"text/plain"}, "extra"},
+
+	{{N_("Configure file"), ANJUTA_TARGET_CONFIGURE,
+	"text/plain"}, "configure_generated_file"},
+	
+	{{N_("Interface file"), ANJUTA_TARGET_IDL,
+	"text/plain"}, "orbit_idl"},
+	
+	{{N_("GLib mkenums"), ANJUTA_TARGET_MKENUMS,
+	"text/plain"}, "glib_mkenums"},
+	
+	{{N_("GLib genmarshal"), ANJUTA_TARGET_GENMARSHAL,
+	"text/plain"}, "glib_genmarshal"},
+	
+	{{N_("Intl rule"), ANJUTA_TARGET_INTLTOOL,
+	"text/plain"}, "intltool_rule"},
+	
+	{{NULL, ANJUTA_TARGET_UNKNOWN,
+	NULL}}
+};
+static GHashTable *GbfAmTargetMapping = NULL;
+
 
 /* ----------------------------------------------------------------------
    Private prototypes
@@ -257,6 +329,7 @@ static gboolean        project_update               (GbfAmProject      *project,
 						     GError           **err);
 
 static void            gbf_am_node_free             (GbfAmNode         *node);
+static void            gbf_am_node_update           (AnjutaProjectNode *node);
 static GNode          *project_node_new             (GbfAmNodeType      type);
 static void            project_node_destroy         (GbfAmProject      *project,
 						     GNode             *g_node);
@@ -1097,6 +1170,7 @@ sax_start_element (void *ctxt, const xmlChar *name, const xmlChar **attrs)
 		node->name = g_strdup ((char *) group_name);
 		node->uri = g_strdup ((char *) group_source);
 		node->config = gbf_am_config_mapping_new ();
+		gbf_am_node_update (g_node);
 		
 		/* set working node */
 		data->depth++;
@@ -1178,6 +1252,7 @@ sax_start_element (void *ctxt, const xmlChar *name, const xmlChar **attrs)
 		node->name = g_strdup ((char *) target_name);
 		node->detail = g_strdup ((char *) target_type);
 		node->config = gbf_am_config_mapping_new ();
+		gbf_am_node_update (g_node);
 
 		/* set working node */
 		data->current_node = g_node;
@@ -1237,6 +1312,7 @@ sax_start_element (void *ctxt, const xmlChar *name, const xmlChar **attrs)
 			g_free (node->uri);
 		}
 		node->uri = source_uri;
+		gbf_am_node_update (g_node);
 			
 		/* set working node */
 		data->current_node = g_node;
@@ -1302,6 +1378,7 @@ sax_start_element (void *ctxt, const xmlChar *name, const xmlChar **attrs)
 		}
 		node->uri = source_uri;
 		node->detail = g_strdup ((char *) target_dep);
+		gbf_am_node_update (g_node);
 
 		/* set working node */
 		data->current_node = g_node;
@@ -2252,9 +2329,68 @@ project_update (GbfAmProject *project,
  */
 
 static void
+gbf_am_node_update (AnjutaProjectNode *g_node)
+{
+	if (g_node) {
+		GbfAmNode *node = (GbfAmNode *)g_node->data;
+
+		switch (node->group.node.type)
+		{
+			case ANJUTA_PROJECT_GROUP:
+				if (node->group.directory) g_object_unref (node->group.directory);
+				node->group.directory = NULL;
+				if (node->uri)
+				{
+					GFile *file = g_file_new_for_path (node->uri);
+					node->group.directory = g_file_get_parent (file);
+					g_object_unref (file);
+				}
+				break;
+			case ANJUTA_PROJECT_TARGET:
+				if (node->target.name) g_free (node->target.name);
+				node->target.name = NULL;
+				if (node->name) node->target.name = g_strdup (node->name);
+				if (node->detail)
+				{
+					node->target.type = g_hash_table_lookup (GbfAmTargetMapping, node->detail);
+					if (node->target.type == NULL) node->target.type = &(GbfAmTargetTypes[0].base);
+				}
+				else
+				{
+					node->target.type = &(GbfAmTargetTypes[0].base);
+				}
+				break;
+			case ANJUTA_PROJECT_SOURCE:
+				if (node->source.file) g_object_unref (node->source.file);
+				node->source.file = NULL;
+				if (node->uri) node->source.file = g_file_new_for_uri (node->uri);
+				break;
+			default:
+				g_assert_not_reached ();
+				break;
+		}
+	}
+}
+
+static void
 gbf_am_node_free (GbfAmNode *node)
 {
 	if (node) {
+		switch (node->group.node.type)
+		{
+			case ANJUTA_PROJECT_GROUP:
+				if (node->group.directory) g_object_unref (node->group.directory);
+				break;
+			case ANJUTA_PROJECT_TARGET:
+				if (node->target.name) g_free (node->target.name);
+				break;
+			case ANJUTA_PROJECT_SOURCE:
+				if (node->source.file) g_object_unref (node->source.file);
+				break;
+			default:
+				g_assert_not_reached ();
+				break;
+		}
 		g_free (node->id);
 		g_free (node->name);
 		g_free (node->detail);
@@ -2272,6 +2408,24 @@ project_node_new (GbfAmNodeType type)
 
 	node = g_new0 (GbfAmNode, 1);
 	node->type = type;
+	switch (type) {
+		case GBF_AM_NODE_GROUP:
+			node->group.node.type = ANJUTA_PROJECT_GROUP;
+			node->group.directory = NULL;
+			break;
+		case GBF_AM_NODE_TARGET:
+			node->target.node.type = ANJUTA_PROJECT_TARGET;
+			node->target.name = NULL;
+			node->target.type = NULL;
+			break;
+		case GBF_AM_NODE_SOURCE:
+			node->source.node.type = ANJUTA_PROJECT_SOURCE;
+			node->source.file = NULL;
+			break;
+		default:
+			g_assert_not_reached ();
+			break;
+	};
 
 	return g_node_new (node);
 }
@@ -2341,6 +2495,10 @@ project_data_destroy (GbfAmProject *project)
 	project->groups = NULL;
 	project->targets = NULL;
 	project->sources = NULL;
+
+	/* Target mapping */
+	if (GbfAmTargetMapping) g_hash_table_destroy (GbfAmTargetMapping);
+	GbfAmTargetMapping = NULL;
 }
 
 static void
@@ -2348,6 +2506,7 @@ project_data_init (GbfAmProject *project)
 {
 	g_return_if_fail (project != NULL);
 	g_return_if_fail (GBF_IS_AM_PROJECT (project));
+	GbfAmTargetInformation *target;
 	
 	/* free data if necessary */
 	project_data_destroy (project);
@@ -2364,6 +2523,13 @@ project_data_init (GbfAmProject *project)
 	project->groups = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 	project->targets = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 	project->sources = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+	/* Target mapping */
+	GbfAmTargetMapping = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL); 
+	for (target = GbfAmTargetTypes; target->base.name != NULL; target++)
+	{
+		if (target->detail != NULL) g_hash_table_insert (GbfAmTargetMapping, (gpointer)target->detail, target);
+	}
 }
 
 GbfAmConfigMapping *
@@ -3650,6 +3816,253 @@ impl_get_config_packages  (GbfProject *project,
 	return result;
 }
 
+/* Implement IAnjutaProject
+ *---------------------------------------------------------------------------*/
+
+static AnjutaProjectGroup* 
+iproject_add_group (IAnjutaProject *obj, AnjutaProjectGroup *parent,  const gchar *name, GError **err)
+{
+	gchar *id;
+	AnjutaProjectNode *g_node = NULL;
+	
+	g_message ("iproject_add_group");
+
+	id = gbf_project_add_group (GBF_PROJECT (obj), GBF_AM_NODE (parent)->id, name, err);
+
+	if (id != NULL)
+	{
+		g_node = (AnjutaProjectNode *)g_hash_table_lookup (GBF_AM_PROJECT (obj)->groups, id);
+		g_free (id);
+	}
+	
+	return (AnjutaProjectGroup *)g_node;
+}
+
+static AnjutaProjectTarget* 
+iproject_add_target (IAnjutaProject *obj, AnjutaProjectGroup *parent,  const gchar *name,  AnjutaProjectTargetType type, GError **err)
+{
+	gchar *id;
+	AnjutaProjectNode *g_node = NULL;
+	GbfAmTargetInformation *target;
+	
+	g_message ("iproject_add_target");
+
+	for (target = GbfAmTargetTypes; target->base.name != NULL; target++) if ((char *)type == (char *)target) break;
+	id = gbf_project_add_target (GBF_PROJECT (obj), GBF_AM_NODE (parent)->id, name, target->detail, err);
+
+	if (id != NULL)
+	{
+		g_node = (AnjutaProjectNode *)g_hash_table_lookup (GBF_AM_PROJECT (obj)->targets, id);
+		g_free (id);
+	}
+
+	return (AnjutaProjectTarget *)g_node;
+}
+
+static AnjutaProjectSource* 
+iproject_add_source (IAnjutaProject *obj, AnjutaProjectTarget *parent,  GFile *file, GError **err)
+{
+	gchar *id;
+	gchar *uri;
+	AnjutaProjectNode *g_node = NULL;
+	
+	g_message ("iproject_add_source");
+
+	uri = g_file_get_uri (file);
+	id = gbf_project_add_source (GBF_PROJECT (obj), GBF_AM_NODE (parent)->id, uri, err);
+	g_free (uri);
+
+	if (id != NULL)
+	{
+		g_node = (AnjutaProjectNode *)g_hash_table_lookup (GBF_AM_PROJECT (obj)->sources, id);
+		g_free (id);
+	}
+
+	return (AnjutaProjectSource *)g_node;
+}
+
+static GtkWidget* 
+iproject_configure (IAnjutaProject *obj, GError **error)
+{
+	g_message ("iproject_configure");
+	
+        return gbf_project_configure (GBF_PROJECT (obj), error);
+}
+
+static guint 
+iproject_get_capabilities (IAnjutaProject *obj, GError **err)
+{
+	return (IANJUTA_PROJECT_CAN_ADD_GROUP |
+		IANJUTA_PROJECT_CAN_ADD_TARGET |
+		IANJUTA_PROJECT_CAN_ADD_SOURCE);
+}
+
+static GList* 
+iproject_get_packages (IAnjutaProject *obj, GError **err)
+{
+	GList *modules;
+	GList *packages;
+	GList* node;
+	GHashTable *all = g_hash_table_new (g_str_hash, g_str_equal);
+	
+	g_message ("iproject_get_packages");
+	
+	modules = gbf_project_get_config_modules (GBF_PROJECT (obj), NULL);
+	for (node = modules; node != NULL; node = g_list_next (node))
+	{
+		GList *pack;
+		
+		packages = gbf_project_get_config_packages (GBF_PROJECT (obj), (const gchar *)node->data, NULL);
+		for (pack = packages; pack != NULL; pack = g_list_next (pack))
+		{
+			g_hash_table_replace (all, pack->data, NULL);
+		}
+	    g_list_free (packages);
+	}
+	g_list_free (modules);
+
+	packages = g_hash_table_get_keys (all);
+	g_hash_table_destroy (all);
+	
+	return packages;
+}
+
+static AnjutaProjectGroup* 
+iproject_get_root (IAnjutaProject *obj, GError **err)
+{
+	AnjutaProjectGroup *root;
+	
+	g_message ("iproject_get_root");
+	root = (AnjutaProjectGroup *)((GbfAmProject *)obj)->root_node;
+		
+	return root;
+}
+
+static GList* 
+iproject_get_target_types (IAnjutaProject *obj, GError **err)
+{
+	GbfAmTargetInformation *targets = GbfAmTargetTypes;
+        GList *types = NULL;
+
+	g_message ("iproject_get_target_types"); 
+
+        while (targets->base.name != NULL)
+        {
+                types = g_list_prepend (types, targets);
+                targets++;
+        }
+        types = g_list_reverse (types);
+
+        return types;
+}
+
+static gboolean
+iproject_load (IAnjutaProject *obj, GFile *file, GError **error)
+{
+	GError *err = NULL;
+	gboolean ok;
+	gchar *uri;
+	
+	g_message ("iproject_load");
+
+	uri = g_file_get_uri (file);
+	gbf_project_load (GBF_PROJECT (obj), uri, &err);
+	g_free (uri);
+	ok = err == NULL;
+	if (err != NULL) g_propagate_error (error, err);
+
+	return ok;
+}
+
+static gboolean
+iproject_refresh (IAnjutaProject *obj, GError **error)
+{
+	GError *err = NULL;
+	gboolean ok;
+	
+	g_message ("iproject_refresh");
+
+	gbf_project_refresh (GBF_PROJECT (obj), &err);
+	ok = err == NULL;
+	if (err != NULL) g_propagate_error (error, err);
+
+	return ok;
+}
+
+static gboolean
+iproject_remove_node (IAnjutaProject *obj, AnjutaProjectNode *node, GError **error)
+{
+	GError *err = NULL;
+	gboolean ok;
+	
+	g_message ("iproject_remove_node");
+
+	switch (ANJUTA_PROJECT_NODE_DATA (node)->type)
+	{
+		case ANJUTA_PROJECT_GROUP:
+			gbf_project_remove_group (GBF_PROJECT (obj), GBF_AM_NODE (node)->id, &err);
+			break;
+		case ANJUTA_PROJECT_TARGET:
+			gbf_project_remove_target (GBF_PROJECT (obj), GBF_AM_NODE (node)->id, &err);
+			break;
+		case ANJUTA_PROJECT_SOURCE:
+			gbf_project_remove_source (GBF_PROJECT (obj), GBF_AM_NODE (node)->id, &err);
+			break;
+		default:
+			g_assert_not_reached ();
+			break;
+	}
+	ok = err == NULL;
+	if (err != NULL) g_propagate_error (error, err);
+
+	return ok;
+}
+
+static GtkWidget*
+iproject_configure_node (IAnjutaProject *obj, AnjutaProjectNode *node, GError **error)
+{
+	GError *err = NULL;
+	GtkWidget *wid = NULL;
+	
+	g_message ("iproject_configure_node");
+
+	switch (ANJUTA_PROJECT_NODE_DATA (node)->type)
+	{
+		case ANJUTA_PROJECT_GROUP:
+			wid = gbf_am_properties_get_group_widget (GBF_AM_PROJECT (obj), GBF_AM_NODE (node)->id, &err);
+			break;
+		case ANJUTA_PROJECT_TARGET:
+			wid = gbf_am_properties_get_target_widget (GBF_AM_PROJECT (obj), GBF_AM_NODE (node)->id, &err);
+			break;
+		case ANJUTA_PROJECT_SOURCE:
+			break;
+		default:
+			g_assert_not_reached ();
+			break;
+	}
+	
+	if (err != NULL) g_propagate_error (error, err);
+
+	return wid;
+}
+
+static void
+iproject_iface_init(IAnjutaProjectIface* iface)
+{
+	iface->add_group = iproject_add_group;
+	iface->add_source = iproject_add_source;
+	iface->add_target = iproject_add_target;
+	iface->configure = iproject_configure;
+	iface->configure_node = iproject_configure_node;
+	iface->get_capabilities = iproject_get_capabilities;
+	iface->get_packages = iproject_get_packages;
+	iface->get_root = iproject_get_root;
+	iface->get_target_types = iproject_get_target_types;
+	iface->load = iproject_load;
+	iface->refresh = iproject_refresh;
+	iface->remove_node = iproject_remove_node;
+}
+
 static void
 gbf_am_project_class_init (GbfAmProjectClass *klass)
 {
@@ -3772,10 +4185,29 @@ gbf_am_project_get_property (GObject    *object,
 	}
 }
 
-GbfProject *
+IAnjutaProject *
 gbf_am_project_new (void)
 {
-	return GBF_PROJECT (g_object_new (GBF_TYPE_AM_PROJECT, NULL));
+	return IANJUTA_PROJECT (g_object_new (GBF_TYPE_AM_PROJECT, NULL));
+}
+
+gint
+gbf_am_project_probe (GFile *file, GError **err)
+{
+	gchar *root_path;
+	gboolean retval = FALSE;
+
+	root_path = g_file_get_path (file);
+	if ((root_path != NULL) && g_file_test (root_path, G_FILE_TEST_IS_DIR)) {
+		retval = (file_exists (root_path, "Makefile.am") &&
+			  (file_exists (root_path, "configure.in") ||
+			   file_exists (root_path, "configure.ac")));
+	}
+	g_free (root_path);
+	
+        return retval ? IANJUTA_PROJECT_PROBE_PROJECT_FILES : 0;
 }
 
-GBF_BACKEND_BOILERPLATE (GbfAmProject, gbf_am_project);
+ANJUTA_TYPE_BEGIN(GbfAmProject, gbf_am_project, GBF_TYPE_PROJECT);
+ANJUTA_TYPE_ADD_INTERFACE(iproject, IANJUTA_TYPE_PROJECT);
+ANJUTA_TYPE_END;
diff --git a/plugins/gbf-am/gbf-am-project.h b/plugins/gbf-am/gbf-am-project.h
index 758598b..7ba30b9 100644
--- a/plugins/gbf-am/gbf-am-project.h
+++ b/plugins/gbf-am/gbf-am-project.h
@@ -26,12 +26,14 @@
 
 #include <glib-object.h>
 #include <libanjuta/gbf-project.h>
+#include <libanjuta/interfaces/ianjuta-project.h>
+#include <libanjuta/anjuta-project.h>
 #include <libanjuta/anjuta-plugin.h>
 #include "gbf-am-config.h"
 
 G_BEGIN_DECLS
 
-#define GBF_TYPE_AM_PROJECT		(gbf_am_project_get_type (NULL))
+#define GBF_TYPE_AM_PROJECT		(gbf_am_project_get_type ())
 #define GBF_AM_PROJECT(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), GBF_TYPE_AM_PROJECT, GbfAmProject))
 #define GBF_AM_PROJECT_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), GBF_TYPE_AM_PROJECT, GbfAmProjectClass))
 #define GBF_IS_AM_PROJECT(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GBF_TYPE_AM_PROJECT))
@@ -49,6 +51,11 @@ typedef enum {
 } GbfAmNodeType;
 	
 struct _GbfAmNode {
+	union {
+		AnjutaProjectGroupData group;
+		AnjutaProjectTargetData target;
+		AnjutaProjectSourceData source;
+	};
 	GbfAmNodeType       type;
 	gchar              *id;        /* unique id among nodes of the same type */
 	gchar              *name;      /* user visible string */
@@ -106,8 +113,10 @@ struct _GbfAmProjectClass {
 /* convenient shortcut macro the get the GbfAmNode from a GNode */
 #define GBF_AM_NODE(g_node)  ((g_node) != NULL ? (GbfAmNode *)((g_node)->data) : NULL)
 
-GType         gbf_am_project_get_type (GTypeModule *plugin);
-GbfProject   *gbf_am_project_new      (void);
+GType         gbf_am_project_get_type (void);
+IAnjutaProject   *gbf_am_project_new      (void);
+
+gint          gbf_am_project_probe (GFile *file, GError **err);
 
 /* FIXME: The config infrastructure should probably be made part of GbfProject
  * so that other backend implementations could use them directly and we don't
diff --git a/plugins/gbf-am/plugin.c b/plugins/gbf-am/plugin.c
index 1325da6..0656bbe 100644
--- a/plugins/gbf-am/plugin.c
+++ b/plugins/gbf-am/plugin.c
@@ -51,20 +51,27 @@ deactivate_plugin (AnjutaPlugin *plugin)
 /* IAnjutaProjectBackend implementation
  *---------------------------------------------------------------------------*/
 
-static GbfProject*
+static IAnjutaProject*
 iproject_backend_new_project (IAnjutaProjectBackend* backend, GError** err)
 {
-	GbfProject *project;
-	
+	IAnjutaProject *project;
+
 	project = gbf_am_project_new ();
 		
 	return project;
 }
 
+static gint
+iproject_backend_probe (IAnjutaProjectBackend* backend, GFile *directory, GError** err)
+{
+	return gbf_am_project_probe (directory, err);
+}
+
 static void
 iproject_backend_iface_init(IAnjutaProjectBackendIface *iface)
 {
 	iface->new_project = iproject_backend_new_project;
+	iface->probe = iproject_backend_probe;
 }
 
 /* GObject functions
@@ -114,9 +121,4 @@ ANJUTA_PLUGIN_BEGIN (GbfAmPlugin, gbf_am_plugin);
 ANJUTA_PLUGIN_ADD_INTERFACE (iproject_backend, IANJUTA_TYPE_PROJECT_BACKEND);
 ANJUTA_PLUGIN_END;
 
-G_MODULE_EXPORT void
-anjuta_glue_register_components (GTypeModule *module)
-{
-	gbf_am_plugin_get_type (module);
-	gbf_am_project_get_type (module);
-}                     
+ANJUTA_SIMPLE_PLUGIN (GbfAmPlugin, gbf_am_plugin);
diff --git a/plugins/gbf-mkfile/gbf-mkfile-project.c b/plugins/gbf-mkfile/gbf-mkfile-project.c
index e1aeb5b..d61292e 100644
--- a/plugins/gbf-mkfile/gbf-mkfile-project.c
+++ b/plugins/gbf-mkfile/gbf-mkfile-project.c
@@ -41,6 +41,7 @@
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 #include <libanjuta/gbf-project.h>
+#include <libanjuta/interfaces/ianjuta-project.h>
 #include <libanjuta/anjuta-utils.h>
 #include "gbf-mkfile-project.h"
 #include "gbf-mkfile-config.h"
@@ -3520,4 +3521,25 @@ gbf_mkfile_project_new (void)
 	return GBF_PROJECT (g_object_new (GBF_TYPE_MKFILE_PROJECT, NULL));
 }
 
+gint
+gbf_mkfile_project_probe (GFile *file, GError **err)
+{
+	gchar *root_path;
+	gboolean retval = FALSE;
+	
+	/* use _for_commandline_arg to resolve eventually relative path against
+	 * current directory
+	 */
+	root_path = g_file_get_path (file);
+	if ((root_path) != NULL && g_file_test (root_path, G_FILE_TEST_IS_DIR)) {
+		retval = ((file_exists (root_path, "Makefile") ||
+				   file_exists (root_path, "makefile")) &&
+				   !(file_exists (root_path, "Makefile.am") || 
+					 file_exists (root_path, "Makefile.in")));
+	}
+	g_free (root_path);
+
+        return retval ? IANJUTA_PROJECT_PROBE_PROJECT_FILES : 0;
+}
+
 GBF_BACKEND_BOILERPLATE (GbfMkfileProject, gbf_mkfile_project);
diff --git a/plugins/gbf-mkfile/gbf-mkfile-project.h b/plugins/gbf-mkfile/gbf-mkfile-project.h
index d8aeece..7ee098d 100644
--- a/plugins/gbf-mkfile/gbf-mkfile-project.h
+++ b/plugins/gbf-mkfile/gbf-mkfile-project.h
@@ -31,6 +31,7 @@
 
 #include <glib-object.h>
 #include <libanjuta/gbf-project.h>
+#include <libanjuta/anjuta-project.h>
 #include "gbf-mkfile-config.h"
 
 G_BEGIN_DECLS
@@ -113,6 +114,8 @@ struct _GbfMkfileProjectClass {
 GType         gbf_mkfile_project_get_type (GTypeModule *module);
 GbfProject   *gbf_mkfile_project_new      (void);
 
+gint          gbf_mkfile_project_probe (GFile *file, GError **err);
+
 /* FIXME: The config infrastructure should probably be made part of GbfProject
  * so that other backend implementations could use them directly and we don't
  * have to create separate configuration widgets. But then different back end
diff --git a/plugins/gbf-mkfile/plugin.c b/plugins/gbf-mkfile/plugin.c
index 4d0d60f..cf12580 100644
--- a/plugins/gbf-mkfile/plugin.c
+++ b/plugins/gbf-mkfile/plugin.c
@@ -62,10 +62,18 @@ iproject_backend_new_project (IAnjutaProjectBackend* backend, GError** err)
 	return project;
 }
 
+static gint
+iproject_backend_probe (IAnjutaProjectBackend* backend, GFile *directory, GError** err)
+{
+	g_message ("mkfile probe");
+	return gbf_mkfile_project_probe (directory, err);
+}
+
 static void
 iproject_backend_iface_init(IAnjutaProjectBackendIface *iface)
 {
 	iface->new_project = iproject_backend_new_project;
+	iface->probe = iproject_backend_probe;
 }
 
 /* GObject functions
@@ -115,9 +123,4 @@ ANJUTA_PLUGIN_BEGIN (GbfMkfilePlugin, gbf_mkfile_plugin);
 ANJUTA_PLUGIN_ADD_INTERFACE (iproject_backend, IANJUTA_TYPE_PROJECT_BACKEND);
 ANJUTA_PLUGIN_END;
 
-G_MODULE_EXPORT void
-anjuta_glue_register_components (GTypeModule *module)
-{
-	gbf_mkfile_plugin_get_type (module);
-        gbf_mkfile_project_get_type (module);
-}                     
+ANJUTA_SIMPLE_PLUGIN (GbfMkfilePlugin, gbf_mkfile_plugin);
diff --git a/plugins/glade/plugin.c b/plugins/glade/plugin.c
index 0bcf9be..c696ae6 100644
--- a/plugins/glade/plugin.c
+++ b/plugins/glade/plugin.c
@@ -316,9 +316,10 @@ value_added_pm_current_uri (AnjutaPlugin *plugin, const char *name,
 	ui = anjuta_shell_get_ui (plugin->shell, NULL);
 	action = anjuta_ui_get_action (ui, "ActionGroupGlade", "ActionSetDefaultTarget");
 	selected_id = ianjuta_project_manager_get_selected_id (projman,
-	                                                       IANJUTA_PROJECT_MANAGER_TARGET,
+	                                                       ANJUTA_PROJECT_TARGET,
 	                                                       NULL);
 	gtk_action_set_sensitive (action, selected_id != NULL);
+	g_free (selected_id);
 }
 
 static void
@@ -3871,7 +3872,7 @@ on_set_default_resource_target (GtkAction* action, GladePlugin* plugin)
 		anjuta_shell_get_interface (ANJUTA_PLUGIN(plugin)->shell,
 		                            IAnjutaProjectManager, NULL);
 
-	selected = ianjuta_project_manager_get_selected_id (projman, IANJUTA_PROJECT_MANAGER_TARGET, NULL);
+	selected = ianjuta_project_manager_get_selected_id (projman, ANJUTA_PROJECT_TARGET, NULL);
 	DEBUG_PRINT ("Selected element is %s", selected);
 	set_default_resource_target (selected, plugin);
 	g_free (selected);
diff --git a/plugins/project-manager/gbf-project-model.c b/plugins/project-manager/gbf-project-model.c
index 5f63eb8..7a89cc6 100644
--- a/plugins/project-manager/gbf-project-model.c
+++ b/plugins/project-manager/gbf-project-model.c
@@ -29,12 +29,14 @@
 #include <glib-object.h>
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
+#include <gio/gio.h>
 
+#include "gbf-project-util.h"
 #include "gbf-project-model.h"
 
 
 struct _GbfProjectModelPrivate {
-	GbfProject          *proj;
+	IAnjutaProject      *proj;
 	gulong               project_updated_handler;
 	
 	GtkTreeRowReference *root_row;
@@ -57,7 +59,7 @@ static void     gbf_project_model_drag_source_init   (GtkTreeDragSourceIface *if
 static void     gbf_project_model_drag_dest_init     (GtkTreeDragDestIface   *iface);
 
 static void     load_project                         (GbfProjectModel        *model,
-						      GbfProject             *proj);
+						      IAnjutaProject         *proj);
 static void     insert_empty_node                    (GbfProjectModel        *model);
 static void     unload_project                       (GbfProjectModel        *model);
 
@@ -284,12 +286,12 @@ default_sort_func (GtkTreeModel *model,
 		/* special case: the order of shortcuts is
 		 * user customizable */
 		for (l = GBF_PROJECT_MODEL (model)->priv->shortcuts; l; l = l->next) {
-			if (!strcmp (l->data, data_a->id)) {
+			if (l->data == data_a->id) {
 				/* a comes first */
 				retval = -1;
 				break;
 			}
-			else if (!strcmp (l->data, data_b->id)) {
+			else if (l->data == data_b->id) {
 				/* b comes first */
 				retval = 1;
 				break;
@@ -322,16 +324,14 @@ default_sort_func (GtkTreeModel *model,
 
 
 static void 
-add_source (GbfProjectModel *model,
-	    const gchar     *source_id,
-	    GtkTreeIter     *parent)
+add_source (GbfProjectModel    	      *model,
+	    AnjutaProjectSource *source,
+	    GtkTreeIter               *parent)
 {
-	GbfProjectTargetSource *source;
 	GtkTreeIter iter;
 	GbfTreeData *data;
-	
-	source = gbf_project_get_source (model->priv->proj, source_id, NULL);
-	if (!source)
+
+	if ((!source) || (anjuta_project_node_get_type (source) != ANJUTA_PROJECT_SOURCE))
 		return;
 	
 	data = gbf_tree_data_new_source (model->priv->proj, source);
@@ -340,31 +340,28 @@ add_source (GbfProjectModel *model,
 			    GBF_PROJECT_MODEL_COLUMN_DATA, data,
 			    -1);
 	gbf_tree_data_free (data);
-
-	gbf_project_target_source_free (source);
 }
 
 static GtkTreePath *
-find_shortcut (GbfProjectModel *model, const gchar *target_id)
+find_shortcut (GbfProjectModel *model, const AnjutaProjectTarget *target)
 {
 	GList *l;
 	gint i;
 	
 	for (l = model->priv->shortcuts, i = 0; l; l = l->next, i++) {
-		if (!strcmp (target_id, l->data))
+		if (target == l->data)
 			return gtk_tree_path_new_from_indices (i, -1);
 	}
 	return NULL;
 }
 
 static void
-remove_shortcut (GbfProjectModel *model, const gchar *target_id)
+remove_shortcut (GbfProjectModel *model, const AnjutaProjectTarget *target)
 {
 	GList *l;
 	
 	for (l = model->priv->shortcuts; l; l = l->next) {
-		if (!strcmp (target_id, l->data)) {
-			g_free (l->data);
+		if (target == l->data) {
 			model->priv->shortcuts = g_list_delete_link (
 				model->priv->shortcuts, l);
 			break;
@@ -374,17 +371,15 @@ remove_shortcut (GbfProjectModel *model, const gchar *target_id)
 
 static void 
 add_target_shortcut (GbfProjectModel *model,
-		     const gchar     *target_id,
+		     AnjutaProjectTarget *target,
 		     GtkTreePath     *before_path)
 {
-	GList *l;
+	AnjutaProjectNode *node;
 	GtkTreeIter iter, sibling;
-	GbfProjectTarget *target;
 	GtkTreePath *root_path, *old_path;
 	gint *path_indices, i;
 	GbfTreeData *data;
 	
-	target = gbf_project_get_target (model->priv->proj, target_id, NULL);
 	if (!target)
 		return;
 
@@ -406,9 +401,9 @@ add_target_shortcut (GbfProjectModel *model,
 	i = path_indices [0];
 
 	/* remove the old shortcut to make sorting actually work */
-	old_path = find_shortcut (model, target_id);
+	old_path = find_shortcut (model, target);
 	if (old_path) {
-		remove_shortcut (model, target_id);
+		remove_shortcut (model, target);
 		if (gtk_tree_path_compare (old_path, before_path) < 0) {
 			/* adjust shortcut insert position if the old
 			 * index was before the new site */
@@ -419,7 +414,7 @@ add_target_shortcut (GbfProjectModel *model,
 			
 	/* add entry to the shortcut list */
 	model->priv->shortcuts = g_list_insert (model->priv->shortcuts,
-						g_strdup (target->id), i);
+						target, i);
 	
 	data = gbf_tree_data_new_target (model->priv->proj, target);
 	data->is_shortcut = TRUE;
@@ -430,25 +425,22 @@ add_target_shortcut (GbfProjectModel *model,
 	gbf_tree_data_free (data);
 	
 	/* add sources */
-	for (l = target->sources; l; l = l->next)
-		add_source (model, l->data, &iter);
+	for (node = anjuta_project_node_first_child (target); node; node = anjuta_project_node_next_sibling (node))
+		add_source (model, node, &iter);
 
 	gtk_tree_path_free (root_path);
-	gbf_project_target_free (target);
 }
 
 static void 
-add_target (GbfProjectModel *model,
-	    const gchar     *target_id,
-	    GtkTreeIter     *parent)
+add_target (GbfProjectModel 		*model,
+	    AnjutaProjectTarget   *target,
+	    GtkTreeIter     	        *parent)
 {
-	GbfProjectTarget *target;
-	GList *l;
+	AnjutaProjectNode *l;
 	GtkTreeIter iter;	
 	GbfTreeData *data;
 	
-	target = gbf_project_get_target (model->priv->proj, target_id, NULL);
-	if (!target)
+	if ((!target) || (anjuta_project_node_get_type (target) != ANJUTA_PROJECT_TARGET))
 		return;
 	
 	data = gbf_tree_data_new_target (model->priv->proj, target);
@@ -459,84 +451,88 @@ add_target (GbfProjectModel *model,
 	gbf_tree_data_free (data);
 	
 	/* add sources */
-	for (l = target->sources; l; l = l->next)
-		add_source (model, l->data, &iter);
+	for (l = anjuta_project_node_first_child (target); l; l = anjuta_project_node_next_sibling (l))
+	{
+		add_source (model, l, &iter);
+	}
 
 	/* add a shortcut to the target if the target's type is a primary */
 	/* FIXME: this shouldn't be here.  We would rather provide a
 	 * set of public functions to add/remove shortcuts to save
 	 * this information in the project metadata (when that's
 	 * implemented) */
-	if (!strcmp (target->type, "program") ||
-	    !strcmp (target->type, "shared_lib") ||
-	    !strcmp (target->type, "static_lib") ||
-	    !strcmp (target->type, "java") ||
-	    !strcmp (target->type, "python")) {
-		add_target_shortcut (model, target->id, NULL);
+	switch (anjuta_project_target_type_class (anjuta_project_target_get_type (target)))
+	{
+		case ANJUTA_TARGET_SHAREDLIB:
+		case ANJUTA_TARGET_STATICLIB:
+		case ANJUTA_TARGET_EXECUTABLE:
+		case ANJUTA_TARGET_PYTHON:
+		case ANJUTA_TARGET_JAVA:
+			add_target_shortcut (model, target, NULL);
+			break;
+		default:
+			break;
 	}
-
-	gbf_project_target_free (target);
 }
 
 static void
-update_target (GbfProjectModel *model, const gchar *target_id, GtkTreeIter *iter)
+update_target (GbfProjectModel *model, AnjutaProjectTarget *target, GtkTreeIter *iter)
 {
 	GtkTreeModel *tree_model;
-	GbfProjectTarget *target;
 	GtkTreeIter child;
+	GList *sources;
 	GList *node;
-	
+
 	tree_model = GTK_TREE_MODEL (model);
-	target = gbf_project_get_target (model->priv->proj, target_id, NULL);
-	if (!target)
+	if ((!target) || (anjuta_project_node_get_type (target) != ANJUTA_PROJECT_TARGET))
 		return;
 	
 	/* update target data here */
+	sources = gbf_project_util_all_child (target, ANJUTA_PROJECT_SOURCE);
 	
 	/* walk the tree target */
 	if (gtk_tree_model_iter_children (tree_model, &child, iter)) {
-		GbfTreeData *data;
 		gboolean valid = TRUE;
 		
 		while (valid) {
-			gtk_tree_model_get (tree_model, &child,
-					    GBF_PROJECT_MODEL_COLUMN_DATA, &data,
-					    -1);
-
+			AnjutaProjectNode *data;
+			
 			/* find the iterating id in the target's sources */
-			if (data->id) {
-				node = g_list_find_custom (target->sources,
-							   data->id, (GCompareFunc) strcmp);
+			data = gbf_project_model_get_node (model, &child);
+
+			if (data) {
+				node = g_list_find (sources, data);
 				if (node) {
-					target->sources = g_list_delete_link (target->sources, node);
+					sources = g_list_delete_link (sources, node);
 					valid = gtk_tree_model_iter_next (tree_model, &child);
 				} else {
 					valid = gtk_tree_store_remove (GTK_TREE_STORE (model), &child);
 				}
-				gbf_tree_data_free (data);
+			}
+			else
+			{
+				valid = gtk_tree_store_remove (GTK_TREE_STORE (model), &child);
 			}
 		}
 	}
 
 	/* add the remaining sources */
-	for (node = target->sources; node; node = node->next)
-		add_source (model, node->data, iter);
-	
-	gbf_project_target_free (target);
+	for (node = sources; node; node = g_list_next (node))
+	{
+		add_source (model, (AnjutaProjectSource *)node->data, iter);
+	}
 }
 
 static void 
-add_target_group (GbfProjectModel *model,
-		  const gchar     *group_id,
-		  GtkTreeIter     *parent)
+add_target_group (GbfProjectModel 	*model,
+		  AnjutaProjectGroup	*group,
+		  GtkTreeIter     	*parent)
 {
-	GbfProjectGroup *group;
 	GtkTreeIter iter;
-	GList *l;
+	AnjutaProjectNode *node;
 	GbfTreeData *data;
 
-	group = gbf_project_get_group (model->priv->proj, group_id, NULL);
-	if (!group)
+	if ((!group) || (anjuta_project_node_get_type (group) != ANJUTA_PROJECT_GROUP))
 		return;
 	
 	data = gbf_tree_data_new_group (model->priv->proj, group);
@@ -557,86 +553,95 @@ add_target_group (GbfProjectModel *model,
 	}
 
 	/* add groups ... */
-	for (l = group->groups; l; l = l->next)
-		add_target_group (model, l->data, &iter);
-
+	for (node = anjuta_project_node_first_child (group); node; node = anjuta_project_node_next_sibling (node))
+		add_target_group (model, node, &iter);
+	
 	/* ... and targets */
-	for (l = group->targets; l; l = l->next)
-		add_target (model, l->data, &iter);
-
-	gbf_project_group_free (group);
+	for (node = anjuta_project_node_first_child (group); node; node = anjuta_project_node_next_sibling (node))
+		add_target (model, node, &iter);
+	
+	/* ... and sources */
+	for (node = anjuta_project_node_first_child (group); node; node = anjuta_project_node_next_sibling (node))
+		add_source (model, node, &iter);
 }
 
 static void
-update_group (GbfProjectModel *model, const gchar *group_id, GtkTreeIter *iter)
+update_group (GbfProjectModel *model, AnjutaProjectGroup *group, GtkTreeIter *iter)
 {
 	GtkTreeModel *tree_model;
-	GbfProjectGroup *group;
 	GtkTreeIter child;
 	GList *node;
-	
+	GList *groups;
+	GList *targets;
+	GList *sources;
+
+	if ((!group) || (anjuta_project_node_get_type (group) != ANJUTA_PROJECT_GROUP))
+		return;
+
 	tree_model = GTK_TREE_MODEL (model);
-	group = gbf_project_get_group (model->priv->proj, group_id, NULL);
 	
 	/* update group data. nothing to do here */
+	groups = gbf_project_util_all_child (group, ANJUTA_PROJECT_GROUP);
+	targets = gbf_project_util_all_child (group, ANJUTA_PROJECT_TARGET);
+	sources = gbf_project_util_all_child (group, ANJUTA_PROJECT_SOURCE);
 
 	/* walk the tree group */
 	/* group can be NULL, but we iterate anyway to remove any
 	 * shortcuts the old group could have had */
 	if (gtk_tree_model_iter_children (tree_model, &child, iter)) {
-		GbfTreeData *data;
 		gboolean valid = TRUE;
 		
 		while (valid) {
 			gboolean remove_child = FALSE;
-			
-			gtk_tree_model_get (tree_model, &child,
-					    GBF_PROJECT_MODEL_COLUMN_DATA, &data,
-					    -1);
+			AnjutaProjectNode* data;
 
 			/* find the iterating id in the group's children */
-			if (data->type == GBF_TREE_NODE_GROUP) {
+			data = gbf_project_model_get_node (model, &child);
+			
+			if (anjuta_project_node_get_type (data) == ANJUTA_PROJECT_GROUP) {
 				/* update recursively */
-				update_group (model, data->id, &child);
-				if (group && (node = g_list_find_custom (group->groups, data->id,
-									 (GCompareFunc) strcmp))) {
-					group->groups = g_list_delete_link (group->groups, node);
+				update_group (model, data, &child);
+				if (group && (node = g_list_find (groups, data))) {
+					groups = g_list_delete_link (groups, node);
 				} else {
 					remove_child = TRUE;
 				}
 				
-			} else if (data->type == GBF_TREE_NODE_TARGET) {
+			} else if (anjuta_project_node_get_type (data) == ANJUTA_PROJECT_TARGET) {
 				GtkTreePath *shortcut;
 
-				if (group && (node = g_list_find_custom (group->targets,
-									 data->id,
-									 (GCompareFunc) strcmp))) {
-					group->targets = g_list_delete_link (group->targets, node);
+				if (group && (node = g_list_find (targets, data))) {
+					targets = g_list_delete_link (targets, node);
 					/* update recursively */
-					update_target (model, data->id, &child);
+					update_target (model, data, &child);
 				} else {
 					remove_child = TRUE;
 				}
 
 				/* remove or update the shortcut if it previously existed */
-				shortcut = find_shortcut (model, data->id);
+				shortcut = find_shortcut (model, data);
 				if (shortcut) {
 					GtkTreeIter tmp;
 					
 					if (remove_child)
-						remove_shortcut (model, data->id);
+						remove_shortcut (model, data);
 
 					if (gtk_tree_model_get_iter (tree_model, &tmp, shortcut)) {
 						if (remove_child)
 							gtk_tree_store_remove (GTK_TREE_STORE (model), &tmp);
 						else
-							update_target (model, data->id, &tmp);
+							update_target (model, data, &tmp);
 					}
 					gtk_tree_path_free (shortcut);
 				}
+			} else if (anjuta_project_node_get_type (data)  == ANJUTA_PROJECT_SOURCE) {
+				if ((data) && (node = g_list_find (sources, data))) {
+					sources = g_list_delete_link (sources, node);
+				} else {
+					remove_child = TRUE;
+				}
 			}
-			
-			gbf_tree_data_free (data);
+		
 			if (remove_child)
 				valid = gtk_tree_store_remove (GTK_TREE_STORE (model), &child);
 			else
@@ -645,35 +650,36 @@ update_group (GbfProjectModel *model, const gchar *group_id, GtkTreeIter *iter)
 	}
 
 	if (group) {
-		/* add the remaining targets and groups */
-		for (node = group->groups; node; node = node->next)
+		/* add the remaining sources, targets and groups */
+		for (node = groups; node; node = node->next)
 			add_target_group (model, node->data, iter);
 		
-		for (node = group->targets; node; node = node->next)
+		for (node = targets; node; node = node->next)
 			add_target (model, node->data, iter);
-	
-		gbf_project_group_free (group);
+
+		for (node = sources; node; node = g_list_next (node))
+			add_source (model, node->data, iter);
 	}
 }
 
 static void
-project_updated_cb (GbfProject *project, GbfProjectModel *model)
+project_updated_cb (IAnjutaProject *project, GbfProjectModel *model)
 {
 	GtkTreePath *path;
 	GtkTreeIter iter;
 
 	path = gtk_tree_row_reference_get_path (model->priv->root_row);
 	if (path && gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path))
-		update_group (model, "/", &iter);
+		update_group (model, ianjuta_project_get_root (project, NULL), &iter);
 	else
-		add_target_group (model, "/", NULL);
+		add_target_group (model, ianjuta_project_get_root (project, NULL), NULL);
 			
 	if (path)
 		gtk_tree_path_free (path);
 }
 
 static void
-load_project (GbfProjectModel *model, GbfProject *proj)
+load_project (GbfProjectModel *model, IAnjutaProject *proj)
 {
 	model->priv->proj = proj;
 	g_object_ref (proj);
@@ -681,7 +687,7 @@ load_project (GbfProjectModel *model, GbfProject *proj)
 	/* to get rid of the empty node */
 	gtk_tree_store_clear (GTK_TREE_STORE (model));
 
-	add_target_group (model, "/", NULL);
+	add_target_group (model, ianjuta_project_get_root (proj, NULL), NULL);
 
 	model->priv->project_updated_handler =
 		g_signal_connect (model->priv->proj, "project-updated",
@@ -708,7 +714,6 @@ unload_project (GbfProjectModel *model)
 
 		gtk_tree_store_clear (GTK_TREE_STORE (model));
 
-		g_list_foreach (model->priv->shortcuts, (GFunc) g_free, NULL);
 		g_list_free (model->priv->shortcuts);
 		model->priv->shortcuts = NULL;
 		
@@ -723,10 +728,10 @@ unload_project (GbfProjectModel *model)
 }
 
 static gboolean 
-recursive_find_id (GtkTreeModel    *model,
-		   GtkTreeIter     *iter,
-		   GbfTreeNodeType  type,
-		   const gchar     *id)
+recursive_find_id (GtkTreeModel   	*model,
+		   GtkTreeIter     	*iter,
+		   GbfTreeNodeType  	 type,
+		   AnjutaProjectNode	*id)
 {
 	GtkTreeIter tmp;
 	GbfTreeData *data;
@@ -739,7 +744,7 @@ recursive_find_id (GtkTreeModel    *model,
 		
 		gtk_tree_model_get (model, &tmp,
 				    GBF_PROJECT_MODEL_COLUMN_DATA, &data, -1);
-		if (data->type == type && !strcmp (id, data->id)) {
+		if (id == data->id) {
 			*iter = tmp;
 			retval = TRUE;
 		}
@@ -758,10 +763,10 @@ recursive_find_id (GtkTreeModel    *model,
 }
 
 gboolean 
-gbf_project_model_find_id (GbfProjectModel *model,
-			   GtkTreeIter     *iter,
-			   GbfTreeNodeType  type,
-			   const gchar     *id)
+gbf_project_model_find_id (GbfProjectModel 	*model,
+			   GtkTreeIter     	*iter,
+			   GbfTreeNodeType  	 type,
+			   AnjutaProjectNode   *id)
 {
 	GtkTreePath *root;
 	GtkTreeIter tmp_iter;
@@ -783,7 +788,7 @@ gbf_project_model_find_id (GbfProjectModel *model,
 }
 
 GbfProjectModel *
-gbf_project_model_new (GbfProject *project)
+gbf_project_model_new (IAnjutaProject *project)
 {
 	return GBF_PROJECT_MODEL (g_object_new (GBF_TYPE_PROJECT_MODEL,
 						"project", project,
@@ -791,10 +796,10 @@ gbf_project_model_new (GbfProject *project)
 }
 
 void 
-gbf_project_model_set_project (GbfProjectModel *model, GbfProject *project)
+gbf_project_model_set_project (GbfProjectModel *model, IAnjutaProject *project)
 {
 	g_return_if_fail (model != NULL && GBF_IS_PROJECT_MODEL (model));
-	g_return_if_fail (project == NULL || GBF_IS_PROJECT (project));
+	g_return_if_fail (project == NULL || IANJUTA_IS_PROJECT (project));
 	
 	if (model->priv->proj)
 		unload_project (model);
@@ -803,7 +808,7 @@ gbf_project_model_set_project (GbfProjectModel *model, GbfProject *project)
 		load_project (model, project);
 }
 
-GbfProject *
+IAnjutaProject *
 gbf_project_model_get_project (GbfProjectModel *model)
 {
 	g_return_val_if_fail (model != NULL && GBF_IS_PROJECT_MODEL (model), NULL);
@@ -824,6 +829,53 @@ gbf_project_model_get_project_root (GbfProjectModel *model)
 	return path;
 }
 
+AnjutaProjectNode *
+gbf_project_model_get_node (GbfProjectModel *model,
+                            GtkTreeIter     *iter)
+{
+	GbfTreeData *data = NULL;
+	AnjutaProjectNode *parent;
+	AnjutaProjectNode *node = NULL;
+	GtkTreeIter piter;
+	GFile *file;
+		
+	gtk_tree_model_get (GTK_TREE_MODEL (model), iter,
+			    GBF_PROJECT_MODEL_COLUMN_DATA, &data,
+			    -1);
+	if (data != NULL)
+	{
+		switch (data->type)
+		{
+		case GBF_TREE_NODE_GROUP:
+			file = g_file_new_for_uri (data->uri);
+	        	node = anjuta_project_group_get_node_from_file (ianjuta_project_get_root (model->priv->proj, NULL), file);
+			g_object_unref (file);
+			break;
+		case GBF_TREE_NODE_TARGET:
+			if (!gtk_tree_model_iter_parent (GTK_TREE_MODEL (model), &piter, iter))
+				break;
+			parent = gbf_project_model_get_node (model, &piter);
+	        	if (parent) node = anjuta_project_target_get_node_from_name (parent, data->name);
+			break;
+		case GBF_TREE_NODE_SOURCE:
+			if (!gtk_tree_model_iter_parent (GTK_TREE_MODEL (model), &piter, iter))
+				break;
+			parent = gbf_project_model_get_node (model, &piter);
+	        	if (parent)
+			{
+				file = g_file_new_for_uri (data->uri);
+				node = anjuta_project_source_get_node_from_file (parent, file);
+				g_object_unref (file);
+			}
+			break;
+		default:
+			break;
+		}
+		gbf_tree_data_free (data);
+	}
+
+	return node;
+}
 
 /* DND stuff ------------- */
 
diff --git a/plugins/project-manager/gbf-project-model.h b/plugins/project-manager/gbf-project-model.h
index 3129c2c..f18b0d7 100644
--- a/plugins/project-manager/gbf-project-model.h
+++ b/plugins/project-manager/gbf-project-model.h
@@ -25,7 +25,8 @@
 
 #include <glib-object.h>
 #include <gtk/gtk.h>
-#include <libanjuta/gbf-project.h>
+#include <libanjuta/interfaces/ianjuta-project.h>
+#include <libanjuta/anjuta-project.h>
 #include "gbf-tree-data.h"
 
 #define GBF_TYPE_PROJECT_MODEL            (gbf_project_model_get_type ())
@@ -53,16 +54,18 @@ struct _GbfProjectModelClass {
 };
 
 GType            gbf_project_model_get_type          (void); 
-GbfProjectModel *gbf_project_model_new               (GbfProject      *project);
+GbfProjectModel *gbf_project_model_new               (IAnjutaProject    *project);
 
-void             gbf_project_model_set_project       (GbfProjectModel *model,
-                                                      GbfProject      *project);
-GbfProject      *gbf_project_model_get_project       (GbfProjectModel *model);
+void             gbf_project_model_set_project       (GbfProjectModel   *model,
+                                                      IAnjutaProject    *project);
+IAnjutaProject  *gbf_project_model_get_project       (GbfProjectModel   *model);
 
-GtkTreePath     *gbf_project_model_get_project_root  (GbfProjectModel *model);
-gboolean         gbf_project_model_find_id           (GbfProjectModel *model,
-                                                      GtkTreeIter     *iter,
-                                                      GbfTreeNodeType  type,
-                                                      const gchar     *id);
+GtkTreePath     *gbf_project_model_get_project_root  (GbfProjectModel   *model);
+gboolean         gbf_project_model_find_id           (GbfProjectModel   *model,
+                                                      GtkTreeIter       *iter,
+                                                      GbfTreeNodeType    type,
+                                                      AnjutaProjectNode *id);
+AnjutaProjectNode *gbf_project_model_get_node        (GbfProjectModel *model,
+                                                      GtkTreeIter     *iter);
 
 #endif
diff --git a/plugins/project-manager/gbf-project-util.c b/plugins/project-manager/gbf-project-util.c
index c57d702..4f9cc51 100644
--- a/plugins/project-manager/gbf-project-util.c
+++ b/plugins/project-manager/gbf-project-util.c
@@ -76,9 +76,9 @@ groups_filter_fn (GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
 }
 
 static void 
-setup_groups_treeview (GbfProjectModel *model,
-                       GtkWidget       *view,
-                       const gchar     *select_group)
+setup_groups_treeview (GbfProjectModel    *model,
+                       GtkWidget          *view,
+                       AnjutaProjectGroup *select_group)
 {
     GtkTreeModel *filter;
     GtkTreePath *path;
@@ -163,19 +163,19 @@ entry_changed_cb (GtkEditable *editable, gpointer user_data)
     g_free (text);
 }
 
-gchar*
-gbf_project_util_new_group (GbfProjectModel *model,
-                            GtkWindow       *parent,
-                            const gchar     *default_group,
-                            const gchar     *default_group_name_to_add)
+AnjutaProjectGroup*
+gbf_project_util_new_group (GbfProjectModel    *model,
+                            GtkWindow          *parent,
+                            AnjutaProjectGroup *default_group,
+                            const gchar        *default_group_name_to_add)
 {
     GtkBuilder *gui;
     GtkWidget *dialog, *group_name_entry, *ok_button;
     GtkWidget *groups_view;
     gint response;
-    GbfProject *project;
+    IAnjutaProject *project;
     gboolean finished = FALSE;
-    gchar *new_group = NULL;
+    AnjutaProjectGroup *new_group = NULL;
 
     g_return_val_if_fail (model != NULL, NULL);
     
@@ -218,20 +218,16 @@ gbf_project_util_new_group (GbfProjectModel *model,
             case GTK_RESPONSE_OK: 
             {
                 GError *err = NULL;
-                GbfTreeData *data;
-                gchar *parent_id = NULL, *name;
+                AnjutaProjectNode *group;
+                gchar *name;
             
                 name = gtk_editable_get_chars (
                     GTK_EDITABLE (group_name_entry), 0, -1);
-                data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (groups_view),
-                                                       GBF_TREE_NODE_GROUP);
-                if (data) {
-                    gchar *new_group = NULL;
-                    
-                    parent_id = g_strdup (data->id);
-                    gbf_tree_data_free (data);
-		    
-                    new_group = gbf_project_add_group (project, parent_id, name, &err);
+                
+                group = gbf_project_view_find_selected (GBF_PROJECT_VIEW (groups_view),
+                                                       ANJUTA_PROJECT_GROUP);
+                if (group) {
+                    new_group = ianjuta_project_add_group (project, group, name, &err);
                     if (err) {
                         error_dialog (parent, _("Cannot add group"), "%s",
                                       err->message);
@@ -239,7 +235,6 @@ gbf_project_util_new_group (GbfProjectModel *model,
                     } else {
 			finished = TRUE;
 		    }
-                    g_free (parent_id);
                 } else {
                     error_dialog (parent, _("Cannot add group"),
 				  "%s", _("No parent group selected"));
@@ -268,24 +263,24 @@ enum {
 
 /* create a tree model with the target types */
 static GtkListStore *
-build_types_store (GbfProject *project)
+build_types_store (IAnjutaProject *project)
 {
     GtkListStore *store;
     GtkTreeIter iter;
-    gchar **types;
-    gint i;
-    
-    types = gbf_project_get_types (project);
+    GList *types;
+    GList *node;
+
+    types = ianjuta_project_get_target_types (project, NULL);
     store = gtk_list_store_new (TARGET_TYPE_N_COLUMNS,
-                                G_TYPE_STRING,
+                                G_TYPE_POINTER,
                                 G_TYPE_STRING,
                                 GDK_TYPE_PIXBUF);
     
-    for (i = 0; types [i]; i++) {
+    for (node = g_list_first (types); node != NULL; node = g_list_next (node)) {
         GdkPixbuf *pixbuf;
         const gchar *name;
 
-        name = gbf_project_name_for_type (project, types [i]);
+        name = anjuta_project_target_type_name ((AnjutaProjectTargetType)node->data);
         pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default(),
                                            GTK_STOCK_CONVERT,
                                            ICON_SIZE,
@@ -294,7 +289,7 @@ build_types_store (GbfProject *project)
 
         gtk_list_store_append (store, &iter);
         gtk_list_store_set (store, &iter,
-                            TARGET_TYPE_TYPE, types [i],
+                            TARGET_TYPE_TYPE, node->data,
                             TARGET_TYPE_NAME, name,
                             TARGET_TYPE_PIXBUF, pixbuf,
                             -1);
@@ -303,15 +298,15 @@ build_types_store (GbfProject *project)
             g_object_unref (pixbuf);
     }
 
-    g_strfreev (types);
+    g_list_free (types);
 
     return store;
 }
 
-gchar* 
+AnjutaProjectTarget* 
 gbf_project_util_new_target (GbfProjectModel *model,
                              GtkWindow       *parent,
-                             const gchar     *default_group,
+                             AnjutaProjectGroup *default_group,
                              const gchar     *default_target_name_to_add)
 {
     GtkBuilder *gui;
@@ -320,9 +315,9 @@ gbf_project_util_new_target (GbfProjectModel *model,
     GtkListStore *types_store;
     GtkCellRenderer *renderer;
     gint response;
-    GbfProject *project;
+    IAnjutaProject *project;
     gboolean finished = FALSE;
-    gchar *new_target = NULL;
+    AnjutaProjectTarget *new_target = NULL;
     
     g_return_val_if_fail (model != NULL, NULL);
     
@@ -392,14 +387,15 @@ gbf_project_util_new_target (GbfProjectModel *model,
             case GTK_RESPONSE_OK: 
             {
                 GError *err = NULL;
-                GbfTreeData *data;
+                AnjutaProjectNode *group;
                 GtkTreeIter iter;
-                gchar *group_id = NULL, *name, *type = NULL;
+                gchar *name;
+                AnjutaProjectTargetType type = NULL;
                 
                 name = gtk_editable_get_chars (
                     GTK_EDITABLE (target_name_entry), 0, -1);
-                data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (groups_view),
-                                                       GBF_TREE_NODE_GROUP);
+                group = gbf_project_view_find_selected (GBF_PROJECT_VIEW (groups_view),
+                                                         ANJUTA_PROJECT_GROUP);
 
                 /* retrieve target type */
                 if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (target_type_combo), &iter)) {
@@ -408,11 +404,8 @@ gbf_project_util_new_target (GbfProjectModel *model,
                                         -1);
                 }
                 
-                if (data && type) {
-                    group_id = g_strdup (data->id);
-                    gbf_tree_data_free (data);
-            
-                    new_target = gbf_project_add_target (project, group_id, name, type, &err);
+                if (group && type) {
+                    new_target = ianjuta_project_add_target (project, group, name, type, &err);
                     if (err) {
                         error_dialog (parent, _("Cannot add target"), "%s",
                                       err->message);
@@ -420,8 +413,6 @@ gbf_project_util_new_target (GbfProjectModel *model,
                     } else {
 			finished = TRUE;
 		    }
-		    g_free (group_id);
-                    g_free (type);
                 } else {
                     error_dialog (parent, _("Cannot add target"), "%s",
 				  _("No group selected"));
@@ -461,10 +452,10 @@ targets_filter_fn (GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
 }
 
 static void 
-setup_targets_treeview (GbfProjectModel *model,
-                        GtkWidget       *view,
-                        const gchar     *select_target,
-                        const gchar     *select_group)
+setup_targets_treeview (GbfProjectModel     *model,
+                        GtkWidget           *view,
+                        AnjutaProjectTarget *select_target,
+                        AnjutaProjectGroup  *select_group)
 {
     GtkTreeModel *filter;
     GtkTreeIter iter, iter_filter;
@@ -590,12 +581,12 @@ on_row_changed(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, gpoint
 		gtk_widget_set_sensitive(button, FALSE);
 }
 
-gchar*
-gbf_project_util_add_source (GbfProjectModel *model,
-                             GtkWindow       *parent,
-                             const gchar     *default_target,
-                             const gchar     *default_group,
-                             const gchar     *default_uri)
+AnjutaProjectSource*
+gbf_project_util_add_source (GbfProjectModel     *model,
+                             GtkWindow           *parent,
+                             AnjutaProjectTarget *default_target,
+                             AnjutaProjectGroup  *default_group,
+                             const gchar         *default_uri)
 {
         GList* new_sources;
 	gchar* uri = NULL;
@@ -610,11 +601,11 @@ gbf_project_util_add_source (GbfProjectModel *model,
                                                    default_target,
                                                    default_group, uris);
 	g_free (uri);
+        g_list_free (uris);
 	
 	if (new_sources && g_list_length (new_sources))
 	{
-		gchar* new_source = g_strdup (new_sources->data);
-                g_list_foreach (new_sources, (GFunc) g_free, NULL);
+		AnjutaProjectSource *new_source = new_sources->data;
 		g_list_free (new_sources);
 		return new_source;
 	}
@@ -623,18 +614,18 @@ gbf_project_util_add_source (GbfProjectModel *model,
 }
 
 GList* 
-gbf_project_util_add_source_multi (GbfProjectModel *model,
-				   GtkWindow       *parent,
-				   const gchar     *default_target,
-				   const gchar     *default_group,
-				   GList     *uris_to_add)
+gbf_project_util_add_source_multi (GbfProjectModel     *model,
+				   GtkWindow           *parent,
+                                   AnjutaProjectTarget *default_target,
+                                   AnjutaProjectGroup  *default_group,
+				   GList               *uris_to_add)
 {
     GtkBuilder *gui;
     GtkWidget *dialog, *source_file_tree;
     GtkWidget *ok_button, *browse_button;
     GtkWidget *targets_view;
     gint response;
-    GbfProject *project;
+    IAnjutaProject *project;
     gboolean finished = FALSE;
     gchar *project_root;
     GtkListStore* list;
@@ -723,36 +714,36 @@ gbf_project_util_add_source_multi (GbfProjectModel *model,
         switch (response) {
             case GTK_RESPONSE_OK: 
             {
-                GbfTreeData *data;
-                gchar *target_id = NULL;
+                AnjutaProjectNode *target;
             
-                data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (targets_view),
-                                                       GBF_TREE_NODE_TARGET);
-		if (data) {
+                target = gbf_project_view_find_selected (GBF_PROJECT_VIEW (targets_view),
+                                                         ANJUTA_PROJECT_TARGET);
+		if (target) {
 		    GtkTreeIter iter;
 		    GString *err_mesg = g_string_new (NULL);
 		    
-		    target_id = g_strdup (data->id);
-		    gbf_tree_data_free (data);
-		    
 		    if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list),
 							&iter))
 			break;
 		    do
 		    {
 			GError *err = NULL;
-			gchar* new_source;
-			gchar* source_file;
+			AnjutaProjectSource* new_source;
+			gchar* uri;
+                        GFile* source_file;
+
 			gtk_tree_model_get (GTK_TREE_MODEL(list), &iter,
-					    COLUMN_URI, &source_file, -1);
-			
-			new_source = gbf_project_add_source (project,
-							     target_id,
+					    COLUMN_URI, &uri, -1);
+
+                        source_file = g_file_new_for_uri (uri);
+			new_source = ianjuta_project_add_source (project,
+							     target,
 							     source_file,
 							     &err);
+                        g_object_unref (source_file);
 			if (err) {
 			    gchar *str = g_strdup_printf ("%s: %s\n",
-							  source_file,
+							  uri,
 							  err->message);
 			    g_string_append (err_mesg, str);
 			    g_error_free (err);
@@ -762,12 +753,10 @@ gbf_project_util_add_source_multi (GbfProjectModel *model,
 			    new_sources = g_list_append (new_sources,
 							 new_source);
 			
-			g_free (source_file);
+			g_free (uri);
 		    } while (gtk_tree_model_iter_next (GTK_TREE_MODEL(list),
 						       &iter));
 		    
-                    g_free (target_id);
-		    
 		    if (err_mesg->str && strlen (err_mesg->str) > 0) {
 			error_dialog (parent, _("Cannot add source files"),
 				      "%s", err_mesg->str);
@@ -794,3 +783,64 @@ gbf_project_util_add_source_multi (GbfProjectModel *model,
     g_object_unref (gui);
     return new_sources;
 }
+
+GList *
+gbf_project_util_all_child (AnjutaProjectNode *parent, AnjutaProjectNodeType type)
+{
+    AnjutaProjectNode *node;
+    GList *list = NULL;
+ 
+    for (node = anjuta_project_node_first_child (parent); node != NULL; node = anjuta_project_node_next_sibling (node))
+    {
+        if (anjuta_project_node_get_type (node) == type)
+        {
+            list = g_list_prepend (list, node);
+        }
+    }
+ 
+    list = g_list_reverse (list);
+ 
+    return list;
+}
+ 
+GList *
+gbf_project_util_node_all (AnjutaProjectNode *parent, AnjutaProjectNodeType type)
+{
+    AnjutaProjectNode *node;
+    GList *list = NULL;
+ 
+    for (node = anjuta_project_node_first_child (parent); node != NULL; node = anjuta_project_node_next_sibling (node))
+    {
+        if (anjuta_project_node_get_type (node) == type)
+        {
+            list = g_list_prepend (list, node);
+        }
+        if (anjuta_project_node_get_type (node) == ANJUTA_PROJECT_GROUP)
+        {
+            GList *child_list;
+ 
+            child_list = gbf_project_util_node_all (node, type);
+            child_list = g_list_reverse (child_list);
+            list = g_list_concat (child_list, list);
+        }
+    }
+ 
+    list = g_list_reverse (list);
+ 
+    return list;
+}
+
+GList *
+gbf_project_util_replace_by_uri (GList* list)
+{
+        GList* link;
+    
+	for (link = g_list_first (list); link != NULL; link = g_list_next (link))
+	{
+                AnjutaProjectNode *node = (AnjutaProjectNode *)link->data;
+
+                link->data = anjuta_project_node_get_uri (node);
+	}
+
+        return list;
+}
diff --git a/plugins/project-manager/gbf-project-util.h b/plugins/project-manager/gbf-project-util.h
index abc71e1..f859f70 100644
--- a/plugins/project-manager/gbf-project-util.h
+++ b/plugins/project-manager/gbf-project-util.h
@@ -25,33 +25,40 @@
 
 #include <glib.h>
 #include <gtk/gtk.h>
+#include <libanjuta/anjuta-project.h>
 #include "gbf-project-model.h"
 
 G_BEGIN_DECLS
 
-gchar* gbf_project_util_new_group  (GbfProjectModel *model,
-				    GtkWindow       *parent,
-				    const gchar     *default_group,
-				    const gchar     *default_group_name_to_add);
-
-gchar* gbf_project_util_new_target (GbfProjectModel *model,
-				    GtkWindow       *parent,
-				    const gchar     *default_group,
-				    const gchar     *default_target_name_to_add);
-
-gchar* gbf_project_util_add_source (GbfProjectModel *model,
-				    GtkWindow       *parent,
-				    const gchar     *default_target,
-				    const gchar     *default_group,
-				    const gchar     *default_uri_to_add);
-
-GList* gbf_project_util_add_source_multi (GbfProjectModel *model,
-				    GtkWindow       *parent,
-				    const gchar     *default_target,
-				    const gchar     *default_group,
-				    GList     *uris_to_add);
-				    
+AnjutaProjectGroup* gbf_project_util_new_group  (GbfProjectModel   *model,
+				                GtkWindow          *parent,
+				                AnjutaProjectGroup *default_group,
+				                const gchar        *default_group_name_to_add);
+
+AnjutaProjectTarget* gbf_project_util_new_target (GbfProjectModel  *model,
+				                GtkWindow          *parent,
+				                AnjutaProjectGroup *default_group,
+				                const gchar        *default_target_name_to_add);
+
+AnjutaProjectSource* gbf_project_util_add_source (GbfProjectModel   *model,
+				                GtkWindow           *parent,
+				                AnjutaProjectTarget *default_target,
+				                AnjutaProjectGroup  *default_group,
+				                const gchar         *default_uri_to_add);
+
+GList* gbf_project_util_add_source_multi (GbfProjectModel   *model,
+				        GtkWindow           *parent,
+        		                AnjutaProjectTarget *default_target,
+				        AnjutaProjectGroup  *default_group,
+				        GList               *uris_to_add);
 				    
+GList * gbf_project_util_all_child (AnjutaProjectNode *parent,
+                                        AnjutaProjectNodeType type);
+
+GList * gbf_project_util_node_all (AnjutaProjectNode *parent,
+                                        AnjutaProjectNodeType type);
+
+GList * gbf_project_util_replace_by_uri (GList* list);
 				    
 G_END_DECLS
 
diff --git a/plugins/project-manager/gbf-project-view.c b/plugins/project-manager/gbf-project-view.c
index f932a0c..b870f6f 100644
--- a/plugins/project-manager/gbf-project-view.c
+++ b/plugins/project-manager/gbf-project-view.c
@@ -91,13 +91,13 @@ row_activated (GtkTreeView       *tree_view,
 	if (data->type == GBF_TREE_NODE_TARGET) {
 		g_signal_emit (G_OBJECT (tree_view),
 			       signals [TARGET_SELECTED], 0,
-			       data->id);
+			       data->name);
 	}
 	
 	if (data->type == GBF_TREE_NODE_GROUP) {
 		g_signal_emit (G_OBJECT (tree_view),
 			       signals [GROUP_SELECTED], 0,
-			       data->id);
+			       data->uri);
 	}
 	
 	gbf_tree_data_free (data);
@@ -174,7 +174,7 @@ set_pixbuf (GtkTreeViewColumn *tree_column,
 	g_return_if_fail (data != NULL);
 	
 	switch (data->type) {
-		case GBF_TREE_NODE_TARGET_SOURCE:
+		case GBF_TREE_NODE_SOURCE:
 		{
 			pixbuf = get_icon (data->uri);
 			break;
@@ -309,8 +309,8 @@ gbf_project_view_class_init (GbfProjectViewClass *klass)
 			      G_STRUCT_OFFSET (GbfProjectViewClass,
 					       target_selected),
 			      NULL, NULL,
-			      g_cclosure_marshal_VOID__STRING,
-			      G_TYPE_NONE, 1, G_TYPE_STRING);
+			      g_cclosure_marshal_VOID__POINTER,
+			      G_TYPE_NONE, 1, G_TYPE_POINTER);
 	signals [GROUP_SELECTED] = 
 		g_signal_new ("group_selected",
 			      GBF_TYPE_PROJECT_VIEW,
@@ -318,8 +318,8 @@ gbf_project_view_class_init (GbfProjectViewClass *klass)
 			      G_STRUCT_OFFSET (GbfProjectViewClass,
 					       group_selected),
 			      NULL, NULL,
-			      g_cclosure_marshal_VOID__STRING,
-			      G_TYPE_NONE, 1, G_TYPE_STRING);
+			      g_cclosure_marshal_VOID__POINTER,
+			      G_TYPE_NONE, 1, G_TYPE_POINTER);
 }
 
 static void 
@@ -367,37 +367,39 @@ gbf_project_view_new (void)
 	return GTK_WIDGET (g_object_new (GBF_TYPE_PROJECT_VIEW, NULL));
 }
 
-GbfTreeData *
-gbf_project_view_find_selected (GbfProjectView *view, GbfTreeNodeType type)
+AnjutaProjectNode *
+gbf_project_view_find_selected (GbfProjectView *view, AnjutaProjectNodeType type)
 {
-	GbfTreeData *data = NULL;
 	GtkTreeSelection *selection;
 	GtkTreeModel *model;
-	GtkTreeIter iter, iter2;
+	GtkTreeIter iter;
+	AnjutaProjectNode *node = NULL;
 
 	g_return_val_if_fail (view != NULL, NULL);
 	g_return_val_if_fail (GBF_IS_PROJECT_VIEW (view), NULL);
 	
 	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
 	if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
-		gtk_tree_model_get (model, &iter,
-				    GBF_PROJECT_MODEL_COLUMN_DATA, &data,
-				    -1);
-		/* walk up the hierarchy searching for a node of the given type */
-		while (NULL != data && data->type != type) {
-			gbf_tree_data_free (data);
-			data = NULL;
-
-			if (!gtk_tree_model_iter_parent (model, &iter2, &iter))
-				break;
+		if (GBF_IS_PROJECT_MODEL (model))
+		{
+			node = gbf_project_model_get_node (GBF_PROJECT_MODEL (model), &iter);
+		}
+		else if (GTK_IS_TREE_MODEL_FILTER (model))
+		{
+			GtkTreeIter child_iter;
 			
-			gtk_tree_model_get (model, &iter2,
-					    GBF_PROJECT_MODEL_COLUMN_DATA, &data,
-					    -1);
-			iter = iter2;
+			gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (model), &child_iter, &iter);
+			model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model));
+			node = gbf_project_model_get_node (GBF_PROJECT_MODEL (model), &child_iter);
+		}
+
+		/* walk up the hierarchy searching for a node of the given type */
+		while ((node != NULL) && (anjuta_project_node_get_type (node) != type))
+		{
+			node = anjuta_project_node_parent (node);
 		}
 	}
 
-	return data;
+	return node;
 }
 
diff --git a/plugins/project-manager/gbf-project-view.h b/plugins/project-manager/gbf-project-view.h
index db62a24..99c9ba4 100644
--- a/plugins/project-manager/gbf-project-view.h
+++ b/plugins/project-manager/gbf-project-view.h
@@ -24,6 +24,7 @@
 #define _GBF_PROJECT_TREE_H_
 
 #include <gtk/gtk.h>
+#include <libanjuta/anjuta-project.h>
 #include "gbf-tree-data.h"
 
 G_BEGIN_DECLS
@@ -51,17 +52,17 @@ struct _GbfProjectViewClass {
 	void (* uri_activated)    (GbfProjectView *project_view,
 				   const char     *uri);
 
-	void (* target_selected)  (GbfProjectView *project_view,
-				   const gchar    *target_id);
-	void (* group_selected)  (GbfProjectView *project_view,
-				   const gchar    *group_id);
+	void (* target_selected)  (GbfProjectView      *project_view,
+				   AnjutaProjectTarget *target);
+	void (* group_selected)  (GbfProjectView       *project_view,
+				   AnjutaProjectGroup  *group);
 };
 
 GType                       gbf_project_view_get_type         (void);
 GtkWidget                  *gbf_project_view_new              (void);
 
-GbfTreeData                *gbf_project_view_find_selected    (GbfProjectView *view,
-							       GbfTreeNodeType type);
+AnjutaProjectNode          *gbf_project_view_find_selected    (GbfProjectView *view,
+							       AnjutaProjectNodeType type);
 
 G_END_DECLS
 
diff --git a/plugins/project-manager/gbf-tree-data.c b/plugins/project-manager/gbf-tree-data.c
index 37ac2c8..042a2f5 100644
--- a/plugins/project-manager/gbf-tree-data.c
+++ b/plugins/project-manager/gbf-tree-data.c
@@ -53,60 +53,70 @@ gbf_tree_data_new_string (const gchar *string)
 }
 
 GbfTreeData *
-gbf_tree_data_new_group (GbfProject *project, const GbfProjectGroup *group)
+gbf_tree_data_new_group (IAnjutaProject *project, AnjutaProjectGroup *group)
 {
 	GbfTreeData *node = g_new0 (GbfTreeData, 1);
-	
+	GFileInfo *ginfo;
+
 	node->type = GBF_TREE_NODE_GROUP;
-	node->name = g_strdup (group->name);
-	node->id = g_strdup (group->id);
+	node->id = group;
+	node->uri = g_file_get_uri (anjuta_project_group_get_directory (group));
+	
+	
+	ginfo = g_file_query_info (anjuta_project_group_get_directory (group),
+	    G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+	    G_FILE_QUERY_INFO_NONE,
+	    NULL, NULL);
+	if (ginfo)
+	{
+		node->name = g_strdup (g_file_info_get_display_name (ginfo));
+	        g_object_unref(ginfo);
+	}
+	else
+	{
+		node->name = g_strdup ("?");
+	}
 
 	return node;
 }
 
 GbfTreeData *
-gbf_tree_data_new_target (GbfProject *project, const GbfProjectTarget *target)
+gbf_tree_data_new_target (IAnjutaProject *project, AnjutaProjectTarget *target)
 {
 	GbfTreeData *node = g_new0 (GbfTreeData, 1);
 	
 	node->type = GBF_TREE_NODE_TARGET;
-	node->name = g_strdup (target->name);
-	node->id = g_strdup (target->id);
-	node->mime_type = g_strdup (gbf_project_mimetype_for_type (project, target->type));
+	node->id = target;
+	
+	node->name = g_strdup (anjuta_project_target_get_name (target));
+	node->mime_type = g_strdup (anjuta_project_target_type_mime (anjuta_project_target_get_type (target)));
 	
 	return node;
 }
 
 GbfTreeData *
-gbf_tree_data_new_source (GbfProject *project, const GbfProjectTargetSource *source)
+gbf_tree_data_new_source (IAnjutaProject *project, AnjutaProjectSource *source)
 {
 	GbfTreeData *node = g_new0 (GbfTreeData, 1);
-	GFile *file;
-	GFileInfo *file_info;
+	GFileInfo *ginfo;
 	
-	node->type = GBF_TREE_NODE_TARGET_SOURCE;
-	node->id = g_strdup (source->id);
-	node->uri = g_strdup (source->source_uri);
-	node->name = NULL;
+	node->type = GBF_TREE_NODE_SOURCE;
+	node->id = source;
 	
-	file = g_file_new_for_uri (source->source_uri);
-	node->name = g_file_get_basename (file);
-	if (g_file_query_exists (file, NULL))
+	node->uri = g_file_get_uri (anjuta_project_source_get_file (source));
+
+	ginfo = g_file_query_info (anjuta_project_source_get_file (source),
+	    G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+	    G_FILE_QUERY_INFO_NONE,
+	    NULL, NULL);
+	if (ginfo)
 	{
-		file_info = g_file_query_info (file, 
-			G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
-			G_FILE_QUERY_INFO_NONE,
-			NULL, NULL);
-		if (file_info)
-		{
-			node->name = g_strdup (g_file_info_get_display_name (file_info));
-		}
+		node->name = g_strdup (g_file_info_get_display_name (ginfo));
+	        g_object_unref(ginfo);
 	}
-	g_object_unref (file);
-
-	if (node->name == NULL)
+	else
 	{
-		node->name = g_file_get_basename (file);
+		node->name = g_file_get_basename (anjuta_project_source_get_file (source));
 	}
 
 	return node;
@@ -120,7 +130,7 @@ gbf_tree_data_copy (GbfTreeData *src)
 	node = g_new (GbfTreeData, 1);
 	node->type = src->type;
 	node->name = g_strdup (src->name);
-	node->id = g_strdup (src->id);
+	node->id = src->id;
 	node->uri = g_strdup (src->uri);
 	node->is_shortcut = src->is_shortcut;
 	node->mime_type = g_strdup (src->mime_type);
@@ -133,7 +143,6 @@ gbf_tree_data_free (GbfTreeData *node)
 {
 	if (node) {
 		g_free (node->name);
-		g_free (node->id);
 		g_free (node->uri);
 		g_free (node->mime_type);
 		g_free (node);
diff --git a/plugins/project-manager/gbf-tree-data.h b/plugins/project-manager/gbf-tree-data.h
index 0c2075b..c34c3b9 100644
--- a/plugins/project-manager/gbf-tree-data.h
+++ b/plugins/project-manager/gbf-tree-data.h
@@ -25,7 +25,8 @@
 #define _GBF_TREE_DATA_H_
 
 #include <glib-object.h>
-#include <libanjuta/gbf-project.h>
+#include <libanjuta/interfaces/ianjuta-project.h>
+#include <libanjuta/anjuta-project.h>
 
 G_BEGIN_DECLS
 
@@ -37,29 +38,29 @@ typedef enum {
 	GBF_TREE_NODE_STRING,
 	GBF_TREE_NODE_GROUP,
 	GBF_TREE_NODE_TARGET,
-	GBF_TREE_NODE_TARGET_SOURCE,
+	GBF_TREE_NODE_SOURCE,
 } GbfTreeNodeType;
 
 struct _GbfTreeData
 {
-	GbfTreeNodeType  type;
-	gchar           *name;
-	gchar           *id;
-	gchar           *uri;
-	gboolean         is_shortcut;
-	gchar           *mime_type;
+	GbfTreeNodeType  	type;
+	gchar           	*name;
+	AnjutaProjectNode	*id;
+	gchar           	*uri;
+	gboolean         	is_shortcut;
+	gchar           	*mime_type;
 };
 
 GType          gbf_tree_data_get_type            (void);
-GbfTreeData   *gbf_tree_data_new_string          (const gchar                  *string);
-GbfTreeData   *gbf_tree_data_new_group           (GbfProject                   *project,
-						  const GbfProjectGroup        *group);
-GbfTreeData   *gbf_tree_data_new_target          (GbfProject                   *project,
-						  const GbfProjectTarget       *target);
-GbfTreeData   *gbf_tree_data_new_source          (GbfProject                   *project,
-						  const GbfProjectTargetSource *source);
-GbfTreeData   *gbf_tree_data_copy                (GbfTreeData                  *data);
-void           gbf_tree_data_free                (GbfTreeData                  *data);
+GbfTreeData   *gbf_tree_data_new_string          (const gchar            *string);
+GbfTreeData   *gbf_tree_data_new_group           (IAnjutaProject         *project,
+						  AnjutaProjectGroup     *group);
+GbfTreeData   *gbf_tree_data_new_target          (IAnjutaProject         *project,
+						  AnjutaProjectTarget    *target);
+GbfTreeData   *gbf_tree_data_new_source          (IAnjutaProject         *project,
+						  AnjutaProjectSource    *source);
+GbfTreeData   *gbf_tree_data_copy                (GbfTreeData            *data);
+void           gbf_tree_data_free                (GbfTreeData            *data);
 
 
 G_END_DECLS
diff --git a/plugins/project-manager/plugin.c b/plugins/project-manager/plugin.c
index bf6ef23..a72c8ed 100644
--- a/plugins/project-manager/plugin.c
+++ b/plugins/project-manager/plugin.c
@@ -27,9 +27,11 @@
 #include <libanjuta/interfaces/ianjuta-file-manager.h>
 #include <libanjuta/interfaces/ianjuta-builder.h>
 #include <libanjuta/interfaces/ianjuta-project-backend.h>
+#include <libanjuta/interfaces/ianjuta-project.h>
 #include <libanjuta/anjuta-profile-manager.h>
 #include <libanjuta/anjuta-debug.h>
 #include <libanjuta/anjuta-status.h>
+#include <libanjuta/anjuta-project.h>
 
 #include "gbf-project-util.h"
 
@@ -53,7 +55,7 @@ typedef enum _PmPropertiesType
 struct _PmPropertiesDialogInfo
 {
 	PmPropertiesType type;
-	const gchar* id;
+	AnjutaProjectNode* id;
 	GtkWidget* dialog;
 };
 
@@ -266,7 +268,7 @@ update_operation_end (ProjectManagerPlugin *plugin, gboolean emit_signal)
 		{
 			GList *post_update_sources =
 			ianjuta_project_manager_get_elements (IANJUTA_PROJECT_MANAGER (plugin),
-												  IANJUTA_PROJECT_MANAGER_SOURCE,
+												  ANJUTA_PROJECT_SOURCE,
 												  NULL);
 			update_operation_emit_signals (plugin, plugin->pre_update_sources,
 										   post_update_sources);
@@ -280,7 +282,7 @@ update_operation_end (ProjectManagerPlugin *plugin, gboolean emit_signal)
 		{
 			GList *post_update_targets =
 			ianjuta_project_manager_get_elements (IANJUTA_PROJECT_MANAGER (plugin),
-												  IANJUTA_PROJECT_MANAGER_TARGET,
+												  ANJUTA_PROJECT_TARGET,
 												  NULL);
 			update_operation_emit_signals (plugin, plugin->pre_update_targets,
 										   post_update_targets);
@@ -294,7 +296,7 @@ update_operation_end (ProjectManagerPlugin *plugin, gboolean emit_signal)
 		{
 			GList *post_update_groups =
 			ianjuta_project_manager_get_elements (IANJUTA_PROJECT_MANAGER (plugin),
-												  IANJUTA_PROJECT_MANAGER_GROUP,
+												  ANJUTA_PROJECT_GROUP,
 												  NULL);
 			update_operation_emit_signals (plugin, plugin->pre_update_groups,
 										   post_update_groups);
@@ -331,15 +333,15 @@ update_operation_begin (ProjectManagerPlugin *plugin)
 	update_operation_end (plugin, FALSE);
 	plugin->pre_update_sources =
 	ianjuta_project_manager_get_elements (IANJUTA_PROJECT_MANAGER (plugin),
-										  IANJUTA_PROJECT_MANAGER_SOURCE,
+										  ANJUTA_PROJECT_SOURCE,
 										  NULL);
 	plugin->pre_update_targets =
 	ianjuta_project_manager_get_elements (IANJUTA_PROJECT_MANAGER (plugin),
-										  IANJUTA_PROJECT_MANAGER_TARGET,
+										  ANJUTA_PROJECT_TARGET,
 										  NULL);
 	plugin->pre_update_groups =
 	ianjuta_project_manager_get_elements (IANJUTA_PROJECT_MANAGER (plugin),
-										  IANJUTA_PROJECT_MANAGER_GROUP,
+										  ANJUTA_PROJECT_GROUP,
 										  NULL);
 }
 
@@ -366,7 +368,7 @@ compare_properties_id (PmPropertiesDialogInfo *info, PmPropertiesDialogInfo *inf
 	return (info->type == info1->type) &&
 			((info1->id == NULL) ||
 			 ((info->id != NULL) &&
-			  (strcmp(info->id, info1->id) == 0))) ? 0 : 1;
+			  (info->id == info1->id))) ? 0 : 1;
 }
 
 static void
@@ -395,7 +397,7 @@ on_properties_dialog_response (GtkDialog *win,
 static void
 project_manager_show_properties_dialog (ProjectManagerPlugin *plugin,
 										PmPropertiesType type,
-										const gchar *id)
+										AnjutaProjectNode *id)
 {
 	PmPropertiesDialogInfo info;
 	GList* prop;
@@ -421,16 +423,16 @@ project_manager_show_properties_dialog (ProjectManagerPlugin *plugin,
 		switch (type)
 		{
 			case PM_PROJECT_PROPERTIES:
-				properties = gbf_project_configure (plugin->project, NULL);
+				properties = ianjuta_project_configure (plugin->project, NULL);
 				title = _("Project properties");
 				break;
 			case PM_TARGET_PROPERTIES:		
-				properties = gbf_project_configure_target (plugin->project,
+				properties = ianjuta_project_configure_node (plugin->project,
 														   id, NULL);
 				title = _("Target properties");
 				break;
 			case PM_GROUP_PROPERTIES:
-				properties = gbf_project_configure_group (plugin->project,
+				properties = ianjuta_project_configure_node (plugin->project,
 														   id, NULL);
 				title = _("Group properties");
 				break;
@@ -478,7 +480,7 @@ on_refresh_idle (gpointer user_data)
 	anjuta_status_push (status, _("Refreshing symbol treeâ?¦"));
 	anjuta_status_busy_push (status);
 	
-	gbf_project_refresh (GBF_PROJECT (plugin->project), &err);
+	ianjuta_project_refresh (IANJUTA_PROJECT (plugin->project), &err);
 	if (err)
 	{
 		anjuta_util_dialog_error (get_plugin_parent_window (plugin),
@@ -562,21 +564,21 @@ on_add_source (GtkAction *action, ProjectManagerPlugin *plugin)
 static void
 on_popup_properties (GtkAction *action, ProjectManagerPlugin *plugin)
 {
-	GbfTreeData *data;
+	AnjutaProjectNode *node;
 	
-	data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-										   GBF_TREE_NODE_TARGET);
-	if (data)
+	node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+										   ANJUTA_PROJECT_TARGET);
+	if (node)
 	{
-		project_manager_show_properties_dialog (plugin, PM_TARGET_PROPERTIES, data->id);
+		project_manager_show_properties_dialog (plugin, PM_TARGET_PROPERTIES, node);
 		return;
 	}
 		
-	data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-										   GBF_TREE_NODE_GROUP);
-	if (data)
+	node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+										   ANJUTA_PROJECT_GROUP);
+	if (node)
 	{
-		project_manager_show_properties_dialog (plugin, PM_GROUP_PROPERTIES, data->id);
+		project_manager_show_properties_dialog (plugin, PM_GROUP_PROPERTIES, node);
 		return;
 	}
 	
@@ -586,88 +588,74 @@ on_popup_properties (GtkAction *action, ProjectManagerPlugin *plugin)
 static void
 on_popup_add_group (GtkAction *action, ProjectManagerPlugin *plugin)
 {
-	GbfTreeData *data;
-	const gchar *selected_group;
-	gchar *group_id;
+	AnjutaProjectNode *selected_group;
+	AnjutaProjectGroup *new_group;
 	
 	update_operation_begin (plugin);
-	data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-										   GBF_TREE_NODE_GROUP);
-	selected_group = NULL;
-	if (data)
-		selected_group = data->id;
-	group_id = gbf_project_util_new_group (plugin->model,
+	selected_group = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+							  					     ANJUTA_PROJECT_GROUP);
+	new_group = gbf_project_util_new_group (plugin->model,
 										   get_plugin_parent_window (plugin),
 										   selected_group, NULL);
-	if (data)
-		gbf_tree_data_free (data);
 	update_operation_end (plugin, TRUE);
-	g_free (group_id);
 }
 
 static void
 on_popup_add_target (GtkAction *action, ProjectManagerPlugin *plugin)
 {
-	GbfTreeData *data;
-	const gchar *selected_group;
-	gchar *target_id;
+	AnjutaProjectGroup *selected_group;
+	AnjutaProjectTarget *new_target;
 
 	update_operation_begin (plugin);
-	data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-										   GBF_TREE_NODE_GROUP);
-	selected_group = NULL;
-	if (data)
-		selected_group = data->id;
-	target_id = gbf_project_util_new_target (plugin->model,
+	selected_group = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+					 					   			 ANJUTA_PROJECT_GROUP);
+	
+	new_target = gbf_project_util_new_target (plugin->model,
 											 get_plugin_parent_window (plugin),
 											 selected_group, NULL);
-	if (data)
-		gbf_tree_data_free (data);
+	
 	update_operation_end (plugin, TRUE);
-	g_free (target_id);
 }
 
 static void
 on_popup_add_source (GtkAction *action, ProjectManagerPlugin *plugin)
 {
-	GbfTreeData *data;
-	const gchar *selected_target;
-	gchar *source_id;
+	AnjutaProjectTarget *selected_target;
+	AnjutaProjectSource *new_source;
 	
 	update_operation_begin (plugin);
-	data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-										   GBF_TREE_NODE_TARGET);
-	selected_target = NULL;
-	if (data)
-		selected_target = data->id;
-	source_id = gbf_project_util_add_source (plugin->model,
+	selected_target = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+										   			  ANJUTA_PROJECT_TARGET);
+
+	new_source = gbf_project_util_add_source (plugin->model,
 											 get_plugin_parent_window (plugin),
 											 selected_target, NULL, NULL);
-	if (data)
-		gbf_tree_data_free (data);
+
 	update_operation_end (plugin, TRUE);
-	g_free (source_id);
 }
 
 static gboolean
-confirm_removal (ProjectManagerPlugin *plugin, GbfTreeData *data)
+confirm_removal (ProjectManagerPlugin *plugin, AnjutaProjectNode *node)
 {
 	gboolean answer;
 	gchar *mesg;
 	gchar* question;
 	gchar* full_mesg;
+	gchar* name;
 
-	switch (data->type)
+
+	name = anjuta_project_node_get_name (node);
+	switch (anjuta_project_node_get_type (node))
 	{
-		case GBF_TREE_NODE_GROUP:
+		case ANJUTA_PROJECT_GROUP:
 			question = _("Are you sure you want to remove the following group from the project?\n\n");
 			mesg = _("Group: %s\n\nThe group will not be deleted from the file system.");
 			break;
-		case GBF_TREE_NODE_TARGET:
+		case ANJUTA_PROJECT_TARGET:
 			question = _("Are you sure you want to remove the following target from the project?\n\n");
 			mesg = _("Target: %s");
 			break;
-		case GBF_TREE_NODE_TARGET_SOURCE:
+		case ANJUTA_PROJECT_SOURCE:
 			question = _("Are you sure you want to remove the following source file from the project?\n\n");
 			mesg = _("Source: %s\n\nThe source file will not be deleted from the file system.");
 			break;
@@ -678,7 +666,8 @@ confirm_removal (ProjectManagerPlugin *plugin, GbfTreeData *data)
 	full_mesg = g_strconcat (question, mesg, NULL);
 	answer =
 		anjuta_util_dialog_boolean_question (get_plugin_parent_window (plugin),
-											 full_mesg, data->name);
+											 full_mesg, name);
+	g_free (name);
 	g_free (full_mesg);
 	return answer;
 }
@@ -686,50 +675,38 @@ confirm_removal (ProjectManagerPlugin *plugin, GbfTreeData *data)
 static void
 on_popup_remove (GtkAction *action, ProjectManagerPlugin *plugin)
 {
-	GbfTreeData *data;
+	AnjutaProjectNode *node;
 	
-	data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-										   GBF_TREE_NODE_TARGET_SOURCE);
-	if (data == NULL)
+	node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+										   ANJUTA_PROJECT_SOURCE);
+	if (node == NULL)
 	{
-		data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-											   GBF_TREE_NODE_TARGET);
+		node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+											   ANJUTA_PROJECT_TARGET);
 	}
-	if (data == NULL)
+	if (node == NULL)
 	{
-		data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-											   GBF_TREE_NODE_GROUP);
+		node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+											   ANJUTA_PROJECT_GROUP);
 	}
-	if (data)
+	if (node)
 	{
-		if (confirm_removal (plugin, data))
+		if (confirm_removal (plugin, node))
 		{
 			GError *err = NULL;
 			update_operation_begin (plugin);
-			switch (data->type)
-			{
-				case GBF_TREE_NODE_GROUP:
-					gbf_project_remove_group (plugin->project, data->id, &err);
-					break;
-				case GBF_TREE_NODE_TARGET:
-					gbf_project_remove_target (plugin->project, data->id, &err);
-					break;
-				case GBF_TREE_NODE_TARGET_SOURCE:
-					gbf_project_remove_source (plugin->project, data->id, &err);
-					break;
-				default:
-					g_warning ("Should not reach here!!!");
-			}
+			ianjuta_project_remove_node (plugin->project, node, &err);
 			update_operation_end (plugin, TRUE);
 			if (err)
 			{
+				gchar *name = anjuta_project_node_get_name (node);
 				anjuta_util_dialog_error (get_plugin_parent_window (plugin),
 										  _("Failed to remove '%s':\n%s"),
-										  data->name, err->message);
+										  name, err->message);
+				g_free (name);
 				g_error_free (err);
 			}
 		}
-		gbf_tree_data_free (data);
 	}
 }
 
@@ -759,21 +736,21 @@ on_popup_add_to_project (GtkAction *action, ProjectManagerPlugin *plugin)
 		filename = g_path_get_basename (plugin->fm_current_uri);
 		if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
 		{
-			gchar *group_id =
+			gchar *new_uri =
 			ianjuta_project_manager_add_group (IANJUTA_PROJECT_MANAGER (plugin),
 											   filename, parent_directory,
 											   NULL);
-			g_free (group_id);
+			g_free (new_uri);
 		}
 		else
 		{
-			gchar *source_id =
+			gchar *new_uri =
 				ianjuta_project_manager_add_source (IANJUTA_PROJECT_MANAGER
 													(plugin),
 													plugin->fm_current_uri,
 													parent_directory,
 													NULL);
-			g_free(source_id);
+			g_free (new_uri);
 		}
 		g_object_unref (file_info);
 		g_free (filename);
@@ -893,10 +870,10 @@ update_ui (ProjectManagerPlugin *plugin)
 	AnjutaUI *ui;
 	gint j;
 	GtkAction *action;
-	GbfProjectCapabilities caps = GBF_PROJECT_CAN_ADD_NONE;
+	IAnjutaProjectCapabilities caps = IANJUTA_PROJECT_CAN_ADD_NONE;
 	
 	if (plugin->project)
-		caps = gbf_project_get_capabilities (plugin->project, NULL);
+		caps = ianjuta_project_get_capabilities (plugin->project, NULL);
 	
 	ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL);
 	for (j = 0; j < G_N_ELEMENTS (pm_actions); j++)
@@ -917,19 +894,19 @@ update_ui (ProjectManagerPlugin *plugin)
 								   "ActionProjectAddGroup");
 	g_object_set (G_OBJECT (action), "sensitive",
 				  ((plugin->project != NULL) &&
-				   (caps & GBF_PROJECT_CAN_ADD_GROUP)), NULL);
+				   (caps & IANJUTA_PROJECT_CAN_ADD_GROUP)), NULL);
 	
 	action = anjuta_ui_get_action (ui, "ActionGroupProjectManager",
 								   "ActionProjectAddTarget");
 	g_object_set (G_OBJECT (action), "sensitive",
 				  ((plugin->project != NULL) &&
-				   (caps & GBF_PROJECT_CAN_ADD_TARGET)), NULL);
+				   (caps & IANJUTA_PROJECT_CAN_ADD_TARGET)), NULL);
 
 	action = anjuta_ui_get_action (ui, "ActionGroupProjectManager",
 								   "ActionProjectAddSource");
 	g_object_set (G_OBJECT (action), "sensitive",
 				  ((plugin->project != NULL) &&
-				   (caps & GBF_PROJECT_CAN_ADD_SOURCE)), NULL);
+				   (caps & IANJUTA_PROJECT_CAN_ADD_SOURCE)), NULL);
 
 	/* Popup menus */
 	for (j = 0; j < G_N_ELEMENTS (popup_actions); j++)
@@ -950,9 +927,9 @@ on_treeview_selection_changed (GtkTreeSelection *sel,
 {
 	AnjutaUI *ui;
 	GtkAction *action;
-	GbfTreeData *data;
+	AnjutaProjectNode *node;
 	gchar *selected_uri;
-	GbfProjectCapabilities caps = GBF_PROJECT_CAN_ADD_NONE;
+	IAnjutaProjectCapabilities caps = IANJUTA_PROJECT_CAN_ADD_NONE;
 	
 	ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL);
 	/* Popup menu */
@@ -970,12 +947,12 @@ on_treeview_selection_changed (GtkTreeSelection *sel,
 	g_object_set (G_OBJECT (action), "sensitive", FALSE, NULL);
 	
 	if (plugin->project)
-		caps = gbf_project_get_capabilities (plugin->project, NULL);
-	data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-										   GBF_TREE_NODE_TARGET_SOURCE);
-	if (data && data->type == GBF_TREE_NODE_TARGET_SOURCE)
+		caps = ianjuta_project_get_capabilities (plugin->project, NULL);
+	node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+										   ANJUTA_PROJECT_SOURCE);
+	if (node && anjuta_project_node_get_type (node) == ANJUTA_PROJECT_SOURCE)
 	{
-		if (caps & GBF_PROJECT_CAN_ADD_SOURCE)
+		if (caps & IANJUTA_PROJECT_CAN_ADD_SOURCE)
 		{
 			action = anjuta_ui_get_action (ui, "ActionGroupProjectManagerPopup",
 										   "ActionPopupProjectAddSource");
@@ -984,16 +961,14 @@ on_treeview_selection_changed (GtkTreeSelection *sel,
 		action = anjuta_ui_get_action (ui, "ActionGroupProjectManagerPopup",
 									   "ActionPopupProjectRemove");
 		g_object_set (G_OBJECT (action), "sensitive", TRUE, NULL);
-		gbf_tree_data_free (data);
 		goto finally;
 	}
 	
-	gbf_tree_data_free (data);
-	data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-										   GBF_TREE_NODE_TARGET);
-	if (data && data->type == GBF_TREE_NODE_TARGET)
+	node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+										   ANJUTA_PROJECT_TARGET);
+	if (node && anjuta_project_node_get_type (node) == ANJUTA_PROJECT_TARGET)
 	{
-		if (caps & GBF_PROJECT_CAN_ADD_SOURCE)
+		if (caps & IANJUTA_PROJECT_CAN_ADD_SOURCE)
 		{
 			action = anjuta_ui_get_action (ui, "ActionGroupProjectManagerPopup",
 										   "ActionPopupProjectAddSource");
@@ -1002,22 +977,20 @@ on_treeview_selection_changed (GtkTreeSelection *sel,
 		action = anjuta_ui_get_action (ui, "ActionGroupProjectManagerPopup",
 									   "ActionPopupProjectRemove");
 		g_object_set (G_OBJECT (action), "sensitive", TRUE, NULL);
-		gbf_tree_data_free (data);
 		goto finally;
 	}
 	
-	gbf_tree_data_free (data);
-	data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-										   GBF_TREE_NODE_GROUP);
-	if (data && data->type == GBF_TREE_NODE_GROUP)
+	node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+										   ANJUTA_PROJECT_GROUP);
+	if (node && anjuta_project_node_get_type (node) == ANJUTA_PROJECT_GROUP)
 	{
-		if (caps & GBF_PROJECT_CAN_ADD_GROUP)
+		if (caps & IANJUTA_PROJECT_CAN_ADD_GROUP)
 		{
 			action = anjuta_ui_get_action (ui, "ActionGroupProjectManagerPopup",
 										   "ActionPopupProjectAddGroup");
 			g_object_set (G_OBJECT (action), "sensitive", TRUE, NULL);
 		}
-		if (caps & GBF_PROJECT_CAN_ADD_TARGET)
+		if (caps & IANJUTA_PROJECT_CAN_ADD_TARGET)
 		{
 			action = anjuta_ui_get_action (ui, "ActionGroupProjectManagerPopup",
 										   "ActionPopupProjectAddTarget");
@@ -1026,7 +999,6 @@ on_treeview_selection_changed (GtkTreeSelection *sel,
 		action = anjuta_ui_get_action (ui, "ActionGroupProjectManagerPopup",
 									   "ActionPopupProjectRemove");
 		g_object_set (G_OBJECT (action), "sensitive", TRUE, NULL);
-		gbf_tree_data_free (data);
 		goto finally;
 	}
 finally:
@@ -1183,15 +1155,18 @@ project_manager_load_gbf (ProjectManagerPlugin *pm_plugin)
 	AnjutaPluginManager *plugin_manager;
 	AnjutaStatus *status;
 	gchar *dirname;
+	GFile *dirfile;
 	gchar *basename;
 	const gchar *root_uri;
 	GError *error = NULL;
 	GList *descs = NULL;
 	GList *desc;
+	IAnjutaProjectBackend *backend;
 	
 	root_uri = pm_plugin->project_root_uri;
 	
 	dirname = anjuta_util_get_local_path_from_uri (root_uri);
+	dirfile = g_file_new_for_uri (root_uri);
 	
 	g_return_if_fail (dirname != NULL);
 	
@@ -1206,50 +1181,40 @@ project_manager_load_gbf (ProjectManagerPlugin *pm_plugin)
 										 "IAnjutaProjectBackend",
 										 NULL);
 	for (desc = g_list_first (descs); desc != NULL; desc = g_list_next (desc)) {
-		AnjutaPluginDescription *backend;
-		IAnjutaProjectBackend *plugin;
+		AnjutaPluginDescription *backend_desc;
 		gchar *location = NULL;
 		
-		backend = (AnjutaPluginDescription *)desc->data;
-		anjuta_plugin_description_get_string (backend, "Anjuta Plugin", "Location", &location);
-		plugin = (IAnjutaProjectBackend *)anjuta_plugin_manager_get_plugin_by_id (plugin_manager, location);
+		backend_desc = (AnjutaPluginDescription *)desc->data;
+		anjuta_plugin_description_get_string (backend_desc, "Anjuta Plugin", "Location", &location);
+		backend = (IAnjutaProjectBackend *)anjuta_plugin_manager_get_plugin_by_id (plugin_manager, location);
 		g_free (location);
-			
-		pm_plugin->project = ianjuta_project_backend_new_project (plugin, NULL);
-		if (pm_plugin->project)
+
+		if (ianjuta_project_backend_probe (backend, dirfile, NULL))
 		{
-			if (gbf_project_probe (pm_plugin->project, dirname, NULL))
-			{
-				/* Backend found */
-				break;
-			}
-			g_object_unref (pm_plugin->project);
-			pm_plugin->project = NULL;
-		}
-		/*
-		if (!strcmp (backend->id, "gbf-am:GbfAmProject"))
+			/* Backend found */
 			break;
-		*/
-		plugin = NULL;
+		}
+		backend = NULL;
 	}
 	g_list_free (descs);
 	
-	if (!pm_plugin->project)
+	if (!backend)
 	{
 		/* FIXME: Set err */
 		g_warning ("no backend available for this project\n");
 		g_free (dirname);
+		g_object_unref (dirfile);
 		return;
 	}
 	
 	DEBUG_PRINT ("%s", "Creating new gbf project\n");
-	
-	/* pm_plugin->project = gbf_backend_new_project (backend->id); */
+	pm_plugin->project = ianjuta_project_backend_new_project (backend, NULL);
 	if (!pm_plugin->project)
 	{
 		/* FIXME: Set err */
 		g_warning ("project creation failed\n");
 		g_free (dirname);
+		g_object_unref (dirfile);
 		return;
 	}
 	
@@ -1262,7 +1227,7 @@ project_manager_load_gbf (ProjectManagerPlugin *pm_plugin)
 	DEBUG_PRINT ("loading project %s\n\n", dirname);
 	/* FIXME: use the error parameter to determine if the project
 	 * was loaded successfully */
-	gbf_project_load (pm_plugin->project, dirname, &error);
+	ianjuta_project_load (pm_plugin->project, dirfile, &error);
 	
 	anjuta_status_progress_tick (status, NULL, _("Created project viewâ?¦"));
 	
@@ -1285,6 +1250,7 @@ project_manager_load_gbf (ProjectManagerPlugin *pm_plugin)
 		pm_plugin->project = NULL;
 		g_free (basename);
 		g_free (dirname);
+		g_object_unref (dirfile);
 		/* gtk_widget_destroy (progress_win); */
 		anjuta_status_pop (status);
 		anjuta_status_busy_pop (status);
@@ -1303,6 +1269,7 @@ project_manager_load_gbf (ProjectManagerPlugin *pm_plugin)
 	anjuta_status_busy_pop (status);
 	g_free (basename);
 	g_free (dirname);
+	g_object_unref (dirfile);
 }
 
 static void
@@ -1731,29 +1698,16 @@ uri_is_inside_project (ProjectManagerPlugin *plugin, const gchar *uri)
 }
 
 static gchar *
-get_element_uri_from_id (ProjectManagerPlugin *plugin, const gchar *id, const gchar *root)
+get_element_uri_from_id (ProjectManagerPlugin *plugin, AnjutaProjectNode *id, const gchar *root)
 {
-	gchar *path, *ptr;
-	gchar *uri;
 	const gchar *project_root = NULL;
+	GFile *file = NULL;
+	GFile *target_file = NULL;
+	gchar *uri = NULL;
 	
 	if (!id)
 		return NULL;
 	
-	path = g_strdup (id);
-	ptr = strrchr (path, ':');
-	if (ptr)
-	{
-		*ptr = '\0';
-		if (ptr[1] == '/')
-		{
-			 /* ID is source ID, extract source uri */
-			uri = strrchr (path, ':');		/* keep uri scheme */
-			*ptr = ':';
-			return g_strdup (uri+1);
-		}
-	}
-	
 	anjuta_shell_get (ANJUTA_PLUGIN (plugin)->shell,
 					  root, G_TYPE_STRING,
 					  &project_root, NULL);
@@ -1766,9 +1720,47 @@ get_element_uri_from_id (ProjectManagerPlugin *plugin, const gchar *id, const gc
 					  &project_root,
 					  NULL);
 	}
-	uri = g_build_filename (project_root, path, NULL);
-	/* DEBUG_PRINT ("Converting id: %s to %s", id, uri); */
-	g_free (path);
+
+	switch (anjuta_project_node_get_type (id))
+	{
+		case ANJUTA_PROJECT_GROUP:
+			file = anjuta_project_group_get_directory (id);
+			break;
+		case ANJUTA_PROJECT_TARGET:
+			file = anjuta_project_group_get_directory (anjuta_project_node_parent (id));
+			target_file = g_file_get_child (file, anjuta_project_target_get_name (id));
+			file = target_file;
+			break;
+		case ANJUTA_PROJECT_SOURCE:
+			file = anjuta_project_source_get_file (id);
+			break;
+		default:
+			file = NULL;
+			break;
+	}
+
+	if ((file != NULL) && (project_root != NULL))
+	{
+		gchar *rel_path;
+
+		rel_path = g_file_get_relative_path (anjuta_project_group_get_directory (ianjuta_project_get_root (plugin->project, NULL)), file);
+
+		if (rel_path)
+		{
+			GFile *node_file = NULL;
+			GFile *root_file = NULL;
+			root_file = g_file_new_for_uri (project_root);
+			node_file = g_file_get_child (root_file, rel_path);
+			g_object_unref (root_file);
+
+			uri = g_file_get_uri (node_file);
+			g_object_unref (node_file);
+			g_free (rel_path);
+		}
+	}
+		
+	if (target_file != NULL) g_object_unref (target_file);
+	
 	return uri;
 }
 
@@ -1808,293 +1800,193 @@ get_element_relative_path (ProjectManagerPlugin *plugin, const gchar *uri, const
 	return NULL;
 }
 
-static GbfProjectTarget*
-get_target_from_uri (ProjectManagerPlugin *plugin, const gchar *uri)
+static AnjutaProjectNode*
+get_node_from_file (AnjutaProjectNode *parent, GFile *file)
 {
-	GbfProjectTarget *data;
-	const gchar *rel_path;
-	gchar *test_id;
-	
-	rel_path = get_element_relative_path (plugin, uri, IANJUTA_BUILDER_ROOT_URI);
-	
-	if (!rel_path)
-		return NULL;
-	
-	/* FIXME: More target types should be handled */
-	/* Test for shared lib */
-	test_id = g_strconcat (rel_path, ":shared_lib", NULL);
-	data = gbf_project_get_target (GBF_PROJECT (plugin->project),
-								   test_id, NULL);
-	g_free (test_id);
-	
-	if (!data)
-	{
-		/* Test for static lib */
-		test_id = g_strconcat (rel_path, ":static_lib", NULL);
-		data = gbf_project_get_target (GBF_PROJECT (plugin->project),
-									   test_id, NULL);
-		g_free (test_id);
-	}
-	if (!data)
+	AnjutaProjectNode *node;
+	GFile *target_file = NULL;
+
+	for (node = anjuta_project_node_first_child (parent); node != NULL; node = anjuta_project_node_next_sibling (node))
 	{
-		/* Test for program */
-		test_id = g_strconcat (rel_path, ":program", NULL);
-		data = gbf_project_get_target (GBF_PROJECT (plugin->project),
-									   test_id, NULL);
-		g_free (test_id);
+		switch (anjuta_project_node_get_type (node))
+		{
+		case ANJUTA_PROJECT_GROUP:
+			if (g_file_equal (anjuta_project_group_get_directory (node), file))
+			{
+				return node;
+			}
+			else
+			{
+				return get_node_from_file (node, file);
+			}
+			break;
+		case ANJUTA_PROJECT_TARGET:
+			target_file = g_file_get_child (anjuta_project_group_get_directory (parent), anjuta_project_target_get_name (node));
+			if (g_file_equal (target_file, file))
+			{
+				g_object_unref (target_file);
+				return node;
+			}
+			g_object_unref (target_file);
+			break;
+		case ANJUTA_PROJECT_SOURCE:
+			if (g_file_equal (anjuta_project_source_get_file (node), file))
+			{
+				return node;
+			}
+			break;
+		default:
+			break;
+		}
 	}
-	return data;
+				
+	return NULL;		
 }
 
-static gchar *
+static AnjutaProjectNode*
 get_element_id_from_uri (ProjectManagerPlugin *plugin, const gchar *uri)
 {
-	GbfProjectTarget *target;
-	gchar *id;
+	AnjutaProjectNode *node;
+	GFile *file;
 	
 	if (!uri_is_inside_project (plugin, uri))
 		return NULL;
-	
-	target = get_target_from_uri (plugin, uri);
-	if (target)
+
+	file = g_file_new_for_uri (uri);
+	node = ianjuta_project_get_root (plugin->project, NULL);
+	if (g_file_equal (anjuta_project_group_get_directory (node), file))
 	{
-		id = g_strdup (target->id);
-		gbf_project_target_free (target);
+		return node;
 	}
-	else if (get_uri_vfs_type (uri) | G_FILE_TYPE_DIRECTORY)
+	else
+	{
+		return get_node_from_file (node, file);
+	}
+}
+
+static AnjutaProjectTarget*
+get_target_from_uri (ProjectManagerPlugin *plugin, const gchar *uri)
+{
+	AnjutaProjectNode *node;
+
+	node = get_element_id_from_uri (plugin, uri);
+
+	if (anjuta_project_node_get_type (node) == ANJUTA_PROJECT_TARGET)
 	{
-		id = g_strconcat (get_element_relative_path (plugin, uri, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI), "/", NULL);
+		return (AnjutaProjectTarget *)node;
 	}
 	else
 	{
-		id = strdup (get_element_relative_path (plugin, uri, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI));
+		return NULL;
 	}
-	return id;
 }
 
-static IAnjutaProjectManagerElementType
+static AnjutaProjectNodeType
 iproject_manager_get_element_type (IAnjutaProjectManager *project_manager,
 								   const gchar *element_uri,
 								   GError **err)
 {
-	GFileType ftype;
+	AnjutaProjectNode *node;
 	ProjectManagerPlugin *plugin;
-	
+
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager),
-						  IANJUTA_PROJECT_MANAGER_UNKNOWN);
+						  ANJUTA_PROJECT_UNKNOWN);
 	
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
-	g_return_val_if_fail (GBF_IS_PROJECT (plugin->project),
-						  IANJUTA_PROJECT_MANAGER_UNKNOWN);
-	g_return_val_if_fail (uri_is_inside_project (plugin, element_uri),
-						  IANJUTA_PROJECT_MANAGER_UNKNOWN);
-	
-	ftype = get_uri_vfs_type (element_uri);
-	if (ftype | G_FILE_TYPE_DIRECTORY)
-	{
-		return IANJUTA_PROJECT_MANAGER_GROUP;
-	}
-	else if (ianjuta_project_manager_get_target_type (project_manager,
-													  element_uri, NULL) !=
-				IANJUTA_PROJECT_MANAGER_TARGET_UNKNOWN)
-	{
-		return IANJUTA_PROJECT_MANAGER_TARGET;
-	}
-	else if (ftype | G_FILE_TYPE_REGULAR)
-	{
-		return IANJUTA_PROJECT_MANAGER_SOURCE;
-	}
-	return IANJUTA_PROJECT_MANAGER_UNKNOWN;
+
+	node = get_element_id_from_uri (plugin, element_uri);
+
+	return node == NULL ? ANJUTA_PROJECT_UNKNOWN : anjuta_project_node_get_type (node);
 }
 
 static GList*
 iproject_manager_get_elements (IAnjutaProjectManager *project_manager,
-							   IAnjutaProjectManagerElementType element_type,
+							   AnjutaProjectNodeType element_type,
 							   GError **err)
 {
-	GList *elements;
 	ProjectManagerPlugin *plugin;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), NULL);
 	
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
-	g_return_val_if_fail (GBF_IS_PROJECT (plugin->project), NULL);
-	
-	elements = NULL;
-	switch (element_type)
-	{
-		case IANJUTA_PROJECT_MANAGER_SOURCE:
-		{
-			GList *sources, *node;
-			GbfProjectTargetSource *source;
-			sources = gbf_project_get_all_sources (plugin->project, NULL);
-			node = sources;
-			while (node)
-			{
-				source = gbf_project_get_source (plugin->project,
-												 (const gchar *) node->data,
-												 NULL);
-				if (source)
-					elements = g_list_prepend (elements,
-											   g_strdup (source->source_uri));
-				gbf_project_target_source_free (source);
-				g_free (node->data);
-				node = node->next;
-			}
-			g_list_free (sources);
-			break;
-		}
-		case IANJUTA_PROJECT_MANAGER_TARGET:
-		{
-			GList *targets, *node;
-			targets = gbf_project_get_all_targets (plugin->project, NULL);
-			node = targets;
-			while (node)
-			{
-				elements = g_list_prepend (elements,
-										   get_element_uri_from_id (plugin,
-												(const gchar *)node->data,
-												IANJUTA_BUILDER_ROOT_URI));
-				g_free (node->data);
-				node = node->next;
-			}
-			g_list_free (targets);
-			break;
-		}
-		case IANJUTA_PROJECT_MANAGER_GROUP:
-		{
-			GList *groups, *node;
-			groups = gbf_project_get_all_groups (plugin->project, NULL);
-			node = groups;
-			while (node)
-			{
-				elements = g_list_prepend (elements,
-										   get_element_uri_from_id (plugin,
-												(const gchar *)node->data,
-										        IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI));
-				g_free (node->data);
-				node = node->next;
-			}
-			g_list_free (groups);
-			break;
-		}
-		default:
-			elements = NULL;
-	}
-	return g_list_reverse (elements);
+	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), NULL);
+
+	return gbf_project_util_replace_by_uri (gbf_project_util_node_all (ianjuta_project_get_root (plugin->project, NULL), element_type)); 
 }
 
-static IAnjutaProjectManagerTargetType
+static AnjutaProjectTargetClass
 iproject_manager_get_target_type (IAnjutaProjectManager *project_manager,
 								   const gchar *target_uri,
 								   GError **err)
 {
-	IAnjutaProjectManagerElementType element_type;
-	IAnjutaProjectManagerTargetType target_type;
 	ProjectManagerPlugin *plugin;
-	GbfProjectTarget *data;
+	AnjutaProjectTarget *target;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager),
-						  IANJUTA_PROJECT_MANAGER_TARGET_UNKNOWN);
+						  ANJUTA_TARGET_UNKNOWN);
 	
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
-	g_return_val_if_fail (GBF_IS_PROJECT (plugin->project),
-						  IANJUTA_PROJECT_MANAGER_TARGET_UNKNOWN);
-	
-	element_type = ianjuta_project_manager_get_element_type (project_manager,
-															 target_uri, NULL);
+	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project),
+						  ANJUTA_TARGET_UNKNOWN);
 	
 	g_return_val_if_fail (uri_is_inside_project (plugin, target_uri),
-						  IANJUTA_PROJECT_MANAGER_TARGET_UNKNOWN);
-	
-	data = get_target_from_uri (plugin, target_uri);
+						  ANJUTA_TARGET_UNKNOWN);
 	
-	if (data && data->type && strcmp (data->type, "shared_lib") == 0)
-	{
-		target_type = IANJUTA_PROJECT_MANAGER_TARGET_SHAREDLIB;
-	}
-	else if (data && data->type && strcmp (data->type, "static_lib") == 0)
-	{
-		target_type = IANJUTA_PROJECT_MANAGER_TARGET_STATICLIB;
-	}
-	else if (data && data->type && strcmp (data->type, "program") == 0)
+	target = get_target_from_uri (plugin, target_uri);
+
+	if (target != NULL)
 	{
-		target_type = IANJUTA_PROJECT_MANAGER_TARGET_STATICLIB;
+		AnjutaProjectTargetType type = anjuta_project_target_get_type (target);
+
+		return anjuta_project_target_type_class (type);
 	}
 	else
 	{
-		target_type = IANJUTA_PROJECT_MANAGER_TARGET_UNKNOWN;
+		return ANJUTA_TARGET_UNKNOWN;
 	}
-	if (data)
-		gbf_project_target_free (data);
-	return target_type;
 }
 
 static GList*
 iproject_manager_get_targets (IAnjutaProjectManager *project_manager,
-							  IAnjutaProjectManagerTargetType target_type,
+							  AnjutaProjectTargetClass target_type,
 							  GError **err)
 {
 	GList *targets, *node;
-	const gchar *target_id;
-	GList *elements;
 	ProjectManagerPlugin *plugin;
-	GList *target_types = NULL;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), NULL);
 	
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
-	g_return_val_if_fail (GBF_IS_PROJECT (plugin->project), NULL);
-	
-	switch (target_type)
-	{
-		case IANJUTA_PROJECT_MANAGER_TARGET_SHAREDLIB:
-			target_types = g_list_append(target_types, "shared_lib");
-			break;
-		case IANJUTA_PROJECT_MANAGER_TARGET_STATICLIB:
-			target_types = g_list_append(target_types, "static_lib");
-			break;
-		case IANJUTA_PROJECT_MANAGER_TARGET_EXECUTABLE:
-			target_types = g_list_append(target_types, "program");
-			target_types = g_list_append(target_types, "script");
-			break;
-		default:
-			/* FIXME: there are some more target types */
-			g_warning ("Unsupported target type");
-			return NULL;
-	}
-	
-	elements = NULL;
-	targets = gbf_project_get_all_targets (plugin->project, NULL);
-	node = targets;
-	while (node)
+	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), NULL);
+
+	/* Get all targets */
+	targets = gbf_project_util_node_all (ianjuta_project_get_root (plugin->project, NULL), ANJUTA_PROJECT_TARGET);
+
+	/* Remove all targets not in specified class */
+	for (node = g_list_first (targets); node != NULL;)
 	{
-		const gchar *t_type;
-		
-		target_id = (const gchar*) node->data;
-		
-		t_type = strrchr (target_id, ':');
-		if (t_type && strlen (t_type) > 2)
+		AnjutaProjectTargetType type;
+
+		type = anjuta_project_target_get_type (node->data);
+		if (anjuta_project_target_type_class (type) != target_type)
 		{
-			GList* type_node;
-			t_type++;
-			for (type_node = target_types; type_node != NULL;
-				 type_node = type_node->next)
-			{
-				if (strcmp (t_type, type_node->data) == 0)
-				{
-					gchar *target_uri = get_element_uri_from_id (plugin,
-																 target_id,
-																 IANJUTA_BUILDER_ROOT_URI);
-					elements = g_list_prepend (elements, target_uri);
-				}
-			}
+			GList *next = g_list_next (node);
+			targets = g_list_delete_link (targets, node);
+			node = next;
+		}
+		else
+		{
+			node = g_list_next (node);
 		}
-		g_free (node->data);
-		node = node->next;
 	}
-	g_list_free (targets);
-	return g_list_reverse (elements);
+
+	/* Replace all targets by their corresponding URI */
+	for (node = g_list_first (targets); node != NULL; node = g_list_next (node))
+	{
+		node->data = get_element_uri_from_id (plugin, node->data, IANJUTA_BUILDER_ROOT_URI);
+	}
+
+	return targets;
 }
 
 static gchar*
@@ -2102,13 +1994,13 @@ iproject_manager_get_parent (IAnjutaProjectManager *project_manager,
 							 const gchar *element_uri,
 							 GError **err)
 {
-	IAnjutaProjectManagerElementType type;
+	AnjutaProjectNodeType type;
 	ProjectManagerPlugin *plugin;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), NULL);
 	
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
-	g_return_val_if_fail (GBF_IS_PROJECT (plugin->project), NULL);
+	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), NULL);
 	
 	type = ianjuta_project_manager_get_element_type (project_manager,
 													 element_uri, NULL);
@@ -2126,7 +2018,7 @@ iproject_manager_get_children (IAnjutaProjectManager *project_manager,
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), NULL);
 	
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
-	g_return_val_if_fail (GBF_IS_PROJECT (plugin->project), NULL);
+	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), NULL);
 	/* FIXME: */
 	return NULL;
 }
@@ -2136,7 +2028,7 @@ iproject_manager_get_selected (IAnjutaProjectManager *project_manager,
 							   GError **err)
 {
 	gchar *uri;
-	GbfTreeData *data;
+	AnjutaProjectNode *node;
 	ProjectManagerPlugin *plugin;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), NULL);
@@ -2144,120 +2036,104 @@ iproject_manager_get_selected (IAnjutaProjectManager *project_manager,
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
 	if (plugin->project == NULL) return NULL;
 	
-	g_return_val_if_fail (GBF_IS_PROJECT (plugin->project), NULL);
+	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), NULL);
 	
-	data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-										   GBF_TREE_NODE_TARGET_SOURCE);
-	if (data && data->type == GBF_TREE_NODE_TARGET_SOURCE)
+	node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+										   ANJUTA_PROJECT_SOURCE);
+	if (node && anjuta_project_node_get_type (node) == ANJUTA_PROJECT_SOURCE)
 	{
-		uri = g_strdup (data->uri);
-		gbf_tree_data_free (data);
+		uri = g_file_get_uri (anjuta_project_source_get_file (node));
 		return uri;
 	}
-	
-	if (data)
-		gbf_tree_data_free (data);
 
-	data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-										   GBF_TREE_NODE_TARGET);
-	if (data && data->type == GBF_TREE_NODE_TARGET)
+	node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+										   ANJUTA_PROJECT_TARGET);
+	if (node && anjuta_project_node_get_type (node) == ANJUTA_PROJECT_TARGET)
 	{
-		uri = get_element_uri_from_id (plugin, data->id, IANJUTA_BUILDER_ROOT_URI);
-		gbf_tree_data_free (data);
+		uri = get_element_uri_from_id (plugin, node, IANJUTA_BUILDER_ROOT_URI);
 		return uri;
 	}
-	
-	if (data)
-		gbf_tree_data_free (data);
 
-	data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-										   GBF_TREE_NODE_GROUP);
-	if (data && data->type == GBF_TREE_NODE_GROUP)
+	node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+										   ANJUTA_PROJECT_GROUP);
+	if (node && anjuta_project_node_get_type (node) == GBF_TREE_NODE_GROUP)
 	{
-		uri = g_strdup (data->uri);
-		gbf_tree_data_free (data);
+		uri = g_file_get_uri (anjuta_project_group_get_directory (node));
 		return uri;;
 	}
-
-	if (data)
-		gbf_tree_data_free (data);
 	
 	return NULL;
 }
 
-static gchar *
+static gchar*
 iproject_manager_get_selected_id (IAnjutaProjectManager *project_manager,
-								  IAnjutaProjectManagerElementType element_type,
+								  AnjutaProjectNodeType element_type,
 								  GError **err)
 {
-	GbfTreeData *data;
 	ProjectManagerPlugin *plugin;
-	gchar *id = NULL;
+	AnjutaProjectNode *node = NULL;
+	gchar *uri;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), NULL);
 	
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
-	g_return_val_if_fail (GBF_IS_PROJECT (plugin->project), NULL);
+	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), NULL);
 
-	if (element_type == IANJUTA_PROJECT_MANAGER_UNKNOWN ||
-		element_type == IANJUTA_PROJECT_MANAGER_SOURCE)
+	if (element_type == ANJUTA_PROJECT_UNKNOWN ||
+		element_type == ANJUTA_PROJECT_SOURCE)
 	{
-		data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-		                                       GBF_TREE_NODE_TARGET_SOURCE);
-		if (data && data->type == GBF_TREE_NODE_TARGET_SOURCE)
-			id = g_strdup (data->id);
-
-		if (data)
-			gbf_tree_data_free (data);
-
-		if (id)
-			return id;
+		node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+		                                       ANJUTA_PROJECT_SOURCE);
+		if (node)
+		{
+			uri = get_element_uri_from_id (plugin, node, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
+			return uri;
+		}
 	}
 
-	if (element_type == IANJUTA_PROJECT_MANAGER_UNKNOWN ||
-		element_type == IANJUTA_PROJECT_MANAGER_TARGET)
+	if (element_type == ANJUTA_PROJECT_UNKNOWN ||
+		element_type == ANJUTA_PROJECT_TARGET)
 	{
-		data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-											   GBF_TREE_NODE_TARGET);
-		if (data && data->type == GBF_TREE_NODE_TARGET)
-			id = g_strdup (data->id);
-		
-		if (data)
-			gbf_tree_data_free (data);
-
-		if (id)
-			return id;
+		node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+											   ANJUTA_PROJECT_TARGET);
+		if (node)
+		{
+			uri = get_element_uri_from_id (plugin, node, IANJUTA_BUILDER_ROOT_URI);
+			return uri;
+		}
 	}
 
-	if (element_type == IANJUTA_PROJECT_MANAGER_UNKNOWN ||
-		element_type == IANJUTA_PROJECT_MANAGER_GROUP)
+	if (element_type == ANJUTA_PROJECT_UNKNOWN ||
+		element_type == ANJUTA_PROJECT_GROUP)
 	{
-		data = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
-											   GBF_TREE_NODE_GROUP);
-		if (data && data->type == GBF_TREE_NODE_GROUP)
-			id = g_strdup (data->id);
-
-		if (data)
-			gbf_tree_data_free (data);
-
-		if (id)
-			return id;
+		node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+											   ANJUTA_PROJECT_GROUP);
+		if (node)
+		{
+			uri = get_element_uri_from_id (plugin, node, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
+			return uri;
+		}
 	}
 
-	return id;
+	if (node)
+	{
+		uri = get_element_uri_from_id (plugin, node, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
+		return uri;
+	}
+	return NULL;
 }
 
-static IAnjutaProjectManagerCapabilities
+static IAnjutaProjectCapabilities
 iproject_manager_get_capabilities (IAnjutaProjectManager *project_manager,
 								   GError **err)
 {
 	ProjectManagerPlugin *plugin;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager),
-						  IANJUTA_PROJECT_MANAGER_CAN_ADD_NONE);
+						  IANJUTA_PROJECT_CAN_ADD_NONE);
 	
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
-	return gbf_project_get_capabilities (plugin->project, NULL);
+	return ianjuta_project_get_capabilities (plugin->project, NULL);
 }
 
 static gchar*
@@ -2267,20 +2143,20 @@ iproject_manager_add_source (IAnjutaProjectManager *project_manager,
 							 GError **err)
 {
 	ProjectManagerPlugin *plugin;
-	IAnjutaProjectManagerElementType default_location_type;
-	gchar *location_id = NULL;
-	gchar* source_id;
+	AnjutaProjectNodeType default_location_type;
+	AnjutaProjectNode *location_id = NULL;
+	AnjutaProjectSource *source_id;
 	gchar* source_uri;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), FALSE);
 	
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
-	g_return_val_if_fail (GBF_IS_PROJECT (plugin->project), FALSE);
+	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), FALSE);
 
 	update_operation_begin (plugin);
 	if (default_location_uri == NULL)
 	{
-		default_location_type = IANJUTA_PROJECT_MANAGER_UNKNOWN;
+		default_location_type = ANJUTA_PROJECT_UNKNOWN;
 	}
 	else
 	{
@@ -2289,14 +2165,14 @@ iproject_manager_add_source (IAnjutaProjectManager *project_manager,
 													  default_location_uri, NULL);
 		location_id = get_element_id_from_uri (plugin, default_location_uri);
 	}
-	if (default_location_type == IANJUTA_PROJECT_MANAGER_GROUP)
+	if (default_location_type == ANJUTA_PROJECT_GROUP)
 	{
 		source_id = gbf_project_util_add_source (plugin->model,
 											get_plugin_parent_window (plugin),
 												 NULL, location_id,
 												 source_uri_to_add);
 	}
-	else if (default_location_type == IANJUTA_PROJECT_MANAGER_TARGET)
+	else if (default_location_type == ANJUTA_PROJECT_TARGET)
 	{
 		source_id = gbf_project_util_add_source (plugin->model,
 											 get_plugin_parent_window (plugin),
@@ -2313,7 +2189,6 @@ iproject_manager_add_source (IAnjutaProjectManager *project_manager,
 	update_operation_end (plugin, TRUE);
 	
 	source_uri = get_element_uri_from_id(plugin, source_id, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
-	g_free(source_id);
 	
 	return source_uri;
 }
@@ -2325,21 +2200,26 @@ iproject_manager_add_source_quiet (IAnjutaProjectManager *project_manager,
 								   GError **err)
 {
 	ProjectManagerPlugin *plugin;
-	gchar* source_id;
+	AnjutaProjectSource *source_id;
+	GFile *source_file;
+	AnjutaProjectTarget *target;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), FALSE);
 	
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
-	g_return_val_if_fail (GBF_IS_PROJECT (plugin->project), FALSE);
+	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), FALSE);
 
+	target = get_element_id_from_uri (plugin, location_uri);
+	source_file = g_file_new_for_uri (source_uri_to_add);
 	update_operation_begin (plugin);
-	source_id = gbf_project_add_source (plugin->project,
-										source_uri_to_add,
-										location_uri,
+	source_id = ianjuta_project_add_source (plugin->project,
+	    								target,
+	    								source_file,
 										err);
 	update_operation_end (plugin, TRUE);
+	g_object_unref (source_file);
 	
-	return source_id;
+	return get_element_uri_from_id (plugin, source_id, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
 }
 
 static GList*
@@ -2349,20 +2229,20 @@ iproject_manager_add_source_multi (IAnjutaProjectManager *project_manager,
 							 GError **err)
 {
 	ProjectManagerPlugin *plugin;
-	IAnjutaProjectManagerElementType default_location_type;
-	gchar *location_id = NULL;
+	AnjutaProjectNodeType default_location_type;
+	AnjutaProjectNode *location_id = NULL;
 	GList* source_ids;
 	GList* source_uris = NULL;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), FALSE);
 	
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
-	g_return_val_if_fail (GBF_IS_PROJECT (plugin->project), FALSE);
+	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), FALSE);
 
 	update_operation_begin (plugin);
 	if (default_location_uri == NULL)
 	{
-		default_location_type = IANJUTA_PROJECT_MANAGER_UNKNOWN;
+		default_location_type = ANJUTA_PROJECT_UNKNOWN;
 	}
 	else
 	{
@@ -2371,14 +2251,14 @@ iproject_manager_add_source_multi (IAnjutaProjectManager *project_manager,
 													  default_location_uri, NULL);
 		location_id = get_element_id_from_uri (plugin, default_location_uri);
 	}
-	if (default_location_type == IANJUTA_PROJECT_MANAGER_GROUP)
+	if (default_location_type == ANJUTA_PROJECT_GROUP)
 	{
 		source_ids = gbf_project_util_add_source_multi (plugin->model,
 											 get_plugin_parent_window (plugin),
 												 NULL, location_id,
 												 source_add_uris);
 	}
-	else if (default_location_type == IANJUTA_PROJECT_MANAGER_TARGET)
+	else if (default_location_type == ANJUTA_PROJECT_TARGET)
 	{
 		source_ids =
 			gbf_project_util_add_source_multi (plugin->model,
@@ -2402,10 +2282,9 @@ iproject_manager_add_source_multi (IAnjutaProjectManager *project_manager,
 									 get_element_uri_from_id (plugin,
 														  source_ids->data,
 														  IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI));
-		g_free (source_ids->data);
-		source_ids = g_list_next(source_ids);
+		source_ids = g_list_delete_link (source_ids, source_ids);
 	}
-	g_list_free (source_ids);
+
 	return source_uris;
 }
 
@@ -2416,13 +2295,15 @@ iproject_manager_add_target (IAnjutaProjectManager *project_manager,
 							 GError **err)
 {
 	ProjectManagerPlugin *plugin;
-	gchar *default_group_id, *target_id, *target_uri = NULL;
+	gchar *target_uri = NULL;
+	AnjutaProjectTarget *target_id;
+	AnjutaProjectGroup *default_group_id;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), FALSE);
 	
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
 	
-	g_return_val_if_fail (GBF_IS_PROJECT (plugin->project), FALSE);
+	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), FALSE);
 
 	default_group_id = get_element_id_from_uri (plugin, default_group_uri);
 	
@@ -2433,8 +2314,7 @@ iproject_manager_add_target (IAnjutaProjectManager *project_manager,
 											 target_name_to_add);
 	update_operation_end (plugin, TRUE);
 	target_uri = get_element_uri_from_id (plugin, target_id, IANJUTA_BUILDER_ROOT_URI);
-	g_free (target_id);
-	g_free (default_group_id);
+
 	return target_uri;
 }
 
@@ -2445,13 +2325,14 @@ iproject_manager_add_group (IAnjutaProjectManager *project_manager,
 							GError **err)
 {
 	ProjectManagerPlugin *plugin;
-	gchar *group_id, *group_uri = NULL;
-	gchar *default_group_id;
+	gchar *group_uri = NULL;
+	AnjutaProjectGroup *group_id;
+	AnjutaProjectGroup *default_group_id;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), FALSE);
 	
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
-	g_return_val_if_fail (GBF_IS_PROJECT (plugin->project), FALSE);
+	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), FALSE);
 
 	default_group_id = get_element_id_from_uri (plugin, default_group_uri);
 	
@@ -2462,8 +2343,7 @@ iproject_manager_add_group (IAnjutaProjectManager *project_manager,
 										   group_name_to_add);
 	update_operation_end (plugin, TRUE);
 	group_uri = get_element_uri_from_id (plugin, group_id, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
-	g_free (group_id);
-	g_free (default_group_id);
+	
 	return group_uri;
 }
 
@@ -2474,32 +2354,20 @@ iproject_manager_is_open (IAnjutaProjectManager *project_manager, GError **err)
 
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
 
-	return GBF_IS_PROJECT (plugin->project);
+	return IANJUTA_IS_PROJECT (plugin->project);
 }
 
 static GList*
 iproject_manager_get_packages (IAnjutaProjectManager *project_manager, GError **err)
 {
 	ProjectManagerPlugin *plugin;
-	GList *modules = NULL;
-	GList *packages = NULL;
-	GList* node;
-	
+
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
 	
 	/* Check if a current project is opened */
 	if (plugin->project == NULL) return NULL;
-	
-	modules = gbf_project_get_config_modules (plugin->project, NULL);
-	for (node = modules; node != NULL; node = g_list_next (node))
-	{
-		GList* mod_pkgs = gbf_project_get_config_packages (plugin->project,
-														   node->data, NULL);
-		packages = g_list_concat (packages, mod_pkgs);
-	}
-	g_list_foreach (modules, (GFunc)g_free, NULL);
-	g_list_free (modules);
-	return packages;
+
+	return ianjuta_project_get_packages (plugin->project, NULL);
 }
 
 static void
diff --git a/plugins/project-manager/plugin.h b/plugins/project-manager/plugin.h
index 7490a02..1e58763 100644
--- a/plugins/project-manager/plugin.h
+++ b/plugins/project-manager/plugin.h
@@ -22,7 +22,8 @@
 #define _PROJECT_MANAGER_PLUGIN_H_
 
 #include <libanjuta/anjuta-plugin.h>
-#include <libanjuta/gbf-project.h>
+#include <libanjuta/anjuta-project.h>
+#include <libanjuta/interfaces/ianjuta-project.h>
 #include "gbf-project-model.h"
 #include "gbf-project-view.h"
 
@@ -42,7 +43,7 @@ struct _ProjectManagerPlugin{
 	
 	AnjutaUI *ui;
 	AnjutaPreferences *prefs;
-	GbfProject *project;
+	IAnjutaProject *project;
 	GtkWidget *view;
 	GbfProjectModel *model;
 	GtkWidget *scrolledwindow;
diff --git a/plugins/run-program/parameters.c b/plugins/run-program/parameters.c
index 062e763..5693c0c 100644
--- a/plugins/run-program/parameters.c
+++ b/plugins/run-program/parameters.c
@@ -678,7 +678,7 @@ run_dialog_init (RunDialog *dlg, RunProgramPlugin *plugin)
 		if (pm != NULL)
 		{
 			exec_targets = ianjuta_project_manager_get_targets (pm,
-							 IANJUTA_PROJECT_MANAGER_TARGET_EXECUTABLE,
+							 ANJUTA_TARGET_EXECUTABLE,
 							 NULL);
 		}
 		if (exec_targets != NULL)
diff --git a/plugins/search/search-replace_backend.c b/plugins/search/search-replace_backend.c
index 8b1fa17..b67fbeb 100644
--- a/plugins/search/search-replace_backend.c
+++ b/plugins/search/search-replace_backend.c
@@ -300,7 +300,7 @@ get_project_file_list(void)
 											IAnjutaProjectManager , NULL);
 		
 		list = ianjuta_project_manager_get_elements (prjman,
-													 IANJUTA_PROJECT_MANAGER_SOURCE,
+													 ANJUTA_PROJECT_SOURCE,
 													 NULL);
 		if (list)
 		{
diff --git a/plugins/symbol-db/plugin.c b/plugins/symbol-db/plugin.c
index ed512ff..47ba8c2 100644
--- a/plugins/symbol-db/plugin.c
+++ b/plugins/symbol-db/plugin.c
@@ -1422,7 +1422,7 @@ do_import_project_sources (AnjutaPlugin *plugin, IAnjutaProjectManager *pm,
 	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (plugin);	
 
 	prj_elements_list = ianjuta_project_manager_get_elements (pm,
-					   IANJUTA_PROJECT_MANAGER_SOURCE,
+					   ANJUTA_PROJECT_SOURCE,
 					   NULL);
 	
 	if (prj_elements_list == NULL)
@@ -1588,7 +1588,7 @@ do_check_offline_files_changed (SymbolDBPlugin *sdb_plugin)
 									 IAnjutaProjectManager, NULL);	
 
 	prj_elements_list = ianjuta_project_manager_get_elements (pm,
-		   IANJUTA_PROJECT_MANAGER_SOURCE,
+		   ANJUTA_PROJECT_SOURCE,
 		   NULL);
 	
 	/* fill an hash table with all the items of the list just taken. 
diff --git a/plugins/symbol-db/test-queries/Makefile.am b/plugins/symbol-db/test-queries/Makefile.am
index 65721a5..0e93479 100644
--- a/plugins/symbol-db/test-queries/Makefile.am
+++ b/plugins/symbol-db/test-queries/Makefile.am
@@ -4,6 +4,7 @@ noinst_PROGRAMS = \
 
 AM_CPPFLAGS = \
 	$(PLUGIN_SYMBOL_DB_CFLAGS) \
+	$(LIBANJUTA_CFLAGS) \
 	$(GDL_CFLAGS) \
 	-DDEBUG
 



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