Commit cf180c07 authored by Christian Hergert's avatar Christian Hergert
Browse files

buildui: track changes to pty window title

We can track the changes in the terminal widget's interpretation
of the pty to update messages in the pipeline. We still need
more logic to determine when to use these messages.
parent d0b0bbf8
......@@ -169,6 +169,13 @@ struct _IdeBuildPipeline
VtePty *pty;
int pty_slave;
/*
* If the terminal interpreting our Pty has received a terminal
* title update, it might set this message which we can use for
* better build messages.
*/
gchar *message;
/*
* No reference to the current stage. It is only available during
* the asynchronous execution of the stage.
......@@ -983,6 +990,7 @@ ide_build_pipeline_dispose (GObject *object)
ide_build_pipeline_unload (self);
g_clear_pointer (&self->message, g_free);
g_clear_object (&self->pty);
if (self->pty_slave != -1)
......@@ -2989,3 +2997,17 @@ ide_build_pipeline_get_can_export (IdeBuildPipeline *self)
return FALSE;
}
void
_ide_build_pipeline_set_message (IdeBuildPipeline *self,
const gchar *message)
{
g_return_if_fail (IDE_IS_BUILD_PIPELINE (self));
if (!ide_str_equal0 (message, self->message))
{
g_free (self->message);
self->message = g_strdup (message);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_MESSAGE]);
}
}
......@@ -24,6 +24,8 @@
G_BEGIN_DECLS
VtePty *_ide_build_pipeline_get_pty (IdeBuildPipeline *self);
VtePty *_ide_build_pipeline_get_pty (IdeBuildPipeline *self);
void _ide_build_pipeline_set_message (IdeBuildPipeline *self,
const gchar *message);
G_END_DECLS
......@@ -131,6 +131,22 @@ ide_build_log_panel_changed_font_name (IdeBuildLogPanel *self,
g_clear_pointer (&font_desc, pango_font_description_free);
}
static void
ide_build_log_panel_window_title_changed (IdeBuildLogPanel *self,
IdeTerminal *terminal)
{
g_assert (IDE_IS_BUILD_LOG_PANEL (self));
g_assert (VTE_IS_TERMINAL (terminal));
if (self->pipeline != NULL)
{
const gchar *title;
title = vte_terminal_get_window_title (VTE_TERMINAL (terminal));
_ide_build_pipeline_set_message (self->pipeline, title);
}
}
static void
ide_build_log_panel_finalize (GObject *object)
{
......@@ -300,6 +316,12 @@ ide_build_log_panel_init (IdeBuildLogPanel *self)
gtk_widget_init_template (GTK_WIDGET (self));
g_signal_connect_object (self->terminal,
"window-title-changed",
G_CALLBACK (ide_build_log_panel_window_title_changed),
self,
G_CONNECT_SWAPPED);
gtk_range_set_adjustment (GTK_RANGE (self->scrollbar),
gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (self->terminal)));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment