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

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

#include <granite-7.h>
#include <glib-object.h>
#include <adwaita.h>
#include <gtk/gtk.h>
#include <pango/pango.h>
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <vte/vte.h>
#include <float.h>
#include <math.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>

#define TERMINAL_TERMINAL_VIEW_TAB_HISTORY_MAX_ITEMS 20
#define TERMINAL_MAIN_WINDOW_ACTION_PREFIX "win."
#define TERMINAL_MAIN_WINDOW_ACTION_RESTORE_CLOSED_TAB "action-restore-closed-tab"
#define TERMINAL_TERMINAL_WIDGET_DEFAULT_LABEL _ ("Terminal")
#define TERMINAL_MAIN_WINDOW_ACTION_CLOSE_OTHER_TABS "action_close_other_tabs"
#define TERMINAL_MAIN_WINDOW_ACTION_CLOSE_TABS_TO_RIGHT "action_close_tabs_to_right"
#define TERMINAL_MAIN_WINDOW_ACTION_MOVE_TAB_TO_NEW_WINDOW "action-move-tab-to-new-window"
#define TERMINAL_MAIN_WINDOW_ACTION_CLOSE_TAB "action-close-tab"
#define TERMINAL_MAIN_WINDOW_ACTION_DUPLICATE_TAB "action-duplicate-tab"
#define TERMINAL_MAIN_WINDOW_ACTION_TAB_RELOAD "action-tab_reload"
#define TERMINAL_MAIN_WINDOW_ACTION_NEW_TAB_AT "action-new-tab-at"
#define TERMINAL_MAIN_WINDOW_ACTION_TAB_ACTIVE_SHELL "action-tab_active_shell"
#define TERMINAL_MAIN_WINDOW_ACTION_NEW_TAB "action-term_widgetnew-tab"
#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

#define TERMINAL_TYPE_TERMINAL_VIEW (terminal_terminal_view_get_type ())
#define TERMINAL_TERMINAL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_TYPE_TERMINAL_VIEW, TerminalTerminalView))
#define TERMINAL_TERMINAL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_TERMINAL_VIEW, TerminalTerminalViewClass))
#define TERMINAL_IS_TERMINAL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_TYPE_TERMINAL_VIEW))
#define TERMINAL_IS_TERMINAL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_TERMINAL_VIEW))
#define TERMINAL_TERMINAL_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_TERMINAL_VIEW, TerminalTerminalViewClass))

typedef struct _TerminalTerminalView TerminalTerminalView;
typedef struct _TerminalTerminalViewClass TerminalTerminalViewClass;
typedef struct _TerminalTerminalViewPrivate TerminalTerminalViewPrivate;

#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;

#define TERMINAL_WIDGETS_TYPE_ZOOM_OVERLAY (terminal_widgets_zoom_overlay_get_type ())
#define TERMINAL_WIDGETS_ZOOM_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_WIDGETS_TYPE_ZOOM_OVERLAY, TerminalWidgetsZoomOverlay))
#define TERMINAL_WIDGETS_ZOOM_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_WIDGETS_TYPE_ZOOM_OVERLAY, TerminalWidgetsZoomOverlayClass))
#define TERMINAL_WIDGETS_IS_ZOOM_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_WIDGETS_TYPE_ZOOM_OVERLAY))
#define TERMINAL_WIDGETS_IS_ZOOM_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_WIDGETS_TYPE_ZOOM_OVERLAY))
#define TERMINAL_WIDGETS_ZOOM_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_WIDGETS_TYPE_ZOOM_OVERLAY, TerminalWidgetsZoomOverlayClass))

typedef struct _TerminalWidgetsZoomOverlay TerminalWidgetsZoomOverlay;
typedef struct _TerminalWidgetsZoomOverlayClass TerminalWidgetsZoomOverlayClass;
enum  {
	TERMINAL_TERMINAL_VIEW_0_PROPERTY,
	TERMINAL_TERMINAL_VIEW_N_PAGES_PROPERTY,
	TERMINAL_TERMINAL_VIEW_SELECTED_PAGE_PROPERTY,
	TERMINAL_TERMINAL_VIEW_MAIN_WINDOW_PROPERTY,
	TERMINAL_TERMINAL_VIEW_TAB_BAR_PROPERTY,
	TERMINAL_TERMINAL_VIEW_TAB_VIEW_PROPERTY,
	TERMINAL_TERMINAL_VIEW_TAB_MENU_TARGET_PROPERTY,
	TERMINAL_TERMINAL_VIEW_NUM_PROPERTIES
};
static GParamSpec* terminal_terminal_view_properties[TERMINAL_TERMINAL_VIEW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define __vala_PangoFontDescription_free0(var) ((var == NULL) ? NULL : (var = (_vala_PangoFontDescription_free (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#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 _Block3Data Block3Data;
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 ())
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _TerminalTerminalView {
	GraniteBin parent_instance;
	TerminalTerminalViewPrivate * priv;
};

struct _TerminalTerminalViewClass {
	GraniteBinClass parent_class;
};

struct _TerminalTerminalViewPrivate {
	TerminalMainWindow* _main_window;
	AdwTabBar* _tab_bar;
	AdwTabView* _tab_view;
	AdwTabPage* _tab_menu_target;
	TerminalWidgetsZoomOverlay* zoom_overlay;
	GtkMenuButton* tab_history_button;
	PangoFontDescription* term_font;
	guint tab_number_timeout;
	gboolean tab_numbers_showing;
};

struct _Block3Data {
	int _ref_count_;
	TerminalTerminalView* self;
	TerminalTerminalWidget* terminal_widget;
	AdwTabPage* tab;
};

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

struct _TerminalTerminalWidgetClass {
	VteTerminalClass parent_class;
};

static gint TerminalTerminalView_private_offset;
static gpointer terminal_terminal_view_parent_class = NULL;
static GSettings* terminal_terminal_view_gnome_interface_settings;
static GSettings* terminal_terminal_view_gnome_interface_settings = NULL;
VALA_EXTERN GSettings* terminal_application_settings;
VALA_EXTERN GSettings* terminal_application_saved_state;

VALA_EXTERN GType terminal_terminal_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TerminalTerminalView, g_object_unref)
VALA_EXTERN GType terminal_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TerminalMainWindow, g_object_unref)
VALA_EXTERN GType terminal_widgets_zoom_overlay_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TerminalWidgetsZoomOverlay, g_object_unref)
static void _vala_PangoFontDescription_free (PangoFontDescription* self);
VALA_EXTERN TerminalTerminalView* terminal_terminal_view_new (TerminalMainWindow* window);
VALA_EXTERN TerminalTerminalView* terminal_terminal_view_construct (GType object_type,
                                                        TerminalMainWindow* window);
VALA_EXTERN void terminal_terminal_view_make_restorable (TerminalTerminalView* self,
                                             const gchar* path);
VALA_EXTERN GType terminal_terminal_widget_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TerminalTerminalWidget, g_object_unref)
VALA_EXTERN TerminalTerminalWidget* terminal_terminal_view_add_new_tab (TerminalTerminalView* self,
                                                            const gchar* location,
                                                            const gchar* program,
                                                            gint pos);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
VALA_EXTERN gint terminal_terminal_view_get_n_pages (TerminalTerminalView* self);
VALA_EXTERN TerminalTerminalWidget* terminal_terminal_widget_new (void);
VALA_EXTERN TerminalTerminalWidget* terminal_terminal_widget_construct (GType object_type);
static void __lambda13_ (TerminalTerminalView* self,
                  GObject* obj,
                  GParamSpec* pspec);
VALA_EXTERN void terminal_widgets_zoom_overlay_show_zoom_level (TerminalWidgetsZoomOverlay* self,
                                                    gdouble zoom_level);
static TerminalMainWindow* terminal_terminal_view_get_main_window (TerminalTerminalView* self);
VALA_EXTERN void terminal_main_window_save_opened_terminals (TerminalMainWindow* self,
                                                 gboolean save_tabs,
                                                 gboolean save_zooms);
static void ___lambda13__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
VALA_EXTERN AdwTabView* terminal_terminal_view_get_tab_view (TerminalTerminalView* self);
static void __lambda14_ (Block3Data* _data3_);
VALA_EXTERN GType terminal_terminal_widget_tab_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN TerminalTerminalWidgetTabState terminal_terminal_widget_get_tab_state (TerminalTerminalWidget* self);
VALA_EXTERN GIcon* terminal_terminal_widget_tab_state_to_icon (TerminalTerminalWidgetTabState self);
static void ___lambda14__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
static TerminalTerminalWidget* terminal_terminal_view_get_term_widget (AdwTabPage* tab);
VALA_EXTERN void terminal_terminal_view_set_selected_page (TerminalTerminalView* self,
                                               AdwTabPage* value);
VALA_EXTERN void terminal_terminal_widget_active_shell (TerminalTerminalWidget* self,
                                            const gchar* dir);
VALA_EXTERN void terminal_terminal_widget_run_program (TerminalTerminalWidget* self,
                                           const gchar* program);
VALA_EXTERN void terminal_terminal_view_close_tab (TerminalTerminalView* self);
VALA_EXTERN AdwTabPage* terminal_terminal_view_get_tab_menu_target (TerminalTerminalView* self);
VALA_EXTERN void terminal_terminal_view_close_tabs_to_right (TerminalTerminalView* self);
VALA_EXTERN void terminal_terminal_view_close_other_tabs (TerminalTerminalView* self);
VALA_EXTERN void terminal_terminal_view_cycle_tabs (TerminalTerminalView* self,
                                        AdwNavigationDirection direction);
VALA_EXTERN AdwTabPage* terminal_terminal_view_get_selected_page (TerminalTerminalView* self);
VALA_EXTERN void terminal_terminal_view_transfer_tab_to_window (TerminalTerminalView* self,
                                                    TerminalMainWindow* window);
VALA_EXTERN TerminalTerminalView* terminal_main_window_get_notebook (TerminalMainWindow* self);
static void terminal_terminal_view_tab_view_setup_menu (TerminalTerminalView* self,
                                                 AdwTabPage* page);
static void terminal_terminal_view_set_tab_menu_target (TerminalTerminalView* self,
                                                 AdwTabPage* value);
VALA_EXTERN GSimpleActionGroup* terminal_main_window_get_actions (TerminalMainWindow* self);
VALA_EXTERN GSimpleAction* terminal_utils_action_from_group (const gchar* action_name,
                                                 GSimpleActionGroup* action_group);
static void terminal_terminal_view_key_released (TerminalTerminalView* self,
                                          guint keyval,
                                          guint keycode,
                                          GdkModifierType modifiers);
static void terminal_terminal_view_cancel_tab_numbers (TerminalTerminalView* self);
static gboolean terminal_terminal_view_key_pressed (TerminalTerminalView* self,
                                             guint keyval,
                                             guint keycode,
                                             GdkModifierType modifiers);
static void terminal_terminal_view_show_tab_numbers (TerminalTerminalView* self);
static void terminal_terminal_view_schedule_tab_numbers (TerminalTerminalView* self);
static gboolean __lambda17_ (TerminalTerminalView* self);
static gboolean ___lambda17__gsource_func (gpointer self);
static void terminal_terminal_view_update_font (TerminalTerminalView* self);
VALA_EXTERN void terminal_terminal_view_after_tab_restored (TerminalTerminalView* self,
                                                const gchar* path);
static GMenu* terminal_terminal_view_create_menu_model (void);
static void terminal_terminal_view_on_add_button_target_value_changed (GObject* obj,
                                                                GParamSpec* pspec);
VALA_EXTERN gboolean terminal_utils_valid_local_uri (const gchar* s,
                                         gchar** path);
static gboolean terminal_terminal_view_on_add_button_drop (TerminalTerminalView* self,
                                                    GValue* val,
                                                    gdouble x,
                                                    gdouble y);
static GVariant* _variant_new1 (const gchar* value);
static gboolean terminal_terminal_view_on_tab_bar_extra_drag_drop (TerminalTerminalView* self,
                                                            AdwTabPage* tab,
                                                            GValue* val);
