From cee6caa16804a4c4b539518b37d81c1470ca9270 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Mon, 13 Oct 2014 16:20:51 +0200 Subject: Uses g_app_info_launch_uris instead of g_app_info_launch to spawn other sessions Closes https://github.com/mate-desktop/atril/issues/86 Solution comes from evince code --- shell/ev-application.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/shell/ev-application.c b/shell/ev-application.c index 220519d1..da6366f8 100644 --- a/shell/ev-application.c +++ b/shell/ev-application.c @@ -282,12 +282,13 @@ ev_spawn (const char *uri, break; } - g_string_append_printf (cmd, " %s", uri); - cmdline = g_string_free (cmd, FALSE); app = g_app_info_create_from_commandline (cmdline, NULL, 0, &error); if (app != NULL) { + GList uri_list; + GList *uris = NULL; + #if GTK_CHECK_VERSION (3, 0, 0) ctx = gdk_display_get_app_launch_context (gdk_screen_get_display (screen)); #else @@ -297,7 +298,12 @@ ev_spawn (const char *uri, gdk_app_launch_context_set_screen (ctx, screen); gdk_app_launch_context_set_timestamp (ctx, timestamp); - g_app_info_launch (app, NULL, G_APP_LAUNCH_CONTEXT (ctx), &error); + if (uri) { + uri_list.data = (gchar *)uri; + uri_list.prev = uri_list.next = NULL; + uris = &uri_list; + } + g_app_info_launch_uris (app, uris, G_APP_LAUNCH_CONTEXT (ctx), &error); g_object_unref (app); g_object_unref (ctx); -- cgit v1.2.1