[Terminal] Add RunCommand method to the DBus API
authorIra W. Snyder <devel@irasnyder.com>
Sun, 20 Jan 2008 03:29:16 +0000 (19:29 -0800)
committerIra W. Snyder <devel@irasnyder.com>
Sun, 20 Jan 2008 03:29:16 +0000 (19:29 -0800)
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
tilda-terminal.h
tilda-terminal.xml

index 91921d2..12c08af 100644 (file)
@@ -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,
index 9abff00..81815f0 100644 (file)
@@ -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 */
 
index f17c40f..0818981 100644 (file)
@@ -5,6 +5,11 @@
        <interface name="net.sourceforge.Tilda.Window.Terminal">
                <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="tilda_terminal" />
 
+       <method name="RunCommand">
+               <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="tilda_terminal_run_command" />
+               <arg type="s" name="command" direction="in" />
+       </method>
+
        </interface>
 </node>