static GVariant* _variant_new2 (const gchar* value);
static void terminal_terminal_view_set_main_window (TerminalTerminalView* self,
                                             TerminalMainWindow* value);
VALA_EXTERN AdwTabBar* terminal_terminal_view_get_tab_bar (TerminalTerminalView* self);
static void terminal_terminal_view_set_tab_bar (TerminalTerminalView* self,
                                         AdwTabBar* value);
static void terminal_terminal_view_set_tab_view (TerminalTerminalView* self,
                                          AdwTabView* value);
static GObject * terminal_terminal_view_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties);
static void _terminal_terminal_view_tab_view_setup_menu_adw_tab_view_setup_menu (AdwTabView* _sender,
                                                                          AdwTabPage* page,
                                                                          gpointer self);
VALA_EXTERN TerminalWidgetsZoomOverlay* terminal_widgets_zoom_overlay_new (GtkOverlay* overlay);
VALA_EXTERN TerminalWidgetsZoomOverlay* terminal_widgets_zoom_overlay_construct (GType object_type,
                                                                     GtkOverlay* overlay);
static void _terminal_terminal_view___lambda18_ (TerminalTerminalView* self);
static void __terminal_terminal_view___lambda18__g_settings_changed (GSettings* _sender,
                                                              const gchar* key,
                                                              gpointer self);
static void _terminal_terminal_view_on_add_button_target_value_changed_g_object_notify (GObject* _sender,
                                                                                 GParamSpec* pspec,
                                                                                 gpointer self);
static gboolean _terminal_terminal_view_on_add_button_drop_gtk_drop_target_drop (GtkDropTarget* _sender,
                                                                          GValue* value,
                                                                          gdouble x,
                                                                          gdouble y,
                                                                          gpointer self);
VALA_EXTERN void terminal_widgets_zoom_overlay_hide_zoom_level (TerminalWidgetsZoomOverlay* self);
static void _terminal_widgets_zoom_overlay_hide_zoom_level_g_object_notify (GObject* _sender,
                                                                     GParamSpec* pspec,
                                                                     gpointer self);
static gboolean _terminal_terminal_view_on_tab_bar_extra_drag_drop_adw_tab_bar_extra_drag_drop (AdwTabBar* _sender,
                                                                                         AdwTabPage* page,
                                                                                         GValue* value,
                                                                                         gpointer self);
static gboolean _terminal_terminal_view_key_pressed_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                                   guint keyval,
                                                                                   guint keycode,
                                                                                   GdkModifierType state,
                                                                                   gpointer self);
static void _terminal_terminal_view_key_released_gtk_event_controller_key_key_released (GtkEventControllerKey* _sender,
                                                                                 guint keyval,
                                                                                 guint keycode,
                                                                                 GdkModifierType state,
                                                                                 gpointer self);
static void _terminal_terminal_view___lambda19_ (TerminalTerminalView* self);
static void __terminal_terminal_view___lambda19__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                                            gpointer self);
static void _terminal_terminal_view_update_font_g_settings_changed (GSettings* _sender,
                                                             const gchar* key,
                                                             gpointer self);
static void terminal_terminal_view_finalize (GObject * obj);
static GType terminal_terminal_view_get_type_once (void);
static void _vala_terminal_terminal_view_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec);
static void _vala_terminal_terminal_view_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
terminal_terminal_view_get_instance_private (TerminalTerminalView* self)
{
	return G_STRUCT_MEMBER_P (self, TerminalTerminalView_private_offset);
}

static void
_vala_PangoFontDescription_free (PangoFontDescription* self)
{
	g_boxed_free (pango_font_description_get_type (), self);
}

TerminalTerminalView*
terminal_terminal_view_construct (GType object_type,
                                  TerminalMainWindow* window)
{
	TerminalTerminalView * self = NULL;
	g_return_val_if_fail (window != NULL, NULL);
	self = (TerminalTerminalView*) g_object_new (object_type, "main-window", window, NULL);
	return self;
}

TerminalTerminalView*
terminal_terminal_view_new (TerminalMainWindow* window)
{
	return terminal_terminal_view_construct (TERMINAL_TYPE_TERMINAL_VIEW, window);
}

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

void
terminal_terminal_view_make_restorable (TerminalTerminalView* self,
                                        const gchar* path)
{
	GtkMenuButton* _tmp0_;
	GMenuModel* _tmp1_;
	GMenuModel* _tmp2_;
	GMenu* menu = NULL;
	GtkMenuButton* _tmp9_;
	GMenuModel* _tmp10_;
	GMenuModel* _tmp11_;
	GMenu* _tmp12_;
	gint position_in_menu = 0;
	GMenu* _tmp23_;
	GMenu* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	_tmp0_ = self->priv->tab_history_button;
	_tmp1_ = gtk_menu_button_get_menu_model (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		GtkMenuButton* _tmp3_;
		GMenu* _tmp4_;
		GMenu* _tmp5_;
		GtkMenuButton* _tmp6_;
		GtkPopover* _tmp7_;
		GtkPopover* _tmp8_;
		_tmp3_ = self->priv->tab_history_button;
		_tmp4_ = g_menu_new ();
		_tmp5_ = _tmp4_;
		gtk_menu_button_set_menu_model (_tmp3_, (GMenuModel*) _tmp5_);
		_g_object_unref0 (_tmp5_);
		_tmp6_ = self->priv->tab_history_button;
		_tmp7_ = gtk_menu_button_get_popover (_tmp6_);
		_tmp8_ = _tmp7_;
		gtk_popover_set_has_arrow (_tmp8_, FALSE);
	}
	_tmp9_ = self->priv->tab_history_button;
	_tmp10_ = gtk_menu_button_get_menu_model (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, g_menu_get_type (), GMenu));
	menu = _tmp12_;
	position_in_menu = -1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp13_ = FALSE;
			_tmp13_ = TRUE;
			while (TRUE) {
				GMenu* _tmp15_;
				GMenu* _tmp16_;
				const GVariantType* _tmp17_;
				GVariant* _tmp18_;
				GVariant* _tmp19_;
				const gchar* _tmp20_;
				gboolean _tmp21_;
				if (!_tmp13_) {
					gint _tmp14_;
					_tmp14_ = i;
					i = _tmp14_ + 1;
				}
				_tmp13_ = FALSE;
				_tmp15_ = menu;
				if (!(i < g_menu_model_get_n_items ((GMenuModel*) _tmp15_))) {
					break;
				}
				_tmp16_ = menu;
				_tmp17_ = G_VARIANT_TYPE_STRING;
				_tmp18_ = g_menu_model_get_item_attribute_value ((GMenuModel*) _tmp16_, i, G_MENU_ATTRIBUTE_TARGET, _tmp17_);
				_tmp19_ = _tmp18_;
				_tmp20_ = g_variant_get_string (_tmp19_, NULL);
				_tmp21_ = g_strcmp0 (path, _tmp20_) == 0;
				_g_variant_unref0 (_tmp19_);
				if (_tmp21_) {
					position_in_menu = i;
					break;
				}
			}
		}
	}
	if (position_in_menu != -1) {
		GMenu* _tmp22_;
		_tmp22_ = menu;
		g_menu_remove (_tmp22_, position_in_menu);
	}
	_tmp23_ = menu;
	if (g_menu_model_get_n_items ((GMenuModel*) _tmp23_) >= TERMINAL_TERMINAL_VIEW_TAB_HISTORY_MAX_ITEMS) {
		GMenu* _tmp24_;
		_tmp24_ = menu;
		g_menu_remove (_tmp24_, TERMINAL_TERMINAL_VIEW_TAB_HISTORY_MAX_ITEMS - 1);
	}
	_tmp25_ = menu;
	_tmp26_ = g_strdup_printf ("%s::%s", TERMINAL_MAIN_WINDOW_ACTION_PREFIX TERMINAL_MAIN_WINDOW_ACTION_RESTORE_CLOSED_TAB, path);
	_tmp27_ = _tmp26_;
	g_menu_prepend (_tmp25_, path, _tmp27_);
	_g_free0 (_tmp27_);
	_g_object_unref0 (menu);
}

static Block3Data*
block3_data_ref (Block3Data* _data3_)
{
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}

static void
block3_data_unref (void * _userdata_)
{
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		TerminalTerminalView* self;
		self = _data3_->self;
		_g_object_unref0 (_data3_->terminal_widget);
		_g_object_unref0 (self);
		g_slice_free (Block3Data, _data3_);
	}
}

static void
__lambda13_ (TerminalTerminalView* self,
             GObject* obj,
             GParamSpec* pspec)
{
	TerminalWidgetsZoomOverlay* _tmp0_;
	gdouble _tmp1_;
	gdouble _tmp2_;
	TerminalMainWindow* _tmp3_;
	g_return_if_fail (obj != NULL);
	g_return_if_fail (pspec != NULL);
	_tmp0_ = self->priv->zoom_overlay;
	_tmp1_ = vte_terminal_get_font_scale ((VteTerminal*) G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_TYPE_TERMINAL_WIDGET, TerminalTerminalWidget));
	_tmp2_ = _tmp1_;
	terminal_widgets_zoom_overlay_show_zoom_level (_tmp0_, _tmp2_);
	_tmp3_ = self->priv->_main_window;
	terminal_main_window_save_opened_terminals (_tmp3_, FALSE, TRUE);
}

static void
___lambda13__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	__lambda13_ ((TerminalTerminalView*) self, _sender, pspec);
}

static void
__lambda14_ (Block3Data* _data3_)
{
	TerminalTerminalView* self;
	AdwTabPage* _tmp0_;
	TerminalTerminalWidget* _tmp1_;
	TerminalTerminalWidgetTabState _tmp2_;
	TerminalTerminalWidgetTabState _tmp3_;
	GIcon* _tmp4_;
	GIcon* _tmp5_;
	AdwTabPage* _tmp6_;
	TerminalTerminalWidget* _tmp7_;
	TerminalTerminalWidgetTabState _tmp8_;
	TerminalTerminalWidgetTabState _tmp9_;
	self = _data3_->self;
	_tmp0_ = _data3_->tab;
	_tmp1_ = _data3_->terminal_widget;
	_tmp2_ = terminal_terminal_widget_get_tab_state (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = terminal_terminal_widget_tab_state_to_icon (_tmp3_);
	_tmp5_ = _tmp4_;
	adw_tab_page_set_icon (_tmp0_, _tmp5_);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = _data3_->tab;
	_tmp7_ = _data3_->terminal_widget;
	_tmp8_ = terminal_terminal_widget_get_tab_state (_tmp7_);
	_tmp9_ = _tmp8_;
	adw_tab_page_set_needs_attention (_tmp6_, _tmp9_ == TERMINAL_TERMINAL_WIDGET_TAB_STATE_ATTENTION);
}

static void
___lambda14__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	__lambda14_ (self);
}

