/* TerminalWidget.c generated by valac 0.56.19, the Vala compiler
 * generated from TerminalWidget.vala, do not modify */

/*
 * SPDX-License-Identifier: LGPL-3.0-or-later
 * SPDX-FileCopyrightText: 2011-2025 elementary, Inc. (https://elementary.io)
 */

#include <glib.h>
#include <vte/vte.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <adwaita.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <float.h>
#include <math.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>
#include <granite-7.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <poll.h>
#include <pcre2.h>
#include <glib/gstdio.h>

#define TERMINAL_TERMINAL_WIDGET_DEFAULT_LABEL _ ("Terminal")
#define TERMINAL_TERMINAL_WIDGET_ACTION_OPEN_IN_BROWSER "term.open-in-browser"
#define TERMINAL_TERMINAL_WIDGET_ACTION_COPY "term.copy"
#define TERMINAL_TERMINAL_WIDGET_ACTION_COPY_OUTPUT "term.copy-output"
#define TERMINAL_TERMINAL_WIDGET_ACTION_CLEAR_SCREEN "term.clear-screen"
#define TERMINAL_TERMINAL_WIDGET_ACTION_RESET "term.reset"
#define TERMINAL_TERMINAL_WIDGET_ACTION_PASTE "term.paste"
#define TERMINAL_TERMINAL_WIDGET_ACTION_RELOAD "term.reload"
#define TERMINAL_TERMINAL_WIDGET_ACTION_SCROLL_TO_COMMAND "term.scroll-to-command"
#define TERMINAL_TERMINAL_WIDGET_ACTION_SELECT_ALL "term.select-all"
#define TERMINAL_TERMINAL_WIDGET_SEND_PROCESS_FINISHED_BASH "dbus-send --type=method_call " "--session --dest=io.elementary.terminal " "/io/elementary/terminal " "io.elementary.terminal.ProcessFinished " "string:$PANTHEON_TERMINAL_ID " "string:\"$(fc -nl -1 | cut -c 3-)\" " "int32:\$__bp_last_ret_value >/dev/null 2>&1"
#define TERMINAL_TERMINAL_WIDGET_USERCHARS "-[:alnum:]"
#define TERMINAL_TERMINAL_WIDGET_USERCHARS_CLASS "[" TERMINAL_TERMINAL_WIDGET_USERCHARS "]"
#define TERMINAL_TERMINAL_WIDGET_PASSCHARS_CLASS "[-[:alnum:]\\Q,?;.:/!%$^*&~\"#'\\E]"
#define TERMINAL_TERMINAL_WIDGET_HOSTCHARS_CLASS "[-[:alnum:]]"
#define TERMINAL_TERMINAL_WIDGET_HOST TERMINAL_TERMINAL_WIDGET_HOSTCHARS_CLASS "+(\\." TERMINAL_TERMINAL_WIDGET_HOSTCHARS_CLASS "+)*"
#define TERMINAL_TERMINAL_WIDGET_PORT "(?:\\:[[:digit:]]{1,5})?"
#define TERMINAL_TERMINAL_WIDGET_PATHCHARS_CLASS "[-[:alnum:]\\Q_$.+!*,;:@&=?/~#%\\E]"
#define TERMINAL_TERMINAL_WIDGET_PATHTERM_CLASS "[^\\Q]'.}>) \t\r\n,\"\\E]"
#define TERMINAL_TERMINAL_WIDGET_SCHEME "(?:news:|telnet:|nntp:|file:\\/|https?:|ftps?:|sftp:|webcal:" "|irc:|sftp:|ldaps?:|nfs:|smb:|rsync:|ssh:|rlogin:|telnet:|git:" "|git\\+ssh:|bzr:|bzr\\+ssh:|svn:|svn\\+ssh:|hg:|mailto:|magnet:)"
#define TERMINAL_TERMINAL_WIDGET_USERPASS TERMINAL_TERMINAL_WIDGET_USERCHARS_CLASS "+(?:" TERMINAL_TERMINAL_WIDGET_PASSCHARS_CLASS "+)?"
#define TERMINAL_TERMINAL_WIDGET_URLPATH "(?:(/" TERMINAL_TERMINAL_WIDGET_PATHCHARS_CLASS "+(?:[(]" TERMINAL_TERMINAL_WIDGET_PATHCHARS_CLASS "*[)])*" TERMINAL_TERMINAL_WIDGET_PATHCHARS_CLASS "*)*" TERMINAL_TERMINAL_WIDGET_PATHTERM_CLASS ")?"
#define TERMINAL_TERMINAL_WIDGET_MIN_SCALE 0.25
#define TERMINAL_TERMINAL_WIDGET_MAX_SCALE 4.0
#define TERMINAL_TERMINAL_WIDGET_SYS_PIDFD_OPEN 434
#define TERMINAL_TERMINAL_WIDGET_CONTENTS_CHANGED_DELAY_MSEC 100
#define TERMINAL_THEMES_PALETTE_SIZE 19
#define TERMINAL_THEMES_DARK "dark"
#define TERMINAL_THEMES_LIGHT "solarized-light"
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

typedef gboolean (*_LocalFunc0_) (guint keyval, guint code, gpointer user_data);

#define TERMINAL_TYPE_TERMINAL_WIDGET (terminal_terminal_widget_get_type ())
#define TERMINAL_TERMINAL_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_TYPE_TERMINAL_WIDGET, TerminalTerminalWidget))
#define TERMINAL_TERMINAL_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_TERMINAL_WIDGET, TerminalTerminalWidgetClass))
#define TERMINAL_IS_TERMINAL_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_TYPE_TERMINAL_WIDGET))
#define TERMINAL_IS_TERMINAL_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_TERMINAL_WIDGET))
#define TERMINAL_TERMINAL_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_TERMINAL_WIDGET, TerminalTerminalWidgetClass))

typedef struct _TerminalTerminalWidget TerminalTerminalWidget;
typedef struct _TerminalTerminalWidgetClass TerminalTerminalWidgetClass;
typedef struct _TerminalTerminalWidgetPrivate TerminalTerminalWidgetPrivate;
typedef enum  {
	TERMINAL_TERMINAL_WIDGET_TAB_STATE_NONE,
	TERMINAL_TERMINAL_WIDGET_TAB_STATE_WORKING,
	TERMINAL_TERMINAL_WIDGET_TAB_STATE_COMPLETED,
	TERMINAL_TERMINAL_WIDGET_TAB_STATE_ERROR,
	TERMINAL_TERMINAL_WIDGET_TAB_STATE_ATTENTION
} TerminalTerminalWidgetTabState;

#define TERMINAL_TERMINAL_WIDGET_TYPE_TAB_STATE (terminal_terminal_widget_tab_state_get_type ())
enum  {
	TERMINAL_TERMINAL_WIDGET_0_PROPERTY,
	TERMINAL_TERMINAL_WIDGET_CURRENT_WORKING_DIRECTORY_PROPERTY,
	TERMINAL_TERMINAL_WIDGET_PROGRAM_STRING_PROPERTY,
	TERMINAL_TERMINAL_WIDGET_TAB_STATE_PROPERTY,
	TERMINAL_TERMINAL_WIDGET_KILLED_PROPERTY,
	TERMINAL_TERMINAL_WIDGET_NUM_PROPERTIES
};
static GParamSpec* terminal_terminal_widget_properties[TERMINAL_TERMINAL_WIDGET_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _gdk_event_unref0(var) ((var == NULL) ? NULL : (var = (gdk_event_unref (var), NULL)))
#define __vala_GdkEventSequence_free0(var) ((var == NULL) ? NULL : (var = (_vala_GdkEventSequence_free (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _Block4Data Block4Data;
typedef void (*TerminalTerminalWidgetConfirmedActionCallback) (gboolean confirmed, gpointer user_data);
typedef struct _Block5Data Block5Data;

#define TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG (terminal_foreground_process_dialog_get_type ())
#define TERMINAL_FOREGROUND_PROCESS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG, TerminalForegroundProcessDialog))
#define TERMINAL_FOREGROUND_PROCESS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG, TerminalForegroundProcessDialogClass))
#define TERMINAL_IS_FOREGROUND_PROCESS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG))
#define TERMINAL_IS_FOREGROUND_PROCESS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG))
#define TERMINAL_FOREGROUND_PROCESS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG, TerminalForegroundProcessDialogClass))

typedef struct _TerminalForegroundProcessDialog TerminalForegroundProcessDialog;
typedef struct _TerminalForegroundProcessDialogClass TerminalForegroundProcessDialogClass;
typedef struct _Block6Data Block6Data;

#define TERMINAL_TYPE_MAIN_WINDOW (terminal_main_window_get_type ())
#define TERMINAL_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_TYPE_MAIN_WINDOW, TerminalMainWindow))
#define TERMINAL_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_MAIN_WINDOW, TerminalMainWindowClass))
#define TERMINAL_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_TYPE_MAIN_WINDOW))
#define TERMINAL_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_MAIN_WINDOW))
#define TERMINAL_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_MAIN_WINDOW, TerminalMainWindowClass))

typedef struct _TerminalMainWindow TerminalMainWindow;
typedef struct _TerminalMainWindowClass TerminalMainWindowClass;
typedef struct _Block7Data Block7Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define TERMINAL_TYPE_UNSAFE_PASTE_DIALOG (terminal_unsafe_paste_dialog_get_type ())
#define TERMINAL_UNSAFE_PASTE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_TYPE_UNSAFE_PASTE_DIALOG, TerminalUnsafePasteDialog))
#define TERMINAL_UNSAFE_PASTE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_UNSAFE_PASTE_DIALOG, TerminalUnsafePasteDialogClass))
#define TERMINAL_IS_UNSAFE_PASTE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_TYPE_UNSAFE_PASTE_DIALOG))
#define TERMINAL_IS_UNSAFE_PASTE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_UNSAFE_PASTE_DIALOG))
#define TERMINAL_UNSAFE_PASTE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_UNSAFE_PASTE_DIALOG, TerminalUnsafePasteDialogClass))

typedef struct _TerminalUnsafePasteDialog TerminalUnsafePasteDialog;
typedef struct _TerminalUnsafePasteDialogClass TerminalUnsafePasteDialogClass;
typedef struct _Block8Data Block8Data;
typedef struct _Block9Data Block9Data;
#define _vte_regex_unref0(var) ((var == NULL) ? NULL : (var = (vte_regex_unref (var), NULL)))
enum  {
	TERMINAL_TERMINAL_WIDGET_CWD_CHANGED_SIGNAL,
	TERMINAL_TERMINAL_WIDGET_FOREGROUND_PROCESS_CHANGED_SIGNAL,
	TERMINAL_TERMINAL_WIDGET_NUM_SIGNALS
};
static guint terminal_terminal_widget_signals[TERMINAL_TERMINAL_WIDGET_NUM_SIGNALS] = {0};

struct _TerminalTerminalWidget {
	VteTerminal parent_instance;
	TerminalTerminalWidgetPrivate * priv;
	gchar* terminal_id;
	AdwTabPage* tab;
};

struct _TerminalTerminalWidgetClass {
	VteTerminalClass parent_class;
};

struct _TerminalTerminalWidgetPrivate {
	gchar* _current_working_directory;
	gchar* _program_string;
	gboolean init_complete;
	gboolean _resized;
	TerminalTerminalWidgetTabState _tab_state;
	GPid child_pid;
	GPid fg_pid;
	gboolean _killed;
	GSimpleAction* open_in_browser_action;
	GSimpleAction* copy_action;
	GSimpleAction* copy_output_action;
	GSimpleAction* clear_screen_action;
	GSimpleAction* reset_action;
	GSimpleAction* paste_action;
	GSimpleAction* scroll_to_command_action;
	glong remembered_position;
	glong remembered_command_start_row;
	glong remembered_command_end_row;
	gboolean last_key_was_return;
	gboolean child_has_exited;
	gchar* link_uri;
	GtkEventControllerScroll* scroll_controller;
	gdouble scroll_delta;
	gchar* old_loc;
	guint contents_changed_timeout_id;
	gboolean contents_changed_continue;
};

struct _Block4Data {
	int _ref_count_;
	TerminalTerminalWidget* self;
	GtkPopoverMenu* new_context_menu;
};

struct _Block5Data {
	int _ref_count_;
	TerminalTerminalWidget* self;
	TerminalTerminalWidgetConfirmedActionCallback cb;
	gpointer cb_target;
};

struct _Block6Data {
	int _ref_count_;
	Block5Data * _data5_;
	TerminalForegroundProcessDialog* dialog;
};

struct _Block7Data {
	int _ref_count_;
	TerminalTerminalWidget* self;
	gchar* command;
};

struct _Block8Data {
	int _ref_count_;
	TerminalTerminalWidget* self;
	TerminalUnsafePasteDialog* dialog;
	gchar* text;
};

struct _Block9Data {
	int _ref_count_;
	TerminalTerminalWidget* self;
	gchar* program;
};

static gint TerminalTerminalWidget_private_offset;
static gpointer terminal_terminal_widget_parent_class = NULL;
static gint terminal_terminal_widget_terminal_id_counter;
static gint terminal_terminal_widget_terminal_id_counter = 0;
VALA_EXTERN GSettings* terminal_application_settings;

VALA_EXTERN GType terminal_terminal_widget_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TerminalTerminalWidget, g_object_unref)
VALA_EXTERN GType terminal_terminal_widget_tab_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GIcon* terminal_terminal_widget_tab_state_to_icon (TerminalTerminalWidgetTabState self);
static void terminal_terminal_widget_pointer_focus (TerminalTerminalWidget* self);
static void terminal_terminal_widget_secondary_pressed (TerminalTerminalWidget* self,
                                                 GtkGestureSingle* gesture,
                                                 gdouble x,
                                                 gdouble y);
VALA_EXTERN gboolean terminal_terminal_widget_has_foreground_process (TerminalTerminalWidget* self);
static gchar* terminal_terminal_widget_get_link (TerminalTerminalWidget* self,
                                          gdouble x,
                                          gdouble y);
static void terminal_terminal_widget_popup_context_menu (TerminalTerminalWidget* self,
                                                  gdouble x,
                                                  gdouble y);
static void terminal_terminal_widget_click_pressed (TerminalTerminalWidget* self,
                                             GtkGestureClick* gesture,
                                             gint n_press,
                                             gdouble x,
                                             gdouble y);
static void _vala_GdkEventSequence_free (GdkEventSequence* self);
static gboolean terminal_terminal_widget_on_scroll (TerminalTerminalWidget* self,
                                             GtkEventControllerScroll* controller,
                                             gdouble x,
                                             gdouble y);
static gboolean terminal_terminal_widget_on_key_pressed (TerminalTerminalWidget* self,
                                                  GtkEventControllerKey* controller,
                                                  guint keyval,
                                                  guint keycode,
                                                  GdkModifierType modifiers);
static gboolean terminal_terminal_widget_get_resized (TerminalTerminalWidget* self);
static gchar* terminal_terminal_widget_get_last_output (TerminalTerminalWidget* self,
                                                 gboolean include_command);
static void terminal_terminal_widget_remember_position (TerminalTerminalWidget* self);
static void terminal_terminal_widget_remember_command_end_position (TerminalTerminalWidget* self);
static void terminal_terminal_widget_remember_command_start_position (TerminalTerminalWidget* self);
VALA_EXTERN void terminal_terminal_widget_default_font_size (TerminalTerminalWidget* self);
static gboolean __lambda6_ (TerminalTerminalWidget* self,
                     guint keyval,
                     guint code);
static gboolean ___lambda6___localfunc0_ (guint keyval,
                                   guint code,
                                   gpointer self);
static void terminal_terminal_widget_action_reset (TerminalTerminalWidget* self);
static void terminal_terminal_widget_action_clear_screen (TerminalTerminalWidget* self);
static void terminal_terminal_widget_update_actions_state (TerminalTerminalWidget* self);
VALA_EXTERN GAppInfo* terminal_utils_get_default_app_for_uri (const gchar* uri);
static gchar* terminal_terminal_widget_get_current_selection_link_or_pwd (TerminalTerminalWidget* self);
static GMenu* terminal_terminal_widget_construct_context_menu_model (TerminalTerminalWidget* self);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static void __lambda5_ (Block4Data* _data4_);
static void ___lambda5__gtk_popover_closed (GtkPopover* _sender,
                                     gpointer self);
static void terminal_terminal_widget_real_copy_clipboard (VteTerminal* base);
static void terminal_terminal_widget_copy_output (TerminalTerminalWidget* self);
VALA_EXTERN void terminal_terminal_widget_confirm_kill_fg_process (TerminalTerminalWidget* self,
                                                       const gchar* primary_text,
                                                       const gchar* button_label,
                                                       TerminalTerminalWidgetConfirmedActionCallback cb,
                                                       gpointer cb_target);
static Block5Data* block5_data_ref (Block5Data* _data5_);
static void block5_data_unref (void * _userdata_);
VALA_EXTERN GType terminal_foreground_process_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TerminalForegroundProcessDialog, g_object_unref)
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
VALA_EXTERN GType terminal_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TerminalMainWindow, g_object_unref)
VALA_EXTERN TerminalForegroundProcessDialog* terminal_foreground_process_dialog_new (TerminalMainWindow* parent,
                                                                         const gchar* primary_text,
                                                                         const gchar* button_label);
VALA_EXTERN TerminalForegroundProcessDialog* terminal_foreground_process_dialog_construct (GType object_type,
                                                                               TerminalMainWindow* parent,
                                                                               const gchar* primary_text,
                                                                               const gchar* button_label);
static void ___lambda20_ (Block6Data* _data6_,
                   gint res);
static void ____lambda20__gtk_dialog_response (GtkDialog* _sender,
                                        gint response_id,
                                        gpointer self);
static void terminal_terminal_widget_feed_command (TerminalTerminalWidget* self,
                                            const gchar* command);
static void __lambda41_ (TerminalTerminalWidget* self,
                  gboolean confirmed);
static void ___lambda41__terminal_terminal_widget_confirmed_action_callback (gboolean confirmed,
                                                                      gpointer self);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static gboolean __lambda22_ (Block7Data* _data7_);
static gboolean ___lambda22__gsource_func (gpointer self);
VALA_EXTERN void terminal_terminal_widget_change_directory (TerminalTerminalWidget* self,
                                                const gchar* path);
VALA_EXTERN void terminal_terminal_widget_reload (TerminalTerminalWidget* self);
VALA_EXTERN gchar* terminal_terminal_widget_get_shell_location (TerminalTerminalWidget* self);
static void __lambda21_ (TerminalTerminalWidget* self,
                  gboolean confirmed);
static void ___lambda21__terminal_terminal_widget_confirmed_action_callback (gboolean confirmed,
                                                                      gpointer self);
static void terminal_terminal_widget_real_paste_clipboard (VteTerminal* base);
static void terminal_terminal_widget_validated_paste (TerminalTerminalWidget* self,
                                               const gchar* text);
static void ___lambda40_ (TerminalTerminalWidget* self,
                   GObject* obj,
                   GAsyncResult* res);
static void ____lambda40__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
VALA_EXTERN GType terminal_unsafe_paste_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TerminalUnsafePasteDialog, g_object_unref)
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
VALA_EXTERN gboolean terminal_utils_is_safe_paste (const gchar* text,
                                       gchar*** msg_array,
                                       gint* msg_array_length1);
VALA_EXTERN TerminalUnsafePasteDialog* terminal_unsafe_paste_dialog_new (TerminalMainWindow* parent,
                                                             const gchar* title_text,
                                                             const gchar* text_to_paste);
VALA_EXTERN TerminalUnsafePasteDialog* terminal_unsafe_paste_dialog_construct (GType object_type,
                                                                   TerminalMainWindow* parent,
                                                                   const gchar* title_text,
                                                                   const gchar* text_to_paste);
static void __lambda39_ (Block8Data* _data8_,
                  gint res);
static void ___lambda39__gtk_dialog_response (GtkDialog* _sender,
                                       gint response_id,
                                       gpointer self);
static void terminal_terminal_widget_update_current_working_directory (TerminalTerminalWidget* self,
                                                                const gchar* cwd);
static void terminal_terminal_widget_set_current_working_directory (TerminalTerminalWidget* self,
                                                             const gchar* value);
static void terminal_terminal_widget_update_theme (TerminalTerminalWidget* self);
VALA_EXTERN GdkRGBA* terminal_themes_get_rgba_palette (const gchar* theme,
                                           gint* result_length1);
static GdkRGBA* _vala_array_dup1 (GdkRGBA* self,
                           gssize length);
static void terminal_terminal_widget_update_audible_bell (TerminalTerminalWidget* self);
static void terminal_terminal_widget_update_cursor_shape (TerminalTerminalWidget* self);
static void terminal_terminal_widget_on_child_exited (TerminalTerminalWidget* self);
static void terminal_terminal_widget_on_window_title_changed (TerminalTerminalWidget* self);
VALA_EXTERN void terminal_terminal_widget_set_tab_state (TerminalTerminalWidget* self,
                                             TerminalTerminalWidgetTabState value);
VALA_EXTERN void terminal_terminal_widget_kill_fg (TerminalTerminalWidget* self);
static gboolean terminal_terminal_widget_try_get_foreground_pid (TerminalTerminalWidget* self,
                                                          gint* pid);
VALA_EXTERN void terminal_terminal_widget_term_ps (TerminalTerminalWidget* self);
static void terminal_terminal_widget_set_killed (TerminalTerminalWidget* self,
                                          gboolean value);
VALA_EXTERN void terminal_terminal_widget_active_shell (TerminalTerminalWidget* self,
                                            const gchar* dir);
static void __lambda15_ (TerminalTerminalWidget* self,
                  VteTerminal* terminal,
                  GPid pid,
                  GError* _error_);
static void ___lambda15__vte_terminal_spawn_async_callback (VteTerminal* terminal,
                                                     GPid pid,
                                                     GError* _error_,
                                                     gpointer self);
VALA_EXTERN void terminal_terminal_widget_run_program (TerminalTerminalWidget* self,
                                           const gchar* program);
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
static gboolean __lambda16_ (Block9Data* _data9_);
static gboolean ___lambda16__gsource_func (gpointer self);
static void terminal_terminal_widget_clickable (TerminalTerminalWidget* self,
                                         gchar** str,
                                         gint str_length1);
static gchar* terminal_terminal_widget_get_pid_exe_name (TerminalTerminalWidget* self,
                                                  gint pid);
static void terminal_terminal_widget_real_increase_font_size (VteTerminal* base);
static void terminal_terminal_widget_real_decrease_font_size (VteTerminal* base);
VALA_EXTERN gboolean terminal_terminal_widget_is_init_complete (TerminalTerminalWidget* self);
VALA_EXTERN void terminal_terminal_widget_set_init_complete (TerminalTerminalWidget* self);
static gboolean terminal_terminal_widget_on_drop (TerminalTerminalWidget* self,
                                           GValue* val,
                                           gdouble x,
                                           gdouble y);
static void terminal_terminal_widget_set_resized (TerminalTerminalWidget* self,
                                           gboolean value);
static void terminal_terminal_widget_scroll_to_command (TerminalTerminalWidget* self,
                                                 GSimpleAction* action,
                                                 GVariant* parameter);
static void terminal_terminal_widget_on_contents_changed (TerminalTerminalWidget* self);
static gboolean __lambda42_ (TerminalTerminalWidget* self);
VALA_EXTERN const gchar* terminal_terminal_widget_get_current_working_directory (TerminalTerminalWidget* self);
static gboolean ___lambda42__gsource_func (gpointer self);
static void terminal_terminal_widget_open_in_browser (TerminalTerminalWidget* self,
                                               GSimpleAction* action,
                                               GVariant* parameter);
static void __lambda43_ (TerminalTerminalWidget* self,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda43__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
VALA_EXTERN TerminalTerminalWidget* terminal_terminal_widget_new (void);
VALA_EXTERN TerminalTerminalWidget* terminal_terminal_widget_construct (GType object_type);
VALA_EXTERN const gchar* terminal_terminal_widget_get_program_string (TerminalTerminalWidget* self);
VALA_EXTERN void terminal_terminal_widget_set_program_string (TerminalTerminalWidget* self,
                                                  const gchar* value);
VALA_EXTERN TerminalTerminalWidgetTabState terminal_terminal_widget_get_tab_state (TerminalTerminalWidget* self);
VALA_EXTERN gboolean terminal_terminal_widget_get_killed (TerminalTerminalWidget* self);
static GObject * terminal_terminal_widget_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
static void _terminal_terminal_widget_update_theme_g_object_notify (GObject* _sender,
                                                             GParamSpec* pspec,
                                                             gpointer self);
static void _terminal_terminal_widget_update_audible_bell_g_settings_changed (GSettings* _sender,
                                                                       const gchar* key,
                                                                       gpointer self);
static void _terminal_terminal_widget_update_theme_g_settings_changed (GSettings* _sender,
                                                                const gchar* key,
                                                                gpointer self);
static void _terminal_terminal_widget_update_cursor_shape_g_settings_changed (GSettings* _sender,
                                                                       const gchar* key,
                                                                       gpointer self);
static void _terminal_terminal_widget_pointer_focus_gtk_event_controller_motion_enter (GtkEventControllerMotion* _sender,
                                                                                gdouble x,
                                                                                gdouble y,
                                                                                gpointer self);
static gboolean _terminal_terminal_widget_on_scroll_gtk_event_controller_scroll_scroll (GtkEventControllerScroll* _sender,
                                                                                 gdouble dx,
                                                                                 gdouble dy,
                                                                                 gpointer self);
static void _terminal_terminal_widget___lambda44_ (TerminalTerminalWidget* self);
static void __terminal_terminal_widget___lambda44__gtk_event_controller_scroll_scroll_end (GtkEventControllerScroll* _sender,
                                                                                    gpointer self);
static gboolean _terminal_terminal_widget_on_key_pressed_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                                        guint keyval,
                                                                                        guint keycode,
                                                                                        GdkModifierType state,
                                                                                        gpointer self);
static void _terminal_terminal_widget___lambda45_ (TerminalTerminalWidget* self);
static void __terminal_terminal_widget___lambda45__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                                              gpointer self);
static void _terminal_terminal_widget___lambda46_ (TerminalTerminalWidget* self);
static void __terminal_terminal_widget___lambda46__gtk_event_controller_focus_enter (GtkEventControllerFocus* _sender,
                                                                              gpointer self);
static void _terminal_terminal_widget_click_pressed_gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                                                        gint n_press,
                                                                        gdouble x,
                                                                        gdouble y,
                                                                        gpointer self);
static void _terminal_terminal_widget_secondary_pressed_gtk_gesture_long_press_pressed (GtkGestureLongPress* _sender,
                                                                                 gdouble x,
                                                                                 gdouble y,
                                                                                 gpointer self);
static void _terminal_terminal_widget___lambda47_ (TerminalTerminalWidget* self);
static void __terminal_terminal_widget___lambda47__vte_terminal_selection_changed (VteTerminal* _sender,
                                                                            gpointer self);
static void _terminal_terminal_widget___lambda48_ (TerminalTerminalWidget* self);
static void __terminal_terminal_widget___lambda48__g_object_notify (GObject* _sender,
                                                             GParamSpec* pspec,
                                                             gpointer self);
static void _terminal_terminal_widget___lambda49_ (TerminalTerminalWidget* self);
static void __terminal_terminal_widget___lambda49__g_object_notify (GObject* _sender,
                                                             GParamSpec* pspec,
                                                             gpointer self);
static void _terminal_terminal_widget_on_contents_changed_vte_terminal_contents_changed (VteTerminal* _sender,
                                                                                  gpointer self);
static void _terminal_terminal_widget_on_child_exited_vte_terminal_child_exited (VteTerminal* _sender,
                                                                          gint status,
                                                                          gpointer self);
static void _terminal_terminal_widget_on_window_title_changed_vte_terminal_window_title_changed (VteTerminal* _sender,
                                                                                          gpointer self);
static void _terminal_terminal_widget_update_actions_state_gdk_clipboard_changed (GdkClipboard* _sender,
                                                                           gpointer self);
static gboolean _terminal_terminal_widget_on_drop_gtk_drop_target_drop (GtkDropTarget* _sender,
                                                                 GValue* value,
                                                                 gdouble x,
                                                                 gdouble y,
                                                                 gpointer self);
static void _terminal_terminal_widget_open_in_browser_g_simple_action_activate (GSimpleAction* _sender,
                                                                         GVariant* parameter,
                                                                         gpointer self);
static void _terminal_terminal_widget___lambda50_ (TerminalTerminalWidget* self);
static void __terminal_terminal_widget___lambda50__g_simple_action_activate (GSimpleAction* _sender,
                                                                      GVariant* parameter,
                                                                      gpointer self);
static void _terminal_terminal_widget_copy_output_g_simple_action_activate (GSimpleAction* _sender,
                                                                     GVariant* parameter,
                                                                     gpointer self);
static void _terminal_terminal_widget_action_clear_screen_g_simple_action_activate (GSimpleAction* _sender,
                                                                             GVariant* parameter,
                                                                             gpointer self);
static void _terminal_terminal_widget_action_reset_g_simple_action_activate (GSimpleAction* _sender,
                                                                      GVariant* parameter,
                                                                      gpointer self);
static void _terminal_terminal_widget___lambda51_ (TerminalTerminalWidget* self);
static void __terminal_terminal_widget___lambda51__g_simple_action_activate (GSimpleAction* _sender,
                                                                      GVariant* parameter,
                                                                      gpointer self);
static void _terminal_terminal_widget_reload_g_simple_action_activate (GSimpleAction* _sender,
                                                                GVariant* parameter,
                                                                gpointer self);
static void _terminal_terminal_widget_scroll_to_command_g_simple_action_activate (GSimpleAction* _sender,
                                                                           GVariant* parameter,
                                                                           gpointer self);
static void _vte_terminal_select_all_g_simple_action_activate (GSimpleAction* _sender,
                                                        GVariant* parameter,
                                                        gpointer self);
static void terminal_terminal_widget_finalize (GObject * obj);
static GType terminal_terminal_widget_get_type_once (void);
static void _vala_terminal_terminal_widget_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_terminal_terminal_widget_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const gchar* TERMINAL_TERMINAL_WIDGET_ACCELS_OPEN_IN_BROWSER[2] = {"<Control><Shift>E", NULL};
static const gchar* TERMINAL_TERMINAL_WIDGET_ACCELS_COPY[2] = {"<Control><Shift>C", NULL};
static const gchar* TERMINAL_TERMINAL_WIDGET_ACCELS_COPY_OUTPUT[2] = {"<Alt>C", NULL};
static const gchar* TERMINAL_TERMINAL_WIDGET_ACCELS_CLEAR_SCREEN[2] = {"<Control><Shift>L", NULL};
static const gchar* TERMINAL_TERMINAL_WIDGET_ACCELS_RESET[2] = {"<Control><Shift>K", NULL};
static const gchar* TERMINAL_TERMINAL_WIDGET_ACCELS_PASTE[2] = {"<Control><Shift>V", NULL};
static const gchar* TERMINAL_TERMINAL_WIDGET_ACCELS_RELOAD[3] = {"<Control><Shift>R", "<Ctrl>F5", NULL};
static const gchar* TERMINAL_TERMINAL_WIDGET_ACCELS_SELECT_ALL[2] = {"<Control><Shift>A", NULL};
const gchar* TERMINAL_TERMINAL_WIDGET_ACCELS_ZOOM_DEFAULT[3] = {"<control>0", "<Control>KP_0", NULL};
const gchar* TERMINAL_TERMINAL_WIDGET_ACCELS_ZOOM_IN[4] = {"<Control>plus", "<Control>equal", "<Control>KP_Add", NULL};
const gchar* TERMINAL_TERMINAL_WIDGET_ACCELS_ZOOM_OUT[3] = {"<Control>minus", "<Control>KP_Subtract", NULL};
static const gchar* TERMINAL_TERMINAL_WIDGET_REGEX_STRINGS[5] = {TERMINAL_TERMINAL_WIDGET_SCHEME "//(?:" TERMINAL_TERMINAL_WIDGET_USERPASS "\\@)?" TERMINAL_TERMINAL_WIDGET_HOST TERMINAL_TERMINAL_WIDGET_PORT TERMINAL_TERMINAL_WIDGET_URLPATH, "(?:www|ftp)" TERMINAL_TERMINAL_WIDGET_HOSTCHARS_CLASS "*\\." TERMINAL_TERMINAL_WIDGET_HOST TERMINAL_TERMINAL_WIDGET_PORT TERMINAL_TERMINAL_WIDGET_URLPATH, "(?:callto:|h323:|sip:)" TERMINAL_TERMINAL_WIDGET_USERCHARS_CLASS "[" TERMINAL_TERMINAL_WIDGET_USERCHARS ".]*(?:" TERMINAL_TERMINAL_WIDGET_PORT "/[a-z0-9]+)?\\@" TERMINAL_TERMINAL_WIDGET_HOST, "(?:mailto:)?" TERMINAL_TERMINAL_WIDGET_USERCHARS_CLASS "[" TERMINAL_TERMINAL_WIDGET_USERCHARS ".]*\\@" TERMINAL_TERMINAL_WIDGET_HOSTCHARS_CLASS "+\\." TERMINAL_TERMINAL_WIDGET_HOST, "(?:news:|man:|info:)[[:alnum:]\\Q^_{|}~!\"#$%&'()*+,./;:=?`\\E]+"};

static inline gpointer
terminal_terminal_widget_get_instance_private (TerminalTerminalWidget* self)
{
	return G_STRUCT_MEMBER_P (self, TerminalTerminalWidget_private_offset);
}

GIcon*
terminal_terminal_widget_tab_state_to_icon (TerminalTerminalWidgetTabState self)
{
	GIcon* result;
	switch (self) {
		case TERMINAL_TERMINAL_WIDGET_TAB_STATE_COMPLETED:
		{
			GThemedIcon* _tmp0_;
			_tmp0_ = (GThemedIcon*) g_themed_icon_new ("process-completed-symbolic");
			result = (GIcon*) _tmp0_;
			return result;
		}
		case TERMINAL_TERMINAL_WIDGET_TAB_STATE_ERROR:
		{
			GThemedIcon* _tmp1_;
			_tmp1_ = (GThemedIcon*) g_themed_icon_new ("process-error-symbolic");
			result = (GIcon*) _tmp1_;
			return result;
		}
		case TERMINAL_TERMINAL_WIDGET_TAB_STATE_ATTENTION:
		{
			GThemedIcon* _tmp2_;
			_tmp2_ = (GThemedIcon*) g_themed_icon_new ("dialog-question-symbolic");
			result = (GIcon*) _tmp2_;
			return result;
		}
		default:
		{
			result = NULL;
			return result;
		}
	}
}

static GType
terminal_terminal_widget_tab_state_get_type_once (void)
{
	static const GEnumValue values[] = {{TERMINAL_TERMINAL_WIDGET_TAB_STATE_NONE, "TERMINAL_TERMINAL_WIDGET_TAB_STATE_NONE", "none"}, {TERMINAL_TERMINAL_WIDGET_TAB_STATE_WORKING, "TERMINAL_TERMINAL_WIDGET_TAB_STATE_WORKING", "working"}, {TERMINAL_TERMINAL_WIDGET_TAB_STATE_COMPLETED, "TERMINAL_TERMINAL_WIDGET_TAB_STATE_COMPLETED", "completed"}, {TERMINAL_TERMINAL_WIDGET_TAB_STATE_ERROR, "TERMINAL_TERMINAL_WIDGET_TAB_STATE_ERROR", "error"}, {TERMINAL_TERMINAL_WIDGET_TAB_STATE_ATTENTION, "TERMINAL_TERMINAL_WIDGET_TAB_STATE_ATTENTION", "attention"}, {0, NULL, NULL}};
	GType terminal_terminal_widget_tab_state_type_id;
	terminal_terminal_widget_tab_state_type_id = g_enum_register_static ("TerminalTerminalWidgetTabState", values);
	return terminal_terminal_widget_tab_state_type_id;
}

GType
terminal_terminal_widget_tab_state_get_type (void)
{
	static volatile gsize terminal_terminal_widget_tab_state_type_id__once = 0;
	if (g_once_init_enter (&terminal_terminal_widget_tab_state_type_id__once)) {
		GType terminal_terminal_widget_tab_state_type_id;
		terminal_terminal_widget_tab_state_type_id = terminal_terminal_widget_tab_state_get_type_once ();
		g_once_init_leave (&terminal_terminal_widget_tab_state_type_id__once, terminal_terminal_widget_tab_state_type_id);
	}
	return terminal_terminal_widget_tab_state_type_id__once;
}

