[anjuta] Replace all URI to GFile* in the project manager interface



commit 9fbd3cdb63900b45fc4ef0d439a650e3f0cff9f4
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Mon Jan 18 22:33:56 2010 +0100

    Replace all URI to GFile* in the project manager interface

 libanjuta/anjuta-project.c                 |   26 ++
 libanjuta/anjuta-project.h                 |    1 +
 libanjuta/interfaces/libanjuta.idl         |  187 ++++++++-------
 plugins/build-basic-autotools/executer.c   |   17 +-
 plugins/class-gen/plugin.c                 |   44 +---
 plugins/debug-manager/start.c              |   14 +-
 plugins/file-wizard/file.c                 |   31 +--
 plugins/glade/plugin.c                     |   59 +++--
 plugins/project-manager/gbf-project-util.c |    4 +-
 plugins/project-manager/gbf-project-util.h |    2 +-
 plugins/project-manager/gbf-tree-data.c    |   34 ++-
 plugins/project-manager/gbf-tree-data.h    |    3 +-
 plugins/project-manager/plugin.c           |  362 ++++++++++++----------------
 plugins/run-program/parameters.c           |    8 +-
 plugins/search/search-replace_backend.c    |    7 +-
 plugins/symbol-db/plugin.c                 |   26 +--
 plugins/tools/variable.c                   |   10 +-
 17 files changed, 405 insertions(+), 430 deletions(-)
---
diff --git a/libanjuta/anjuta-project.c b/libanjuta/anjuta-project.c
index 30c8b0d..aa7c394 100644
--- a/libanjuta/anjuta-project.c
+++ b/libanjuta/anjuta-project.c
@@ -201,6 +201,32 @@ anjuta_project_node_get_uri (AnjutaProjectNode *node)
 	return uri;
 }
 
+GFile*
+anjuta_project_node_get_file (AnjutaProjectNode *node)
+{
+	AnjutaProjectGroup *parent;
+	GFile *file;
+	
+	switch (NODE_DATA (node)->type)
+	{
+	case ANJUTA_PROJECT_GROUP:
+		file = g_object_ref (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));
+		break;
+	case ANJUTA_PROJECT_SOURCE:
+		file = g_object_ref (SOURCE_DATA (node)->file);
+		break;
+	default:
+		file = NULL;
+		break;
+	}
+
+	return file;
+}
+
 /* Group access functions
  *---------------------------------------------------------------------------*/
 
diff --git a/libanjuta/anjuta-project.h b/libanjuta/anjuta-project.h
index 0cd9294..2776e6d 100644
--- a/libanjuta/anjuta-project.h
+++ b/libanjuta/anjuta-project.h
@@ -117,6 +117,7 @@ void anjuta_project_node_children_foreach (AnjutaProjectNode *node, AnjutaProjec
 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);
+GFile *anjuta_project_node_get_file (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);
diff --git a/libanjuta/interfaces/libanjuta.idl b/libanjuta/interfaces/libanjuta.idl
index f0fadea..ca0833e 100644
--- a/libanjuta/interfaces/libanjuta.idl
+++ b/libanjuta/interfaces/libanjuta.idl
@@ -3299,135 +3299,124 @@ interface IAnjutaProjectManager
 	/**
 	* IAnjutaProjectManager::element_added:
 	* @obj: Self
-	* @element_uri: fixme
+	* @element: A #GFile corrresponding to added element
 	* @err: Error propagation and reporting.
 	* 
 	* Emitted when a new element is added to the project. It can be
-	* a source, a target or a group. The URI does not always correspond
+	* a source, a target or a group. It does not always correspond
 	* to an existing file. This signal can be emitted several time for
 	* the same element.
 	*/
-	void ::element_added (const gchar *element_uri);
+	void ::element_added (GFile *element);
 	
 	/** 
 	* IAnjutaProjectManager::element_removed:
 	* @obj: Self
-	* @element_uri: fixme
+	* @element: A #GFile corresponding to removed element
 	* @err: Error propagation and reporting.
 	* 
-	* fixme
+	* Emitted when an element is removed from a project. It can be
+	* a source, a target or a group.
 	*/
-	void ::element_removed (const gchar *element_uri);
+	void ::element_removed (GFile *element);
 	
 	/**
 	* IAnjutaProjectManager::element_selected:
 	* @obj: Self
-	* @element_uri: fixme
+	* @element_uri: A #GFile corresponding to selected element
 	* @err: Error propagation and reporting.
 	* 
-	* fixme
+	* Emitted when an element is selected in the project view. It
+	* can be a source, a target or a group.
 	*/
-	void ::element_selected (const gchar *element_uri);
+	void ::element_selected (GFile *element);
 	
 	// Methods
 	
 	/**
-	* ianjuta_project_manager_get_element_type:
-	* @obj: Self
-	* @element_uri: fixme
-	* @err: Error propagation and reporting.
-	* 
-	* fixme
-	*
-	* Returns: fixme
-	*/
-	AnjutaProjectNodeType get_element_type (const gchar *element_uri);
-	
-	/**
 	* ianjuta_project_manager_get_elements:
 	* @obj: Self
-	* @element_type: fixme
+	* @element_type: Select one element type: source, group or target
 	* @err: Error propagation and reporting.
 	* 
-	* fixme
+	* Get a list of all elements of this type in the project.
 	* 
-	* Returns: fixme
+	* Returns: Get list of #GFile corresponding to all valid elements or %NULL if
+	* there are no elements of this type. Free the returned list with
+	* g_list_free() and the files with g_object_unref().
 	*/
-	List<const gchar*> get_elements (AnjutaProjectNodeType element_type);
+	List<GFile *> get_elements (AnjutaProjectNodeType element_type);
 	
 	/**
 	* ianjuta_project_manager_get_target_type:
 	* @obj: Self
-	* @target_uri: fixme
+	* @target: A #GFile corresponding to a target
 	* @err: Error propagation and reporting.
 	* 
-	* fixme
+	* Get the type of the corresponding target: program, library...
 	* 
-	* Returns: fixme
+	* Returns: Return the type of the target.
 	*/
-	AnjutaProjectTargetClass get_target_type (const gchar *target_uri);
+	AnjutaProjectTargetClass get_target_type (GFile *target);
 	
 	/**
 	* ianjuta_project_manager_get_targets:
 	* @obj: Self
-	* @target_type: fixme
+	* @target_type: type of the target
 	* @err: Error propagation and reporting.
 	* 
-	* fixme
+	* Get a list of targets in the project with the corresponding type.
 	* 
-	* Returns: fixme
+	* Returns: A list of #GFile corresponding to each target of the requested
+	* type or %NULL if none exists. Free the returned list with g_list_free()
+	* and the files with g_object_unref().
 	*/
-	List<const gchar*> get_targets (AnjutaProjectTargetClass target_type);
+	List<GFile *> get_targets (AnjutaProjectTargetClass target_type);
 	
 	/**
 	* ianjuta_project_manager_get_parent:
 	* @obj: Self
-	* @element_uri: fixme
+	* @element: A #GFile corresponding to one child.
 	* @err: Error propagation and reporting.
 	* 
-	* fixme
+	* Gets the parent of the corresponding child.
 	*
-	* Returns: fixme
+	* Returns: The parent of the child, or %NULL if the element is the root.
 	*/
-	gchar* get_parent (const gchar *element_uri);
+	GFile* get_parent (GFile *element);
 	
 	/**
 	* ianjuta_project_manager_get_children:
 	* @obj: Self
-	* @element_uri: fixme
+	* @element: A #GFile corresponding to a parent.
 	* @err: Error propagation and reporting.
 	* 
-	* fixme
+	* Gets the list of all children of the corresponding parent.
 	*
-	* Returns: fixme
-	*/
-	List<const gchar*> get_children (const gchar *element_uri);
-	
-	/**
-	* ianjuta_project_manager_get_selected:
-	* @obj: Self
-	* @err: Error propagation and reporting.
-	* 
-	* fixme
+	* Returns: The list of #GFile corresponding to each child of the element or
+	* %NULL if the element has no child. Free the returned list with g_list_free()
+	* and the files with g_object_unref().
 	*/
-	gchar* get_selected ();
+	List<GFile*> get_children (GFile *element);
 	
 	/**
 	* ianjuta_project_manager_get_selected:
 	* @obj: Self
-	* @element_type: fixme
 	* @err: Error propagation and reporting.
 	* 
-	* fixme
+	* Gets the currently selected element in the project manager view.
+	*
+	* Returns: A #GFile corresponding to the selected element in the project
+	* view. You own the returned file; use g_object_unref() to release it.
 	*/