TerminalTerminalWidget*
terminal_terminal_view_add_new_tab (TerminalTerminalView* self,
                                    const gchar* location,
                                    const gchar* program,
                                    gint pos)
{
	Block3Data* _data3_;
	GSettings* _tmp2_;
	TerminalTerminalWidget* _tmp3_ = NULL;
	TerminalTerminalWidget* _tmp4_;
	GtkScrolledWindow* scrolled = NULL;
	TerminalTerminalWidget* _tmp5_;
	GtkAdjustment* _tmp6_;
	GtkAdjustment* _tmp7_;
	GtkAdjustment* _tmp8_;
	TerminalTerminalWidget* _tmp9_;
	GtkWidget* _tmp10_;
	GtkScrolledWindow* _tmp11_ = NULL;
	AdwTabView* _tmp12_;
	GtkScrolledWindow* _tmp13_;
	AdwTabPage* _tmp14_;
	gchar* _tmp15_ = NULL;
	AdwTabPage* _tmp18_;
	TerminalTerminalWidget* _tmp19_;
	AdwTabPage* _tmp20_;
	TerminalTerminalWidget* _tmp21_;
	AdwTabPage* _tmp22_;
	TerminalTerminalWidget* _tmp23_;
	TerminalTerminalWidget* _tmp24_;
	PangoFontDescription* _tmp25_;
	TerminalTerminalWidget* current_terminal = NULL;
	AdwTabView* _tmp26_;
	AdwTabPage* _tmp27_;
	AdwTabPage* _tmp28_;
	TerminalTerminalWidget* _tmp29_;
	TerminalTerminalWidget* _tmp30_;
	TerminalTerminalWidget* _tmp31_;
	AdwTabPage* _tmp38_;
	gint _tmp43_;
	gint _tmp44_;
	TerminalMainWindow* _tmp46_;
	TerminalTerminalWidget* _tmp47_;
	TerminalTerminalWidget* _tmp48_;
	TerminalTerminalWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (program != NULL, NULL);
	_data3_ = g_slice_new0 (Block3Data);
	_data3_->_ref_count_ = 1;
	_data3_->self = g_object_ref (self);
	if (pos == -1) {
		gint _tmp0_;
		gint _tmp1_;
		_tmp0_ = terminal_terminal_view_get_n_pages (self);
		_tmp1_ = _tmp0_;
		pos = _tmp1_;
	}
	_tmp2_ = terminal_application_settings;
	_tmp3_ = terminal_terminal_widget_new ();
	vte_terminal_set_scrollback_lines ((VteTerminal*) _tmp3_, (guint) g_settings_get_int (_tmp2_, "scrollback-lines"));
	vte_terminal_set_enable_fallback_scrolling ((VteTerminal*) _tmp3_, FALSE);
	vte_terminal_set_scroll_unit_is_pixels ((VteTerminal*) _tmp3_, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp3_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp3_, TRUE);
	g_object_ref_sink (_tmp3_);
	_data3_->terminal_widget = _tmp3_;
	_tmp4_ = _data3_->terminal_widget;
	g_signal_connect_object ((GObject*) _tmp4_, "notify::font-scale", (GCallback) ___lambda13__g_object_notify, self, 0);
	_tmp5_ = _data3_->terminal_widget;
	_tmp6_ = gtk_scrollable_get_vadjustment ((GtkScrollable*) _tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	_tmp9_ = _data3_->terminal_widget;
	_tmp10_ = _g_object_ref0 ((GtkWidget*) _tmp9_);
	_tmp11_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	gtk_scrolled_window_set_vadjustment (_tmp11_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	gtk_scrolled_window_set_child (_tmp11_, _tmp10_);
	_g_object_unref0 (_tmp10_);
	g_object_ref_sink (_tmp11_);
	scrolled = _tmp11_;
	_tmp12_ = self->priv->_tab_view;
	_tmp13_ = scrolled;
	_tmp14_ = adw_tab_view_insert (_tmp12_, (GtkWidget*) _tmp13_, pos);
	_data3_->tab = _tmp14_;
	if (location != NULL) {
		gchar* _tmp16_;
		_tmp16_ = g_path_get_basename (location);
		_g_free0 (_tmp15_);
		_tmp15_ = _tmp16_;
	} else {
		gchar* _tmp17_;
		_tmp17_ = g_strdup (TERMINAL_TERMINAL_WIDGET_DEFAULT_LABEL);
		_g_free0 (_tmp15_);
		_tmp15_ = _tmp17_;
	}
	_tmp18_ = _data3_->tab;
	adw_tab_page_set_title (_tmp18_, _tmp15_);
	_tmp19_ = _data3_->terminal_widget;
	_tmp20_ = _data3_->tab;
	g_object_bind_property_with_closures ((GObject*) _tmp19_, "current-working-directory", (GObject*) _tmp20_, "tooltip", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp21_ = _data3_->terminal_widget;
	_tmp22_ = _data3_->tab;
	_tmp21_->tab = _tmp22_;
	_tmp23_ = _data3_->terminal_widget;
	g_signal_connect_data ((GObject*) _tmp23_, "notify::tab-state", (GCallback) ___lambda14__g_object_notify, block3_data_ref (_data3_), (GClosureNotify) block3_data_unref, 0);
	_tmp24_ = _data3_->terminal_widget;
	_tmp25_ = self->priv->term_font;
	vte_terminal_set_font ((VteTerminal*) _tmp24_, _tmp25_);
	_tmp26_ = self->priv->_tab_view;
	_tmp27_ = adw_tab_view_get_selected_page (_tmp26_);
	_tmp28_ = _tmp27_;
	_tmp29_ = terminal_terminal_view_get_term_widget (_tmp28_);
	_tmp30_ = _g_object_ref0 (_tmp29_);
	current_terminal = _tmp30_;
	_tmp31_ = current_terminal;
	if (_tmp31_ != NULL) {
		TerminalTerminalWidget* _tmp32_;
		TerminalTerminalWidget* _tmp33_;
		gdouble _tmp34_;
		gdouble _tmp35_;
		_tmp32_ = _data3_->terminal_widget;
		_tmp33_ = current_terminal;
		_tmp34_ = vte_terminal_get_font_scale ((VteTerminal*) _tmp33_);
		_tmp35_ = _tmp34_;
		vte_terminal_set_font_scale ((VteTerminal*) _tmp32_, _tmp35_);
	} else {
		TerminalTerminalWidget* _tmp36_;
		GSettings* _tmp37_;
		_tmp36_ = _data3_->terminal_widget;
		_tmp37_ = terminal_application_saved_state;
		vte_terminal_set_font_scale ((VteTerminal*) _tmp36_, g_settings_get_double (_tmp37_, "zoom"));
	}
	_tmp38_ = _data3_->tab;
	terminal_terminal_view_set_selected_page (self, _tmp38_);
	if (g_strcmp0 (location, "") == 0) {
		TerminalTerminalWidget* _tmp39_;
		gchar* _tmp40_;
		gchar* _tmp41_;
		_tmp39_ = _data3_->terminal_widget;
		_tmp40_ = g_get_current_dir ();
		_tmp41_ = _tmp40_;
		terminal_terminal_widget_active_shell (_tmp39_, _tmp41_);
		_g_free0 (_tmp41_);
	} else {
		TerminalTerminalWidget* _tmp42_;
		_tmp42_ = _data3_->terminal_widget;
		terminal_terminal_widget_active_shell (_tmp42_, location);
	}
	_tmp43_ = strlen (program);
	_tmp44_ = _tmp43_;
	if (_tmp44_ > 0) {
		TerminalTerminalWidget* _tmp45_;
		_tmp45_ = _data3_->terminal_widget;
		terminal_terminal_widget_run_program (_tmp45_, program);
	}
	_tmp46_ = self->priv->_main_window;
	terminal_main_window_save_opened_terminals (_tmp46_, TRUE, TRUE);
	_tmp47_ = _data3_->terminal_widget;
	_tmp48_ = _g_object_ref0 (_tmp47_);
	result = _tmp48_;
	_g_object_unref0 (current_terminal);
	_g_free0 (_tmp15_);
	_g_object_unref0 (scrolled);
	block3_data_unref (_data3_);
	_data3_ = NULL;
	return result;
}

void
terminal_terminal_view_close_tab (TerminalTerminalView* self)
{
	AdwTabPage* _tmp0_ = NULL;
	AdwTabPage* _tmp1_;
	AdwTabPage* target = NULL;
	AdwTabPage* _tmp5_;
	AdwTabPage* _tmp6_;
	AdwTabView* _tmp7_;
	AdwTabPage* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_tab_menu_target;
	_tmp0_ = _tmp1_;
	if (_tmp0_ == NULL) {
		AdwTabView* _tmp2_;
		AdwTabPage* _tmp3_;
		AdwTabPage* _tmp4_;
		_tmp2_ = self->priv->_tab_view;
		_tmp3_ = adw_tab_view_get_selected_page (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	}
	_tmp5_ = _g_object_ref0 (_tmp0_);
	target = _tmp5_;
	_tmp6_ = target;
	if (_tmp6_ == NULL) {
		_g_object_unref0 (target);
		return;
	}
	_tmp7_ = self->priv->_tab_view;
	_tmp8_ = target;
	adw_tab_view_close_page (_tmp7_, _tmp8_);
	_g_object_unref0 (target);
}

void
terminal_terminal_view_close_tabs_to_right (TerminalTerminalView* self)
{
	AdwTabPage* _tmp0_ = NULL;
	AdwTabPage* _tmp1_;
	AdwTabPage* target = NULL;
	AdwTabPage* _tmp5_;
	AdwTabPage* _tmp6_;
	AdwTabView* _tmp7_;
	AdwTabPage* _tmp8_;
	AdwTabView* _tmp9_;
	AdwTabPage* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_tab_menu_target;
	_tmp0_ = _tmp1_;
	if (_tmp0_ == NULL) {
		AdwTabView* _tmp2_;
		AdwTabPage* _tmp3_;
		AdwTabPage* _tmp4_;
		_tmp2_ = self->priv->_tab_view;
		_tmp3_ = adw_tab_view_get_selected_page (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	}
	_tmp5_ = _g_object_ref0 (_tmp0_);
	target = _tmp5_;
	_tmp6_ = target;
	if (_tmp6_ == NULL) {
		_g_object_unref0 (target);
		return;
	}
	_tmp7_ = self->priv->_tab_view;
	_tmp8_ = target;
	adw_tab_view_close_pages_after (_tmp7_, _tmp8_);
	_tmp9_ = self->priv->_tab_view;
	_tmp10_ = target;
	adw_tab_view_set_selected_page (_tmp9_, _tmp10_);
	_g_object_unref0 (target);
}

void
terminal_terminal_view_close_other_tabs (TerminalTerminalView* self)
{
	AdwTabPage* _tmp0_ = NULL;
	AdwTabPage* _tmp1_;
	AdwTabPage* target = NULL;
	AdwTabPage* _tmp5_;
	AdwTabPage* _tmp6_;
	AdwTabView* _tmp7_;
	AdwTabPage* _tmp8_;
	AdwTabView* _tmp9_;
	AdwTabPage* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_tab_menu_target;
	_tmp0_ = _tmp1_;
	if (_tmp0_ == NULL) {
		AdwTabView* _tmp2_;
		AdwTabPage* _tmp3_;
		AdwTabPage* _tmp4_;
		_tmp2_ = self->priv->_tab_view;
		_tmp3_ = adw_tab_view_get_selected_page (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	}
	_tmp5_ = _g_object_ref0 (_tmp0_);
	target = _tmp5_;
	_tmp6_ = target;
	if (_tmp6_ == NULL) {
		_g_object_unref0 (target);
		return;
	}
	_tmp7_ = self->priv->_tab_view;
	_tmp8_ = target;
	adw_tab_view_close_other_pages (_tmp7_, _tmp8_);
	_tmp9_ = self->priv->_tab_view;
	_tmp10_ = target;
	adw_tab_view_set_selected_page (_tmp9_, _tmp10_);
	_g_object_unref0 (target);
}

void
terminal_terminal_view_cycle_tabs (TerminalTerminalView* self,
                                   AdwNavigationDirection direction)
{
	gint pos = 0;
	AdwTabView* _tmp0_;
	AdwTabPage* _tmp1_;
	AdwTabPage* _tmp2_;
	gint _tmp3_ = 0;
	gint _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	AdwTabView* _tmp8_;
	AdwTabPage* _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_tab_view;
	_tmp1_ = terminal_terminal_view_get_selected_page (self);
	_tmp2_ = _tmp1_;
	pos = adw_tab_view_get_page_position (_tmp0_, _tmp2_);
	if (direction == ADW_NAVIGATION_DIRECTION_FORWARD) {
		_tmp3_ = pos + 1;
	} else {
		_tmp3_ = pos - 1;
	}
	pos = _tmp3_;
	_tmp4_ = terminal_terminal_view_get_n_pages (self);
	_tmp5_ = _tmp4_;
	_tmp6_ = terminal_terminal_view_get_n_pages (self);
	_tmp7_ = _tmp6_;
	pos = (pos + _tmp5_) % _tmp7_;
	_tmp8_ = self->priv->_tab_view;
	_tmp9_ = adw_tab_view_get_nth_page (_tmp8_, pos);
	terminal_terminal_view_set_selected_page (self, _tmp9_);
}

void
terminal_terminal_view_transfer_tab_to_window (TerminalTerminalView* self,
                                               TerminalMainWindow* window)
{
	AdwTabPage* _tmp0_ = NULL;
	AdwTabPage* _tmp1_;
	AdwTabPage* target = NULL;
	AdwTabPage* _tmp5_;
	AdwTabPage* _tmp6_;
	AdwTabView* _tmp7_;
	AdwTabPage* _tmp8_;
	TerminalTerminalView* _tmp9_;
	TerminalTerminalView* _tmp10_;
	AdwTabView* _tmp11_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	_tmp1_ = self->priv->_tab_menu_target;
	_tmp0_ = _tmp1_;
	if (_tmp0_ == NULL) {
		AdwTabView* _tmp2_;
		AdwTabPage* _tmp3_;
		AdwTabPage* _tmp4_;
		_tmp2_ = self->priv->_tab_view;
		_tmp3_ = adw_tab_view_get_selected_page (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	}
	_tmp5_ = _g_object_ref0 (_tmp0_);
	target = _tmp5_;
	_tmp6_ = target;
	if (_tmp6_ == NULL) {
		_g_object_unref0 (target);
		return;
	}
	_tmp7_ = self->priv->_tab_view;
	_tmp8_ = target;
	_tmp9_ = terminal_main_window_get_notebook (window);
	_tmp10_ = _tmp9_;
	_tmp11_ = _tmp10_->priv->_tab_view;
	adw_tab_view_transfer_page (_tmp7_, _tmp8_, _tmp11_, 0);
	_g_object_unref0 (target);
}

static void
terminal_terminal_view_tab_view_setup_menu (TerminalTerminalView* self,
                                            AdwTabPage* page)
{
	GSimpleActionGroup* actions = NULL;
	TerminalMainWindow* _tmp0_;
	GSimpleActionGroup* _tmp1_;
	GSimpleActionGroup* _tmp2_;
	GSimpleActionGroup* _tmp3_;
	GSimpleAction* close_other_tabs_action = NULL;
	GSimpleActionGroup* _tmp4_;
	GSimpleAction* _tmp5_;
	GSimpleAction* close_tabs_to_right_action = NULL;
	GSimpleActionGroup* _tmp6_;
	GSimpleAction* _tmp7_;
	GSimpleAction* open_in_new_window_action = NULL;
	GSimpleActionGroup* _tmp8_;
	GSimpleAction* _tmp9_;
	gint _tmp10_ = 0;
	gint page_position = 0;
	gboolean _tmp12_ = FALSE;
	GSimpleAction* _tmp16_;
	gboolean _tmp17_ = FALSE;
	GSimpleAction* _tmp21_;
	gboolean _tmp22_ = FALSE;
	GSimpleAction* _tmp26_;
	g_return_if_fail (self != NULL);
	terminal_terminal_view_set_tab_menu_target (self, page);
	_tmp0_ = self->priv->_main_window;
	_tmp1_ = terminal_main_window_get_actions (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	actions = _tmp3_;
	_tmp4_ = actions;
	_tmp5_ = terminal_utils_action_from_group (TERMINAL_MAIN_WINDOW_ACTION_CLOSE_OTHER_TABS, _tmp4_);
	close_other_tabs_action = _tmp5_;
	_tmp6_ = actions;
	_tmp7_ = terminal_utils_action_from_group (TERMINAL_MAIN_WINDOW_ACTION_CLOSE_TABS_TO_RIGHT, _tmp6_);
	close_tabs_to_right_action = _tmp7_;
	_tmp8_ = actions;
	_tmp9_ = terminal_utils_action_from_group (TERMINAL_MAIN_WINDOW_ACTION_MOVE_TAB_TO_NEW_WINDOW, _tmp8_);
	open_in_new_window_action = _tmp9_;
	if (page != NULL) {
		AdwTabView* _tmp11_;
		_tmp11_ = self->priv->_tab_view;
		_tmp10_ = adw_tab_view_get_page_position (_tmp11_, page);
	} else {
		_tmp10_ = -1;
	}
	page_position = _tmp10_;
	if (page != NULL) {
		AdwTabView* _tmp13_;
		gint _tmp14_;
		gint _tmp15_;
		_tmp13_ = self->priv->_tab_view;
		_tmp14_ = adw_tab_view_get_n_pages (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp12_ = _tmp15_ > 1;
	} else {
		_tmp12_ = FALSE;
	}
	_tmp16_ = close_other_tabs_action;
	g_simple_action_set_enabled (_tmp16_, _tmp12_);
	if (page != NULL) {
		AdwTabView* _tmp18_;
		gint _tmp19_;
		gint _tmp20_;
		_tmp18_ = self->priv->_tab_view;
		_tmp19_ = adw_tab_view_get_n_pages (_tmp18_);
		_tmp20_ = _tmp19_;
		_tmp17_ = page_position != (_tmp20_ - 1);
	} else {
		_tmp17_ = FALSE;
	}
	_tmp21_ = close_tabs_to_right_action;
	g_simple_action_set_enabled (_tmp21_, _tmp17_);
	if (page != NULL) {
		AdwTabView* _tmp23_;
		gint _tmp24_;
		gint _tmp25_;
		_tmp23_ = self->priv->_tab_view;
		_tmp24_ = adw_tab_view_get_n_pages (_tmp23_);
		_tmp25_ = _tmp24_;
		_tmp22_ = _tmp25_ > 1;
	} else {
		_tmp22_ = FALSE;
	}
	_tmp26_ = open_in_new_window_action;
	g_simple_action_set_enabled (_tmp26_, _tmp22_);
	_g_object_unref0 (open_in_new_window_action);
	_g_object_unref0 (close_tabs_to_right_action);
	_g_object_unref0 (close_other_tabs_action);
	_g_object_unref0 (actions);
}

static void
terminal_terminal_view_key_released (TerminalTerminalView* self,
                                     guint keyval,
                                     guint keycode,
                                     GdkModifierType modifiers)
{
	g_return_if_fail (self != NULL);
	terminal_terminal_view_cancel_tab_numbers (self);
}

static gboolean
terminal_terminal_view_key_pressed (TerminalTerminalView* self,
                                    guint keyval,
                                    guint keycode,
                                    GdkModifierType modifiers)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	switch (keyval) {
		case GDK_KEY_1:
		case GDK_KEY_2:
		case GDK_KEY_3:
		case GDK_KEY_4:
		case GDK_KEY_5:
		case GDK_KEY_6:
		case GDK_KEY_7:
		case GDK_KEY_8:
		{
			gboolean _tmp0_ = FALSE;
			if ((modifiers & GDK_ALT_MASK) == GDK_ALT_MASK) {
				GSettings* _tmp1_;
				_tmp1_ = terminal_application_settings;
				_tmp0_ = g_settings_get_boolean (_tmp1_, "alt-changes-tab");
			} else {
				_tmp0_ = FALSE;
			}
			if (_tmp0_) {
				gint tab_index = 0;
				gint _tmp2_;
				gint _tmp3_;
				tab_index = (gint) (keyval - GDK_KEY_1);
				_tmp2_ = terminal_terminal_view_get_n_pages (self);
				_tmp3_ = _tmp2_;
				if (tab_index < _tmp3_) {
					AdwTabView* _tmp4_;
					AdwTabPage* _tmp5_;
					_tmp4_ = self->priv->_tab_view;
					_tmp5_ = adw_tab_view_get_nth_page (_tmp4_, tab_index);
					terminal_terminal_view_set_selected_page (self, _tmp5_);
				}
				result = GDK_EVENT_STOP;
				return result;
			}
			break;
		}
		case GDK_KEY_9:
		{
			gboolean _tmp6_ = FALSE;
			gboolean _tmp7_ = FALSE;
			gint _tmp8_;
			gint _tmp9_;
			_tmp8_ = terminal_terminal_view_get_n_pages (self);
			_tmp9_ = _tmp8_;
			if (_tmp9_ > 0) {
				_tmp7_ = (modifiers & GDK_ALT_MASK) == GDK_ALT_MASK;
			} else {
				_tmp7_ = FALSE;
			}
			if (_tmp7_) {
				GSettings* _tmp10_;
				_tmp10_ = terminal_application_settings;
				_tmp6_ = g_settings_get_boolean (_tmp10_, "alt-changes-tab");
			} else {
				_tmp6_ = FALSE;
			}
			if (_tmp6_) {
				AdwTabView* _tmp11_;
				gint _tmp12_;
				gint _tmp13_;
				AdwTabPage* _tmp14_;
				_tmp11_ = self->priv->_tab_view;
				_tmp12_ = terminal_terminal_view_get_n_pages (self);
				_tmp13_ = _tmp12_;
				_tmp14_ = adw_tab_view_get_nth_page (_tmp11_, _tmp13_ - 1);
				terminal_terminal_view_set_selected_page (self, _tmp14_);
				result = GDK_EVENT_STOP;
				return result;
			}
			break;
		}
		case GDK_KEY_0:
		case GDK_KEY_KP_0:
		{
			gboolean _tmp15_ = FALSE;
			if ((modifiers & GDK_ALT_MASK) == GDK_ALT_MASK) {
				GSettings* _tmp16_;
				_tmp16_ = terminal_application_settings;
				_tmp15_ = g_settings_get_boolean (_tmp16_, "alt-changes-tab");
			} else {
				_tmp15_ = FALSE;
			}
			if (_tmp15_) {
				terminal_terminal_view_show_tab_numbers (self);
				result = GDK_EVENT_STOP;
				return result;
			}
			break;
		}
		default:
		{
			if (keyval == GDK_KEY_Alt_L) {
				terminal_terminal_view_schedule_tab_numbers (self);
			}
			break;
		}
	}
	result = GDK_EVENT_PROPAGATE;
	return result;
}

static gboolean
__lambda17_ (TerminalTerminalView* self)
{
	gboolean result;
	self->priv->tab_number_timeout = (guint) 0;
	terminal_terminal_view_show_tab_numbers (self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda17__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda17_ ((TerminalTerminalView*) self);
	return result;
}

static void
terminal_terminal_view_schedule_tab_numbers (TerminalTerminalView* self)
{
	gboolean _tmp0_ = FALSE;
	GtkSettings* _tmp1_;
	guint _tmp2_;
	guint _tmp3_;
	g_return_if_fail (self != NULL);
	if (self->priv->tab_numbers_showing) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = self->priv->tab_number_timeout > ((guint) 0);
	}
	if (_tmp0_) {
		return;
	}
	_tmp1_ = gtk_settings_get_default ();
	g_object_get (_tmp1_, "gtk-long-press-time", &_tmp2_, NULL);
	_tmp3_ = _tmp2_;
	self->priv->tab_number_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT, _tmp3_, ___lambda17__gsource_func, g_object_ref (self), g_object_unref);
}

static void
terminal_terminal_view_show_tab_numbers (TerminalTerminalView* self)
{
	g_return_if_fail (self != NULL);
	self->priv->tab_numbers_showing = TRUE;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				gint _tmp2_;
				gint _tmp3_;
				AdwTabPage* tab = NULL;
				AdwTabView* _tmp4_;
				AdwTabPage* _tmp5_;
				AdwTabPage* _tmp6_;
				gchar* badge = NULL;
				gchar* _tmp7_;
				AdwTabPage* _tmp8_;
				const gchar* _tmp9_;
				const gchar* _tmp10_;
				const gchar* _tmp11_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = terminal_terminal_view_get_n_pages (self);
				_tmp3_ = _tmp2_;
				if (!(i < _tmp3_)) {
					break;
				}
				_tmp4_ = self->priv->_tab_view;
				_tmp5_ = adw_tab_view_get_nth_page (_tmp4_, i);
				_tmp6_ = _g_object_ref0 (_tmp5_);
				tab = _tmp6_;
				_tmp7_ = g_strdup_printf ("(%d) ", i + 1);
				badge = _tmp7_;
				_tmp8_ = tab;
				_tmp9_ = adw_tab_page_get_title (_tmp8_);
				_tmp10_ = _tmp9_;
				_tmp11_ = badge;
				if (!g_str_has_prefix (_tmp10_, _tmp11_)) {
					AdwTabPage* _tmp12_;
					const gchar* _tmp13_;
					AdwTabPage* _tmp14_;
					const gchar* _tmp15_;
					const gchar* _tmp16_;
					gchar* _tmp17_;
					gchar* _tmp18_;
					_tmp12_ = tab;
					_tmp13_ = badge;
					_tmp14_ = tab;
					_tmp15_ = adw_tab_page_get_title (_tmp14_);
					_tmp16_ = _tmp15_;
					_tmp17_ = g_strconcat (_tmp13_, _tmp16_, NULL);
					_tmp18_ = _tmp17_;
					adw_tab_page_set_title (_tmp12_, _tmp18_);
					_g_free0 (_tmp18_);
				}
				_g_free0 (badge);
				_g_object_unref0 (tab);
			}
		}
	}
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static void
terminal_terminal_view_cancel_tab_numbers (TerminalTerminalView* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->tab_number_timeout > ((guint) 0)) {
		g_source_remove (self->priv->tab_number_timeout);
		self->priv->tab_number_timeout = (guint) 0;
	}
	if (self->priv->tab_numbers_showing) {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp0_ = FALSE;
				_tmp0_ = TRUE;
				while (TRUE) {
					gint _tmp2_;
					gint _tmp3_;
					AdwTabPage* tab = NULL;
					AdwTabView* _tmp4_;
					AdwTabPage* _tmp5_;
					AdwTabPage* _tmp6_;
					gchar* badge = NULL;
					gchar* _tmp7_;
					AdwTabPage* _tmp8_;
					const gchar* _tmp9_;
					const gchar* _tmp10_;
					const gchar* _tmp11_;
					if (!_tmp0_) {
						gint _tmp1_;
						_tmp1_ = i;
						i = _tmp1_ + 1;
					}
					_tmp0_ = FALSE;
					_tmp2_ = terminal_terminal_view_get_n_pages (self);
					_tmp3_ = _tmp2_;
					if (!(i < _tmp3_)) {
						break;
					}
					_tmp4_ = self->priv->_tab_view;
					_tmp5_ = adw_tab_view_get_nth_page (_tmp4_, i);
					_tmp6_ = _g_object_ref0 (_tmp5_);
					tab = _tmp6_;
					_tmp7_ = g_strdup_printf ("(%d) ", i + 1);
					badge = _tmp7_;
					_tmp8_ = tab;
					_tmp9_ = adw_tab_page_get_title (_tmp8_);
					_tmp10_ = _tmp9_;
					_tmp11_ = badge;
					if (g_str_has_prefix (_tmp10_, _tmp11_)) {
						AdwTabPage* _tmp12_;
						AdwTabPage* _tmp13_;
						const gchar* _tmp14_;
						const gchar* _tmp15_;
						const gchar* _tmp16_;
						gint _tmp17_;
						gint _tmp18_;
						AdwTabPage* _tmp19_;
						const gchar* _tmp20_;
						const gchar* _tmp21_;
						gint _tmp22_;
						gint _tmp23_;
						gchar* _tmp24_;
						gchar* _tmp25_;
						_tmp12_ = tab;
						_tmp13_ = tab;
						_tmp14_ = adw_tab_page_get_title (_tmp13_);
						_tmp15_ = _tmp14_;
						_tmp16_ = badge;
						_tmp17_ = strlen (_tmp16_);
						_tmp18_ = _tmp17_;
						_tmp19_ = tab;
						_tmp20_ = adw_tab_page_get_title (_tmp19_);
						_tmp21_ = _tmp20_;
						_tmp22_ = strlen (_tmp21_);
						_tmp23_ = _tmp22_;
						_tmp24_ = string_slice (_tmp15_, (glong) _tmp18_, (glong) _tmp23_);
						_tmp25_ = _tmp24_;
						adw_tab_page_set_title (_tmp12_, _tmp25_);
						_g_free0 (_tmp25_);
					}
					_g_free0 (badge);
					_g_object_unref0 (tab);
				}
			}
		}
		self->priv->tab_numbers_showing = FALSE;
	}
}

static void
terminal_terminal_view_update_font (TerminalTerminalView* self)
{
	gchar* app_font_name = NULL;
	GSettings* _tmp0_;
	gchar* _tmp1_;
	gchar* sys_font_name = NULL;
	GSettings* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = terminal_application_settings;
	_tmp1_ = g_settings_get_string (_tmp0_, "font");
	app_font_name = _tmp1_;
	_tmp2_ = terminal_terminal_view_gnome_interface_settings;
	_tmp3_ = g_settings_get_string (_tmp2_, "monospace-font-name");
	sys_font_name = _tmp3_;
	_tmp4_ = app_font_name;
	if (g_strcmp0 (_tmp4_, "") != 0) {
		const gchar* _tmp5_;
		PangoFontDescription* _tmp6_;
		_tmp5_ = app_font_name;
		_tmp6_ = pango_font_description_from_string (_tmp5_);
		__vala_PangoFontDescription_free0 (self->priv->term_font);
		self->priv->term_font = _tmp6_;
	} else {
		const gchar* _tmp7_;
		PangoFontDescription* _tmp8_;
		_tmp7_ = sys_font_name;
		_tmp8_ = pango_font_description_from_string (_tmp7_);
		__vala_PangoFontDescription_free0 (self->priv->term_font);
		self->priv->term_font = _tmp8_;
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp9_ = FALSE;
			_tmp9_ = TRUE;
			while (TRUE) {
				gint _tmp11_;
				gint _tmp12_;
				TerminalTerminalWidget* term = NULL;
				AdwTabView* _tmp13_;
				AdwTabPage* _tmp14_;
				TerminalTerminalWidget* _tmp15_;
				TerminalTerminalWidget* _tmp16_;
				TerminalTerminalWidget* _tmp17_;
				PangoFontDescription* _tmp18_;
				if (!_tmp9_) {
					gint _tmp10_;
					_tmp10_ = i;
					i = _tmp10_ + 1;
				}
				_tmp9_ = FALSE;
				_tmp11_ = terminal_terminal_view_get_n_pages (self);
				_tmp12_ = _tmp11_;
				if (!(i < _tmp12_)) {
					break;
				}
				_tmp13_ = self->priv->_tab_view;
				_tmp14_ = adw_tab_view_get_nth_page (_tmp13_, i);
				_tmp15_ = terminal_terminal_view_get_term_widget (_tmp14_);
				_tmp16_ = _g_object_ref0 (_tmp15_);
				term = _tmp16_;
				_tmp17_ = term;
				_tmp18_ = self->priv->term_font;
				vte_terminal_set_font ((VteTerminal*) _tmp17_, _tmp18_);
				_g_object_unref0 (term);
			}
		}
	}
	_g_free0 (sys_font_name);
	_g_free0 (app_font_name);
}

static TerminalTerminalWidget*
terminal_terminal_view_get_term_widget (AdwTabPage* tab)
{
	GtkScrolledWindow* tab_child = NULL;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	GtkScrolledWindow* _tmp2_;
	TerminalTerminalWidget* term = NULL;
	GtkScrolledWindow* _tmp3_;
	GtkWidget* _tmp4_;
	GtkWidget* _tmp5_;
	TerminalTerminalWidget* _tmp6_;
	TerminalTerminalWidget* result;
	if (tab == NULL) {
		result = NULL;
		return result;
	}
	_tmp0_ = adw_tab_page_get_child (tab);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_scrolled_window_get_type (), GtkScrolledWindow));
	tab_child = _tmp2_;
	_tmp3_ = tab_child;
	_tmp4_ = gtk_scrolled_window_get_child (_tmp3_);
	_tmp5_ = _tmp4_;
	term = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, TERMINAL_TYPE_TERMINAL_WIDGET, TerminalTerminalWidget);
	_tmp6_ = term;
	result = _tmp6_;
	_g_object_unref0 (tab_child);
	return result;
}