static void
terminal_terminal_widget_pointer_focus (TerminalTerminalWidget* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	g_object_get ((GtkWidget*) self, "has-focus", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	vte_terminal_set_allow_hyperlink ((VteTerminal*) self, _tmp1_);
}

static void
terminal_terminal_widget_secondary_pressed (TerminalTerminalWidget* self,
                                            GtkGestureSingle* gesture,
                                            gdouble x,
                                            gdouble y)
{
	gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (gesture != NULL);
	if (terminal_terminal_widget_has_foreground_process (self)) {
		gtk_gesture_set_state ((GtkGesture*) gesture, GTK_EVENT_SEQUENCE_DENIED);
		return;
	}
	_tmp0_ = terminal_terminal_widget_get_link (self, x, y);
	_g_free0 (self->priv->link_uri);
	self->priv->link_uri = _tmp0_;
	_tmp1_ = self->priv->link_uri;
	if (_tmp1_ != NULL) {
		GSimpleAction* _tmp2_;
		_tmp2_ = self->priv->copy_action;
		g_simple_action_set_enabled (_tmp2_, TRUE);
	}
	terminal_terminal_widget_popup_context_menu (self, x, y);
	gtk_gesture_set_state ((GtkGesture*) gesture, GTK_EVENT_SEQUENCE_CLAIMED);
	gtk_event_controller_reset ((GtkEventController*) gesture);
}

static gpointer
_gdk_event_ref0 (gpointer self)
{
	return self ? gdk_event_ref (self) : NULL;
}

static void
_vala_GdkEventSequence_free (GdkEventSequence* self)
{
	g_boxed_free (gdk_event_sequence_get_type (), self);
}

static void
terminal_terminal_widget_click_pressed (TerminalTerminalWidget* self,
                                        GtkGestureClick* gesture,
                                        gint n_press,
                                        gdouble x,
                                        gdouble y)
{
	GdkEventSequence* sequence = NULL;
	GdkEventSequence* _tmp0_;
	GdkEvent* event = NULL;
	GdkEventSequence* _tmp1_;
	GdkEvent* _tmp2_;
	GdkEvent* _tmp3_;
	GdkEvent* _tmp4_;
	gboolean control_pressed = FALSE;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_;
	gboolean _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (gesture != NULL);
	_tmp0_ = gtk_gesture_single_get_current_sequence ((GtkGestureSingle*) gesture);
	sequence = _tmp0_;
	_tmp1_ = sequence;
	_tmp2_ = gtk_gesture_get_last_event ((GtkGesture*) gesture, _tmp1_);
	_tmp3_ = _gdk_event_ref0 (_tmp2_);
	event = _tmp3_;
	_tmp4_ = event;
	if (gdk_event_triggers_context_menu (_tmp4_)) {
		terminal_terminal_widget_secondary_pressed (self, (GtkGestureSingle*) gesture, x, y);
		_gdk_event_unref0 (event);
		__vala_GdkEventSequence_free0 (sequence);
		return;
	}
	control_pressed = (gtk_event_controller_get_current_event_state ((GtkEventController*) gesture) & GDK_CONTROL_MASK) == GDK_CONTROL_MASK;
	_g_free0 (self->priv->link_uri);
	self->priv->link_uri = NULL;
	_tmp6_ = vte_terminal_get_allow_hyperlink ((VteTerminal*) self);
	_tmp7_ = _tmp6_;
	if (_tmp7_) {
		_tmp5_ = control_pressed;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		gchar* _tmp8_;
		gboolean _tmp9_ = FALSE;
		const gchar* _tmp10_;
		_tmp8_ = terminal_terminal_widget_get_link (self, x, y);
		_g_free0 (self->priv->link_uri);
		self->priv->link_uri = _tmp8_;
		_tmp10_ = self->priv->link_uri;
		if (_tmp10_ != NULL) {
			_tmp9_ = !vte_terminal_get_has_selection ((VteTerminal*) self);
		} else {
			_tmp9_ = FALSE;
		}
		if (_tmp9_) {
			GSimpleAction* _tmp11_;
			_tmp11_ = self->priv->open_in_browser_action;
			g_signal_emit_by_name (_tmp11_, "activate", NULL);
		}
	} else {
		vte_terminal_set_allow_hyperlink ((VteTerminal*) self, TRUE);
	}
	_gdk_event_unref0 (event);
	__vala_GdkEventSequence_free0 (sequence);
}

static gboolean
terminal_terminal_widget_on_scroll (TerminalTerminalWidget* self,
                                    GtkEventControllerScroll* controller,
                                    gdouble x,
                                    gdouble y)
{
	gboolean control_pressed = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (controller != NULL, FALSE);
	control_pressed = (gtk_event_controller_get_current_event_state ((GtkEventController*) controller) & GDK_CONTROL_MASK) == GDK_CONTROL_MASK;
	if (!control_pressed) {
		result = FALSE;
		return result;
	}
	self->priv->scroll_delta = self->priv->scroll_delta + y;
	if (self->priv->scroll_delta >= 0.5) {
		g_signal_emit_by_name ((VteTerminal*) self, "decrease-font-size");
		self->priv->scroll_delta = 0.0;
	} else {
		if (self->priv->scroll_delta <= (-0.5)) {
			g_signal_emit_by_name ((VteTerminal*) self, "increase-font-size");
			self->priv->scroll_delta = 0.0;
		}
	}
	result = TRUE;
	return result;
}

static guint8*
string_get_data (const gchar* self,
                 gint* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res;
	_tmp2__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static gboolean
__lambda6_ (TerminalTerminalWidget* self,
            guint keyval,
            guint code)
{
	GdkKeymapKey* keys = NULL;
	gint keys_length1 = 0;
	gint _keys_size_ = 0;
	guint* keyvals = NULL;
	gint keyvals_length1 = 0;
	gint _keyvals_size_ = 0;
	GdkDisplay* _tmp0_;
	GdkKeymapKey* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	guint* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	gboolean _tmp5_;
	gboolean result;
	_tmp0_ = gtk_widget_get_display ((GtkWidget*) self);
	_tmp5_ = gdk_display_map_keycode (_tmp0_, code, &_tmp1_, &_tmp3_, &_tmp4_);
	keys = (g_free (keys), NULL);
	keys = _tmp1_;
	keys_length1 = _tmp2_;
	_keys_size_ = keys_length1;
	keyvals = (g_free (keyvals), NULL);
	keyvals = _tmp3_;
	keyvals_length1 = _tmp4_;
	_keyvals_size_ = keyvals_length1;
	if (_tmp5_) {
		guint* _tmp6_;
		gint _tmp6__length1;
		_tmp6_ = keyvals;
		_tmp6__length1 = keyvals_length1;
		{
			guint* kv_collection = NULL;
			gint kv_collection_length1 = 0;
			gint _kv_collection_size_ = 0;
			gint kv_it = 0;
			kv_collection = _tmp6_;
			kv_collection_length1 = _tmp6__length1;
			for (kv_it = 0; kv_it < kv_collection_length1; kv_it = kv_it + 1) {
				guint kv = 0U;
				kv = kv_collection[kv_it];
				{
					if (kv == keyval) {
						result = TRUE;
						keyvals = (g_free (keyvals), NULL);
						keys = (g_free (keys), NULL);
						return result;
					}
				}
			}
		}
	}
	result = FALSE;
	keyvals = (g_free (keyvals), NULL);
	keys = (g_free (keys), NULL);
	return result;
}

static gboolean
___lambda6___localfunc0_ (guint keyval,
                          guint code,
                          gpointer self)
{
	gboolean result;
	result = __lambda6_ ((TerminalTerminalWidget*) self, keyval, code);
	return result;
}

static gboolean
terminal_terminal_widget_on_key_pressed (TerminalTerminalWidget* self,
                                         GtkEventControllerKey* controller,
                                         guint keyval,
                                         guint keycode,
                                         GdkModifierType modifiers)
{
	gboolean control_pressed = FALSE;
	gboolean shift_pressed = FALSE;
	_LocalFunc0_ match_keycode = NULL;
	gpointer match_keycode_target;
	gboolean natural = FALSE;
	GSettings* _tmp21_;
	gboolean _tmp32_ = FALSE;
	gboolean _tmp33_ = FALSE;
	gboolean _tmp35_ = FALSE;
	gboolean _tmp36_ = FALSE;
	gboolean _tmp38_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (controller != NULL, FALSE);
	control_pressed = (modifiers & GDK_CONTROL_MASK) == GDK_CONTROL_MASK;
	shift_pressed = (modifiers & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;
	switch (keyval) {
		case GDK_KEY_Alt_L:
		case GDK_KEY_Alt_R:
		{
			gboolean _tmp0_ = FALSE;
			gboolean _tmp1_;
			GSimpleAction* _tmp6_;
			_tmp1_ = self->priv->_resized;
			if (!_tmp1_) {
				gchar* _tmp2_;
				gchar* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				_tmp2_ = terminal_terminal_widget_get_last_output (self, TRUE);
				_tmp3_ = _tmp2_;
				_tmp4_ = strlen (_tmp3_);
				_tmp5_ = _tmp4_;
				_tmp0_ = _tmp5_ > 0;
				_g_free0 (_tmp3_);
			} else {
				_tmp0_ = FALSE;
			}
			_tmp6_ = self->priv->copy_output_action;
			g_simple_action_set_enabled (_tmp6_, _tmp0_);
			break;
		}
		case GDK_KEY_Return:
		{
			GSimpleAction* _tmp7_;
			GSimpleAction* _tmp8_;
			terminal_terminal_widget_remember_position (self);
			_tmp7_ = self->priv->scroll_to_command_action;
			g_simple_action_set_enabled (_tmp7_, TRUE);
			terminal_terminal_widget_remember_command_end_position (self);
			_tmp8_ = self->priv->copy_output_action;
			g_simple_action_set_enabled (_tmp8_, FALSE);
			break;
		}
		case GDK_KEY_Up:
		case GDK_KEY_Down:
		{
			terminal_terminal_widget_remember_command_start_position (self);
			break;
		}
		case GDK_KEY_Menu:
		{
			glong col = 0L;
			glong row = 0L;
			glong _tmp9_ = 0L;
			glong _tmp10_ = 0L;
			glong cell_width = 0L;
			glong cell_height = 0L;
			gdouble vadj = 0.0;
			GtkAdjustment* _tmp11_;
			GtkAdjustment* _tmp12_;
			gdouble _tmp13_;
			gdouble _tmp14_;
			vte_terminal_get_cursor_position ((VteTerminal*) self, &_tmp9_, &_tmp10_);
			col = _tmp9_;
			row = _tmp10_;
			cell_width = vte_terminal_get_char_width ((VteTerminal*) self);
			cell_height = vte_terminal_get_char_height ((VteTerminal*) self);
			_tmp11_ = gtk_scrollable_get_vadjustment ((GtkScrollable*) self);
			_tmp12_ = _tmp11_;
			_tmp13_ = gtk_adjustment_get_value (_tmp12_);
			_tmp14_ = _tmp13_;
			vadj = _tmp14_;
			terminal_terminal_widget_popup_context_menu (self, (gdouble) (col * cell_width), (row - vadj) * cell_height);
			break;
		}
		case GDK_KEY_plus:
		case GDK_KEY_equal:
		case GDK_KEY_KP_Add:
		{
			if (control_pressed) {
				g_signal_emit_by_name ((VteTerminal*) self, "increase-font-size");
				result = TRUE;
				return result;
			}
			break;
		}
		case GDK_KEY_minus:
		case GDK_KEY_KP_Subtract:
		{
			if (control_pressed) {
				g_signal_emit_by_name ((VteTerminal*) self, "decrease-font-size");
				result = TRUE;
				return result;
			}
			break;
		}
		case GDK_KEY_0:
		case GDK_KEY_KP_0:
		{
			if (control_pressed) {
				terminal_terminal_widget_default_font_size (self);
				result = TRUE;
				return result;
			}
			break;
		}
		case GDK_KEY_BackSpace:
		{
			gboolean _tmp15_ = FALSE;
			if (control_pressed) {
				_tmp15_ = !terminal_terminal_widget_has_foreground_process (self);
			} else {
				_tmp15_ = FALSE;
			}
			if (_tmp15_) {
				guint8* _tmp16_;
				gint _tmp16__length1;
				gint _tmp17_ = 0;
				guint8* _tmp18_;
				gint _tmp18__length1;
				_tmp16_ = string_get_data ("\x1b\x7f", &_tmp17_);
				_tmp16__length1 = _tmp17_;
				_tmp18_ = _tmp16_;
				_tmp18__length1 = _tmp16__length1;
				vte_terminal_feed_child ((VteTerminal*) self, _tmp18_, (gssize) _tmp18__length1);
				result = GDK_EVENT_STOP;
				return result;
			}
			break;
		}
		default:
		{
			gboolean _tmp19_ = FALSE;
			gboolean _tmp20_ = FALSE;
			if (control_pressed) {
				_tmp20_ = TRUE;
			} else {
				_tmp20_ = shift_pressed;
			}
			if (!_tmp20_) {
				_tmp19_ = TRUE;
			} else {
				_tmp19_ = !((modifiers & gtk_accelerator_get_default_mod_mask ()) == gtk_accelerator_get_default_mod_mask ());
			}
			if (_tmp19_) {
				terminal_terminal_widget_remember_command_start_position (self);
			}
			break;
		}
	}
	match_keycode = ___lambda6___localfunc0_;
	match_keycode_target = self;
	_tmp21_ = terminal_application_settings;
	natural = g_settings_get_boolean (_tmp21_, "natural-copy-paste");
	if (control_pressed) {
		_LocalFunc0_ _tmp22_;
		gpointer _tmp22__target;
		_tmp22_ = match_keycode;
		_tmp22__target = match_keycode_target;
		if (_tmp22_ (GDK_KEY_c, keycode, _tmp22__target)) {
			gboolean _tmp23_ = FALSE;
			if (vte_terminal_get_has_selection ((VteTerminal*) self)) {
				gboolean _tmp24_ = FALSE;
				if (natural) {
					_tmp24_ = TRUE;
				} else {
					_tmp24_ = shift_pressed;
				}
				_tmp23_ = _tmp24_;
			} else {
				_tmp23_ = FALSE;
			}
			if (_tmp23_) {
				vte_terminal_copy_clipboard ((VteTerminal*) self);
				result = TRUE;
				return result;
			} else {
				self->priv->last_key_was_return = TRUE;
			}
		} else {
			gboolean _tmp25_ = FALSE;
			gboolean _tmp26_ = FALSE;
			_LocalFunc0_ _tmp27_;
			gpointer _tmp27__target;
			_tmp27_ = match_keycode;
			_tmp27__target = match_keycode_target;
			if (_tmp27_ (GDK_KEY_v, keycode, _tmp27__target)) {
				gboolean _tmp28_ = FALSE;
				if (natural) {
					_tmp28_ = TRUE;
				} else {
					_tmp28_ = shift_pressed;
				}
				_tmp26_ = _tmp28_;
			} else {
				_tmp26_ = FALSE;
			}
			if (_tmp26_) {
				GdkDisplay* _tmp29_;
				GdkClipboard* _tmp30_;
				GdkContentFormats* _tmp31_;
				_tmp29_ = gdk_display_get_default ();
				_tmp30_ = gdk_display_get_clipboard (_tmp29_);
				_tmp31_ = gdk_clipboard_get_formats (_tmp30_);
				_tmp25_ = gdk_content_formats_contain_gtype (_tmp31_, G_TYPE_STRING);
			} else {
				_tmp25_ = FALSE;
			}
			if (_tmp25_) {
				vte_terminal_paste_clipboard ((VteTerminal*) self);
				result = TRUE;
				return result;
			}
		}
	}
	if ((modifiers & GDK_CONTROL_MASK) == GDK_CONTROL_MASK) {
		_tmp33_ = (modifiers & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;
	} else {
		_tmp33_ = FALSE;
	}
	if (_tmp33_) {
		_LocalFunc0_ _tmp34_;
		gpointer _tmp34__target;
		_tmp34_ = match_keycode;
		_tmp34__target = match_keycode_target;
		_tmp32_ = _tmp34_ (GDK_KEY_k, keycode, _tmp34__target);
	} else {
		_tmp32_ = FALSE;
	}
	if (_tmp32_) {
		terminal_terminal_widget_action_reset (self);
		result = TRUE;
		return result;
	}
	if ((modifiers & GDK_CONTROL_MASK) == GDK_CONTROL_MASK) {
		_tmp36_ = (modifiers & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;
	} else {
		_tmp36_ = FALSE;
	}
	if (_tmp36_) {
		_LocalFunc0_ _tmp37_;
		gpointer _tmp37__target;
		_tmp37_ = match_keycode;
		_tmp37__target = match_keycode_target;
		_tmp35_ = _tmp37_ (GDK_KEY_l, keycode, _tmp37__target);
	} else {
		_tmp35_ = FALSE;
	}
	if (_tmp35_) {
		terminal_terminal_widget_action_clear_screen (self);
		result = TRUE;
		return result;
	}
	if ((modifiers & GDK_ALT_MASK) == GDK_ALT_MASK) {
		_tmp38_ = keyval == GDK_KEY_Up;
	} else {
		_tmp38_ = FALSE;
	}
	if (_tmp38_) {
		GSimpleAction* _tmp39_;
		gboolean _tmp40_;
		gboolean _tmp41_;
		_tmp39_ = self->priv->scroll_to_command_action;
		_tmp40_ = g_action_get_enabled ((GAction*) _tmp39_);
		_tmp41_ = _tmp40_;
		result = !_tmp41_;
		return result;
	}
	result = FALSE;
	return result;
}

static void
terminal_terminal_widget_update_actions_state (TerminalTerminalWidget* self)
{
	GAppInfo* appinfo = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	GAppInfo* _tmp2_;
	GAppInfo* _tmp3_;
	GSimpleAction* _tmp4_;
	GAppInfo* _tmp5_;
	GdkClipboard* clipboard = NULL;
	GdkDisplay* _tmp6_;
	GdkClipboard* _tmp7_;
	gboolean _tmp8_ = FALSE;
	GdkClipboard* _tmp9_;
	GdkContentFormats* _tmp10_;
	GdkContentFormats* _tmp11_;
	gboolean clipboard_has_string = FALSE;
	GSimpleAction* _tmp15_;
	gboolean _tmp16_ = FALSE;
	gboolean _tmp17_;
	gboolean has_output = FALSE;
	GSimpleAction* _tmp22_;
	g_return_if_fail (self != NULL);
	_tmp0_ = terminal_terminal_widget_get_current_selection_link_or_pwd (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = terminal_utils_get_default_app_for_uri (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	appinfo = _tmp3_;
	_tmp4_ = self->priv->open_in_browser_action;
	_tmp5_ = appinfo;
	g_simple_action_set_enabled (_tmp4_, _tmp5_ != NULL);
	_tmp6_ = gdk_display_get_default ();
	_tmp7_ = gdk_display_get_clipboard (_tmp6_);
	clipboard = _tmp7_;
	_tmp9_ = clipboard;
	_tmp10_ = gdk_clipboard_get_formats (_tmp9_);
	_tmp11_ = _tmp10_;
	if (_tmp11_ != NULL) {
		GdkClipboard* _tmp12_;
		GdkContentFormats* _tmp13_;
		GdkContentFormats* _tmp14_;
		_tmp12_ = clipboard;
		_tmp13_ = gdk_clipboard_get_formats (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp8_ = gdk_content_formats_contain_gtype (_tmp14_, G_TYPE_STRING);
	} else {
		_tmp8_ = FALSE;
	}
	clipboard_has_string = _tmp8_;
	_tmp15_ = self->priv->paste_action;
	g_simple_action_set_enabled (_tmp15_, clipboard_has_string);
	_tmp17_ = self->priv->_resized;
	if (!_tmp17_) {
		gchar* _tmp18_;
		gchar* _tmp19_;
		gint _tmp20_;
		gint _tmp21_;
		_tmp18_ = terminal_terminal_widget_get_last_output (self, TRUE);
		_tmp19_ = _tmp18_;
		_tmp20_ = strlen (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp16_ = _tmp21_ > 0;
		_g_free0 (_tmp19_);
	} else {
		_tmp16_ = FALSE;
	}
	has_output = _tmp16_;
	_tmp22_ = self->priv->copy_output_action;
	g_simple_action_set_enabled (_tmp22_, has_output);
	_g_object_unref0 (appinfo);
}

static GMenu*
terminal_terminal_widget_construct_context_menu_model (TerminalTerminalWidget* self)
{
	gchar* show_in_browser_uri = NULL;
	gchar* _tmp0_;
	GAppInfo* appinfo = NULL;
	const gchar* _tmp1_;
	GAppInfo* _tmp2_;
	const gchar* _tmp3_ = NULL;
	GAppInfo* _tmp4_;
	GMenuItem* open_in_browser_menuitem = NULL;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GMenuItem* _tmp9_;
	GMenuItem* _tmp10_;
	const gchar* _tmp11_;
	GVariant* _tmp12_;
	GVariant* _tmp13_;
	GMenuItem* copy_menuitem = NULL;
	GMenuItem* _tmp14_;
	const gchar* _tmp15_;
	GVariant* _tmp16_;
	GVariant* _tmp17_;
	GMenuItem* copy_last_output_menuitem = NULL;
	GMenuItem* _tmp18_;
	const gchar* _tmp19_;
	GVariant* _tmp20_;
	GVariant* _tmp21_;
	GMenuItem* clear_screen_menuitem = NULL;
	GMenuItem* _tmp22_;
	const gchar* _tmp23_;
	GVariant* _tmp24_;
	GVariant* _tmp25_;
	GMenuItem* reset_menuitem = NULL;
	GMenuItem* _tmp26_;
	const gchar* _tmp27_;
	GVariant* _tmp28_;
	GVariant* _tmp29_;
	GMenuItem* paste_menuitem = NULL;
	GMenuItem* _tmp30_;
	const gchar* _tmp31_;
	GVariant* _tmp32_;
	GVariant* _tmp33_;
	GMenuItem* select_all_menuitem = NULL;
	GMenuItem* _tmp34_;
	const gchar* _tmp35_;
	GVariant* _tmp36_;
	GVariant* _tmp37_;
	GMenu* terminal_action_section = NULL;
	GMenu* _tmp38_;
	GMenu* terminal_clear_reset_section = NULL;
	GMenu* _tmp39_;
	GMenu* context_menu_model = NULL;
	GMenu* _tmp40_;
	GMenu* result;
	g_return_val_if_fail (self != NULL, NULL);
	terminal_terminal_widget_update_actions_state (self);
	_tmp0_ = terminal_terminal_widget_get_current_selection_link_or_pwd (self);
	show_in_browser_uri = _tmp0_;
	_tmp1_ = show_in_browser_uri;
	_tmp2_ = terminal_utils_get_default_app_for_uri (_tmp1_);
	appinfo = _tmp2_;
	_tmp4_ = appinfo;
	if (_tmp4_ != NULL) {
		GAppInfo* _tmp5_;
		const gchar* _tmp6_;
		_tmp5_ = appinfo;
		_tmp6_ = g_app_info_get_display_name (_tmp5_);
		_tmp3_ = _tmp6_;
	} else {
		_tmp3_ = _ ("Default application");
	}
	_tmp7_ = g_strdup_printf (_ ("Show in %s"), _tmp3_);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_menu_item_new (_tmp8_, TERMINAL_TERMINAL_WIDGET_ACTION_OPEN_IN_BROWSER);
	_tmp10_ = _tmp9_;
	_g_free0 (_tmp8_);
	open_in_browser_menuitem = _tmp10_;
	_tmp11_ = TERMINAL_TERMINAL_WIDGET_ACCELS_OPEN_IN_BROWSER[0];
	_tmp12_ = g_variant_new ("s", _tmp11_, NULL);
	g_variant_ref_sink (_tmp12_);
	_tmp13_ = _tmp12_;
	g_menu_item_set_attribute_value (open_in_browser_menuitem, "accel", _tmp13_);
	_g_variant_unref0 (_tmp13_);
	_tmp14_ = g_menu_item_new (_ ("Copy"), TERMINAL_TERMINAL_WIDGET_ACTION_COPY);
	copy_menuitem = _tmp14_;
	_tmp15_ = TERMINAL_TERMINAL_WIDGET_ACCELS_COPY[0];
	_tmp16_ = g_variant_new ("s", _tmp15_, NULL);
	g_variant_ref_sink (_tmp16_);
	_tmp17_ = _tmp16_;
	g_menu_item_set_attribute_value (copy_menuitem, "accel", _tmp17_);
	_g_variant_unref0 (_tmp17_);
	_tmp18_ = g_menu_item_new (_ ("Copy Last Output"), TERMINAL_TERMINAL_WIDGET_ACTION_COPY_OUTPUT);
	copy_last_output_menuitem = _tmp18_;
	_tmp19_ = TERMINAL_TERMINAL_WIDGET_ACCELS_COPY_OUTPUT[0];
	_tmp20_ = g_variant_new ("s", _tmp19_, NULL);
	g_variant_ref_sink (_tmp20_);
	_tmp21_ = _tmp20_;
	g_menu_item_set_attribute_value (copy_last_output_menuitem, "accel", _tmp21_);
	_g_variant_unref0 (_tmp21_);
	_tmp22_ = g_menu_item_new (_ ("Clear Screen"), TERMINAL_TERMINAL_WIDGET_ACTION_CLEAR_SCREEN);
	clear_screen_menuitem = _tmp22_;
	_tmp23_ = TERMINAL_TERMINAL_WIDGET_ACCELS_CLEAR_SCREEN[0];
	_tmp24_ = g_variant_new ("s", _tmp23_, NULL);
	g_variant_ref_sink (_tmp24_);
	_tmp25_ = _tmp24_;
	g_menu_item_set_attribute_value (clear_screen_menuitem, "accel", _tmp25_);
	_g_variant_unref0 (_tmp25_);
	_tmp26_ = g_menu_item_new (_ ("Reset"), TERMINAL_TERMINAL_WIDGET_ACTION_RESET);
	reset_menuitem = _tmp26_;
	_tmp27_ = TERMINAL_TERMINAL_WIDGET_ACCELS_RESET[0];
	_tmp28_ = g_variant_new ("s", _tmp27_, NULL);
	g_variant_ref_sink (_tmp28_);
	_tmp29_ = _tmp28_;
	g_menu_item_set_attribute_value (reset_menuitem, "accel", _tmp29_);
	_g_variant_unref0 (_tmp29_);
	_tmp30_ = g_menu_item_new (_ ("Paste"), TERMINAL_TERMINAL_WIDGET_ACTION_PASTE);
	paste_menuitem = _tmp30_;
	_tmp31_ = TERMINAL_TERMINAL_WIDGET_ACCELS_PASTE[0];
	_tmp32_ = g_variant_new ("s", _tmp31_, NULL);
	g_variant_ref_sink (_tmp32_);
	_tmp33_ = _tmp32_;
	g_menu_item_set_attribute_value (paste_menuitem, "accel", _tmp33_);
	_g_variant_unref0 (_tmp33_);
	_tmp34_ = g_menu_item_new (_ ("Select All"), TERMINAL_TERMINAL_WIDGET_ACTION_SELECT_ALL);
	select_all_menuitem = _tmp34_;
	_tmp35_ = TERMINAL_TERMINAL_WIDGET_ACCELS_SELECT_ALL[0];
	_tmp36_ = g_variant_new ("s", _tmp35_, NULL);
	g_variant_ref_sink (_tmp36_);
	_tmp37_ = _tmp36_;
	g_menu_item_set_attribute_value (select_all_menuitem, "accel", _tmp37_);
	_g_variant_unref0 (_tmp37_);
	_tmp38_ = g_menu_new ();
	terminal_action_section = _tmp38_;
	g_menu_append_item (terminal_action_section, copy_menuitem);
	g_menu_append_item (terminal_action_section, copy_last_output_menuitem);
	g_menu_append_item (terminal_action_section, paste_menuitem);
	g_menu_append_item (terminal_action_section, select_all_menuitem);
	_tmp39_ = g_menu_new ();
	terminal_clear_reset_section = _tmp39_;
	g_menu_append_item (terminal_clear_reset_section, clear_screen_menuitem);
	g_menu_append_item (terminal_clear_reset_section, reset_menuitem);
	_tmp40_ = g_menu_new ();
	context_menu_model = _tmp40_;
	g_menu_append_item (context_menu_model, open_in_browser_menuitem);
	g_menu_append_section (context_menu_model, NULL, (GMenuModel*) terminal_action_section);
	g_menu_append_section (context_menu_model, NULL, (GMenuModel*) terminal_clear_reset_section);
	result = context_menu_model;
	_g_object_unref0 (terminal_clear_reset_section);
	_g_object_unref0 (terminal_action_section);
	_g_object_unref0 (select_all_menuitem);
	_g_object_unref0 (paste_menuitem);
	_g_object_unref0 (reset_menuitem);
	_g_object_unref0 (clear_screen_menuitem);
	_g_object_unref0 (copy_last_output_menuitem);
	_g_object_unref0 (copy_menuitem);
	_g_object_unref0 (open_in_browser_menuitem);
	_g_object_unref0 (appinfo);
	_g_free0 (show_in_browser_uri);
	return result;
}

static Block4Data*
block4_data_ref (Block4Data* _data4_)
{
	g_atomic_int_inc (&_data4_->_ref_count_);
	return _data4_;
}

static void
block4_data_unref (void * _userdata_)
{
	Block4Data* _data4_;
	_data4_ = (Block4Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
		TerminalTerminalWidget* self;
		self = _data4_->self;
		_g_object_unref0 (_data4_->new_context_menu);
		_g_object_unref0 (self);
		g_slice_free (Block4Data, _data4_);
	}
}

static void
__lambda5_ (Block4Data* _data4_)
{
	TerminalTerminalWidget* self;
	self = _data4_->self;
	g_signal_emit_by_name ((GtkWidget*) _data4_->new_context_menu, "destroy");
}

static void
___lambda5__gtk_popover_closed (GtkPopover* _sender,
                                gpointer self)
{
	__lambda5_ (self);
}

static void
terminal_terminal_widget_popup_context_menu (TerminalTerminalWidget* self,
                                             gdouble x,
                                             gdouble y)
{
	Block4Data* _data4_;
	GMenu* context_menu_model = NULL;
	GMenu* _tmp0_;
	GdkRectangle _tmp1_ = {0};
	GtkPopoverMenu* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	_data4_ = g_slice_new0 (Block4Data);
	_data4_->_ref_count_ = 1;
	_data4_->self = g_object_ref (self);
	_tmp0_ = terminal_terminal_widget_construct_context_menu_model (self);
	context_menu_model = _tmp0_;
	_tmp1_.x = (gint) x;
	_tmp1_.y = (gint) y;
	_tmp1_.width = 1;
	_tmp1_.height = 1;
	_tmp2_ = (GtkPopoverMenu*) gtk_popover_menu_new_from_model ((GMenuModel*) context_menu_model);
	gtk_popover_set_has_arrow ((GtkPopover*) _tmp2_, FALSE);
	g_object_set ((GtkPopover*) _tmp2_, "pointing-to", &_tmp1_, NULL);
	g_object_ref_sink (_tmp2_);
	_data4_->new_context_menu = _tmp2_;
	gtk_widget_set_parent ((GtkWidget*) _data4_->new_context_menu, (GtkWidget*) self);
	g_signal_connect_data ((GtkPopover*) _data4_->new_context_menu, "closed", (GCallback) ___lambda5__gtk_popover_closed, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0);
	gtk_popover_popup ((GtkPopover*) _data4_->new_context_menu);
	_g_object_unref0 (context_menu_model);
	block4_data_unref (_data4_);
	_data4_ = NULL;
}

static void
terminal_terminal_widget_real_copy_clipboard (VteTerminal* base)
{
	TerminalTerminalWidget * self;
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	self = (TerminalTerminalWidget*) base;
	_tmp1_ = self->priv->link_uri;
	if (_tmp1_ != NULL) {
		_tmp0_ = !vte_terminal_get_has_selection ((VteTerminal*) self);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GdkDisplay* _tmp2_;
		GdkClipboard* _tmp3_;
		const gchar* _tmp4_;
		_tmp2_ = gdk_display_get_default ();
		_tmp3_ = gdk_display_get_clipboard (_tmp2_);
		_tmp4_ = self->priv->link_uri;
		gdk_clipboard_set_text (_tmp3_, _tmp4_);
	} else {
		VTE_TERMINAL_CLASS (terminal_terminal_widget_parent_class)->copy_clipboard (G_TYPE_CHECK_INSTANCE_CAST (self, vte_terminal_get_type (), VteTerminal));
	}
}

static void
terminal_terminal_widget_copy_output (TerminalTerminalWidget* self)
{
	GdkDisplay* _tmp0_;
	GdkClipboard* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = gdk_display_get_clipboard (_tmp0_);
	_tmp2_ = terminal_terminal_widget_get_last_output (self, TRUE);
	_tmp3_ = _tmp2_;
	gdk_clipboard_set_text (_tmp1_, _tmp3_);
	_g_free0 (_tmp3_);
}

static Block5Data*
block5_data_ref (Block5Data* _data5_)
{
	g_atomic_int_inc (&_data5_->_ref_count_);
	return _data5_;
}

static void
block5_data_unref (void * _userdata_)
{
	Block5Data* _data5_;
	_data5_ = (Block5Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
		TerminalTerminalWidget* self;
		self = _data5_->self;
		_g_object_unref0 (self);
		g_slice_free (Block5Data, _data5_);
	}
}

static Block6Data*
block6_data_ref (Block6Data* _data6_)
{
	g_atomic_int_inc (&_data6_->_ref_count_);
	return _data6_;
}

static void
block6_data_unref (void * _userdata_)
{
	Block6Data* _data6_;
	_data6_ = (Block6Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
		TerminalTerminalWidget* self;
		self = _data6_->_data5_->self;
		_g_object_unref0 (_data6_->dialog);
		block5_data_unref (_data6_->_data5_);
		_data6_->_data5_ = NULL;
		g_slice_free (Block6Data, _data6_);
	}
}

static void
___lambda20_ (Block6Data* _data6_,
              gint res)
{
	Block5Data* _data5_;
	TerminalTerminalWidget* self;
	TerminalForegroundProcessDialog* _tmp0_;
	_data5_ = _data6_->_data5_;
	self = _data5_->self;
	_tmp0_ = _data6_->dialog;
	gtk_window_destroy ((GtkWindow*) _tmp0_);
	_data5_->cb (res == ((gint) GTK_RESPONSE_ACCEPT), _data5_->cb_target);
}

static void
____lambda20__gtk_dialog_response (GtkDialog* _sender,
                                   gint response_id,
                                   gpointer self)
{
	___lambda20_ (self, response_id);
}

void
terminal_terminal_widget_confirm_kill_fg_process (TerminalTerminalWidget* self,
                                                  const gchar* primary_text,
                                                  const gchar* button_label,
                                                  TerminalTerminalWidgetConfirmedActionCallback cb,
                                                  gpointer cb_target)
{
	Block5Data* _data5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (primary_text != NULL);
	g_return_if_fail (button_label != NULL);
	_data5_ = g_slice_new0 (Block5Data);
	_data5_->_ref_count_ = 1;
	_data5_->self = g_object_ref (self);
	_data5_->cb = cb;
	_data5_->cb_target = cb_target;
	if (terminal_terminal_widget_has_foreground_process (self)) {
		Block6Data* _data6_;
		GtkRoot* _tmp0_;
		TerminalForegroundProcessDialog* _tmp1_;
		TerminalForegroundProcessDialog* _tmp2_;
		TerminalForegroundProcessDialog* _tmp3_;
		_data6_ = g_slice_new0 (Block6Data);
		_data6_->_ref_count_ = 1;
		_data6_->_data5_ = block5_data_ref (_data5_);
		_tmp0_ = gtk_widget_get_root ((GtkWidget*) self);
		_tmp1_ = terminal_foreground_process_dialog_new (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TERMINAL_TYPE_MAIN_WINDOW, TerminalMainWindow), primary_text, button_label);
		g_object_ref_sink (_tmp1_);
		_data6_->dialog = _tmp1_;
		_tmp2_ = _data6_->dialog;
		g_signal_connect_data ((GtkDialog*) _tmp2_, "response", (GCallback) ____lambda20__gtk_dialog_response, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
		_tmp3_ = _data6_->dialog;
		gtk_window_present ((GtkWindow*) _tmp3_);
		block6_data_unref (_data6_);
		_data6_ = NULL;
	} else {
		_data5_->cb (TRUE, _data5_->cb_target);
	}
	block5_data_unref (_data5_);
	_data5_ = NULL;
}

static void
terminal_terminal_widget_action_clear_screen (TerminalTerminalWidget* self)
{
	g_return_if_fail (self != NULL);
	if (terminal_terminal_widget_has_foreground_process (self)) {
		return;
	}
	terminal_terminal_widget_feed_command (self, "clear -x\n");
}

static void
__lambda41_ (TerminalTerminalWidget* self,
             gboolean confirmed)
{
	if (confirmed) {
		terminal_terminal_widget_feed_command (self, "reset\n");
	}
}

static void
___lambda41__terminal_terminal_widget_confirmed_action_callback (gboolean confirmed,
                                                                 gpointer self)
{
	__lambda41_ ((TerminalTerminalWidget*) self, confirmed);
}

static void
terminal_terminal_widget_action_reset (TerminalTerminalWidget* self)
{
	g_return_if_fail (self != NULL);
	terminal_terminal_widget_confirm_kill_fg_process (self, _ ("Are you sure you want to reset the terminal?"), _ ("Reset"), ___lambda41__terminal_terminal_widget_confirmed_action_callback, self);
}

static Block7Data*
block7_data_ref (Block7Data* _data7_)
{
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}

static void
block7_data_unref (void * _userdata_)
{
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		TerminalTerminalWidget* self;
		self = _data7_->self;
		_g_free0 (_data7_->command);
		_g_object_unref0 (self);
		g_slice_free (Block7Data, _data7_);
	}
}

static gboolean
__lambda22_ (Block7Data* _data7_)
{
	TerminalTerminalWidget* self;
	guint8* _tmp0_;
	gint _tmp0__length1;
	gint _tmp1_ = 0;
	guint8* _tmp2_;
	gint _tmp2__length1;
	gboolean result;
	self = _data7_->self;
	_tmp0_ = string_get_data (_data7_->command, &_tmp1_);
	_tmp0__length1 = _tmp1_;
	_tmp2_ = _tmp0_;
	_tmp2__length1 = _tmp0__length1;
	vte_terminal_feed_child ((VteTerminal*) self, _tmp2_, (gssize) _tmp2__length1);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda22__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda22_ (self);
	return result;
}

static void
terminal_terminal_widget_feed_command (TerminalTerminalWidget* self,
                                       const gchar* command)
{
	Block7Data* _data7_;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (command != NULL);
	_data7_ = g_slice_new0 (Block7Data);
	_data7_->_ref_count_ = 1;
	_data7_->self = g_object_ref (self);
	_tmp0_ = g_strdup (command);
	_g_free0 (_data7_->command);
	_data7_->command = _tmp0_;
	kill ((pid_t) self->priv->child_pid, (gint) SIGINT);
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 10, ___lambda22__gsource_func, block7_data_ref (_data7_), block7_data_unref);
	block7_data_unref (_data7_);
	_data7_ = NULL;
}

void
terminal_terminal_widget_change_directory (TerminalTerminalWidget* self,
                                           const gchar* path)
{
	gchar* command = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	if (terminal_terminal_widget_has_foreground_process (self)) {
		return;
	}
	_tmp0_ = g_strdup_printf ("cd '%s';clear\n", path);
	command = _tmp0_;
	_tmp1_ = command;
	terminal_terminal_widget_feed_command (self, _tmp1_);
	_g_free0 (command);
}

static void
__lambda21_ (TerminalTerminalWidget* self,
             gboolean confirmed)
{
	if (confirmed) {
		gchar* command = NULL;
		const gchar* _tmp0_;
		gchar* _tmp1_;
		const gchar* _tmp2_;
		_tmp0_ = self->priv->old_loc;
		_tmp1_ = g_strdup_printf ("reset;cd '%s';clear\n", _tmp0_);
		command = _tmp1_;
		_tmp2_ = command;
		terminal_terminal_widget_feed_command (self, _tmp2_);
		_g_free0 (command);
	}
}

static void
___lambda21__terminal_terminal_widget_confirmed_action_callback (gboolean confirmed,
                                                                 gpointer self)
{
	__lambda21_ ((TerminalTerminalWidget*) self, confirmed);
}

void
terminal_terminal_widget_reload (TerminalTerminalWidget* self)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = terminal_terminal_widget_get_shell_location (self);
	_g_free0 (self->priv->old_loc);
	self->priv->old_loc = _tmp0_;
	terminal_terminal_widget_confirm_kill_fg_process (self, _ ("Are you sure you want to reload this tab?"), _ ("Reload"), ___lambda21__terminal_terminal_widget_confirmed_action_callback, self);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
___lambda40_ (TerminalTerminalWidget* self,
              GObject* obj,
              GAsyncResult* res)
{
	GdkClipboard* _clipboard = NULL;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	_clipboard = G_TYPE_CHECK_INSTANCE_CAST (obj, gdk_clipboard_get_type (), GdkClipboard);
	{
		gchar* text = NULL;
		gchar* _tmp0_;
		_tmp0_ = gdk_clipboard_read_text_finish (_clipboard, res, &_inner_error0_);
		text = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		terminal_terminal_widget_validated_paste (self, text);
		_g_free0 (text);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp1_;
		const gchar* _tmp2_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = e;
		_tmp2_ = _tmp1_->message;
		g_warning ("TerminalWidget.vala:707: Error reading text from clipboard - %s", _tmp2_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
____lambda40__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	___lambda40_ ((TerminalTerminalWidget*) self, source_object, res);
	g_object_unref (self);
}

static void
terminal_terminal_widget_real_paste_clipboard (VteTerminal* base)
{
	TerminalTerminalWidget * self;
	GdkClipboard* clipboard = NULL;
	GdkDisplay* _tmp0_;
	GdkClipboard* _tmp1_;
	GdkContentProvider* content_provider = NULL;
	GdkClipboard* _tmp2_;
	GdkContentProvider* _tmp3_;
	GdkContentProvider* _tmp4_;
	GdkContentProvider* _tmp5_;
	GError* _inner_error0_ = NULL;
	self = (TerminalTerminalWidget*) base;
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = gdk_display_get_clipboard (_tmp0_);
	clipboard = _tmp1_;
	_tmp2_ = clipboard;
	_tmp3_ = gdk_clipboard_get_content (_tmp2_);
	_tmp4_ = _g_object_ref0 (_tmp3_);
	content_provider = _tmp4_;
	_tmp5_ = content_provider;
	if (_tmp5_ != NULL) {
		{
			GValue val = {0};
			GValue _tmp6_ = {0};
			GdkContentProvider* _tmp7_;
			gchar* text = NULL;
			gchar* _tmp8_;
			const gchar* _tmp9_;
			g_value_init (&_tmp6_, G_TYPE_STRING);
			val = _tmp6_;
			_tmp7_ = content_provider;
			gdk_content_provider_get_value (_tmp7_, &val, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
				goto __catch0_g_error;
			}
			_tmp8_ = g_value_dup_string (&val);
			text = _tmp8_;
			_tmp9_ = text;
			terminal_terminal_widget_validated_paste (self, _tmp9_);
			_g_free0 (text);
			G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* e = NULL;
			GError* _tmp10_;
			const gchar* _tmp11_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp10_ = e;
			_tmp11_ = _tmp10_->message;
			g_warning ("TerminalWidget.vala:696: Error getting clipboard content - %s", _tmp11_);
			_g_error_free0 (e);
			_g_object_unref0 (content_provider);
			return;
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (content_provider);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	} else {
		GdkClipboard* _tmp12_;
		_tmp12_ = clipboard;
		gdk_clipboard_read_text_async (_tmp12_, NULL, ____lambda40__gasync_ready_callback, g_object_ref (self));
	}
	_g_object_unref0 (content_provider);
}

static Block8Data*
block8_data_ref (Block8Data* _data8_)
{
	g_atomic_int_inc (&_data8_->_ref_count_);
	return _data8_;
}

static void
block8_data_unref (void * _userdata_)
{
	Block8Data* _data8_;
	_data8_ = (Block8Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		TerminalTerminalWidget* self;
		self = _data8_->self;
		_g_object_unref0 (_data8_->dialog);
		_g_free0 (_data8_->text);
		_g_object_unref0 (self);
		g_slice_free (Block8Data, _data8_);
	}
}

static gchar*
_vala_g_strjoinv (const gchar* separator,
                  gchar** str_array,
                  gint str_array_length1)
{
	gboolean _tmp0_ = FALSE;
	gchar* result;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp16_;
		gint _tmp17_;
		const gchar* res = NULL;
		void* _tmp18_;
		const gchar* _tmp19_ = NULL;
		const gchar* _tmp20_;
		void* ptr = NULL;
		const gchar* _tmp22_;
		void* _tmp23_;
		const gchar* _tmp33_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					_tmp7_ = i < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp8_ = FALSE;
					if (str_array_length1 == -1) {
						const gchar* _tmp9_;
						_tmp9_ = str_array[i];
						_tmp8_ = _tmp9_ != NULL;
					} else {
						_tmp8_ = FALSE;
					}
					_tmp6_ = _tmp8_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp11_ = str_array[i];
				if (_tmp11_ != NULL) {
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = str_array[i];
					_tmp13_ = strlen ((const gchar*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp10_ = _tmp14_;
				} else {
					_tmp10_ = 0;
				}
				len += (gsize) _tmp10_;
			}
		}
		if (i == 0) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("");
			result = _tmp15_;
			return result;
		}
		str_array_length1 = i;
		_tmp16_ = strlen ((const gchar*) separator);
		_tmp17_ = _tmp16_;
		len += (gsize) (_tmp17_ * (i - 1));
		_tmp18_ = g_malloc (len);
		res = _tmp18_;
		_tmp20_ = str_array[0];
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = str_array[0];
			_tmp19_ = (const gchar*) _tmp21_;
		} else {
			_tmp19_ = "";
		}
		_tmp22_ = res;
		_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_);
		ptr = _tmp23_;
		{
			gboolean _tmp24_ = FALSE;
			i = 1;
			_tmp24_ = TRUE;
			while (TRUE) {
				void* _tmp26_;
				void* _tmp27_;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				void* _tmp31_;
				void* _tmp32_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				if (!(i < str_array_length1)) {
					break;
				}
				_tmp26_ = ptr;
				_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator);
				ptr = _tmp27_;
				_tmp29_ = str_array[i];
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_;
					_tmp30_ = str_array[i];
					_tmp28_ = (const gchar*) _tmp30_;
				} else {
					_tmp28_ = "";
				}
				_tmp31_ = ptr;
				_tmp32_ = g_stpcpy (_tmp31_, _tmp28_);
				ptr = _tmp32_;
			}
		}
		_tmp33_ = res;
		res = NULL;
		result = (gchar*) _tmp33_;
		return result;
	} else {
		gchar* _tmp34_;
		_tmp34_ = g_strdup ("");
		result = _tmp34_;
		return result;
	}
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static void
__lambda39_ (Block8Data* _data8_,
             gint res)
{
	TerminalTerminalWidget* self;
	TerminalUnsafePasteDialog* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->dialog;
	gtk_window_destroy ((GtkWindow*) _tmp0_);
	if (res == ((gint) GTK_RESPONSE_ACCEPT)) {
		vte_terminal_paste_text ((VteTerminal*) self, _data8_->text);
	}
}

static void
___lambda39__gtk_dialog_response (GtkDialog* _sender,
                                  gint response_id,
                                  gpointer self)
{
	__lambda39_ (self, response_id);
}

static void
terminal_terminal_widget_validated_paste (TerminalTerminalWidget* self,
                                          const gchar* text)
{
	Block8Data* _data8_;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	GSettings* _tmp2_;
	gchar** warn_text_array = NULL;
	gint warn_text_array_length1 = 0;
	gint _warn_text_array_size_ = 0;
	gchar** _tmp3_ = NULL;
	gint _tmp4_ = 0;
	gboolean _tmp5_;
	TerminalMainWindow* toplevel = NULL;
	GtkRoot* _tmp6_;
	gchar* warn_text = NULL;
	gchar** _tmp7_;
	gint _tmp7__length1;
	gchar* _tmp8_;
	TerminalMainWindow* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	TerminalUnsafePasteDialog* _tmp13_;
	TerminalUnsafePasteDialog* _tmp14_;
	TerminalUnsafePasteDialog* _tmp15_;
	TerminalUnsafePasteDialog* _tmp16_;
	g_return_if_fail (self != NULL);
	_data8_ = g_slice_new0 (Block8Data);
	_data8_->_ref_count_ = 1;
	_data8_->self = g_object_ref (self);
	_tmp0_ = g_strdup (text);
	_g_free0 (_data8_->text);
	_data8_->text = _tmp0_;
	if (_data8_->text == NULL) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = !g_utf8_validate (_data8_->text, (gssize) -1, NULL);
	}
	if (_tmp1_) {
		block8_data_unref (_data8_);
		_data8_ = NULL;
		return;
	}
	_tmp2_ = terminal_application_settings;
	if (!g_settings_get_boolean (_tmp2_, "unsafe-paste-alert")) {
		vte_terminal_paste_text ((VteTerminal*) self, _data8_->text);
		block8_data_unref (_data8_);
		_data8_ = NULL;
		return;
	}
	_tmp5_ = terminal_utils_is_safe_paste (_data8_->text, &_tmp3_, &_tmp4_);
	warn_text_array = (_vala_array_free (warn_text_array, warn_text_array_length1, (GDestroyNotify) g_free), NULL);
	warn_text_array = _tmp3_;
	warn_text_array_length1 = _tmp4_;
	_warn_text_array_size_ = warn_text_array_length1;
	if (_tmp5_) {
		vte_terminal_paste_text ((VteTerminal*) self, _data8_->text);
		warn_text_array = (_vala_array_free (warn_text_array, warn_text_array_length1, (GDestroyNotify) g_free), NULL);
		block8_data_unref (_data8_);
		_data8_ = NULL;
		return;
	}
	_tmp6_ = gtk_widget_get_root ((GtkWidget*) self);
	toplevel = G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, TERMINAL_TYPE_MAIN_WINDOW, TerminalMainWindow);
	_tmp7_ = warn_text_array;
	_tmp7__length1 = warn_text_array_length1;
	_tmp8_ = _vala_g_strjoinv ("\n\n", _tmp7_, (gint) _tmp7__length1);
	warn_text = _tmp8_;
	_tmp9_ = toplevel;
	_tmp10_ = warn_text;
	_tmp11_ = string_strip (_data8_->text);
	_tmp12_ = _tmp11_;
	_tmp13_ = terminal_unsafe_paste_dialog_new (_tmp9_, _tmp10_, _tmp12_);
	g_object_ref_sink (_tmp13_);
	_tmp14_ = _tmp13_;
	_g_free0 (_tmp12_);
	_data8_->dialog = _tmp14_;
	_tmp15_ = _data8_->dialog;
	g_signal_connect_data ((GtkDialog*) _tmp15_, "response", (GCallback) ___lambda39__gtk_dialog_response, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	_tmp16_ = _data8_->dialog;
	gtk_window_present ((GtkWindow*) _tmp16_);
	_g_free0 (warn_text);
	warn_text_array = (_vala_array_free (warn_text_array, warn_text_array_length1, (GDestroyNotify) g_free), NULL);
	block8_data_unref (_data8_);
	_data8_ = NULL;
}

static void
terminal_terminal_widget_update_current_working_directory (TerminalTerminalWidget* self,
                                                           const gchar* cwd)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (cwd != NULL);
	terminal_terminal_widget_set_current_working_directory (self, cwd);
	g_signal_emit (self, terminal_terminal_widget_signals[TERMINAL_TERMINAL_WIDGET_CWD_CHANGED_SIGNAL], 0);
}

static GdkRGBA*
_vala_array_dup1 (GdkRGBA* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (GdkRGBA));
	}
	return NULL;
}

static void
terminal_terminal_widget_update_theme (TerminalTerminalWidget* self)
{
	GtkSettings* gtk_settings = NULL;
	GtkSettings* _tmp0_;
	GtkSettings* _tmp1_;
	GdkRGBA* theme_palette = NULL;
	GdkRGBA* _tmp2_;
	gint theme_palette_length1;
	gint _theme_palette_size_;
	GSettings* _tmp3_;
	GdkRGBA background = {0};
	GdkRGBA* _tmp19_;
	gint _tmp19__length1;
	GdkRGBA _tmp20_;
	GdkRGBA foreground = {0};
	GdkRGBA* _tmp21_;
	gint _tmp21__length1;
	GdkRGBA _tmp22_;
	GdkRGBA cursor = {0};
	GdkRGBA* _tmp23_;
	gint _tmp23__length1;
	GdkRGBA _tmp24_;
	GdkRGBA* palette = NULL;
	GdkRGBA* _tmp25_;
	gint _tmp25__length1;
	GdkRGBA* _tmp26_;
	gint _tmp26__length1;
	gint palette_length1;
	gint _palette_size_;
	GdkRGBA _tmp27_;
	GdkRGBA _tmp28_;
	GdkRGBA _tmp29_;
	GdkRGBA _tmp30_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_settings_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	gtk_settings = _tmp1_;
	_tmp2_ = g_new0 (GdkRGBA, TERMINAL_THEMES_PALETTE_SIZE);
	theme_palette = _tmp2_;
	theme_palette_length1 = TERMINAL_THEMES_PALETTE_SIZE;
	_theme_palette_size_ = theme_palette_length1;
	_tmp3_ = terminal_application_settings;
	if (g_settings_get_boolean (_tmp3_, "follow-system-style")) {
		gboolean system_prefers_dark = FALSE;
		GraniteSettings* _tmp4_;
		GraniteSettingsColorScheme _tmp5_;
		GraniteSettingsColorScheme _tmp6_;
		GtkSettings* _tmp7_;
		_tmp4_ = granite_settings_get_default ();
		_tmp5_ = granite_settings_get_prefers_color_scheme (_tmp4_);
		_tmp6_ = _tmp5_;
		system_prefers_dark = _tmp6_ == GRANITE_SETTINGS_COLOR_SCHEME_DARK;
		_tmp7_ = gtk_settings;
		g_object_set (_tmp7_, "gtk-application-prefer-dark-theme", system_prefers_dark, NULL);
		if (system_prefers_dark) {
			gint _tmp8_ = 0;
			GdkRGBA* _tmp9_;
			_tmp9_ = terminal_themes_get_rgba_palette (TERMINAL_THEMES_DARK, &_tmp8_);
			theme_palette = (g_free (theme_palette), NULL);
			theme_palette = _tmp9_;
			theme_palette_length1 = _tmp8_;
			_theme_palette_size_ = theme_palette_length1;
		} else {
			gint _tmp10_ = 0;
			GdkRGBA* _tmp11_;
			_tmp11_ = terminal_themes_get_rgba_palette (TERMINAL_THEMES_LIGHT, &_tmp10_);
			theme_palette = (g_free (theme_palette), NULL);
			theme_palette = _tmp11_;
			theme_palette_length1 = _tmp10_;
			_theme_palette_size_ = theme_palette_length1;
		}
	} else {
		GtkSettings* _tmp12_;
		GSettings* _tmp13_;
		GSettings* _tmp14_;
		gchar* _tmp15_;
		gchar* _tmp16_;
		gint _tmp17_ = 0;
		GdkRGBA* _tmp18_;
		_tmp12_ = gtk_settings;
		_tmp13_ = terminal_application_settings;
		g_object_set (_tmp12_, "gtk-application-prefer-dark-theme", g_settings_get_boolean (_tmp13_, "prefer-dark-style"), NULL);
		_tmp14_ = terminal_application_settings;
		_tmp15_ = g_settings_get_string (_tmp14_, "theme");
		_tmp16_ = _tmp15_;
		_tmp18_ = terminal_themes_get_rgba_palette (_tmp16_, &_tmp17_);
		theme_palette = (g_free (theme_palette), NULL);
		theme_palette = _tmp18_;
		theme_palette_length1 = _tmp17_;
		_theme_palette_size_ = theme_palette_length1;
		_g_free0 (_tmp16_);
	}
	_tmp19_ = theme_palette;
	_tmp19__length1 = theme_palette_length1;
	_tmp20_ = _tmp19_[TERMINAL_THEMES_PALETTE_SIZE - 3];
	background = _tmp20_;
	_tmp21_ = theme_palette;
	_tmp21__length1 = theme_palette_length1;
	_tmp22_ = _tmp21_[TERMINAL_THEMES_PALETTE_SIZE - 2];
	foreground = _tmp22_;
	_tmp23_ = theme_palette;
	_tmp23__length1 = theme_palette_length1;
	_tmp24_ = _tmp23_[TERMINAL_THEMES_PALETTE_SIZE - 1];
	cursor = _tmp24_;
	_tmp25_ = theme_palette;
	_tmp25__length1 = theme_palette_length1;
	_tmp26_ = (_tmp25_ != NULL) ? _vala_array_dup1 (_tmp25_ + 0, 16 - 0) : _tmp25_;
	_tmp26__length1 = 16 - 0;
	palette = _tmp26_;
	palette_length1 = _tmp26__length1;
	_palette_size_ = palette_length1;
	_tmp27_ = foreground;
	_tmp28_ = background;
	vte_terminal_set_colors ((VteTerminal*) self, &_tmp27_, &_tmp28_, palette, (gsize) palette_length1);
	_tmp29_ = background;
	gtk_widget_set_opacity ((GtkWidget*) self, (gdouble) _tmp29_.alpha);
	_tmp30_ = cursor;
	vte_terminal_set_color_cursor ((VteTerminal*) self, &_tmp30_);
	palette = (g_free (palette), NULL);
	theme_palette = (g_free (theme_palette), NULL);
	_g_object_unref0 (gtk_settings);
}

static void
terminal_terminal_widget_update_audible_bell (TerminalTerminalWidget* self)
{
	GSettings* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = terminal_application_settings;
	vte_terminal_set_audible_bell ((VteTerminal*) self, g_settings_get_boolean (_tmp0_, "audible-bell"));
}

static void
terminal_terminal_widget_update_cursor_shape (TerminalTerminalWidget* self)
{
	GSettings* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = terminal_application_settings;
	vte_terminal_set_cursor_shape ((VteTerminal*) self, (VteCursorShape) g_settings_get_enum (_tmp0_, "cursor-shape"));
}

static void
terminal_terminal_widget_on_child_exited (TerminalTerminalWidget* self)
{
	g_return_if_fail (self != NULL);
	self->priv->child_has_exited = TRUE;
	self->priv->last_key_was_return = TRUE;
	self->priv->fg_pid = (GPid) -1;
}

static void
terminal_terminal_widget_on_window_title_changed (TerminalTerminalWidget* self)
{
	g_return_if_fail (self != NULL);
	if (terminal_terminal_widget_has_foreground_process (self)) {
		terminal_terminal_widget_set_tab_state (self, TERMINAL_TERMINAL_WIDGET_TAB_STATE_WORKING);
	}
}

void
terminal_terminal_widget_kill_fg (TerminalTerminalWidget* self)
{
	gint fg_pid = 0;
	gint _tmp0_ = 0;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp1_ = terminal_terminal_widget_try_get_foreground_pid (self, &_tmp0_);
	fg_pid = _tmp0_;
	if (_tmp1_) {
		kill ((pid_t) fg_pid, (gint) SIGHUP);
		kill ((pid_t) fg_pid, (gint) SIGTERM);
		kill ((pid_t) fg_pid, (gint) SIGKILL);
	}
}

void
terminal_terminal_widget_term_ps (TerminalTerminalWidget* self)
{
	gint pid_fd = 0;
	struct pollfd pid_pfd[1] = {0};
	struct pollfd _tmp0_ = {0};
	g_return_if_fail (self != NULL);
	terminal_terminal_widget_set_killed (self, TRUE);
	pid_fd = syscall (TERMINAL_TERMINAL_WIDGET_SYS_PIDFD_OPEN, self->priv->child_pid, 0, NULL);
	kill ((pid_t) self->priv->child_pid, (gint) SIGHUP);
	kill ((pid_t) self->priv->child_pid, (gint) SIGTERM);
	if (pid_fd == -1) {
		waitpid ((pid_t) self->priv->child_pid, NULL, 0);
		return;
	}
	memset (&_tmp0_, 0, sizeof (struct pollfd));
	_tmp0_.fd = pid_fd;
	_tmp0_.events = POLLIN;
	pid_pfd[0] = _tmp0_;
	while (TRUE) {
		if (!(poll (pid_pfd, (gint) 1, -1) != 1)) {
			break;
		}
	}
	close (pid_fd);
}

static void
__lambda15_ (TerminalTerminalWidget* self,
             VteTerminal* terminal,
             GPid pid,
             GError* _error_)
{
	g_return_if_fail (terminal != NULL);
	if (_error_ == NULL) {
		self->priv->child_pid = pid;
	} else {
		const gchar* _tmp0_;
		_tmp0_ = _error_->message;
		g_warning ("TerminalWidget.vala:896: %s", _tmp0_);
	}
}

static void
___lambda15__vte_terminal_spawn_async_callback (VteTerminal* terminal,
                                                GPid pid,
                                                GError* _error_,
                                                gpointer self)
{
	__lambda15_ ((TerminalTerminalWidget*) self, terminal, pid, _error_);
	g_object_unref (self);
}

void
terminal_terminal_widget_active_shell (TerminalTerminalWidget* self,
                                       const gchar* dir)
{
	gchar* shell = NULL;
	GSettings* _tmp0_;
	gchar* _tmp1_;
	gchar** envv = NULL;
	gint envv_length1;
	gint _envv_size_;
	const gchar* _tmp2_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar** _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar** _tmp12_;
	gchar** _tmp13_;
	gint _tmp13__length1;
	gchar** _tmp14_;
	gint _tmp14__length1;
	g_return_if_fail (self != NULL);
	g_return_if_fail (dir != NULL);
	_tmp0_ = terminal_application_settings;
	_tmp1_ = g_settings_get_string (_tmp0_, "shell");
	shell = _tmp1_;
	envv = NULL;
	envv_length1 = 0;
	_envv_size_ = envv_length1;
	_tmp2_ = shell;
	if (g_strcmp0 (_tmp2_, "") == 0) {
		gchar* _tmp3_;
		_tmp3_ = vte_get_user_shell ();
		_g_free0 (shell);
		shell = _tmp3_;
	}
	_tmp4_ = shell;
	if (g_strcmp0 (_tmp4_, "") == 0) {
		g_critical ("TerminalWidget.vala:860: No user shell available");
		envv = (_vala_array_free (envv, envv_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (shell);
		return;
	}
	if (g_strcmp0 (dir, "") == 0) {
		g_debug ("TerminalWidget.vala:865: Using fallback directory");
		dir = "/";
	}
	_tmp5_ = self->terminal_id;
	_tmp6_ = g_strconcat ("PANTHEON_TERMINAL_ID=", _tmp5_, NULL);
	_tmp7_ = g_getenv ("PROMPT_COMMAND");
	_tmp8_ = g_strconcat ("PROMPT_COMMAND=" TERMINAL_TERMINAL_WIDGET_SEND_PROCESS_FINISHED_BASH, _tmp7_, NULL);
	_tmp9_ = g_new0 (gchar*, 2 + 1);
	_tmp9_[0] = _tmp6_;
	_tmp9_[1] = _tmp8_;
	envv = (_vala_array_free (envv, envv_length1, (GDestroyNotify) g_free), NULL);
	envv = _tmp9_;
	envv_length1 = 2;
	_envv_size_ = envv_length1;
	_tmp10_ = shell;
	_tmp11_ = g_strdup (_tmp10_);
	_tmp12_ = g_new0 (gchar*, 1 + 1);
	_tmp12_[0] = _tmp11_;
	_tmp13_ = _tmp12_;
	_tmp13__length1 = 1;
	_tmp14_ = envv;
	_tmp14__length1 = envv_length1;
	vte_terminal_spawn_async ((VteTerminal*) self, VTE_PTY_DEFAULT, dir, _tmp13_, _tmp14_, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, -1, NULL, ___lambda15__vte_terminal_spawn_async_callback, g_object_ref (self));
	_tmp13_ = (_vala_array_free (_tmp13_, _tmp13__length1, (GDestroyNotify) g_free), NULL);
	envv = (_vala_array_free (envv, envv_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (shell);
}

static Block9Data*
block9_data_ref (Block9Data* _data9_)
{
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}

static void
block9_data_unref (void * _userdata_)
{
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		TerminalTerminalWidget* self;
		self = _data9_->self;
		_g_free0 (_data9_->program);
		_g_object_unref0 (self);
		g_slice_free (Block9Data, _data9_);
	}
}

static gboolean
__lambda16_ (Block9Data* _data9_)
{
	TerminalTerminalWidget* self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	gint _tmp3_ = 0;
	guint8* _tmp4_;
	gint _tmp4__length1;
	gboolean result;
	self = _data9_->self;
	_tmp0_ = g_strconcat (_data9_->program, "\n", NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = string_get_data (_tmp1_, &_tmp3_);
	_tmp2__length1 = _tmp3_;
	_tmp4_ = _tmp2_;
	_tmp4__length1 = _tmp2__length1;
	vte_terminal_feed_child ((VteTerminal*) self, _tmp4_, (gssize) _tmp4__length1);
	_g_free0 (_tmp1_);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda16__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda16_ (self);
	return result;
}

void
terminal_terminal_widget_run_program (TerminalTerminalWidget* self,
                                      const gchar* program)
{
	Block9Data* _data9_;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (program != NULL);
	_data9_ = g_slice_new0 (Block9Data);
	_data9_->_ref_count_ = 1;
	_data9_->self = g_object_ref (self);
	_tmp0_ = g_strdup (program);
	_g_free0 (_data9_->program);
	_data9_->program = _tmp0_;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda16__gsource_func, block9_data_ref (_data9_), block9_data_unref);
	block9_data_unref (_data9_);
	_data9_ = NULL;
}

static gboolean
terminal_terminal_widget_try_get_foreground_pid (TerminalTerminalWidget* self,
                                                 gint* pid)
{
	gint _vala_pid = 0;
	gint pty = 0;
	VtePty* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint fgpid = 0;
	gboolean _tmp3_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (self->priv->child_has_exited) {
		_vala_pid = -1;
		result = FALSE;
		if (pid) {
			*pid = _vala_pid;
		}
		return result;
	}
	_tmp0_ = vte_terminal_get_pty ((VteTerminal*) self);
	_tmp1_ = vte_pty_get_fd (_tmp0_);
	_tmp2_ = _tmp1_;
	pty = _tmp2_;
	fgpid = (gint) tcgetpgrp (pty);
	if (fgpid != ((gint) self->priv->child_pid)) {
		_tmp3_ = fgpid != -1;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		_vala_pid = (gint) fgpid;
		result = TRUE;
		if (pid) {
			*pid = _vala_pid;
		}
		return result;
	} else {
		_vala_pid = -1;
		result = FALSE;
		if (pid) {
			*pid = _vala_pid;
		}
		return result;
	}
}

gboolean
terminal_terminal_widget_has_foreground_process (TerminalTerminalWidget* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = terminal_terminal_widget_try_get_foreground_pid (self, NULL);
	return result;
}

static void
terminal_terminal_widget_clickable (TerminalTerminalWidget* self,
                                    gchar** str,
                                    gint str_length1)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		gchar** exp_collection = NULL;
		gint exp_collection_length1 = 0;
		gint _exp_collection_size_ = 0;
		gint exp_it = 0;
		exp_collection = str;
		exp_collection_length1 = str_length1;
		for (exp_it = 0; exp_it < exp_collection_length1; exp_it = exp_it + 1) {
			const gchar* exp = NULL;
			exp = exp_collection[exp_it];
			{
				{
					VteRegex* regex = NULL;
					const gchar* _tmp0_;
					VteRegex* _tmp1_;
					gint id = 0;
					VteRegex* _tmp2_;
					_tmp0_ = exp;
					_tmp1_ = vte_regex_new_for_match (_tmp0_, (gssize) -1, (guint32) PCRE2_MULTILINE, &_inner_error0_);
					regex = _tmp1_;
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						goto __catch0_g_error;
					}
					_tmp2_ = regex;
					id = vte_terminal_match_add_regex ((VteTerminal*) self, _tmp2_, (guint32) 0);
					vte_terminal_match_set_cursor_name ((VteTerminal*) self, id, "pointer");
					_vte_regex_unref0 (regex);
				}
				goto __finally0;
				__catch0_g_error:
				{
					GError* _error_ = NULL;
					GError* _tmp3_;
					const gchar* _tmp4_;
					_error_ = _inner_error0_;
					_inner_error0_ = NULL;
					_tmp3_ = _error_;
					_tmp4_ = _tmp3_->message;
					g_warning ("TerminalWidget.vala:942: %s", _tmp4_);
					_g_error_free0 (_error_);
				}
				__finally0:
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
					g_clear_error (&_inner_error0_);
					return;
				}
			}
		}
	}
}

