[gnome-builder/wip/gtk4-port: 1233/1774] plugins/vcsui: add terminal widget
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 1233/1774] plugins/vcsui: add terminal widget
- Date: Mon, 11 Jul 2022 22:31:39 +0000 (UTC)
commit f4b678f5559262d9d5e9494487269d1a011c32cc
Author: Christian Hergert <chergert redhat com>
Date: Mon May 30 13:21:14 2022 -0700
plugins/vcsui: add terminal widget
We'll end up hiding this by default, and show it while the operation is
in progress. Using a terminal will allow us to have a PTY attached which
can be useful for output from Git.
src/plugins/vcsui/gbp-vcsui-clone-page.c | 9 +++++++++
src/plugins/vcsui/gbp-vcsui-clone-page.ui | 23 +++++++++++++++++++++++
2 files changed, 32 insertions(+)
---
diff --git a/src/plugins/vcsui/gbp-vcsui-clone-page.c b/src/plugins/vcsui/gbp-vcsui-clone-page.c
index ba8c380ab..3078ffa9f 100644
--- a/src/plugins/vcsui/gbp-vcsui-clone-page.c
+++ b/src/plugins/vcsui/gbp-vcsui-clone-page.c
@@ -25,6 +25,7 @@
#include <glib/gi18n.h>
#include <adwaita.h>
+#include <vte/vte.h>
#include <libide-projects.h>
@@ -38,6 +39,7 @@ struct _GbpVcsuiClonePage
AdwEntryRow *location_row;
AdwEntryRow *author_name_row;
AdwEntryRow *author_email_row;
+ VteTerminal *terminal;
};
G_DEFINE_FINAL_TYPE (GbpVcsuiClonePage, gbp_vcsui_clone_page, GTK_TYPE_WIDGET)
@@ -135,19 +137,26 @@ gbp_vcsui_clone_page_class_init (GbpVcsuiClonePageClass *klass)
gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, location_row);
gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, author_name_row);
gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, author_email_row);
+ gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, terminal);
gtk_widget_class_bind_template_callback (widget_class, location_row_changed_cb);
gtk_widget_class_install_action (widget_class, "clone-page.select-folder", NULL, select_folder_action);
+
+ g_type_ensure (VTE_TYPE_TERMINAL);
}
static void
gbp_vcsui_clone_page_init (GbpVcsuiClonePage *self)
{
g_autofree char *projects_dir = ide_path_collapse (ide_get_projects_dir ());
+ static GdkRGBA transparent = {0, 0, 0, 0};
gtk_widget_init_template (GTK_WIDGET (self));
gtk_editable_set_text (GTK_EDITABLE (self->location_row), projects_dir);
gtk_editable_set_text (GTK_EDITABLE (self->author_name_row), g_get_real_name ());
+
+ vte_terminal_set_colors (self->terminal, NULL, &transparent, NULL, 0);
+ vte_terminal_feed (self->terminal, "Cloning git repository…\r\n", -1);
}
diff --git a/src/plugins/vcsui/gbp-vcsui-clone-page.ui b/src/plugins/vcsui/gbp-vcsui-clone-page.ui
index 510fcc3ab..a8bc73703 100644
--- a/src/plugins/vcsui/gbp-vcsui-clone-page.ui
+++ b/src/plugins/vcsui/gbp-vcsui-clone-page.ui
@@ -124,6 +124,29 @@
</style>
</object>
</child>
+ <child>
+ <object class="GtkFrame">
+ <style>
+ <class name="card"/>
+ </style>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="min-content-height">100</property>
+ <property name="max-content-height">300</property>
+ <property name="vscrollbar-policy">external</property>
+ <property name="hscrollbar-policy">never</property>
+ <child>
+ <object class="VteTerminal" id="terminal">
+ <property name="margin-top">9</property>
+ <property name="margin-bottom">9</property>
+ <property name="margin-start">9</property>
+ <property name="margin-end">9</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]