void
terminal_terminal_view_after_tab_restored (TerminalTerminalView* self,
                                           const gchar* path)
{
	GMenu* menu = NULL;
	GtkMenuButton* _tmp0_;
	GMenuModel* _tmp1_;
	GMenuModel* _tmp2_;
	GMenu* _tmp3_;
	GMenu* _tmp14_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	_tmp0_ = self->priv->tab_history_button;
	_tmp1_ = gtk_menu_button_get_menu_model (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, g_menu_get_type (), GMenu));
	menu = _tmp3_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp4_ = FALSE;
			_tmp4_ = TRUE;
			while (TRUE) {
				GMenu* _tmp6_;
				GMenu* _tmp7_;
				const GVariantType* _tmp8_;
				GVariant* _tmp9_;
				GVariant* _tmp10_;
				const gchar* _tmp11_;
				gboolean _tmp12_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				_tmp6_ = menu;
				if (!(i < g_menu_model_get_n_items ((GMenuModel*) _tmp6_))) {
					break;
				}
				_tmp7_ = menu;
				_tmp8_ = G_VARIANT_TYPE_STRING;
				_tmp9_ = g_menu_model_get_item_attribute_value ((GMenuModel*) _tmp7_, i, G_MENU_ATTRIBUTE_TARGET, _tmp8_);
				_tmp10_ = _tmp9_;
				_tmp11_ = g_variant_get_string (_tmp10_, NULL);
				_tmp12_ = g_strcmp0 (path, _tmp11_) == 0;
				_g_variant_unref0 (_tmp10_);
				if (_tmp12_) {
					GMenu* _tmp13_;
					_tmp13_ = menu;
					g_menu_remove (_tmp13_, i);
					break;
				}
			}
		}
	}
	_tmp14_ = menu;
	if (g_menu_model_get_n_items ((GMenuModel*) _tmp14_) == 0) {
		GtkMenuButton* _tmp15_;
		_tmp15_ = self->priv->tab_history_button;
		gtk_menu_button_set_menu_model (_tmp15_, NULL);
	}
	_g_object_unref0 (menu);
}

