1 /* terminal.c generated by valac 0.34.9, the Vala compiler
2  * generated from terminal.vala, do not modify */
3 
4 /*
5  * terminal.vala - This file is part of the Geany MultiTerm plugin
6  *
7  * Copyright (c) 2012 Matthew Brush <matt@geany.org>.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22  * MA 02110-1301, USA.
23  */
24 
25 #include <glib.h>
26 #include <glib-object.h>
27 #include "multiterm.h"
28 #include <vte/vte.h>
29 #include <stdlib.h>
30 #include <string.h>
31 #include <glib/gi18n-lib.h>
32 #include <gtk/gtk.h>
33 #include <gdk/gdk.h>
34 
35 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
36 #define _multi_term_shell_config_unref0(var) ((var == NULL) ? NULL : (var = (multi_term_shell_config_unref (var), NULL)))
37 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
38 #define _g_free0(var) (var = (g_free (var), NULL))
39 
40 struct _MultiTermTerminalPrivate {
41 	MultiTermShellConfig* sh;
42 };
43 
44 
45 static gpointer multi_term_terminal_parent_class = NULL;
46 
47 #define MULTI_TERM_TERMINAL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MULTI_TERM_TYPE_TERMINAL, MultiTermTerminalPrivate))
48 enum  {
49 	MULTI_TERM_TERMINAL_DUMMY_PROPERTY,
50 	MULTI_TERM_TERMINAL_TAB_LABEL_TEXT,
51 	MULTI_TERM_TERMINAL_BACKGROUND_COLOR,
52 	MULTI_TERM_TERMINAL_FOREGROUND_COLOR
53 };
54 static void multi_term_terminal_on_window_title_changed (MultiTermTerminal* self);
55 static void multi_term_terminal_on_vte_realize (MultiTermTerminal* self);
56 MultiTermConfig* multi_term_shell_config_get_cfg (MultiTermShellConfig* self);
57 static gboolean multi_term_terminal_on_button_press (MultiTermTerminal* self, GdkEventButton* event);
58 static gboolean _multi_term_terminal_on_button_press_gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self);
59 static void multi_term_terminal_on_child_exited (MultiTermTerminal* self);
60 static void _multi_term_terminal_on_window_title_changed_vte_terminal_window_title_changed (VteTerminal* _sender, gpointer self);
61 static void _multi_term_terminal_on_child_exited_vte_terminal_child_exited (VteTerminal* _sender, gpointer self);
62 static void _multi_term_terminal_on_vte_realize_gtk_widget_realize (GtkWidget* _sender, gpointer self);
63 static void g_cclosure_user_marshal_BOOLEAN__POINTER (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
64 static void multi_term_terminal_finalize (GObject* obj);
65 static void _vala_multi_term_terminal_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
66 static void _vala_multi_term_terminal_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
67 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
68 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
69 
70 
multi_term_terminal_on_window_title_changed(MultiTermTerminal * self)71 static void multi_term_terminal_on_window_title_changed (MultiTermTerminal* self) {
72 	VteTerminal* _tmp0_ = NULL;
73 	const gchar* _tmp1_ = NULL;
74 	const gchar* _tmp2_ = NULL;
75 	g_return_if_fail (self != NULL);
76 	_tmp0_ = self->terminal;
77 	_tmp1_ = vte_terminal_get_window_title (_tmp0_);
78 	_tmp2_ = _tmp1_;
79 	multi_term_terminal_set_tab_label_text (self, _tmp2_);
80 }
81 
82 
multi_term_terminal_run_command(MultiTermTerminal * self,const gchar * command)83 void multi_term_terminal_run_command (MultiTermTerminal* self, const gchar* command) {
84 	GPid pid = 0;
85 	gchar** argv = NULL;
86 	const gchar* _tmp0_ = NULL;
87 	gchar* _tmp1_ = NULL;
88 	gchar** _tmp2_ = NULL;
89 	gint argv_length1 = 0;
90 	gint _argv_size_ = 0;
91 	GError * _inner_error_ = NULL;
92 	g_return_if_fail (self != NULL);
93 	g_return_if_fail (command != NULL);
94 	_tmp0_ = command;
95 	_tmp1_ = g_strdup (_tmp0_);
96 	_tmp2_ = g_new0 (gchar*, 2 + 1);
97 	_tmp2_[0] = _tmp1_;
98 	_tmp2_[1] = NULL;
99 	argv = _tmp2_;
100 	argv_length1 = 2;
101 	_argv_size_ = argv_length1;
102 	{
103 		VteTerminal* _tmp3_ = NULL;
104 		GPid _tmp4_ = 0;
105 		_tmp3_ = self->terminal;
106 		vte_terminal_fork_command_full (_tmp3_, VTE_PTY_DEFAULT, NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &_tmp4_, &_inner_error_);
107 		pid = _tmp4_;
108 		if (G_UNLIKELY (_inner_error_ != NULL)) {
109 			goto __catch24_g_error;
110 		}
111 	}
112 	goto __finally24;
113 	__catch24_g_error:
114 	{
115 		GError* err = NULL;
116 		const gchar* _tmp5_ = NULL;
117 		GError* _tmp6_ = NULL;
118 		const gchar* _tmp7_ = NULL;
119 		err = _inner_error_;
120 		_inner_error_ = NULL;
121 		_tmp5_ = _ ("Unable to run command: %s");
122 		_tmp6_ = err;
123 		_tmp7_ = _tmp6_->message;
124 		g_warning (_tmp5_, _tmp7_);
125 		_g_error_free0 (err);
126 	}
127 	__finally24:
128 	if (G_UNLIKELY (_inner_error_ != NULL)) {
129 		argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
130 		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
131 		g_clear_error (&_inner_error_);
132 		return;
133 	}
134 	argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
135 }
136 
137 
_multi_term_terminal_on_button_press_gtk_widget_button_press_event(GtkWidget * _sender,GdkEventButton * event,gpointer self)138 static gboolean _multi_term_terminal_on_button_press_gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self) {
139 	gboolean result;
140 	result = multi_term_terminal_on_button_press ((MultiTermTerminal*) self, event);
141 	return result;
142 }
143 
144 
multi_term_terminal_on_vte_realize(MultiTermTerminal * self)145 static void multi_term_terminal_on_vte_realize (MultiTermTerminal* self) {
146 	MultiTermShellConfig* _tmp0_ = NULL;
147 	MultiTermConfig* _tmp1_ = NULL;
148 	MultiTermConfig* _tmp2_ = NULL;
149 	VteTerminal* _tmp11_ = NULL;
150 	VteTerminal* _tmp12_ = NULL;
151 	g_return_if_fail (self != NULL);
152 	_tmp0_ = self->priv->sh;
153 	_tmp1_ = multi_term_shell_config_get_cfg (_tmp0_);
154 	_tmp2_ = _tmp1_;
155 	if (_tmp2_ != NULL) {
156 		MultiTermShellConfig* _tmp3_ = NULL;
157 		gchar* _tmp4_ = NULL;
158 		gchar* _tmp5_ = NULL;
159 		gchar* _tmp6_ = NULL;
160 		MultiTermShellConfig* _tmp7_ = NULL;
161 		gchar* _tmp8_ = NULL;
162 		gchar* _tmp9_ = NULL;
163 		gchar* _tmp10_ = NULL;
164 		_tmp3_ = self->priv->sh;
165 		_tmp4_ = multi_term_shell_config_get_background_color (_tmp3_);
166 		_tmp5_ = _tmp4_;
167 		_tmp6_ = _tmp5_;
168 		multi_term_terminal_set_background_color (self, _tmp6_);
169 		_g_free0 (_tmp6_);
170 		_tmp7_ = self->priv->sh;
171 		_tmp8_ = multi_term_shell_config_get_foreground_color (_tmp7_);
172 		_tmp9_ = _tmp8_;
173 		_tmp10_ = _tmp9_;
174 		multi_term_terminal_set_foreground_color (self, _tmp10_);
175 		_g_free0 (_tmp10_);
176 	} else {
177 		multi_term_terminal_set_background_color (self, "#ffffff");
178 		multi_term_terminal_set_foreground_color (self, "#000000");
179 	}
180 	_tmp11_ = self->terminal;
181 	gtk_widget_add_events ((GtkWidget*) _tmp11_, (gint) GDK_BUTTON_PRESS_MASK);
182 	_tmp12_ = self->terminal;
183 	g_signal_connect_object ((GtkWidget*) _tmp12_, "button-press-event", (GCallback) _multi_term_terminal_on_button_press_gtk_widget_button_press_event, self, 0);
184 }
185 
186 
multi_term_terminal_on_child_exited(MultiTermTerminal * self)187 static void multi_term_terminal_on_child_exited (MultiTermTerminal* self) {
188 	MultiTermShellConfig* _tmp0_ = NULL;
189 	gchar* _tmp1_ = NULL;
190 	gchar* _tmp2_ = NULL;
191 	gchar* _tmp3_ = NULL;
192 	g_return_if_fail (self != NULL);
193 	_tmp0_ = self->priv->sh;
194 	_tmp1_ = multi_term_shell_config_get_command (_tmp0_);
195 	_tmp2_ = _tmp1_;
196 	_tmp3_ = _tmp2_;
197 	multi_term_terminal_run_command (self, _tmp3_);
198 	_g_free0 (_tmp3_);
199 }
200 
201 
multi_term_terminal_on_button_press(MultiTermTerminal * self,GdkEventButton * event)202 static gboolean multi_term_terminal_on_button_press (MultiTermTerminal* self, GdkEventButton* event) {
203 	gboolean result = FALSE;
204 	GdkEventButton _tmp0_ = {0};
205 	guint _tmp1_ = 0U;
206 	g_return_val_if_fail (self != NULL, FALSE);
207 	g_return_val_if_fail (event != NULL, FALSE);
208 	_tmp0_ = *event;
209 	_tmp1_ = _tmp0_.button;
210 	if (_tmp1_ == ((guint) 3)) {
211 		GdkEventButton _tmp2_ = {0};
212 		gboolean _tmp3_ = FALSE;
213 		_tmp2_ = *event;
214 		g_signal_emit_by_name (self, "right-click-event", &_tmp2_, &_tmp3_);
215 		result = _tmp3_;
216 		return result;
217 	}
218 	result = FALSE;
219 	return result;
220 }
221 
222 
multi_term_terminal_send_command(MultiTermTerminal * self,const gchar * command)223 void multi_term_terminal_send_command (MultiTermTerminal* self, const gchar* command) {
224 	VteTerminal* _tmp0_ = NULL;
225 	const gchar* _tmp1_ = NULL;
226 	gchar* _tmp2_ = NULL;
227 	gchar* _tmp3_ = NULL;
228 	g_return_if_fail (self != NULL);
229 	g_return_if_fail (command != NULL);
230 	_tmp0_ = self->terminal;
231 	_tmp1_ = command;
232 	_tmp2_ = g_strdup_printf ("%s\n", _tmp1_);
233 	_tmp3_ = _tmp2_;
234 	vte_terminal_feed_child (_tmp0_, _tmp3_, (glong) -1);
235 	_g_free0 (_tmp3_);
236 }
237 
238 
_multi_term_shell_config_ref0(gpointer self)239 static gpointer _multi_term_shell_config_ref0 (gpointer self) {
240 	return self ? multi_term_shell_config_ref (self) : NULL;
241 }
242 
243 
string_strip(const gchar * self)244 static gchar* string_strip (const gchar* self) {
245 	gchar* result = NULL;
246 	gchar* _result_ = NULL;
247 	gchar* _tmp0_ = NULL;
248 	const gchar* _tmp1_ = NULL;
249 	g_return_val_if_fail (self != NULL, NULL);
250 	_tmp0_ = g_strdup (self);
251 	_result_ = _tmp0_;
252 	_tmp1_ = _result_;
253 	g_strstrip (_tmp1_);
254 	result = _result_;
255 	return result;
256 }
257 
258 
_multi_term_terminal_on_window_title_changed_vte_terminal_window_title_changed(VteTerminal * _sender,gpointer self)259 static void _multi_term_terminal_on_window_title_changed_vte_terminal_window_title_changed (VteTerminal* _sender, gpointer self) {
260 	multi_term_terminal_on_window_title_changed ((MultiTermTerminal*) self);
261 }
262 
263 
_multi_term_terminal_on_child_exited_vte_terminal_child_exited(VteTerminal * _sender,gpointer self)264 static void _multi_term_terminal_on_child_exited_vte_terminal_child_exited (VteTerminal* _sender, gpointer self) {
265 	multi_term_terminal_on_child_exited ((MultiTermTerminal*) self);
266 }
267 
268 
_multi_term_terminal_on_vte_realize_gtk_widget_realize(GtkWidget * _sender,gpointer self)269 static void _multi_term_terminal_on_vte_realize_gtk_widget_realize (GtkWidget* _sender, gpointer self) {
270 	multi_term_terminal_on_vte_realize ((MultiTermTerminal*) self);
271 }
272 
273 
multi_term_terminal_construct(GType object_type,MultiTermShellConfig * sh)274 MultiTermTerminal* multi_term_terminal_construct (GType object_type, MultiTermShellConfig* sh) {
275 	MultiTermTerminal * self = NULL;
276 	GtkVScrollbar* vsb = NULL;
277 	GtkHBox* hbox = NULL;
278 	MultiTermShellConfig* _tmp0_ = NULL;
279 	MultiTermShellConfig* _tmp1_ = NULL;
280 	MultiTermShellConfig* _tmp2_ = NULL;
281 	gchar* _tmp3_ = NULL;
282 	gchar* _tmp4_ = NULL;
283 	gchar* _tmp5_ = NULL;
284 	gchar* _tmp6_ = NULL;
285 	gchar* _tmp7_ = NULL;
286 	gboolean _tmp8_ = FALSE;
287 	VteTerminal* _tmp10_ = NULL;
288 	VteTerminal* _tmp11_ = NULL;
289 	VteTerminal* _tmp12_ = NULL;
290 	VteTerminal* _tmp13_ = NULL;
291 	GtkAdjustment* _tmp14_ = NULL;
292 	GtkVScrollbar* _tmp15_ = NULL;
293 	GtkHBox* _tmp16_ = NULL;
294 	GtkHBox* _tmp17_ = NULL;
295 	VteTerminal* _tmp18_ = NULL;
296 	GtkHBox* _tmp19_ = NULL;
297 	GtkVScrollbar* _tmp20_ = NULL;
298 	GtkHBox* _tmp21_ = NULL;
299 	MultiTermShellConfig* _tmp22_ = NULL;
300 	gboolean _tmp23_ = FALSE;
301 	gboolean _tmp24_ = FALSE;
302 	VteTerminal* _tmp26_ = NULL;
303 	MultiTermShellConfig* _tmp27_ = NULL;
304 	MultiTermConfig* _tmp28_ = NULL;
305 	MultiTermConfig* _tmp29_ = NULL;
306 	VteTerminal* _tmp92_ = NULL;
307 	MultiTermShellConfig* _tmp93_ = NULL;
308 	gchar* _tmp94_ = NULL;
309 	gchar* _tmp95_ = NULL;
310 	gchar* _tmp96_ = NULL;
311 	g_return_val_if_fail (sh != NULL, NULL);
312 	self = (MultiTermTerminal*) g_object_new (object_type, NULL);
313 	_tmp0_ = sh;
314 	_tmp1_ = _multi_term_shell_config_ref0 (_tmp0_);
315 	_multi_term_shell_config_unref0 (self->priv->sh);
316 	self->priv->sh = _tmp1_;
317 	_tmp2_ = self->priv->sh;
318 	_tmp3_ = multi_term_shell_config_get_command (_tmp2_);
319 	_tmp4_ = _tmp3_;
320 	_tmp5_ = _tmp4_;
321 	_tmp6_ = string_strip (_tmp5_);
322 	_tmp7_ = _tmp6_;
323 	_tmp8_ = g_strcmp0 (_tmp7_, "") == 0;
324 	_g_free0 (_tmp7_);
325 	_g_free0 (_tmp5_);
326 	if (_tmp8_) {
327 		MultiTermShellConfig* _tmp9_ = NULL;
328 		_tmp9_ = self->priv->sh;
329 		multi_term_shell_config_set_command (_tmp9_, "sh");
330 	}
331 	_tmp10_ = (VteTerminal*) vte_terminal_new ();
332 	g_object_ref_sink (_tmp10_);
333 	_g_object_unref0 (self->terminal);
334 	self->terminal = _tmp10_;
335 	_tmp11_ = self->terminal;
336 	gtk_widget_set_size_request ((GtkWidget*) _tmp11_, 100, 100);
337 	_tmp12_ = self->terminal;
338 	gtk_widget_show_all ((GtkWidget*) _tmp12_);
339 	_tmp13_ = self->terminal;
340 	_tmp14_ = vte_terminal_get_adjustment (_tmp13_);
341 	_tmp15_ = (GtkVScrollbar*) gtk_vscrollbar_new (_tmp14_);
342 	g_object_ref_sink (_tmp15_);
343 	_g_object_unref0 (vsb);
344 	vsb = _tmp15_;
345 	_tmp16_ = (GtkHBox*) gtk_hbox_new (FALSE, 0);
346 	g_object_ref_sink (_tmp16_);
347 	_g_object_unref0 (hbox);
348 	hbox = _tmp16_;
349 	_tmp17_ = hbox;
350 	_tmp18_ = self->terminal;
351 	gtk_box_pack_start ((GtkBox*) _tmp17_, (GtkWidget*) _tmp18_, TRUE, TRUE, (guint) 0);
352 	_tmp19_ = hbox;
353 	_tmp20_ = vsb;
354 	gtk_box_pack_start ((GtkBox*) _tmp19_, (GtkWidget*) _tmp20_, FALSE, FALSE, (guint) 0);
355 	_tmp21_ = hbox;
356 	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp21_);
357 	_tmp22_ = self->priv->sh;
358 	_tmp23_ = multi_term_shell_config_get_track_title (_tmp22_);
359 	_tmp24_ = _tmp23_;
360 	if (_tmp24_) {
361 		VteTerminal* _tmp25_ = NULL;
362 		_tmp25_ = self->terminal;
363 		g_signal_connect_object (_tmp25_, "window-title-changed", (GCallback) _multi_term_terminal_on_window_title_changed_vte_terminal_window_title_changed, self, 0);
364 	}
365 	_tmp26_ = self->terminal;
366 	g_signal_connect_object (_tmp26_, "child-exited", (GCallback) _multi_term_terminal_on_child_exited_vte_terminal_child_exited, self, 0);
367 	_tmp27_ = self->priv->sh;
368 	_tmp28_ = multi_term_shell_config_get_cfg (_tmp27_);
369 	_tmp29_ = _tmp28_;
370 	if (_tmp29_ != NULL) {
371 		VteTerminal* _tmp30_ = NULL;
372 		MultiTermShellConfig* _tmp31_ = NULL;
373 		gchar* _tmp32_ = NULL;
374 		gchar* _tmp33_ = NULL;
375 		gchar* _tmp34_ = NULL;
376 		VteTerminal* _tmp35_ = NULL;
377 		MultiTermShellConfig* _tmp36_ = NULL;
378 		gboolean _tmp37_ = FALSE;
379 		gboolean _tmp38_ = FALSE;
380 		VteTerminal* _tmp39_ = NULL;
381 		MultiTermShellConfig* _tmp40_ = NULL;
382 		gboolean _tmp41_ = FALSE;
383 		gboolean _tmp42_ = FALSE;
384 		VteTerminal* _tmp43_ = NULL;
385 		MultiTermShellConfig* _tmp44_ = NULL;
386 		VteTerminalCursorBlinkMode _tmp45_ = 0;
387 		VteTerminalCursorBlinkMode _tmp46_ = 0;
388 		VteTerminal* _tmp47_ = NULL;
389 		MultiTermShellConfig* _tmp48_ = NULL;
390 		VteTerminalCursorShape _tmp49_ = 0;
391 		VteTerminalCursorShape _tmp50_ = 0;
392 		VteTerminal* _tmp51_ = NULL;
393 		MultiTermShellConfig* _tmp52_ = NULL;
394 		VteTerminalEraseBinding _tmp53_ = 0;
395 		VteTerminalEraseBinding _tmp54_ = 0;
396 		VteTerminal* _tmp55_ = NULL;
397 		MultiTermShellConfig* _tmp56_ = NULL;
398 		gboolean _tmp57_ = FALSE;
399 		gboolean _tmp58_ = FALSE;
400 		VteTerminal* _tmp59_ = NULL;
401 		MultiTermShellConfig* _tmp60_ = NULL;
402 		gboolean _tmp61_ = FALSE;
403 		gboolean _tmp62_ = FALSE;
404 		VteTerminal* _tmp63_ = NULL;
405 		MultiTermShellConfig* _tmp64_ = NULL;
406 		gboolean _tmp65_ = FALSE;
407 		gboolean _tmp66_ = FALSE;
408 		VteTerminal* _tmp67_ = NULL;
409 		MultiTermShellConfig* _tmp68_ = NULL;
410 		gint _tmp69_ = 0;
411 		gint _tmp70_ = 0;
412 		VteTerminal* _tmp71_ = NULL;
413 		MultiTermShellConfig* _tmp72_ = NULL;
414 		gboolean _tmp73_ = FALSE;
415 		gboolean _tmp74_ = FALSE;
416 		VteTerminal* _tmp75_ = NULL;
417 		MultiTermShellConfig* _tmp76_ = NULL;
418 		gchar* _tmp77_ = NULL;
419 		gchar* _tmp78_ = NULL;
420 		gchar* _tmp79_ = NULL;
421 		_tmp30_ = self->terminal;
422 		_tmp31_ = self->priv->sh;
423 		_tmp32_ = multi_term_shell_config_get_font (_tmp31_);
424 		_tmp33_ = _tmp32_;
425 		_tmp34_ = _tmp33_;
426 		vte_terminal_set_font_from_string (_tmp30_, _tmp34_);
427 		_g_free0 (_tmp34_);
428 		_tmp35_ = self->terminal;
429 		_tmp36_ = self->priv->sh;
430 		_tmp37_ = multi_term_shell_config_get_allow_bold (_tmp36_);
431 		_tmp38_ = _tmp37_;
432 		vte_terminal_set_allow_bold (_tmp35_, _tmp38_);
433 		_tmp39_ = self->terminal;
434 		_tmp40_ = self->priv->sh;
435 		_tmp41_ = multi_term_shell_config_get_audible_bell (_tmp40_);
436 		_tmp42_ = _tmp41_;
437 		vte_terminal_set_audible_bell (_tmp39_, _tmp42_);
438 		_tmp43_ = self->terminal;
439 		_tmp44_ = self->priv->sh;
440 		_tmp45_ = multi_term_shell_config_get_cursor_blink_mode (_tmp44_);
441 		_tmp46_ = _tmp45_;
442 		vte_terminal_set_cursor_blink_mode (_tmp43_, _tmp46_);
443 		_tmp47_ = self->terminal;
444 		_tmp48_ = self->priv->sh;
445 		_tmp49_ = multi_term_shell_config_get_cursor_shape (_tmp48_);
446 		_tmp50_ = _tmp49_;
447 		vte_terminal_set_cursor_shape (_tmp47_, _tmp50_);
448 		_tmp51_ = self->terminal;
449 		_tmp52_ = self->priv->sh;
450 		_tmp53_ = multi_term_shell_config_get_backspace_binding (_tmp52_);
451 		_tmp54_ = _tmp53_;
452 		vte_terminal_set_backspace_binding (_tmp51_, _tmp54_);
453 		_tmp55_ = self->terminal;
454 		_tmp56_ = self->priv->sh;
455 		_tmp57_ = multi_term_shell_config_get_pointer_autohide (_tmp56_);
456 		_tmp58_ = _tmp57_;
457 		vte_terminal_set_mouse_autohide (_tmp55_, _tmp58_);
458 		_tmp59_ = self->terminal;
459 		_tmp60_ = self->priv->sh;
460 		_tmp61_ = multi_term_shell_config_get_scroll_on_keystroke (_tmp60_);
461 		_tmp62_ = _tmp61_;
462 		vte_terminal_set_scroll_on_keystroke (_tmp59_, _tmp62_);
463 		_tmp63_ = self->terminal;
464 		_tmp64_ = self->priv->sh;
465 		_tmp65_ = multi_term_shell_config_get_scroll_on_output (_tmp64_);
466 		_tmp66_ = _tmp65_;
467 		vte_terminal_set_scroll_on_output (_tmp63_, _tmp66_);
468 		_tmp67_ = self->terminal;
469 		_tmp68_ = self->priv->sh;
470 		_tmp69_ = multi_term_shell_config_get_scrollback_lines (_tmp68_);
471 		_tmp70_ = _tmp69_;
472 		vte_terminal_set_scrollback_lines (_tmp67_, (glong) _tmp70_);
473 		_tmp71_ = self->terminal;
474 		_tmp72_ = self->priv->sh;
475 		_tmp73_ = multi_term_shell_config_get_visible_bell (_tmp72_);
476 		_tmp74_ = _tmp73_;
477 		vte_terminal_set_visible_bell (_tmp71_, _tmp74_);
478 		_tmp75_ = self->terminal;
479 		_tmp76_ = self->priv->sh;
480 		_tmp77_ = multi_term_shell_config_get_word_chars (_tmp76_);
481 		_tmp78_ = _tmp77_;
482 		_tmp79_ = _tmp78_;
483 		vte_terminal_set_word_chars (_tmp75_, _tmp79_);
484 		_g_free0 (_tmp79_);
485 	} else {
486 		VteTerminal* _tmp80_ = NULL;
487 		VteTerminal* _tmp81_ = NULL;
488 		VteTerminal* _tmp82_ = NULL;
489 		VteTerminal* _tmp83_ = NULL;
490 		VteTerminal* _tmp84_ = NULL;
491 		VteTerminal* _tmp85_ = NULL;
492 		VteTerminal* _tmp86_ = NULL;
493 		VteTerminal* _tmp87_ = NULL;
494 		VteTerminal* _tmp88_ = NULL;
495 		VteTerminal* _tmp89_ = NULL;
496 		VteTerminal* _tmp90_ = NULL;
497 		VteTerminal* _tmp91_ = NULL;
498 		_tmp80_ = self->terminal;
499 		vte_terminal_set_font_from_string (_tmp80_, "Monospace 9");
500 		_tmp81_ = self->terminal;
501 		vte_terminal_set_allow_bold (_tmp81_, TRUE);
502 		_tmp82_ = self->terminal;
503 		vte_terminal_set_audible_bell (_tmp82_, TRUE);
504 		_tmp83_ = self->terminal;
505 		vte_terminal_set_cursor_blink_mode (_tmp83_, VTE_CURSOR_BLINK_SYSTEM);
506 		_tmp84_ = self->terminal;
507 		vte_terminal_set_cursor_shape (_tmp84_, VTE_CURSOR_SHAPE_BLOCK);
508 		_tmp85_ = self->terminal;
509 		vte_terminal_set_backspace_binding (_tmp85_, VTE_ERASE_AUTO);
510 		_tmp86_ = self->terminal;
511 		vte_terminal_set_mouse_autohide (_tmp86_, FALSE);
512 		_tmp87_ = self->terminal;
513 		vte_terminal_set_scroll_on_keystroke (_tmp87_, TRUE);
514 		_tmp88_ = self->terminal;
515 		vte_terminal_set_scroll_on_output (_tmp88_, FALSE);
516 		_tmp89_ = self->terminal;
517 		vte_terminal_set_scrollback_lines (_tmp89_, (glong) 512);
518 		_tmp90_ = self->terminal;
519 		vte_terminal_set_visible_bell (_tmp90_, FALSE);
520 		_tmp91_ = self->terminal;
521 		vte_terminal_set_word_chars (_tmp91_, "");
522 	}
523 	_tmp92_ = self->terminal;
524 	g_signal_connect_object ((GtkWidget*) _tmp92_, "realize", (GCallback) _multi_term_terminal_on_vte_realize_gtk_widget_realize, self, 0);
525 	_tmp93_ = self->priv->sh;
526 	_tmp94_ = multi_term_shell_config_get_command (_tmp93_);
527 	_tmp95_ = _tmp94_;
528 	_tmp96_ = _tmp95_;
529 	multi_term_terminal_run_command (self, _tmp96_);
530 	_g_free0 (_tmp96_);
531 	_g_object_unref0 (hbox);
532 	_g_object_unref0 (vsb);
533 	return self;
534 }
535 
536 
multi_term_terminal_new(MultiTermShellConfig * sh)537 MultiTermTerminal* multi_term_terminal_new (MultiTermShellConfig* sh) {
538 	return multi_term_terminal_construct (MULTI_TERM_TYPE_TERMINAL, sh);
539 }
540 
541 
_g_object_ref0(gpointer self)542 static gpointer _g_object_ref0 (gpointer self) {
543 	return self ? g_object_ref (self) : NULL;
544 }
545 
546 
multi_term_terminal_get_tab_label_text(MultiTermTerminal * self)547 const gchar* multi_term_terminal_get_tab_label_text (MultiTermTerminal* self) {
548 	const gchar* result;
549 	MultiTermTabLabel* label = NULL;
550 	gconstpointer _tmp0_ = NULL;
551 	MultiTermTabLabel* _tmp1_ = NULL;
552 	const gchar* _tmp2_ = NULL;
553 	const gchar* _tmp3_ = NULL;
554 	g_return_val_if_fail (self != NULL, NULL);
555 	_tmp0_ = g_object_get_data ((GObject*) self, "label");
556 	_tmp1_ = _g_object_ref0 ((MultiTermTabLabel*) _tmp0_);
557 	label = _tmp1_;
558 	_tmp2_ = multi_term_tab_label_get_text (label);
559 	_tmp3_ = _tmp2_;
560 	result = _tmp3_;
561 	_g_object_unref0 (label);
562 	return result;
563 }
564 
565 
multi_term_terminal_set_tab_label_text(MultiTermTerminal * self,const gchar * value)566 void multi_term_terminal_set_tab_label_text (MultiTermTerminal* self, const gchar* value) {
567 	MultiTermTabLabel* label = NULL;
568 	gconstpointer _tmp0_ = NULL;
569 	MultiTermTabLabel* _tmp1_ = NULL;
570 	const gchar* _tmp2_ = NULL;
571 	g_return_if_fail (self != NULL);
572 	_tmp0_ = g_object_get_data ((GObject*) self, "label");
573 	_tmp1_ = _g_object_ref0 ((MultiTermTabLabel*) _tmp0_);
574 	label = _tmp1_;
575 	_tmp2_ = value;
576 	multi_term_tab_label_set_text (label, _tmp2_);
577 	_g_object_unref0 (label);
578 	g_object_notify ((GObject *) self, "tab-label-text");
579 }
580 
581 
multi_term_terminal_set_background_color(MultiTermTerminal * self,const gchar * value)582 void multi_term_terminal_set_background_color (MultiTermTerminal* self, const gchar* value) {
583 	GdkColor color = {0};
584 	GdkColormap* _tmp0_ = NULL;
585 	GdkColor _tmp1_ = {0};
586 	const gchar* _tmp2_ = NULL;
587 	GdkColor _tmp3_ = {0};
588 	VteTerminal* _tmp4_ = NULL;
589 	GdkColor _tmp5_ = {0};
590 	g_return_if_fail (self != NULL);
591 	memset (&color, 0, sizeof (GdkColor));
592 	_tmp0_ = gdk_colormap_get_system ();
593 	_tmp1_ = color;
594 	gdk_colormap_alloc_color (_tmp0_, &_tmp1_, TRUE, TRUE);
595 	_tmp2_ = value;
596 	gdk_color_parse (_tmp2_, &_tmp3_);
597 	color = _tmp3_;
598 	_tmp4_ = self->terminal;
599 	_tmp5_ = color;
600 	vte_terminal_set_color_background (_tmp4_, &_tmp5_);
601 	g_object_notify ((GObject *) self, "background-color");
602 }
603 
604 
multi_term_terminal_set_foreground_color(MultiTermTerminal * self,const gchar * value)605 void multi_term_terminal_set_foreground_color (MultiTermTerminal* self, const gchar* value) {
606 	GdkColor color = {0};
607 	GdkColormap* _tmp0_ = NULL;
608 	GdkColor _tmp1_ = {0};
609 	const gchar* _tmp2_ = NULL;
610 	GdkColor _tmp3_ = {0};
611 	VteTerminal* _tmp4_ = NULL;
612 	GdkColor _tmp5_ = {0};
613 	g_return_if_fail (self != NULL);
614 	memset (&color, 0, sizeof (GdkColor));
615 	_tmp0_ = gdk_colormap_get_system ();
616 	_tmp1_ = color;
617 	gdk_colormap_alloc_color (_tmp0_, &_tmp1_, TRUE, TRUE);
618 	_tmp2_ = value;
619 	gdk_color_parse (_tmp2_, &_tmp3_);
620 	color = _tmp3_;
621 	_tmp4_ = self->terminal;
622 	_tmp5_ = color;
623 	vte_terminal_set_color_foreground (_tmp4_, &_tmp5_);
624 	g_object_notify ((GObject *) self, "foreground-color");
625 }
626 
627 
g_cclosure_user_marshal_BOOLEAN__POINTER(GClosure * closure,GValue * return_value,guint n_param_values,const GValue * param_values,gpointer invocation_hint,gpointer marshal_data)628 static void g_cclosure_user_marshal_BOOLEAN__POINTER (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
629 	typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER) (gpointer data1, gpointer arg_1, gpointer data2);
630 	register GMarshalFunc_BOOLEAN__POINTER callback;
631 	register GCClosure * cc;
632 	register gpointer data1;
633 	register gpointer data2;
634 	gboolean v_return;
635 	cc = (GCClosure *) closure;
636 	g_return_if_fail (return_value != NULL);
637 	g_return_if_fail (n_param_values == 2);
638 	if (G_CCLOSURE_SWAP_DATA (closure)) {
639 		data1 = closure->data;
640 		data2 = param_values->data[0].v_pointer;
641 	} else {
642 		data1 = param_values->data[0].v_pointer;
643 		data2 = closure->data;
644 	}
645 	callback = (GMarshalFunc_BOOLEAN__POINTER) (marshal_data ? marshal_data : cc->callback);
646 	v_return = callback (data1, g_value_get_pointer (param_values + 1), data2);
647 	g_value_set_boolean (return_value, v_return);
648 }
649 
650 
multi_term_terminal_class_init(MultiTermTerminalClass * klass)651 static void multi_term_terminal_class_init (MultiTermTerminalClass * klass) {
652 	multi_term_terminal_parent_class = g_type_class_peek_parent (klass);
653 	g_type_class_add_private (klass, sizeof (MultiTermTerminalPrivate));
654 	G_OBJECT_CLASS (klass)->get_property = _vala_multi_term_terminal_get_property;
655 	G_OBJECT_CLASS (klass)->set_property = _vala_multi_term_terminal_set_property;
656 	G_OBJECT_CLASS (klass)->finalize = multi_term_terminal_finalize;
657 	g_object_class_install_property (G_OBJECT_CLASS (klass), MULTI_TERM_TERMINAL_TAB_LABEL_TEXT, g_param_spec_string ("tab-label-text", "tab-label-text", "tab-label-text", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
658 	g_object_class_install_property (G_OBJECT_CLASS (klass), MULTI_TERM_TERMINAL_BACKGROUND_COLOR, g_param_spec_string ("background-color", "background-color", "background-color", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE));
659 	g_object_class_install_property (G_OBJECT_CLASS (klass), MULTI_TERM_TERMINAL_FOREGROUND_COLOR, g_param_spec_string ("foreground-color", "foreground-color", "foreground-color", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE));
660 	g_signal_new ("right_click_event", MULTI_TERM_TYPE_TERMINAL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_BOOLEAN__POINTER, G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
661 }
662 
663 
multi_term_terminal_instance_init(MultiTermTerminal * self)664 static void multi_term_terminal_instance_init (MultiTermTerminal * self) {
665 	self->priv = MULTI_TERM_TERMINAL_GET_PRIVATE (self);
666 }
667 
668 
multi_term_terminal_finalize(GObject * obj)669 static void multi_term_terminal_finalize (GObject* obj) {
670 	MultiTermTerminal * self;
671 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MULTI_TERM_TYPE_TERMINAL, MultiTermTerminal);
672 	_g_object_unref0 (self->terminal);
673 	_multi_term_shell_config_unref0 (self->priv->sh);
674 	G_OBJECT_CLASS (multi_term_terminal_parent_class)->finalize (obj);
675 }
676 
677 
multi_term_terminal_get_type(void)678 GType multi_term_terminal_get_type (void) {
679 	static volatile gsize multi_term_terminal_type_id__volatile = 0;
680 	if (g_once_init_enter (&multi_term_terminal_type_id__volatile)) {
681 		static const GTypeInfo g_define_type_info = { sizeof (MultiTermTerminalClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) multi_term_terminal_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MultiTermTerminal), 0, (GInstanceInitFunc) multi_term_terminal_instance_init, NULL };
682 		GType multi_term_terminal_type_id;
683 		multi_term_terminal_type_id = g_type_register_static (GTK_TYPE_FRAME, "MultiTermTerminal", &g_define_type_info, 0);
684 		g_once_init_leave (&multi_term_terminal_type_id__volatile, multi_term_terminal_type_id);
685 	}
686 	return multi_term_terminal_type_id__volatile;
687 }
688 
689 
_vala_multi_term_terminal_get_property(GObject * object,guint property_id,GValue * value,GParamSpec * pspec)690 static void _vala_multi_term_terminal_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
691 	MultiTermTerminal * self;
692 	self = G_TYPE_CHECK_INSTANCE_CAST (object, MULTI_TERM_TYPE_TERMINAL, MultiTermTerminal);
693 	switch (property_id) {
694 		case MULTI_TERM_TERMINAL_TAB_LABEL_TEXT:
695 		g_value_set_string (value, multi_term_terminal_get_tab_label_text (self));
696 		break;
697 		default:
698 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
699 		break;
700 	}
701 }
702 
703 
_vala_multi_term_terminal_set_property(GObject * object,guint property_id,const GValue * value,GParamSpec * pspec)704 static void _vala_multi_term_terminal_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
705 	MultiTermTerminal * self;
706 	self = G_TYPE_CHECK_INSTANCE_CAST (object, MULTI_TERM_TYPE_TERMINAL, MultiTermTerminal);
707 	switch (property_id) {
708 		case MULTI_TERM_TERMINAL_TAB_LABEL_TEXT:
709 		multi_term_terminal_set_tab_label_text (self, g_value_get_string (value));
710 		break;
711 		case MULTI_TERM_TERMINAL_BACKGROUND_COLOR:
712 		multi_term_terminal_set_background_color (self, g_value_get_string (value));
713 		break;
714 		case MULTI_TERM_TERMINAL_FOREGROUND_COLOR:
715 		multi_term_terminal_set_foreground_color (self, g_value_get_string (value));
716 		break;
717 		default:
718 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
719 		break;
720 	}
721 }
722 
723 
_vala_array_destroy(gpointer array,gint array_length,GDestroyNotify destroy_func)724 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
725 	if ((array != NULL) && (destroy_func != NULL)) {
726 		int i;
727 		for (i = 0; i < array_length; i = i + 1) {
728 			if (((gpointer*) array)[i] != NULL) {
729 				destroy_func (((gpointer*) array)[i]);
730 			}
731 		}
732 	}
733 }
734 
735 
_vala_array_free(gpointer array,gint array_length,GDestroyNotify destroy_func)736 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
737 	_vala_array_destroy (array, array_length, destroy_func);
738 	g_free (array);
739 }
740 
741 
742 
743