use the vte_terminal_spawn_sync wrapper

The vte_ptr_set_term function is gone, so there's no reason to create
the pty object manually.
This commit is contained in:
Daniel Micay 2014-09-21 20:33:24 -04:00
parent be4e2faf73
commit e63d868ed6
1 changed files with 5 additions and 15 deletions

View File

@ -1443,13 +1443,6 @@ int main(int argc, char **argv) {
command_argv = default_argv; command_argv = default_argv;
} }
VtePty *pty = vte_terminal_pty_new_sync(vte, VTE_PTY_DEFAULT, NULL, &error);
if (!pty) {
g_printerr("failed to create pty: %s\n", error->message);
return EXIT_FAILURE;
}
keybind_info info { keybind_info info {
GTK_WINDOW(window), vte, GTK_WINDOW(window), vte,
{gtk_entry_new(), {gtk_entry_new(),
@ -1471,8 +1464,6 @@ int main(int argc, char **argv) {
}; };
signal(SIGUSR1, [](int){ reload_config(); }); signal(SIGUSR1, [](int){ reload_config(); });
vte_terminal_set_pty(vte, pty);
GdkRGBA transparent {0, 0, 0, 0}; GdkRGBA transparent {0, 0, 0, 0};
gtk_widget_override_background_color(hint_overlay, GTK_STATE_FLAG_NORMAL, &transparent); gtk_widget_override_background_color(hint_overlay, GTK_STATE_FLAG_NORMAL, &transparent);
@ -1548,12 +1539,11 @@ int main(int argc, char **argv) {
env = g_environ_setenv(env, "TERM", term, TRUE); env = g_environ_setenv(env, "TERM", term, TRUE);
env = g_environ_setenv(env, "VTE_VERSION", "3405", TRUE); env = g_environ_setenv(env, "VTE_VERSION", "3405", TRUE);
GPid ppid; GPid child_pid;
if (g_spawn_async(nullptr, command_argv, env, if (vte_terminal_spawn_sync(vte, VTE_PTY_DEFAULT, nullptr, command_argv, env,
(GSpawnFlags)(G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH), G_SPAWN_SEARCH_PATH, nullptr, nullptr, &child_pid, nullptr,
(GSpawnChildSetupFunc)vte_pty_child_setup, pty, &error)) {
&ppid, &error)) { vte_terminal_watch_child(vte, child_pid);
vte_terminal_watch_child(vte, ppid);
} else { } else {
g_printerr("the command failed to run: %s\n", error->message); g_printerr("the command failed to run: %s\n", error->message);
return EXIT_FAILURE; return EXIT_FAILURE;