[anjuta] project-manager: Move project model from project object to the project view



commit 84a07434a0f03a42a561025b3ebd82358299274a
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Thu Dec 9 21:11:44 2010 +0100

    project-manager: Move project model from project object to the project view

 plugins/am-project/am-project.c              |   11 ++
 plugins/project-manager/dialogs.c            |   58 ++++----
 plugins/project-manager/dialogs.h            |   14 +-
 plugins/project-manager/plugin.c             |  193 +++++++++++---------------
 plugins/project-manager/plugin.h             |    2 +-
 plugins/project-manager/project-marshal.list |    2 +-
 plugins/project-manager/project-view.c       |  125 ++++++++++++++++-
 plugins/project-manager/project-view.h       |   20 +++-
 plugins/project-manager/project.c            |   96 ++-----------
 plugins/project-manager/project.h            |    5 +-
 10 files changed, 278 insertions(+), 248 deletions(-)
---
diff --git a/plugins/am-project/am-project.c b/plugins/am-project/am-project.c
index 1dc3e89..61041ff 100644
--- a/plugins/am-project/am-project.c
+++ b/plugins/am-project/am-project.c
@@ -2483,10 +2483,19 @@ static gboolean
 amp_load_complete (PmJob *job)
 {
 	GHashTable *map;
+	static GTimer *timer = NULL;
 
 	g_return_val_if_fail (job->proxy != NULL, FALSE);
 
 	//anjuta_project_node_check (job->node);
+	if (timer == NULL)
+	{
+		timer = g_timer_new ();		
+	}
+	else
+	{
+		g_timer_continue (timer);
+	}
 	map = amp_project_map_node (job->node, job->proxy);
 	g_object_ref (job->proxy);
 	g_hash_table_foreach (map, (GHFunc)amp_project_update_node, map);
@@ -2495,6 +2504,8 @@ amp_load_complete (PmJob *job)
 	g_object_unref (job->proxy);
 	job->proxy = NULL;
 	g_signal_emit_by_name (AMP_PROJECT (job->user_data), "node-loaded", job->node,  job->error);
+	g_timer_stop (timer);
+	g_message ("amp_load_complete completed in %g", g_timer_elapsed (timer, NULL));
 
 	return TRUE;
 }
