[Xfce4-commits] <terminal:master> Work around deprecated API in vte 0.26.

Nick Schermer noreply at xfce.org
Sun Jan 30 14:36:03 CET 2011


Updating branch refs/heads/master
         to ef462b1a24384045dc815d602e006b8040b2b382 (commit)
       from f636a4bd8f8035bc339892854790bdb8aad20564 (commit)

commit ef462b1a24384045dc815d602e006b8040b2b382
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Jan 30 13:41:39 2011 +0100

    Work around deprecated API in vte 0.26.

 terminal/terminal-screen.c |   42 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 7e80461..7298425 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -1320,11 +1320,16 @@ terminal_screen_update_label_orientation (TerminalScreen *screen)
 void
 terminal_screen_launch_child (TerminalScreen *screen)
 {
-  gboolean update;
-  GError  *error = NULL;
-  gchar   *command;
-  gchar  **argv;
-  gchar  **env;
+  gboolean      update;
+  GError       *error = NULL;
+  gchar        *command;
+  gchar       **argv;
+  gchar       **env;
+#if VTE_CHECK_VERSION (0, 26, 0)
+  gchar       **argv2;
+  guint         i;
+  GSpawnFlags   spawn_flags = G_SPAWN_CHILD_INHERITS_STDIN | G_SPAWN_SEARCH_PATH;
+#endif
 
   terminal_return_if_fail (TERMINAL_IS_SCREEN (screen));
 
@@ -1344,13 +1349,38 @@ terminal_screen_launch_child (TerminalScreen *screen)
       g_object_get (G_OBJECT (screen->preferences),
                     "command-update-records", &update,
                     NULL);
-
       env = terminal_screen_get_child_environment (screen);
 
+#if VTE_CHECK_VERSION (0, 26, 0)
+      argv2 = g_new0 (gchar *, g_strv_length (argv) + 2);
+      argv2[0] = command;
+
+      if (argv != NULL)
+        {
+          for (i = 0; argv[i] != NULL; i++)
+            argv2[i + 1] = argv[i];
+
+          spawn_flags |= G_SPAWN_FILE_AND_ARGV_ZERO;
+        }
+
+      if (!vte_terminal_fork_command_full (VTE_TERMINAL (screen->terminal),
+                                           update ? VTE_PTY_DEFAULT : VTE_PTY_NO_LASTLOG | VTE_PTY_NO_UTMP | VTE_PTY_NO_WTMP,
+                                           screen->working_directory, argv2, env, 
+                                           spawn_flags,
+                                           NULL, NULL,
+                                           &screen->pid, &error))
+        {
+          terminal_dialogs_show_error (GTK_WIDGET (screen), error, _("Failed to execute child"));
+          g_error_free (error);
+        }
+
+      g_free (argv2);
+#else
       screen->pid = vte_terminal_fork_command (VTE_TERMINAL (screen->terminal),
                                                command, argv, env,
                                                screen->working_directory,
                                                update, update, update);
+#endif
 
       g_strfreev (argv);
       g_strfreev (env);



More information about the Xfce4-commits mailing list