static gchar*
terminal_terminal_widget_get_link (TerminalTerminalWidget* self,
                                   gdouble x,
                                   gdouble y)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = vte_terminal_check_match_at ((VteTerminal*) self, x, y, NULL);
	result = _tmp0_;
	return result;
}

gchar*
terminal_terminal_widget_get_shell_location (TerminalTerminalWidget* self)
{
	gint pid = 0;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	pid = (gint) ((GPid) self->priv->child_pid);
	{
		gchar* _tmp0_ = NULL;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp1_ = g_strdup_printf ("/proc/%d/cwd", pid);
		_tmp2_ = _tmp1_;
		_tmp3_ = g_file_read_link (_tmp2_, &_inner_error0_);
		_tmp4_ = _tmp3_;
		_g_free0 (_tmp2_);
		_tmp0_ = _tmp4_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_FILE_ERROR) {
				goto __catch0_g_file_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp5_ = _tmp0_;
		_tmp0_ = NULL;
		result = _tmp5_;
		_g_free0 (_tmp0_);
		return result;
	}
	goto __finally0;
	__catch0_g_file_error:
	{
		gchar* _tmp6_;
		g_clear_error (&_inner_error0_);
		_tmp6_ = g_strdup ("");
		result = _tmp6_;
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static gchar*
terminal_terminal_widget_get_pid_exe_name (TerminalTerminalWidget* self,
                                           gint pid)
{
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	{
		gchar* exe = NULL;
		gchar* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp0_ = g_strdup_printf ("/proc/%d/exe", pid);
		_tmp1_ = _tmp0_;
		_tmp2_ = g_file_read_link (_tmp1_, &_inner_error0_);
		_tmp3_ = _tmp2_;
		_g_free0 (_tmp1_);
		exe = _tmp3_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp4_ = g_path_get_basename (exe);
		result = _tmp4_;
		_g_free0 (exe);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		gchar* _tmp5_;
		g_clear_error (&_inner_error0_);
		_tmp5_ = g_strdup ("");
		result = _tmp5_;
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static void
terminal_terminal_widget_real_increase_font_size (VteTerminal* base)
{
	TerminalTerminalWidget * self;
	gdouble _tmp0_;
	gdouble _tmp1_;
	self = (TerminalTerminalWidget*) base;
	_tmp0_ = vte_terminal_get_font_scale ((VteTerminal*) self);
	_tmp1_ = _tmp0_;
	vte_terminal_set_font_scale ((VteTerminal*) self, _tmp1_ + 0.1);
}

static void
terminal_terminal_widget_real_decrease_font_size (VteTerminal* base)
{
	TerminalTerminalWidget * self;
	gdouble _tmp0_;
	gdouble _tmp1_;
	self = (TerminalTerminalWidget*) base;
	_tmp0_ = vte_terminal_get_font_scale ((VteTerminal*) self);
	_tmp1_ = _tmp0_;
	vte_terminal_set_font_scale ((VteTerminal*) self, _tmp1_ - 0.1);
}

void
terminal_terminal_widget_default_font_size (TerminalTerminalWidget* self)
{
	g_return_if_fail (self != NULL);
	vte_terminal_set_font_scale ((VteTerminal*) self, 1.0);
}

gboolean
terminal_terminal_widget_is_init_complete (TerminalTerminalWidget* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->init_complete;
	return result;
}

void
terminal_terminal_widget_set_init_complete (TerminalTerminalWidget* self)
{
	g_return_if_fail (self != NULL);
	self->priv->init_complete = TRUE;
}

static gboolean
terminal_terminal_widget_on_drop (TerminalTerminalWidget* self,
                                  GValue* val,
                                  gdouble x,
                                  gdouble y)
{
	gchar** uris = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gint uris_length1;
	gint _uris_size_;
	gchar* path = NULL;
	GFile* file = NULL;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (val != NULL, FALSE);
	_tmp0_ = g_value_dup_string (val);
	_tmp1_ = _tmp0_;
	_tmp3_ = _tmp2_ = g_uri_list_extract_uris (_tmp1_);
	_tmp4_ = _tmp3_;
	_tmp4__length1 = _vala_array_length (_tmp2_);
	_g_free0 (_tmp1_);
	uris = _tmp4_;
	uris_length1 = _tmp4__length1;
	_uris_size_ = uris_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				gchar** _tmp7_;
				gint _tmp7__length1;
				if (!_tmp5_) {
					gint _tmp6_;
					_tmp6_ = i;
					i = _tmp6_ + 1;
				}
				_tmp5_ = FALSE;
				_tmp7_ = uris;
				_tmp7__length1 = uris_length1;
				if (!(i < _tmp7__length1)) {
					break;
				}
				{
					gboolean _tmp8_ = FALSE;
					gchar** _tmp9_;
					gint _tmp9__length1;
					const gchar* _tmp10_;
					_tmp9_ = uris;
					_tmp9__length1 = uris_length1;
					_tmp10_ = _tmp9_[i];
					_tmp8_ = g_uri_is_valid (_tmp10_, G_URI_FLAGS_PARSE_RELAXED, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						goto __catch0_g_error;
					}
					if (_tmp8_) {
						gchar** _tmp11_;
						gint _tmp11__length1;
						const gchar* _tmp12_;
						GFile* _tmp13_;
						GFile* _tmp14_;
						gchar* _tmp15_;
						const gchar* _tmp16_;
						gchar** _tmp22_;
						gint _tmp22__length1;
						const gchar* _tmp23_;
						guint8* _tmp24_;
						gint _tmp24__length1;
						gint _tmp25_ = 0;
						guint8* _tmp26_;
						gint _tmp26__length1;
						_tmp11_ = uris;
						_tmp11__length1 = uris_length1;
						_tmp12_ = _tmp11_[i];
						_tmp13_ = g_file_new_for_uri (_tmp12_);
						_g_object_unref0 (file);
						file = _tmp13_;
						_tmp14_ = file;
						_tmp15_ = g_file_get_path (_tmp14_);
						_g_free0 (path);
						path = _tmp15_;
						_tmp16_ = path;
						if (_tmp16_ != NULL) {
							gchar** _tmp17_;
							gint _tmp17__length1;
							const gchar* _tmp18_;
							gchar* _tmp19_;
							gchar* _tmp20_;
							gchar* _tmp21_;
							_tmp17_ = uris;
							_tmp17__length1 = uris_length1;
							_tmp18_ = path;
							_tmp19_ = g_shell_quote (_tmp18_);
							_tmp20_ = _tmp19_;
							_tmp21_ = g_strconcat (_tmp20_, " ", NULL);
							_g_free0 (_tmp17_[i]);
							_tmp17_[i] = _tmp21_;
							_g_free0 (_tmp20_);
						}
						_tmp22_ = uris;
						_tmp22__length1 = uris_length1;
						_tmp23_ = _tmp22_[i];
						_tmp24_ = string_get_data (_tmp23_, &_tmp25_);
						_tmp24__length1 = _tmp25_;
						_tmp26_ = _tmp24_;
						_tmp26__length1 = _tmp24__length1;
						vte_terminal_feed_child ((VteTerminal*) self, _tmp26_, (gssize) _tmp26__length1);
					}
				}
				goto __finally0;
				__catch0_g_error:
				{
					gchar** _tmp27_;
					gint _tmp27__length1;
					const gchar* _tmp28_;
					g_clear_error (&_inner_error0_);
					_tmp27_ = uris;
					_tmp27__length1 = uris_length1;
					_tmp28_ = _tmp27_[i];
					terminal_terminal_widget_validated_paste (self, _tmp28_);
				}
				__finally0:
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					gboolean _tmp29_ = FALSE;
					_g_object_unref0 (file);
					_g_free0 (path);
					uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL);
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
					g_clear_error (&_inner_error0_);
					return _tmp29_;
				}
			}
		}
	}
	result = TRUE;
	_g_object_unref0 (file);
	_g_free0 (path);
	uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

