[gnome-builder] terminal: propagate text-inserted signal
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] terminal: propagate text-inserted signal
- Date: Mon, 6 May 2019 20:22:56 +0000 (UTC)
commit 6aa4b02dccdae368539eee6d0d50b2b547462567
Author: Christian Hergert <chergert redhat com>
Date: Mon May 6 13:19:57 2019 -0700
terminal: propagate text-inserted signal
This can be used to track changes while the terminal is not
currently the foreground.
src/libide/terminal/ide-terminal-page.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
---
diff --git a/src/libide/terminal/ide-terminal-page.c b/src/libide/terminal/ide-terminal-page.c
index 63d0deb56..18e7e457d 100644
--- a/src/libide/terminal/ide-terminal-page.c
+++ b/src/libide/terminal/ide-terminal-page.c
@@ -52,7 +52,13 @@ enum {
N_PROPS
};
+enum {
+ TEXT_INSERTED,
+ N_SIGNALS
+};
+
static GParamSpec *properties [N_PROPS];
+static guint signals [N_SIGNALS];
static void ide_terminal_page_connect_terminal (IdeTerminalPage *self,
VteTerminal *terminal);
@@ -370,6 +376,13 @@ ide_terminal_page_context_set (GtkWidget *widget,
self->launcher = ide_terminal_launcher_new (context);
}
+static void
+ide_terminal_page_on_text_inserted_cb (IdeTerminalPage *self,
+ VteTerminal *terminal)
+{
+ g_signal_emit (self, signals [TEXT_INSERTED], 0);
+}
+
static void
ide_terminal_page_finalize (GObject *object)
{
@@ -512,6 +525,18 @@ ide_terminal_page_class_init (IdeTerminalPageClass *klass)
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
+
+ signals [TEXT_INSERTED] =
+ g_signal_new ("text-inserted",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+ g_signal_set_va_marshaller (signals [TEXT_INSERTED],
+ G_TYPE_FROM_CLASS (klass),
+ g_cclosure_marshal_VOID__VOIDv);
}
static void
@@ -530,6 +555,12 @@ ide_terminal_page_init (IdeTerminalPage *self)
gtk_widget_init_template (GTK_WIDGET (self));
+ g_signal_connect_object (self->terminal_top,
+ "text-inserted",
+ G_CALLBACK (ide_terminal_page_on_text_inserted_cb),
+ self,
+ G_CONNECT_SWAPPED);
+
ide_page_set_icon_name (IDE_PAGE (self), "utilities-terminal-symbolic");
ide_page_set_can_split (IDE_PAGE (self), TRUE);
ide_page_set_menu_id (IDE_PAGE (self), "ide-terminal-page-document-menu");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]