static GMenu*
terminal_terminal_view_create_menu_model (void)
{
	GMenu* close_tab_section = NULL;
	GMenu* _tmp0_;
	GMenu* open_tab_section = NULL;
	GMenu* _tmp1_;
	GMenu* reload_section = NULL;
	GMenu* _tmp2_;
	GMenu* menu = NULL;
	GMenu* _tmp3_;
	GMenu* result;
	_tmp0_ = g_menu_new ();
	close_tab_section = _tmp0_;
	g_menu_append (close_tab_section, _ ("Close Tabs to the Right"), TERMINAL_MAIN_WINDOW_ACTION_PREFIX TERMINAL_MAIN_WINDOW_ACTION_CLOSE_TABS_TO_RIGHT);
	g_menu_append (close_tab_section, _ ("Close Other Tabs"), TERMINAL_MAIN_WINDOW_ACTION_PREFIX TERMINAL_MAIN_WINDOW_ACTION_CLOSE_OTHER_TABS);
	g_menu_append (close_tab_section, _ ("Close Tab"), TERMINAL_MAIN_WINDOW_ACTION_PREFIX TERMINAL_MAIN_WINDOW_ACTION_CLOSE_TAB);
	_tmp1_ = g_menu_new ();
	open_tab_section = _tmp1_;
	g_menu_append (open_tab_section, _ ("Open in New Window"), TERMINAL_MAIN_WINDOW_ACTION_PREFIX TERMINAL_MAIN_WINDOW_ACTION_MOVE_TAB_TO_NEW_WINDOW);
	g_menu_append (open_tab_section, _ ("Duplicate Tab"), TERMINAL_MAIN_WINDOW_ACTION_PREFIX TERMINAL_MAIN_WINDOW_ACTION_DUPLICATE_TAB);
	_tmp2_ = g_menu_new ();
	reload_section = _tmp2_;
	g_menu_append (reload_section, _ ("Reload"), TERMINAL_MAIN_WINDOW_ACTION_PREFIX TERMINAL_MAIN_WINDOW_ACTION_TAB_RELOAD);
	_tmp3_ = g_menu_new ();
	menu = _tmp3_;
	g_menu_append_section (menu, NULL, (GMenuModel*) open_tab_section);
	g_menu_append_section (menu, NULL, (GMenuModel*) close_tab_section);
	g_menu_append_section (menu, NULL, (GMenuModel*) reload_section);
	result = menu;
	_g_object_unref0 (reload_section);
	_g_object_unref0 (open_tab_section);
	_g_object_unref0 (close_tab_section);
	return result;
}