static void
terminal_terminal_widget_remember_position (TerminalTerminalWidget* self)
{
	glong col = 0L;
	glong row = 0L;
	glong _tmp0_ = 0L;
	glong _tmp1_ = 0L;
	g_return_if_fail (self != NULL);
	vte_terminal_get_cursor_position ((VteTerminal*) self, &_tmp0_, &_tmp1_);
	col = _tmp0_;
	row = _tmp1_;
	self->priv->remembered_position = row;
}

static void
terminal_terminal_widget_remember_command_start_position (TerminalTerminalWidget* self)
{
	gboolean _tmp0_ = FALSE;
	glong col = 0L;
	glong row = 0L;
	glong _tmp1_ = 0L;
	glong _tmp2_ = 0L;
	g_return_if_fail (self != NULL);
	if (!self->priv->last_key_was_return) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = terminal_terminal_widget_has_foreground_process (self);
	}
	if (_tmp0_) {
		return;
	}
	vte_terminal_get_cursor_position ((VteTerminal*) self, &_tmp1_, &_tmp2_);
	col = _tmp1_;
	row = _tmp2_;
	self->priv->remembered_command_start_row = row;
	self->priv->last_key_was_return = FALSE;
	terminal_terminal_widget_set_resized (self, FALSE);
}

static void
terminal_terminal_widget_remember_command_end_position (TerminalTerminalWidget* self)
{
	gboolean _tmp0_ = FALSE;
	glong col = 0L;
	glong row = 0L;
	glong _tmp1_ = 0L;
	glong _tmp2_ = 0L;
	g_return_if_fail (self != NULL);
	if (self->priv->last_key_was_return) {
		_tmp0_ = !terminal_terminal_widget_has_foreground_process (self);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	vte_terminal_get_cursor_position ((VteTerminal*) self, &_tmp1_, &_tmp2_);
	col = _tmp1_;
	row = _tmp2_;
	if ((row - self->priv->remembered_command_end_row) <= ((glong) 2)) {
		self->priv->remembered_command_end_row = row;
	}
	self->priv->last_key_was_return = TRUE;
}

static gchar*
terminal_terminal_widget_get_last_output (TerminalTerminalWidget* self,
                                          gboolean include_command)
{
	glong output_end_col = 0L;
	glong output_end_row = 0L;
	glong start_row = 0L;
	glong _tmp0_ = 0L;
	glong _tmp1_ = 0L;
	glong command_lines = 0L;
	glong _tmp2_ = 0L;
	gsize len = 0UL;
	gsize _tmp4_ = 0UL;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	vte_terminal_get_cursor_position ((VteTerminal*) self, &_tmp0_, &_tmp1_);
	output_end_col = _tmp0_;
	output_end_row = _tmp1_;
	command_lines = self->priv->remembered_command_end_row - self->priv->remembered_command_start_row;
	if (!include_command) {
		start_row = self->priv->remembered_command_end_row + 1;
	} else {
		start_row = self->priv->remembered_command_start_row;
	}
	if (include_command) {
		_tmp2_ = command_lines + 1;
	} else {
		_tmp2_ = (glong) 1;
	}
	if ((output_end_row - start_row) < _tmp2_) {
		gchar* _tmp3_;
		_tmp3_ = g_strdup ("");
		result = _tmp3_;
		return result;
	}
	self->priv->last_key_was_return = TRUE;
	len = (gsize) 0;
	_tmp5_ = vte_terminal_get_text_range_format ((VteTerminal*) self, VTE_FORMAT_TEXT, start_row, (glong) 0, output_end_row - 1, (glong) 1000, &_tmp4_);
	len = _tmp4_;
	_tmp6_ = _tmp5_;
	_tmp7_ = g_strconcat (_tmp6_, "\n", NULL);
	_tmp8_ = _tmp7_;
	_g_free0 (_tmp6_);
	result = _tmp8_;
	return result;
}

static void
terminal_terminal_widget_scroll_to_command (TerminalTerminalWidget* self,
                                            GSimpleAction* action,
                                            GVariant* parameter)
{
	glong row = 0L;
	glong delta = 0L;
	glong _tmp0_ = 0L;
	GtkAdjustment* _tmp1_;
	GtkAdjustment* _tmp2_;
	GtkAdjustment* _tmp3_;
	GtkAdjustment* _tmp4_;
	gdouble _tmp5_;
	gdouble _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	vte_terminal_get_cursor_position ((VteTerminal*) self, NULL, &_tmp0_);
	row = _tmp0_;
	delta = self->priv->remembered_position - row;
	_tmp1_ = gtk_scrollable_get_vadjustment ((GtkScrollable*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = gtk_scrollable_get_vadjustment ((GtkScrollable*) self);
	_tmp4_ = _tmp3_;
	_tmp5_ = gtk_adjustment_get_value (_tmp4_);
	_tmp6_ = _tmp5_;
	g_object_get ((GtkWidget*) self, "height-request", &_tmp7_, NULL);
	_tmp8_ = _tmp7_;
	gtk_adjustment_set_value (_tmp4_, _tmp6_ + ((((gint) delta) + (_tmp8_ / vte_terminal_get_char_height ((VteTerminal*) self))) - 1));
	g_simple_action_set_enabled (action, FALSE);
}

static gboolean
__lambda42_ (TerminalTerminalWidget* self)
{
	gchar* cwd = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gint pid = 0;
	gint _tmp4_ = 0;
	gboolean result;
	if (self->priv->contents_changed_continue) {
		self->priv->contents_changed_continue = FALSE;
		result = G_SOURCE_CONTINUE;
		return result;
	}
	_tmp0_ = terminal_terminal_widget_get_shell_location (self);
	cwd = _tmp0_;
	_tmp1_ = cwd;
	_tmp2_ = self->priv->_current_working_directory;
	if (g_strcmp0 (_tmp1_, _tmp2_) != 0) {
		const gchar* _tmp3_;
		_tmp3_ = cwd;
		terminal_terminal_widget_update_current_working_directory (self, _tmp3_);
	}
	terminal_terminal_widget_try_get_foreground_pid (self, &_tmp4_);
	pid = _tmp4_;
	if (pid != ((gint) self->priv->fg_pid)) {
		gchar* name = NULL;
		gchar* _tmp5_;
		const gchar* _tmp6_;
		_tmp5_ = terminal_terminal_widget_get_pid_exe_name (self, pid);
		name = _tmp5_;
		_tmp6_ = name;
		g_signal_emit (self, terminal_terminal_widget_signals[TERMINAL_TERMINAL_WIDGET_FOREGROUND_PROCESS_CHANGED_SIGNAL], 0, _tmp6_);
		self->priv->fg_pid = (GPid) pid;
		_g_free0 (name);
	}
	self->priv->contents_changed_timeout_id = (guint) 0;
	result = G_SOURCE_REMOVE;
	_g_free0 (cwd);
	return result;
}

static gboolean
___lambda42__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda42_ ((TerminalTerminalWidget*) self);
	return result;
}

static void
terminal_terminal_widget_on_contents_changed (TerminalTerminalWidget* self)
{
	g_return_if_fail (self != NULL);
	self->priv->contents_changed_continue = TRUE;
	if (self->priv->contents_changed_timeout_id > ((guint) 0)) {
		return;
	}
	self->priv->contents_changed_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) TERMINAL_TERMINAL_WIDGET_CONTENTS_CHANGED_DELAY_MSEC, ___lambda42__gsource_func, g_object_ref (self), g_object_unref);
}

