1 /* 2 * This is free software; you can redistribute it and/or modify it under 3 * the terms of the GNU Library General Public License as published by 4 * the Free Software Foundation; either version 2 of the License, or 5 * (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, but 8 * WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 * General Public License for more details. 11 * 12 * You should have received a copy of the GNU Library General Public 13 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 14 */ 15 16 #ifndef TILDA_TERMINALN_H 17 #define TILDA_TERMINALN_H 18 19 #include "tilda_window.h" 20 #include "tilda-palettes.h" 21 22 #include <gtk/gtk.h> 23 24 G_BEGIN_DECLS 25 26 typedef struct tilda_term_ tilda_term; 27 28 struct tilda_term_ 29 { 30 GtkWidget *vte_term; 31 GtkWidget *hbox; 32 GtkWidget *scrollbar; 33 GRegex *http_regexp; 34 GPid pid; 35 /* We remember if we have already dropped to the default 36 * shell before, if so, then we know that this time we can 37 * exit the program. 38 */ 39 gboolean dropped_to_default_shell; 40 gchar *initial_working_dir; 41 42 struct tilda_window_ *tw; 43 }; 44 45 enum tilda_term_scrollbar_positions { RIGHT, LEFT, DISABLED }; 46 enum delete_keys { ASCII_DELETE, DELETE_SEQUENCE, ASCII_BACKSPACE, AUTO }; 47 48 /** 49 * tilda_term_init () 50 * 51 * Initialize and return a new struct tilda_term_. 52 * 53 * @param tw The main tilda window, which must be initialized. 54 * 55 * Success: return a non-NULL struct tilda_term_ *. 56 * Failure: return NULL. 57 * 58 * Notes: you must call tilda_term_free() on the returned struct tilda_term_ 59 * when you are finished using it, and it has been removed from all GTK 60 * structures, such as the notebook. 61 */ 62 struct tilda_term_ *tilda_term_init (struct tilda_window_ *tw); 63 64 /** 65 * tilda_term_free () 66 * 67 * Free a struct tilda_term_* created with tilda_term_init (). This will 68 * clean up any memory allocations that were made to create the object. It 69 * should only be called when there is no more need to access the object. 70 * 71 * Success: return 0 72 * Failure: return non-zero 73 */ 74 gint tilda_term_free (struct tilda_term_ *term); 75 76 77 void tilda_term_set_scrollbar_position (tilda_term *tt, enum tilda_term_scrollbar_positions pos); 78 char* tilda_term_get_cwd(tilda_term* tt); 79 80 81 /* Adjust the font-size scale for the terminal */ 82 void tilda_term_adjust_font_scale(tilda_term *term, gdouble scale); 83 84 gchar * tilda_terminal_get_full_title (tilda_term *tt); 85 gchar * tilda_terminal_get_title (tilda_term *tt); 86 87 #define TILDA_TERM(tt) ((tilda_term *)(tt)) 88 89 G_END_DECLS 90 91 /* vim: set ts=4 sts=4 sw=4 expandtab: */ 92 93 #endif /* TILDA_TERMINALN_H */ 94 95