anjuta r4756 - in trunk: . plugins/search



Author: jhs
Date: Mon Feb 16 20:06:39 2009
New Revision: 4756
URL: http://svn.gnome.org/viewvc/anjuta?rev=4756&view=rev

Log:
2009-02-16  Johannes Schmid  <jhs gnome org>

	* plugins/search/search-replace.c (on_message_clicked):
	#564942 â display project-relative path in search results pane

Modified:
   trunk/ChangeLog
   trunk/plugins/search/search-replace.c

Modified: trunk/plugins/search/search-replace.c
==============================================================================
--- trunk/plugins/search/search-replace.c	(original)
+++ trunk/plugins/search/search-replace.c	Mon Feb 16 20:06:39 2009
@@ -709,10 +709,10 @@
 on_message_clicked (GObject* object, gchar* message, gpointer data)
 {
 	gchar *ptr, *ptr2;
-	gchar *path, *nline;
+	gchar *path, *nline, *real_path = NULL, *project_uri;
 	GFile* file;
 	gint line;
-		
+	
 	if (!(ptr = g_strstr_len(message, strlen(message), ":")) )
 		return FALSE;
 	path = g_strndup(message, ptr - message);
@@ -723,11 +723,30 @@
 	nline = g_strndup(ptr, ptr2 - ptr);
 	line = atoi(nline);
 	
-	file = g_file_new_for_path (path); 
+	anjuta_shell_get (ANJUTA_PLUGIN(sr->docman)->shell,
+	                  "project_root_uri", G_TYPE_STRING,
+	                  &project_uri, NULL);
+	
+	if (project_uri && strlen(project_uri))
+	{
+		gchar* project_path = g_filename_from_uri (project_uri, NULL, NULL);
+		if (project_path)
+		{
+			real_path = g_build_filename (project_path, path, NULL);
+			g_free(path);
+		}
+		g_free(project_path);
+		g_free(project_uri);
+	}
+	if (!real_path)
+		real_path = path;
+	
+	file = g_file_new_for_path (real_path); 
 	ianjuta_document_manager_goto_file_line_mark (sr->docman, file, line, TRUE, NULL);
 	g_object_unref (file);
-	g_free(path);
+	g_free(real_path);
 	g_free(nline);
+	g_free(project_uri);
 	return FALSE;
 }
 



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