summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2018-06-16 20:27:22 +0200
committerZenWalker <[email protected]>2018-06-27 11:50:10 +0200
commit7708278f7ecdaeeffc857d2fd19ec8ab170fa3d3 (patch)
treef65892d9bebb04e85e1e8e2e938c5283aa9b1f25
parent82e48ff2f5d23d3ec7d472e62425e40bc2c66b84 (diff)
downloadmate-terminal-7708278f7ecdaeeffc857d2fd19ec8ab170fa3d3.tar.bz2
mate-terminal-7708278f7ecdaeeffc857d2fd19ec8ab170fa3d3.tar.xz
terminal-screen: avoid deprecated 'vte_terminal_spawn_sync'
-rw-r--r--configure.ac2
-rw-r--r--src/terminal-screen.c89
2 files changed, 59 insertions, 32 deletions
diff --git a/configure.ac b/configure.ac
index c5dfc0b..75f5c67 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,7 @@ AM_GLIB_GNU_GETTEXT
GLIB_REQUIRED=2.50.0
GIO_REQUIRED=2.50.0
GTK_REQUIRED=3.22.0
-VTE_REQUIRED=0.46
+VTE_REQUIRED=0.48
DCONF_REQUIRED=0.13.4
PKG_CHECK_MODULES([TERM],
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index 73fa9ae..037d247 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1487,6 +1487,49 @@ info_bar_response_cb (GtkWidget *info_bar,
}
}
+static void handle_error_child (TerminalScreen *screen,
+ GError *err)
+{
+ GtkWidget *info_bar;
+
+ info_bar = terminal_info_bar_new (GTK_MESSAGE_ERROR,
+ _("_Profile Preferences"), RESPONSE_EDIT_PROFILE,
+ _("_Relaunch"), RESPONSE_RELAUNCH,
+ NULL);
+ terminal_info_bar_format_text (TERMINAL_INFO_BAR (info_bar),
+ _("There was an error creating the child process for this terminal"));
+ terminal_info_bar_format_text (TERMINAL_INFO_BAR (info_bar),
+ "%s", err->message);
+ g_signal_connect (info_bar, "response",
+ G_CALLBACK (info_bar_response_cb), screen);
+
+ gtk_box_pack_start (GTK_BOX (terminal_screen_container_get_from_screen (screen)),
+ info_bar, FALSE, FALSE, 0);
+ gtk_info_bar_set_default_response (GTK_INFO_BAR (info_bar), GTK_RESPONSE_CANCEL);
+ gtk_widget_show (info_bar);
+
+ g_error_free (err);
+}
+
+static void term_spawn_callback (GtkWidget *terminal,
+ GPid pid,
+ GError *error,
+ gpointer user_data)
+{
+ TerminalScreen *screen = TERMINAL_SCREEN (terminal);
+
+ if (error)
+ {
+ handle_error_child (screen, error);
+ g_error_free (error);
+ }
+ else
+ {
+ TerminalScreenPrivate *priv = screen->priv;
+ priv->child_pid = pid;
+ }
+}
+
static gboolean
terminal_screen_launch_child_cb (TerminalScreen *screen)
{
@@ -1499,7 +1542,6 @@ terminal_screen_launch_child_cb (TerminalScreen *screen)
const char *working_dir;
VtePtyFlags pty_flags = VTE_PTY_DEFAULT;
GSpawnFlags spawn_flags = 0;
- GPid pid;
priv->launch_child_source_id = 0;
@@ -1521,36 +1563,9 @@ terminal_screen_launch_child_cb (TerminalScreen *screen)
if (!terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_UPDATE_RECORDS))
pty_flags |= VTE_PTY_NO_UTMP | VTE_PTY_NO_WTMP;
- if (!get_child_command (screen, shell, &spawn_flags, &argv, &err) ||
- !vte_terminal_spawn_sync (
- terminal,
- pty_flags,
- working_dir,
- argv,
- env,
- spawn_flags,
- NULL, NULL,
- &pid,
- NULL,
- &err))
+ if (!get_child_command (screen, shell, &spawn_flags, &argv, &err))
{
- GtkWidget *info_bar;
-
- info_bar = terminal_info_bar_new (GTK_MESSAGE_ERROR,
- _("_Profile Preferences"), RESPONSE_EDIT_PROFILE,
- _("_Relaunch"), RESPONSE_RELAUNCH,
- NULL);
- terminal_info_bar_format_text (TERMINAL_INFO_BAR (info_bar),
- _("There was an error creating the child process for this terminal"));
- terminal_info_bar_format_text (TERMINAL_INFO_BAR (info_bar),
- "%s", err->message);
- g_signal_connect (info_bar, "response",
- G_CALLBACK (info_bar_response_cb), screen);
-
- gtk_box_pack_start (GTK_BOX (terminal_screen_container_get_from_screen (screen)),
- info_bar, FALSE, FALSE, 0);
- gtk_info_bar_set_default_response (GTK_INFO_BAR (info_bar), GTK_RESPONSE_CANCEL);
- gtk_widget_show (info_bar);
+ handle_error_child (screen, err);
g_error_free (err);
g_strfreev (env);
@@ -1559,7 +1574,19 @@ terminal_screen_launch_child_cb (TerminalScreen *screen)
return FALSE;
}
- priv->child_pid = pid;
+ vte_terminal_spawn_async (terminal,
+ pty_flags,
+ working_dir,
+ argv,
+ env,
+ spawn_flags,
+ NULL,
+ NULL,
+ NULL,
+ -1,
+ NULL,
+ (VteTerminalSpawnAsyncCallback) term_spawn_callback,
+ NULL);
g_free (shell);
g_strfreev (argv);