-	gchar* get_selected_id (AnjutaProjectNodeType element_type);
+	GFile* get_selected ();
 	
 	/**
 	* ianjuta_project_manager_get_capabilities:
 	* @obj: Self
 	* @err: Error propagation and reporting.
 	*
-	* Returns the capabilites of project whether it can add group, target
+	* Gets the capabilites of project whether it can add group, target
 	* sources etc.
 	*
 	* Returns: Supported capabilites.
@@ -3436,85 +3425,107 @@ interface IAnjutaProjectManager
 
 	/**
 	* ianjuta_project_manager_add_source:
-	* @obj: Self
-	* @source_uri_to_add: Target name or uri
-	* @default_location_uri: Default source location or NULL if don't care
+	* @obj: Self.
+	* @name: Source name or URI.
+	* @default_target: A #GFile corresponding to the default target or group or
+	*					%NULL if you don't care.
 	* @err: Error propagation and reporting.
 	*
-	* Prompt the user to add a file to the project. If the user selects
-	* multiple files only the first uri is returned.
+	* Prompts the user to add a file to the project. If the user selects
+	* multiple files only the first source file is returned.
+	*
+	* You can add non existing file. In this case the element_added
+	* signal will be emitted with a non existing file. So it is
+	* up to the caller to reemit this signal later when the file
+	* is created.
 	*
-	* Returns: element URIs. Must be freed when no longer required.
+	* Returns: A #GFile corresponding to the new source file in the project
+	* view. You own the returned file; use g_object_unref() to release it.
 	*/
-	gchar* add_source (const gchar *source_uri_to_add, const gchar *default_location_uri);
+	GFile* add_source (const gchar *name, GFile *default_target);
 
 	/**
 	* ianjuta_project_manager_add_source_quiet:
-	* @obj: Self
-	* @source_uri_to_add: fixme
-	* @target_id: fixme
+	* @obj: Self.
+	* @name: Source name or URI.
+	* @target: A #GFile corresponding to the parent target or group.
 	* @err: Error propagation and reporting.
 	*
-	* Add a file to the project without prompting the user.
+	* Adds a file to the project without prompting the user.
 	*
-	* Returns: element ID. Must be freed when no longer required.
+	* You can add non existing file. In this case the element_added
+	* signal will be emitted with a non existing file. So it is
+	* up to the caller to reemit this signal later when the file
+	* is created.
+	*
+	* Returns: A #GFile corresponding to the new source file in the project
+	* view. You own the returned file; use g_object_unref() to release it.
 	*/
-	gchar* add_source_quiet (const gchar *source_uri_to_add, const gchar *target_uri);
+	GFile* add_source_quiet (const gchar *name, GFile *target);
 	
 	/**
 	* ianjuta_project_manager_add_sources:
-	* @obj: Self
-	* @source_uris_to_add: sources URI to add
-	* @default_location_uri: fixme
+	* @obj: Self.
+	* @names: Sources name or URI to add.
+	* @default_target: A #GFile corresponding to the default target or group or
+	*					%NULL if don't care.
 	* @err: Error propagation and reporting.
 	*
-	* Prompt the user to add a file to the project. Depending on the 
+	* Prompts the user to add several files to the project. Depending on the 
 	* project backend, it can be possible that the source files must
-	* be located in a particular directory. You can pass to this
-	* function relative URI and it will return absolute URI valid
-	* for the target selected by the user.
+	* be located in a particular directory.
 	*
 	* You can add non existing file. In this case the element_added
 	* signal will be emitted with a non existing file. So it is
 	* up to the caller to reemit this signal later when the file
 	* is created.
 	*
-	* Returns: absolute element URIs. Must be freed when no longer required.
+	* Returns: A list of #GFile corresponding to all new source files added
+	* in the project. You own the list with the the returned files; use
+	* g_list_free() and g_object_unref() on each file to release them.
 	*/
-	List<const gchar*> add_sources (List<const gchar*> source_uris_to_add, const gchar *default_location_uri);
+	List<GFile*> add_sources (List<const gchar*> names, GFile *default_target);
 	
 	/**
 	* ianjuta_project_manager_add_target:
 	* @obj: Self
-	* @target_name_to_add: fixme
-	* @default_location_uri: fixme
+	* @name: Target name or URI.
+	* @default_group: A #GFile corresponding to the default parent group or
+	*					%NULL if don't care.
 	* @err: Error propagation and reporting.
 	* 
-	* fixme
+	* Prompts the user to add a new target to the project. The user can select
+	* a parent group different from the one set as default.
 	* 
-	* Returns:
+	* Returns: A #GFile corresponding to the new target added in the project.
+	* You own the returned file; use g_object_unref() to release it.
 	*/
-	gchar* add_target (const gchar *target_name_to_add, const gchar *default_location_uri);
+	GFile* add_target (const gchar *name, GFile *default_group);
 	
 	/**
 	* ianjuta_project_manager_add_group:
-	* @obj: Self
-	* @group_name_to_add: fixme
-	* @default_location_uri: fixme
+	* @obj: Self.
+	* @name: Group name or URI.
+	* @default_group: A #GFile corresponding to the default parent group or
+	*					%NULL if don't care.
 	* @err: Error propagation and reporting.
 	* 
-	* fixme
+	* Prompts the user to add a new group to the project. The user can select
+	* a parent group different from the one set as default.
 	* 
-	* Returns: fixme
+	* Returns: A #GFile corresponding to the new group added in the project.
+	* You own the returned file; use g_object_unref() to release it.
 	*/
-	gchar* add_group (const gchar *group_name_to_add, const gchar *default_location_uri);
+	GFile* add_group (const gchar *name, GFile *default_group);
 	
 	/**
 	* ianjuta_project_manager_is_open:
 	* @obj: Self
 	* @err: Error propagation and reporting.
 	* 
-	* fixme
+	* Gets whether a project is currently opened.
+	*
+	* Returns: %TRUE if a project is opened.
 	*/ 
 	gboolean is_open ();
 	
