File 0002-Use-g_spawn_command_line_async-to-launch-instances.patch of Package mingw32-evince

From eb92c76b31edf36251d317542216061739814bbb Mon Sep 17 00:00:00 2001
From: Hib Eris <hib@hiberis.nl>
Date: Fri, 8 Apr 2011 10:26:37 +0200
Subject: [PATCH 02/12] Use g_spawn_command_line_async() to launch instances

Work around for not working g_app_info_create_from_commandline () on
win32.
---
 shell/ev-application.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/shell/ev-application.c b/shell/ev-application.c
index a92d29c..49d4db6 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -224,7 +224,9 @@ ev_spawn (const char     *uri,
 {
 	GString *cmd;
 	gchar *path, *cmdline;
+#ifndef G_OS_WIN32
 	GAppInfo *app;
+#endif
 	GError  *error = NULL;
 
 	cmd = g_string_new (NULL);
@@ -234,15 +236,16 @@ ev_spawn (const char     *uri,
 	gchar *dir;
 
 	dir = g_win32_get_package_installation_directory_of_module (NULL);
-	path = g_build_filename (dir, "bin", "evince", NULL);
+	path = g_build_filename (dir, "bin", "evince.exe", NULL);
 
 	g_free (dir);
+	g_string_append_printf (cmd, "'%s'", path);
 }
 #else
 	path = g_build_filename (BINDIR, "evince", NULL);
+	g_string_append_printf (cmd, " %s", path);
 #endif
 
-	g_string_append_printf (cmd, " %s", path);
 	g_free (path);
 	
 	/* Page label */
@@ -282,6 +285,13 @@ ev_spawn (const char     *uri,
 		break;
 	}
 
+#ifdef G_OS_WIN32
+// Work around for not working g_app_info_create_from_commandline ();
+	g_string_append_printf (cmd, " %s", uri);
+	cmdline = g_string_free (cmd, FALSE);
+	g_spawn_command_line_async (cmdline, &error);
+#else
+
 	cmdline = g_string_free (cmd, FALSE);
 	app = g_app_info_create_from_commandline (cmdline, NULL, 0, &error);
 
@@ -307,6 +317,7 @@ ev_spawn (const char     *uri,
 		g_object_unref (app);
 		g_object_unref (ctx);
 	}
+#endif
 
 	if (error != NULL) {
 		g_printerr ("Error launching evince %s: %s\n", uri, error->message);
-- 
1.7.5.4

openSUSE Build Service is sponsored by