static void
terminal_terminal_view_on_add_button_target_value_changed (GObject* obj,
                                                           GParamSpec* pspec)
{
	GtkDropTarget* button_target = NULL;
	GtkDropTarget* _tmp0_;
	GValue* value = NULL;
	GtkDropTarget* _tmp1_;
	GValue* _tmp2_;
	gchar** uris = NULL;
	GValue* _tmp4_;
	const gchar* _tmp5_;
	gchar** _tmp6_;
	gchar** _tmp7_;
	gint uris_length1;
	gint _uris_size_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	g_return_if_fail (obj != NULL);
	g_return_if_fail (pspec != NULL);
	_vala_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (obj, gtk_drop_target_get_type ()), "obj is Gtk.DropTarget");
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (obj, gtk_drop_target_get_type (), GtkDropTarget));
	button_target = _tmp0_;
	_tmp1_ = button_target;
	value = gtk_drop_target_get_value (_tmp1_);
	_tmp2_ = value;
	if (!G_VALUE_HOLDS (_tmp2_, G_TYPE_STRING)) {
		GtkDropTarget* _tmp3_;
		_tmp3_ = button_target;
		gtk_drop_target_reject (_tmp3_);
		_g_object_unref0 (button_target);
		return;
	}
	_tmp4_ = value;
	_tmp5_ = g_value_get_string (_tmp4_);
	_tmp7_ = _tmp6_ = g_uri_list_extract_uris (_tmp5_);
	uris = _tmp7_;
	uris_length1 = _vala_array_length (_tmp6_);
	_uris_size_ = uris_length1;
	_tmp8_ = uris;
	_tmp8__length1 = uris_length1;
	{
		gchar** uri_collection = NULL;
		gint uri_collection_length1 = 0;
		gint _uri_collection_size_ = 0;
		gint uri_it = 0;
		uri_collection = _tmp8_;
		uri_collection_length1 = _tmp8__length1;
		for (uri_it = 0; uri_it < uri_collection_length1; uri_it = uri_it + 1) {
			const gchar* uri = NULL;
			uri = uri_collection[uri_it];
			{
				const gchar* _tmp9_;
				_tmp9_ = uri;
				if (!terminal_utils_valid_local_uri (_tmp9_, NULL)) {
					GtkDropTarget* _tmp10_;
					_tmp10_ = button_target;
					gtk_drop_target_reject (_tmp10_);
					break;
				}
			}
		}
	}
	uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (button_target);
}

static GVariant*
_variant_new1 (const gchar* value)
{
	return g_variant_ref_sink (g_variant_new_string (value));
}

static gboolean
terminal_terminal_view_on_add_button_drop (TerminalTerminalView* self,
                                           GValue* val,
                                           gdouble x,
                                           gdouble y)
{
	gchar** uris = NULL;
	const gchar* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint uris_length1;
	gint _uris_size_;
	GSimpleAction* new_tab_action = NULL;
	TerminalMainWindow* _tmp3_;
	GSimpleActionGroup* _tmp4_;
	GSimpleActionGroup* _tmp5_;
	GSimpleAction* _tmp6_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (val != NULL, FALSE);
	_tmp0_ = g_value_get_string (val);
	_tmp2_ = _tmp1_ = g_uri_list_extract_uris (_tmp0_);
	uris = _tmp2_;
	uris_length1 = _vala_array_length (_tmp1_);
	_uris_size_ = uris_length1;
	_tmp3_ = self->priv->_main_window;
	_tmp4_ = terminal_main_window_get_actions (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = terminal_utils_action_from_group (TERMINAL_MAIN_WINDOW_ACTION_NEW_TAB_AT, _tmp5_);
	new_tab_action = _tmp6_;
	_tmp7_ = uris;
	_tmp7__length1 = uris_length1;
	{
		gchar** uri_collection = NULL;
		gint uri_collection_length1 = 0;
		gint _uri_collection_size_ = 0;
		gint uri_it = 0;
		uri_collection = _tmp7_;
		uri_collection_length1 = _tmp7__length1;
		for (uri_it = 0; uri_it < uri_collection_length1; uri_it = uri_it + 1) {
			gchar* _tmp8_;
			gchar* uri = NULL;
			_tmp8_ = g_strdup (uri_collection[uri_it]);
			uri = _tmp8_;
			{
				gchar* path = NULL;
				const gchar* _tmp9_;
				gchar* _tmp10_ = NULL;
				gboolean _tmp11_;
				GSimpleAction* _tmp12_;
				const gchar* _tmp13_;
				GVariant* _tmp14_;
				_tmp9_ = uri;
				_tmp11_ = terminal_utils_valid_local_uri (_tmp9_, &_tmp10_);
				_g_free0 (path);
				path = _tmp10_;
				if (!_tmp11_) {
					_g_free0 (path);
					_g_free0 (uri);
					continue;
				}
				_tmp12_ = new_tab_action;
				_tmp13_ = path;
				_tmp14_ = _variant_new1 (_tmp13_);
				g_signal_emit_by_name (_tmp12_, "activate", _tmp14_);
				_g_variant_unref0 (_tmp14_);
				_g_free0 (path);
				_g_free0 (uri);
			}
		}
	}
	result = TRUE;
	_g_object_unref0 (new_tab_action);
	uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

static GVariant*
_variant_new2 (const gchar* value)
{
	return g_variant_ref_sink (g_variant_new_string (value));
}

static gboolean
terminal_terminal_view_on_tab_bar_extra_drag_drop (TerminalTerminalView* self,
                                                   AdwTabPage* tab,
                                                   GValue* val)
{
	gchar** uris = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gint uris_length1;
	gint _uris_size_;
	GSimpleAction* active_shell_action = NULL;
	TerminalMainWindow* _tmp5_;
	GSimpleActionGroup* _tmp6_;
	GSimpleActionGroup* _tmp7_;
	GSimpleAction* _tmp8_;
	gchar** _tmp9_;
	gint _tmp9__length1;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (tab != 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;
	_tmp5_ = self->priv->_main_window;
	_tmp6_ = terminal_main_window_get_actions (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = terminal_utils_action_from_group (TERMINAL_MAIN_WINDOW_ACTION_TAB_ACTIVE_SHELL, _tmp7_);
	active_shell_action = _tmp8_;
	_tmp9_ = uris;
	_tmp9__length1 = uris_length1;
	{
		gchar** uri_collection = NULL;
		gint uri_collection_length1 = 0;
		gint _uri_collection_size_ = 0;
		gint uri_it = 0;
		uri_collection = _tmp9_;
		uri_collection_length1 = _tmp9__length1;
		for (uri_it = 0; uri_it < uri_collection_length1; uri_it = uri_it + 1) {
			gchar* _tmp10_;
			gchar* uri = NULL;
			_tmp10_ = g_strdup (uri_collection[uri_it]);
			uri = _tmp10_;
			{
				GFile* file = NULL;
				const gchar* _tmp11_;
				GFile* _tmp12_;
				gchar* scheme = NULL;
				GFile* _tmp13_;
				gchar* _tmp14_;
				gboolean _tmp15_ = FALSE;
				const gchar* _tmp16_;
				GFileType type = 0;
				GFile* _tmp18_;
				gchar* path = NULL;
				GSimpleAction* _tmp25_;
				const gchar* _tmp26_;
				GVariant* _tmp27_;
				_tmp11_ = uri;
				_tmp12_ = g_file_new_for_uri (_tmp11_);
				file = _tmp12_;
				_tmp13_ = file;
				_tmp14_ = g_file_get_uri_scheme (_tmp13_);
				scheme = _tmp14_;
				_tmp16_ = scheme;
				if (g_strcmp0 (_tmp16_, "file") != 0) {
					const gchar* _tmp17_;
					_tmp17_ = scheme;
					_tmp15_ = g_strcmp0 (_tmp17_, "") != 0;
				} else {
					_tmp15_ = FALSE;
				}
				if (_tmp15_) {
					result = FALSE;
					_g_free0 (scheme);
					_g_object_unref0 (file);
					_g_free0 (uri);
					_g_object_unref0 (active_shell_action);
					uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL);
					return result;
				}
				_tmp18_ = file;
				type = g_file_query_file_type (_tmp18_, G_FILE_QUERY_INFO_NONE, NULL);
				if (type == G_FILE_TYPE_DIRECTORY) {
					GFile* _tmp19_;
					gchar* _tmp20_;
					_tmp19_ = file;
					_tmp20_ = g_file_get_path (_tmp19_);
					_g_free0 (path);
					path = _tmp20_;
				} else {
					if (type == G_FILE_TYPE_REGULAR) {
						GFile* _tmp21_;
						GFile* _tmp22_;
						GFile* _tmp23_;
						gchar* _tmp24_;
						_tmp21_ = file;
						_tmp22_ = g_file_get_parent (_tmp21_);
						_tmp23_ = _tmp22_;
						_tmp24_ = g_file_get_path (_tmp23_);
						_g_free0 (path);
						path = _tmp24_;
						_g_object_unref0 (_tmp23_);
					} else {
						_g_free0 (path);
						_g_free0 (scheme);
						_g_object_unref0 (file);
						_g_free0 (uri);
						continue;
					}
				}
				_tmp25_ = active_shell_action;
				_tmp26_ = path;
				_tmp27_ = _variant_new2 (_tmp26_);
				g_signal_emit_by_name (_tmp25_, "activate", _tmp27_);
				_g_variant_unref0 (_tmp27_);
				_g_free0 (path);
				_g_free0 (scheme);
				_g_object_unref0 (file);
				_g_free0 (uri);
			}
		}
	}
	result = TRUE;
	_g_object_unref0 (active_shell_action);
	uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

gint
terminal_terminal_view_get_n_pages (TerminalTerminalView* self)
{
	gint result;
	AdwTabView* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = self->priv->_tab_view;
	_tmp1_ = adw_tab_view_get_n_pages (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

AdwTabPage*
terminal_terminal_view_get_selected_page (TerminalTerminalView* self)
{
	AdwTabPage* result;
	AdwTabView* _tmp0_;
	AdwTabPage* _tmp1_;
	AdwTabPage* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_tab_view;
	_tmp1_ = adw_tab_view_get_selected_page (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
terminal_terminal_view_set_selected_page (TerminalTerminalView* self,
                                          AdwTabPage* value)
{
	AdwTabView* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_tab_view;
	adw_tab_view_set_selected_page (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, terminal_terminal_view_properties[TERMINAL_TERMINAL_VIEW_SELECTED_PAGE_PROPERTY]);
}

static TerminalMainWindow*
terminal_terminal_view_get_main_window (TerminalTerminalView* self)
{
	TerminalMainWindow* result;
	TerminalMainWindow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_main_window;
	result = _tmp0_;
	return result;
}

static void
terminal_terminal_view_set_main_window (TerminalTerminalView* self,
                                        TerminalMainWindow* value)
{
	TerminalMainWindow* old_value;
	g_return_if_fail (self != NULL);
	old_value = terminal_terminal_view_get_main_window (self);
	if (old_value != value) {
		self->priv->_main_window = value;
		g_object_notify_by_pspec ((GObject *) self, terminal_terminal_view_properties[TERMINAL_TERMINAL_VIEW_MAIN_WINDOW_PROPERTY]);
	}
}

AdwTabBar*
terminal_terminal_view_get_tab_bar (TerminalTerminalView* self)
{
	AdwTabBar* result;
	AdwTabBar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_tab_bar;
	result = _tmp0_;
	return result;
}

static void
terminal_terminal_view_set_tab_bar (TerminalTerminalView* self,
                                    AdwTabBar* value)
{
	AdwTabBar* old_value;
	g_return_if_fail (self != NULL);
	old_value = terminal_terminal_view_get_tab_bar (self);
	if (old_value != value) {
		AdwTabBar* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_tab_bar);
		self->priv->_tab_bar = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, terminal_terminal_view_properties[TERMINAL_TERMINAL_VIEW_TAB_BAR_PROPERTY]);
	}
}

AdwTabView*
terminal_terminal_view_get_tab_view (TerminalTerminalView* self)
{
	AdwTabView* result;
	AdwTabView* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_tab_view;
	result = _tmp0_;
	return result;
}

static void
terminal_terminal_view_set_tab_view (TerminalTerminalView* self,
                                     AdwTabView* value)
{
	AdwTabView* old_value;
	g_return_if_fail (self != NULL);
	old_value = terminal_terminal_view_get_tab_view (self);
	if (old_value != value) {
		AdwTabView* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_tab_view);
		self->priv->_tab_view = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, terminal_terminal_view_properties[TERMINAL_TERMINAL_VIEW_TAB_VIEW_PROPERTY]);
	}
}

AdwTabPage*
terminal_terminal_view_get_tab_menu_target (TerminalTerminalView* self)
{
	AdwTabPage* result;
	AdwTabPage* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_tab_menu_target;
	result = _tmp0_;
	return result;
}

static void
terminal_terminal_view_set_tab_menu_target (TerminalTerminalView* self,
                                            AdwTabPage* value)
{
	AdwTabPage* old_value;
	g_return_if_fail (self != NULL);
	old_value = terminal_terminal_view_get_tab_menu_target (self);
	if (old_value != value) {
		AdwTabPage* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_tab_menu_target);
		self->priv->_tab_menu_target = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, terminal_terminal_view_properties[TERMINAL_TERMINAL_VIEW_TAB_MENU_TARGET_PROPERTY]);
	}
}

static void
_terminal_terminal_view_tab_view_setup_menu_adw_tab_view_setup_menu (AdwTabView* _sender,
                                                                     AdwTabPage* page,
                                                                     gpointer self)
{
	terminal_terminal_view_tab_view_setup_menu ((TerminalTerminalView*) self, page);
}

static void
_terminal_terminal_view___lambda18_ (TerminalTerminalView* self)
{
	AdwTabBar* _tmp0_;
	GSettings* _tmp1_;
	_tmp0_ = self->priv->_tab_bar;
	_tmp1_ = terminal_application_settings;
	adw_tab_bar_set_autohide (_tmp0_, g_settings_get_enum (_tmp1_, "tab-bar-behavior") == 1);
}

static void
__terminal_terminal_view___lambda18__g_settings_changed (GSettings* _sender,
                                                         const gchar* key,
                                                         gpointer self)
{
	_terminal_terminal_view___lambda18_ ((TerminalTerminalView*) self);
}

static void
_terminal_terminal_view_on_add_button_target_value_changed_g_object_notify (GObject* _sender,
                                                                            GParamSpec* pspec,
                                                                            gpointer self)
{
	terminal_terminal_view_on_add_button_target_value_changed (_sender, pspec);
}

static gboolean
_terminal_terminal_view_on_add_button_drop_gtk_drop_target_drop (GtkDropTarget* _sender,
                                                                 GValue* value,
                                                                 gdouble x,
                                                                 gdouble y,
                                                                 gpointer self)
{
	gboolean result;
	result = terminal_terminal_view_on_add_button_drop ((TerminalTerminalView*) self, value, x, y);
	return result;
}

static void
_terminal_widgets_zoom_overlay_hide_zoom_level_g_object_notify (GObject* _sender,
                                                                GParamSpec* pspec,
                                                                gpointer self)
{
	terminal_widgets_zoom_overlay_hide_zoom_level ((TerminalWidgetsZoomOverlay*) self);
}

static gboolean
_terminal_terminal_view_on_tab_bar_extra_drag_drop_adw_tab_bar_extra_drag_drop (AdwTabBar* _sender,
                                                                                AdwTabPage* page,
                                                                                GValue* value,
                                                                                gpointer self)
{
	gboolean result;
	result = terminal_terminal_view_on_tab_bar_extra_drag_drop ((TerminalTerminalView*) self, page, value);
	return result;
}

static gboolean
_terminal_terminal_view_key_pressed_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                          guint keyval,
                                                                          guint keycode,
                                                                          GdkModifierType state,
                                                                          gpointer self)
{
	gboolean result;
	result = terminal_terminal_view_key_pressed ((TerminalTerminalView*) self, keyval, keycode, state);
	return result;
}

static void
_terminal_terminal_view_key_released_gtk_event_controller_key_key_released (GtkEventControllerKey* _sender,
                                                                            guint keyval,
                                                                            guint keycode,
                                                                            GdkModifierType state,
                                                                            gpointer self)
{
	terminal_terminal_view_key_released ((TerminalTerminalView*) self, keyval, keycode, state);
}

static void
_terminal_terminal_view___lambda19_ (TerminalTerminalView* self)
{
	terminal_terminal_view_cancel_tab_numbers (self);
}

static void
__terminal_terminal_view___lambda19__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                                       gpointer self)
{
	_terminal_terminal_view___lambda19_ ((TerminalTerminalView*) self);
}