diff --git a/plugins/build-basic-autotools/executer.c b/plugins/build-basic-autotools/executer.c
index 87bbcd2..14f569e 100644
--- a/plugins/build-basic-autotools/executer.c
+++ b/plugins/build-basic-autotools/executer.c
@@ -112,12 +112,13 @@ get_program_parameters (BasicAutotoolsPlugin *plugin,
 		while (node)
 		{
 			gchar *local_path;
+            gchar *uri;
 			const gchar *rel_path;
-		
-			local_path = anjuta_util_get_local_path_from_uri ((gchar *)node->data);
+
+			local_path = g_file_get_path ((GFile *)node->data);
 			if (local_path == NULL)
 			{
-				g_free (node->data);
+				g_object_unref (node->data);
 				node = g_list_next (node);
 				continue;
 			}
@@ -126,11 +127,12 @@ get_program_parameters (BasicAutotoolsPlugin *plugin,
 				(gchar*)local_path +
 				 strlen (plugin->project_root_dir) + 1;
 			
+            uri = g_file_get_uri ((GFile *)node->data);
 			gtk_list_store_append (store, &iter);
 			gtk_list_store_set (store, &iter, 0, rel_path, 1,
-								node->data, -1);
+								uri, -1);
       
-      if (plugin->last_exec_uri && g_str_equal (plugin->last_exec_uri, node->data))
+      if (plugin->last_exec_uri && g_str_equal (plugin->last_exec_uri, uri))
       { 
 				GtkTreePath* path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter);
         gtk_tree_selection_select_iter (selection, &iter);
@@ -141,9 +143,10 @@ get_program_parameters (BasicAutotoolsPlugin *plugin,
         g_free (plugin->last_exec_uri);
         plugin->last_exec_uri = NULL;
       }
-      
+
+            g_free (uri);
 			g_free (local_path);
-			g_free (node->data);
+			g_object_unref (node->data);
 			node = g_list_next (node);
 		}
 		g_list_free (exec_targets);
diff --git a/plugins/class-gen/plugin.c b/plugins/class-gen/plugin.c
index 9178c4b..a02bd22 100644
--- a/plugins/class-gen/plugin.c
+++ b/plugins/class-gen/plugin.c
@@ -178,7 +178,7 @@ cg_plugin_add_to_project (AnjutaClassGenPlugin *plugin,
 	IAnjutaProjectManager *manager;
 	GList *filenames;
 	GList *added_files;
-	GList *node;
+	GFile *file;
 	gboolean result;
 
 	manager = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
@@ -187,35 +187,24 @@ cg_plugin_add_to_project (AnjutaClassGenPlugin *plugin,
 	if (manager == NULL) 
 		return FALSE;
 
-	filenames = NULL;
-	filenames = g_list_append (filenames, g_path_get_basename (header_file));
+	filenames = g_list_append (NULL, g_path_get_basename (header_file));
 	filenames = g_list_append (filenames, g_path_get_basename (source_file));
+	file = g_file_new_for_path (plugin->top_dir);
 	added_files = ianjuta_project_manager_add_sources (manager, filenames,
-	                                                   plugin->top_dir, NULL);
-	if (g_list_length (added_files) != 2)
-	{
-		for (node = added_files; node != NULL; node = g_list_next (node))
-			g_free (node->data);
+	                                                   file, NULL);
+	g_object_unref (file);
+	g_list_foreach (filenames, (GFunc)g_free, NULL);
+	g_list_free (filenames);
 
-		result = FALSE;
-	}
-	else
+	result = g_list_length (added_files) == 2;
+	if (result)
 	{
-		GFile *file;
-
-		file = g_file_new_for_uri ((gchar *)added_files->data);
-		*new_header_file = g_file_get_path(file);
-		g_object_unref (file);
-		file = g_file_new_for_uri ((gchar *)g_list_next (added_files)->data);
-		*new_source_file = g_file_get_path(file);
-		g_object_unref (file);
-		
-		result = TRUE;
+		*new_header_file = g_file_get_path((GFile *)added_files->data);
+		*new_source_file = g_file_get_path((GFile *)g_list_next (added_files)->data);
 	}
 
-	g_list_foreach (added_files, (GFunc)g_free, NULL);
+	g_list_foreach (added_files, (GFunc)g_object_unref, NULL);
 	g_list_free (added_files);
-	g_list_free (filenames);
 
 	return result;
 }
@@ -326,13 +315,8 @@ cg_plugin_generator_created_cb (CgGenerator *generator,
 		manager = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell, IAnjutaProjectManager, NULL);
 		if (manager)
 		{
-			gchar *huri = g_file_get_uri (header);
-			gchar *suri = g_file_get_uri (source);
-
-			g_signal_emit_by_name (G_OBJECT (manager), "element_added", huri);
-			g_signal_emit_by_name (G_OBJECT (manager), "element_added", suri);
-			g_free (huri);
-			g_free (suri);
+			g_signal_emit_by_name (G_OBJECT (manager), "element_added", header);
+			g_signal_emit_by_name (G_OBJECT (manager), "element_added", source);
 		}
 
 		g_object_unref (header);
diff --git a/plugins/debug-manager/start.c b/plugins/debug-manager/start.c
index 542f80e..e6a8775 100644
--- a/plugins/debug-manager/start.c
+++ b/plugins/debug-manager/start.c
@@ -223,18 +223,20 @@ get_source_directories (AnjutaPlugin *plugin)
 	node = slibs_dirs;
 	while (node)
 	{
-		gchar *dir_uri;
-		dir_uri = g_path_get_dirname (node->data);
-		search_dirs = g_list_prepend (search_dirs, dir_uri);
+		gchar *path;
+		GFile *parent = g_file_get_parent (node->data);
+		path = g_file_get_uri (parent);
+		g_object_unref (parent);
+		search_dirs = g_list_prepend (search_dirs, path);
 		node = g_list_next (node);
 	}
 	
 	node = libs_dirs;
 	while (node)
 	{
-		gchar *dir_uri;
-		dir_uri = g_path_get_dirname (node->data);
-		search_dirs = g_list_prepend (search_dirs, dir_uri);
+		gchar *path;
+		path = g_file_get_path (node->data);
+		search_dirs = g_list_prepend (search_dirs, path);
 		node = g_list_next (node);
 	}
 	
diff --git a/plugins/file-wizard/file.c b/plugins/file-wizard/file.c
index 98c9294..1fbf6d3 100644
--- a/plugins/file-wizard/file.c
+++ b/plugins/file-wizard/file.c
@@ -336,9 +336,8 @@ on_new_file_okbutton_clicked(GtkWidget *window, GdkEvent *event,
 		gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (nfg->add_to_project)))
 	{
 		IAnjutaProjectManager *pm;
-		GFile* file;
 		GList *names = NULL;
-		GList *uri_list;
+		GList *file_list;
 		
 		pm = anjuta_shell_get_interface (ANJUTA_PLUGIN(docman)->shell, 
 										 IAnjutaProjectManager, NULL);
@@ -346,24 +345,20 @@ on_new_file_okbutton_clicked(GtkWidget *window, GdkEvent *event,
 
 		if (teh) names = g_list_prepend (names, header_name);
 		names = g_list_prepend (names, (gpointer) name);
-		uri_list = ianjuta_project_manager_add_sources (pm, names, NULL, NULL);
+		file_list = ianjuta_project_manager_add_sources (pm, names, NULL, NULL);
 		g_list_free (names);
 		
-		if (uri_list)
+		if (file_list)
 		{
 			GList* node;
 
 			/* Save main file */
-			file = g_file_new_for_uri ((const gchar *)uri_list->data);
-			ianjuta_file_savable_save_as (IANJUTA_FILE_SAVABLE (te), file, NULL);		
-			g_object_unref (file);
+			ianjuta_file_savable_save_as (IANJUTA_FILE_SAVABLE (te), (GFile *)file_list->data, NULL);		
 			
-			if (uri_list->next)
+			if (file_list->next)
 			{
 				/* Save header file */
-				file = g_file_new_for_uri ((const gchar *)uri_list->next->data);
-				ianjuta_file_savable_save_as (IANJUTA_FILE_SAVABLE (teh), file, NULL);		
-				g_object_unref (file);
+				ianjuta_file_savable_save_as (IANJUTA_FILE_SAVABLE (teh), (GFile *)file_list->data, NULL);		
 			}		
 
 
@@ -374,25 +369,19 @@ on_new_file_okbutton_clicked(GtkWidget *window, GdkEvent *event,
 										 IAnjutaVcs, NULL);
 				if (ivcs)
 				{					
-					GList* files = NULL;
 					AnjutaAsyncNotify* notify = anjuta_async_notify_new();
-					for (node = uri_list; node != NULL; node = g_list_next (node))
-					{
-						files = g_list_append (files, g_file_new_for_uri (node->data));
-					}
-					ianjuta_vcs_add (ivcs, files, notify, NULL);
-					g_list_foreach (files, (GFunc) g_object_unref, NULL);
+					ianjuta_vcs_add (ivcs, file_list, notify, NULL);
 				}
 			}
 
 			/* Re emit element_added for symbol-db */
-			for (node = uri_list; node != NULL; node = g_list_next (node))
+			for (node = file_list; node != NULL; node = g_list_next (node))
 			{
 				g_signal_emit_by_name (G_OBJECT (pm), "element_added", node->data);
 			}
 
-			g_list_foreach (uri_list, (GFunc)g_free, NULL);
-			g_list_free (uri_list);
+			g_list_foreach (file_list, (GFunc)g_object_unref, NULL);
+			g_list_free (file_list);
 		}
 		else
 		{
diff --git a/plugins/glade/plugin.c b/plugins/glade/plugin.c
index c696ae6..50c02f9 100644
--- a/plugins/glade/plugin.c
+++ b/plugins/glade/plugin.c
@@ -105,7 +105,7 @@ struct _GladePluginPriv
 
 	gboolean insert_handler_on_edit;
 	gint default_handler_template;
-	gchar *default_resource_target;
+	GFile *default_resource_target;
 	gboolean auto_add_resource;
 
 	GFile *last_editor;
@@ -308,18 +308,16 @@ value_added_pm_current_uri (AnjutaPlugin *plugin, const char *name,
 {
 	AnjutaUI *ui;
 	GtkAction *action;
-	gchar *selected_id;
+	GFile *selected;
 	IAnjutaProjectManager *projman =
 		anjuta_shell_get_interface (ANJUTA_PLUGIN(plugin)->shell,
 		                            IAnjutaProjectManager, NULL);
 
 	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,
-	                                                       ANJUTA_PROJECT_TARGET,
-	                                                       NULL);
-	gtk_action_set_sensitive (action, selected_id != NULL);
-	g_free (selected_id);
+	selected = ianjuta_project_manager_get_selected (projman, NULL);
+	gtk_action_set_sensitive (action, selected != NULL);
+	g_object_unref (selected);
 }
 
 static void
@@ -831,15 +829,17 @@ glade_plugin_save_preferences (GladePlugin *plugin, xmlDocPtr xml_doc, xmlNodePt
 	            BAD_CAST (value));
 	g_free (value);
 
+	value = g_file_get_uri (plugin->priv->default_resource_target);
 	xmlSetProp (child_node, BAD_CAST (GLADE_DEFAULT_RESOURCE_TARGET),
-	            BAD_CAST (plugin->priv->default_resource_target));
+	            BAD_CAST (value));
+	g_free (value);
 }
 
 static void
 on_associations_changed (DesignerAssociations *self, DesignerAssociationsItem *item,
                          DesignerAssociationsAction action, GladePlugin *plugin);
 static void
-on_default_resource_target_changed (const gchar *selected, GladePlugin *plugin);
+on_default_resource_target_changed (GFile *selected, GladePlugin *plugin);
 
 static gboolean
 glade_plugin_do_save_associations (GladePlugin *plugin, GError **error)
@@ -978,9 +978,8 @@ glade_plugin_load_preferences (GladePlugin *plugin, xmlDocPtr xml_doc, xmlNodePt
 		xmlFree (value);
 	}
 
-	plugin->priv->default_resource_target =
-		claim_xml_string (xmlGetProp (child_node,
-		                              BAD_CAST (GLADE_DEFAULT_RESOURCE_TARGET)));
+	value = (gchar *)xmlGetProp (child_node, BAD_CAST (GLADE_DEFAULT_RESOURCE_TARGET));
+	plugin->priv->default_resource_target = g_file_new_for_uri (value);
 
 	update_actions (plugin);
 	update_prefs_page (plugin);
