[anjuta] Send absolute pathes to an already existing anjuta instance
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [anjuta] Send absolute pathes to an already existing anjuta instance
- Date: Tue, 8 Sep 2009 20:05:38 +0000 (UTC)
commit eabb49143147b094e2a6ecb46c2b91d9ecf90df5
Author: Sébastien Granjoux <seb sfo free fr>
Date: Tue Sep 8 22:03:31 2009 +0200
Send absolute pathes to an already existing anjuta instance
src/anjuta.c | 4 ++--
src/main.c | 22 +++++++++++++++++++---
2 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/src/anjuta.c b/src/anjuta.c
index 2b39803..dfb0f68 100644
--- a/src/anjuta.c
+++ b/src/anjuta.c
@@ -337,7 +337,7 @@ anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
/* Identify non-project files and set them for loading in session */
for (node = files; *node != NULL; node++)
{
- GFile* file = g_file_new_for_commandline_arg(*node);
+ GFile* file = g_file_new_for_uri (*node);
gchar *filename = g_file_get_path (file);
if (anjuta_util_is_project_file (filename))
{
@@ -406,7 +406,7 @@ anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
/* Load project file */
if (project_file)
{
- GFile* file = g_file_new_for_commandline_arg (project_file);
+ GFile* file = g_file_new_for_uri (project_file);
IAnjutaFileLoader *loader;
loader = anjuta_shell_get_interface (ANJUTA_SHELL (app),
IAnjutaFileLoader, NULL);
diff --git a/src/main.c b/src/main.c
index 6392a00..b037557 100644
--- a/src/main.c
+++ b/src/main.c
@@ -125,10 +125,10 @@ message_received_cb (UniqueApp *unique,
gchar** uris = unique_message_data_get_uris(message);
gchar** uri;
for (uri = uris; *uri != NULL; uri++)
- {
+ {
IAnjutaFileLoader* loader =
anjuta_shell_get_interface(ANJUTA_SHELL(app), IAnjutaFileLoader, NULL);
- GFile* gfile = g_file_new_for_commandline_arg(*uri);
+ GFile* gfile = g_file_new_for_uri(*uri);
ianjuta_file_loader_load(loader, gfile, FALSE, NULL);
g_object_unref (gfile);
}
@@ -182,7 +182,23 @@ main (int argc, char *argv[])
/* Init debug helpers */
anjuta_debug_init ();
-
+
+ /* Convert all file names to URI */
+ /* So an already existing instance of Anjuta having another current
+ * directory can still open the files */
+ if (anjuta_filenames)
+ {
+ gchar** filename;
+ for (filename = anjuta_filenames; *filename != NULL; filename++)
+ {
+ GFile* file = g_file_new_for_commandline_arg(*filename);
+
+ g_free (*filename);
+ *filename = g_file_get_uri (file);
+ g_object_unref (file);
+ }
+ }
+
unique = unique_app_new ("org.gnome.anjuta", NULL);
if (unique_app_is_running(unique))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]