static void
_terminal_terminal_view_update_font_g_settings_changed (GSettings* _sender,
                                                        const gchar* key,
                                                        gpointer self)
{
	terminal_terminal_view_update_font ((TerminalTerminalView*) self);
}

static GObject *
terminal_terminal_view_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TerminalTerminalView * self;
	GtkApplication* app_instance = NULL;
	GApplication* _tmp0_;
	GtkApplication* _tmp1_;
	AdwTabView* _tmp2_ = NULL;
	AdwTabView* _tmp3_;
	AdwTabView* _tmp4_;
	GMenu* _tmp5_;
	GMenu* _tmp6_;
	AdwTabView* _tmp7_;
	GtkButton* new_tab_button = NULL;
	GtkApplication* _tmp8_;
	gchar** _tmp9_;
	gchar** _tmp10_;
	gchar** _tmp11_;
	gint _tmp11__length1;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GtkButton* _tmp14_ = NULL;
	GtkButton* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	GtkMenuButton* _tmp18_ = NULL;
	GSettings* _tmp19_;
	GtkButton* _tmp20_;
	GtkWidget* _tmp21_;
	GtkMenuButton* _tmp22_;
	GtkWidget* _tmp23_;
	AdwTabView* _tmp24_;
	AdwTabView* _tmp25_;
	AdwTabBar* _tmp26_ = NULL;
	AdwTabBar* _tmp27_;
	GtkOverlay* overlay = NULL;
	AdwTabView* _tmp28_;
	GtkWidget* _tmp29_;
	GtkOverlay* _tmp30_ = NULL;
	GtkOverlay* _tmp31_;
	TerminalWidgetsZoomOverlay* _tmp32_;
	GtkOverlay* _tmp33_;
	GSettings* _tmp34_;
	GtkDropTarget* button_target = NULL;
	GtkDropTarget* _tmp35_ = NULL;
	GtkDropTarget* _tmp36_;
	GtkDropTarget* _tmp37_;
	GtkButton* _tmp38_;
	GtkDropTarget* _tmp39_;
	GtkEventController* _tmp40_;
	AdwTabView* _tmp41_;
	TerminalWidgetsZoomOverlay* _tmp42_;
	AdwTabBar* _tmp43_;
	GType* _tmp44_;
	GType* _tmp45_;
	gint _tmp45__length1;
	AdwTabBar* _tmp46_;
	GtkEventControllerKey* key_controller = NULL;
	GtkEventControllerKey* _tmp47_ = NULL;
	GtkEventControllerKey* _tmp48_;
	GtkEventControllerKey* _tmp49_;
	GtkEventControllerKey* _tmp50_;
	GtkEventController* _tmp51_;
	GtkEventControllerFocus* focus_controller = NULL;
	GtkEventControllerFocus* _tmp52_ = NULL;
	GtkEventControllerFocus* _tmp53_;
	GtkEventControllerFocus* _tmp54_;
	GtkEventController* _tmp55_;
	GSettings* _tmp56_;
	GSettings* _tmp57_;
	parent_class = G_OBJECT_CLASS (terminal_terminal_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_TYPE_TERMINAL_VIEW, TerminalTerminalView);
	_tmp0_ = g_application_get_default ();
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gtk_application_get_type (), GtkApplication));
	app_instance = _tmp1_;
	_tmp2_ = adw_tab_view_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp2_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp2_, TRUE);
	g_object_ref_sink (_tmp2_);
	_tmp3_ = _tmp2_;
	terminal_terminal_view_set_tab_view (self, _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = self->priv->_tab_view;
	_tmp5_ = terminal_terminal_view_create_menu_model ();
	_tmp6_ = _tmp5_;
	adw_tab_view_set_menu_model (_tmp4_, (GMenuModel*) _tmp6_);
	_g_object_unref0 (_tmp6_);
	_tmp7_ = self->priv->_tab_view;
	g_signal_connect_object (_tmp7_, "setup-menu", (GCallback) _terminal_terminal_view_tab_view_setup_menu_adw_tab_view_setup_menu, self, 0);
	_tmp8_ = app_instance;
	_tmp10_ = _tmp9_ = gtk_application_get_accels_for_action (_tmp8_, TERMINAL_MAIN_WINDOW_ACTION_PREFIX TERMINAL_MAIN_WINDOW_ACTION_NEW_TAB);
	_tmp11_ = _tmp10_;
	_tmp11__length1 = _vala_array_length (_tmp9_);
	_tmp12_ = granite_markup_accel_tooltip (_tmp11_, (gint) _vala_array_length (_tmp9_), _ ("New Tab"));
	_tmp13_ = g_strdup (TERMINAL_MAIN_WINDOW_ACTION_PREFIX TERMINAL_MAIN_WINDOW_ACTION_NEW_TAB);
	_tmp14_ = (GtkButton*) gtk_button_new_from_icon_name ("list-add-symbolic");
	gtk_button_set_has_frame (_tmp14_, FALSE);
	gtk_widget_set_tooltip_markup ((GtkWidget*) _tmp14_, _tmp12_);
	_g_free0 (_tmp12_);
	gtk_actionable_set_action_name ((GtkActionable*) _tmp14_, _tmp13_);
	_g_free0 (_tmp13_);
	g_object_ref_sink (_tmp14_);
	_tmp15_ = _tmp14_;
	_tmp11_ = (_vala_array_free (_tmp11_, _tmp11__length1, (GDestroyNotify) g_free), NULL);
	new_tab_button = _tmp15_;
	_tmp16_ = g_strdup ("document-open-recent-symbolic");
	_tmp17_ = g_strdup (_ ("Closed Tabs"));
	_tmp18_ = (GtkMenuButton*) gtk_menu_button_new ();
	gtk_menu_button_set_icon_name (_tmp18_, _tmp16_);
	_g_free0 (_tmp16_);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp18_, _tmp17_);
	_g_free0 (_tmp17_);
	g_object_ref_sink (_tmp18_);
	_g_object_unref0 (self->priv->tab_history_button);
	self->priv->tab_history_button = _tmp18_;
	_tmp19_ = terminal_application_settings;
	_tmp20_ = new_tab_button;
	_tmp21_ = _g_object_ref0 ((GtkWidget*) _tmp20_);
	_tmp22_ = self->priv->tab_history_button;
	_tmp23_ = _g_object_ref0 ((GtkWidget*) _tmp22_);
	_tmp24_ = self->priv->_tab_view;
	_tmp25_ = _g_object_ref0 (_tmp24_);
	_tmp26_ = adw_tab_bar_new ();
	adw_tab_bar_set_autohide (_tmp26_, g_settings_get_enum (_tmp19_, "tab-bar-behavior") == 1);
	adw_tab_bar_set_expand_tabs (_tmp26_, FALSE);
	adw_tab_bar_set_inverted (_tmp26_, TRUE);
	adw_tab_bar_set_start_action_widget (_tmp26_, _tmp21_);
	_g_object_unref0 (_tmp21_);
	adw_tab_bar_set_end_action_widget (_tmp26_, _tmp23_);
	_g_object_unref0 (_tmp23_);
	adw_tab_bar_set_view (_tmp26_, _tmp25_);
	_g_object_unref0 (_tmp25_);
	g_object_ref_sink (_tmp26_);
	_tmp27_ = _tmp26_;
	terminal_terminal_view_set_tab_bar (self, _tmp27_);
	_g_object_unref0 (_tmp27_);
	_tmp28_ = self->priv->_tab_view;
	_tmp29_ = _g_object_ref0 ((GtkWidget*) _tmp28_);
	_tmp30_ = (GtkOverlay*) gtk_overlay_new ();
	gtk_overlay_set_child (_tmp30_, _tmp29_);
	_g_object_unref0 (_tmp29_);
	g_object_ref_sink (_tmp30_);
	overlay = _tmp30_;
	_tmp31_ = overlay;
	_tmp32_ = terminal_widgets_zoom_overlay_new (_tmp31_);
	g_object_ref_sink (_tmp32_);
	_g_object_unref0 (self->priv->zoom_overlay);
	self->priv->zoom_overlay = _tmp32_;
	_tmp33_ = overlay;
	granite_bin_set_child ((GraniteBin*) self, (GtkWidget*) _tmp33_);
	_tmp34_ = terminal_application_settings;
	g_signal_connect_object (_tmp34_, "changed::tab-bar-behavior", (GCallback) __terminal_terminal_view___lambda18__g_settings_changed, self, 0);
	_tmp35_ = gtk_drop_target_new (G_TYPE_STRING, GDK_ACTION_COPY);
	gtk_drop_target_set_preload (_tmp35_, TRUE);
	button_target = _tmp35_;
	_tmp36_ = button_target;
	g_signal_connect ((GObject*) _tmp36_, "notify::value", (GCallback) _terminal_terminal_view_on_add_button_target_value_changed_g_object_notify, NULL);
	_tmp37_ = button_target;
	g_signal_connect_object (_tmp37_, "drop", (GCallback) _terminal_terminal_view_on_add_button_drop_gtk_drop_target_drop, self, 0);
	_tmp38_ = new_tab_button;
	_tmp39_ = button_target;
	_tmp40_ = _g_object_ref0 ((GtkEventController*) _tmp39_);
	gtk_widget_add_controller ((GtkWidget*) _tmp38_, _tmp40_);
	_tmp41_ = self->priv->_tab_view;
	_tmp42_ = self->priv->zoom_overlay;
	g_signal_connect_object ((GObject*) _tmp41_, "notify::selected-page", (GCallback) _terminal_widgets_zoom_overlay_hide_zoom_level_g_object_notify, _tmp42_, 0);
	_tmp43_ = self->priv->_tab_bar;
	_tmp44_ = g_new0 (GType, 1);
	_tmp44_[0] = G_TYPE_STRING;
	_tmp45_ = _tmp44_;
	_tmp45__length1 = 1;
	adw_tab_bar_setup_extra_drop_target (_tmp43_, GDK_ACTION_COPY, _tmp45_, (gsize) 1);
	_tmp45_ = (g_free (_tmp45_), NULL);
	_tmp46_ = self->priv->_tab_bar;
	g_signal_connect_object (_tmp46_, "extra-drag-drop", (GCallback) _terminal_terminal_view_on_tab_bar_extra_drag_drop_adw_tab_bar_extra_drag_drop, self, 0);
	_tmp47_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	gtk_event_controller_set_propagation_phase ((GtkEventController*) _tmp47_, GTK_PHASE_CAPTURE);
	key_controller = _tmp47_;
	_tmp48_ = key_controller;
	g_signal_connect_object (_tmp48_, "key-pressed", (GCallback) _terminal_terminal_view_key_pressed_gtk_event_controller_key_key_pressed, self, 0);
	_tmp49_ = key_controller;
	g_signal_connect_object (_tmp49_, "key-released", (GCallback) _terminal_terminal_view_key_released_gtk_event_controller_key_key_released, self, 0);
	_tmp50_ = key_controller;
	_tmp51_ = _g_object_ref0 ((GtkEventController*) _tmp50_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp51_);
	_tmp52_ = (GtkEventControllerFocus*) gtk_event_controller_focus_new ();
	gtk_event_controller_set_propagation_phase ((GtkEventController*) _tmp52_, GTK_PHASE_CAPTURE);
	focus_controller = _tmp52_;
	_tmp53_ = focus_controller;
	g_signal_connect_object (_tmp53_, "leave", (GCallback) __terminal_terminal_view___lambda19__gtk_event_controller_focus_leave, self, 0);
	_tmp54_ = focus_controller;
	_tmp55_ = _g_object_ref0 ((GtkEventController*) _tmp54_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp55_);
	terminal_terminal_view_update_font (self);
	_tmp56_ = terminal_terminal_view_gnome_interface_settings;
	g_signal_connect_object (_tmp56_, "changed::monospace-font-name", (GCallback) _terminal_terminal_view_update_font_g_settings_changed, self, 0);
	_tmp57_ = terminal_application_settings;
	g_signal_connect_object (_tmp57_, "changed::font", (GCallback) _terminal_terminal_view_update_font_g_settings_changed, self, 0);
	_g_object_unref0 (focus_controller);
	_g_object_unref0 (key_controller);
	_g_object_unref0 (button_target);
	_g_object_unref0 (overlay);
	_g_object_unref0 (new_tab_button);
	_g_object_unref0 (app_instance);
	return obj;
}

