[anjuta] search: Double click on an absolute file name in search result open the file in editor
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [anjuta] search: Double click on an absolute file name in search result open the file in editor
- Date: Mon, 3 Aug 2009 19:56:47 +0000 (UTC)
commit 6a707b4d88a434c71544353c4401b4c254f4b911
Author: Sébastien Granjoux <seb sfo free fr>
Date: Mon Aug 3 21:56:11 2009 +0200
search: Double click on an absolute file name in search result open the file in editor
plugins/search/search-replace.c | 43 ++++++++++++++++++++++----------------
1 files changed, 25 insertions(+), 18 deletions(-)
---
diff --git a/plugins/search/search-replace.c b/plugins/search/search-replace.c
index 86f6b34..3360217 100644
--- a/plugins/search/search-replace.c
+++ b/plugins/search/search-replace.c
@@ -707,7 +707,7 @@ static gboolean
on_message_clicked (GObject* object, gchar* message, gpointer data)
{
gchar *ptr, *ptr2;
- gchar *path, *nline, *real_path = NULL, *project_uri;
+ gchar *path, *nline;
GFile* file;
gint line;
@@ -720,30 +720,37 @@ on_message_clicked (GObject* object, gchar* message, gpointer data)
return FALSE;
nline = g_strndup(ptr, ptr2 - ptr);
line = atoi(nline);
-
- anjuta_shell_get (ANJUTA_PLUGIN(sr->docman)->shell,
- IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI, G_TYPE_STRING,
- &project_uri, NULL);
-
- if (project_uri && strlen(project_uri))
+ g_free (nline);
+
+ if (!g_path_is_absolute (path))
{
- gchar* project_path = g_filename_from_uri (project_uri, NULL, NULL);
- if (project_path)
+ gchar *project_uri = NULL;
+
+ anjuta_shell_get (ANJUTA_PLUGIN(sr->docman)->shell,
+ IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI, G_TYPE_STRING,
+ &project_uri, NULL);
+
+ if (project_uri && (*project_uri != '\0'))
{
- real_path = g_build_filename (project_path, path, NULL);
- g_free(path);
+ gchar* project_path = g_filename_from_uri (project_uri, NULL, NULL);
+ if (project_path)
+ {
+ gchar *relative_path = path;
+
+ path = g_build_filename (project_path, path, NULL);
+
+ g_free(relative_path);
+ }
+ g_free (project_path);
}
- g_free(project_path);
+ g_free (project_uri);
}
- if (!real_path)
- real_path = path;
- file = g_file_new_for_path (real_path);
+ file = g_file_new_for_path (path);
ianjuta_document_manager_goto_file_line_mark (sr->docman, file, line, TRUE, NULL);
g_object_unref (file);
- g_free(real_path);
- g_free(nline);
- g_free(project_uri);
+ g_free(path);
+
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]