@@ -1144,8 +1143,8 @@ on_glade_resource_added (GladeProject *project, const gchar *resource,
 	DEBUG_PRINT ("Adding resource \"%s\" to the target \"%s\"",
 	              resource_uri, plugin->priv->default_resource_target);
 	str = ianjuta_project_manager_add_source_quiet (projman,
-	                                                plugin->priv->default_resource_target,
 	                                                resource_uri,
+	                                                plugin->priv->default_resource_target,
 	                                                &error);
 	if (error)
 	{
@@ -3854,28 +3853,27 @@ glade_plugin_add_project (GladePlugin *glade_plugin, GladeProject *project,
 }
 
 static void
-set_default_resource_target (const gchar *value, GladePlugin* plugin)
+set_default_resource_target (GFile *value, GladePlugin* plugin)
 {
-	g_free (plugin->priv->default_resource_target);
-	if (!value || strlen (value) == 0)
+	g_object_unref (plugin->priv->default_resource_target);
+	if (value == NULL)
 		plugin->priv->default_resource_target = NULL;
 	else
-		plugin->priv->default_resource_target = g_strdup (value);
+		plugin->priv->default_resource_target = g_object_ref (value);
 	on_default_resource_target_changed (value, plugin);
 }
 
 static void
 on_set_default_resource_target (GtkAction* action, GladePlugin* plugin)
 {
-	gchar *selected;
+	GFile *selected;
 	IAnjutaProjectManager *projman =
 		anjuta_shell_get_interface (ANJUTA_PLUGIN(plugin)->shell,
 		                            IAnjutaProjectManager, NULL);
 
-	selected = ianjuta_project_manager_get_selected_id (projman, ANJUTA_PROJECT_TARGET, NULL);
-	DEBUG_PRINT ("Selected element is %s", selected);
+	selected = ianjuta_project_manager_get_selected (projman, NULL);
 	set_default_resource_target (selected, plugin);
-	g_free (selected);
+	g_object_unref (selected);
 }
 
 #if 0
@@ -4609,7 +4607,7 @@ deactivate_plugin (AnjutaPlugin *plugin)
 		g_object_unref (priv->last_editor);
 		priv->last_editor = NULL;
 	}
-	g_free (priv->default_resource_target);
+	g_object_unref (priv->default_resource_target);
 	priv->default_resource_target = NULL;
 
 	if (priv->xml)
@@ -4985,10 +4983,13 @@ on_preferences_default_resource_entry_focus_out (GtkWidget *entry,
                                                  GladePlugin *plugin)
 {
 	const gchar *value;
+	GFile *file;
 
 	g_return_val_if_fail (plugin->priv->prefs, FALSE);
 	value = gtk_entry_get_text (GTK_ENTRY(entry));
-	set_default_resource_target (value, plugin);
+	file = g_file_new_for_commandline_arg (value);
+	set_default_resource_target (file, plugin);
+	g_object_unref (file);
 
 	return FALSE;
 }
@@ -4997,24 +4998,30 @@ void
 on_preferences_default_resource_entry_activate (GtkEntry *entry, GladePlugin *plugin)
 {
 	const gchar *value;
+	GFile *file;
 
 	g_return_if_fail (plugin->priv->prefs);
 
 	value = gtk_entry_get_text (entry);
-	set_default_resource_target (value, plugin);
+	file = g_file_new_for_commandline_arg (value);
+	set_default_resource_target (file, plugin);
+	g_object_unref (file);
 }
 
 static void
-on_default_resource_target_changed (const gchar *value, GladePlugin *plugin)
+on_default_resource_target_changed (GFile *file, GladePlugin *plugin)
 {
 	GtkEntry *entry;
+	gchar *value;
 
 	if (!plugin->priv->prefs)
 		return;
 
 	entry = GTK_ENTRY(gtk_builder_get_object (plugin->priv->xml,
 	                                          DEFAULT_RESOURCE_ENTRY_NAME));
-	gtk_entry_set_text (entry, value ? value : "");
+	value = g_file_get_path (file);
+	gtk_entry_set_text (entry, value != NULL ? value : "");
+	g_free (value);
 }
 
 static void
diff --git a/plugins/project-manager/gbf-project-util.c b/plugins/project-manager/gbf-project-util.c
index 84ee0db..078f092 100644
--- a/plugins/project-manager/gbf-project-util.c
+++ b/plugins/project-manager/gbf-project-util.c
@@ -812,7 +812,7 @@ gbf_project_util_node_all (AnjutaProjectNode *parent, AnjutaProjectNodeType type
 }
 
 GList *
-gbf_project_util_replace_by_uri (GList* list)
+gbf_project_util_replace_by_file (GList* list)
 {
         GList* link;
     
@@ -820,7 +820,7 @@ gbf_project_util_replace_by_uri (GList* list)
 	{
                 AnjutaProjectNode *node = (AnjutaProjectNode *)link->data;
 
-                link->data = anjuta_project_node_get_uri (node);
+                link->data = anjuta_project_node_get_file (node);
 	}
 
         return list;
diff --git a/plugins/project-manager/gbf-project-util.h b/plugins/project-manager/gbf-project-util.h
index d1250f7..bb929b9 100644
--- a/plugins/project-manager/gbf-project-util.h
+++ b/plugins/project-manager/gbf-project-util.h
@@ -56,7 +56,7 @@ GList * gbf_project_util_all_child (AnjutaProjectNode *parent,
 GList * gbf_project_util_node_all (AnjutaProjectNode *parent,
                                         AnjutaProjectNodeType type);
 
-GList * gbf_project_util_replace_by_uri (GList* list);
+GList * gbf_project_util_replace_by_file (GList* list);
 				    
 G_END_DECLS
 
diff --git a/plugins/project-manager/gbf-tree-data.c b/plugins/project-manager/gbf-tree-data.c
index df2fb4c..70d864f 100644
--- a/plugins/project-manager/gbf-tree-data.c
+++ b/plugins/project-manager/gbf-tree-data.c
@@ -111,6 +111,29 @@ gbf_tree_data_get_uri (GbfTreeData *data)
 	return NULL;
 }
 
+GFile *
+gbf_tree_data_get_file (GbfTreeData *data)
+{
+	if (data->source != NULL)
+	{
+		return g_object_ref (g_file_get_uri (data->source));
+	}
+	else if (data->target != NULL)
+	{
+		GFile *target;
+
+		target = g_file_get_child (data->group, data->target);
+		
+		return target;
+	}
+	else if (data->group != NULL)
+	{
+		return g_object_ref (g_file_get_uri (data->group));
+	}
+
+	return NULL;
+}
+
 gchar *
 gbf_tree_data_get_path (GbfTreeData *data)
 {
@@ -279,36 +302,31 @@ gbf_tree_data_new_for_path (const gchar *path)
 }
 
 GbfTreeData *
-gbf_tree_data_new_for_uri (const gchar *uri, GbfTreeNodeType type)
+gbf_tree_data_new_for_file (GFile *file, GbfTreeNodeType type)
 {
 	GbfTreeData *data = g_slice_new0 (GbfTreeData);
 	GFileInfo *ginfo;
-	GFile *file;
 
 	data->type = type;
 
-	file = g_file_new_for_uri (uri);
-	
 	switch (type)
 	{
 	case GBF_TREE_NODE_UNKNOWN:
 	case GBF_TREE_NODE_SHORTCUT:
 	case GBF_TREE_NODE_GROUP:
-		data->group = file;
+		data->group = g_object_ref (file);
 		break;
 	case GBF_TREE_NODE_TARGET:
 		data->group = g_file_get_parent (file);
 		data->target = g_file_get_basename (file);
-		g_object_unref (file);
 		file = NULL;
 		data->name = g_strdup (data->target);
 		break;
 	case GBF_TREE_NODE_SOURCE:
-		data->source = file;
+		data->source = g_object_ref (file);
 		break;
 	case GBF_TREE_NODE_STRING:
 		data->name = g_file_get_parse_name (file);
-		g_object_unref (file);
 		file = NULL;
 		break;
 	}
diff --git a/plugins/project-manager/gbf-tree-data.h b/plugins/project-manager/gbf-tree-data.h
index b2e244e..0354154 100644
--- a/plugins/project-manager/gbf-tree-data.h
+++ b/plugins/project-manager/gbf-tree-data.h
@@ -56,6 +56,7 @@ AnjutaProjectNode *gbf_tree_data_get_node	    (GbfTreeData		 *data,
                                                  IAnjutaProject     *project);
 
 gchar	      *gbf_tree_data_get_uri		    (GbfTreeData          *data);
+GFile	      *gbf_tree_data_get_file		    (GbfTreeData          *data);
 
 gchar		  *gbf_tree_data_get_path		    (GbfTreeData          *data);
 
@@ -63,7 +64,7 @@ gboolean       gbf_tree_data_equal              (GbfTreeData          *data_a,
                                                  GbfTreeData          *data_b);
 
 GbfTreeData   *gbf_tree_data_new_for_path       (const gchar          *data);
-GbfTreeData   *gbf_tree_data_new_for_uri        (const gchar          *uri,
+GbfTreeData   *gbf_tree_data_new_for_file       (GFile                *file,
                                                  GbfTreeNodeType      type);
 GbfTreeData   *gbf_tree_data_new_string         (const gchar          *string);
 GbfTreeData   *gbf_tree_data_new_shortcut       (GbfTreeData		  *src);
diff --git a/plugins/project-manager/plugin.c b/plugins/project-manager/plugin.c
index 12f713b..aa3124b 100644
--- a/plugins/project-manager/plugin.c
+++ b/plugins/project-manager/plugin.c
@@ -61,8 +61,8 @@ struct _PmPropertiesDialogInfo
 
 static gpointer parent_class;
 
-static gboolean uri_is_inside_project (ProjectManagerPlugin *plugin,
-									   const gchar *uri);
+static gboolean file_is_inside_project (ProjectManagerPlugin *plugin,
+									   GFile *uri);
 static void project_manager_plugin_close (ProjectManagerPlugin *plugin);
 
 static GtkWindow*
@@ -232,13 +232,13 @@ on_close_project (GtkAction *action, ProjectManagerPlugin *plugin)
 }
 
 static GList *
-find_missing_uris (GList *pre, GList *post)
+find_missing_files (GList *pre, GList *post)
 {
 	GHashTable *hash;
 	GList *ret = NULL;
 	GList *node;
 	
-	hash = g_hash_table_new (g_str_hash, g_str_equal);
+	hash = g_hash_table_new (g_file_hash, g_file_equal);
 	node = pre;
 	while (node)
 	{
@@ -261,10 +261,10 @@ static void
 update_operation_emit_signals (ProjectManagerPlugin *plugin, GList *pre,
 							   GList *post)
 {
-	GList *missing_uris, *node;
+	GList *missing_files, *node;
 	
-	missing_uris = find_missing_uris (pre, post);
-	node = missing_uris;
+	missing_files = find_missing_files (pre, post);
+	node = missing_files;
 	while (node)
 	{
 		DEBUG_PRINT ("URI added emitting: %s", (char*)node->data);
@@ -272,10 +272,10 @@ update_operation_emit_signals (ProjectManagerPlugin *plugin, GList *pre,
 							   node->data);
 		node = g_list_next (node);
 	}
-	g_list_free (missing_uris);
+	g_list_free (missing_files);
 	
-	missing_uris = find_missing_uris (post, pre);
-	node = missing_uris;
+	missing_files = find_missing_files (post, pre);
+	node = missing_files;
 	while (node)
 	{
 		DEBUG_PRINT ("URI removed emitting: %s", (char*)node->data);
@@ -283,7 +283,7 @@ update_operation_emit_signals (ProjectManagerPlugin *plugin, GList *pre,
 							   node->data);
 		node = g_list_next (node);
 	}
-	g_list_free (missing_uris);
+	g_list_free (missing_files);
 }
 
 static void
@@ -301,7 +301,7 @@ update_operation_end (ProjectManagerPlugin *plugin, gboolean emit_signal)
 										   post_update_sources);
 			if (post_update_sources)
 			{
-				g_list_foreach (post_update_sources, (GFunc)g_free, NULL);
+				g_list_foreach (post_update_sources, (GFunc)g_object_unref, NULL);
 				g_list_free (post_update_sources);
 			}
 		}
@@ -315,7 +315,7 @@ update_operation_end (ProjectManagerPlugin *plugin, gboolean emit_signal)
 										   post_update_targets);
 			if (post_update_targets)
 			{
-				g_list_foreach (post_update_targets, (GFunc)g_free, NULL);
+				g_list_foreach (post_update_targets, (GFunc)g_object_unref, NULL);
 				g_list_free (post_update_targets);
 			}
 		}
@@ -329,26 +329,26 @@ update_operation_end (ProjectManagerPlugin *plugin, gboolean emit_signal)
 										   post_update_groups);
 			if (post_update_groups)
 			{
-				g_list_foreach (post_update_groups, (GFunc)g_free, NULL);
+				g_list_foreach (post_update_groups, (GFunc)g_object_unref, NULL);
 				g_list_free (post_update_groups);
 			}
 		}
 	}
 	if (plugin->pre_update_sources)
 	{
-		g_list_foreach (plugin->pre_update_sources, (GFunc)g_free, NULL);
+		g_list_foreach (plugin->pre_update_sources, (GFunc)g_object_unref, NULL);
 		g_list_free (plugin->pre_update_sources);
 		plugin->pre_update_sources = NULL;
 	}
 	if (plugin->pre_update_targets)
 	{
-		g_list_foreach (plugin->pre_update_targets, (GFunc)g_free, NULL);
+		g_list_foreach (plugin->pre_update_targets, (GFunc)g_object_unref, NULL);
 		g_list_free (plugin->pre_update_targets);
 		plugin->pre_update_targets = NULL;
 	}
 	if (plugin->pre_update_groups)
 	{
-		g_list_foreach (plugin->pre_update_groups, (GFunc)g_free, NULL);
+		g_list_foreach (plugin->pre_update_groups, (GFunc)g_object_unref, NULL);
 		g_list_free (plugin->pre_update_groups);
 		plugin->pre_update_groups = NULL;
 	}