static void
terminal_terminal_view_class_init (TerminalTerminalViewClass * klass,
                                   gpointer klass_data)
{
	GSettings* _tmp0_;
	terminal_terminal_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TerminalTerminalView_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_terminal_terminal_view_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_terminal_terminal_view_set_property;
	G_OBJECT_CLASS (klass)->constructor = terminal_terminal_view_constructor;
	G_OBJECT_CLASS (klass)->finalize = terminal_terminal_view_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TERMINAL_TERMINAL_VIEW_N_PAGES_PROPERTY, terminal_terminal_view_properties[TERMINAL_TERMINAL_VIEW_N_PAGES_PROPERTY] = g_param_spec_int ("n-pages", "n-pages", "n-pages", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TERMINAL_TERMINAL_VIEW_SELECTED_PAGE_PROPERTY, terminal_terminal_view_properties[TERMINAL_TERMINAL_VIEW_SELECTED_PAGE_PROPERTY] = g_param_spec_object ("selected-page", "selected-page", "selected-page", adw_tab_page_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TERMINAL_TERMINAL_VIEW_MAIN_WINDOW_PROPERTY, terminal_terminal_view_properties[TERMINAL_TERMINAL_VIEW_MAIN_WINDOW_PROPERTY] = g_param_spec_object ("main-window", "main-window", "main-window", TERMINAL_TYPE_MAIN_WINDOW, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TERMINAL_TERMINAL_VIEW_TAB_BAR_PROPERTY, terminal_terminal_view_properties[TERMINAL_TERMINAL_VIEW_TAB_BAR_PROPERTY] = g_param_spec_object ("tab-bar", "tab-bar", "tab-bar", adw_tab_bar_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TERMINAL_TERMINAL_VIEW_TAB_VIEW_PROPERTY, terminal_terminal_view_properties[TERMINAL_TERMINAL_VIEW_TAB_VIEW_PROPERTY] = g_param_spec_object ("tab-view", "tab-view", "tab-view", adw_tab_view_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TERMINAL_TERMINAL_VIEW_TAB_MENU_TARGET_PROPERTY, terminal_terminal_view_properties[TERMINAL_TERMINAL_VIEW_TAB_MENU_TARGET_PROPERTY] = g_param_spec_object ("tab-menu-target", "tab-menu-target", "tab-menu-target", adw_tab_page_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	_tmp0_ = g_settings_new ("org.gnome.desktop.interface");
	_g_object_unref0 (terminal_terminal_view_gnome_interface_settings);
	terminal_terminal_view_gnome_interface_settings = _tmp0_;
}

static void
terminal_terminal_view_instance_init (TerminalTerminalView * self,
                                      gpointer klass)
{
	self->priv = terminal_terminal_view_get_instance_private (self);
	self->priv->_tab_menu_target = NULL;
	self->priv->tab_number_timeout = (guint) 0;
	self->priv->tab_numbers_showing = FALSE;
}

static void
terminal_terminal_view_finalize (GObject * obj)
{
	TerminalTerminalView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_TYPE_TERMINAL_VIEW, TerminalTerminalView);
	_g_object_unref0 (self->priv->_tab_bar);
	_g_object_unref0 (self->priv->_tab_view);
	_g_object_unref0 (self->priv->_tab_menu_target);
	_g_object_unref0 (self->priv->zoom_overlay);
	_g_object_unref0 (self->priv->tab_history_button);
	__vala_PangoFontDescription_free0 (self->priv->term_font);
	G_OBJECT_CLASS (terminal_terminal_view_parent_class)->finalize (obj);
}

static GType
terminal_terminal_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TerminalTerminalViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) terminal_terminal_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TerminalTerminalView), 0, (GInstanceInitFunc) terminal_terminal_view_instance_init, NULL };
	GType terminal_terminal_view_type_id;
	terminal_terminal_view_type_id = g_type_register_static (GRANITE_TYPE_BIN, "TerminalTerminalView", &g_define_type_info, 0);
	TerminalTerminalView_private_offset = g_type_add_instance_private (terminal_terminal_view_type_id, sizeof (TerminalTerminalViewPrivate));
	return terminal_terminal_view_type_id;
}

GType
terminal_terminal_view_get_type (void)
{
	static volatile gsize terminal_terminal_view_type_id__once = 0;
	if (g_once_init_enter (&terminal_terminal_view_type_id__once)) {
		GType terminal_terminal_view_type_id;
		terminal_terminal_view_type_id = terminal_terminal_view_get_type_once ();
		g_once_init_leave (&terminal_terminal_view_type_id__once, terminal_terminal_view_type_id);
	}
	return terminal_terminal_view_type_id__once;
}

static void
_vala_terminal_terminal_view_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec)
{
	TerminalTerminalView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TERMINAL_TYPE_TERMINAL_VIEW, TerminalTerminalView);
	switch (property_id) {
		case TERMINAL_TERMINAL_VIEW_N_PAGES_PROPERTY:
		g_value_set_int (value, terminal_terminal_view_get_n_pages (self));
		break;
		case TERMINAL_TERMINAL_VIEW_SELECTED_PAGE_PROPERTY:
		g_value_set_object (value, terminal_terminal_view_get_selected_page (self));
		break;
		case TERMINAL_TERMINAL_VIEW_MAIN_WINDOW_PROPERTY:
		g_value_set_object (value, terminal_terminal_view_get_main_window (self));
		break;
		case TERMINAL_TERMINAL_VIEW_TAB_BAR_PROPERTY:
		g_value_set_object (value, terminal_terminal_view_get_tab_bar (self));
		break;
		case TERMINAL_TERMINAL_VIEW_TAB_VIEW_PROPERTY:
		g_value_set_object (value, terminal_terminal_view_get_tab_view (self));
		break;
		case TERMINAL_TERMINAL_VIEW_TAB_MENU_TARGET_PROPERTY:
		g_value_set_object (value, terminal_terminal_view_get_tab_menu_target (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_terminal_terminal_view_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec)
{
	TerminalTerminalView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TERMINAL_TYPE_TERMINAL_VIEW, TerminalTerminalView);
	switch (property_id) {
		case TERMINAL_TERMINAL_VIEW_SELECTED_PAGE_PROPERTY:
		terminal_terminal_view_set_selected_page (self, g_value_get_object (value));
		break;
		case TERMINAL_TERMINAL_VIEW_MAIN_WINDOW_PROPERTY:
		terminal_terminal_view_set_main_window (self, g_value_get_object (value));
		break;
		case TERMINAL_TERMINAL_VIEW_TAB_BAR_PROPERTY:
		terminal_terminal_view_set_tab_bar (self, g_value_get_object (value));
		break;
		case TERMINAL_TERMINAL_VIEW_TAB_VIEW_PROPERTY:
		terminal_terminal_view_set_tab_view (self, g_value_get_object (value));
		break;
		case TERMINAL_TERMINAL_VIEW_TAB_MENU_TARGET_PROPERTY:
		terminal_terminal_view_set_tab_menu_target (self, g_value_get_object (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;
}

