diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2010-12-22 16:56:20 +0100 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2010-12-22 17:00:54 +0100 |
commit | 77ecdd69b023a16fc4d6d2895dd470c628679168 (patch) | |
tree | 7544feae00ebb9400f319a6c72749a5d651baf53 | |
parent | 13b6a5a50db8dd35dbcbbf1d318ba747609dfb70 (diff) | |
download | nautilus-77ecdd69b023a16fc4d6d2895dd470c628679168.tar.gz |
program-choosing: don't use gdk_spawn_ API
-rw-r--r-- | libnautilus-private/nautilus-program-choosing.c | 30 | ||||
-rw-r--r-- | libnautilus-private/nautilus-program-choosing.h | 2 |
2 files changed, 26 insertions, 6 deletions
diff --git a/libnautilus-private/nautilus-program-choosing.c b/libnautilus-private/nautilus-program-choosing.c index ea21f04ef..a003b840a 100644 --- a/libnautilus-private/nautilus-program-choosing.c +++ b/libnautilus-private/nautilus-program-choosing.c @@ -180,7 +180,6 @@ nautilus_launch_application_by_uri (GAppInfo *application, */ void nautilus_launch_application_from_command (GdkScreen *screen, - const char *name, const char *command_string, gboolean use_terminal, ...) @@ -189,6 +188,8 @@ nautilus_launch_application_from_command (GdkScreen *screen, char *quoted_parameter; char *parameter; va_list ap; + GAppInfo *app; + GdkAppLaunchContext *ctx; full_command = g_strdup (command_string); @@ -209,7 +210,17 @@ nautilus_launch_application_from_command (GdkScreen *screen, if (use_terminal) { eel_gnome_open_terminal_on_screen (full_command, screen); } else { - gdk_spawn_command_line_on_screen (screen, full_command, NULL); + app = g_app_info_create_from_commandline (full_command, NULL, 0, NULL); + + if (app != NULL) { + ctx = gdk_app_launch_context_new (); + gdk_app_launch_context_set_screen (ctx, screen); + + g_app_info_launch (app, NULL, G_APP_LAUNCH_CONTEXT (ctx), NULL); + + g_object_unref (app); + g_object_unref (ctx); + } } g_free (full_command); @@ -227,7 +238,6 @@ nautilus_launch_application_from_command (GdkScreen *screen, */ void nautilus_launch_application_from_command_array (GdkScreen *screen, - const char *name, const char *command_string, gboolean use_terminal, const char * const * parameters) @@ -235,6 +245,8 @@ nautilus_launch_application_from_command_array (GdkScreen *screen, char *full_command, *tmp; char *quoted_parameter; const char * const *p; + GAppInfo *app; + GdkAppLaunchContext *ctx; full_command = g_strdup (command_string); @@ -252,7 +264,17 @@ nautilus_launch_application_from_command_array (GdkScreen *screen, if (use_terminal) { eel_gnome_open_terminal_on_screen (full_command, screen); } else { - gdk_spawn_command_line_on_screen (screen, full_command, NULL); + app = g_app_info_create_from_commandline (full_command, NULL, 0, NULL); + + if (app != NULL) { + ctx = gdk_app_launch_context_new (); + gdk_app_launch_context_set_screen (ctx, screen); + + g_app_info_launch (app, NULL, G_APP_LAUNCH_CONTEXT (ctx), NULL); + + g_object_unref (app); + g_object_unref (ctx); + } } g_free (full_command); diff --git a/libnautilus-private/nautilus-program-choosing.h b/libnautilus-private/nautilus-program-choosing.h index f90ac056a..56fa836b7 100644 --- a/libnautilus-private/nautilus-program-choosing.h +++ b/libnautilus-private/nautilus-program-choosing.h @@ -43,12 +43,10 @@ void nautilus_launch_application_for_mount (GAppInfo GMount *mount, GtkWindow *parent_window); void nautilus_launch_application_from_command (GdkScreen *screen, - const char *name, const char *command_string, gboolean use_terminal, ...) G_GNUC_NULL_TERMINATED; void nautilus_launch_application_from_command_array (GdkScreen *screen, - const char *name, const char *command_string, gboolean use_terminal, const char * const * parameters); |