From: Cosimo Cecchi Date: Thu, 23 Dec 2010 17:07:53 +0000 (+0100) Subject: shell: Use GAppInfo to launch evince-previewer instead of gdk_spawn X-Git-Tag: EVINCE_2_91_4~13 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=fa091bc8b0aeb73ce9fc836aa45baf8b79892e3b;p=evince.git shell: Use GAppInfo to launch evince-previewer instead of gdk_spawn --- diff --git a/shell/main.c b/shell/main.c index 7d4fb0d3..ab4b8dfb 100644 --- a/shell/main.c +++ b/shell/main.c @@ -92,8 +92,6 @@ launch_previewer (void) { GString *cmd_str; gchar *cmd; - gint argc; - gchar **argv; gboolean retval = FALSE; GError *error = NULL; @@ -123,16 +121,16 @@ launch_previewer (void) } cmd = g_string_free (cmd_str, FALSE); - g_shell_parse_argv (cmd, &argc, &argv, &error); - g_free (cmd); - + if (!error) { - retval = gdk_spawn_on_screen (gdk_screen_get_default (), - NULL, argv, NULL, - G_SPAWN_SEARCH_PATH, - NULL, NULL, NULL, - &error); - g_strfreev (argv); + GAppInfo *app; + + app = g_app_info_create_from_commandline (cmd, NULL, 0, &error); + + if (app != NULL) { + retval = g_app_info_launch (app, NULL, NULL, &error); + g_object_unref (app); + } } if (error) { @@ -140,6 +138,8 @@ launch_previewer (void) g_error_free (error); } + g_free (cmd); + return retval; }