@@ -539,57 +539,65 @@ on_properties (GtkAction *action, ProjectManagerPlugin *plugin)
 static void
 on_add_group (GtkAction *action, ProjectManagerPlugin *plugin)
 {
-	gchar *group_uri, *default_group_uri = NULL;
+	GFile *group;
+	GFile *default_group = NULL;
+	
 	if (plugin->current_editor_uri)
-		default_group_uri = g_path_get_dirname (plugin->current_editor_uri);
-	else
-		default_group_uri = g_strdup ("");
-	group_uri =
+	{
+		gchar *path = g_path_get_dirname (plugin->current_editor_uri);
+		default_group = g_file_new_for_path (path);
+		g_free (path);
+	}
+	
+	group =
 		ianjuta_project_manager_add_group (IANJUTA_PROJECT_MANAGER (plugin),
-										   "", default_group_uri,
+										   "", default_group,
 										   NULL);
-	g_free (group_uri);
-	g_free (default_group_uri);
+	g_object_unref (group);
+	g_object_unref (default_group);
 }
 
 static void
 on_add_target (GtkAction *action, ProjectManagerPlugin *plugin)
 {
-	gchar *target_uri, *default_group_uri = NULL;
+	GFile *target;
+	GFile *default_group = NULL;
+	
 	if (plugin->current_editor_uri)
-		default_group_uri = g_path_get_dirname (plugin->current_editor_uri);
-	else
-		default_group_uri = g_strdup ("");
-	target_uri =
+	{
+		gchar *path = g_path_get_dirname (plugin->current_editor_uri);
+		default_group = g_file_new_for_path (path);
+		g_free (path);
+	}
+	
+	target =
 		ianjuta_project_manager_add_target (IANJUTA_PROJECT_MANAGER (plugin),
-											"", default_group_uri,
+											"", default_group,
 											NULL);
-	g_free (target_uri);
-	g_free (default_group_uri);
+	g_object_unref (target);
+	g_object_unref (default_group);
 }
 
 static void
 on_add_source (GtkAction *action, ProjectManagerPlugin *plugin)
 {
-	gchar *default_group_uri = NULL, *default_source_uri;
-	gchar* source_uri;
+	GFile *default_group = NULL;
+	gchar *source_uri = NULL;
+	GFile *source;
 	
 	if (plugin->current_editor_uri)
 	{
-		default_group_uri = g_path_get_dirname (plugin->current_editor_uri);
-		default_source_uri = plugin->current_editor_uri;
+		gchar *path = g_path_get_dirname (plugin->current_editor_uri);
+		default_group = g_file_new_for_path (path);
+		g_free (path);
+		source_uri = plugin->current_editor_uri;
 	}
-	else
-	{
-		default_group_uri = g_strdup ("");
-		default_source_uri = "";
-	}
-	source_uri =
+	source =
 		ianjuta_project_manager_add_source (IANJUTA_PROJECT_MANAGER (plugin),
-											default_source_uri,
-											default_group_uri, NULL);
-	g_free (source_uri);
-	g_free (default_group_uri);
+											source_uri,
+											default_group, NULL);
+	g_object_unref (source);
+	g_object_unref (default_group);
 }
 
 static void
@@ -813,7 +821,8 @@ on_popup_add_to_project (GtkAction *action, ProjectManagerPlugin *plugin)
 	GtkWindow *win;
 	GFile *file;
 	GFileInfo *file_info;
-	gchar *parent_directory, *filename;
+	GFile *parent_directory;
+	gchar *filename;
 	GError *error = NULL;
 	
 	win = get_plugin_parent_window (plugin);
@@ -826,32 +835,30 @@ on_popup_add_to_project (GtkAction *action, ProjectManagerPlugin *plugin)
 								   &error);
 	if (file_info != NULL)
 	{
-		parent_directory = g_path_get_dirname (plugin->fm_current_uri);
-		if (!parent_directory)
-			parent_directory = g_strdup ("");
+		parent_directory = g_file_get_parent (file);
 		
-		filename = g_path_get_basename (plugin->fm_current_uri);
+		filename = g_file_get_basename (file);
 		if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
 		{
-			gchar *new_uri =
+			GFile *new_file =
 			ianjuta_project_manager_add_group (IANJUTA_PROJECT_MANAGER (plugin),
 											   filename, parent_directory,
 											   NULL);
-			g_free (new_uri);
+			g_object_unref (new_file);
 		}
 		else
 		{
-			gchar *new_uri =
+			GFile *new_file =
 				ianjuta_project_manager_add_source (IANJUTA_PROJECT_MANAGER
 													(plugin),
 													plugin->fm_current_uri,
 													parent_directory,
 													NULL);
-			g_free (new_uri);
+			g_object_unref (new_file);
 		}
 		g_object_unref (file_info);
 		g_free (filename);
-		g_free (parent_directory);
+		g_object_unref (parent_directory);
 	}
 	else
 	{
@@ -1025,7 +1032,7 @@ on_treeview_selection_changed (GtkTreeSelection *sel,
 	AnjutaUI *ui;
 	GtkAction *action;
 	AnjutaProjectNode *node;
-	gchar *selected_uri;
+	GFile *selected_file;
 	IAnjutaProjectCapabilities caps = IANJUTA_PROJECT_CAN_ADD_NONE;
 	
 	ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL);
@@ -1099,21 +1106,24 @@ on_treeview_selection_changed (GtkTreeSelection *sel,
 		goto finally;
 	}
 finally:
-	selected_uri =
+	selected_file =
 		ianjuta_project_manager_get_selected (IANJUTA_PROJECT_MANAGER (plugin),
 											  NULL);
-	if (selected_uri)
+	if (selected_file)
 	{
 		GValue *value;
+		gchar *uri = g_file_get_uri (selected_file);
+		
 		value = g_new0 (GValue, 1);
 		g_value_init (value, G_TYPE_STRING);
-		g_value_set_string (value, selected_uri);
+		g_value_set_string (value, uri);
 		anjuta_shell_add_value (ANJUTA_PLUGIN(plugin)->shell,
 								IANJUTA_PROJECT_MANAGER_CURRENT_URI,
 								value, NULL);
 		g_signal_emit_by_name (G_OBJECT (plugin), "element_selected",
-							   selected_uri);
-		g_free (selected_uri);
+							   selected_file);
+		g_free (uri);
+		g_object_unref (selected_file);
 	} else {
 		anjuta_shell_remove_value (ANJUTA_PLUGIN(plugin)->shell,
 								   IANJUTA_PROJECT_MANAGER_CURRENT_URI, NULL);
@@ -1838,11 +1848,17 @@ get_uri_vfs_type (const gchar *uri)
 }
 
 static gboolean
