From 7f09fc152737d466464b94a921ee28df6fc7f6ea Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Sat, 19 Jan 2008 19:29:16 -0800 Subject: [PATCH] [Terminal] Add RunCommand method to the DBus API The RunCommand method allows users to send arbitrary text over DBus, and have it entered into the terminal as if they had typed it themselves. This is a feature which was requested by Chris Ward. Thanks! --- tilda-terminal.c | 12 ++++++++++++ tilda-terminal.h | 1 + tilda-terminal.xml | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/tilda-terminal.c b/tilda-terminal.c index 91921d2..12c08af 100644 --- a/tilda-terminal.c +++ b/tilda-terminal.c @@ -22,6 +22,18 @@ tilda_terminal_dbus_register_object (TildaTerminal *tt) g_free (object_path); } +gboolean +tilda_terminal_run_command (TildaTerminal *self, gchar *command, GError **error) +{ + debug_enter (); + debug_assert (TILDA_IS_TERMINAL(self)); + + vte_terminal_feed_child (VTE_TERMINAL(self->vte_term), command, -1); + vte_terminal_feed_child (VTE_TERMINAL(self->vte_term), "\n", -1); + + return TRUE; +} + /** * Start the current tt->shell in the given TildaTerminal * NOTE: this will kill whatever is running in the terminal, diff --git a/tilda-terminal.h b/tilda-terminal.h index 9abff00..81815f0 100644 --- a/tilda-terminal.h +++ b/tilda-terminal.h @@ -80,6 +80,7 @@ struct _TildaTerminalClass { GType tilda_terminal_get_type (void); /* API */ +gboolean tilda_terminal_run_command (TildaTerminal *self, gchar *command, GError **error); #endif /* TILDA_TERMINAL_H */ diff --git a/tilda-terminal.xml b/tilda-terminal.xml index f17c40f..0818981 100644 --- a/tilda-terminal.xml +++ b/tilda-terminal.xml @@ -5,6 +5,11 @@ + + + + + -- 2.34.1