1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module vte.Terminal;
26 
27 private import gdk.Cursor;
28 private import gdk.Event;
29 private import gdk.RGBA;
30 private import gio.Cancellable;
31 private import gio.OutputStream;
32 private import glib.ArrayG;
33 private import glib.ConstructionException;
34 private import glib.ErrorG;
35 private import glib.GException;
36 private import glib.Regex;
37 private import glib.Str;
38 private import gobject.ObjectG;
39 private import gobject.Signals;
40 private import gtk.BuildableIF;
41 private import gtk.BuildableT;
42 private import gtk.ScrollableIF;
43 private import gtk.ScrollableT;
44 private import gtk.Widget;
45 private import gtk.Window;
46 public  import gtkc.gdktypes;
47 private import pango.PgFontDescription;
48 private import std.algorithm;
49 private import vte.Pty;
50 private import vte.Regex : RegexVte = Regex;
51 private import vtec.vte;
52 public  import vtec.vtetypes;
53 
54 
55 /** */
56 public class Terminal : Widget, ScrollableIF
57 {
58 	/** the main Gtk struct */
59 	protected VteTerminal* vteTerminal;
60 
61 	/** Get the main Gtk struct */
62 	public VteTerminal* getTerminalStruct()
63 	{
64 		return vteTerminal;
65 	}
66 
67 	/** the main Gtk struct as a void* */
68 	protected override void* getStruct()
69 	{
70 		return cast(void*)vteTerminal;
71 	}
72 
73 	protected override void setStruct(GObject* obj)
74 	{
75 		vteTerminal = cast(VteTerminal*)obj;
76 		super.setStruct(obj);
77 	}
78 
79 	/**
80 	 * Sets our main struct and passes it to the parent class.
81 	 */
82 	public this (VteTerminal* vteTerminal, bool ownedRef = false)
83 	{
84 		this.vteTerminal = vteTerminal;
85 		super(cast(GtkWidget*)vteTerminal, ownedRef);
86 	}
87 
88 	// add the Scrollable capabilities
89 	mixin ScrollableT!(VteTerminal);
90 
91 
92 	/** */
93 	public static GType getType()
94 	{
95 		return vte_terminal_get_type();
96 	}
97 
98 	/**
99 	 * Creates a new terminal widget.
100 	 *
101 	 * Return: a new #VteTerminal object
102 	 *
103 	 * Throws: ConstructionException GTK+ fails to create the object.
104 	 */
105 	public this()
106 	{
107 		auto p = vte_terminal_new();
108 		
109 		if(p is null)
110 		{
111 			throw new ConstructionException("null returned by new");
112 		}
113 		
114 		this(cast(VteTerminal*) p);
115 	}
116 
117 	/**
118 	 * Places the selected text in the terminal in the #GDK_SELECTION_CLIPBOARD
119 	 * selection.
120 	 */
121 	public void copyClipboard()
122 	{
123 		vte_terminal_copy_clipboard(vteTerminal);
124 	}
125 
126 	/**
127 	 * Places the selected text in the terminal in the #GDK_SELECTION_PRIMARY
128 	 * selection.
129 	 */
130 	public void copyPrimary()
131 	{
132 		vte_terminal_copy_primary(vteTerminal);
133 	}
134 
135 	/**
136 	 * This function does nothing.
137 	 *
138 	 * Deprecated: Use vte_terminal_event_check_regex_simple() instead.
139 	 *
140 	 * Params:
141 	 *     event = a #GdkEvent
142 	 *     regexes = an array of #GRegex
143 	 *     nRegexes = number of items in @regexes
144 	 *     matchFlags = the #GRegexMatchFlags to use when matching the regexes
145 	 *     matches = a location to store the matches
146 	 *
147 	 * Return: %FALSE
148 	 *
149 	 * Since: 0.44
150 	 */
151 	public bool eventCheckGregexSimple(Event event, Regex[] regexes, GRegexMatchFlags matchFlags, string[] matches)
152 	{
153 		GRegex*[] regexesArray = new GRegex*[regexes.length];
154 		for ( int i = 0; i < regexes.length; i++ )
155 		{
156 			regexesArray[i] = regexes[i].getRegexStruct();
157 		}
158 		
159 		return vte_terminal_event_check_gregex_simple(vteTerminal, (event is null) ? null : event.getEventStruct(), regexesArray.ptr, cast(size_t)matches.length, matchFlags, Str.toStringzArray(matches)) != 0;
160 	}
161 
162 	/**
163 	 * Checks each regex in @regexes if the text in and around the position of
164 	 * the event matches the regular expressions.  If a match exists, the matched
165 	 * text is stored in @matches at the position of the regex in @regexes; otherwise
166 	 * %NULL is stored there.
167 	 *
168 	 * Params:
169 	 *     event = a #GdkEvent
170 	 *     regexes = an array of #VteRegex
171 	 *     nRegexes = number of items in @regexes
172 	 *     matchFlags = PCRE2 match flags, or 0
173 	 *     matches = a location to store the matches
174 	 *
175 	 * Return: %TRUE iff any of the regexes produced a match
176 	 *
177 	 * Since: 0.46
178 	 */
179 	public bool eventCheckRegexSimple(Event event, RegexVte[] regexes, uint matchFlags, string[] matches)
180 	{
181 		VteRegex*[] regexesArray = new VteRegex*[regexes.length];
182 		for ( int i = 0; i < regexes.length; i++ )
183 		{
184 			regexesArray[i] = regexes[i].getRegexStruct();
185 		}
186 		
187 		return vte_terminal_event_check_regex_simple(vteTerminal, (event is null) ? null : event.getEventStruct(), regexesArray.ptr, cast(size_t)matches.length, matchFlags, Str.toStringzArray(matches)) != 0;
188 	}
189 
190 	/**
191 	 * Interprets @data as if it were data received from a child process.  This
192 	 * can either be used to drive the terminal without a child process, or just
193 	 * to mess with your users.
194 	 *
195 	 * Params:
196 	 *     data = a string in the terminal's current encoding
197 	 *     length = the length of the string, or -1 to use the full length or a nul-terminated string
198 	 */
199 	public void feed(string data)
200 	{
201 		vte_terminal_feed(vteTerminal, Str.toStringz(data), cast(ptrdiff_t)data.length);
202 	}
203 
204 	/**
205 	 * Sends a block of UTF-8 text to the child as if it were entered by the user
206 	 * at the keyboard.
207 	 *
208 	 * Params:
209 	 *     text = data to send to the child
210 	 *     length = length of @text in bytes, or -1 if @text is NUL-terminated
211 	 */
212 	public void feedChild(string text, ptrdiff_t length)
213 	{
214 		vte_terminal_feed_child(vteTerminal, Str.toStringz(text), length);
215 	}
216 
217 	/**
218 	 * Sends a block of binary data to the child.
219 	 *
220 	 * Params:
221 	 *     data = data to send to the child
222 	 *     length = length of @data
223 	 */
224 	public void feedChildBinary(ubyte[] data)
225 	{
226 		vte_terminal_feed_child_binary(vteTerminal, data.ptr, cast(size_t)data.length);
227 	}
228 
229 	/**
230 	 * Checks whether or not the terminal will attempt to draw bold text by
231 	 * repainting text with a one-pixel offset.
232 	 *
233 	 * Return: %TRUE if bolding is enabled, %FALSE if not
234 	 */
235 	public bool getAllowBold()
236 	{
237 		return vte_terminal_get_allow_bold(vteTerminal) != 0;
238 	}
239 
240 	/**
241 	 * Checks whether or not the terminal will beep when the child outputs the
242 	 * "bl" sequence.
243 	 *
244 	 * Return: %TRUE if audible bell is enabled, %FALSE if not
245 	 */
246 	public bool getAudibleBell()
247 	{
248 		return vte_terminal_get_audible_bell(vteTerminal) != 0;
249 	}
250 
251 	/**
252 	 * Return: the height of a character cell
253 	 */
254 	public glong getCharHeight()
255 	{
256 		return vte_terminal_get_char_height(vteTerminal);
257 	}
258 
259 	/**
260 	 * Return: the width of a character cell
261 	 */
262 	public glong getCharWidth()
263 	{
264 		return vte_terminal_get_char_width(vteTerminal);
265 	}
266 
267 	/**
268 	 * Returns whether ambiguous-width characters are narrow or wide when using
269 	 * the UTF-8 encoding (vte_terminal_set_encoding()).
270 	 *
271 	 * Return: 1 if ambiguous-width characters are narrow, or 2 if they are wide
272 	 */
273 	public int getCjkAmbiguousWidth()
274 	{
275 		return vte_terminal_get_cjk_ambiguous_width(vteTerminal);
276 	}
277 
278 	/**
279 	 * Return: the number of columns
280 	 */
281 	public glong getColumnCount()
282 	{
283 		return vte_terminal_get_column_count(vteTerminal);
284 	}
285 
286 	/**
287 	 * Return: the URI of the current directory of the
288 	 *     process running in the terminal, or %NULL
289 	 */
290 	public string getCurrentDirectoryUri()
291 	{
292 		return Str.toString(vte_terminal_get_current_directory_uri(vteTerminal));
293 	}
294 
295 	/**
296 	 * Return: the URI of the current file the
297 	 *     process running in the terminal is operating on, or %NULL if
298 	 *     not set
299 	 */
300 	public string getCurrentFileUri()
301 	{
302 		return Str.toString(vte_terminal_get_current_file_uri(vteTerminal));
303 	}
304 
305 	/**
306 	 * Returns the currently set cursor blink mode.
307 	 *
308 	 * Return: cursor blink mode.
309 	 */
310 	public VteCursorBlinkMode getCursorBlinkMode()
311 	{
312 		return vte_terminal_get_cursor_blink_mode(vteTerminal);
313 	}
314 
315 	/**
316 	 * Reads the location of the insertion cursor and returns it.  The row
317 	 * coordinate is absolute.
318 	 *
319 	 * Params:
320 	 *     column = a location to store the column, or %NULL
321 	 *     row = a location to store the row, or %NULL
322 	 */
323 	public void getCursorPosition(out glong column, out glong row)
324 	{
325 		vte_terminal_get_cursor_position(vteTerminal, &column, &row);
326 	}
327 
328 	/**
329 	 * Returns the currently set cursor shape.
330 	 *
331 	 * Return: cursor shape.
332 	 */
333 	public VteCursorShape getCursorShape()
334 	{
335 		return vte_terminal_get_cursor_shape(vteTerminal);
336 	}
337 
338 	/**
339 	 * Determines the name of the encoding in which the terminal expects data to be
340 	 * encoded.
341 	 *
342 	 * Return: the current encoding for the terminal
343 	 */
344 	public string getEncoding()
345 	{
346 		return Str.toString(vte_terminal_get_encoding(vteTerminal));
347 	}
348 
349 	/**
350 	 * Queries the terminal for information about the fonts which will be
351 	 * used to draw text in the terminal.  The actual font takes the font scale
352 	 * into account, this is not reflected in the return value, the unscaled
353 	 * font is returned.
354 	 *
355 	 * Return: a #PangoFontDescription describing the font the
356 	 *     terminal uses to render text at the default font scale of 1.0.
357 	 */
358 	public PgFontDescription getFont()
359 	{
360 		auto p = vte_terminal_get_font(vteTerminal);
361 		
362 		if(p is null)
363 		{
364 			return null;
365 		}
366 		
367 		return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p);
368 	}
369 
370 	/**
371 	 * Return: the terminal's font scale
372 	 */
373 	public double getFontScale()
374 	{
375 		return vte_terminal_get_font_scale(vteTerminal);
376 	}
377 
378 	/**
379 	 * Fills in some @hints from @terminal's geometry. The hints
380 	 * filled are those covered by the %GDK_HINT_RESIZE_INC,
381 	 * %GDK_HINT_MIN_SIZE and %GDK_HINT_BASE_SIZE flags.
382 	 *
383 	 * See gtk_window_set_geometry_hints() for more information.
384 	 *
385 	 * @terminal must be realized (see gtk_widget_get_realized()).
386 	 *
387 	 * Params:
388 	 *     hints = a #GdkGeometry to fill in
389 	 *     minRows = the minimum number of rows to request
390 	 *     minColumns = the minimum number of columns to request
391 	 */
392 	public void getGeometryHints(out GdkGeometry hints, int minRows, int minColumns)
393 	{
394 		vte_terminal_get_geometry_hints(vteTerminal, &hints, minRows, minColumns);
395 	}
396 
397 	/**
398 	 * Checks if the terminal currently contains selected text.  Note that this
399 	 * is different from determining if the terminal is the owner of any
400 	 * #GtkClipboard items.
401 	 *
402 	 * Return: %TRUE if part of the text in the terminal is selected.
403 	 */
404 	public bool getHasSelection()
405 	{
406 		return vte_terminal_get_has_selection(vteTerminal) != 0;
407 	}
408 
409 	/**
410 	 * Return: the icon title
411 	 */
412 	public string getIconTitle()
413 	{
414 		return Str.toString(vte_terminal_get_icon_title(vteTerminal));
415 	}
416 
417 	/**
418 	 * Returns whether the terminal allow user input.
419 	 */
420 	public bool getInputEnabled()
421 	{
422 		return vte_terminal_get_input_enabled(vteTerminal) != 0;
423 	}
424 
425 	/**
426 	 * Determines the value of the terminal's mouse autohide setting.  When
427 	 * autohiding is enabled, the mouse cursor will be hidden when the user presses
428 	 * a key and shown when the user moves the mouse.  This setting can be changed
429 	 * using vte_terminal_set_mouse_autohide().
430 	 *
431 	 * Return: %TRUE if autohiding is enabled, %FALSE if not
432 	 */
433 	public bool getMouseAutohide()
434 	{
435 		return vte_terminal_get_mouse_autohide(vteTerminal) != 0;
436 	}
437 
438 	/**
439 	 * Returns the #VtePty of @terminal.
440 	 *
441 	 * Return: a #VtePty, or %NULL
442 	 */
443 	public Pty getPty()
444 	{
445 		auto p = vte_terminal_get_pty(vteTerminal);
446 		
447 		if(p is null)
448 		{
449 			return null;
450 		}
451 		
452 		return ObjectG.getDObject!(Pty)(cast(VtePty*) p);
453 	}
454 
455 	/**
456 	 * Checks whether or not the terminal will rewrap its contents upon resize.
457 	 *
458 	 * Return: %TRUE if rewrapping is enabled, %FALSE if not
459 	 */
460 	public bool getRewrapOnResize()
461 	{
462 		return vte_terminal_get_rewrap_on_resize(vteTerminal) != 0;
463 	}
464 
465 	/**
466 	 * Return: the number of rows
467 	 */
468 	public glong getRowCount()
469 	{
470 		return vte_terminal_get_row_count(vteTerminal);
471 	}
472 
473 	/**
474 	 * Extracts a view of the visible part of the terminal.  If @is_selected is not
475 	 * %NULL, characters will only be read if @is_selected returns %TRUE after being
476 	 * passed the column and row, respectively.  A #VteCharAttributes structure
477 	 * is added to @attributes for each byte added to the returned string detailing
478 	 * the character's position, colors, and other characteristics.
479 	 *
480 	 * Params:
481 	 *     isSelected = a #VteSelectionFunc callback
482 	 *     userData = user data to be passed to the callback
483 	 *     attributes = location for storing text attributes
484 	 *
485 	 * Return: a newly allocated text string, or %NULL.
486 	 */
487 	public string getText(VteSelectionFunc isSelected, void* userData, out ArrayG attributes)
488 	{
489 		GArray* outattributes = gMalloc!GArray();
490 		
491 		auto retStr = vte_terminal_get_text(vteTerminal, isSelected, userData, outattributes);
492 		
493 		attributes = new ArrayG(outattributes, true);
494 		
495 		scope(exit) Str.freeString(retStr);
496 		return Str.toString(retStr);
497 	}
498 
499 	/**
500 	 * Extracts a view of the visible part of the terminal.  If @is_selected is not
501 	 * %NULL, characters will only be read if @is_selected returns %TRUE after being
502 	 * passed the column and row, respectively.  A #VteCharAttributes structure
503 	 * is added to @attributes for each byte added to the returned string detailing
504 	 * the character's position, colors, and other characteristics. This function
505 	 * differs from vte_terminal_get_text() in that trailing spaces at the end of
506 	 * lines are included.
507 	 *
508 	 * Params:
509 	 *     isSelected = a #VteSelectionFunc callback
510 	 *     userData = user data to be passed to the callback
511 	 *     attributes = location for storing text attributes
512 	 *
513 	 * Return: a newly allocated text string, or %NULL.
514 	 */
515 	public string getTextIncludeTrailingSpaces(VteSelectionFunc isSelected, void* userData, out ArrayG attributes)
516 	{
517 		GArray* outattributes = gMalloc!GArray();
518 		
519 		auto retStr = vte_terminal_get_text_include_trailing_spaces(vteTerminal, isSelected, userData, outattributes);
520 		
521 		attributes = new ArrayG(outattributes, true);
522 		
523 		scope(exit) Str.freeString(retStr);
524 		return Str.toString(retStr);
525 	}
526 
527 	/**
528 	 * Extracts a view of the visible part of the terminal.  If @is_selected is not
529 	 * %NULL, characters will only be read if @is_selected returns %TRUE after being
530 	 * passed the column and row, respectively.  A #VteCharAttributes structure
531 	 * is added to @attributes for each byte added to the returned string detailing
532 	 * the character's position, colors, and other characteristics.  The
533 	 * entire scrollback buffer is scanned, so it is possible to read the entire
534 	 * contents of the buffer using this function.
535 	 *
536 	 * Params:
537 	 *     startRow = first row to search for data
538 	 *     startCol = first column to search for data
539 	 *     endRow = last row to search for data
540 	 *     endCol = last column to search for data
541 	 *     isSelected = a #VteSelectionFunc callback
542 	 *     userData = user data to be passed to the callback
543 	 *     attributes = location for storing text attributes
544 	 *
545 	 * Return: a newly allocated text string, or %NULL.
546 	 */
547 	public string getTextRange(glong startRow, glong startCol, glong endRow, glong endCol, VteSelectionFunc isSelected, void* userData, out ArrayG attributes)
548 	{
549 		GArray* outattributes = gMalloc!GArray();
550 		
551 		auto retStr = vte_terminal_get_text_range(vteTerminal, startRow, startCol, endRow, endCol, isSelected, userData, outattributes);
552 		
553 		attributes = new ArrayG(outattributes, true);
554 		
555 		scope(exit) Str.freeString(retStr);
556 		return Str.toString(retStr);
557 	}
558 
559 	/**
560 	 * Return: the window title
561 	 */
562 	public string getWindowTitle()
563 	{
564 		return Str.toString(vte_terminal_get_window_title(vteTerminal));
565 	}
566 
567 	/**
568 	 * Returns the set of characters which will be considered parts of a word
569 	 * when doing word-wise selection, in addition to the default which only
570 	 * considers alphanumeric characters part of a word.
571 	 *
572 	 * If %NULL, a built-in set is used.
573 	 *
574 	 * Return: a string, or %NULL
575 	 *
576 	 * Since: 0.40
577 	 */
578 	public string getWordCharExceptions()
579 	{
580 		return Str.toString(vte_terminal_get_word_char_exceptions(vteTerminal));
581 	}
582 
583 	/**
584 	 * Adds the regular expression @regex to the list of matching expressions.  When the
585 	 * user moves the mouse cursor over a section of displayed text which matches
586 	 * this expression, the text will be highlighted.
587 	 *
588 	 * Deprecated: Use vte_terminal_match_add_regex() or vte_terminal_match_add_regex_full() instead.
589 	 *
590 	 * Params:
591 	 *     gregex = a #GRegex
592 	 *     gflags = the #GRegexMatchFlags to use when matching the regex
593 	 *
594 	 * Return: an integer associated with this expression, or -1 if @gregex could not be
595 	 *     transformed into a #VteRegex or @gflags were incompatible
596 	 */
597 	public int matchAddGregex(Regex gregex, GRegexMatchFlags gflags)
598 	{
599 		return vte_terminal_match_add_gregex(vteTerminal, (gregex is null) ? null : gregex.getRegexStruct(), gflags);
600 	}
601 
602 	/**
603 	 * Adds the regular expression @regex to the list of matching expressions.  When the
604 	 * user moves the mouse cursor over a section of displayed text which matches
605 	 * this expression, the text will be highlighted.
606 	 *
607 	 * Params:
608 	 *     regex = a #VteRegex
609 	 *     flags = PCRE2 match flags, or 0
610 	 *
611 	 * Return: an integer associated with this expression
612 	 *
613 	 * Since: 0.46
614 	 */
615 	public int matchAddRegex(RegexVte regex, uint flags)
616 	{
617 		return vte_terminal_match_add_regex(vteTerminal, (regex is null) ? null : regex.getRegexStruct(), flags);
618 	}
619 
620 	/**
621 	 * Checks if the text in and around the specified position matches any of the
622 	 * regular expressions previously set using vte_terminal_match_add().  If a
623 	 * match exists, the text string is returned and if @tag is not %NULL, the number
624 	 * associated with the matched regular expression will be stored in @tag.
625 	 *
626 	 * If more than one regular expression has been set with
627 	 * vte_terminal_match_add(), then expressions are checked in the order in
628 	 * which they were added.
629 	 *
630 	 * Deprecated: Use vte_terminal_match_check_event() instead.
631 	 *
632 	 * Params:
633 	 *     column = the text column
634 	 *     row = the text row
635 	 *     tag = a location to store the tag, or %NULL
636 	 *
637 	 * Return: a newly allocated string which matches one of the previously
638 	 *     set regular expressions
639 	 */
640 	public string matchCheck(glong column, glong row, out int tag)
641 	{
642 		auto retStr = vte_terminal_match_check(vteTerminal, column, row, &tag);
643 		
644 		scope(exit) Str.freeString(retStr);
645 		return Str.toString(retStr);
646 	}
647 
648 	/**
649 	 * Checks if the text in and around the position of the event matches any of the
650 	 * regular expressions previously set using vte_terminal_match_add().  If a
651 	 * match exists, the text string is returned and if @tag is not %NULL, the number
652 	 * associated with the matched regular expression will be stored in @tag.
653 	 *
654 	 * If more than one regular expression has been set with
655 	 * vte_terminal_match_add(), then expressions are checked in the order in
656 	 * which they were added.
657 	 *
658 	 * Params:
659 	 *     event = a #GdkEvent
660 	 *     tag = a location to store the tag, or %NULL
661 	 *
662 	 * Return: a newly allocated string which matches one of the previously
663 	 *     set regular expressions
664 	 */
665 	public string matchCheckEvent(Event event, out int tag)
666 	{
667 		auto retStr = vte_terminal_match_check_event(vteTerminal, (event is null) ? null : event.getEventStruct(), &tag);
668 		
669 		scope(exit) Str.freeString(retStr);
670 		return Str.toString(retStr);
671 	}
672 
673 	/**
674 	 * Removes the regular expression which is associated with the given @tag from
675 	 * the list of expressions which the terminal will highlight when the user
676 	 * moves the mouse cursor over matching text.
677 	 *
678 	 * Params:
679 	 *     tag = the tag of the regex to remove
680 	 */
681 	public void matchRemove(int tag)
682 	{
683 		vte_terminal_match_remove(vteTerminal, tag);
684 	}
685 
686 	/**
687 	 * Clears the list of regular expressions the terminal uses to highlight text
688 	 * when the user moves the mouse cursor.
689 	 */
690 	public void matchRemoveAll()
691 	{
692 		vte_terminal_match_remove_all(vteTerminal);
693 	}
694 
695 	/**
696 	 * Sets which cursor the terminal will use if the pointer is over the pattern
697 	 * specified by @tag.  The terminal keeps a reference to @cursor.
698 	 *
699 	 * Deprecated: Use vte_terminal_match_set_cursor_type() or vte_terminal_match_set_cursor_named() instead.
700 	 *
701 	 * Params:
702 	 *     tag = the tag of the regex which should use the specified cursor
703 	 *     cursor = the #GdkCursor which the terminal should use when the pattern is
704 	 *         highlighted, or %NULL to use the standard cursor
705 	 */
706 	public void matchSetCursor(int tag, Cursor cursor)
707 	{
708 		vte_terminal_match_set_cursor(vteTerminal, tag, (cursor is null) ? null : cursor.getCursorStruct());
709 	}
710 
711 	/**
712 	 * Sets which cursor the terminal will use if the pointer is over the pattern
713 	 * specified by @tag.
714 	 *
715 	 * Params:
716 	 *     tag = the tag of the regex which should use the specified cursor
717 	 *     cursorName = the name of the cursor
718 	 */
719 	public void matchSetCursorName(int tag, string cursorName)
720 	{
721 		vte_terminal_match_set_cursor_name(vteTerminal, tag, Str.toStringz(cursorName));
722 	}
723 
724 	/**
725 	 * Sets which cursor the terminal will use if the pointer is over the pattern
726 	 * specified by @tag.
727 	 *
728 	 * Params:
729 	 *     tag = the tag of the regex which should use the specified cursor
730 	 *     cursorType = a #GdkCursorType
731 	 */
732 	public void matchSetCursorType(int tag, GdkCursorType cursorType)
733 	{
734 		vte_terminal_match_set_cursor_type(vteTerminal, tag, cursorType);
735 	}
736 
737 	/**
738 	 * Sends the contents of the #GDK_SELECTION_CLIPBOARD selection to the
739 	 * terminal's child.  If necessary, the data is converted from UTF-8 to the
740 	 * terminal's current encoding. It's called on paste menu item, or when
741 	 * user presses Shift+Insert.
742 	 */
743 	public void pasteClipboard()
744 	{
745 		vte_terminal_paste_clipboard(vteTerminal);
746 	}
747 
748 	/**
749 	 * Sends the contents of the #GDK_SELECTION_PRIMARY selection to the terminal's
750 	 * child.  If necessary, the data is converted from UTF-8 to the terminal's
751 	 * current encoding.  The terminal will call also paste the
752 	 * #GDK_SELECTION_PRIMARY selection when the user clicks with the the second
753 	 * mouse button.
754 	 */
755 	public void pastePrimary()
756 	{
757 		vte_terminal_paste_primary(vteTerminal);
758 	}
759 
760 	/**
761 	 * Creates a new #VtePty, and sets the emulation property
762 	 * from #VteTerminal:emulation.
763 	 *
764 	 * See vte_pty_new() for more information.
765 	 *
766 	 * Params:
767 	 *     flags = flags from #VtePtyFlags
768 	 *     cancellable = a #GCancellable, or %NULL
769 	 *
770 	 * Return: a new #VtePty
771 	 *
772 	 * Throws: GException on failure.
773 	 */
774 	public Pty ptyNewSync(VtePtyFlags flags, Cancellable cancellable)
775 	{
776 		GError* err = null;
777 		
778 		auto p = vte_terminal_pty_new_sync(vteTerminal, flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
779 		
780 		if (err !is null)
781 		{
782 			throw new GException( new ErrorG(err) );
783 		}
784 		
785 		if(p is null)
786 		{
787 			return null;
788 		}
789 		
790 		return ObjectG.getDObject!(Pty)(cast(VtePty*) p, true);
791 	}
792 
793 	/**
794 	 * Resets as much of the terminal's internal state as possible, discarding any
795 	 * unprocessed input data, resetting character attributes, cursor state,
796 	 * national character set state, status line, terminal modes (insert/delete),
797 	 * selection state, and encoding.
798 	 *
799 	 * Params:
800 	 *     clearTabstops = whether to reset tabstops
801 	 *     clearHistory = whether to empty the terminal's scrollback buffer
802 	 */
803 	public void reset(bool clearTabstops, bool clearHistory)
804 	{
805 		vte_terminal_reset(vteTerminal, clearTabstops, clearHistory);
806 	}
807 
808 	/**
809 	 * Searches the next string matching the search regex set with
810 	 * vte_terminal_search_set_regex().
811 	 *
812 	 * Return: %TRUE if a match was found
813 	 */
814 	public bool searchFindNext()
815 	{
816 		return vte_terminal_search_find_next(vteTerminal) != 0;
817 	}
818 
819 	/**
820 	 * Searches the previous string matching the search regex set with
821 	 * vte_terminal_search_set_regex().
822 	 *
823 	 * Return: %TRUE if a match was found
824 	 */
825 	public bool searchFindPrevious()
826 	{
827 		return vte_terminal_search_find_previous(vteTerminal) != 0;
828 	}
829 
830 	/**
831 	 *
832 	 *
833 	 * Deprecated: use vte_terminal_search_get_regex() instead.
834 	 *
835 	 * Return: %NULL
836 	 */
837 	public Regex searchGetGregex()
838 	{
839 		auto p = vte_terminal_search_get_gregex(vteTerminal);
840 		
841 		if(p is null)
842 		{
843 			return null;
844 		}
845 		
846 		return new Regex(cast(GRegex*) p);
847 	}
848 
849 	/**
850 	 * Return: the search #VteRegex regex set in @terminal, or %NULL
851 	 *
852 	 * Since: 0.46
853 	 */
854 	public RegexVte searchGetRegex()
855 	{
856 		auto p = vte_terminal_search_get_regex(vteTerminal);
857 		
858 		if(p is null)
859 		{
860 			return null;
861 		}
862 		
863 		return ObjectG.getDObject!(RegexVte)(cast(VteRegex*) p);
864 	}
865 
866 	/**
867 	 * Return: whether searching will wrap around
868 	 */
869 	public bool searchGetWrapAround()
870 	{
871 		return vte_terminal_search_get_wrap_around(vteTerminal) != 0;
872 	}
873 
874 	/**
875 	 * Sets the #GRegex regex to search for. Unsets the search regex when passed %NULL.
876 	 *
877 	 * Deprecated: use vte_terminal_search_set_regex() instead.
878 	 *
879 	 * Params:
880 	 *     gregex = a #GRegex, or %NULL
881 	 *     gflags = flags from #GRegexMatchFlags
882 	 */
883 	public void searchSetGregex(Regex gregex, GRegexMatchFlags gflags)
884 	{
885 		vte_terminal_search_set_gregex(vteTerminal, (gregex is null) ? null : gregex.getRegexStruct(), gflags);
886 	}
887 
888 	/**
889 	 * Sets the regex to search for. Unsets the search regex when passed %NULL.
890 	 *
891 	 * Params:
892 	 *     regex = a #VteRegex, or %NULL
893 	 *     flags = PCRE2 match flags, or 0
894 	 *
895 	 * Since: 0.46
896 	 */
897 	public void searchSetRegex(RegexVte regex, uint flags)
898 	{
899 		vte_terminal_search_set_regex(vteTerminal, (regex is null) ? null : regex.getRegexStruct(), flags);
900 	}
901 
902 	/**
903 	 * Sets whether search should wrap around to the beginning of the
904 	 * terminal content when reaching its end.
905 	 *
906 	 * Params:
907 	 *     wrapAround = whether search should wrap
908 	 */
909 	public void searchSetWrapAround(bool wrapAround)
910 	{
911 		vte_terminal_search_set_wrap_around(vteTerminal, wrapAround);
912 	}
913 
914 	/**
915 	 * Selects all text within the terminal (including the scrollback buffer).
916 	 */
917 	public void selectAll()
918 	{
919 		vte_terminal_select_all(vteTerminal);
920 	}
921 
922 	/**
923 	 * Controls whether or not the terminal will attempt to draw bold text,
924 	 * either by using a bold font variant or by repainting text with a different
925 	 * offset.
926 	 *
927 	 * Params:
928 	 *     allowBold = %TRUE if the terminal should attempt to draw bold text
929 	 */
930 	public void setAllowBold(bool allowBold)
931 	{
932 		vte_terminal_set_allow_bold(vteTerminal, allowBold);
933 	}
934 
935 	/**
936 	 * Controls whether or not the terminal will beep when the child outputs the
937 	 * "bl" sequence.
938 	 *
939 	 * Params:
940 	 *     isAudible = %TRUE if the terminal should beep
941 	 */
942 	public void setAudibleBell(bool isAudible)
943 	{
944 		vte_terminal_set_audible_bell(vteTerminal, isAudible);
945 	}
946 
947 	/**
948 	 * Modifies the terminal's backspace key binding, which controls what
949 	 * string or control sequence the terminal sends to its child when the user
950 	 * presses the backspace key.
951 	 *
952 	 * Params:
953 	 *     binding = a #VteEraseBinding for the backspace key
954 	 */
955 	public void setBackspaceBinding(VteEraseBinding binding)
956 	{
957 		vte_terminal_set_backspace_binding(vteTerminal, binding);
958 	}
959 
960 	/**
961 	 * This setting controls whether ambiguous-width characters are narrow or wide
962 	 * when using the UTF-8 encoding (vte_terminal_set_encoding()). In all other encodings,
963 	 * the width of ambiguous-width characters is fixed.
964 	 *
965 	 * Params:
966 	 *     width = either 1 (narrow) or 2 (wide)
967 	 */
968 	public void setCjkAmbiguousWidth(int width)
969 	{
970 		vte_terminal_set_cjk_ambiguous_width(vteTerminal, width);
971 	}
972 
973 	/**
974 	 * Sets the background color for text which does not have a specific background
975 	 * color assigned.  Only has effect when no background image is set and when
976 	 * the terminal is not transparent.
977 	 *
978 	 * Params:
979 	 *     background = the new background color
980 	 */
981 	public void setColorBackground(RGBA background)
982 	{
983 		vte_terminal_set_color_background(vteTerminal, (background is null) ? null : background.getRGBAStruct());
984 	}
985 
986 	/**
987 	 * Sets the color used to draw bold text in the default foreground color.
988 	 * If @bold is %NULL then the default color is used.
989 	 *
990 	 * Params:
991 	 *     bold = the new bold color or %NULL
992 	 */
993 	public void setColorBold(RGBA bold)
994 	{
995 		vte_terminal_set_color_bold(vteTerminal, (bold is null) ? null : bold.getRGBAStruct());
996 	}
997 
998 	/**
999 	 * Sets the background color for text which is under the cursor.  If %NULL, text
1000 	 * under the cursor will be drawn with foreground and background colors
1001 	 * reversed.
1002 	 *
1003 	 * Params:
1004 	 *     cursorBackground = the new color to use for the text cursor, or %NULL
1005 	 */
1006 	public void setColorCursor(RGBA cursorBackground)
1007 	{
1008 		vte_terminal_set_color_cursor(vteTerminal, (cursorBackground is null) ? null : cursorBackground.getRGBAStruct());
1009 	}
1010 
1011 	/**
1012 	 * Sets the foreground color for text which is under the cursor.  If %NULL, text
1013 	 * under the cursor will be drawn with foreground and background colors
1014 	 * reversed.
1015 	 *
1016 	 * Params:
1017 	 *     cursorForeground = the new color to use for the text cursor, or %NULL
1018 	 *
1019 	 * Since: 0.44
1020 	 */
1021 	public void setColorCursorForeground(RGBA cursorForeground)
1022 	{
1023 		vte_terminal_set_color_cursor_foreground(vteTerminal, (cursorForeground is null) ? null : cursorForeground.getRGBAStruct());
1024 	}
1025 
1026 	/**
1027 	 * Sets the foreground color used to draw normal text.
1028 	 *
1029 	 * Params:
1030 	 *     foreground = the new foreground color
1031 	 */
1032 	public void setColorForeground(RGBA foreground)
1033 	{
1034 		vte_terminal_set_color_foreground(vteTerminal, (foreground is null) ? null : foreground.getRGBAStruct());
1035 	}
1036 
1037 	/**
1038 	 * Sets the background color for text which is highlighted.  If %NULL,
1039 	 * it is unset.  If neither highlight background nor highlight foreground are set,
1040 	 * highlighted text (which is usually highlighted because it is selected) will
1041 	 * be drawn with foreground and background colors reversed.
1042 	 *
1043 	 * Params:
1044 	 *     highlightBackground = the new color to use for highlighted text, or %NULL
1045 	 */
1046 	public void setColorHighlight(RGBA highlightBackground)
1047 	{
1048 		vte_terminal_set_color_highlight(vteTerminal, (highlightBackground is null) ? null : highlightBackground.getRGBAStruct());
1049 	}
1050 
1051 	/**
1052 	 * Sets the foreground color for text which is highlighted.  If %NULL,
1053 	 * it is unset.  If neither highlight background nor highlight foreground are set,
1054 	 * highlighted text (which is usually highlighted because it is selected) will
1055 	 * be drawn with foreground and background colors reversed.
1056 	 *
1057 	 * Params:
1058 	 *     highlightForeground = the new color to use for highlighted text, or %NULL
1059 	 */
1060 	public void setColorHighlightForeground(RGBA highlightForeground)
1061 	{
1062 		vte_terminal_set_color_highlight_foreground(vteTerminal, (highlightForeground is null) ? null : highlightForeground.getRGBAStruct());
1063 	}
1064 
1065 	/**
1066 	 * @palette specifies the new values for the 256 palette colors: 8 standard colors,
1067 	 * their 8 bright counterparts, 6x6x6 color cube, and 24 grayscale colors.
1068 	 * Omitted entries will default to a hardcoded value.
1069 	 *
1070 	 * @palette_size must be 0, 8, 16, 232 or 256.
1071 	 *
1072 	 * If @foreground is %NULL and @palette_size is greater than 0, the new foreground
1073 	 * color is taken from @palette[7].  If @background is %NULL and @palette_size is
1074 	 * greater than 0, the new background color is taken from @palette[0].
1075 	 *
1076 	 * Params:
1077 	 *     foreground = the new foreground color, or %NULL
1078 	 *     background = the new background color, or %NULL
1079 	 *     palette = the color palette
1080 	 *     paletteSize = the number of entries in @palette
1081 	 */
1082 	public void setColors(RGBA foreground, RGBA background, RGBA[] palette)
1083 	{
1084 		GdkRGBA[] paletteArray = new GdkRGBA[palette.length];
1085 		for ( int i = 0; i < palette.length; i++ )
1086 		{
1087 			paletteArray[i] = *(palette[i].getRGBAStruct());
1088 		}
1089 		
1090 		vte_terminal_set_colors(vteTerminal, (foreground is null) ? null : foreground.getRGBAStruct(), (background is null) ? null : background.getRGBAStruct(), paletteArray.ptr, cast(size_t)palette.length);
1091 	}
1092 
1093 	/**
1094 	 * Sets whether or not the cursor will blink. Using %VTE_CURSOR_BLINK_SYSTEM
1095 	 * will use the #GtkSettings::gtk-cursor-blink setting.
1096 	 *
1097 	 * Params:
1098 	 *     mode = the #VteCursorBlinkMode to use
1099 	 */
1100 	public void setCursorBlinkMode(VteCursorBlinkMode mode)
1101 	{
1102 		vte_terminal_set_cursor_blink_mode(vteTerminal, mode);
1103 	}
1104 
1105 	/**
1106 	 * Sets the shape of the cursor drawn.
1107 	 *
1108 	 * Params:
1109 	 *     shape = the #VteCursorShape to use
1110 	 */
1111 	public void setCursorShape(VteCursorShape shape)
1112 	{
1113 		vte_terminal_set_cursor_shape(vteTerminal, shape);
1114 	}
1115 
1116 	/**
1117 	 * Reset the terminal palette to reasonable compiled-in default color.
1118 	 */
1119 	public void setDefaultColors()
1120 	{
1121 		vte_terminal_set_default_colors(vteTerminal);
1122 	}
1123 
1124 	/**
1125 	 * Modifies the terminal's delete key binding, which controls what
1126 	 * string or control sequence the terminal sends to its child when the user
1127 	 * presses the delete key.
1128 	 *
1129 	 * Params:
1130 	 *     binding = a #VteEraseBinding for the delete key
1131 	 */
1132 	public void setDeleteBinding(VteEraseBinding binding)
1133 	{
1134 		vte_terminal_set_delete_binding(vteTerminal, binding);
1135 	}
1136 
1137 	/**
1138 	 * Changes the encoding the terminal will expect data from the child to
1139 	 * be encoded with.  For certain terminal types, applications executing in the
1140 	 * terminal can change the encoding. If @codeset is %NULL, it uses "UTF-8".
1141 	 *
1142 	 * Params:
1143 	 *     codeset = a valid #GIConv target, or %NULL to use UTF-8
1144 	 *
1145 	 * Return: %TRUE if the encoding could be changed to the specified one,
1146 	 *     or %FALSE with @error set to %G_CONVERT_ERROR_NO_CONVERSION.
1147 	 *
1148 	 * Throws: GException on failure.
1149 	 */
1150 	public bool setEncoding(string codeset)
1151 	{
1152 		GError* err = null;
1153 		
1154 		auto p = vte_terminal_set_encoding(vteTerminal, Str.toStringz(codeset), &err) != 0;
1155 		
1156 		if (err !is null)
1157 		{
1158 			throw new GException( new ErrorG(err) );
1159 		}
1160 		
1161 		return p;
1162 	}
1163 
1164 	/**
1165 	 * Sets the font used for rendering all text displayed by the terminal,
1166 	 * overriding any fonts set using gtk_widget_modify_font().  The terminal
1167 	 * will immediately attempt to load the desired font, retrieve its
1168 	 * metrics, and attempt to resize itself to keep the same number of rows
1169 	 * and columns.  The font scale is applied to the specified font.
1170 	 *
1171 	 * Params:
1172 	 *     fontDesc = a #PangoFontDescription for the desired font, or %NULL
1173 	 */
1174 	public void setFont(PgFontDescription fontDesc)
1175 	{
1176 		vte_terminal_set_font(vteTerminal, (fontDesc is null) ? null : fontDesc.getPgFontDescriptionStruct());
1177 	}
1178 
1179 	/**
1180 	 * Sets the terminal's font scale to @scale.
1181 	 *
1182 	 * Params:
1183 	 *     scale = the font scale
1184 	 */
1185 	public void setFontScale(double scale)
1186 	{
1187 		vte_terminal_set_font_scale(vteTerminal, scale);
1188 	}
1189 
1190 	/**
1191 	 * Sets @terminal as @window's geometry widget. See
1192 	 * gtk_window_set_geometry_hints() for more information.
1193 	 *
1194 	 * @terminal must be realized (see gtk_widget_get_realized()).
1195 	 *
1196 	 * Params:
1197 	 *     window = a #GtkWindow
1198 	 */
1199 	public void setGeometryHintsForWindow(Window window)
1200 	{
1201 		vte_terminal_set_geometry_hints_for_window(vteTerminal, (window is null) ? null : window.getWindowStruct());
1202 	}
1203 
1204 	/**
1205 	 * Enables or disables user input. When user input is disabled,
1206 	 * the terminal's child will not receive any key press, or mouse button
1207 	 * press or motion events sent to it.
1208 	 *
1209 	 * Params:
1210 	 *     enabled = whether to enable user input
1211 	 */
1212 	public void setInputEnabled(bool enabled)
1213 	{
1214 		vte_terminal_set_input_enabled(vteTerminal, enabled);
1215 	}
1216 
1217 	/**
1218 	 * Changes the value of the terminal's mouse autohide setting.  When autohiding
1219 	 * is enabled, the mouse cursor will be hidden when the user presses a key and
1220 	 * shown when the user moves the mouse.  This setting can be read using
1221 	 * vte_terminal_get_mouse_autohide().
1222 	 *
1223 	 * Params:
1224 	 *     setting = whether the mouse pointer should autohide
1225 	 */
1226 	public void setMouseAutohide(bool setting)
1227 	{
1228 		vte_terminal_set_mouse_autohide(vteTerminal, setting);
1229 	}
1230 
1231 	/**
1232 	 * Sets @pty as the PTY to use in @terminal.
1233 	 * Use %NULL to unset the PTY.
1234 	 *
1235 	 * Params:
1236 	 *     pty = a #VtePty, or %NULL
1237 	 */
1238 	public void setPty(Pty pty)
1239 	{
1240 		vte_terminal_set_pty(vteTerminal, (pty is null) ? null : pty.getPtyStruct());
1241 	}
1242 
1243 	/**
1244 	 * Controls whether or not the terminal will rewrap its contents, including
1245 	 * the scrollback history, whenever the terminal's width changes.
1246 	 *
1247 	 * Params:
1248 	 *     rewrap = %TRUE if the terminal should rewrap on resize
1249 	 */
1250 	public void setRewrapOnResize(bool rewrap)
1251 	{
1252 		vte_terminal_set_rewrap_on_resize(vteTerminal, rewrap);
1253 	}
1254 
1255 	/**
1256 	 * Controls whether or not the terminal will forcibly scroll to the bottom of
1257 	 * the viewable history when the user presses a key.  Modifier keys do not
1258 	 * trigger this behavior.
1259 	 *
1260 	 * Params:
1261 	 *     scroll = whether the terminal should scroll on keystrokes
1262 	 */
1263 	public void setScrollOnKeystroke(bool scroll)
1264 	{
1265 		vte_terminal_set_scroll_on_keystroke(vteTerminal, scroll);
1266 	}
1267 
1268 	/**
1269 	 * Controls whether or not the terminal will forcibly scroll to the bottom of
1270 	 * the viewable history when the new data is received from the child.
1271 	 *
1272 	 * Params:
1273 	 *     scroll = whether the terminal should scroll on output
1274 	 */
1275 	public void setScrollOnOutput(bool scroll)
1276 	{
1277 		vte_terminal_set_scroll_on_output(vteTerminal, scroll);
1278 	}
1279 
1280 	/**
1281 	 * Sets the length of the scrollback buffer used by the terminal.  The size of
1282 	 * the scrollback buffer will be set to the larger of this value and the number
1283 	 * of visible rows the widget can display, so 0 can safely be used to disable
1284 	 * scrollback.
1285 	 *
1286 	 * A negative value means "infinite scrollback".
1287 	 *
1288 	 * Note that this setting only affects the normal screen buffer.
1289 	 * No scrollback is allowed on the alternate screen buffer.
1290 	 *
1291 	 * Params:
1292 	 *     lines = the length of the history buffer
1293 	 */
1294 	public void setScrollbackLines(glong lines)
1295 	{
1296 		vte_terminal_set_scrollback_lines(vteTerminal, lines);
1297 	}
1298 
1299 	/**
1300 	 * Attempts to change the terminal's size in terms of rows and columns.  If
1301 	 * the attempt succeeds, the widget will resize itself to the proper size.
1302 	 *
1303 	 * Params:
1304 	 *     columns = the desired number of columns
1305 	 *     rows = the desired number of rows
1306 	 */
1307 	public void setSize(glong columns, glong rows)
1308 	{
1309 		vte_terminal_set_size(vteTerminal, columns, rows);
1310 	}
1311 
1312 	/**
1313 	 * With this function you can provide a set of characters which will
1314 	 * be considered parts of a word when doing word-wise selection, in
1315 	 * addition to the default which only considers alphanumeric characters
1316 	 * part of a word.
1317 	 *
1318 	 * The characters in @exceptions must be non-alphanumeric, each character
1319 	 * must occur only once, and if @exceptions contains the character
1320 	 * U+002D HYPHEN-MINUS, it must be at the start of the string.
1321 	 *
1322 	 * Use %NULL to reset the set of exception characters to the default.
1323 	 *
1324 	 * Params:
1325 	 *     exceptions = a string of ASCII punctuation characters, or %NULL
1326 	 *
1327 	 * Since: 0.40
1328 	 */
1329 	public void setWordCharExceptions(string exceptions)
1330 	{
1331 		vte_terminal_set_word_char_exceptions(vteTerminal, Str.toStringz(exceptions));
1332 	}
1333 
1334 	/**
1335 	 * Starts the specified command under a newly-allocated controlling
1336 	 * pseudo-terminal.  The @argv and @envv lists should be %NULL-terminated.
1337 	 * The "TERM" environment variable is automatically set to a default value,
1338 	 * but can be overridden from @envv.
1339 	 * @pty_flags controls logging the session to the specified system log files.
1340 	 *
1341 	 * Note that %G_SPAWN_DO_NOT_REAP_CHILD will always be added to @spawn_flags.
1342 	 *
1343 	 * Note that all open file descriptors will be closed in the child. If you want
1344 	 * to keep some file descriptor open for use in the child process, you need to
1345 	 * use a child setup function that unsets the FD_CLOEXEC flag on that file
1346 	 * descriptor.
1347 	 *
1348 	 * See vte_pty_new(), g_spawn_async() and vte_terminal_watch_child() for more information.
1349 	 *
1350 	 * Params:
1351 	 *     ptyFlags = flags from #VtePtyFlags
1352 	 *     workingDirectory = the name of a directory the command should start
1353 	 *         in, or %NULL to use the current working directory
1354 	 *     argv = child's argument vector
1355 	 *     envv = a list of environment
1356 	 *         variables to be added to the environment before starting the process, or %NULL
1357 	 *     spawnFlags = flags from #GSpawnFlags
1358 	 *     childSetup = an extra child setup function to run in the child just before exec(), or %NULL
1359 	 *     childSetupData = user data for @child_setup
1360 	 *     childPid = a location to store the child PID, or %NULL
1361 	 *     cancellable = a #GCancellable, or %NULL
1362 	 *
1363 	 * Return: %TRUE on success, or %FALSE on error with @error filled in
1364 	 *
1365 	 * Throws: GException on failure.
1366 	 */
1367 	public bool spawnSync(VtePtyFlags ptyFlags, string workingDirectory, string[] argv, string[] envv, GSpawnFlags spawnFlags, GSpawnChildSetupFunc childSetup, void* childSetupData, out GPid childPid, Cancellable cancellable)
1368 	{
1369 		GError* err = null;
1370 		
1371 		auto p = vte_terminal_spawn_sync(vteTerminal, ptyFlags, Str.toStringz(workingDirectory), Str.toStringzArray(argv), Str.toStringzArray(envv), spawnFlags, childSetup, childSetupData, &childPid, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
1372 		
1373 		if (err !is null)
1374 		{
1375 			throw new GException( new ErrorG(err) );
1376 		}
1377 		
1378 		return p;
1379 	}
1380 
1381 	/**
1382 	 * Clears the current selection.
1383 	 */
1384 	public void unselectAll()
1385 	{
1386 		vte_terminal_unselect_all(vteTerminal);
1387 	}
1388 
1389 	/**
1390 	 * Watches @child_pid. When the process exists, the #VteTerminal::child-exited
1391 	 * signal will be called with the child's exit status.
1392 	 *
1393 	 * Prior to calling this function, a #VtePty must have been set in @terminal
1394 	 * using vte_terminal_set_pty().
1395 	 * When the child exits, the terminal's #VtePty will be set to %NULL.
1396 	 *
1397 	 * Note: g_child_watch_add() or g_child_watch_add_full() must not have
1398 	 * been called for @child_pid, nor a #GSource for it been created with
1399 	 * g_child_watch_source_new().
1400 	 *
1401 	 * Note: when using the g_spawn_async() family of functions,
1402 	 * the %G_SPAWN_DO_NOT_REAP_CHILD flag MUST have been passed.
1403 	 *
1404 	 * Params:
1405 	 *     childPid = a #GPid
1406 	 */
1407 	public void watchChild(GPid childPid)
1408 	{
1409 		vte_terminal_watch_child(vteTerminal, childPid);
1410 	}
1411 
1412 	/**
1413 	 * Write contents of the current contents of @terminal (including any
1414 	 * scrollback history) to @stream according to @flags.
1415 	 *
1416 	 * If @cancellable is not %NULL, then the operation can be cancelled by triggering
1417 	 * the cancellable object from another thread. If the operation was cancelled,
1418 	 * the error %G_IO_ERROR_CANCELLED will be returned in @error.
1419 	 *
1420 	 * This is a synchronous operation and will make the widget (and input
1421 	 * processing) during the write operation, which may take a long time
1422 	 * depending on scrollback history and @stream availability for writing.
1423 	 *
1424 	 * Params:
1425 	 *     stream = a #GOutputStream to write to
1426 	 *     flags = a set of #VteWriteFlags
1427 	 *     cancellable = a #GCancellable object, or %NULL
1428 	 *
1429 	 * Return: %TRUE on success, %FALSE if there was an error
1430 	 *
1431 	 * Throws: GException on failure.
1432 	 */
1433 	public bool writeContentsSync(OutputStream stream, VteWriteFlags flags, Cancellable cancellable)
1434 	{
1435 		GError* err = null;
1436 		
1437 		auto p = vte_terminal_write_contents_sync(vteTerminal, (stream is null) ? null : stream.getOutputStreamStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
1438 		
1439 		if (err !is null)
1440 		{
1441 			throw new GException( new ErrorG(err) );
1442 		}
1443 		
1444 		return p;
1445 	}
1446 
1447 	protected class OnBellDelegateWrapper
1448 	{
1449 		void delegate(Terminal) dlg;
1450 		gulong handlerId;
1451 		ConnectFlags flags;
1452 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
1453 		{
1454 			this.dlg = dlg;
1455 			this.handlerId = handlerId;
1456 			this.flags = flags;
1457 		}
1458 	}
1459 	protected OnBellDelegateWrapper[] onBellListeners;
1460 
1461 	/**
1462 	 * This signal is emitted when the a child sends a bell request to the
1463 	 * terminal.
1464 	 */
1465 	gulong addOnBell(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1466 	{
1467 		onBellListeners ~= new OnBellDelegateWrapper(dlg, 0, connectFlags);
1468 		onBellListeners[onBellListeners.length - 1].handlerId = Signals.connectData(
1469 			this,
1470 			"bell",
1471 			cast(GCallback)&callBackBell,
1472 			cast(void*)onBellListeners[onBellListeners.length - 1],
1473 			cast(GClosureNotify)&callBackBellDestroy,
1474 			connectFlags);
1475 		return onBellListeners[onBellListeners.length - 1].handlerId;
1476 	}
1477 	
1478 	extern(C) static void callBackBell(VteTerminal* terminalStruct,OnBellDelegateWrapper wrapper)
1479 	{
1480 		wrapper.dlg(wrapper.outer);
1481 	}
1482 	
1483 	extern(C) static void callBackBellDestroy(OnBellDelegateWrapper wrapper, GClosure* closure)
1484 	{
1485 		wrapper.outer.internalRemoveOnBell(wrapper);
1486 	}
1487 
1488 	protected void internalRemoveOnBell(OnBellDelegateWrapper source)
1489 	{
1490 		foreach(index, wrapper; onBellListeners)
1491 		{
1492 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1493 			{
1494 				onBellListeners[index] = null;
1495 				onBellListeners = std.algorithm.remove(onBellListeners, index);
1496 				break;
1497 			}
1498 		}
1499 	}
1500 	
1501 
1502 	protected class OnCharSizeChangedDelegateWrapper
1503 	{
1504 		void delegate(uint, uint, Terminal) dlg;
1505 		gulong handlerId;
1506 		ConnectFlags flags;
1507 		this(void delegate(uint, uint, Terminal) dlg, gulong handlerId, ConnectFlags flags)
1508 		{
1509 			this.dlg = dlg;
1510 			this.handlerId = handlerId;
1511 			this.flags = flags;
1512 		}
1513 	}
1514 	protected OnCharSizeChangedDelegateWrapper[] onCharSizeChangedListeners;
1515 
1516 	/**
1517 	 * Emitted whenever selection of a new font causes the values of the
1518 	 * %char_width or %char_height fields to change.
1519 	 *
1520 	 * Params:
1521 	 *     width = the new character cell width
1522 	 *     height = the new character cell height
1523 	 */
1524 	gulong addOnCharSizeChanged(void delegate(uint, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1525 	{
1526 		onCharSizeChangedListeners ~= new OnCharSizeChangedDelegateWrapper(dlg, 0, connectFlags);
1527 		onCharSizeChangedListeners[onCharSizeChangedListeners.length - 1].handlerId = Signals.connectData(
1528 			this,
1529 			"char-size-changed",
1530 			cast(GCallback)&callBackCharSizeChanged,
1531 			cast(void*)onCharSizeChangedListeners[onCharSizeChangedListeners.length - 1],
1532 			cast(GClosureNotify)&callBackCharSizeChangedDestroy,
1533 			connectFlags);
1534 		return onCharSizeChangedListeners[onCharSizeChangedListeners.length - 1].handlerId;
1535 	}
1536 	
1537 	extern(C) static void callBackCharSizeChanged(VteTerminal* terminalStruct, uint width, uint height,OnCharSizeChangedDelegateWrapper wrapper)
1538 	{
1539 		wrapper.dlg(width, height, wrapper.outer);
1540 	}
1541 	
1542 	extern(C) static void callBackCharSizeChangedDestroy(OnCharSizeChangedDelegateWrapper wrapper, GClosure* closure)
1543 	{
1544 		wrapper.outer.internalRemoveOnCharSizeChanged(wrapper);
1545 	}
1546 
1547 	protected void internalRemoveOnCharSizeChanged(OnCharSizeChangedDelegateWrapper source)
1548 	{
1549 		foreach(index, wrapper; onCharSizeChangedListeners)
1550 		{
1551 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1552 			{
1553 				onCharSizeChangedListeners[index] = null;
1554 				onCharSizeChangedListeners = std.algorithm.remove(onCharSizeChangedListeners, index);
1555 				break;
1556 			}
1557 		}
1558 	}
1559 	
1560 
1561 	protected class OnChildExitedDelegateWrapper
1562 	{
1563 		void delegate(int, Terminal) dlg;
1564 		gulong handlerId;
1565 		ConnectFlags flags;
1566 		this(void delegate(int, Terminal) dlg, gulong handlerId, ConnectFlags flags)
1567 		{
1568 			this.dlg = dlg;
1569 			this.handlerId = handlerId;
1570 			this.flags = flags;
1571 		}
1572 	}
1573 	protected OnChildExitedDelegateWrapper[] onChildExitedListeners;
1574 
1575 	/**
1576 	 * This signal is emitted when the terminal detects that a child
1577 	 * watched using vte_terminal_watch_child() has exited.
1578 	 *
1579 	 * Params:
1580 	 *     status = the child's exit status
1581 	 */
1582 	gulong addOnChildExited(void delegate(int, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1583 	{
1584 		onChildExitedListeners ~= new OnChildExitedDelegateWrapper(dlg, 0, connectFlags);
1585 		onChildExitedListeners[onChildExitedListeners.length - 1].handlerId = Signals.connectData(
1586 			this,
1587 			"child-exited",
1588 			cast(GCallback)&callBackChildExited,
1589 			cast(void*)onChildExitedListeners[onChildExitedListeners.length - 1],
1590 			cast(GClosureNotify)&callBackChildExitedDestroy,
1591 			connectFlags);
1592 		return onChildExitedListeners[onChildExitedListeners.length - 1].handlerId;
1593 	}
1594 	
1595 	extern(C) static void callBackChildExited(VteTerminal* terminalStruct, int status,OnChildExitedDelegateWrapper wrapper)
1596 	{
1597 		wrapper.dlg(status, wrapper.outer);
1598 	}
1599 	
1600 	extern(C) static void callBackChildExitedDestroy(OnChildExitedDelegateWrapper wrapper, GClosure* closure)
1601 	{
1602 		wrapper.outer.internalRemoveOnChildExited(wrapper);
1603 	}
1604 
1605 	protected void internalRemoveOnChildExited(OnChildExitedDelegateWrapper source)
1606 	{
1607 		foreach(index, wrapper; onChildExitedListeners)
1608 		{
1609 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1610 			{
1611 				onChildExitedListeners[index] = null;
1612 				onChildExitedListeners = std.algorithm.remove(onChildExitedListeners, index);
1613 				break;
1614 			}
1615 		}
1616 	}
1617 	
1618 
1619 	protected class OnCommitDelegateWrapper
1620 	{
1621 		void delegate(string, uint, Terminal) dlg;
1622 		gulong handlerId;
1623 		ConnectFlags flags;
1624 		this(void delegate(string, uint, Terminal) dlg, gulong handlerId, ConnectFlags flags)
1625 		{
1626 			this.dlg = dlg;
1627 			this.handlerId = handlerId;
1628 			this.flags = flags;
1629 		}
1630 	}
1631 	protected OnCommitDelegateWrapper[] onCommitListeners;
1632 
1633 	/**
1634 	 * Emitted whenever the terminal receives input from the user and
1635 	 * prepares to send it to the child process.  The signal is emitted even
1636 	 * when there is no child process.
1637 	 *
1638 	 * Params:
1639 	 *     text = a string of text
1640 	 *     size = the length of that string of text
1641 	 */
1642 	gulong addOnCommit(void delegate(string, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1643 	{
1644 		onCommitListeners ~= new OnCommitDelegateWrapper(dlg, 0, connectFlags);
1645 		onCommitListeners[onCommitListeners.length - 1].handlerId = Signals.connectData(
1646 			this,
1647 			"commit",
1648 			cast(GCallback)&callBackCommit,
1649 			cast(void*)onCommitListeners[onCommitListeners.length - 1],
1650 			cast(GClosureNotify)&callBackCommitDestroy,
1651 			connectFlags);
1652 		return onCommitListeners[onCommitListeners.length - 1].handlerId;
1653 	}
1654 	
1655 	extern(C) static void callBackCommit(VteTerminal* terminalStruct, char* text, uint size,OnCommitDelegateWrapper wrapper)
1656 	{
1657 		wrapper.dlg(Str.toString(text), size, wrapper.outer);
1658 	}
1659 	
1660 	extern(C) static void callBackCommitDestroy(OnCommitDelegateWrapper wrapper, GClosure* closure)
1661 	{
1662 		wrapper.outer.internalRemoveOnCommit(wrapper);
1663 	}
1664 
1665 	protected void internalRemoveOnCommit(OnCommitDelegateWrapper source)
1666 	{
1667 		foreach(index, wrapper; onCommitListeners)
1668 		{
1669 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1670 			{
1671 				onCommitListeners[index] = null;
1672 				onCommitListeners = std.algorithm.remove(onCommitListeners, index);
1673 				break;
1674 			}
1675 		}
1676 	}
1677 	
1678 
1679 	protected class OnContentsChangedDelegateWrapper
1680 	{
1681 		void delegate(Terminal) dlg;
1682 		gulong handlerId;
1683 		ConnectFlags flags;
1684 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
1685 		{
1686 			this.dlg = dlg;
1687 			this.handlerId = handlerId;
1688 			this.flags = flags;
1689 		}
1690 	}
1691 	protected OnContentsChangedDelegateWrapper[] onContentsChangedListeners;
1692 
1693 	/**
1694 	 * Emitted whenever the visible appearance of the terminal has changed.
1695 	 * Used primarily by #VteTerminalAccessible.
1696 	 */
1697 	gulong addOnContentsChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1698 	{
1699 		onContentsChangedListeners ~= new OnContentsChangedDelegateWrapper(dlg, 0, connectFlags);
1700 		onContentsChangedListeners[onContentsChangedListeners.length - 1].handlerId = Signals.connectData(
1701 			this,
1702 			"contents-changed",
1703 			cast(GCallback)&callBackContentsChanged,
1704 			cast(void*)onContentsChangedListeners[onContentsChangedListeners.length - 1],
1705 			cast(GClosureNotify)&callBackContentsChangedDestroy,
1706 			connectFlags);
1707 		return onContentsChangedListeners[onContentsChangedListeners.length - 1].handlerId;
1708 	}
1709 	
1710 	extern(C) static void callBackContentsChanged(VteTerminal* terminalStruct,OnContentsChangedDelegateWrapper wrapper)
1711 	{
1712 		wrapper.dlg(wrapper.outer);
1713 	}
1714 	
1715 	extern(C) static void callBackContentsChangedDestroy(OnContentsChangedDelegateWrapper wrapper, GClosure* closure)
1716 	{
1717 		wrapper.outer.internalRemoveOnContentsChanged(wrapper);
1718 	}
1719 
1720 	protected void internalRemoveOnContentsChanged(OnContentsChangedDelegateWrapper source)
1721 	{
1722 		foreach(index, wrapper; onContentsChangedListeners)
1723 		{
1724 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1725 			{
1726 				onContentsChangedListeners[index] = null;
1727 				onContentsChangedListeners = std.algorithm.remove(onContentsChangedListeners, index);
1728 				break;
1729 			}
1730 		}
1731 	}
1732 	
1733 
1734 	protected class OnCopyClipboardDelegateWrapper
1735 	{
1736 		void delegate(Terminal) dlg;
1737 		gulong handlerId;
1738 		ConnectFlags flags;
1739 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
1740 		{
1741 			this.dlg = dlg;
1742 			this.handlerId = handlerId;
1743 			this.flags = flags;
1744 		}
1745 	}
1746 	protected OnCopyClipboardDelegateWrapper[] onCopyClipboardListeners;
1747 
1748 	/**
1749 	 * Emitted whenever vte_terminal_copy_clipboard() is called.
1750 	 */
1751 	gulong addOnCopyClipboard(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1752 	{
1753 		onCopyClipboardListeners ~= new OnCopyClipboardDelegateWrapper(dlg, 0, connectFlags);
1754 		onCopyClipboardListeners[onCopyClipboardListeners.length - 1].handlerId = Signals.connectData(
1755 			this,
1756 			"copy-clipboard",
1757 			cast(GCallback)&callBackCopyClipboard,
1758 			cast(void*)onCopyClipboardListeners[onCopyClipboardListeners.length - 1],
1759 			cast(GClosureNotify)&callBackCopyClipboardDestroy,
1760 			connectFlags);
1761 		return onCopyClipboardListeners[onCopyClipboardListeners.length - 1].handlerId;
1762 	}
1763 	
1764 	extern(C) static void callBackCopyClipboard(VteTerminal* terminalStruct,OnCopyClipboardDelegateWrapper wrapper)
1765 	{
1766 		wrapper.dlg(wrapper.outer);
1767 	}
1768 	
1769 	extern(C) static void callBackCopyClipboardDestroy(OnCopyClipboardDelegateWrapper wrapper, GClosure* closure)
1770 	{
1771 		wrapper.outer.internalRemoveOnCopyClipboard(wrapper);
1772 	}
1773 
1774 	protected void internalRemoveOnCopyClipboard(OnCopyClipboardDelegateWrapper source)
1775 	{
1776 		foreach(index, wrapper; onCopyClipboardListeners)
1777 		{
1778 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1779 			{
1780 				onCopyClipboardListeners[index] = null;
1781 				onCopyClipboardListeners = std.algorithm.remove(onCopyClipboardListeners, index);
1782 				break;
1783 			}
1784 		}
1785 	}
1786 	
1787 
1788 	protected class OnCurrentDirectoryUriChangedDelegateWrapper
1789 	{
1790 		void delegate(Terminal) dlg;
1791 		gulong handlerId;
1792 		ConnectFlags flags;
1793 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
1794 		{
1795 			this.dlg = dlg;
1796 			this.handlerId = handlerId;
1797 			this.flags = flags;
1798 		}
1799 	}
1800 	protected OnCurrentDirectoryUriChangedDelegateWrapper[] onCurrentDirectoryUriChangedListeners;
1801 
1802 	/**
1803 	 * Emitted when the current directory URI is modified.
1804 	 */
1805 	gulong addOnCurrentDirectoryUriChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1806 	{
1807 		onCurrentDirectoryUriChangedListeners ~= new OnCurrentDirectoryUriChangedDelegateWrapper(dlg, 0, connectFlags);
1808 		onCurrentDirectoryUriChangedListeners[onCurrentDirectoryUriChangedListeners.length - 1].handlerId = Signals.connectData(
1809 			this,
1810 			"current-directory-uri-changed",
1811 			cast(GCallback)&callBackCurrentDirectoryUriChanged,
1812 			cast(void*)onCurrentDirectoryUriChangedListeners[onCurrentDirectoryUriChangedListeners.length - 1],
1813 			cast(GClosureNotify)&callBackCurrentDirectoryUriChangedDestroy,
1814 			connectFlags);
1815 		return onCurrentDirectoryUriChangedListeners[onCurrentDirectoryUriChangedListeners.length - 1].handlerId;
1816 	}
1817 	
1818 	extern(C) static void callBackCurrentDirectoryUriChanged(VteTerminal* terminalStruct,OnCurrentDirectoryUriChangedDelegateWrapper wrapper)
1819 	{
1820 		wrapper.dlg(wrapper.outer);
1821 	}
1822 	
1823 	extern(C) static void callBackCurrentDirectoryUriChangedDestroy(OnCurrentDirectoryUriChangedDelegateWrapper wrapper, GClosure* closure)
1824 	{
1825 		wrapper.outer.internalRemoveOnCurrentDirectoryUriChanged(wrapper);
1826 	}
1827 
1828 	protected void internalRemoveOnCurrentDirectoryUriChanged(OnCurrentDirectoryUriChangedDelegateWrapper source)
1829 	{
1830 		foreach(index, wrapper; onCurrentDirectoryUriChangedListeners)
1831 		{
1832 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1833 			{
1834 				onCurrentDirectoryUriChangedListeners[index] = null;
1835 				onCurrentDirectoryUriChangedListeners = std.algorithm.remove(onCurrentDirectoryUriChangedListeners, index);
1836 				break;
1837 			}
1838 		}
1839 	}
1840 	
1841 
1842 	protected class OnCurrentFileUriChangedDelegateWrapper
1843 	{
1844 		void delegate(Terminal) dlg;
1845 		gulong handlerId;
1846 		ConnectFlags flags;
1847 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
1848 		{
1849 			this.dlg = dlg;
1850 			this.handlerId = handlerId;
1851 			this.flags = flags;
1852 		}
1853 	}
1854 	protected OnCurrentFileUriChangedDelegateWrapper[] onCurrentFileUriChangedListeners;
1855 
1856 	/**
1857 	 * Emitted when the current file URI is modified.
1858 	 */
1859 	gulong addOnCurrentFileUriChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1860 	{
1861 		onCurrentFileUriChangedListeners ~= new OnCurrentFileUriChangedDelegateWrapper(dlg, 0, connectFlags);
1862 		onCurrentFileUriChangedListeners[onCurrentFileUriChangedListeners.length - 1].handlerId = Signals.connectData(
1863 			this,
1864 			"current-file-uri-changed",
1865 			cast(GCallback)&callBackCurrentFileUriChanged,
1866 			cast(void*)onCurrentFileUriChangedListeners[onCurrentFileUriChangedListeners.length - 1],
1867 			cast(GClosureNotify)&callBackCurrentFileUriChangedDestroy,
1868 			connectFlags);
1869 		return onCurrentFileUriChangedListeners[onCurrentFileUriChangedListeners.length - 1].handlerId;
1870 	}
1871 	
1872 	extern(C) static void callBackCurrentFileUriChanged(VteTerminal* terminalStruct,OnCurrentFileUriChangedDelegateWrapper wrapper)
1873 	{
1874 		wrapper.dlg(wrapper.outer);
1875 	}
1876 	
1877 	extern(C) static void callBackCurrentFileUriChangedDestroy(OnCurrentFileUriChangedDelegateWrapper wrapper, GClosure* closure)
1878 	{
1879 		wrapper.outer.internalRemoveOnCurrentFileUriChanged(wrapper);
1880 	}
1881 
1882 	protected void internalRemoveOnCurrentFileUriChanged(OnCurrentFileUriChangedDelegateWrapper source)
1883 	{
1884 		foreach(index, wrapper; onCurrentFileUriChangedListeners)
1885 		{
1886 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1887 			{
1888 				onCurrentFileUriChangedListeners[index] = null;
1889 				onCurrentFileUriChangedListeners = std.algorithm.remove(onCurrentFileUriChangedListeners, index);
1890 				break;
1891 			}
1892 		}
1893 	}
1894 	
1895 
1896 	protected class OnCursorMovedDelegateWrapper
1897 	{
1898 		void delegate(Terminal) dlg;
1899 		gulong handlerId;
1900 		ConnectFlags flags;
1901 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
1902 		{
1903 			this.dlg = dlg;
1904 			this.handlerId = handlerId;
1905 			this.flags = flags;
1906 		}
1907 	}
1908 	protected OnCursorMovedDelegateWrapper[] onCursorMovedListeners;
1909 
1910 	/**
1911 	 * Emitted whenever the cursor moves to a new character cell.  Used
1912 	 * primarily by #VteTerminalAccessible.
1913 	 */
1914 	gulong addOnCursorMoved(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1915 	{
1916 		onCursorMovedListeners ~= new OnCursorMovedDelegateWrapper(dlg, 0, connectFlags);
1917 		onCursorMovedListeners[onCursorMovedListeners.length - 1].handlerId = Signals.connectData(
1918 			this,
1919 			"cursor-moved",
1920 			cast(GCallback)&callBackCursorMoved,
1921 			cast(void*)onCursorMovedListeners[onCursorMovedListeners.length - 1],
1922 			cast(GClosureNotify)&callBackCursorMovedDestroy,
1923 			connectFlags);
1924 		return onCursorMovedListeners[onCursorMovedListeners.length - 1].handlerId;
1925 	}
1926 	
1927 	extern(C) static void callBackCursorMoved(VteTerminal* terminalStruct,OnCursorMovedDelegateWrapper wrapper)
1928 	{
1929 		wrapper.dlg(wrapper.outer);
1930 	}
1931 	
1932 	extern(C) static void callBackCursorMovedDestroy(OnCursorMovedDelegateWrapper wrapper, GClosure* closure)
1933 	{
1934 		wrapper.outer.internalRemoveOnCursorMoved(wrapper);
1935 	}
1936 
1937 	protected void internalRemoveOnCursorMoved(OnCursorMovedDelegateWrapper source)
1938 	{
1939 		foreach(index, wrapper; onCursorMovedListeners)
1940 		{
1941 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1942 			{
1943 				onCursorMovedListeners[index] = null;
1944 				onCursorMovedListeners = std.algorithm.remove(onCursorMovedListeners, index);
1945 				break;
1946 			}
1947 		}
1948 	}
1949 	
1950 
1951 	protected class OnDecreaseFontSizeDelegateWrapper
1952 	{
1953 		void delegate(Terminal) dlg;
1954 		gulong handlerId;
1955 		ConnectFlags flags;
1956 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
1957 		{
1958 			this.dlg = dlg;
1959 			this.handlerId = handlerId;
1960 			this.flags = flags;
1961 		}
1962 	}
1963 	protected OnDecreaseFontSizeDelegateWrapper[] onDecreaseFontSizeListeners;
1964 
1965 	/**
1966 	 * Emitted when the user hits the '-' key while holding the Control key.
1967 	 */
1968 	gulong addOnDecreaseFontSize(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1969 	{
1970 		onDecreaseFontSizeListeners ~= new OnDecreaseFontSizeDelegateWrapper(dlg, 0, connectFlags);
1971 		onDecreaseFontSizeListeners[onDecreaseFontSizeListeners.length - 1].handlerId = Signals.connectData(
1972 			this,
1973 			"decrease-font-size",
1974 			cast(GCallback)&callBackDecreaseFontSize,
1975 			cast(void*)onDecreaseFontSizeListeners[onDecreaseFontSizeListeners.length - 1],
1976 			cast(GClosureNotify)&callBackDecreaseFontSizeDestroy,
1977 			connectFlags);
1978 		return onDecreaseFontSizeListeners[onDecreaseFontSizeListeners.length - 1].handlerId;
1979 	}
1980 	
1981 	extern(C) static void callBackDecreaseFontSize(VteTerminal* terminalStruct,OnDecreaseFontSizeDelegateWrapper wrapper)
1982 	{
1983 		wrapper.dlg(wrapper.outer);
1984 	}
1985 	
1986 	extern(C) static void callBackDecreaseFontSizeDestroy(OnDecreaseFontSizeDelegateWrapper wrapper, GClosure* closure)
1987 	{
1988 		wrapper.outer.internalRemoveOnDecreaseFontSize(wrapper);
1989 	}
1990 
1991 	protected void internalRemoveOnDecreaseFontSize(OnDecreaseFontSizeDelegateWrapper source)
1992 	{
1993 		foreach(index, wrapper; onDecreaseFontSizeListeners)
1994 		{
1995 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1996 			{
1997 				onDecreaseFontSizeListeners[index] = null;
1998 				onDecreaseFontSizeListeners = std.algorithm.remove(onDecreaseFontSizeListeners, index);
1999 				break;
2000 			}
2001 		}
2002 	}
2003 	
2004 
2005 	protected class OnDeiconifyWindowDelegateWrapper
2006 	{
2007 		void delegate(Terminal) dlg;
2008 		gulong handlerId;
2009 		ConnectFlags flags;
2010 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2011 		{
2012 			this.dlg = dlg;
2013 			this.handlerId = handlerId;
2014 			this.flags = flags;
2015 		}
2016 	}
2017 	protected OnDeiconifyWindowDelegateWrapper[] onDeiconifyWindowListeners;
2018 
2019 	/**
2020 	 * Emitted at the child application's request.
2021 	 */
2022 	gulong addOnDeiconifyWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2023 	{
2024 		onDeiconifyWindowListeners ~= new OnDeiconifyWindowDelegateWrapper(dlg, 0, connectFlags);
2025 		onDeiconifyWindowListeners[onDeiconifyWindowListeners.length - 1].handlerId = Signals.connectData(
2026 			this,
2027 			"deiconify-window",
2028 			cast(GCallback)&callBackDeiconifyWindow,
2029 			cast(void*)onDeiconifyWindowListeners[onDeiconifyWindowListeners.length - 1],
2030 			cast(GClosureNotify)&callBackDeiconifyWindowDestroy,
2031 			connectFlags);
2032 		return onDeiconifyWindowListeners[onDeiconifyWindowListeners.length - 1].handlerId;
2033 	}
2034 	
2035 	extern(C) static void callBackDeiconifyWindow(VteTerminal* terminalStruct,OnDeiconifyWindowDelegateWrapper wrapper)
2036 	{
2037 		wrapper.dlg(wrapper.outer);
2038 	}
2039 	
2040 	extern(C) static void callBackDeiconifyWindowDestroy(OnDeiconifyWindowDelegateWrapper wrapper, GClosure* closure)
2041 	{
2042 		wrapper.outer.internalRemoveOnDeiconifyWindow(wrapper);
2043 	}
2044 
2045 	protected void internalRemoveOnDeiconifyWindow(OnDeiconifyWindowDelegateWrapper source)
2046 	{
2047 		foreach(index, wrapper; onDeiconifyWindowListeners)
2048 		{
2049 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2050 			{
2051 				onDeiconifyWindowListeners[index] = null;
2052 				onDeiconifyWindowListeners = std.algorithm.remove(onDeiconifyWindowListeners, index);
2053 				break;
2054 			}
2055 		}
2056 	}
2057 	
2058 
2059 	protected class OnEncodingChangedDelegateWrapper
2060 	{
2061 		void delegate(Terminal) dlg;
2062 		gulong handlerId;
2063 		ConnectFlags flags;
2064 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2065 		{
2066 			this.dlg = dlg;
2067 			this.handlerId = handlerId;
2068 			this.flags = flags;
2069 		}
2070 	}
2071 	protected OnEncodingChangedDelegateWrapper[] onEncodingChangedListeners;
2072 
2073 	/**
2074 	 * Emitted whenever the terminal's current encoding has changed, either
2075 	 * as a result of receiving a control sequence which toggled between the
2076 	 * local and UTF-8 encodings, or at the parent application's request.
2077 	 */
2078 	gulong addOnEncodingChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2079 	{
2080 		onEncodingChangedListeners ~= new OnEncodingChangedDelegateWrapper(dlg, 0, connectFlags);
2081 		onEncodingChangedListeners[onEncodingChangedListeners.length - 1].handlerId = Signals.connectData(
2082 			this,
2083 			"encoding-changed",
2084 			cast(GCallback)&callBackEncodingChanged,
2085 			cast(void*)onEncodingChangedListeners[onEncodingChangedListeners.length - 1],
2086 			cast(GClosureNotify)&callBackEncodingChangedDestroy,
2087 			connectFlags);
2088 		return onEncodingChangedListeners[onEncodingChangedListeners.length - 1].handlerId;
2089 	}
2090 	
2091 	extern(C) static void callBackEncodingChanged(VteTerminal* terminalStruct,OnEncodingChangedDelegateWrapper wrapper)
2092 	{
2093 		wrapper.dlg(wrapper.outer);
2094 	}
2095 	
2096 	extern(C) static void callBackEncodingChangedDestroy(OnEncodingChangedDelegateWrapper wrapper, GClosure* closure)
2097 	{
2098 		wrapper.outer.internalRemoveOnEncodingChanged(wrapper);
2099 	}
2100 
2101 	protected void internalRemoveOnEncodingChanged(OnEncodingChangedDelegateWrapper source)
2102 	{
2103 		foreach(index, wrapper; onEncodingChangedListeners)
2104 		{
2105 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2106 			{
2107 				onEncodingChangedListeners[index] = null;
2108 				onEncodingChangedListeners = std.algorithm.remove(onEncodingChangedListeners, index);
2109 				break;
2110 			}
2111 		}
2112 	}
2113 	
2114 
2115 	protected class OnEofDelegateWrapper
2116 	{
2117 		void delegate(Terminal) dlg;
2118 		gulong handlerId;
2119 		ConnectFlags flags;
2120 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2121 		{
2122 			this.dlg = dlg;
2123 			this.handlerId = handlerId;
2124 			this.flags = flags;
2125 		}
2126 	}
2127 	protected OnEofDelegateWrapper[] onEofListeners;
2128 
2129 	/**
2130 	 * Emitted when the terminal receives an end-of-file from a child which
2131 	 * is running in the terminal.  This signal is frequently (but not
2132 	 * always) emitted with a #VteTerminal::child-exited signal.
2133 	 */
2134 	gulong addOnEof(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2135 	{
2136 		onEofListeners ~= new OnEofDelegateWrapper(dlg, 0, connectFlags);
2137 		onEofListeners[onEofListeners.length - 1].handlerId = Signals.connectData(
2138 			this,
2139 			"eof",
2140 			cast(GCallback)&callBackEof,
2141 			cast(void*)onEofListeners[onEofListeners.length - 1],
2142 			cast(GClosureNotify)&callBackEofDestroy,
2143 			connectFlags);
2144 		return onEofListeners[onEofListeners.length - 1].handlerId;
2145 	}
2146 	
2147 	extern(C) static void callBackEof(VteTerminal* terminalStruct,OnEofDelegateWrapper wrapper)
2148 	{
2149 		wrapper.dlg(wrapper.outer);
2150 	}
2151 	
2152 	extern(C) static void callBackEofDestroy(OnEofDelegateWrapper wrapper, GClosure* closure)
2153 	{
2154 		wrapper.outer.internalRemoveOnEof(wrapper);
2155 	}
2156 
2157 	protected void internalRemoveOnEof(OnEofDelegateWrapper source)
2158 	{
2159 		foreach(index, wrapper; onEofListeners)
2160 		{
2161 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2162 			{
2163 				onEofListeners[index] = null;
2164 				onEofListeners = std.algorithm.remove(onEofListeners, index);
2165 				break;
2166 			}
2167 		}
2168 	}
2169 	
2170 
2171 	protected class OnIconTitleChangedDelegateWrapper
2172 	{
2173 		void delegate(Terminal) dlg;
2174 		gulong handlerId;
2175 		ConnectFlags flags;
2176 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2177 		{
2178 			this.dlg = dlg;
2179 			this.handlerId = handlerId;
2180 			this.flags = flags;
2181 		}
2182 	}
2183 	protected OnIconTitleChangedDelegateWrapper[] onIconTitleChangedListeners;
2184 
2185 	/**
2186 	 * Emitted when the terminal's %icon_title field is modified.
2187 	 */
2188 	gulong addOnIconTitleChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2189 	{
2190 		onIconTitleChangedListeners ~= new OnIconTitleChangedDelegateWrapper(dlg, 0, connectFlags);
2191 		onIconTitleChangedListeners[onIconTitleChangedListeners.length - 1].handlerId = Signals.connectData(
2192 			this,
2193 			"icon-title-changed",
2194 			cast(GCallback)&callBackIconTitleChanged,
2195 			cast(void*)onIconTitleChangedListeners[onIconTitleChangedListeners.length - 1],
2196 			cast(GClosureNotify)&callBackIconTitleChangedDestroy,
2197 			connectFlags);
2198 		return onIconTitleChangedListeners[onIconTitleChangedListeners.length - 1].handlerId;
2199 	}
2200 	
2201 	extern(C) static void callBackIconTitleChanged(VteTerminal* terminalStruct,OnIconTitleChangedDelegateWrapper wrapper)
2202 	{
2203 		wrapper.dlg(wrapper.outer);
2204 	}
2205 	
2206 	extern(C) static void callBackIconTitleChangedDestroy(OnIconTitleChangedDelegateWrapper wrapper, GClosure* closure)
2207 	{
2208 		wrapper.outer.internalRemoveOnIconTitleChanged(wrapper);
2209 	}
2210 
2211 	protected void internalRemoveOnIconTitleChanged(OnIconTitleChangedDelegateWrapper source)
2212 	{
2213 		foreach(index, wrapper; onIconTitleChangedListeners)
2214 		{
2215 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2216 			{
2217 				onIconTitleChangedListeners[index] = null;
2218 				onIconTitleChangedListeners = std.algorithm.remove(onIconTitleChangedListeners, index);
2219 				break;
2220 			}
2221 		}
2222 	}
2223 	
2224 
2225 	protected class OnIconifyWindowDelegateWrapper
2226 	{
2227 		void delegate(Terminal) dlg;
2228 		gulong handlerId;
2229 		ConnectFlags flags;
2230 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2231 		{
2232 			this.dlg = dlg;
2233 			this.handlerId = handlerId;
2234 			this.flags = flags;
2235 		}
2236 	}
2237 	protected OnIconifyWindowDelegateWrapper[] onIconifyWindowListeners;
2238 
2239 	/**
2240 	 * Emitted at the child application's request.
2241 	 */
2242 	gulong addOnIconifyWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2243 	{
2244 		onIconifyWindowListeners ~= new OnIconifyWindowDelegateWrapper(dlg, 0, connectFlags);
2245 		onIconifyWindowListeners[onIconifyWindowListeners.length - 1].handlerId = Signals.connectData(
2246 			this,
2247 			"iconify-window",
2248 			cast(GCallback)&callBackIconifyWindow,
2249 			cast(void*)onIconifyWindowListeners[onIconifyWindowListeners.length - 1],
2250 			cast(GClosureNotify)&callBackIconifyWindowDestroy,
2251 			connectFlags);
2252 		return onIconifyWindowListeners[onIconifyWindowListeners.length - 1].handlerId;
2253 	}
2254 	
2255 	extern(C) static void callBackIconifyWindow(VteTerminal* terminalStruct,OnIconifyWindowDelegateWrapper wrapper)
2256 	{
2257 		wrapper.dlg(wrapper.outer);
2258 	}
2259 	
2260 	extern(C) static void callBackIconifyWindowDestroy(OnIconifyWindowDelegateWrapper wrapper, GClosure* closure)
2261 	{
2262 		wrapper.outer.internalRemoveOnIconifyWindow(wrapper);
2263 	}
2264 
2265 	protected void internalRemoveOnIconifyWindow(OnIconifyWindowDelegateWrapper source)
2266 	{
2267 		foreach(index, wrapper; onIconifyWindowListeners)
2268 		{
2269 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2270 			{
2271 				onIconifyWindowListeners[index] = null;
2272 				onIconifyWindowListeners = std.algorithm.remove(onIconifyWindowListeners, index);
2273 				break;
2274 			}
2275 		}
2276 	}
2277 	
2278 
2279 	protected class OnIncreaseFontSizeDelegateWrapper
2280 	{
2281 		void delegate(Terminal) dlg;
2282 		gulong handlerId;
2283 		ConnectFlags flags;
2284 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2285 		{
2286 			this.dlg = dlg;
2287 			this.handlerId = handlerId;
2288 			this.flags = flags;
2289 		}
2290 	}
2291 	protected OnIncreaseFontSizeDelegateWrapper[] onIncreaseFontSizeListeners;
2292 
2293 	/**
2294 	 * Emitted when the user hits the '+' key while holding the Control key.
2295 	 */
2296 	gulong addOnIncreaseFontSize(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2297 	{
2298 		onIncreaseFontSizeListeners ~= new OnIncreaseFontSizeDelegateWrapper(dlg, 0, connectFlags);
2299 		onIncreaseFontSizeListeners[onIncreaseFontSizeListeners.length - 1].handlerId = Signals.connectData(
2300 			this,
2301 			"increase-font-size",
2302 			cast(GCallback)&callBackIncreaseFontSize,
2303 			cast(void*)onIncreaseFontSizeListeners[onIncreaseFontSizeListeners.length - 1],
2304 			cast(GClosureNotify)&callBackIncreaseFontSizeDestroy,
2305 			connectFlags);
2306 		return onIncreaseFontSizeListeners[onIncreaseFontSizeListeners.length - 1].handlerId;
2307 	}
2308 	
2309 	extern(C) static void callBackIncreaseFontSize(VteTerminal* terminalStruct,OnIncreaseFontSizeDelegateWrapper wrapper)
2310 	{
2311 		wrapper.dlg(wrapper.outer);
2312 	}
2313 	
2314 	extern(C) static void callBackIncreaseFontSizeDestroy(OnIncreaseFontSizeDelegateWrapper wrapper, GClosure* closure)
2315 	{
2316 		wrapper.outer.internalRemoveOnIncreaseFontSize(wrapper);
2317 	}
2318 
2319 	protected void internalRemoveOnIncreaseFontSize(OnIncreaseFontSizeDelegateWrapper source)
2320 	{
2321 		foreach(index, wrapper; onIncreaseFontSizeListeners)
2322 		{
2323 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2324 			{
2325 				onIncreaseFontSizeListeners[index] = null;
2326 				onIncreaseFontSizeListeners = std.algorithm.remove(onIncreaseFontSizeListeners, index);
2327 				break;
2328 			}
2329 		}
2330 	}
2331 	
2332 
2333 	protected class OnLowerWindowDelegateWrapper
2334 	{
2335 		void delegate(Terminal) dlg;
2336 		gulong handlerId;
2337 		ConnectFlags flags;
2338 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2339 		{
2340 			this.dlg = dlg;
2341 			this.handlerId = handlerId;
2342 			this.flags = flags;
2343 		}
2344 	}
2345 	protected OnLowerWindowDelegateWrapper[] onLowerWindowListeners;
2346 
2347 	/**
2348 	 * Emitted at the child application's request.
2349 	 */
2350 	gulong addOnLowerWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2351 	{
2352 		onLowerWindowListeners ~= new OnLowerWindowDelegateWrapper(dlg, 0, connectFlags);
2353 		onLowerWindowListeners[onLowerWindowListeners.length - 1].handlerId = Signals.connectData(
2354 			this,
2355 			"lower-window",
2356 			cast(GCallback)&callBackLowerWindow,
2357 			cast(void*)onLowerWindowListeners[onLowerWindowListeners.length - 1],
2358 			cast(GClosureNotify)&callBackLowerWindowDestroy,
2359 			connectFlags);
2360 		return onLowerWindowListeners[onLowerWindowListeners.length - 1].handlerId;
2361 	}
2362 	
2363 	extern(C) static void callBackLowerWindow(VteTerminal* terminalStruct,OnLowerWindowDelegateWrapper wrapper)
2364 	{
2365 		wrapper.dlg(wrapper.outer);
2366 	}
2367 	
2368 	extern(C) static void callBackLowerWindowDestroy(OnLowerWindowDelegateWrapper wrapper, GClosure* closure)
2369 	{
2370 		wrapper.outer.internalRemoveOnLowerWindow(wrapper);
2371 	}
2372 
2373 	protected void internalRemoveOnLowerWindow(OnLowerWindowDelegateWrapper source)
2374 	{
2375 		foreach(index, wrapper; onLowerWindowListeners)
2376 		{
2377 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2378 			{
2379 				onLowerWindowListeners[index] = null;
2380 				onLowerWindowListeners = std.algorithm.remove(onLowerWindowListeners, index);
2381 				break;
2382 			}
2383 		}
2384 	}
2385 	
2386 
2387 	protected class OnMaximizeWindowDelegateWrapper
2388 	{
2389 		void delegate(Terminal) dlg;
2390 		gulong handlerId;
2391 		ConnectFlags flags;
2392 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2393 		{
2394 			this.dlg = dlg;
2395 			this.handlerId = handlerId;
2396 			this.flags = flags;
2397 		}
2398 	}
2399 	protected OnMaximizeWindowDelegateWrapper[] onMaximizeWindowListeners;
2400 
2401 	/**
2402 	 * Emitted at the child application's request.
2403 	 */
2404 	gulong addOnMaximizeWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2405 	{
2406 		onMaximizeWindowListeners ~= new OnMaximizeWindowDelegateWrapper(dlg, 0, connectFlags);
2407 		onMaximizeWindowListeners[onMaximizeWindowListeners.length - 1].handlerId = Signals.connectData(
2408 			this,
2409 			"maximize-window",
2410 			cast(GCallback)&callBackMaximizeWindow,
2411 			cast(void*)onMaximizeWindowListeners[onMaximizeWindowListeners.length - 1],
2412 			cast(GClosureNotify)&callBackMaximizeWindowDestroy,
2413 			connectFlags);
2414 		return onMaximizeWindowListeners[onMaximizeWindowListeners.length - 1].handlerId;
2415 	}
2416 	
2417 	extern(C) static void callBackMaximizeWindow(VteTerminal* terminalStruct,OnMaximizeWindowDelegateWrapper wrapper)
2418 	{
2419 		wrapper.dlg(wrapper.outer);
2420 	}
2421 	
2422 	extern(C) static void callBackMaximizeWindowDestroy(OnMaximizeWindowDelegateWrapper wrapper, GClosure* closure)
2423 	{
2424 		wrapper.outer.internalRemoveOnMaximizeWindow(wrapper);
2425 	}
2426 
2427 	protected void internalRemoveOnMaximizeWindow(OnMaximizeWindowDelegateWrapper source)
2428 	{
2429 		foreach(index, wrapper; onMaximizeWindowListeners)
2430 		{
2431 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2432 			{
2433 				onMaximizeWindowListeners[index] = null;
2434 				onMaximizeWindowListeners = std.algorithm.remove(onMaximizeWindowListeners, index);
2435 				break;
2436 			}
2437 		}
2438 	}
2439 	
2440 
2441 	protected class OnMoveWindowDelegateWrapper
2442 	{
2443 		void delegate(uint, uint, Terminal) dlg;
2444 		gulong handlerId;
2445 		ConnectFlags flags;
2446 		this(void delegate(uint, uint, Terminal) dlg, gulong handlerId, ConnectFlags flags)
2447 		{
2448 			this.dlg = dlg;
2449 			this.handlerId = handlerId;
2450 			this.flags = flags;
2451 		}
2452 	}
2453 	protected OnMoveWindowDelegateWrapper[] onMoveWindowListeners;
2454 
2455 	/**
2456 	 * Emitted at the child application's request.
2457 	 *
2458 	 * Params:
2459 	 *     x = the terminal's desired location, X coordinate
2460 	 *     y = the terminal's desired location, Y coordinate
2461 	 */
2462 	gulong addOnMoveWindow(void delegate(uint, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2463 	{
2464 		onMoveWindowListeners ~= new OnMoveWindowDelegateWrapper(dlg, 0, connectFlags);
2465 		onMoveWindowListeners[onMoveWindowListeners.length - 1].handlerId = Signals.connectData(
2466 			this,
2467 			"move-window",
2468 			cast(GCallback)&callBackMoveWindow,
2469 			cast(void*)onMoveWindowListeners[onMoveWindowListeners.length - 1],
2470 			cast(GClosureNotify)&callBackMoveWindowDestroy,
2471 			connectFlags);
2472 		return onMoveWindowListeners[onMoveWindowListeners.length - 1].handlerId;
2473 	}
2474 	
2475 	extern(C) static void callBackMoveWindow(VteTerminal* terminalStruct, uint x, uint y,OnMoveWindowDelegateWrapper wrapper)
2476 	{
2477 		wrapper.dlg(x, y, wrapper.outer);
2478 	}
2479 	
2480 	extern(C) static void callBackMoveWindowDestroy(OnMoveWindowDelegateWrapper wrapper, GClosure* closure)
2481 	{
2482 		wrapper.outer.internalRemoveOnMoveWindow(wrapper);
2483 	}
2484 
2485 	protected void internalRemoveOnMoveWindow(OnMoveWindowDelegateWrapper source)
2486 	{
2487 		foreach(index, wrapper; onMoveWindowListeners)
2488 		{
2489 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2490 			{
2491 				onMoveWindowListeners[index] = null;
2492 				onMoveWindowListeners = std.algorithm.remove(onMoveWindowListeners, index);
2493 				break;
2494 			}
2495 		}
2496 	}
2497 	
2498 
2499 	protected class OnPasteClipboardDelegateWrapper
2500 	{
2501 		void delegate(Terminal) dlg;
2502 		gulong handlerId;
2503 		ConnectFlags flags;
2504 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2505 		{
2506 			this.dlg = dlg;
2507 			this.handlerId = handlerId;
2508 			this.flags = flags;
2509 		}
2510 	}
2511 	protected OnPasteClipboardDelegateWrapper[] onPasteClipboardListeners;
2512 
2513 	/**
2514 	 * Emitted whenever vte_terminal_paste_clipboard() is called.
2515 	 */
2516 	gulong addOnPasteClipboard(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2517 	{
2518 		onPasteClipboardListeners ~= new OnPasteClipboardDelegateWrapper(dlg, 0, connectFlags);
2519 		onPasteClipboardListeners[onPasteClipboardListeners.length - 1].handlerId = Signals.connectData(
2520 			this,
2521 			"paste-clipboard",
2522 			cast(GCallback)&callBackPasteClipboard,
2523 			cast(void*)onPasteClipboardListeners[onPasteClipboardListeners.length - 1],
2524 			cast(GClosureNotify)&callBackPasteClipboardDestroy,
2525 			connectFlags);
2526 		return onPasteClipboardListeners[onPasteClipboardListeners.length - 1].handlerId;
2527 	}
2528 	
2529 	extern(C) static void callBackPasteClipboard(VteTerminal* terminalStruct,OnPasteClipboardDelegateWrapper wrapper)
2530 	{
2531 		wrapper.dlg(wrapper.outer);
2532 	}
2533 	
2534 	extern(C) static void callBackPasteClipboardDestroy(OnPasteClipboardDelegateWrapper wrapper, GClosure* closure)
2535 	{
2536 		wrapper.outer.internalRemoveOnPasteClipboard(wrapper);
2537 	}
2538 
2539 	protected void internalRemoveOnPasteClipboard(OnPasteClipboardDelegateWrapper source)
2540 	{
2541 		foreach(index, wrapper; onPasteClipboardListeners)
2542 		{
2543 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2544 			{
2545 				onPasteClipboardListeners[index] = null;
2546 				onPasteClipboardListeners = std.algorithm.remove(onPasteClipboardListeners, index);
2547 				break;
2548 			}
2549 		}
2550 	}
2551 	
2552 
2553 	protected class OnRaiseWindowDelegateWrapper
2554 	{
2555 		void delegate(Terminal) dlg;
2556 		gulong handlerId;
2557 		ConnectFlags flags;
2558 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2559 		{
2560 			this.dlg = dlg;
2561 			this.handlerId = handlerId;
2562 			this.flags = flags;
2563 		}
2564 	}
2565 	protected OnRaiseWindowDelegateWrapper[] onRaiseWindowListeners;
2566 
2567 	/**
2568 	 * Emitted at the child application's request.
2569 	 */
2570 	gulong addOnRaiseWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2571 	{
2572 		onRaiseWindowListeners ~= new OnRaiseWindowDelegateWrapper(dlg, 0, connectFlags);
2573 		onRaiseWindowListeners[onRaiseWindowListeners.length - 1].handlerId = Signals.connectData(
2574 			this,
2575 			"raise-window",
2576 			cast(GCallback)&callBackRaiseWindow,
2577 			cast(void*)onRaiseWindowListeners[onRaiseWindowListeners.length - 1],
2578 			cast(GClosureNotify)&callBackRaiseWindowDestroy,
2579 			connectFlags);
2580 		return onRaiseWindowListeners[onRaiseWindowListeners.length - 1].handlerId;
2581 	}
2582 	
2583 	extern(C) static void callBackRaiseWindow(VteTerminal* terminalStruct,OnRaiseWindowDelegateWrapper wrapper)
2584 	{
2585 		wrapper.dlg(wrapper.outer);
2586 	}
2587 	
2588 	extern(C) static void callBackRaiseWindowDestroy(OnRaiseWindowDelegateWrapper wrapper, GClosure* closure)
2589 	{
2590 		wrapper.outer.internalRemoveOnRaiseWindow(wrapper);
2591 	}
2592 
2593 	protected void internalRemoveOnRaiseWindow(OnRaiseWindowDelegateWrapper source)
2594 	{
2595 		foreach(index, wrapper; onRaiseWindowListeners)
2596 		{
2597 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2598 			{
2599 				onRaiseWindowListeners[index] = null;
2600 				onRaiseWindowListeners = std.algorithm.remove(onRaiseWindowListeners, index);
2601 				break;
2602 			}
2603 		}
2604 	}
2605 	
2606 
2607 	protected class OnRefreshWindowDelegateWrapper
2608 	{
2609 		void delegate(Terminal) dlg;
2610 		gulong handlerId;
2611 		ConnectFlags flags;
2612 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2613 		{
2614 			this.dlg = dlg;
2615 			this.handlerId = handlerId;
2616 			this.flags = flags;
2617 		}
2618 	}
2619 	protected OnRefreshWindowDelegateWrapper[] onRefreshWindowListeners;
2620 
2621 	/**
2622 	 * Emitted at the child application's request.
2623 	 */
2624 	gulong addOnRefreshWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2625 	{
2626 		onRefreshWindowListeners ~= new OnRefreshWindowDelegateWrapper(dlg, 0, connectFlags);
2627 		onRefreshWindowListeners[onRefreshWindowListeners.length - 1].handlerId = Signals.connectData(
2628 			this,
2629 			"refresh-window",
2630 			cast(GCallback)&callBackRefreshWindow,
2631 			cast(void*)onRefreshWindowListeners[onRefreshWindowListeners.length - 1],
2632 			cast(GClosureNotify)&callBackRefreshWindowDestroy,
2633 			connectFlags);
2634 		return onRefreshWindowListeners[onRefreshWindowListeners.length - 1].handlerId;
2635 	}
2636 	
2637 	extern(C) static void callBackRefreshWindow(VteTerminal* terminalStruct,OnRefreshWindowDelegateWrapper wrapper)
2638 	{
2639 		wrapper.dlg(wrapper.outer);
2640 	}
2641 	
2642 	extern(C) static void callBackRefreshWindowDestroy(OnRefreshWindowDelegateWrapper wrapper, GClosure* closure)
2643 	{
2644 		wrapper.outer.internalRemoveOnRefreshWindow(wrapper);
2645 	}
2646 
2647 	protected void internalRemoveOnRefreshWindow(OnRefreshWindowDelegateWrapper source)
2648 	{
2649 		foreach(index, wrapper; onRefreshWindowListeners)
2650 		{
2651 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2652 			{
2653 				onRefreshWindowListeners[index] = null;
2654 				onRefreshWindowListeners = std.algorithm.remove(onRefreshWindowListeners, index);
2655 				break;
2656 			}
2657 		}
2658 	}
2659 	
2660 
2661 	protected class OnResizeWindowDelegateWrapper
2662 	{
2663 		void delegate(uint, uint, Terminal) dlg;
2664 		gulong handlerId;
2665 		ConnectFlags flags;
2666 		this(void delegate(uint, uint, Terminal) dlg, gulong handlerId, ConnectFlags flags)
2667 		{
2668 			this.dlg = dlg;
2669 			this.handlerId = handlerId;
2670 			this.flags = flags;
2671 		}
2672 	}
2673 	protected OnResizeWindowDelegateWrapper[] onResizeWindowListeners;
2674 
2675 	/**
2676 	 * Emitted at the child application's request.
2677 	 *
2678 	 * Params:
2679 	 *     width = the desired number of columns
2680 	 *     height = the desired number of rows
2681 	 */
2682 	gulong addOnResizeWindow(void delegate(uint, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2683 	{
2684 		onResizeWindowListeners ~= new OnResizeWindowDelegateWrapper(dlg, 0, connectFlags);
2685 		onResizeWindowListeners[onResizeWindowListeners.length - 1].handlerId = Signals.connectData(
2686 			this,
2687 			"resize-window",
2688 			cast(GCallback)&callBackResizeWindow,
2689 			cast(void*)onResizeWindowListeners[onResizeWindowListeners.length - 1],
2690 			cast(GClosureNotify)&callBackResizeWindowDestroy,
2691 			connectFlags);
2692 		return onResizeWindowListeners[onResizeWindowListeners.length - 1].handlerId;
2693 	}
2694 	
2695 	extern(C) static void callBackResizeWindow(VteTerminal* terminalStruct, uint width, uint height,OnResizeWindowDelegateWrapper wrapper)
2696 	{
2697 		wrapper.dlg(width, height, wrapper.outer);
2698 	}
2699 	
2700 	extern(C) static void callBackResizeWindowDestroy(OnResizeWindowDelegateWrapper wrapper, GClosure* closure)
2701 	{
2702 		wrapper.outer.internalRemoveOnResizeWindow(wrapper);
2703 	}
2704 
2705 	protected void internalRemoveOnResizeWindow(OnResizeWindowDelegateWrapper source)
2706 	{
2707 		foreach(index, wrapper; onResizeWindowListeners)
2708 		{
2709 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2710 			{
2711 				onResizeWindowListeners[index] = null;
2712 				onResizeWindowListeners = std.algorithm.remove(onResizeWindowListeners, index);
2713 				break;
2714 			}
2715 		}
2716 	}
2717 	
2718 
2719 	protected class OnRestoreWindowDelegateWrapper
2720 	{
2721 		void delegate(Terminal) dlg;
2722 		gulong handlerId;
2723 		ConnectFlags flags;
2724 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2725 		{
2726 			this.dlg = dlg;
2727 			this.handlerId = handlerId;
2728 			this.flags = flags;
2729 		}
2730 	}
2731 	protected OnRestoreWindowDelegateWrapper[] onRestoreWindowListeners;
2732 
2733 	/**
2734 	 * Emitted at the child application's request.
2735 	 */
2736 	gulong addOnRestoreWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2737 	{
2738 		onRestoreWindowListeners ~= new OnRestoreWindowDelegateWrapper(dlg, 0, connectFlags);
2739 		onRestoreWindowListeners[onRestoreWindowListeners.length - 1].handlerId = Signals.connectData(
2740 			this,
2741 			"restore-window",
2742 			cast(GCallback)&callBackRestoreWindow,
2743 			cast(void*)onRestoreWindowListeners[onRestoreWindowListeners.length - 1],
2744 			cast(GClosureNotify)&callBackRestoreWindowDestroy,
2745 			connectFlags);
2746 		return onRestoreWindowListeners[onRestoreWindowListeners.length - 1].handlerId;
2747 	}
2748 	
2749 	extern(C) static void callBackRestoreWindow(VteTerminal* terminalStruct,OnRestoreWindowDelegateWrapper wrapper)
2750 	{
2751 		wrapper.dlg(wrapper.outer);
2752 	}
2753 	
2754 	extern(C) static void callBackRestoreWindowDestroy(OnRestoreWindowDelegateWrapper wrapper, GClosure* closure)
2755 	{
2756 		wrapper.outer.internalRemoveOnRestoreWindow(wrapper);
2757 	}
2758 
2759 	protected void internalRemoveOnRestoreWindow(OnRestoreWindowDelegateWrapper source)
2760 	{
2761 		foreach(index, wrapper; onRestoreWindowListeners)
2762 		{
2763 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2764 			{
2765 				onRestoreWindowListeners[index] = null;
2766 				onRestoreWindowListeners = std.algorithm.remove(onRestoreWindowListeners, index);
2767 				break;
2768 			}
2769 		}
2770 	}
2771 	
2772 
2773 	protected class OnSelectionChangedDelegateWrapper
2774 	{
2775 		void delegate(Terminal) dlg;
2776 		gulong handlerId;
2777 		ConnectFlags flags;
2778 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2779 		{
2780 			this.dlg = dlg;
2781 			this.handlerId = handlerId;
2782 			this.flags = flags;
2783 		}
2784 	}
2785 	protected OnSelectionChangedDelegateWrapper[] onSelectionChangedListeners;
2786 
2787 	/**
2788 	 * Emitted whenever the contents of terminal's selection changes.
2789 	 */
2790 	gulong addOnSelectionChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2791 	{
2792 		onSelectionChangedListeners ~= new OnSelectionChangedDelegateWrapper(dlg, 0, connectFlags);
2793 		onSelectionChangedListeners[onSelectionChangedListeners.length - 1].handlerId = Signals.connectData(
2794 			this,
2795 			"selection-changed",
2796 			cast(GCallback)&callBackSelectionChanged,
2797 			cast(void*)onSelectionChangedListeners[onSelectionChangedListeners.length - 1],
2798 			cast(GClosureNotify)&callBackSelectionChangedDestroy,
2799 			connectFlags);
2800 		return onSelectionChangedListeners[onSelectionChangedListeners.length - 1].handlerId;
2801 	}
2802 	
2803 	extern(C) static void callBackSelectionChanged(VteTerminal* terminalStruct,OnSelectionChangedDelegateWrapper wrapper)
2804 	{
2805 		wrapper.dlg(wrapper.outer);
2806 	}
2807 	
2808 	extern(C) static void callBackSelectionChangedDestroy(OnSelectionChangedDelegateWrapper wrapper, GClosure* closure)
2809 	{
2810 		wrapper.outer.internalRemoveOnSelectionChanged(wrapper);
2811 	}
2812 
2813 	protected void internalRemoveOnSelectionChanged(OnSelectionChangedDelegateWrapper source)
2814 	{
2815 		foreach(index, wrapper; onSelectionChangedListeners)
2816 		{
2817 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2818 			{
2819 				onSelectionChangedListeners[index] = null;
2820 				onSelectionChangedListeners = std.algorithm.remove(onSelectionChangedListeners, index);
2821 				break;
2822 			}
2823 		}
2824 	}
2825 	
2826 
2827 	protected class OnTextDeletedDelegateWrapper
2828 	{
2829 		void delegate(Terminal) dlg;
2830 		gulong handlerId;
2831 		ConnectFlags flags;
2832 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2833 		{
2834 			this.dlg = dlg;
2835 			this.handlerId = handlerId;
2836 			this.flags = flags;
2837 		}
2838 	}
2839 	protected OnTextDeletedDelegateWrapper[] onTextDeletedListeners;
2840 
2841 	/**
2842 	 * An internal signal used for communication between the terminal and
2843 	 * its accessibility peer. May not be emitted under certain
2844 	 * circumstances.
2845 	 */
2846 	gulong addOnTextDeleted(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2847 	{
2848 		onTextDeletedListeners ~= new OnTextDeletedDelegateWrapper(dlg, 0, connectFlags);
2849 		onTextDeletedListeners[onTextDeletedListeners.length - 1].handlerId = Signals.connectData(
2850 			this,
2851 			"text-deleted",
2852 			cast(GCallback)&callBackTextDeleted,
2853 			cast(void*)onTextDeletedListeners[onTextDeletedListeners.length - 1],
2854 			cast(GClosureNotify)&callBackTextDeletedDestroy,
2855 			connectFlags);
2856 		return onTextDeletedListeners[onTextDeletedListeners.length - 1].handlerId;
2857 	}
2858 	
2859 	extern(C) static void callBackTextDeleted(VteTerminal* terminalStruct,OnTextDeletedDelegateWrapper wrapper)
2860 	{
2861 		wrapper.dlg(wrapper.outer);
2862 	}
2863 	
2864 	extern(C) static void callBackTextDeletedDestroy(OnTextDeletedDelegateWrapper wrapper, GClosure* closure)
2865 	{
2866 		wrapper.outer.internalRemoveOnTextDeleted(wrapper);
2867 	}
2868 
2869 	protected void internalRemoveOnTextDeleted(OnTextDeletedDelegateWrapper source)
2870 	{
2871 		foreach(index, wrapper; onTextDeletedListeners)
2872 		{
2873 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2874 			{
2875 				onTextDeletedListeners[index] = null;
2876 				onTextDeletedListeners = std.algorithm.remove(onTextDeletedListeners, index);
2877 				break;
2878 			}
2879 		}
2880 	}
2881 	
2882 
2883 	protected class OnTextInsertedDelegateWrapper
2884 	{
2885 		void delegate(Terminal) dlg;
2886 		gulong handlerId;
2887 		ConnectFlags flags;
2888 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2889 		{
2890 			this.dlg = dlg;
2891 			this.handlerId = handlerId;
2892 			this.flags = flags;
2893 		}
2894 	}
2895 	protected OnTextInsertedDelegateWrapper[] onTextInsertedListeners;
2896 
2897 	/**
2898 	 * An internal signal used for communication between the terminal and
2899 	 * its accessibility peer. May not be emitted under certain
2900 	 * circumstances.
2901 	 */
2902 	gulong addOnTextInserted(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2903 	{
2904 		onTextInsertedListeners ~= new OnTextInsertedDelegateWrapper(dlg, 0, connectFlags);
2905 		onTextInsertedListeners[onTextInsertedListeners.length - 1].handlerId = Signals.connectData(
2906 			this,
2907 			"text-inserted",
2908 			cast(GCallback)&callBackTextInserted,
2909 			cast(void*)onTextInsertedListeners[onTextInsertedListeners.length - 1],
2910 			cast(GClosureNotify)&callBackTextInsertedDestroy,
2911 			connectFlags);
2912 		return onTextInsertedListeners[onTextInsertedListeners.length - 1].handlerId;
2913 	}
2914 	
2915 	extern(C) static void callBackTextInserted(VteTerminal* terminalStruct,OnTextInsertedDelegateWrapper wrapper)
2916 	{
2917 		wrapper.dlg(wrapper.outer);
2918 	}
2919 	
2920 	extern(C) static void callBackTextInsertedDestroy(OnTextInsertedDelegateWrapper wrapper, GClosure* closure)
2921 	{
2922 		wrapper.outer.internalRemoveOnTextInserted(wrapper);
2923 	}
2924 
2925 	protected void internalRemoveOnTextInserted(OnTextInsertedDelegateWrapper source)
2926 	{
2927 		foreach(index, wrapper; onTextInsertedListeners)
2928 		{
2929 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2930 			{
2931 				onTextInsertedListeners[index] = null;
2932 				onTextInsertedListeners = std.algorithm.remove(onTextInsertedListeners, index);
2933 				break;
2934 			}
2935 		}
2936 	}
2937 	
2938 
2939 	protected class OnTextModifiedDelegateWrapper
2940 	{
2941 		void delegate(Terminal) dlg;
2942 		gulong handlerId;
2943 		ConnectFlags flags;
2944 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
2945 		{
2946 			this.dlg = dlg;
2947 			this.handlerId = handlerId;
2948 			this.flags = flags;
2949 		}
2950 	}
2951 	protected OnTextModifiedDelegateWrapper[] onTextModifiedListeners;
2952 
2953 	/**
2954 	 * An internal signal used for communication between the terminal and
2955 	 * its accessibility peer. May not be emitted under certain
2956 	 * circumstances.
2957 	 */
2958 	gulong addOnTextModified(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2959 	{
2960 		onTextModifiedListeners ~= new OnTextModifiedDelegateWrapper(dlg, 0, connectFlags);
2961 		onTextModifiedListeners[onTextModifiedListeners.length - 1].handlerId = Signals.connectData(
2962 			this,
2963 			"text-modified",
2964 			cast(GCallback)&callBackTextModified,
2965 			cast(void*)onTextModifiedListeners[onTextModifiedListeners.length - 1],
2966 			cast(GClosureNotify)&callBackTextModifiedDestroy,
2967 			connectFlags);
2968 		return onTextModifiedListeners[onTextModifiedListeners.length - 1].handlerId;
2969 	}
2970 	
2971 	extern(C) static void callBackTextModified(VteTerminal* terminalStruct,OnTextModifiedDelegateWrapper wrapper)
2972 	{
2973 		wrapper.dlg(wrapper.outer);
2974 	}
2975 	
2976 	extern(C) static void callBackTextModifiedDestroy(OnTextModifiedDelegateWrapper wrapper, GClosure* closure)
2977 	{
2978 		wrapper.outer.internalRemoveOnTextModified(wrapper);
2979 	}
2980 
2981 	protected void internalRemoveOnTextModified(OnTextModifiedDelegateWrapper source)
2982 	{
2983 		foreach(index, wrapper; onTextModifiedListeners)
2984 		{
2985 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
2986 			{
2987 				onTextModifiedListeners[index] = null;
2988 				onTextModifiedListeners = std.algorithm.remove(onTextModifiedListeners, index);
2989 				break;
2990 			}
2991 		}
2992 	}
2993 	
2994 
2995 	protected class OnTextScrolledDelegateWrapper
2996 	{
2997 		void delegate(int, Terminal) dlg;
2998 		gulong handlerId;
2999 		ConnectFlags flags;
3000 		this(void delegate(int, Terminal) dlg, gulong handlerId, ConnectFlags flags)
3001 		{
3002 			this.dlg = dlg;
3003 			this.handlerId = handlerId;
3004 			this.flags = flags;
3005 		}
3006 	}
3007 	protected OnTextScrolledDelegateWrapper[] onTextScrolledListeners;
3008 
3009 	/**
3010 	 * An internal signal used for communication between the terminal and
3011 	 * its accessibility peer. May not be emitted under certain
3012 	 * circumstances.
3013 	 *
3014 	 * Params:
3015 	 *     delta = the number of lines scrolled
3016 	 */
3017 	gulong addOnTextScrolled(void delegate(int, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
3018 	{
3019 		onTextScrolledListeners ~= new OnTextScrolledDelegateWrapper(dlg, 0, connectFlags);
3020 		onTextScrolledListeners[onTextScrolledListeners.length - 1].handlerId = Signals.connectData(
3021 			this,
3022 			"text-scrolled",
3023 			cast(GCallback)&callBackTextScrolled,
3024 			cast(void*)onTextScrolledListeners[onTextScrolledListeners.length - 1],
3025 			cast(GClosureNotify)&callBackTextScrolledDestroy,
3026 			connectFlags);
3027 		return onTextScrolledListeners[onTextScrolledListeners.length - 1].handlerId;
3028 	}
3029 	
3030 	extern(C) static void callBackTextScrolled(VteTerminal* terminalStruct, int delta,OnTextScrolledDelegateWrapper wrapper)
3031 	{
3032 		wrapper.dlg(delta, wrapper.outer);
3033 	}
3034 	
3035 	extern(C) static void callBackTextScrolledDestroy(OnTextScrolledDelegateWrapper wrapper, GClosure* closure)
3036 	{
3037 		wrapper.outer.internalRemoveOnTextScrolled(wrapper);
3038 	}
3039 
3040 	protected void internalRemoveOnTextScrolled(OnTextScrolledDelegateWrapper source)
3041 	{
3042 		foreach(index, wrapper; onTextScrolledListeners)
3043 		{
3044 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
3045 			{
3046 				onTextScrolledListeners[index] = null;
3047 				onTextScrolledListeners = std.algorithm.remove(onTextScrolledListeners, index);
3048 				break;
3049 			}
3050 		}
3051 	}
3052 	
3053 
3054 	protected class OnWindowTitleChangedDelegateWrapper
3055 	{
3056 		void delegate(Terminal) dlg;
3057 		gulong handlerId;
3058 		ConnectFlags flags;
3059 		this(void delegate(Terminal) dlg, gulong handlerId, ConnectFlags flags)
3060 		{
3061 			this.dlg = dlg;
3062 			this.handlerId = handlerId;
3063 			this.flags = flags;
3064 		}
3065 	}
3066 	protected OnWindowTitleChangedDelegateWrapper[] onWindowTitleChangedListeners;
3067 
3068 	/**
3069 	 * Emitted when the terminal's %window_title field is modified.
3070 	 */
3071 	gulong addOnWindowTitleChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
3072 	{
3073 		onWindowTitleChangedListeners ~= new OnWindowTitleChangedDelegateWrapper(dlg, 0, connectFlags);
3074 		onWindowTitleChangedListeners[onWindowTitleChangedListeners.length - 1].handlerId = Signals.connectData(
3075 			this,
3076 			"window-title-changed",
3077 			cast(GCallback)&callBackWindowTitleChanged,
3078 			cast(void*)onWindowTitleChangedListeners[onWindowTitleChangedListeners.length - 1],
3079 			cast(GClosureNotify)&callBackWindowTitleChangedDestroy,
3080 			connectFlags);
3081 		return onWindowTitleChangedListeners[onWindowTitleChangedListeners.length - 1].handlerId;
3082 	}
3083 	
3084 	extern(C) static void callBackWindowTitleChanged(VteTerminal* terminalStruct,OnWindowTitleChangedDelegateWrapper wrapper)
3085 	{
3086 		wrapper.dlg(wrapper.outer);
3087 	}
3088 	
3089 	extern(C) static void callBackWindowTitleChangedDestroy(OnWindowTitleChangedDelegateWrapper wrapper, GClosure* closure)
3090 	{
3091 		wrapper.outer.internalRemoveOnWindowTitleChanged(wrapper);
3092 	}
3093 
3094 	protected void internalRemoveOnWindowTitleChanged(OnWindowTitleChangedDelegateWrapper source)
3095 	{
3096 		foreach(index, wrapper; onWindowTitleChangedListeners)
3097 		{
3098 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
3099 			{
3100 				onWindowTitleChangedListeners[index] = null;
3101 				onWindowTitleChangedListeners = std.algorithm.remove(onWindowTitleChangedListeners, index);
3102 				break;
3103 			}
3104 		}
3105 	}
3106 	
3107 
3108 	/**
3109 	 * Gets the user's shell, or %NULL. In the latter case, the
3110 	 * system default (usually "/bin/sh") should be used.
3111 	 *
3112 	 * Return: a newly allocated string with the
3113 	 *     user's shell, or %NULL
3114 	 */
3115 	public static string getUserShell()
3116 	{
3117 		auto retStr = vte_get_user_shell();
3118 		
3119 		scope(exit) Str.freeString(retStr);
3120 		return Str.toString(retStr);
3121 	}
3122 }