[gnome-builder] terminal: add (Exited) when subprocess exits



commit b97c1c7654e467df65f79f417493b2d6ca13ff73
Author: Christian Hergert <chergert redhat com>
Date:   Tue Aug 6 11:33:40 2019 -0700

    terminal: add (Exited) when subprocess exits
    
    This is useful to notify the user the subprocess has exited and cannot
    be interactived with further.
    
    Fixes #1001

 src/libide/terminal/ide-terminal-page-private.h |  1 +
 src/libide/terminal/ide-terminal-page.c         | 11 +++++++++++
 2 files changed, 12 insertions(+)
---
diff --git a/src/libide/terminal/ide-terminal-page-private.h b/src/libide/terminal/ide-terminal-page-private.h
index 11be8da3e..b4a169e09 100644
--- a/src/libide/terminal/ide-terminal-page-private.h
+++ b/src/libide/terminal/ide-terminal-page-private.h
@@ -49,6 +49,7 @@ struct _IdeTerminalPage
   guint                respawn_on_exit : 1;
   guint                close_on_exit : 1;
   guint                needs_attention : 1;
+  guint                exited : 1;
 };
 
 G_END_DECLS
diff --git a/src/libide/terminal/ide-terminal-page.c b/src/libide/terminal/ide-terminal-page.c
index 6e32674c1..c1774da45 100644
--- a/src/libide/terminal/ide-terminal-page.c
+++ b/src/libide/terminal/ide-terminal-page.c
@@ -92,12 +92,21 @@ ide_terminal_page_spawn_cb (GObject      *object,
   IdeTerminalLauncher *launcher = (IdeTerminalLauncher *)object;
   g_autoptr(IdeTerminalPage) self = user_data;
   g_autoptr(GError) error = NULL;
+  g_autofree gchar *title = NULL;
   gint64 now;
 
   g_assert (IDE_IS_TERMINAL_LAUNCHER (launcher));
   g_assert (G_IS_ASYNC_RESULT (result));
   g_assert (IDE_IS_TERMINAL_PAGE (self));
 
+  self->exited = TRUE;
+
+  title = g_strdup_printf ("%s (%s)",
+                           ide_page_get_title (IDE_PAGE (self)) ?: _("Untitled terminal"),
+                           /* translators: exited describes that the terminal shell process has exited */
+                           _("Exited"));
+  ide_page_set_title (IDE_PAGE (self), title);
+
   if (!ide_terminal_launcher_spawn_finish (launcher, result, &error))
     {
       g_autofree gchar *format = NULL;
@@ -134,6 +143,8 @@ ide_terminal_page_spawn_cb (GObject      *object,
 
   /* Spawn our terminal and wait for it to exit */
   self->last_respawn = now;
+  self->exited = FALSE;
+  ide_page_set_title (IDE_PAGE (self), _("Untitled terminal"));
   ide_terminal_launcher_spawn_async (self->launcher,
                                      self->pty,
                                      NULL,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]