]> www.fi.muni.cz Git - evince.git/commitdiff
shell: Use GAppInfo to launch evince-previewer instead of gdk_spawn
authorCosimo Cecchi <cosimoc@gnome.org>
Thu, 23 Dec 2010 17:07:53 +0000 (18:07 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Thu, 23 Dec 2010 17:16:48 +0000 (18:16 +0100)
shell/main.c

index 7d4fb0d317b723f8e713a2deaa8a23b3a6b93e0d..ab4b8dfb9ab06fbda8701680168cd052a576eb66 100644 (file)
@@ -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;
 }