From f13cbb5444aa02045544584bb20101329cd603c3 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Thu, 23 Dec 2010 18:07:53 +0100 Subject: [PATCH] libview: Use GAppInfo to launch previewer instead of gdk_spawn --- libview/ev-print-operation.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/libview/ev-print-operation.c b/libview/ev-print-operation.c index 1c93d90f..8c96dae4 100644 --- a/libview/ev-print-operation.c +++ b/libview/ev-print-operation.c @@ -855,33 +855,34 @@ export_print_done (EvPrintOperationExport *export) g_key_file_free (key_file); if (!error) { - gint argc; - gchar **argv; gchar *cmd; gchar *quoted_filename; gchar *quoted_settings_filename; + GAppInfo *app; + GdkAppLaunchContext *ctx; quoted_filename = g_shell_quote (export->temp_file); quoted_settings_filename = g_shell_quote (print_settings_file); cmd = g_strdup_printf ("evince-previewer --unlink-tempfile --print-settings %s %s", quoted_settings_filename, quoted_filename); - g_shell_parse_argv (cmd, &argc, &argv, &error); - g_free (quoted_filename); g_free (quoted_settings_filename); - g_free (cmd); - if (!error) { - gdk_spawn_on_screen (gtk_window_get_screen (export->parent_window), - NULL, argv, NULL, - G_SPAWN_SEARCH_PATH, - NULL, NULL, NULL, - &error); - } + app = g_app_info_create_from_commandline (cmd, NULL, 0, &error); - g_strfreev (argv); - } + if (app != NULL) { + ctx = gdk_display_get_app_launch_context (gtk_widget_get_display (GTK_WIDGET (export->parent_window))); + gdk_app_launch_context_set_screen (ctx, gtk_window_get_screen (export->parent_window)); + + g_app_info_launch (app, NULL, G_APP_LAUNCH_CONTEXT (ctx), &error); + + g_object_unref (app); + g_object_unref (ctx); + } + + g_free (cmd); + } if (error) { if (print_settings_file) -- 2.43.0