static void
__lambda43_ (TerminalTerminalWidget* self,
             GObject* obj,
             GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		g_app_info_launch_default_for_uri_finish (res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = e;
		_tmp1_ = _tmp0_->message;
		g_warning ("TerminalWidget.vala:1130: Launcher failed with error %s", _tmp1_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
___lambda43__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda43_ ((TerminalTerminalWidget*) self, source_object, res);
	g_object_unref (self);
}

static void
terminal_terminal_widget_open_in_browser (TerminalTerminalWidget* self,
                                          GSimpleAction* action,
                                          GVariant* parameter)
{
	gchar* uri = NULL;
	gchar* _tmp0_;
	GdkAppLaunchContext* context = NULL;
	GdkDisplay* _tmp1_;
	GdkAppLaunchContext* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = terminal_terminal_widget_get_current_selection_link_or_pwd (self);
	uri = _tmp0_;
	_tmp1_ = gdk_display_get_default ();
	_tmp2_ = gdk_display_get_app_launch_context (_tmp1_);
	context = _tmp2_;
	g_app_info_launch_default_for_uri_async (uri, (GAppLaunchContext*) context, NULL, ___lambda43__gasync_ready_callback, g_object_ref (self));
	_g_object_unref0 (context);
	_g_free0 (uri);
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static gchar*
terminal_terminal_widget_get_current_selection_link_or_pwd (TerminalTerminalWidget* self)
{
	const gchar* _tmp0_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->link_uri;
	if (_tmp0_ == NULL) {
		if (vte_terminal_get_has_selection ((VteTerminal*) self)) {
			vte_terminal_copy_primary ((VteTerminal*) self);
			{
				GdkContentProvider* cp = NULL;
				GdkDisplay* _tmp1_;
				GdkClipboard* _tmp2_;
				GdkContentProvider* _tmp3_;
				GdkContentProvider* _tmp4_;
				GdkContentProvider* _tmp5_;
				_tmp1_ = gdk_display_get_default ();
				_tmp2_ = gdk_display_get_primary_clipboard (_tmp1_);
				_tmp3_ = gdk_clipboard_get_content (_tmp2_);
				_tmp4_ = _g_object_ref0 (_tmp3_);
				cp = _tmp4_;
				_tmp5_ = cp;
				if (_tmp5_ != NULL) {
					GValue val = {0};
					GValue _tmp6_ = {0};
					GdkContentProvider* _tmp7_;
					gchar* _tmp8_;
					g_value_init (&_tmp6_, G_TYPE_STRING);
					val = _tmp6_;
					_tmp7_ = cp;
					gdk_content_provider_get_value (_tmp7_, &val, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
						_g_object_unref0 (cp);
						goto __catch0_g_error;
					}
					_tmp8_ = g_value_dup_string (&val);
					result = _tmp8_;
					G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
					_g_object_unref0 (cp);
					return result;
				}
				_g_object_unref0 (cp);
			}
			goto __finally0;
			__catch0_g_error:
			{
				g_clear_error (&_inner_error0_);
				g_critical ("TerminalWidget.vala:1148: Unable to get clipboard contents");
			}
			__finally0:
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return NULL;
			}
			result = NULL;
			return result;
		} else {
			gchar* shell_location_path = NULL;
			gchar* _tmp9_;
			GFile* shell_location_file = NULL;
			const gchar* _tmp10_;
			GFile* _tmp11_;
			GFile* _tmp12_;
			gchar* _tmp13_;
			_tmp9_ = terminal_terminal_widget_get_shell_location (self);
			shell_location_path = _tmp9_;
			_tmp10_ = shell_location_path;
			_tmp11_ = g_file_new_for_path (_tmp10_);
			shell_location_file = _tmp11_;
			_tmp12_ = shell_location_file;
			_tmp13_ = g_file_get_uri (_tmp12_);
			result = _tmp13_;
			_g_object_unref0 (shell_location_file);
			_g_free0 (shell_location_path);
			return result;
		}
	} else {
		const gchar* _tmp14_;
		const gchar* _tmp17_;
		gchar* _tmp18_;
		_tmp14_ = self->priv->link_uri;
		if (!string_contains (_tmp14_, "://")) {
			const gchar* _tmp15_;
			gchar* _tmp16_;
			_tmp15_ = self->priv->link_uri;
			_tmp16_ = g_strconcat ("http://", _tmp15_, NULL);
			_g_free0 (self->priv->link_uri);
			self->priv->link_uri = _tmp16_;
		}
		_tmp17_ = self->priv->link_uri;
		_tmp18_ = g_strdup (_tmp17_);
		result = _tmp18_;
		return result;
	}
}

TerminalTerminalWidget*
terminal_terminal_widget_construct (GType object_type)
{
	TerminalTerminalWidget * self = NULL;
	self = (TerminalTerminalWidget*) g_object_new (object_type, NULL);
	return self;
}

TerminalTerminalWidget*
terminal_terminal_widget_new (void)
{
	return terminal_terminal_widget_construct (TERMINAL_TYPE_TERMINAL_WIDGET);
}

const gchar*
terminal_terminal_widget_get_current_working_directory (TerminalTerminalWidget* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_current_working_directory;
	result = _tmp0_;
	return result;
}

static void
terminal_terminal_widget_set_current_working_directory (TerminalTerminalWidget* self,
                                                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = terminal_terminal_widget_get_current_working_directory (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_current_working_directory);
		self->priv->_current_working_directory = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, terminal_terminal_widget_properties[TERMINAL_TERMINAL_WIDGET_CURRENT_WORKING_DIRECTORY_PROPERTY]);
	}
}

const gchar*
terminal_terminal_widget_get_program_string (TerminalTerminalWidget* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_program_string;
	result = _tmp0_;
	return result;
}

void
terminal_terminal_widget_set_program_string (TerminalTerminalWidget* self,
                                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = terminal_terminal_widget_get_program_string (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_program_string);
		self->priv->_program_string = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, terminal_terminal_widget_properties[TERMINAL_TERMINAL_WIDGET_PROGRAM_STRING_PROPERTY]);
	}
}

static gboolean
terminal_terminal_widget_get_resized (TerminalTerminalWidget* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_resized;
	return result;
}

static void
terminal_terminal_widget_set_resized (TerminalTerminalWidget* self,
                                      gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_resized = value;
}

TerminalTerminalWidgetTabState
terminal_terminal_widget_get_tab_state (TerminalTerminalWidget* self)
{
	TerminalTerminalWidgetTabState result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_tab_state;
	return result;
}

