Commit def2f8dd authored by Johannes Schmid's avatar Johannes Schmid Committed by Johannes Schmid

#564942 – display project-relative path in search results pane

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

svn path=/trunk/; revision=4756
parent cd40abe5
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
2009-02-16 Massimo Cora' <mcora@svn.gnome.org>
* configure.in:
......@@ -709,10 +709,10 @@ static gboolean
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 @@ on_message_clicked (GObject* object, gchar* message, gpointer data)
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment