[gnome-builder] terminal: note when application exits



commit f9a92ab0b68400c698d0be688e7a8117c02fc019
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jan 14 21:24:59 2018 -0800

    terminal: note when application exits
    
    Give the user some sort of output that the application exited. We might
    still want to add the ability to know how or why it exited (signal or
    exit status), but this gives us something for now.
    
    Fixes #260

 src/plugins/terminal/gb-terminal-workbench-addin.c | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)
---
diff --git a/src/plugins/terminal/gb-terminal-workbench-addin.c 
b/src/plugins/terminal/gb-terminal-workbench-addin.c
index 64a7e6d7d..b927a3c23 100644
--- a/src/plugins/terminal/gb-terminal-workbench-addin.c
+++ b/src/plugins/terminal/gb-terminal-workbench-addin.c
@@ -181,6 +181,16 @@ failure:
   IDE_EXIT;
 }
 
+static void
+on_run_manager_stopped (GbTerminalWorkbenchAddin *self,
+                        IdeRunManager            *run_manager)
+{
+  g_assert (GB_IS_TERMINAL_WORKBENCH_ADDIN (self));
+  g_assert (IDE_IS_RUN_MANAGER (run_manager));
+
+  gb_terminal_view_feed (self->run_terminal, _("Application exited\r\n"));
+}
+
 static const DzlShortcutEntry gb_terminal_shortcut_entries[] = {
   { "org.gnome.builder.workbench.new-terminal",
     0, NULL,
@@ -281,6 +291,11 @@ gb_terminal_workbench_addin_load (IdeWorkbenchAddin *addin,
                            G_CALLBACK (on_run_manager_run),
                            self,
                            G_CONNECT_SWAPPED);
+  g_signal_connect_object (run_manager,
+                           "stopped",
+                           G_CALLBACK (on_run_manager_stopped),
+                           self,
+                           G_CONNECT_SWAPPED);
 }
 
 static void
@@ -288,12 +303,24 @@ gb_terminal_workbench_addin_unload (IdeWorkbenchAddin *addin,
                                     IdeWorkbench      *workbench)
 {
   GbTerminalWorkbenchAddin *self = (GbTerminalWorkbenchAddin *)addin;
+  IdeRunManager *run_manager;
+  IdeContext *context;
 
   g_assert (GB_IS_TERMINAL_WORKBENCH_ADDIN (self));
 
   g_action_map_remove_action (G_ACTION_MAP (self->workbench), "new-terminal");
   g_action_map_remove_action (G_ACTION_MAP (self->workbench), "new-terminal-in-runtime");
 
+  context = ide_workbench_get_context (workbench);
+
+  run_manager = ide_context_get_run_manager (context);
+  g_signal_handlers_disconnect_by_func (run_manager,
+                                        G_CALLBACK (on_run_manager_run),
+                                        self);
+  g_signal_handlers_disconnect_by_func (run_manager,
+                                        G_CALLBACK (on_run_manager_stopped),
+                                        self);
+
   if (self->panel_dock_widget != NULL)
     {
       gtk_widget_destroy (self->panel_dock_widget);


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