return TRUE;
}
+/**
+ * Called when the child process running in the VteTerminal exits.
+ */
+static void
+child_exited_cb (GtkWidget *widget, gpointer data)
+{
+ TildaTerminal *self = TILDA_TERMINAL(data);
+
+ /* These can stay here. They don't need to go into a header because
+ * they are only used at this point in the code. */
+ enum exit_actions { HOLD_TERMINAL_OPEN, RESTART_COMMAND, EXIT_TERMINAL };
+
+ /* Check the user's preference for what to do when the child terminal
+ * is closed. Take the appropriate action */
+ switch (self->exit_action)
+ {
+ case EXIT_TERMINAL:
+ tilda_window_remove_term (TILDA_WINDOW(self->parent_window), self->number);
+ break;
+ case RESTART_COMMAND:
+ vte_terminal_feed (VTE_TERMINAL(self->vte_term), "\r\n\r\n", 4);
+ tilda_terminal_start_shell (self);
+ break;
+ case HOLD_TERMINAL_OPEN:
+ break;
+ default:
+ break;
+ }
+}
+
/*******************************************************************************
* All GObject stuff is below. You probably don't need to change this...
******************************************************************************/
case TILDA_TERMINAL_MOUSE_AUTOHIDE:
g_value_set_boolean (value, self->mouse_autohide);
- break;
default:
/* We don't have this property... */
gtk_widget_show (self->scrollbar);
+ /* Connect Signals */
g_signal_connect (G_OBJECT(self->vte_term), "child-exited",
- G_CALLBACK(gtk_main_quit), self);
+ G_CALLBACK(child_exited_cb), self);
+ g_signal_connect (G_OBJECT(self->vte_term), "eof",
+ G_CALLBACK(child_exited_cb), self);
tilda_terminal_start_shell (self);
tilda_terminal_dbus_register_object (self);