-uri_is_inside_project (ProjectManagerPlugin *plugin, const gchar *uri)
+file_is_inside_project (ProjectManagerPlugin *plugin, GFile *file)
 {
+	gchar *uri = g_file_get_uri (file);
+	gboolean inside = FALSE;
+	
 	if (strncmp (uri, plugin->project_root_uri,
 				 strlen (plugin->project_root_uri)) == 0)
+	{
+		g_free (uri);
 		return TRUE;
+	}
 	
 	if (uri[0] == '/')
 	{
@@ -1851,21 +1867,21 @@ uri_is_inside_project (ProjectManagerPlugin *plugin, const gchar *uri)
 			project_root_path += 3;
 		else
 			project_root_path = plugin->project_root_uri;
-		return (strncmp (uri, project_root_path,
-						 strlen (project_root_path)) == 0);
+		inside = strncmp (uri, project_root_path,
+						 strlen (project_root_path)) == 0;
 	}
-	return FALSE;
+	g_free (uri);
+	
+	return inside;
 }
 
-static gchar *
-get_element_uri_from_id (ProjectManagerPlugin *plugin, AnjutaProjectNode *id, const gchar *root)
+static GFile*
+get_element_file_from_node (ProjectManagerPlugin *plugin, AnjutaProjectNode *node, const gchar *root)
 {
 	const gchar *project_root = NULL;
 	GFile *file = NULL;
-	GFile *target_file = NULL;
-	gchar *uri = NULL;
 	
-	if (!id)
+	if (!node)
 		return NULL;
 	
 	anjuta_shell_get (ANJUTA_PLUGIN (plugin)->shell,
@@ -1881,18 +1897,17 @@ get_element_uri_from_id (ProjectManagerPlugin *plugin, AnjutaProjectNode *id, co
 					  NULL);
 	}
 
-	switch (anjuta_project_node_get_type (id))
+	switch (anjuta_project_node_get_type (node))
 	{
 		case ANJUTA_PROJECT_GROUP:
-			file = anjuta_project_group_get_directory (id);
+			file = g_object_ref (anjuta_project_group_get_directory (node));
 			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;
+			file = anjuta_project_group_get_directory (anjuta_project_node_parent (node));
+			file = g_file_get_child (file, anjuta_project_target_get_name (node));
 			break;
 		case ANJUTA_PROJECT_SOURCE:
-			file = anjuta_project_source_get_file (id);
+			file = g_object_ref (anjuta_project_source_get_file (node));
 			break;
 		default:
 			file = NULL;
@@ -1912,16 +1927,14 @@ get_element_uri_from_id (ProjectManagerPlugin *plugin, AnjutaProjectNode *id, co
 			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_object_unref (file);
+			
+			file = node_file;
 			g_free (rel_path);
 		}
 	}
-		
-	if (target_file != NULL) g_object_unref (target_file);
 	
-	return uri;
+	return file;
 }
 
 static const gchar *
@@ -2004,7 +2017,7 @@ get_node_from_file (AnjutaProjectNode *parent, GFile *file)
 }
 
 static AnjutaProjectNode*
-get_project_node_from_uri (ProjectManagerPlugin *plugin, const gchar *uri, AnjutaProjectNodeType type)
+get_project_node_from_file (ProjectManagerPlugin *plugin, GFile *file, AnjutaProjectNodeType type)
 {
 	GbfTreeData *data;
 	AnjutaProjectNode *node;
@@ -2012,17 +2025,17 @@ get_project_node_from_uri (ProjectManagerPlugin *plugin, const gchar *uri, Anjut
 	switch (type)
 	{
 	case ANJUTA_PROJECT_GROUP:
-		data = gbf_tree_data_new_for_uri (uri, GBF_TREE_NODE_GROUP);
+		data = gbf_tree_data_new_for_file (file, GBF_TREE_NODE_GROUP);
 		break;
 	case ANJUTA_PROJECT_TARGET:
-		data = gbf_tree_data_new_for_uri (uri, GBF_TREE_NODE_TARGET);
+		data = gbf_tree_data_new_for_file (file, GBF_TREE_NODE_TARGET);
 		break;
 	case ANJUTA_PROJECT_SOURCE:
-		data = gbf_tree_data_new_for_uri (uri, GBF_TREE_NODE_SOURCE);
+		data = gbf_tree_data_new_for_file (file, GBF_TREE_NODE_SOURCE);
 		break;
 	case ANJUTA_PROJECT_UNKNOWN:
 	default:
-		data = gbf_tree_data_new_for_uri (uri, GBF_TREE_NODE_UNKNOWN);
+		data = gbf_tree_data_new_for_file (file, GBF_TREE_NODE_UNKNOWN);
 		break;
 	}
 
@@ -2033,12 +2046,12 @@ get_project_node_from_uri (ProjectManagerPlugin *plugin, const gchar *uri, Anjut
 }
 
 static GtkTreeIter*
-get_tree_iter_from_uri (ProjectManagerPlugin *plugin, GtkTreeIter* iter, const gchar *uri, GbfTreeNodeType type)
+get_tree_iter_from_file (ProjectManagerPlugin *plugin, GtkTreeIter* iter, GFile *file, GbfTreeNodeType type)
 {
 	GbfTreeData *data;
 	gboolean found;
 
-	data = gbf_tree_data_new_for_uri (uri, type);
+	data = gbf_tree_data_new_for_file (file, type);
 	found = gbf_project_model_find_tree_data (plugin->model, iter, data);
 	gbf_tree_data_free (data);
 
@@ -2046,19 +2059,11 @@ get_tree_iter_from_uri (ProjectManagerPlugin *plugin, GtkTreeIter* iter, const g
 }
 
 static AnjutaProjectNodeType
-iproject_manager_get_element_type (IAnjutaProjectManager *project_manager,
-								   const gchar *element_uri,
-								   GError **err)
+get_element_type (ProjectManagerPlugin *plugin, GFile *element)
 {
 	AnjutaProjectNode *node = NULL;
-	ProjectManagerPlugin *plugin;
-
-	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager),
-						  ANJUTA_PROJECT_UNKNOWN);
 	
-	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
-
-	node = get_project_node_from_uri (plugin, element_uri, ANJUTA_PROJECT_UNKNOWN);
+	node = get_project_node_from_file (plugin, element, ANJUTA_PROJECT_UNKNOWN);
 
 	return node == NULL ? ANJUTA_PROJECT_UNKNOWN : anjuta_project_node_get_type (node);
 }
@@ -2075,12 +2080,12 @@ iproject_manager_get_elements (IAnjutaProjectManager *project_manager,
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
 	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)); 
