X-Git-Url: https://irasnyder.com/gitweb/?a=blobdiff_plain;f=tilda-terminal.c;h=14567dab471d15d6622f47c345131a745b0ed476;hb=93db48f0c2f7a1185d4da9d9ab7cde83b9a3aa94;hp=d35344b493d92e67c849e23dd06db4127983e06d;hpb=44782eff888e6eb99f44ca6dac9cb552fb31ca23;p=tilda-gobject.git diff --git a/tilda-terminal.c b/tilda-terminal.c index d35344b..14567da 100644 --- a/tilda-terminal.c +++ b/tilda-terminal.c @@ -22,6 +22,31 @@ 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; +} + +gboolean +tilda_terminal_close (TildaTerminal *self, GError **error) +{ + debug_enter (); + debug_assert (TILDA_IS_TERMINAL(self)); + + TildaWindow *parent_window = TILDA_WINDOW(self->parent_window); + + tilda_window_remove_terminal (parent_window, self->number); + + return TRUE; +} + /** * Start the current tt->shell in the given TildaTerminal * NOTE: this will kill whatever is running in the terminal, @@ -119,7 +144,7 @@ tilda_terminal_child_exited_cb (GtkWidget *widget, gpointer data) switch (self->exit_action) { case EXIT_TERMINAL: - tilda_window_remove_term (TILDA_WINDOW(self->parent_window), self->number); + tilda_window_remove_terminal (TILDA_WINDOW(self->parent_window), self->number); break; case RESTART_COMMAND: vte_terminal_feed (VTE_TERMINAL(self->vte_term), "\r\n\r\n", 4); @@ -333,7 +358,7 @@ static GObjectClass *parent_class = NULL; enum tilda_terminal_properties { TILDA_TERMINAL_NUMBER = 1, - TILDA_TERMINAL_TW, + TILDA_TERMINAL_PARENT_WINDOW, /* All non-constructor-only properties */ TILDA_TERMINAL_BACKGROUND_IMAGE, @@ -397,7 +422,7 @@ tilda_terminal_set_property (GObject *object, debug_printf ("terminal number: %d\n", self->number); break; - case TILDA_TERMINAL_TW: + case TILDA_TERMINAL_PARENT_WINDOW: self->parent_window = g_value_get_pointer (value); debug_printf ("terminal parent window: 0x%x\n", self->parent_window); break; @@ -566,7 +591,7 @@ tilda_terminal_get_property (GObject *object, g_value_set_int (value, self->number); break; - case TILDA_TERMINAL_TW: + case TILDA_TERMINAL_PARENT_WINDOW: g_value_set_pointer (value, self->parent_window); break; @@ -687,9 +712,7 @@ tilda_terminal_constructor (GType type, construct_properties); /* Do other stuff here. The object is ready to go now, and all - * ctor properties have been set. - * - * TODO: This is the place to do DBus-init */ + * ctor properties have been set. */ self = TILDA_TERMINAL(obj); /* Pack into the hbox */ @@ -756,8 +779,6 @@ tilda_terminal_finalize (GObject *obj) * Here, complete object destruction. * You might not need to do much... */ - - // TODO: g_free() any primitives here g_free (self->background_image); g_free (self->shell); g_free (self->font); @@ -793,8 +814,8 @@ tilda_terminal_class_init (gpointer g_class, /* Install all of the properties */ pspec = g_param_spec_int ("number", - "Terminal number", - "Set terminal's number", + _("Terminal number"), + NULL, 0, // min value INT_MAX, // max value 0, // def value @@ -805,17 +826,17 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_pointer ("parent-window", - "Pointer to terminal's parent TildaWindow", - "Set the pointer to the terminal's parent TildaWindow", + _("Pointer to terminal's parent TildaWindow"), + NULL, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE); g_object_class_install_property (gobject_class, - TILDA_TERMINAL_TW, + TILDA_TERMINAL_PARENT_WINDOW, pspec); pspec = g_param_spec_string ("background-image", - "Terminal's background image", - "Get/Set terminal's background image", + _("Terminal's background image"), + NULL, NULL, G_PARAM_READWRITE); @@ -824,8 +845,8 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_string ("shell", - "Terminal's shell", - "Get/Set terminal's shell", + _("Terminal's shell"), + NULL, NULL, G_PARAM_READWRITE); @@ -834,8 +855,8 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_string ("font", - "Terminal's font", - "Get/Set terminal's font", + _("Terminal's font"), + NULL, NULL, G_PARAM_READWRITE); @@ -844,8 +865,8 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_string ("title", - "Terminal's title", - "Get/Set terminal's title", + _("Terminal's title"), + NULL, NULL, G_PARAM_READWRITE); @@ -854,8 +875,8 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_string ("working-directory", - "Terminal's initial working directory", - "Get/Set terminal's initial working directory", + _("Terminal's initial working directory"), + NULL, NULL, G_PARAM_READWRITE); @@ -864,7 +885,7 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_string ("web-browser", - "Terminal's web browser command", + _("Terminal's web browser command"), NULL, NULL, G_PARAM_READWRITE); @@ -874,8 +895,8 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_int ("scrollback-lines", - "Terminal's scrollback amount (lines)", - "Get/Set terminal's scrollback amount", + _("Terminal's scrollback amount (lines)"), + NULL, 0, INT_MAX, // TODO: artificially limit this? 1000, @@ -886,8 +907,8 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_int ("transparency-percent", - "Terminal's transparency (percent)", - "Get/Set terminal's transparency", + _("Terminal's transparency (percent)"), + NULL, 0, 100, 0, @@ -898,8 +919,8 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_int ("backspace-binding", - "Terminal's backspace binding", - "Get/Set terminal's backspace key binding", + _("Terminal's backspace binding"), + NULL, VTE_ERASE_AUTO, VTE_ERASE_DELETE_SEQUENCE, VTE_ERASE_AUTO, @@ -910,8 +931,8 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_int ("delete-binding", - "Terminal's delete binding", - "Get/Set terminal's delete key binding", + _("Terminal's delete binding"), + NULL, VTE_ERASE_AUTO, VTE_ERASE_DELETE_SEQUENCE, VTE_ERASE_AUTO, @@ -922,8 +943,8 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_int ("dynamic-title", - "Terminal's dynamic title generation method", - "Get/Set terminal's dynamic title generation method", + _("Terminal's dynamic title generation method"), + NULL, 0, INT_MAX, 0, @@ -934,8 +955,8 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_int ("exit-action", - "Terminal's action upon child exit", - "Get/Set terminal's action upon child exit", + _("Terminal's action upon child exit"), + NULL, 0, INT_MAX, 0, @@ -946,7 +967,7 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_int ("scrollbar-position", - "Terminal's scrollbar position", + _("Terminal's scrollbar position"), NULL, 0, INT_MAX, @@ -958,8 +979,8 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_boolean ("scroll-background", - "Controls terminal's scrolling behavior", - "Get/Set terminal's scrolling behavior", + _("Controls terminal's scrolling behavior"), + NULL, FALSE, G_PARAM_READWRITE); @@ -968,8 +989,8 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_boolean ("scroll-on-output", - "Controls terminal's scrolling behavior on output", - "Get/Set terminal's scrolling behavior on output", + _("Controls terminal's scrolling behavior on output"), + NULL, FALSE, G_PARAM_READWRITE); @@ -978,7 +999,7 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_boolean ("scroll-on-keystroke", - "Controls the terminal's scrolling behavior on keystroke", + _("Controls the terminal's scrolling behavior on keystroke"), NULL, FALSE, G_PARAM_READWRITE); g_object_class_install_property (gobject_class, @@ -986,7 +1007,7 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_boolean ("antialiased", - "Attempt to antialias fonts", + _("Attempt to antialias fonts"), NULL, FALSE, G_PARAM_READWRITE); g_object_class_install_property (gobject_class, @@ -994,7 +1015,7 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_boolean ("allow-bold-text", - "Allow bold text", + _("Allow bold text"), NULL, FALSE, G_PARAM_READWRITE); g_object_class_install_property (gobject_class, @@ -1002,35 +1023,40 @@ tilda_terminal_class_init (gpointer g_class, pspec); pspec = g_param_spec_boolean ("cursor-blinks", - NULL, NULL, FALSE, G_PARAM_READWRITE); + _("Enable cursor blinking"), + NULL, FALSE, G_PARAM_READWRITE); g_object_class_install_property (gobject_class, TILDA_TERMINAL_CURSOR_BLINKS, pspec); pspec = g_param_spec_boolean ("audible-bell", - NULL, NULL, FALSE, G_PARAM_READWRITE); + _("Enable the audible bell"), + NULL, FALSE, G_PARAM_READWRITE); g_object_class_install_property (gobject_class, TILDA_TERMINAL_AUDIBLE_BELL, pspec); pspec = g_param_spec_boolean ("visible-bell", - NULL, NULL, FALSE, G_PARAM_READWRITE); + _("Enable the visible bell"), + NULL, FALSE, G_PARAM_READWRITE); g_object_class_install_property (gobject_class, TILDA_TERMINAL_VISIBLE_BELL, pspec); pspec = g_param_spec_boolean ("double-buffered", - NULL, NULL, FALSE, G_PARAM_READWRITE); + _("Double buffer the terminal"), + NULL, FALSE, G_PARAM_READWRITE); g_object_class_install_property (gobject_class, TILDA_TERMINAL_DOUBLE_BUFFERED, pspec); pspec = g_param_spec_boolean ("mouse-autohide", - NULL, NULL, FALSE, G_PARAM_READWRITE); + _("Hide the mouse cursor while typing"), + NULL, FALSE, G_PARAM_READWRITE); g_object_class_install_property (gobject_class, TILDA_TERMINAL_MOUSE_AUTOHIDE,