diff --git a/plugins/project-manager/dialogs.c b/plugins/project-manager/dialogs.c
index a2e585b..c4d4baa 100644
--- a/plugins/project-manager/dialogs.c
+++ b/plugins/project-manager/dialogs.c
@@ -728,7 +728,7 @@ pm_project_create_properties_dialog (AnjutaPmProject *project, GtkWindow *parent
  *---------------------------------------------------------------------------*/
 
 AnjutaProjectNode*
-anjuta_pm_project_new_group (AnjutaPmProject *project, GtkWindow *parent, GtkTreeIter *selected, const gchar *default_name)
+anjuta_pm_project_new_group (ProjectManagerPlugin *plugin, GtkWindow *parent, GtkTreeIter *selected, const gchar *default_name)
 {
 	GtkBuilder *gui;
 	GtkWidget *dialog, *group_name_entry, *ok_button;
@@ -737,7 +737,7 @@ anjuta_pm_project_new_group (AnjutaPmProject *project, GtkWindow *parent, GtkTre
 	gboolean finished = FALSE;
 	AnjutaProjectNode *new_group = NULL;
 
-	g_return_val_if_fail (project != NULL, NULL);
+	g_return_val_if_fail (plugin->project != NULL, NULL);
 
 	gui = load_interface ("new_group_dialog");
 	g_return_val_if_fail (gui != NULL, NULL);
@@ -759,7 +759,7 @@ anjuta_pm_project_new_group (AnjutaPmProject *project, GtkWindow *parent, GtkTre
 	else
 		gtk_widget_set_sensitive (ok_button, FALSE);
 
-	setup_nodes_treeview (anjuta_pm_project_get_model (project),
+	setup_nodes_treeview (gbf_project_view_get_model (plugin->view),
 							groups_view,
 							parent_filter_func,
 							GINT_TO_POINTER (ANJUTA_PROJECT_GROUP),
@@ -790,7 +790,7 @@ anjuta_pm_project_new_group (AnjutaPmProject *project, GtkWindow *parent, GtkTre
 														ANJUTA_PROJECT_GROUP);
 				if (group)
 				{
-					new_group = anjuta_pm_project_add_group (project, group, NULL, name, &err);
+					new_group = anjuta_pm_project_add_group (plugin->project, group, NULL, name, &err);
 					if (err)
 					{
 						error_dialog (parent, _("Cannot add group"), "%s",
@@ -827,7 +827,7 @@ anjuta_pm_project_new_group (AnjutaPmProject *project, GtkWindow *parent, GtkTre
  *---------------------------------------------------------------------------*/
 
 AnjutaProjectNode*
-anjuta_pm_project_new_source (AnjutaPmProject *project,
+anjuta_pm_project_new_source (ProjectManagerPlugin *plugin,
 							GtkWindow           *parent,
 							GtkTreeIter         *default_parent,
 							const gchar         *default_uri)
@@ -842,7 +842,7 @@ anjuta_pm_project_new_source (AnjutaPmProject *project,
 		uris = g_list_append (NULL, uri);
 	}
 	new_sources = 
-		anjuta_pm_project_new_multiple_source (project, parent,
+		anjuta_pm_project_new_multiple_source (plugin, parent,
 										default_parent, uris);
 	g_free (uri);
 	g_list_free (uris);
@@ -858,7 +858,7 @@ anjuta_pm_project_new_source (AnjutaPmProject *project,
 }
 
 GList* 
-anjuta_pm_project_new_multiple_source (AnjutaPmProject *project,
+anjuta_pm_project_new_multiple_source (ProjectManagerPlugin *plugin,
 								GtkWindow           *top_window,
 								GtkTreeIter         *default_parent,
 								GList               *uris_to_add)
@@ -875,7 +875,7 @@ anjuta_pm_project_new_multiple_source (AnjutaPmProject *project,
 	GList* new_sources = NULL;
 	GList* uri_node;
 
-	g_return_val_if_fail (project != NULL, NULL);
+	g_return_val_if_fail (plugin->project != NULL, NULL);
 
 	gui = load_interface ("add_source_dialog");
 	g_return_val_if_fail (gui != NULL, NULL);
@@ -931,7 +931,7 @@ anjuta_pm_project_new_multiple_source (AnjutaPmProject *project,
 	/*project_root = g_file_get_uri (anjuta_project_node_get_file (anjuta_pm_project_get_root (project)));
 	g_object_set_data_full (G_OBJECT (browse_button), "root", project_root, g_free);*/
 
-	setup_nodes_treeview (anjuta_pm_project_get_model (project),
+	setup_nodes_treeview (gbf_project_view_get_model (plugin->view),
 							targets_view,
 							parent_filter_func,
 							GINT_TO_POINTER (ANJUTA_PROJECT_SOURCE),
@@ -992,7 +992,7 @@ anjuta_pm_project_new_multiple_source (AnjutaPmProject *project,
 					gtk_tree_model_get (GTK_TREE_MODEL(list), &iter,
 						COLUMN_URI, &uri, -1);
 
-					new_source = anjuta_pm_project_add_source (project,
+					new_source = anjuta_pm_project_add_source (plugin->project,
 									parent,
 									sibling,
 									uri,
@@ -1100,7 +1100,7 @@ build_types_store (AnjutaPmProject *project)
 }
 
 AnjutaProjectNode* 
-anjuta_pm_project_new_target (AnjutaPmProject *project,
+anjuta_pm_project_new_target (ProjectManagerPlugin *plugin,
                              GtkWindow       *parent,
                              GtkTreeIter     *default_group,
                              const gchar     *default_target_name_to_add)
@@ -1114,7 +1114,7 @@ anjuta_pm_project_new_target (AnjutaPmProject *project,
 	gboolean finished = FALSE;
 	AnjutaProjectNode *new_target = NULL;
 
-	g_return_val_if_fail (project != NULL, NULL);
+	g_return_val_if_fail (plugin->project != NULL, NULL);
 
 	gui = load_interface ("new_target_dialog");
 	g_return_val_if_fail (gui != NULL, NULL);
@@ -1137,7 +1137,7 @@ anjuta_pm_project_new_target (AnjutaPmProject *project,
 	else
 		gtk_widget_set_sensitive (ok_button, FALSE);
 
-	setup_nodes_treeview (anjuta_pm_project_get_model (project),
+	setup_nodes_treeview (gbf_project_view_get_model (plugin->view),
 							groups_view,
 							parent_filter_func,
 							GINT_TO_POINTER (ANJUTA_PROJECT_TARGET),
@@ -1145,7 +1145,7 @@ anjuta_pm_project_new_target (AnjutaPmProject *project,
 	gtk_widget_show (groups_view);
 
 	/* setup target types combo box */
-	types_store = build_types_store (project);
+	types_store = build_types_store (plugin->project);
 	gtk_combo_box_set_model (GTK_COMBO_BOX (target_type_combo), 
 							GTK_TREE_MODEL (types_store));
 
@@ -1205,7 +1205,7 @@ anjuta_pm_project_new_target (AnjutaPmProject *project,
 
 				if (group && type)
 				{
-					new_target = anjuta_pm_project_add_target (project, group, NULL, name, type, &err);
+					new_target = anjuta_pm_project_add_target (plugin->project, group, NULL, name, type, &err);
 					if (err)
 					{
 						error_dialog (parent, _("Cannot add target"), "%s",
@@ -1258,7 +1258,7 @@ on_cursor_changed(GtkTreeView* view, gpointer data)
 }
 
 GList*
-anjuta_pm_project_new_module (AnjutaPmProject *project,
+anjuta_pm_project_new_module (ProjectManagerPlugin *plugin,
                              GtkWindow          *parent,
                              GtkTreeIter        *default_target,
                              const gchar        *default_module)
@@ -1273,7 +1273,7 @@ anjuta_pm_project_new_module (AnjutaPmProject *project,
 	GList* new_modules = NULL;
 	GtkTreeSelection *module_selection;
 
-	g_return_val_if_fail (project != NULL, NULL);
+	g_return_val_if_fail (plugin->project != NULL, NULL);
 
 	gui = load_interface ("add_module_dialog");
 	g_return_val_if_fail (gui != NULL, NULL);
@@ -1285,13 +1285,13 @@ anjuta_pm_project_new_module (AnjutaPmProject *project,
 	new_button = GTK_WIDGET (gtk_builder_get_object (gui, "new_package_button"));
 	ok_button = GTK_WIDGET (gtk_builder_get_object (gui, "ok_module_button"));
 
-	setup_nodes_treeview (anjuta_pm_project_get_model (project),
+	setup_nodes_treeview (gbf_project_view_get_model (plugin->view),
 							targets_view,
 							parent_filter_func,
 							GINT_TO_POINTER (ANJUTA_PROJECT_MODULE),
 							default_target);
 	gtk_widget_show (targets_view);
-	setup_nodes_treeview (anjuta_pm_project_get_model (project),
+	setup_nodes_treeview (gbf_project_view_get_model (plugin->view),
 							modules_view,
 							module_filter_func,
 							NULL,
@@ -1330,7 +1330,7 @@ anjuta_pm_project_new_module (AnjutaPmProject *project,
 		switch (response) {
 			case 1:
 			{
-				anjuta_pm_project_new_package (project, parent, NULL, NULL);
+				anjuta_pm_project_new_package (plugin, parent, NULL, NULL);
 
 				break;
 			}
@@ -1356,7 +1356,7 @@ anjuta_pm_project_new_module (AnjutaPmProject *project,
 						new_module = gbf_tree_data_get_node (node->data);
 						name = anjuta_project_node_get_name (new_module);
 
-						new_module = ianjuta_project_add_node_after (project->project, target, NULL, ANJUTA_PROJECT_MODULE, NULL, name, &error);
+						new_module = ianjuta_project_add_node_after (plugin->project->project, target, NULL, ANJUTA_PROJECT_MODULE, NULL, name, &error);
 						if (error) {
 							gchar *str = g_strdup_printf ("%s: %s\n",
 															name,
@@ -1471,7 +1471,7 @@ on_pkg_chooser_selection_changed (AnjutaPkgConfigChooser* chooser,
 }
 
 GList* 
-anjuta_pm_project_new_package (AnjutaPmProject *project,
+anjuta_pm_project_new_package (ProjectManagerPlugin *plugin,
                               GtkWindow        *parent,
                               GtkTreeIter      *default_module,
                               GList            *packages_to_add)
@@ -1491,7 +1491,7 @@ anjuta_pm_project_new_package (AnjutaPmProject *project,
     gint default_pos = -1;
 	gint pos;
     
-    g_return_val_if_fail (project != NULL, NULL);
+    g_return_val_if_fail (plugin->project != NULL, NULL);
     
     gui = load_interface ("add_package_dialog");
     g_return_val_if_fail (gui != NULL, NULL);
@@ -1508,7 +1508,7 @@ anjuta_pm_project_new_package (AnjutaPmProject *project,
         GbfTreeData *data;
 	    GbfProjectModel *model;
 
-		model = anjuta_pm_project_get_model(project);
+		model = gbf_project_view_get_model(plugin->view);
 		gtk_tree_model_get (GTK_TREE_MODEL (model), default_module, GBF_PROJECT_MODEL_COLUMN_DATA, &data, -1);
 		if (data != NULL)
 		{
@@ -1520,7 +1520,7 @@ anjuta_pm_project_new_package (AnjutaPmProject *project,
     store = gtk_list_store_new(1, G_TYPE_STRING);	
     gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (module_entry), 0);
 
-	root = ianjuta_project_get_root (project->project, NULL);
+	root = ianjuta_project_get_root (plugin->project->project, NULL);
 	pos = 0;
 	for (node = anjuta_project_node_first_child (root); node != NULL; node = anjuta_project_node_next_sibling (node))
 	{
@@ -1592,16 +1592,16 @@ anjuta_pm_project_new_package (AnjutaPmProject *project,
 				else
 				{
 					/* Look for already existing module */
-					module = anjuta_pm_project_get_module (project, name);
+					module = anjuta_pm_project_get_module (plugin->project, name);
 					if (module == NULL)
 					{
 						/* Create new module */
 						AnjutaProjectNode *root;
 						GError *error = NULL;
 
-						root = ianjuta_project_get_root (project->project, NULL);
+						root = ianjuta_project_get_root (plugin->project->project, NULL);
 
-						module = ianjuta_project_add_node_after (project->project, root, NULL, ANJUTA_PROJECT_MODULE, NULL, name, &error);
+						module = ianjuta_project_add_node_after (plugin->project->project, root, NULL, ANJUTA_PROJECT_MODULE, NULL, name, &error);
 						if (error != NULL)
 						{
                     		gchar *str = g_strdup_printf ("%s: %s\n", name, error->message);
@@ -1628,7 +1628,7 @@ anjuta_pm_project_new_package (AnjutaPmProject *project,
 
 						name = node->data;
 
-						new_package = ianjuta_project_add_node_after (project->project, module, NULL, ANJUTA_PROJECT_PACKAGE, NULL, name, &error);
+						new_package = ianjuta_project_add_node_after (plugin->project->project, module, NULL, ANJUTA_PROJECT_PACKAGE, NULL, name, &error);
 						if (error)
 						{
 							gchar *str = g_strdup_printf ("%s: %s\n",
diff --git a/plugins/project-manager/dialogs.h b/plugins/project-manager/dialogs.h
index eb81323..13161a6 100644
--- a/plugins/project-manager/dialogs.h
+++ b/plugins/project-manager/dialogs.h
@@ -24,16 +24,16 @@
 
 #include <gtk/gtk.h>
 #include <libanjuta/interfaces/ianjuta-project.h>
-#include "project.h"
+#include "plugin.h"
 
 G_BEGIN_DECLS
 
-AnjutaProjectNode* anjuta_pm_project_new_group (AnjutaPmProject *project, GtkWindow *parent, GtkTreeIter *default_parent, const gchar *name);
-AnjutaProjectNode* anjuta_pm_project_new_target (AnjutaPmProject *project, GtkWindow *parent, GtkTreeIter *default_group, const gchar *name);
-AnjutaProjectNode* anjuta_pm_project_new_source (AnjutaPmProject *project, GtkWindow *parent, GtkTreeIter *default_parent, const gchar *name);
-GList* anjuta_pm_project_new_multiple_source (AnjutaPmProject *project, GtkWindow *parent, GtkTreeIter *default_parent, GList *name);
-GList* anjuta_pm_project_new_module (AnjutaPmProject *project, GtkWindow *parent, GtkTreeIter *default_target, const gchar *default_module);
-GList* anjuta_pm_project_new_package (AnjutaPmProject *project, GtkWindow *parent, GtkTreeIter *default_module, GList *packages_to_add);
+AnjutaProjectNode* anjuta_pm_project_new_group (ProjectManagerPlugin *plugin, GtkWindow *parent, GtkTreeIter *default_parent, const gchar *name);
+AnjutaProjectNode* anjuta_pm_project_new_target (ProjectManagerPlugin *plugin, GtkWindow *parent, GtkTreeIter *default_group, const gchar *name);
+AnjutaProjectNode* anjuta_pm_project_new_source (ProjectManagerPlugin *plugin, GtkWindow *parent, GtkTreeIter *default_parent, const gchar *name);
+GList* anjuta_pm_project_new_multiple_source (ProjectManagerPlugin *plugin, GtkWindow *parent, GtkTreeIter *default_parent, GList *name);
+GList* anjuta_pm_project_new_module (ProjectManagerPlugin *plugin, GtkWindow *parent, GtkTreeIter *default_target, const gchar *default_module);
+GList* anjuta_pm_project_new_package (ProjectManagerPlugin *plugin, GtkWindow *parent, GtkTreeIter *default_module, GList *packages_to_add);
 
 
 GtkWidget *pm_project_create_properties_dialog (AnjutaPmProject *project, GtkWindow *parent, AnjutaProjectNode *node);
diff --git a/plugins/project-manager/plugin.c b/plugins/project-manager/plugin.c
index 6cf8f70..c0181f8 100644
--- a/plugins/project-manager/plugin.c
+++ b/plugins/project-manager/plugin.c
@@ -181,7 +181,7 @@ on_session_save (AnjutaShell *shell, AnjutaSessionPhase phase,
 	}
 
 	/* Save shortcuts */
-	list = gbf_project_view_get_shortcut_list (GBF_PROJECT_VIEW (plugin->view));
+	list = gbf_project_view_get_shortcut_list (plugin->view);
 	if (list != NULL)
 	{
     	anjuta_session_set_string_list (session, "Project Manager", "Shortcut", list);
@@ -439,9 +439,9 @@ on_add_package (GtkAction *action, ProjectManagerPlugin *plugin)
 	GbfTreeData *data;
 	
 	update_operation_begin (plugin);
-	data = gbf_project_view_get_first_selected (GBF_PROJECT_VIEW (plugin->view), &selected_module);
+	data = gbf_project_view_get_first_selected (plugin->view, &selected_module);
 	
-	new_module = anjuta_pm_project_new_package (plugin->project,
+	new_module = anjuta_pm_project_new_package (plugin,
 										   get_plugin_parent_window (plugin),
 										   data == NULL ? NULL : &selected_module, NULL);
 	g_list_free (new_module);
@@ -456,9 +456,9 @@ on_add_module (GtkAction *action, ProjectManagerPlugin *plugin)
 	GbfTreeData *data;
 	
 	update_operation_begin (plugin);
-	data = gbf_project_view_get_first_selected (GBF_PROJECT_VIEW (plugin->view), &selected_target);
+	data = gbf_project_view_get_first_selected (plugin->view, &selected_target);
 
-	new_modules = anjuta_pm_project_new_module (plugin->project,
+	new_modules = anjuta_pm_project_new_module (plugin,
 										   get_plugin_parent_window (plugin),
 										   data == NULL ? NULL : &selected_target, NULL);
 	g_list_free (new_modules);
@@ -513,7 +513,7 @@ on_popup_properties (GtkAction *action, ProjectManagerPlugin *plugin)
 {
 	GList *selected;
 	
-	selected = gbf_project_view_get_all_selected (GBF_PROJECT_VIEW (plugin->view));
+	selected = gbf_project_view_get_all_selected (plugin->view);
 
 	if (selected != NULL)
 	{
@@ -536,9 +536,9 @@ on_popup_add_package (GtkAction *action, ProjectManagerPlugin *plugin)
 	GList *packages;
 	
 	update_operation_begin (plugin);
-	gbf_project_view_get_first_selected (GBF_PROJECT_VIEW (plugin->view), &selected_module);
+	gbf_project_view_get_first_selected (plugin->view, &selected_module);
 	
-	packages = anjuta_pm_project_new_package (plugin->project,
+	packages = anjuta_pm_project_new_package (plugin,
 										   get_plugin_parent_window (plugin),
 										   &selected_module, NULL);
 	update_operation_end (plugin, TRUE);
@@ -551,9 +551,9 @@ on_popup_add_module (GtkAction *action, ProjectManagerPlugin *plugin)
 	GList *new_modules;
 	
 	update_operation_begin (plugin);
-	gbf_project_view_get_first_selected (GBF_PROJECT_VIEW (plugin->view), &selected_target);
+	gbf_project_view_get_first_selected (plugin->view, &selected_target);
 	
-	new_modules = anjuta_pm_project_new_module (plugin->project,
+	new_modules = anjuta_pm_project_new_module (plugin,
 										   get_plugin_parent_window (plugin),
 										   &selected_target, NULL);
 	g_list_free (new_modules);
@@ -567,9 +567,9 @@ on_popup_add_group (GtkAction *action, ProjectManagerPlugin *plugin)
 	AnjutaProjectNode *new_group;
 	
 	update_operation_begin (plugin);
-	gbf_project_view_get_first_selected (GBF_PROJECT_VIEW (plugin->view), &selected_group);
+	gbf_project_view_get_first_selected (plugin->view, &selected_group);
 	
-	new_group = anjuta_pm_project_new_group (plugin->project,
+	new_group = anjuta_pm_project_new_group (plugin,
 										   get_plugin_parent_window (plugin),
 										   &selected_group, NULL);
 	update_operation_end (plugin, TRUE);
@@ -582,9 +582,9 @@ on_popup_add_target (GtkAction *action, ProjectManagerPlugin *plugin)
 	AnjutaProjectNode *new_target;
 
 	update_operation_begin (plugin);
-	gbf_project_view_get_first_selected (GBF_PROJECT_VIEW (plugin->view), &selected_group);
+	gbf_project_view_get_first_selected (plugin->view, &selected_group);
 
-	new_target = anjuta_pm_project_new_target (plugin->project,
+	new_target = anjuta_pm_project_new_target (plugin,
 											 get_plugin_parent_window (plugin),
 											 &selected_group, NULL);
 	
@@ -598,9 +598,9 @@ on_popup_add_source (GtkAction *action, ProjectManagerPlugin *plugin)
 	AnjutaProjectNode *new_source;
 	
 	update_operation_begin (plugin);
-	gbf_project_view_get_first_selected (GBF_PROJECT_VIEW (plugin->view), &selected_target);
+	gbf_project_view_get_first_selected (plugin->view, &selected_target);
 
-	new_source = anjuta_pm_project_new_source (plugin->project,
+	new_source = anjuta_pm_project_new_source (plugin,
 											 get_plugin_parent_window (plugin),
 											 &selected_target, NULL);
 
@@ -726,7 +726,7 @@ on_popup_remove (GtkAction *action, ProjectManagerPlugin *plugin)
 {
 	GList *selected;
 	
-	selected = gbf_project_view_get_all_selected (GBF_PROJECT_VIEW (plugin->view));
+	selected = gbf_project_view_get_all_selected (plugin->view);
 
 	if (selected != NULL)
 	{
@@ -768,7 +768,7 @@ on_popup_remove (GtkAction *action, ProjectManagerPlugin *plugin)
 					}
 					break;
 				case GBF_TREE_NODE_SHORTCUT:
-					anjuta_pm_project_remove_data (plugin->project, data, NULL);
+					gbf_project_view_remove_data (plugin->view, data, NULL);
 					break;
 				default:
 					break;
@@ -1037,7 +1037,7 @@ on_treeview_selection_changed (GtkTreeSelection *sel,
 	GFile *selected_file;
 	
 	ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL);
-	node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+	node = gbf_project_view_find_selected (plugin->view,
 										   ANJUTA_PROJECT_UNKNOWN);
 
 	if (node != NULL)
@@ -1275,98 +1275,57 @@ add_primary_target (AnjutaProjectNode *node, gpointer data)
 }
 
 static void
-on_project_updated (AnjutaPmProject *project, AnjutaProjectNode *node, GError *error, ProjectManagerPlugin *plugin)
-{
-	gchar *dirname;
-
-	dirname = anjuta_util_get_local_path_from_uri (plugin->project_root_uri);
-	if (!error)
-	{
-		if (plugin->shortcuts != NULL)
-		{
-			/* Restore existing shortcut */
-			GList *item;
-			
-			gbf_project_view_set_shortcut_list (GBF_PROJECT_VIEW (plugin->view), plugin->shortcuts);
-			/* Remove used shortcuts */
-			for (item = g_list_first (plugin->shortcuts); item != NULL;)
-			{
-				if (*((char *)item->data) == 'U')
-				{
-					GList *next = g_list_next (item);
-					
-					g_free (item->data);
-					plugin->shortcuts = g_list_remove_link (plugin->shortcuts, item);
-					item = next;
-				}
-				else
-				{
-					item = g_list_next (item);
-				}
-			}
-		}
-		else
-		{
-			GList *list = NULL;
-			
-			/* Add new shortcut for PRIMARY target */
-			anjuta_project_node_foreach (node, G_POST_ORDER, add_primary_target, &list);
-
-			if (list != NULL)
-			{
-				list = g_list_reverse (list);
-				gbf_project_view_set_shortcut_list (GBF_PROJECT_VIEW (plugin->view), list);
-				g_list_free (list);
-			}
-		}
-	}
-	g_free (dirname);
-}
-
-static void
-on_project_loaded (AnjutaPmProject *project, AnjutaProjectNode *node, GError *error, ProjectManagerPlugin *plugin)
+on_project_loaded (AnjutaPmProject *project, GtkTreeIter *parent, gboolean complete, GError *error, ProjectManagerPlugin *plugin)
 {
 	AnjutaStatus *status;
 	gchar *dirname;
+	AnjutaProjectNode *node;
 
+	node = gbf_project_view_get_node_from_iter (plugin->view, parent);
+	
 	dirname = anjuta_util_get_local_path_from_uri (plugin->project_root_uri);
 	status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell, NULL);
 	if (error)
 	{
-		GtkWidget *toplevel;
-		GtkWindow *win;
+		if (complete)
+		{
+			GtkWidget *toplevel;
+			GtkWindow *win;
 		
-		toplevel = gtk_widget_get_toplevel (plugin->scrolledwindow);
-		if (toplevel && GTK_IS_WINDOW (toplevel))
-			win = GTK_WINDOW (toplevel);
-		else
-			win = GTK_WINDOW (ANJUTA_PLUGIN (plugin)->shell);
+			toplevel = gtk_widget_get_toplevel (plugin->scrolledwindow);
+			if (toplevel && GTK_IS_WINDOW (toplevel))
+				win = GTK_WINDOW (toplevel);
+			else
+				win = GTK_WINDOW (ANJUTA_PLUGIN (plugin)->shell);
 
-		anjuta_util_dialog_error (win, _("Failed to parse project (the project is opened, but there will be no project view) %s: %s\n"
+			anjuta_util_dialog_error (win, _("Failed to parse project (the project is opened, but there will be no project view) %s: %s\n"
 										 ""),
-								  dirname, error->message);
+									  dirname, error->message);
+		}
 	}
 	else
 	{
 		/* Restore existing shortcut */
-#if 0
 		if (plugin->shortcuts != NULL)
 		{
 			GList *item;
 			
-			gbf_project_view_set_shortcut_list (GBF_PROJECT_VIEW (plugin->view), plugin->shortcuts);
-			/* Remove all shortcuts, as the project is completely loaded */
+			gbf_project_view_set_shortcut_list (plugin->view, plugin->shortcuts);
+			/* Remove used or all shortcuts if loading is completed*/
 			for (item = g_list_first (plugin->shortcuts); item != NULL;)
 			{
 				GList *next = g_list_next (item);
+
+				if (complete || (*((char *)item->data) == 'U'))
+				{
 					
-				g_free (item->data);
-				plugin->shortcuts = g_list_remove_link (plugin->shortcuts, item);
+					g_free (item->data);
+					plugin->shortcuts = g_list_remove_link (plugin->shortcuts, item);
+				}
 				item = next;
 			}
 		}
 		else
-#endif
 		{
 			GList *list = NULL;
 			
@@ -1376,11 +1335,16 @@ on_project_loaded (AnjutaPmProject *project, AnjutaProjectNode *node, GError *er
 			if (list != NULL)
 			{
 				list = g_list_reverse (list);
-				gbf_project_view_set_shortcut_list (GBF_PROJECT_VIEW (plugin->view), list);
+				gbf_project_view_set_shortcut_list (plugin->view, list);
 				g_list_foreach (list, (GFunc)g_free, NULL);
 				g_list_free (list);
 			}
 		}
+	}
+	g_free (dirname);
+
+	if (complete)
+	{
 		gchar *basename = g_path_get_basename (dirname);
 		
 		anjuta_status_progress_tick (status, NULL, _("Update project viewâ?¦"));
@@ -1390,18 +1354,18 @@ on_project_loaded (AnjutaPmProject *project, AnjutaProjectNode *node, GError *er
 									NULL);
 		anjuta_status_set_default (status, _("Project"), basename);
 		g_free (basename);
-	}
-	g_free (dirname);
+		
+		if (plugin->busy)
+		{
+			anjuta_status_pop (status);
+			anjuta_status_busy_pop (status);
+			plugin->busy = FALSE;
+		}
+		
+		/* Emit loaded signal for other plugins */
+		g_signal_emit_by_name (G_OBJECT (plugin), "project_loaded", error);
 
-	if (plugin->busy)
-	{
-		anjuta_status_pop (status);
-		anjuta_status_busy_pop (status);
-		plugin->busy = FALSE;
 	}
-
-	/* Emit loaded signal for other plugins */
-	g_signal_emit_by_name (G_OBJECT (plugin), "project_loaded", error);
 }
 
 static void
@@ -1604,7 +1568,8 @@ static gboolean
 project_manager_plugin_activate_plugin (AnjutaPlugin *plugin)
 {
 	AnjutaProfileManager *profile_manager;
-	GtkWidget *view, *scrolled_window;
+	GtkWidget *scrolled_window;
+	GtkWidget *view;
 	static gboolean initialized = FALSE;
 	GtkTreeSelection *selection;
 	/* GladeXML *gxml; */
@@ -1621,14 +1586,16 @@ project_manager_plugin_activate_plugin (AnjutaPlugin *plugin)
 
 	/* Create project */
 	pm_plugin->project = anjuta_pm_project_new (plugin);
-	g_signal_connect (pm_plugin->project, "updated", G_CALLBACK (on_project_updated), plugin);
-	g_signal_connect (pm_plugin->project, "loaded", G_CALLBACK (on_project_loaded), plugin);
 	
 	/* create model & view and bind them */
 	view = gbf_project_view_new ();
+
+	/* Add project to view */
+	gbf_project_view_set_project (GBF_PROJECT_VIEW (view), pm_plugin->project);
+	g_signal_connect (view, "node-loaded", G_CALLBACK (on_project_loaded), plugin);
 	
-	gtk_tree_view_set_model (GTK_TREE_VIEW (view),
-							 GTK_TREE_MODEL (anjuta_pm_project_get_model (pm_plugin->project)));
+	/*gtk_tree_view_set_model (GTK_TREE_VIEW (view),
+							 GTK_TREE_MODEL (anjuta_pm_project_get_model (pm_plugin->project)));*/
 	
 	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
 	gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
@@ -1656,7 +1623,7 @@ project_manager_plugin_activate_plugin (AnjutaPlugin *plugin)
 	gtk_widget_show (scrolled_window);
 	
 	pm_plugin->scrolledwindow = scrolled_window;
-	pm_plugin->view = view;
+	pm_plugin->view = GBF_PROJECT_VIEW (view);
 	
 	/* Action groups */
 	pm_plugin->pm_action_group = 
@@ -1907,8 +1874,8 @@ static GtkTreeIter*
 get_tree_iter_from_file (ProjectManagerPlugin *plugin, GtkTreeIter* iter, GFile *file, GbfTreeNodeType type)
 {
 	gboolean found;
-	
-	found = gbf_project_model_find_file (anjuta_pm_project_get_model (plugin->project), iter, NULL, type, file);
+
+	found = gbf_project_view_find_file (plugin->view, iter, file, type);
 
 	return found ? iter : NULL;
 }
@@ -1918,7 +1885,7 @@ get_element_type (ProjectManagerPlugin *plugin, GFile *element)
 {
 	AnjutaProjectNode *node;
 	
-	node = anjuta_pm_project_get_node_from_file (plugin->project, ANJUTA_PROJECT_UNKNOWN,  element);
+	node = gbf_project_view_get_node_from_file (plugin->view, ANJUTA_PROJECT_UNKNOWN,  element);
 
 	return node == NULL ? ANJUTA_PROJECT_UNKNOWN : anjuta_project_node_get_node_type (node);
 }
@@ -1953,7 +1920,7 @@ iproject_manager_get_target_type (IAnjutaProjectManager *project_manager,
 	g_return_val_if_fail (file_is_inside_project (plugin, target_file),
 						  ANJUTA_PROJECT_UNKNOWN);
 	
-	target = anjuta_pm_project_get_node_from_file (plugin->project, ANJUTA_PROJECT_TARGET,  target_file);
+	target = gbf_project_view_get_node_from_file (plugin->view, ANJUTA_PROJECT_TARGET,  target_file);
 
 	if (target != NULL)
 	{
@@ -2031,21 +1998,21 @@ iproject_manager_get_selected (IAnjutaProjectManager *project_manager,
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
 	if (!anjuta_pm_project_is_open (plugin->project)) return NULL;
 	
-	node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+	node = gbf_project_view_find_selected (plugin->view,
 										   ANJUTA_PROJECT_SOURCE);
 	if (node && anjuta_project_node_get_node_type (node) == ANJUTA_PROJECT_SOURCE)
 	{
 		return g_object_ref (anjuta_project_node_get_file (node));
 	}
 
-	node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+	node = gbf_project_view_find_selected (plugin->view,
 										   ANJUTA_PROJECT_TARGET);
 	if (node && anjuta_project_node_get_node_type (node) == ANJUTA_PROJECT_TARGET)
 	{
 		return get_element_file_from_node (plugin, node, IANJUTA_BUILDER_ROOT_URI);
 	}
 
-	node = gbf_project_view_find_selected (GBF_PROJECT_VIEW (plugin->view),
+	node = gbf_project_view_find_selected (plugin->view,
 										   ANJUTA_PROJECT_GROUP);
 	if (node && anjuta_project_node_get_node_type (node) == GBF_TREE_NODE_GROUP)
 	{
@@ -2088,7 +2055,7 @@ iproject_manager_add_source (IAnjutaProjectManager *project_manager,
 	{
 		iter = get_tree_iter_from_file (plugin, &target_iter, default_target_file, GBF_TREE_NODE_TARGET);
 	}
-	source_id = anjuta_pm_project_new_source (plugin->project,
+	source_id = anjuta_pm_project_new_source (plugin,
 										     get_plugin_parent_window (plugin),
 											 iter,
 											 source_uri_to_add);
@@ -2113,7 +2080,7 @@ iproject_manager_add_source_quiet (IAnjutaProjectManager *project_manager,
 	
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
 
-	target = anjuta_pm_project_get_node_from_file (plugin->project, ANJUTA_PROJECT_TARGET,  location_file);
+	target = gbf_project_view_get_node_from_file (plugin->view, ANJUTA_PROJECT_TARGET,  location_file);
 	update_operation_begin (plugin);
 	source_id = anjuta_pm_project_add_source (plugin->project,
 	    								target,
@@ -2147,7 +2114,7 @@ iproject_manager_add_source_multi (IAnjutaProjectManager *project_manager,
 		iter = get_tree_iter_from_file (plugin, &target_iter, default_target_file, GBF_TREE_NODE_TARGET);
 	}
 
-	source_ids = anjuta_pm_project_new_multiple_source (plugin->project,
+	source_ids = anjuta_pm_project_new_multiple_source (plugin,
 										 get_plugin_parent_window (plugin),
 										 iter,
 										 source_add_uris);
@@ -2187,7 +2154,7 @@ iproject_manager_add_target (IAnjutaProjectManager *project_manager,
 	}
 	
 	update_operation_begin (plugin);
-	target_id = anjuta_pm_project_new_target (plugin->project,
+	target_id = anjuta_pm_project_new_target (plugin,
 											 get_plugin_parent_window (plugin),
 											 iter,
 											 target_name_to_add);
@@ -2219,7 +2186,7 @@ iproject_manager_add_group (IAnjutaProjectManager *project_manager,
 	}
 	
 	update_operation_begin (plugin);
-	group_id = anjuta_pm_project_new_group (plugin->project,
+	group_id = anjuta_pm_project_new_group (plugin,
 										   get_plugin_parent_window (plugin),
 										   iter,
 										   group_name_to_add);
diff --git a/plugins/project-manager/plugin.h b/plugins/project-manager/plugin.h
index 1422735..dca4524 100644
--- a/plugins/project-manager/plugin.h
+++ b/plugins/project-manager/plugin.h
@@ -46,7 +46,7 @@ struct _ProjectManagerPlugin{
 	
 	AnjutaUI *ui;
 	AnjutaPreferences *prefs;
-	GtkWidget *view;
+	GbfProjectView *view;
 	GtkWidget *scrolledwindow;
 	
 	GtkActionGroup *pm_action_group;
diff --git a/plugins/project-manager/project-marshal.list b/plugins/project-manager/project-marshal.list
index 7b74d10..d870ff4 100644
--- a/plugins/project-manager/project-marshal.list
+++ b/plugins/project-manager/project-marshal.list
@@ -1 +1 @@
-VOID:POINTER,BOXED
+VOID:POINTER,BOOLEAN,BOXED
diff --git a/plugins/project-manager/project-view.c b/plugins/project-manager/project-view.c
index b731293..e95bec0 100644
--- a/plugins/project-manager/project-view.c
+++ b/plugins/project-manager/project-view.c
@@ -37,6 +37,7 @@
 #include "tree-data.h"
 #include "project-model.h"
 #include "project-view.h"
+#include "project-marshal.h"
 
 #define ICON_SIZE 16
 
@@ -44,6 +45,7 @@ enum {
 	URI_ACTIVATED,
 	TARGET_SELECTED,
 	GROUP_SELECTED,
+	NODE_LOADED,
 	LAST_SIGNAL
 };
 
@@ -107,18 +109,26 @@ row_activated (GtkTreeView       *tree_view,
 }
 
 static void
+dispose (GObject *object)
+{
+	GbfProjectView *view;
+	
+	view = GBF_PROJECT_VIEW (object);
+	if (view->model)
+	{
+		g_object_unref (G_OBJECT (view->model));
+		view->model = NULL;
+	}
+	
+	G_OBJECT_CLASS (gbf_project_view_parent_class)->dispose (object);
+}
+
+static void
 destroy (GtkWidget *object)
 {
 	GbfProjectView *tree;
-	GbfProjectViewPrivate *priv;
 	
 	tree = GBF_PROJECT_VIEW (object);
-	priv = tree->priv;
-	
-	if (priv) {
-		g_free (priv);
-		tree->priv = NULL;
-	}
 	
 	if (GTK_WIDGET_CLASS (gbf_project_view_parent_class)->destroy)
 		(* GTK_WIDGET_CLASS (gbf_project_view_parent_class)->destroy) (object);
@@ -315,6 +325,7 @@ gbf_project_view_class_init (GbfProjectViewClass *klass)
 	widget_class = GTK_WIDGET_CLASS (klass);
 	tree_view_class = GTK_TREE_VIEW_CLASS (klass);
 
+	g_object_class->dispose = dispose;
 	widget_class->destroy = destroy;
 	widget_class->draw = draw;
 	tree_view_class->row_activated = row_activated;
@@ -347,6 +358,19 @@ gbf_project_view_class_init (GbfProjectViewClass *klass)
 			      NULL, NULL,
 			      g_cclosure_marshal_VOID__POINTER,
 			      G_TYPE_NONE, 1, G_TYPE_POINTER);
+	signals[NODE_LOADED] =
+		g_signal_new ("node-loaded",
+				GBF_TYPE_PROJECT_VIEW,
+				G_SIGNAL_RUN_LAST,
+				G_STRUCT_OFFSET (GbfProjectViewClass,
+				                 node_loaded),
+				NULL, NULL,
+				pm_cclosure_marshal_VOID__POINTER_BOOLEAN_BOXED,
+				G_TYPE_NONE, 3,
+				G_TYPE_POINTER,
+				G_TYPE_BOOLEAN,
+				G_TYPE_ERROR);
+	
 }
 
 static void 
@@ -386,6 +410,10 @@ gbf_project_view_init (GbfProjectView *tree)
 	gtk_tree_view_column_set_cell_data_func (column, renderer, set_text, tree, NULL);
 
 	gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
+
+	/* Create model */
+	tree->model = gbf_project_model_new (NULL);
+	gtk_tree_view_set_model (GTK_TREE_VIEW (tree), GTK_TREE_MODEL (tree->model));
 }
 
 GtkWidget *
@@ -672,3 +700,86 @@ gbf_project_view_set_shortcut_list (GbfProjectView *view, GList *shortcuts)
 	
 	return;
 }
+
+AnjutaProjectNode *
+gbf_project_view_get_node_from_iter (GbfProjectView *view, GtkTreeIter *iter)
+{
+	return gbf_project_model_get_node (view->model, iter);
+}
+
+AnjutaProjectNode *
+gbf_project_view_get_node_from_file (GbfProjectView *view, AnjutaProjectNodeType type, GFile *file)
+{
+	GtkTreeIter iter;
+	AnjutaProjectNode *node = NULL;
+	
+	if (gbf_project_model_find_file (view->model, &iter, NULL, type, file))
+	{
+		
+		node = gbf_project_model_get_node (view->model, &iter);
+	}
+
+	return NULL;
+}
+
+gboolean
+gbf_project_view_remove_data (GbfProjectView *view, GbfTreeData *data, GError **error)
+{
+	GtkTreeIter iter;
+	
+	if (gbf_project_model_find_tree_data (view->model, &iter, data))
+	{
+		gbf_project_model_remove (view->model, &iter);
+
+		return TRUE;
+	}
+	else
+	{
+		return FALSE;
+	}
+}
+
+static void
+on_node_loaded (AnjutaPmProject *sender, AnjutaProjectNode *node, gboolean complete, GError *error, GbfProjectView *view)
+{
+	if (error != NULL)
+	{
+		g_warning ("unable to load node");
+		g_signal_emit (G_OBJECT (view), NODE_LOADED, 0, NULL, complete, error);
+	}
+	else
+	{
+		GtkTreeIter iter;
+		gboolean found;
+			
+		found = gbf_project_model_find_node (view->model, &iter, NULL, node);
+		gbf_project_model_update_tree (view->model, node, found ? &iter : NULL);
+		if (!found)
+		{
+			gtk_tree_model_get_iter_first (GTK_TREE_MODEL (view->model), &iter);
+		}
+
+		g_signal_emit (G_OBJECT (view), signals[NODE_LOADED], 0, &iter, complete, NULL);
+	}
+}
+
+
+void 
+gbf_project_view_set_project (GbfProjectView *view, AnjutaPmProject *project)
+{
+	g_signal_connect (project, "loaded", G_CALLBACK (on_node_loaded), view);
+
+	gbf_project_model_set_project (view->model, project);
+}
+
+gboolean
+gbf_project_view_find_file (GbfProjectView *view, GtkTreeIter* iter, GFile *file, GbfTreeNodeType type)
+{
+	return gbf_project_model_find_file (view->model, iter, NULL, type, file);	
+}
+
+GbfProjectModel *
+gbf_project_view_get_model (GbfProjectView *view)
+{
+	return view->model;
+}
diff --git a/plugins/project-manager/project-view.h b/plugins/project-manager/project-view.h
index 54728be..ea6bb96 100644
--- a/plugins/project-manager/project-view.h
+++ b/plugins/project-manager/project-view.h
@@ -36,19 +36,23 @@ G_BEGIN_DECLS
 #define GBF_IS_PROJECT_VIEW_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((obj), GBF_TYPE_PROJECT_VIEW))
 
 typedef struct _GbfProjectView        GbfProjectView;
-typedef struct _GbfProjectViewPrivate GbfProjectViewPrivate;
 typedef struct _GbfProjectViewClass   GbfProjectViewClass;
 
 
 struct _GbfProjectView {
 	GtkTreeView parent;
 
-	GbfProjectViewPrivate *priv;
+	GbfProjectModel *model;
 };
 
 struct _GbfProjectViewClass {
 	GtkTreeViewClass parent_class;
 
+	void (*node_loaded) (GbfProjectView *project_view,
+	                     GtkTreeIter *iter,
+	                     gboolean complete,
+	                     GError *error);
+	
 	void (* uri_activated)    (GbfProjectView *project_view,
 				   const char     *uri);
 
@@ -73,6 +77,18 @@ void			gbf_project_view_remove_all_shortcut (GbfProjectView* view);
 void                        gbf_project_view_set_shortcut_list (GbfProjectView *view,
                                                                  GList          *shortcuts);
 
+AnjutaProjectNode *gbf_project_view_get_node_from_iter (GbfProjectView *view, GtkTreeIter *iter);
+
+AnjutaProjectNode *gbf_project_view_get_node_from_file (GbfProjectView *view, AnjutaProjectNodeType type, GFile *file);
+
+gboolean gbf_project_view_remove_data (GbfProjectView *view, GbfTreeData *data, GError **error);
+
+void gbf_project_view_set_project (GbfProjectView *view, AnjutaPmProject *project);
+
+gboolean gbf_project_view_find_file (GbfProjectView *view, GtkTreeIter* iter, GFile *file, GbfTreeNodeType type);
+
+GbfProjectModel *gbf_project_view_get_model (GbfProjectView *view);
+
 G_END_DECLS
 
 #endif /* _PROJECT_VIEW_H_ */
diff --git a/plugins/project-manager/project.c b/plugins/project-manager/project.c
index ff6cdc9..60c5b53 100644
--- a/plugins/project-manager/project.c
+++ b/plugins/project-manager/project.c
@@ -40,7 +40,6 @@
 
 enum
 {
-	UPDATED,
 	LOADED,
 	LAST_SIGNAL
 };
@@ -66,27 +65,13 @@ static gboolean
 pm_command_load_complete (AnjutaPmProject *project, AnjutaProjectNode *node, GError *error)
 {
 	// g_message ("pm_command_load_complete %p", node);
-	
-	if (error != NULL)
-	{
-		g_warning ("unable to load node");
-		g_signal_emit (G_OBJECT (project), project->loaded ? LOADED : UPDATED, 0, node, error);
-	}
-	else
+	gboolean complete = FALSE;
+
+	if (error == NULL)
 	{
 		if (project->root == node)
 		{
-			g_object_set (G_OBJECT (project->model), "project", project, NULL);
 			project->incomplete_node = 0;
-			gbf_project_model_update_tree (project->model, node, NULL);
-		}
-		else
-		{
-			GtkTreeIter iter;
-			gboolean found;
-			
-			found = gbf_project_model_find_node (project->model, &iter, NULL, node);
-			gbf_project_model_update_tree (project->model, node, found ? &iter : NULL);
 		}
 		
 		// Check for incompletely loaded object and load them
@@ -98,17 +83,12 @@ pm_command_load_complete (AnjutaPmProject *project, AnjutaProjectNode *node, GEr
 		anjuta_project_node_clear_state (node, ANJUTA_PROJECT_LOADING | ANJUTA_PROJECT_INCOMPLETE);
 		anjuta_project_node_foreach (node, G_POST_ORDER, (AnjutaProjectNodeForeachFunc)on_pm_project_load_incomplete, project);
 
-		//g_message ("emit node %p", node);
-		if (!project->loaded && (project->incomplete_node == 0))
-		{
-			g_signal_emit (G_OBJECT (project), signals[LOADED], 0, node, NULL);
-			project->loaded = TRUE;
-		}
-		else
-		{
-			g_signal_emit (G_OBJECT (project), signals[UPDATED], 0, node, NULL);
-		}
+		complete = !project->loaded && (project->incomplete_node == 0);
+		if (complete) project->loaded = TRUE;
 	}
+
+	g_signal_emit (G_OBJECT (project), signals[LOADED], 0, node, complete, error);
+
 	
 	return TRUE;
 }
@@ -235,7 +215,6 @@ anjuta_pm_project_load (AnjutaPmProject *project, GFile *file, GError **error)
 gboolean 
 anjuta_pm_project_unload (AnjutaPmProject *project, GError **error)
 {
-	g_object_set (G_OBJECT (project->model), "project", NULL, NULL);
 	g_object_unref (project->project);
 	project->project = NULL;
 	project->loaded = FALSE;
@@ -386,23 +365,6 @@ anjuta_pm_project_remove (AnjutaPmProject *project, AnjutaProjectNode *node, GEr
 }
 
 gboolean
-anjuta_pm_project_remove_data (AnjutaPmProject *project, GbfTreeData *data, GError **error)
-{
-	GtkTreeIter iter;
-	
-	if (gbf_project_model_find_tree_data (project->model, &iter, data))
-	{
-		gbf_project_model_remove (project->model, &iter);
-
-		return TRUE;
-	}
-	else
-	{
-		return FALSE;
-	}
-}
-
-gboolean
 anjuta_pm_project_is_open (AnjutaPmProject *project)
 {
 	return project->project != NULL;
@@ -414,27 +376,6 @@ anjuta_pm_project_get_project (AnjutaPmProject *project)
 	return project->project;
 }
 
-GbfProjectModel *
-anjuta_pm_project_get_model (AnjutaPmProject *project)
-{
-	return project->model;
-}
-
-AnjutaProjectNode *
-anjuta_pm_project_get_node_from_file (AnjutaPmProject *project, AnjutaProjectNodeType type, GFile *file)
-{
-	GtkTreeIter iter;
-	AnjutaProjectNode *node = NULL;
-	
-	if (gbf_project_model_find_file (project->model, &iter, NULL, type, file))
-	{
-		
-		node = gbf_project_model_get_node (project->model, &iter);
-	}
-
-	return NULL;
-}
-
 static gboolean
 find_module (AnjutaProjectNode *node, gpointer data)
 {
@@ -517,7 +458,6 @@ G_DEFINE_TYPE (AnjutaPmProject, anjuta_pm_project, G_TYPE_OBJECT);
 static void
 anjuta_pm_project_init (AnjutaPmProject *project)
 {
-	project->model = gbf_project_model_new (NULL);
 	project->plugin = NULL;
 	project->loaded = FALSE;
 
@@ -527,10 +467,6 @@ anjuta_pm_project_init (AnjutaPmProject *project)
 static void
 anjuta_pm_project_finalize (GObject *object)
 {
-	AnjutaPmProject *project = ANJUTA_PM_PROJECT(object);
-	
-	g_object_unref (G_OBJECT (project->model));
-	
 	G_OBJECT_CLASS (anjuta_pm_project_parent_class)->finalize (object);
 }
 
@@ -555,26 +491,16 @@ anjuta_pm_project_class_init (AnjutaPmProjectClass *klass)
 	 AnjutaProjectNode object and then use a function
 	 in project-view.c to create the corresponding shortcut*/
 	
-	signals[UPDATED] = g_signal_new ("updated",
-	    G_OBJECT_CLASS_TYPE (object_class),
-	    G_SIGNAL_RUN_LAST,
-	    G_STRUCT_OFFSET (AnjutaPmProjectClass, updated),
-	    NULL, NULL,
-	    pm_cclosure_marshal_VOID__POINTER_BOXED,
-	    G_TYPE_NONE,
-	    2,
-	    G_TYPE_POINTER,
-	    G_TYPE_ERROR);
-	
 	signals[LOADED] = g_signal_new ("loaded",
 		G_OBJECT_CLASS_TYPE (object_class),
 		G_SIGNAL_RUN_LAST,
 		G_STRUCT_OFFSET (AnjutaPmProjectClass, loaded),
 		NULL, NULL,
-		pm_cclosure_marshal_VOID__POINTER_BOXED,
+		pm_cclosure_marshal_VOID__POINTER_BOOLEAN_BOXED,
 		G_TYPE_NONE,
-		2,
+		3,
 	    G_TYPE_POINTER,
+	    G_TYPE_BOOLEAN,
 		G_TYPE_ERROR);
 }
 
diff --git a/plugins/project-manager/project.h b/plugins/project-manager/project.h
index 386875a..61c7eea 100644
--- a/plugins/project-manager/project.h
+++ b/plugins/project-manager/project.h
@@ -47,8 +47,7 @@ struct _AnjutaPmProjectClass
 {
 	GObjectClass parent_class;
 
-	void (*updated) (GError *error);
-	void (*loaded) (GError *error);
+	void (*loaded) (AnjutaPmProject* project, AnjutaProjectNode *node, gboolean complete, GError *error);
 };
 
 struct _AnjutaPmProject
@@ -58,7 +57,6 @@ struct _AnjutaPmProject
 	AnjutaPlugin *plugin;
 	
 	IAnjutaProject *project;
-	GbfProjectModel *model;
 
 	AnjutaProjectNode *root;
 	
@@ -98,6 +96,7 @@ IAnjutaProject *anjuta_pm_project_get_project (AnjutaPmProject *project);
 GbfProjectModel *anjuta_pm_project_get_model (AnjutaPmProject *project);
 
 AnjutaProjectNode *anjuta_pm_project_get_node_from_file (AnjutaPmProject *project, AnjutaProjectNodeType type, GFile *file);
+AnjutaProjectNode *anjuta_pm_project_get_node_from_iter (AnjutaPmProject *project, GtkTreeIter *iter);
 AnjutaProjectNode *anjuta_pm_project_get_module (AnjutaPmProject *project, const gchar *name);
 
 gboolean anjuta_pm_project_show_properties_dialog (AnjutaPmProject *project, GbfTreeData *data);



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