+	return gbf_project_util_replace_by_file (gbf_project_util_node_all (ianjuta_project_get_root (plugin->project, NULL), element_type)); 
 }
 
 static AnjutaProjectTargetClass
 iproject_manager_get_target_type (IAnjutaProjectManager *project_manager,
-								   const gchar *target_uri,
+								   GFile *target_file,
 								   GError **err)
 {
 	ProjectManagerPlugin *plugin;
@@ -2093,10 +2098,10 @@ iproject_manager_get_target_type (IAnjutaProjectManager *project_manager,
 	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),
+	g_return_val_if_fail (file_is_inside_project (plugin, target_file),
 						  ANJUTA_TARGET_UNKNOWN);
 	
-	target = get_project_node_from_uri (plugin, target_uri, ANJUTA_PROJECT_TARGET);
+	target = get_project_node_from_file (plugin, target_file, ANJUTA_PROJECT_TARGET);
 
 	if (target != NULL)
 	{
@@ -2147,15 +2152,15 @@ iproject_manager_get_targets (IAnjutaProjectManager *project_manager,
 	/* 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);
+		node->data = get_element_file_from_node (plugin, node->data, IANJUTA_BUILDER_ROOT_URI);
 	}
 
 	return targets;
 }
 
-static gchar*
+static GFile*
 iproject_manager_get_parent (IAnjutaProjectManager *project_manager,
-							 const gchar *element_uri,
+							 GFile *element,
 							 GError **err)
 {
 	AnjutaProjectNodeType type;
@@ -2166,15 +2171,14 @@ iproject_manager_get_parent (IAnjutaProjectManager *project_manager,
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
 	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), NULL);
 	
-	type = ianjuta_project_manager_get_element_type (project_manager,
-													 element_uri, NULL);
+	type = get_element_type (plugin, element);
 	/* FIXME: */
 	return NULL;
 }
 
 static GList*
 iproject_manager_get_children (IAnjutaProjectManager *project_manager,
-							   const gchar *element_uri,
+							   GFile *element,
 							   GError **err)
 {
 	ProjectManagerPlugin *plugin;
@@ -2187,11 +2191,10 @@ iproject_manager_get_children (IAnjutaProjectManager *project_manager,
 	return NULL;
 }
 
-static gchar*
+static GFile*
 iproject_manager_get_selected (IAnjutaProjectManager *project_manager,
 							   GError **err)
 {
-	gchar *uri;
 	AnjutaProjectNode *node;
 	ProjectManagerPlugin *plugin;
 	
@@ -2206,87 +2209,26 @@ iproject_manager_get_selected (IAnjutaProjectManager *project_manager,
 										   ANJUTA_PROJECT_SOURCE);
 	if (node && anjuta_project_node_get_type (node) == ANJUTA_PROJECT_SOURCE)
 	{
-		uri = g_file_get_uri (anjuta_project_source_get_file (node));
-		return uri;
+		return g_object_ref (anjuta_project_source_get_file (node));
 	}
 
 	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, node, IANJUTA_BUILDER_ROOT_URI);
-		return uri;
+		return get_element_file_from_node (plugin, node, IANJUTA_BUILDER_ROOT_URI);
 	}
 
 	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_file_get_uri (anjuta_project_group_get_directory (node));
-		return uri;;
+		return g_object_ref (anjuta_project_group_get_directory (node));
 	}
 	
 	return NULL;
 }
 
-static gchar*
-iproject_manager_get_selected_id (IAnjutaProjectManager *project_manager,
-								  AnjutaProjectNodeType element_type,
-								  GError **err)
-{
-	ProjectManagerPlugin *plugin;
-	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 (IANJUTA_IS_PROJECT (plugin->project), NULL);
-
-	if (element_type == ANJUTA_PROJECT_UNKNOWN ||
-		element_type == ANJUTA_PROJECT_SOURCE)
-	{
-		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 == ANJUTA_PROJECT_UNKNOWN ||
-		element_type == ANJUTA_PROJECT_TARGET)
-	{
-		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 == ANJUTA_PROJECT_UNKNOWN ||
-		element_type == ANJUTA_PROJECT_GROUP)
-	{
-		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;
-		}
-	}
-	
-	if (node)
-	{
-		uri = get_element_uri_from_id (plugin, node, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
-		return uri;
-	}
-	return NULL;
-}
-
 static IAnjutaProjectCapabilities
 iproject_manager_get_capabilities (IAnjutaProjectManager *project_manager,
 								   GError **err)
@@ -2300,17 +2242,17 @@ iproject_manager_get_capabilities (IAnjutaProjectManager *project_manager,
 	return ianjuta_project_get_capabilities (plugin->project, NULL);
 }
 
-static gchar*
+static GFile*
 iproject_manager_add_source (IAnjutaProjectManager *project_manager,
 							 const gchar *source_uri_to_add,
-							 const gchar *default_target_uri,
+							 GFile *default_target_file,
 							 GError **err)
 {
 	ProjectManagerPlugin *plugin;
 	GtkTreeIter target_iter;
 	GtkTreeIter *iter = NULL;
 	AnjutaProjectSource *source_id;
-	gchar* source_uri;
+	GFile* source;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), FALSE);
 	
@@ -2318,9 +2260,9 @@ iproject_manager_add_source (IAnjutaProjectManager *project_manager,
 	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), FALSE);
 
 	update_operation_begin (plugin);