void
terminal_terminal_widget_set_tab_state (TerminalTerminalWidget* self,
                                        TerminalTerminalWidgetTabState value)
{
	TerminalTerminalWidgetTabState old_value;
	g_return_if_fail (self != NULL);
	old_value = terminal_terminal_widget_get_tab_state (self);
	if (old_value != value) {
		self->priv->_tab_state = value;
		g_object_notify_by_pspec ((GObject *) self, terminal_terminal_widget_properties[TERMINAL_TERMINAL_WIDGET_TAB_STATE_PROPERTY]);
	}
}

gboolean
terminal_terminal_widget_get_killed (TerminalTerminalWidget* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_killed;
	return result;
}

static void
terminal_terminal_widget_set_killed (TerminalTerminalWidget* self,
                                     gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = terminal_terminal_widget_get_killed (self);
	if (old_value != value) {
		self->priv->_killed = value;
		g_object_notify_by_pspec ((GObject *) self, terminal_terminal_widget_properties[TERMINAL_TERMINAL_WIDGET_KILLED_PROPERTY]);
	}
}

static void
_terminal_terminal_widget_update_theme_g_object_notify (GObject* _sender,
                                                        GParamSpec* pspec,
                                                        gpointer self)
{
	terminal_terminal_widget_update_theme ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget_update_audible_bell_g_settings_changed (GSettings* _sender,
                                                                  const gchar* key,
                                                                  gpointer self)
{
	terminal_terminal_widget_update_audible_bell ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget_update_theme_g_settings_changed (GSettings* _sender,
                                                           const gchar* key,
                                                           gpointer self)
{
	terminal_terminal_widget_update_theme ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget_update_cursor_shape_g_settings_changed (GSettings* _sender,
                                                                  const gchar* key,
                                                                  gpointer self)
{
	terminal_terminal_widget_update_cursor_shape ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget_pointer_focus_gtk_event_controller_motion_enter (GtkEventControllerMotion* _sender,
                                                                           gdouble x,
                                                                           gdouble y,
                                                                           gpointer self)
{
	terminal_terminal_widget_pointer_focus ((TerminalTerminalWidget*) self);
}

static gboolean
_terminal_terminal_widget_on_scroll_gtk_event_controller_scroll_scroll (GtkEventControllerScroll* _sender,
                                                                        gdouble dx,
                                                                        gdouble dy,
                                                                        gpointer self)
{
	gboolean result;
	result = terminal_terminal_widget_on_scroll ((TerminalTerminalWidget*) self, _sender, dx, dy);
	return result;
}

static void
_terminal_terminal_widget___lambda44_ (TerminalTerminalWidget* self)
{
	self->priv->scroll_delta = 0.0;
}

static void
__terminal_terminal_widget___lambda44__gtk_event_controller_scroll_scroll_end (GtkEventControllerScroll* _sender,
                                                                               gpointer self)
{
	_terminal_terminal_widget___lambda44_ ((TerminalTerminalWidget*) self);
}

static gboolean
_terminal_terminal_widget_on_key_pressed_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                               guint keyval,
                                                                               guint keycode,
                                                                               GdkModifierType state,
                                                                               gpointer self)
{
	gboolean result;
	result = terminal_terminal_widget_on_key_pressed ((TerminalTerminalWidget*) self, _sender, keyval, keycode, state);
	return result;
}

static void
_terminal_terminal_widget___lambda45_ (TerminalTerminalWidget* self)
{
	GtkEventControllerScroll* _tmp0_;
	_tmp0_ = self->priv->scroll_controller;
	gtk_event_controller_scroll_set_flags (_tmp0_, GTK_EVENT_CONTROLLER_SCROLL_NONE);
}

static void
__terminal_terminal_widget___lambda45__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                                         gpointer self)
{
	_terminal_terminal_widget___lambda45_ ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget___lambda46_ (TerminalTerminalWidget* self)
{
	GtkEventControllerScroll* _tmp0_;
	_tmp0_ = self->priv->scroll_controller;
	gtk_event_controller_scroll_set_flags (_tmp0_, GTK_EVENT_CONTROLLER_SCROLL_VERTICAL);
}

static void
__terminal_terminal_widget___lambda46__gtk_event_controller_focus_enter (GtkEventControllerFocus* _sender,
                                                                         gpointer self)
{
	_terminal_terminal_widget___lambda46_ ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget_click_pressed_gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                                                   gint n_press,
                                                                   gdouble x,
                                                                   gdouble y,
                                                                   gpointer self)
{
	terminal_terminal_widget_click_pressed ((TerminalTerminalWidget*) self, _sender, n_press, x, y);
}

static void
_terminal_terminal_widget_secondary_pressed_gtk_gesture_long_press_pressed (GtkGestureLongPress* _sender,
                                                                            gdouble x,
                                                                            gdouble y,
                                                                            gpointer self)
{
	terminal_terminal_widget_secondary_pressed ((TerminalTerminalWidget*) self, _sender, x, y);
}

static void
_terminal_terminal_widget___lambda47_ (TerminalTerminalWidget* self)
{
	GSimpleAction* _tmp0_;
	_tmp0_ = self->priv->copy_action;
	g_simple_action_set_enabled (_tmp0_, vte_terminal_get_has_selection ((VteTerminal*) self));
}

static void
__terminal_terminal_widget___lambda47__vte_terminal_selection_changed (VteTerminal* _sender,
                                                                       gpointer self)
{
	_terminal_terminal_widget___lambda47_ ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget___lambda48_ (TerminalTerminalWidget* self)
{
	terminal_terminal_widget_set_resized (self, TRUE);
}

static void
__terminal_terminal_widget___lambda48__g_object_notify (GObject* _sender,
                                                        GParamSpec* pspec,
                                                        gpointer self)
{
	_terminal_terminal_widget___lambda48_ ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget___lambda49_ (TerminalTerminalWidget* self)
{
	terminal_terminal_widget_set_resized (self, TRUE);
}

static void
__terminal_terminal_widget___lambda49__g_object_notify (GObject* _sender,
                                                        GParamSpec* pspec,
                                                        gpointer self)
{
	_terminal_terminal_widget___lambda49_ ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget_on_contents_changed_vte_terminal_contents_changed (VteTerminal* _sender,
                                                                             gpointer self)
{
	terminal_terminal_widget_on_contents_changed ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget_on_child_exited_vte_terminal_child_exited (VteTerminal* _sender,
                                                                     gint status,
                                                                     gpointer self)
{
	terminal_terminal_widget_on_child_exited ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget_on_window_title_changed_vte_terminal_window_title_changed (VteTerminal* _sender,
                                                                                     gpointer self)
{
	terminal_terminal_widget_on_window_title_changed ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget_update_actions_state_gdk_clipboard_changed (GdkClipboard* _sender,
                                                                      gpointer self)
{
	terminal_terminal_widget_update_actions_state ((TerminalTerminalWidget*) self);
}

static gboolean
_terminal_terminal_widget_on_drop_gtk_drop_target_drop (GtkDropTarget* _sender,
                                                        GValue* value,
                                                        gdouble x,
                                                        gdouble y,
                                                        gpointer self)
{
	gboolean result;
	result = terminal_terminal_widget_on_drop ((TerminalTerminalWidget*) self, value, x, y);
	return result;
}

static void
_terminal_terminal_widget_open_in_browser_g_simple_action_activate (GSimpleAction* _sender,
                                                                    GVariant* parameter,
                                                                    gpointer self)
{
	terminal_terminal_widget_open_in_browser ((TerminalTerminalWidget*) self, _sender, parameter);
}

static void
_terminal_terminal_widget___lambda50_ (TerminalTerminalWidget* self)
{
	vte_terminal_copy_clipboard ((VteTerminal*) self);
}

static void
__terminal_terminal_widget___lambda50__g_simple_action_activate (GSimpleAction* _sender,
                                                                 GVariant* parameter,
                                                                 gpointer self)
{
	_terminal_terminal_widget___lambda50_ ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget_copy_output_g_simple_action_activate (GSimpleAction* _sender,
                                                                GVariant* parameter,
                                                                gpointer self)
{
	terminal_terminal_widget_copy_output ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget_action_clear_screen_g_simple_action_activate (GSimpleAction* _sender,
                                                                        GVariant* parameter,
                                                                        gpointer self)
{
	terminal_terminal_widget_action_clear_screen ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget_action_reset_g_simple_action_activate (GSimpleAction* _sender,
                                                                 GVariant* parameter,
                                                                 gpointer self)
{
	terminal_terminal_widget_action_reset ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget___lambda51_ (TerminalTerminalWidget* self)
{
	vte_terminal_paste_clipboard ((VteTerminal*) self);
}

static void
__terminal_terminal_widget___lambda51__g_simple_action_activate (GSimpleAction* _sender,
                                                                 GVariant* parameter,
                                                                 gpointer self)
{
	_terminal_terminal_widget___lambda51_ ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget_reload_g_simple_action_activate (GSimpleAction* _sender,
                                                           GVariant* parameter,
                                                           gpointer self)
{
	terminal_terminal_widget_reload ((TerminalTerminalWidget*) self);
}

static void
_terminal_terminal_widget_scroll_to_command_g_simple_action_activate (GSimpleAction* _sender,
                                                                      GVariant* parameter,
                                                                      gpointer self)
{
	terminal_terminal_widget_scroll_to_command ((TerminalTerminalWidget*) self, _sender, parameter);
}

static void
_vte_terminal_select_all_g_simple_action_activate (GSimpleAction* _sender,
                                                   GVariant* parameter,
                                                   gpointer self)
{
	vte_terminal_select_all ((VteTerminal*) self);
}

static GObject *
terminal_terminal_widget_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TerminalTerminalWidget * self;
	gint _tmp0_;
	gchar* _tmp1_;
	GraniteSettings* granite_settings = NULL;
	GraniteSettings* _tmp2_;
	GraniteSettings* _tmp3_;
	GraniteSettings* _tmp4_;
	GSettings* _tmp5_;
	GSettings* _tmp6_;
	GSettings* _tmp7_;
	GSettings* _tmp8_;
	GSettings* _tmp9_;
	GSettings* _tmp10_;
	GSettings* _tmp11_;
	GSettings* _tmp12_;
	GSettings* _tmp13_;
	GtkEventControllerMotion* motion_controller = NULL;
	GtkEventControllerMotion* _tmp14_ = NULL;
	GtkEventControllerMotion* _tmp15_;
	GtkEventControllerScroll* _tmp16_ = NULL;
	GtkEventControllerScroll* _tmp17_;
	GtkEventControllerScroll* _tmp18_;
	GtkEventControllerKey* key_controller = NULL;
	GtkEventControllerKey* _tmp19_ = NULL;
	GtkEventControllerKey* _tmp20_;
	GtkEventControllerFocus* focus_controller = NULL;
	GtkEventControllerFocus* _tmp21_;
	GtkEventControllerFocus* _tmp22_;
	GtkEventControllerFocus* _tmp23_;
	GtkGestureClick* click_controller = NULL;
	GtkGestureClick* _tmp24_ = NULL;
	GtkGestureClick* _tmp25_;
	GtkGestureLongPress* long_press_controller = NULL;
	GtkGestureLongPress* _tmp26_ = NULL;
	GtkGestureLongPress* _tmp27_;
	GtkShortcut* select_all_shortcut = NULL;
	GtkKeyvalTrigger* _tmp28_;
	GtkNamedAction* _tmp29_;
	GtkShortcut* _tmp30_;
	GtkShortcut* reload_shortcut = NULL;
	GtkKeyvalTrigger* _tmp31_;
	GtkKeyvalTrigger* _tmp32_;
	GtkAlternativeTrigger* _tmp33_;
	GtkNamedAction* _tmp34_;
	GtkShortcut* _tmp35_;
	GtkShortcut* scroll_to_command_shortcut = NULL;
	GtkKeyvalTrigger* _tmp36_;
	GtkNamedAction* _tmp37_;
	GtkShortcut* _tmp38_;
	GtkShortcut* copy_output_shortcut = NULL;
	GtkKeyvalTrigger* _tmp39_;
	GtkNamedAction* _tmp40_;
	GtkShortcut* _tmp41_;
	GtkShortcutController* shortcut_controller = NULL;
	GtkShortcutController* _tmp42_ = NULL;
	GtkShortcutController* _tmp43_;
	GtkShortcut* _tmp44_;
	GtkShortcut* _tmp45_;
	GtkShortcutController* _tmp46_;
	GtkShortcut* _tmp47_;
	GtkShortcut* _tmp48_;
	GtkShortcutController* _tmp49_;
	GtkShortcut* _tmp50_;
	GtkShortcut* _tmp51_;
	GtkShortcutController* _tmp52_;
	GtkShortcut* _tmp53_;
	GtkShortcut* _tmp54_;
	GtkEventControllerMotion* _tmp55_;
	GtkEventController* _tmp56_;
	GtkEventControllerScroll* _tmp57_;
	GtkEventController* _tmp58_;
	GtkEventControllerKey* _tmp59_;
	GtkEventController* _tmp60_;
	GtkEventControllerFocus* _tmp61_;
	GtkEventController* _tmp62_;
	GtkGestureClick* _tmp63_;
	GtkEventController* _tmp64_;
	GtkGestureLongPress* _tmp65_;
	GtkEventController* _tmp66_;
	GtkShortcutController* _tmp67_;
	GtkEventController* _tmp68_;
	GdkClipboard* clipboard = NULL;
	GdkDisplay* _tmp69_;
	GdkClipboard* _tmp70_;
	GdkClipboard* _tmp71_;
	GtkDropTarget* drop_target = NULL;
	GtkDropTarget* _tmp72_;
	GtkDropTarget* _tmp73_;
	GtkDropTarget* _tmp74_;
	GtkEventController* _tmp75_;
	GSimpleActionGroup* action_group = NULL;
	GSimpleActionGroup* _tmp76_;
	GSimpleActionGroup* _tmp77_;
	GSimpleAction* _tmp78_;
	GSimpleAction* _tmp79_;
	GSimpleAction* _tmp80_;
	GSimpleActionGroup* _tmp81_;
	GSimpleAction* _tmp82_;
	GSimpleAction* _tmp83_;
	GSimpleAction* _tmp84_;
	GSimpleAction* _tmp85_;
	GSimpleActionGroup* _tmp86_;
	GSimpleAction* _tmp87_;
	GSimpleAction* _tmp88_;
	GSimpleAction* _tmp89_;
	GSimpleAction* _tmp90_;
	GSimpleActionGroup* _tmp91_;
	GSimpleAction* _tmp92_;
	GSimpleAction* _tmp93_;
	GSimpleAction* _tmp94_;
	GSimpleAction* _tmp95_;
	GSimpleActionGroup* _tmp96_;
	GSimpleAction* _tmp97_;
	GSimpleAction* _tmp98_;
	GSimpleAction* _tmp99_;
	GSimpleAction* _tmp100_;
	GSimpleActionGroup* _tmp101_;
	GSimpleAction* _tmp102_;
	GSimpleAction* _tmp103_;
	GSimpleAction* _tmp104_;
	GSimpleActionGroup* _tmp105_;
	GSimpleAction* _tmp106_;
	GSimpleAction* reload_action = NULL;
	GSimpleAction* _tmp107_;
	GSimpleAction* _tmp108_;
	GSimpleActionGroup* _tmp109_;
	GSimpleAction* _tmp110_;
	GSimpleAction* _tmp111_;
	GSimpleAction* _tmp112_;
	GSimpleAction* _tmp113_;
	GSimpleActionGroup* _tmp114_;
	GSimpleAction* _tmp115_;
	GSimpleAction* select_all_action = NULL;
	GSimpleAction* _tmp116_;
	GSimpleAction* _tmp117_;
	GSimpleActionGroup* _tmp118_;
	GSimpleAction* _tmp119_;
	parent_class = G_OBJECT_CLASS (terminal_terminal_widget_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_TYPE_TERMINAL_WIDGET, TerminalTerminalWidget);
	g_object_set ((VteTerminal*) self, "pointer-autohide", TRUE, NULL);
	_tmp0_ = terminal_terminal_widget_terminal_id_counter;
	terminal_terminal_widget_terminal_id_counter = _tmp0_ + 1;
	_tmp1_ = g_strdup_printf ("%i", _tmp0_);
	_g_free0 (self->terminal_id);
	self->terminal_id = _tmp1_;
	self->priv->init_complete = FALSE;
	terminal_terminal_widget_update_audible_bell (self);
	terminal_terminal_widget_update_cursor_shape (self);
	terminal_terminal_widget_update_theme (self);
	_tmp2_ = granite_settings_get_default ();
	_tmp3_ = _g_object_ref0 (_tmp2_);
	granite_settings = _tmp3_;
	_tmp4_ = granite_settings;
	g_signal_connect_object ((GObject*) _tmp4_, "notify::prefers-color-scheme", (GCallback) _terminal_terminal_widget_update_theme_g_object_notify, self, 0);
	_tmp5_ = terminal_application_settings;
	g_signal_connect_object (_tmp5_, "changed::audible-bell", (GCallback) _terminal_terminal_widget_update_audible_bell_g_settings_changed, self, 0);
	_tmp6_ = terminal_application_settings;
	g_signal_connect_object (_tmp6_, "changed::background", (GCallback) _terminal_terminal_widget_update_theme_g_settings_changed, self, 0);
	_tmp7_ = terminal_application_settings;
	g_signal_connect_object (_tmp7_, "changed::cursor-color", (GCallback) _terminal_terminal_widget_update_theme_g_settings_changed, self, 0);
	_tmp8_ = terminal_application_settings;
	g_signal_connect_object (_tmp8_, "changed::cursor-shape", (GCallback) _terminal_terminal_widget_update_cursor_shape_g_settings_changed, self, 0);
	_tmp9_ = terminal_application_settings;
	g_signal_connect_object (_tmp9_, "changed::follow-system-style", (GCallback) _terminal_terminal_widget_update_theme_g_settings_changed, self, 0);
	_tmp10_ = terminal_application_settings;
	g_signal_connect_object (_tmp10_, "changed::foreground", (GCallback) _terminal_terminal_widget_update_theme_g_settings_changed, self, 0);
	_tmp11_ = terminal_application_settings;
	g_signal_connect_object (_tmp11_, "changed::palette", (GCallback) _terminal_terminal_widget_update_theme_g_settings_changed, self, 0);
	_tmp12_ = terminal_application_settings;
	g_signal_connect_object (_tmp12_, "changed::prefer-dark-style", (GCallback) _terminal_terminal_widget_update_theme_g_settings_changed, self, 0);
	_tmp13_ = terminal_application_settings;
	g_signal_connect_object (_tmp13_, "changed::theme", (GCallback) _terminal_terminal_widget_update_theme_g_settings_changed, self, 0);
	_tmp14_ = (GtkEventControllerMotion*) gtk_event_controller_motion_new ();
	gtk_event_controller_set_propagation_phase ((GtkEventController*) _tmp14_, GTK_PHASE_CAPTURE);
	motion_controller = _tmp14_;
	_tmp15_ = motion_controller;
	g_signal_connect_object (_tmp15_, "enter", (GCallback) _terminal_terminal_widget_pointer_focus_gtk_event_controller_motion_enter, self, 0);
	_tmp16_ = (GtkEventControllerScroll*) gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL);
	gtk_event_controller_set_propagation_phase ((GtkEventController*) _tmp16_, GTK_PHASE_TARGET);
	_g_object_unref0 (self->priv->scroll_controller);
	self->priv->scroll_controller = _tmp16_;
	_tmp17_ = self->priv->scroll_controller;
	g_signal_connect_object (_tmp17_, "scroll", (GCallback) _terminal_terminal_widget_on_scroll_gtk_event_controller_scroll_scroll, self, 0);
	_tmp18_ = self->priv->scroll_controller;
	g_signal_connect_object (_tmp18_, "scroll-end", (GCallback) __terminal_terminal_widget___lambda44__gtk_event_controller_scroll_scroll_end, self, 0);
	_tmp19_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	gtk_event_controller_set_propagation_phase ((GtkEventController*) _tmp19_, GTK_PHASE_CAPTURE);
	key_controller = _tmp19_;
	_tmp20_ = key_controller;
	g_signal_connect_object (_tmp20_, "key-pressed", (GCallback) _terminal_terminal_widget_on_key_pressed_gtk_event_controller_key_key_pressed, self, 0);
	_tmp21_ = (GtkEventControllerFocus*) gtk_event_controller_focus_new ();
	focus_controller = _tmp21_;
	_tmp22_ = focus_controller;
	g_signal_connect_object (_tmp22_, "leave", (GCallback) __terminal_terminal_widget___lambda45__gtk_event_controller_focus_leave, self, 0);
	_tmp23_ = focus_controller;
	g_signal_connect_object (_tmp23_, "enter", (GCallback) __terminal_terminal_widget___lambda46__gtk_event_controller_focus_enter, self, 0);
	_tmp24_ = (GtkGestureClick*) gtk_gesture_click_new ();
	gtk_gesture_single_set_button ((GtkGestureSingle*) _tmp24_, (guint) 0);
	gtk_gesture_single_set_exclusive ((GtkGestureSingle*) _tmp24_, TRUE);
	click_controller = _tmp24_;
	_tmp25_ = click_controller;
	g_signal_connect_object (_tmp25_, "pressed", (GCallback) _terminal_terminal_widget_click_pressed_gtk_gesture_click_pressed, self, 0);
	_tmp26_ = (GtkGestureLongPress*) gtk_gesture_long_press_new ();
	gtk_gesture_single_set_touch_only ((GtkGestureSingle*) _tmp26_, TRUE);
	long_press_controller = _tmp26_;
	_tmp27_ = long_press_controller;
	g_signal_connect_object (_tmp27_, "pressed", (GCallback) _terminal_terminal_widget_secondary_pressed_gtk_gesture_long_press_pressed, self, 0);
	_tmp28_ = (GtkKeyvalTrigger*) gtk_keyval_trigger_new (GDK_KEY_A, GDK_CONTROL_MASK | GDK_SHIFT_MASK);
	_tmp29_ = (GtkNamedAction*) gtk_named_action_new ("term.select-all");
	_tmp30_ = gtk_shortcut_new ((GtkShortcutTrigger*) _tmp28_, (GtkShortcutAction*) _tmp29_);
	select_all_shortcut = _tmp30_;
	_tmp31_ = (GtkKeyvalTrigger*) gtk_keyval_trigger_new (GDK_KEY_R, GDK_CONTROL_MASK | GDK_SHIFT_MASK);
	_tmp32_ = (GtkKeyvalTrigger*) gtk_keyval_trigger_new (GDK_KEY_F5, GDK_CONTROL_MASK);
	_tmp33_ = (GtkAlternativeTrigger*) gtk_alternative_trigger_new ((GtkShortcutTrigger*) _tmp31_, (GtkShortcutTrigger*) _tmp32_);
	_tmp34_ = (GtkNamedAction*) gtk_named_action_new ("term.reload");
	_tmp35_ = gtk_shortcut_new ((GtkShortcutTrigger*) _tmp33_, (GtkShortcutAction*) _tmp34_);
	reload_shortcut = _tmp35_;
	_tmp36_ = (GtkKeyvalTrigger*) gtk_keyval_trigger_new (GDK_KEY_U, GDK_ALT_MASK);
	_tmp37_ = (GtkNamedAction*) gtk_named_action_new ("term.scroll-to-command");
	_tmp38_ = gtk_shortcut_new ((GtkShortcutTrigger*) _tmp36_, (GtkShortcutAction*) _tmp37_);
	scroll_to_command_shortcut = _tmp38_;
	_tmp39_ = (GtkKeyvalTrigger*) gtk_keyval_trigger_new (GDK_KEY_C, GDK_ALT_MASK);
	_tmp40_ = (GtkNamedAction*) gtk_named_action_new ("term.copy-output");
	_tmp41_ = gtk_shortcut_new ((GtkShortcutTrigger*) _tmp39_, (GtkShortcutAction*) _tmp40_);
	copy_output_shortcut = _tmp41_;
	_tmp42_ = (GtkShortcutController*) gtk_shortcut_controller_new ();
	gtk_event_controller_set_propagation_phase ((GtkEventController*) _tmp42_, GTK_PHASE_CAPTURE);
	gtk_event_controller_set_propagation_limit ((GtkEventController*) _tmp42_, GTK_LIMIT_SAME_NATIVE);
	shortcut_controller = _tmp42_;
	_tmp43_ = shortcut_controller;
	_tmp44_ = select_all_shortcut;
	_tmp45_ = _g_object_ref0 (_tmp44_);
	gtk_shortcut_controller_add_shortcut (_tmp43_, _tmp45_);
	_tmp46_ = shortcut_controller;
	_tmp47_ = reload_shortcut;
	_tmp48_ = _g_object_ref0 (_tmp47_);
	gtk_shortcut_controller_add_shortcut (_tmp46_, _tmp48_);
	_tmp49_ = shortcut_controller;
	_tmp50_ = scroll_to_command_shortcut;
	_tmp51_ = _g_object_ref0 (_tmp50_);
	gtk_shortcut_controller_add_shortcut (_tmp49_, _tmp51_);
	_tmp52_ = shortcut_controller;
	_tmp53_ = copy_output_shortcut;
	_tmp54_ = _g_object_ref0 (_tmp53_);
	gtk_shortcut_controller_add_shortcut (_tmp52_, _tmp54_);
	_tmp55_ = motion_controller;
	_tmp56_ = _g_object_ref0 ((GtkEventController*) _tmp55_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp56_);
	_tmp57_ = self->priv->scroll_controller;
	_tmp58_ = _g_object_ref0 ((GtkEventController*) _tmp57_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp58_);
	_tmp59_ = key_controller;
	_tmp60_ = _g_object_ref0 ((GtkEventController*) _tmp59_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp60_);
	_tmp61_ = focus_controller;
	_tmp62_ = _g_object_ref0 ((GtkEventController*) _tmp61_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp62_);
	_tmp63_ = click_controller;
	_tmp64_ = _g_object_ref0 ((GtkEventController*) _tmp63_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp64_);
	_tmp65_ = long_press_controller;
	_tmp66_ = _g_object_ref0 ((GtkEventController*) _tmp65_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp66_);
	_tmp67_ = shortcut_controller;
	_tmp68_ = _g_object_ref0 ((GtkEventController*) _tmp67_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp68_);
	g_signal_connect_object ((VteTerminal*) self, "selection-changed", (GCallback) __terminal_terminal_widget___lambda47__vte_terminal_selection_changed, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::height-request", (GCallback) __terminal_terminal_widget___lambda48__g_object_notify, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::width-request", (GCallback) __terminal_terminal_widget___lambda49__g_object_notify, self, 0);
	g_signal_connect_object ((VteTerminal*) self, "contents-changed", (GCallback) _terminal_terminal_widget_on_contents_changed_vte_terminal_contents_changed, self, 0);
	g_signal_connect_object ((VteTerminal*) self, "child-exited", (GCallback) _terminal_terminal_widget_on_child_exited_vte_terminal_child_exited, self, 0);
	g_signal_connect_object ((VteTerminal*) self, "window-title-changed", (GCallback) _terminal_terminal_widget_on_window_title_changed_vte_terminal_window_title_changed, self, 0);
	_tmp69_ = gdk_display_get_default ();
	_tmp70_ = gdk_display_get_clipboard (_tmp69_);
	clipboard = _tmp70_;
	_tmp71_ = clipboard;
	g_signal_connect_object (_tmp71_, "changed", (GCallback) _terminal_terminal_widget_update_actions_state_gdk_clipboard_changed, self, 0);
	_tmp72_ = gtk_drop_target_new (G_TYPE_STRING, GDK_ACTION_COPY);
	drop_target = _tmp72_;
	_tmp73_ = drop_target;
	g_signal_connect_object (_tmp73_, "drop", (GCallback) _terminal_terminal_widget_on_drop_gtk_drop_target_drop, self, 0);
	_tmp74_ = drop_target;
	_tmp75_ = _g_object_ref0 ((GtkEventController*) _tmp74_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp75_);
	terminal_terminal_widget_clickable (self, TERMINAL_TERMINAL_WIDGET_REGEX_STRINGS, (gint) G_N_ELEMENTS (TERMINAL_TERMINAL_WIDGET_REGEX_STRINGS));
	_tmp76_ = g_simple_action_group_new ();
	action_group = _tmp76_;
	_tmp77_ = action_group;
	gtk_widget_insert_action_group ((GtkWidget*) self, "term", (GActionGroup*) _tmp77_);
	_tmp78_ = g_simple_action_new ("open-in-browser", NULL);
	_g_object_unref0 (self->priv->open_in_browser_action);
	self->priv->open_in_browser_action = _tmp78_;
	_tmp79_ = self->priv->open_in_browser_action;
	g_simple_action_set_enabled (_tmp79_, FALSE);
	_tmp80_ = self->priv->open_in_browser_action;
	g_signal_connect_object (_tmp80_, "activate", (GCallback) _terminal_terminal_widget_open_in_browser_g_simple_action_activate, self, 0);
	_tmp81_ = action_group;
	_tmp82_ = self->priv->open_in_browser_action;
	g_action_map_add_action ((GActionMap*) _tmp81_, (GAction*) _tmp82_);
	_tmp83_ = g_simple_action_new ("copy", NULL);
	_g_object_unref0 (self->priv->copy_action);
	self->priv->copy_action = _tmp83_;
	_tmp84_ = self->priv->copy_action;
	g_simple_action_set_enabled (_tmp84_, FALSE);
	_tmp85_ = self->priv->copy_action;
	g_signal_connect_object (_tmp85_, "activate", (GCallback) __terminal_terminal_widget___lambda50__g_simple_action_activate, self, 0);
	_tmp86_ = action_group;
	_tmp87_ = self->priv->copy_action;
	g_action_map_add_action ((GActionMap*) _tmp86_, (GAction*) _tmp87_);
	_tmp88_ = g_simple_action_new ("copy-output", NULL);
	_g_object_unref0 (self->priv->copy_output_action);
	self->priv->copy_output_action = _tmp88_;
	_tmp89_ = self->priv->copy_output_action;
	g_simple_action_set_enabled (_tmp89_, FALSE);
	_tmp90_ = self->priv->copy_output_action;
	g_signal_connect_object (_tmp90_, "activate", (GCallback) _terminal_terminal_widget_copy_output_g_simple_action_activate, self, 0);
	_tmp91_ = action_group;
	_tmp92_ = self->priv->copy_output_action;
	g_action_map_add_action ((GActionMap*) _tmp91_, (GAction*) _tmp92_);
	_tmp93_ = g_simple_action_new ("clear-screen", NULL);
	_g_object_unref0 (self->priv->clear_screen_action);
	self->priv->clear_screen_action = _tmp93_;
	_tmp94_ = self->priv->clear_screen_action;
	g_simple_action_set_enabled (_tmp94_, TRUE);
	_tmp95_ = self->priv->clear_screen_action;
	g_signal_connect_object (_tmp95_, "activate", (GCallback) _terminal_terminal_widget_action_clear_screen_g_simple_action_activate, self, 0);
	_tmp96_ = action_group;
	_tmp97_ = self->priv->clear_screen_action;
	g_action_map_add_action ((GActionMap*) _tmp96_, (GAction*) _tmp97_);
	_tmp98_ = g_simple_action_new ("reset", NULL);
	_g_object_unref0 (self->priv->reset_action);
	self->priv->reset_action = _tmp98_;
	_tmp99_ = self->priv->reset_action;
	g_simple_action_set_enabled (_tmp99_, TRUE);
	_tmp100_ = self->priv->reset_action;
	g_signal_connect_object (_tmp100_, "activate", (GCallback) _terminal_terminal_widget_action_reset_g_simple_action_activate, self, 0);
	_tmp101_ = action_group;
	_tmp102_ = self->priv->reset_action;
	g_action_map_add_action ((GActionMap*) _tmp101_, (GAction*) _tmp102_);
	_tmp103_ = g_simple_action_new ("paste", NULL);
	_g_object_unref0 (self->priv->paste_action);
	self->priv->paste_action = _tmp103_;
	_tmp104_ = self->priv->paste_action;
	g_signal_connect_object (_tmp104_, "activate", (GCallback) __terminal_terminal_widget___lambda51__g_simple_action_activate, self, 0);
	_tmp105_ = action_group;
	_tmp106_ = self->priv->paste_action;
	g_action_map_add_action ((GActionMap*) _tmp105_, (GAction*) _tmp106_);
	_tmp107_ = g_simple_action_new ("reload", NULL);
	reload_action = _tmp107_;
	_tmp108_ = reload_action;
	g_signal_connect_object (_tmp108_, "activate", (GCallback) _terminal_terminal_widget_reload_g_simple_action_activate, self, 0);
	_tmp109_ = action_group;
	_tmp110_ = reload_action;
	g_action_map_add_action ((GActionMap*) _tmp109_, (GAction*) _tmp110_);
	_tmp111_ = g_simple_action_new ("scroll-to-command", NULL);
	_g_object_unref0 (self->priv->scroll_to_command_action);
	self->priv->scroll_to_command_action = _tmp111_;
	_tmp112_ = self->priv->scroll_to_command_action;
	g_simple_action_set_enabled (_tmp112_, FALSE);
	_tmp113_ = self->priv->scroll_to_command_action;
	g_signal_connect_object (_tmp113_, "activate", (GCallback) _terminal_terminal_widget_scroll_to_command_g_simple_action_activate, self, 0);
	_tmp114_ = action_group;
	_tmp115_ = self->priv->scroll_to_command_action;
	g_action_map_add_action ((GActionMap*) _tmp114_, (GAction*) _tmp115_);
	_tmp116_ = g_simple_action_new ("select-all", NULL);
	select_all_action = _tmp116_;
	_tmp117_ = select_all_action;
	g_signal_connect_object (_tmp117_, "activate", (GCallback) _vte_terminal_select_all_g_simple_action_activate, (VteTerminal*) self, 0);
	_tmp118_ = action_group;
	_tmp119_ = select_all_action;
	g_action_map_add_action ((GActionMap*) _tmp118_, (GAction*) _tmp119_);
	_g_object_unref0 (select_all_action);
	_g_object_unref0 (reload_action);
	_g_object_unref0 (action_group);
	_g_object_unref0 (drop_target);
	_g_object_unref0 (shortcut_controller);
	_g_object_unref0 (copy_output_shortcut);
	_g_object_unref0 (scroll_to_command_shortcut);
	_g_object_unref0 (reload_shortcut);
	_g_object_unref0 (select_all_shortcut);
	_g_object_unref0 (long_press_controller);
	_g_object_unref0 (click_controller);
	_g_object_unref0 (focus_controller);
	_g_object_unref0 (key_controller);
	_g_object_unref0 (motion_controller);
	_g_object_unref0 (granite_settings);
	return obj;
}

static void
terminal_terminal_widget_class_init (TerminalTerminalWidgetClass * klass,
                                     gpointer klass_data)
{
	terminal_terminal_widget_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TerminalTerminalWidget_private_offset);
	((VteTerminalClass *) klass)->copy_clipboard = (void (*) (VteTerminal*)) terminal_terminal_widget_real_copy_clipboard;
	((VteTerminalClass *) klass)->paste_clipboard = (void (*) (VteTerminal*)) terminal_terminal_widget_real_paste_clipboard;
	((VteTerminalClass *) klass)->increase_font_size = (void (*) (VteTerminal*)) terminal_terminal_widget_real_increase_font_size;
	((VteTerminalClass *) klass)->decrease_font_size = (void (*) (VteTerminal*)) terminal_terminal_widget_real_decrease_font_size;
	G_OBJECT_CLASS (klass)->get_property = _vala_terminal_terminal_widget_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_terminal_terminal_widget_set_property;
	G_OBJECT_CLASS (klass)->constructor = terminal_terminal_widget_constructor;
	G_OBJECT_CLASS (klass)->finalize = terminal_terminal_widget_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TERMINAL_TERMINAL_WIDGET_CURRENT_WORKING_DIRECTORY_PROPERTY, terminal_terminal_widget_properties[TERMINAL_TERMINAL_WIDGET_CURRENT_WORKING_DIRECTORY_PROPERTY] = g_param_spec_string ("current-working-directory", "current-working-directory", "current-working-directory", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TERMINAL_TERMINAL_WIDGET_PROGRAM_STRING_PROPERTY, terminal_terminal_widget_properties[TERMINAL_TERMINAL_WIDGET_PROGRAM_STRING_PROPERTY] = g_param_spec_string ("program-string", "program-string", "program-string", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TERMINAL_TERMINAL_WIDGET_TAB_STATE_PROPERTY, terminal_terminal_widget_properties[TERMINAL_TERMINAL_WIDGET_TAB_STATE_PROPERTY] = g_param_spec_enum ("tab-state", "tab-state", "tab-state", TERMINAL_TERMINAL_WIDGET_TYPE_TAB_STATE, TERMINAL_TERMINAL_WIDGET_TAB_STATE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TERMINAL_TERMINAL_WIDGET_KILLED_PROPERTY, terminal_terminal_widget_properties[TERMINAL_TERMINAL_WIDGET_KILLED_PROPERTY] = g_param_spec_boolean ("killed", "killed", "killed", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	terminal_terminal_widget_signals[TERMINAL_TERMINAL_WIDGET_CWD_CHANGED_SIGNAL] = g_signal_new ("cwd-changed", TERMINAL_TYPE_TERMINAL_WIDGET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	terminal_terminal_widget_signals[TERMINAL_TERMINAL_WIDGET_FOREGROUND_PROCESS_CHANGED_SIGNAL] = g_signal_new ("foreground-process-changed", TERMINAL_TYPE_TERMINAL_WIDGET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
terminal_terminal_widget_instance_init (TerminalTerminalWidget * self,
                                        gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	self->priv = terminal_terminal_widget_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->_current_working_directory = _tmp0_;
	_tmp1_ = g_strdup ("");
	self->priv->_program_string = _tmp1_;
	self->priv->_tab_state = TERMINAL_TERMINAL_WIDGET_TAB_STATE_NONE;
	self->priv->_killed = FALSE;
	self->priv->remembered_command_start_row = (glong) 0;
	self->priv->remembered_command_end_row = (glong) 0;
	self->priv->last_key_was_return = TRUE;
	self->priv->child_has_exited = FALSE;
	self->priv->link_uri = NULL;
	self->priv->scroll_delta = 0.0;
	_tmp2_ = g_strdup ("");
	self->priv->old_loc = _tmp2_;
	self->priv->contents_changed_timeout_id = (guint) 0;
	self->priv->contents_changed_continue = TRUE;
}

static void
terminal_terminal_widget_finalize (GObject * obj)
{
	TerminalTerminalWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_TYPE_TERMINAL_WIDGET, TerminalTerminalWidget);
	_g_free0 (self->terminal_id);
	_g_free0 (self->priv->_current_working_directory);
	_g_free0 (self->priv->_program_string);
	_g_object_unref0 (self->priv->open_in_browser_action);
	_g_object_unref0 (self->priv->copy_action);
	_g_object_unref0 (self->priv->copy_output_action);
	_g_object_unref0 (self->priv->clear_screen_action);
	_g_object_unref0 (self->priv->reset_action);
	_g_object_unref0 (self->priv->paste_action);
	_g_object_unref0 (self->priv->scroll_to_command_action);
	_g_free0 (self->priv->link_uri);
	_g_object_unref0 (self->priv->scroll_controller);
	_g_free0 (self->priv->old_loc);
	G_OBJECT_CLASS (terminal_terminal_widget_parent_class)->finalize (obj);
}

static GType
terminal_terminal_widget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TerminalTerminalWidgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) terminal_terminal_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TerminalTerminalWidget), 0, (GInstanceInitFunc) terminal_terminal_widget_instance_init, NULL };
	GType terminal_terminal_widget_type_id;
	terminal_terminal_widget_type_id = g_type_register_static (vte_terminal_get_type (), "TerminalTerminalWidget", &g_define_type_info, 0);
	TerminalTerminalWidget_private_offset = g_type_add_instance_private (terminal_terminal_widget_type_id, sizeof (TerminalTerminalWidgetPrivate));
	return terminal_terminal_widget_type_id;
}

GType
terminal_terminal_widget_get_type (void)
{
	static volatile gsize terminal_terminal_widget_type_id__once = 0;
	if (g_once_init_enter (&terminal_terminal_widget_type_id__once)) {
		GType terminal_terminal_widget_type_id;
		terminal_terminal_widget_type_id = terminal_terminal_widget_get_type_once ();
		g_once_init_leave (&terminal_terminal_widget_type_id__once, terminal_terminal_widget_type_id);
	}
	return terminal_terminal_widget_type_id__once;
}

static void
_vala_terminal_terminal_widget_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	TerminalTerminalWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TERMINAL_TYPE_TERMINAL_WIDGET, TerminalTerminalWidget);
	switch (property_id) {
		case TERMINAL_TERMINAL_WIDGET_CURRENT_WORKING_DIRECTORY_PROPERTY:
		g_value_set_string (value, terminal_terminal_widget_get_current_working_directory (self));
		break;
		case TERMINAL_TERMINAL_WIDGET_PROGRAM_STRING_PROPERTY:
		g_value_set_string (value, terminal_terminal_widget_get_program_string (self));
		break;
		case TERMINAL_TERMINAL_WIDGET_TAB_STATE_PROPERTY:
		g_value_set_enum (value, terminal_terminal_widget_get_tab_state (self));
		break;
		case TERMINAL_TERMINAL_WIDGET_KILLED_PROPERTY:
		g_value_set_boolean (value, terminal_terminal_widget_get_killed (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_terminal_terminal_widget_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	TerminalTerminalWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TERMINAL_TYPE_TERMINAL_WIDGET, TerminalTerminalWidget);
	switch (property_id) {
		case TERMINAL_TERMINAL_WIDGET_CURRENT_WORKING_DIRECTORY_PROPERTY:
		terminal_terminal_widget_set_current_working_directory (self, g_value_get_string (value));
		break;
		case TERMINAL_TERMINAL_WIDGET_PROGRAM_STRING_PROPERTY:
		terminal_terminal_widget_set_program_string (self, g_value_get_string (value));
		break;
		case TERMINAL_TERMINAL_WIDGET_TAB_STATE_PROPERTY:
		terminal_terminal_widget_set_tab_state (self, g_value_get_enum (value));
		break;
		case TERMINAL_TERMINAL_WIDGET_KILLED_PROPERTY:
		terminal_terminal_widget_set_killed (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