-	if (default_target_uri != NULL)
+	if (default_target_file != NULL)
 	{
-		iter = get_tree_iter_from_uri (plugin, &target_iter, default_target_uri, GBF_TREE_NODE_TARGET);
+		iter = get_tree_iter_from_file (plugin, &target_iter, default_target_file, GBF_TREE_NODE_TARGET);
 	}
 	source_id = gbf_project_util_add_source (plugin->model,
 										     get_plugin_parent_window (plugin),
@@ -2328,15 +2270,15 @@ iproject_manager_add_source (IAnjutaProjectManager *project_manager,
 											 source_uri_to_add);
 	update_operation_end (plugin, TRUE);
 	
-	source_uri = get_element_uri_from_id(plugin, source_id, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
+	source = get_element_file_from_node(plugin, source_id, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
 	
-	return source_uri;
+	return source;
 }
 
-static gchar*
+static GFile*
 iproject_manager_add_source_quiet (IAnjutaProjectManager *project_manager,
 								   const gchar *source_uri_to_add,
-								   const gchar *location_uri,
+								   GFile *location_file,
 								   GError **err)
 {
 	ProjectManagerPlugin *plugin;
@@ -2349,7 +2291,7 @@ iproject_manager_add_source_quiet (IAnjutaProjectManager *project_manager,
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
 	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), FALSE);
 
-	target = get_project_node_from_uri (plugin, location_uri, ANJUTA_PROJECT_TARGET);
+	target = get_project_node_from_file (plugin, location_file, ANJUTA_PROJECT_TARGET);
 	source_file = g_file_new_for_uri (source_uri_to_add);
 	update_operation_begin (plugin);
 	source_id = ianjuta_project_add_source (plugin->project,
@@ -2359,20 +2301,20 @@ iproject_manager_add_source_quiet (IAnjutaProjectManager *project_manager,
 	update_operation_end (plugin, TRUE);
 	g_object_unref (source_file);
 	
-	return get_element_uri_from_id (plugin, source_id, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
+	return get_element_file_from_node (plugin, source_id, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
 }
 
 static GList*
 iproject_manager_add_source_multi (IAnjutaProjectManager *project_manager,
 							 GList *source_add_uris,
-							 const gchar *default_target_uri,
+							 GFile *default_target_file,
 							 GError **err)
 {
 	ProjectManagerPlugin *plugin;
 	GtkTreeIter target_iter;
 	GtkTreeIter *iter = NULL;
 	GList* source_ids;
-	GList* source_uris = NULL;
+	GList* source_files = NULL;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), FALSE);
 	
@@ -2380,9 +2322,9 @@ iproject_manager_add_source_multi (IAnjutaProjectManager *project_manager,
 	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), FALSE);
 
 	update_operation_begin (plugin);
-	if (default_target_uri != NULL)
+	if (default_target_file != NULL)
 	{
-		iter = get_tree_iter_from_uri (plugin, &target_iter, default_target_uri, GBF_TREE_NODE_TARGET);
+		iter = get_tree_iter_from_file (plugin, &target_iter, default_target_file, GBF_TREE_NODE_TARGET);
 	}
 
 	source_ids = gbf_project_util_add_source_multi (plugin->model,
@@ -2393,26 +2335,26 @@ iproject_manager_add_source_multi (IAnjutaProjectManager *project_manager,
 	
 	while (source_ids)
 	{
-		source_uris = g_list_append (source_uris,
-									 get_element_uri_from_id (plugin,
+		source_files = g_list_append (source_files,
+									 get_element_file_from_node (plugin,
 														  source_ids->data,
 														  IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI));
 		source_ids = g_list_delete_link (source_ids, source_ids);
 	}
 
-	return source_uris;
+	return source_files;
 }
 
-static gchar*
+static GFile*
 iproject_manager_add_target (IAnjutaProjectManager *project_manager,
 							 const gchar *target_name_to_add,
-							 const gchar *default_group_uri,
+							 GFile *default_group_file,
 							 GError **err)
 {
 	ProjectManagerPlugin *plugin;
 	GtkTreeIter group_iter;
 	GtkTreeIter *iter = NULL;
-	gchar *target_uri = NULL;
+	GFile *target = NULL;
 	AnjutaProjectTarget *target_id;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), FALSE);
@@ -2421,9 +2363,9 @@ iproject_manager_add_target (IAnjutaProjectManager *project_manager,
 	
 	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), FALSE);
 
-	if (default_group_uri != NULL)
+	if (default_group_file != NULL)
 	{
-		iter = get_tree_iter_from_uri (plugin, &group_iter, default_group_uri, GBF_TREE_NODE_GROUP);
+		iter = get_tree_iter_from_file (plugin, &group_iter, default_group_file, GBF_TREE_NODE_GROUP);
 	}
 	
 	update_operation_begin (plugin);
@@ -2432,21 +2374,21 @@ iproject_manager_add_target (IAnjutaProjectManager *project_manager,
 											 iter,
 											 target_name_to_add);
 	update_operation_end (plugin, TRUE);
-	target_uri = get_element_uri_from_id (plugin, target_id, IANJUTA_BUILDER_ROOT_URI);
+	target = get_element_file_from_node (plugin, target_id, IANJUTA_BUILDER_ROOT_URI);
 
-	return target_uri;
+	return target;
 }
 
-static gchar*
+static GFile*
 iproject_manager_add_group (IAnjutaProjectManager *project_manager,
 							const gchar *group_name_to_add,
-							const gchar *default_group_uri,
+							GFile *default_group_file,
 							GError **err)
 {
 	ProjectManagerPlugin *plugin;
 	GtkTreeIter group_iter;
 	GtkTreeIter *iter = NULL;
-	gchar *group_uri = NULL;
+	GFile *group = NULL;
 	AnjutaProjectGroup *group_id;
 	
 	g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), FALSE);
@@ -2454,9 +2396,9 @@ iproject_manager_add_group (IAnjutaProjectManager *project_manager,
 	plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
 	g_return_val_if_fail (IANJUTA_IS_PROJECT (plugin->project), FALSE);
 
-	if (default_group_uri != NULL)
+	if (default_group_file != NULL)
 	{
-		iter = get_tree_iter_from_uri (plugin, &group_iter, default_group_uri, GBF_TREE_NODE_GROUP);
+		iter = get_tree_iter_from_file (plugin, &group_iter, default_group_file, GBF_TREE_NODE_GROUP);
 	}
 	
 	update_operation_begin (plugin);
@@ -2465,9 +2407,9 @@ iproject_manager_add_group (IAnjutaProjectManager *project_manager,
 										   iter,
 										   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);
+	group = get_element_file_from_node (plugin, group_id, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
 	
-	return group_uri;
+	return group;
 }
 
 static gboolean
@@ -2496,14 +2438,12 @@ iproject_manager_get_packages (IAnjutaProjectManager *project_manager, GError **
 static void
 iproject_manager_iface_init(IAnjutaProjectManagerIface *iface)
 {
-	iface->get_element_type = iproject_manager_get_element_type;
 	iface->get_elements = iproject_manager_get_elements;
 	iface->get_target_type = iproject_manager_get_target_type;
 	iface->get_targets = iproject_manager_get_targets;
 	iface->get_parent = iproject_manager_get_parent;
 	iface->get_children = iproject_manager_get_children;
 	iface->get_selected = iproject_manager_get_selected;
-	iface->get_selected_id = iproject_manager_get_selected_id;
 	iface->get_capabilities = iproject_manager_get_capabilities;
 	iface->add_source = iproject_manager_add_source;
 	iface->add_source_quiet = iproject_manager_add_source_quiet;
diff --git a/plugins/run-program/parameters.c b/plugins/run-program/parameters.c
index 5693c0c..b7fa0ab 100644
--- a/plugins/run-program/parameters.c
+++ b/plugins/run-program/parameters.c
@@ -688,15 +688,17 @@ run_dialog_init (RunDialog *dlg, RunProgramPlugin *plugin)
 			for (node = exec_targets; node; node = g_list_next (node))
 			{
 				GList *target;
+				gchar *uri = g_file_get_uri ((GFile *)node->data);
 				for (target = plugin->recent_target; target; target = g_list_next (target))
 				{
-					if (strcmp ((const gchar *)target->data, node->data) == 0) break;
+					if (strcmp ((const gchar *)target->data, uri) == 0) break;
 				}
 				if (target == NULL)
 				{
-					on_add_uri_in_model (node->data, model);
+					on_add_uri_in_model (uri, model);
 				}
-				g_free (node->data);
+				g_free (uri);
+				g_object_unref (node->data);
 			}
 			g_list_free (exec_targets);
 		}
diff --git a/plugins/search/search-replace_backend.c b/plugins/search/search-replace_backend.c
index b67fbeb..9aa2781 100644
--- a/plugins/search/search-replace_backend.c
+++ b/plugins/search/search-replace_backend.c
@@ -304,14 +304,15 @@ get_project_file_list(void)
 													 NULL);
 		if (list)
 		{
-			const gchar *uri;
+			gchar *uri;
 			GList *node;
 			node = list;
 	
 			while (node)
 			{
-				uri = (const gchar *)node->data;
-				files = g_list_prepend (files, g_strdup (uri));
+				uri = g_file_get_uri ((GFile *)node->data);
+				files = g_list_prepend (files, uri);
+				g_object_unref ((GFile *)node->data);
 				node = g_list_next (node);
 			}
 			files = g_list_reverse (files);
diff --git a/plugins/symbol-db/plugin.c b/plugins/symbol-db/plugin.c
index c79a37f..630ff70 100644
--- a/plugins/symbol-db/plugin.c
+++ b/plugins/symbol-db/plugin.c
@@ -1061,10 +1061,9 @@ do_add_new_files (SymbolDBPlugin *sdb_plugin, const GPtrArray *sources_array,
 }
 
 static void
-on_project_element_added (IAnjutaProjectManager *pm, const gchar *uri,
+on_project_element_added (IAnjutaProjectManager *pm, GFile *gfile,
 						  SymbolDBPlugin *sdb_plugin)
 {
-	GFile *gfile = NULL;		
 	gchar *filename;
 	gint real_added;
 	GPtrArray *files_array;			
@@ -1072,7 +1071,6 @@ on_project_element_added (IAnjutaProjectManager *pm, const gchar *uri,
 	g_return_if_fail (sdb_plugin->project_root_uri != NULL);
 	g_return_if_fail (sdb_plugin->project_root_dir != NULL);
 
-	gfile = g_file_new_for_uri (uri);	
 	filename = g_file_get_path (gfile);
 
 	files_array = g_ptr_array_new ();
@@ -1092,22 +1090,17 @@ on_project_element_added (IAnjutaProjectManager *pm, const gchar *uri,
 	
 	g_ptr_array_foreach (files_array, (GFunc)g_free, NULL);
 	g_ptr_array_free (files_array, TRUE);
-	
-	if (gfile)
-		g_object_unref (gfile);	
 }
 
 static void
-on_project_element_removed (IAnjutaProjectManager *pm, const gchar *uri,
+on_project_element_removed (IAnjutaProjectManager *pm, GFile *gfile,
 							SymbolDBPlugin *sdb_plugin)
 {
 	gchar *filename;
-	GFile *gfile;
 	
 	if (!sdb_plugin->project_root_uri)
 		return;
 	
-	gfile = g_file_new_for_uri (uri);
 	filename = g_file_get_path (gfile);
 
 	if (filename)
@@ -1118,8 +1111,6 @@ on_project_element_removed (IAnjutaProjectManager *pm, const gchar *uri,
 		
 		g_free (filename);
 	}
-	
-	g_object_unref (gfile);
 }
 
 static void
@@ -1454,10 +1445,7 @@ do_import_project_sources (AnjutaPlugin *plugin, IAnjutaProjectManager *pm,
 		gchar *local_filename;
 		GFile *gfile = NULL;
 		
-		if ((gfile = g_file_new_for_uri (g_list_nth_data (prj_elements_list, i))) == NULL)
-		{
-			continue;
-		}		
+		gfile = g_list_nth_data (prj_elements_list, i);
 
 		if ((local_filename = g_file_get_path (gfile)) == NULL)
 		{
@@ -1606,12 +1594,8 @@ do_check_offline_files_changed (SymbolDBPlugin *sdb_plugin)
 	{	
 		GFile *gfile;
 		gchar *filename;
-		const gchar *uri = (const gchar*)g_list_nth_data (prj_elements_list, i);
 
-		if ((gfile = g_file_new_for_uri (uri)) == NULL) 
-		{			
-			continue;
-		}		
+		gfile = (GFile *)g_list_nth_data (prj_elements_list, i);
 		
 		if ((filename = g_file_get_path (gfile)) == NULL || 
 			g_strcmp0 (filename, "") == 0)
@@ -1623,7 +1607,7 @@ do_check_offline_files_changed (SymbolDBPlugin *sdb_plugin)
 		}
 		
 		/* test its existence */
-		if (g_file_test (filename, G_FILE_TEST_EXISTS) == FALSE) 
+		if (g_file_query_exists (gfile, NULL) == FALSE) 
 		{
 			/* FIXME here */
 			/*DEBUG_PRINT ("hey, filename %s (uri %s) does NOT exist", filename, uri);*/
diff --git a/plugins/tools/variable.c b/plugins/tools/variable.c
index 384073f..779a312 100644
--- a/plugins/tools/variable.c
+++ b/plugins/tools/variable.c
@@ -258,7 +258,8 @@ static gchar*
 atp_variable_get_project_manager_variable (const ATPVariable *this, guint id)
 {
 	IAnjutaProjectManager *prjman;
-	gchar* val;
+	gchar* val = NULL;
+	GFile *file;
 	GError* err = NULL;
 
 	prjman = anjuta_shell_get_interface (this->shell, IAnjutaProjectManager, NULL);
@@ -268,7 +269,12 @@ atp_variable_get_project_manager_variable (const ATPVariable *this, guint id)
 	switch (id)
 	{
 	case ATP_PROJECT_MANAGER_CURRENT_URI:
-		val = ianjuta_project_manager_get_selected (prjman, &err);
+		file = ianjuta_project_manager_get_selected (prjman, &err);
+		if (file != NULL)
+		{
+			val = g_file_get_uri (file);
+			g_object_unref (file);
+		}
 		break;
 	default:
 		g_return_val_if_reached (NULL);



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