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

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

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

#define TERMINAL_SETTINGS_POPOVER_ACTION_GROUP_NAME "settings"
#define TERMINAL_SETTINGS_POPOVER_ACTION_GROUP_PREFIX TERMINAL_SETTINGS_POPOVER_ACTION_GROUP_NAME "."
#define TERMINAL_SETTINGS_POPOVER_THEME_CHECK_BUTTON_STYLE_CSS "\n" \
"            .color-button.%s radio {\n" \
"                background-color: %s;\n" \
"                color: %s;\n" \
"                padding: 0.8rem; /* FIXME: Remove during GTK4 port */\n" \
"            }\n" \
"        "
#define TERMINAL_THEMES_PALETTE_SIZE 19
#define TERMINAL_THEMES_HIGH_CONTRAST "high-contrast"
#define TERMINAL_THEMES_LIGHT "solarized-light"
#define TERMINAL_THEMES_DARK "dark"
#define TERMINAL_THEMES_CUSTOM "custom"
#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_SETTINGS_POPOVER (terminal_settings_popover_get_type ())
#define TERMINAL_SETTINGS_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_TYPE_SETTINGS_POPOVER, TerminalSettingsPopover))
#define TERMINAL_SETTINGS_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_SETTINGS_POPOVER, TerminalSettingsPopoverClass))
#define TERMINAL_IS_SETTINGS_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_TYPE_SETTINGS_POPOVER))
#define TERMINAL_IS_SETTINGS_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_SETTINGS_POPOVER))
#define TERMINAL_SETTINGS_POPOVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_SETTINGS_POPOVER, TerminalSettingsPopoverClass))

typedef struct _TerminalSettingsPopover TerminalSettingsPopover;
typedef struct _TerminalSettingsPopoverClass TerminalSettingsPopoverClass;
typedef struct _TerminalSettingsPopoverPrivate TerminalSettingsPopoverPrivate;
enum  {
	TERMINAL_SETTINGS_POPOVER_0_PROPERTY,
	TERMINAL_SETTINGS_POPOVER_TERMINAL_PROPERTY,
	TERMINAL_SETTINGS_POPOVER_NUM_PROPERTIES
};
static GParamSpec* terminal_settings_popover_properties[TERMINAL_SETTINGS_POPOVER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_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;

#define TERMINAL_SETTINGS_POPOVER_TYPE_THEME_CHECK_BUTTON (terminal_settings_popover_theme_check_button_get_type ())
#define TERMINAL_SETTINGS_POPOVER_THEME_CHECK_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_SETTINGS_POPOVER_TYPE_THEME_CHECK_BUTTON, TerminalSettingsPopoverThemeCheckButton))
#define TERMINAL_SETTINGS_POPOVER_THEME_CHECK_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_SETTINGS_POPOVER_TYPE_THEME_CHECK_BUTTON, TerminalSettingsPopoverThemeCheckButtonClass))
#define TERMINAL_SETTINGS_POPOVER_IS_THEME_CHECK_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_SETTINGS_POPOVER_TYPE_THEME_CHECK_BUTTON))
#define TERMINAL_SETTINGS_POPOVER_IS_THEME_CHECK_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_SETTINGS_POPOVER_TYPE_THEME_CHECK_BUTTON))
#define TERMINAL_SETTINGS_POPOVER_THEME_CHECK_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_SETTINGS_POPOVER_TYPE_THEME_CHECK_BUTTON, TerminalSettingsPopoverThemeCheckButtonClass))

typedef struct _TerminalSettingsPopoverThemeCheckButton TerminalSettingsPopoverThemeCheckButton;
typedef struct _TerminalSettingsPopoverThemeCheckButtonClass TerminalSettingsPopoverThemeCheckButtonClass;
typedef struct _TerminalSettingsPopoverThemeCheckButtonPrivate TerminalSettingsPopoverThemeCheckButtonPrivate;
enum  {
	TERMINAL_SETTINGS_POPOVER_THEME_CHECK_BUTTON_0_PROPERTY,
	TERMINAL_SETTINGS_POPOVER_THEME_CHECK_BUTTON_THEME_PROPERTY,
	TERMINAL_SETTINGS_POPOVER_THEME_CHECK_BUTTON_NUM_PROPERTIES
};
static GParamSpec* terminal_settings_popover_theme_check_button_properties[TERMINAL_SETTINGS_POPOVER_THEME_CHECK_BUTTON_NUM_PROPERTIES];
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _Block2Data Block2Data;
enum  {
	TERMINAL_SETTINGS_POPOVER_SHOW_THEME_EDITOR_SIGNAL,
	TERMINAL_SETTINGS_POPOVER_NUM_SIGNALS
};
static guint terminal_settings_popover_signals[TERMINAL_SETTINGS_POPOVER_NUM_SIGNALS] = {0};

struct _TerminalSettingsPopover {
	GtkPopover parent_instance;
	TerminalSettingsPopoverPrivate * priv;
};

struct _TerminalSettingsPopoverClass {
	GtkPopoverClass parent_class;
};

struct _TerminalSettingsPopoverPrivate {
	GBindingGroup* terminal_binding;
};

struct _TerminalSettingsPopoverThemeCheckButton {
	GtkCheckButton parent_instance;
	TerminalSettingsPopoverThemeCheckButtonPrivate * priv;
};

struct _TerminalSettingsPopoverThemeCheckButtonClass {
	GtkCheckButtonClass parent_class;
};

struct _TerminalSettingsPopoverThemeCheckButtonPrivate {
	gchar* _theme;
	GtkCssProvider* css_provider;
};

struct _Block2Data {
	int _ref_count_;
	TerminalSettingsPopover* self;
	TerminalSettingsPopoverThemeCheckButton* custom_button;
	GraniteSwitchModelButton* auto_hide_button;
};

static gint TerminalSettingsPopover_private_offset;
static gpointer terminal_settings_popover_parent_class = NULL;
static gint TerminalSettingsPopoverThemeCheckButton_private_offset;
static gpointer terminal_settings_popover_theme_check_button_parent_class = NULL;
VALA_EXTERN GSettings* terminal_application_settings;

VALA_EXTERN GType terminal_settings_popover_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TerminalSettingsPopover, g_object_unref)
static gboolean terminal_settings_popover_font_scale_to_zoom (GBinding* binding,
                                                       GValue* font_scale,
                                                       GValue* label);
VALA_EXTERN TerminalSettingsPopover* terminal_settings_popover_new (void);
VALA_EXTERN TerminalSettingsPopover* terminal_settings_popover_construct (GType object_type);
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_settings_popover_get_terminal (TerminalSettingsPopover* self);
VALA_EXTERN void terminal_settings_popover_set_terminal (TerminalSettingsPopover* self,
                                             TerminalTerminalWidget* value);
static GType terminal_settings_popover_theme_check_button_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TerminalSettingsPopoverThemeCheckButton, g_object_unref)
static TerminalSettingsPopoverThemeCheckButton* terminal_settings_popover_theme_check_button_new (const gchar* theme);
static TerminalSettingsPopoverThemeCheckButton* terminal_settings_popover_theme_check_button_construct (GType object_type,
                                                                                                 const gchar* theme);
static void terminal_settings_popover_theme_check_button_update_theme_provider (TerminalSettingsPopoverThemeCheckButton* self);
VALA_EXTERN GdkRGBA* terminal_themes_get_rgba_palette (const gchar* theme,
                                           gint* result_length1);
static const gchar* terminal_settings_popover_theme_check_button_get_theme (TerminalSettingsPopoverThemeCheckButton* self);
static void terminal_settings_popover_theme_check_button_set_theme (TerminalSettingsPopoverThemeCheckButton* self,
                                                             const gchar* value);
static GObject * terminal_settings_popover_theme_check_button_constructor (GType type,
                                                                    guint n_construct_properties,
                                                                    GObjectConstructParam * construct_properties);
static void terminal_settings_popover_theme_check_button_finalize (GObject * obj);
static GType terminal_settings_popover_theme_check_button_get_type_once (void);
static void _vala_terminal_settings_popover_theme_check_button_get_property (GObject * object,
                                                                      guint property_id,
                                                                      GValue * value,
                                                                      GParamSpec * pspec);
static void _vala_terminal_settings_popover_theme_check_button_set_property (GObject * object,
                                                                      guint property_id,
                                                                      const GValue * value,
                                                                      GParamSpec * pspec);
static GObject * terminal_settings_popover_constructor (GType type,
                                                 guint n_construct_properties,
                                                 GObjectConstructParam * construct_properties);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static void _terminal_settings_popover___lambda23_ (TerminalSettingsPopover* self);
static void __terminal_settings_popover___lambda23__gtk_button_clicked (GtkButton* _sender,
                                                                 gpointer self);
static void _terminal_settings_popover___lambda24_ (TerminalSettingsPopover* self);
VALA_EXTERN void terminal_terminal_widget_default_font_size (TerminalTerminalWidget* self);
static void __terminal_settings_popover___lambda24__gtk_button_clicked (GtkButton* _sender,
                                                                 gpointer self);
static void _terminal_settings_popover___lambda25_ (TerminalSettingsPopover* self);
static void __terminal_settings_popover___lambda25__gtk_button_clicked (GtkButton* _sender,
                                                                 gpointer self);
static void _terminal_settings_popover___lambda27_ (Block2Data* _data2_,
                                             gint n,
                                             gdouble x,
                                             gdouble y);
static void __terminal_settings_popover___lambda27__gtk_gesture_click_released (GtkGestureClick* _sender,
                                                                         gint n_press,
                                                                         gdouble x,
                                                                         gdouble y,
                                                                         gpointer self);
static void _terminal_settings_popover___lambda28_ (Block2Data* _data2_);
static void __terminal_settings_popover___lambda28__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                        gpointer self);
static void _terminal_settings_popover___lambda29_ (Block2Data* _data2_);
static void __terminal_settings_popover___lambda29__gtk_check_button_toggled (GtkCheckButton* _sender,
                                                                       gpointer self);
static gboolean _terminal_settings_popover_font_scale_to_zoom_gbinding_transform_func (GBinding* binding,
                                                                                GValue* from_value,
                                                                                GValue* to_value,
                                                                                gpointer self);
static void _terminal_settings_popover___lambda30_ (Block2Data* _data2_,
                                             GSettings* s,
                                             const gchar* n);
static void __terminal_settings_popover___lambda30__g_settings_changed (GSettings* _sender,
                                                                 const gchar* key,
                                                                 gpointer self);
static void terminal_settings_popover_finalize (GObject * obj);
static GType terminal_settings_popover_get_type_once (void);
static void _vala_terminal_settings_popover_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec);
static void _vala_terminal_settings_popover_set_property (GObject * object,
                                                   guint property_id,
                                                   const GValue * value,
                                                   GParamSpec * pspec);

VALA_EXTERN const gchar* TERMINAL_TERMINAL_WIDGET_ACCELS_ZOOM_OUT[3];
VALA_EXTERN const gchar* TERMINAL_TERMINAL_WIDGET_ACCELS_ZOOM_DEFAULT[3];
VALA_EXTERN const gchar* TERMINAL_TERMINAL_WIDGET_ACCELS_ZOOM_IN[4];

static inline gpointer
terminal_settings_popover_get_instance_private (TerminalSettingsPopover* self)
{
	return G_STRUCT_MEMBER_P (self, TerminalSettingsPopover_private_offset);
}

static gboolean
terminal_settings_popover_font_scale_to_zoom (GBinding* binding,
                                              GValue* font_scale,
                                              GValue* label)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean result;
	g_return_val_if_fail (binding != NULL, FALSE);
	g_return_val_if_fail (font_scale != NULL, FALSE);
	g_return_val_if_fail (label != NULL, FALSE);
	_tmp0_ = g_strdup_printf ("%.0f%%", g_value_get_double (font_scale) * 100);
	_tmp1_ = _tmp0_;
	g_value_set_string (label, _tmp1_);
	_g_free0 (_tmp1_);
	result = TRUE;
	return result;
}

TerminalSettingsPopover*
terminal_settings_popover_construct (GType object_type)
{
	TerminalSettingsPopover * self = NULL;
	self = (TerminalSettingsPopover*) g_object_new (object_type, NULL);
	return self;
}

TerminalSettingsPopover*
terminal_settings_popover_new (void)
{
	return terminal_settings_popover_construct (TERMINAL_TYPE_SETTINGS_POPOVER);
}

TerminalTerminalWidget*
terminal_settings_popover_get_terminal (TerminalSettingsPopover* self)
{
	TerminalTerminalWidget* result;
	GBindingGroup* _tmp0_;
	GObject* _tmp1_;
	GObject* _tmp2_;
	TerminalTerminalWidget* _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->terminal_binding;
	g_object_get (_tmp0_, "source", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = TERMINAL_IS_TERMINAL_WIDGET (_tmp2_) ? ((TerminalTerminalWidget*) _tmp2_) : NULL;
	if (_tmp3_ == NULL) {
		_g_object_unref0 (_tmp2_);
	}
	result = _tmp3_;
	return result;
}

void
terminal_settings_popover_set_terminal (TerminalSettingsPopover* self,
                                        TerminalTerminalWidget* value)
{
	GBindingGroup* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->terminal_binding;
	g_object_set (_tmp0_, "source", (GObject*) value, NULL);
	g_object_notify_by_pspec ((GObject *) self, terminal_settings_popover_properties[TERMINAL_SETTINGS_POPOVER_TERMINAL_PROPERTY]);
}

static inline gpointer
terminal_settings_popover_theme_check_button_get_instance_private (TerminalSettingsPopoverThemeCheckButton* self)
{
	return G_STRUCT_MEMBER_P (self, TerminalSettingsPopoverThemeCheckButton_private_offset);
}

static TerminalSettingsPopoverThemeCheckButton*
terminal_settings_popover_theme_check_button_construct (GType object_type,
                                                        const gchar* theme)
{
	TerminalSettingsPopoverThemeCheckButton * self = NULL;
	g_return_val_if_fail (theme != NULL, NULL);
	self = (TerminalSettingsPopoverThemeCheckButton*) g_object_new (object_type, "theme", theme, NULL);
	return self;
}

static TerminalSettingsPopoverThemeCheckButton*
terminal_settings_popover_theme_check_button_new (const gchar* theme)
{
	return terminal_settings_popover_theme_check_button_construct (TERMINAL_SETTINGS_POPOVER_TYPE_THEME_CHECK_BUTTON, theme);
}

static void
terminal_settings_popover_theme_check_button_update_theme_provider (TerminalSettingsPopoverThemeCheckButton* self)
{
	GdkRGBA* theme_palette = NULL;
	const gchar* _tmp0_;
	gint _tmp1_ = 0;
	GdkRGBA* _tmp2_;
	gint theme_palette_length1;
	gint _theme_palette_size_;
	gchar* background = NULL;
	gchar* _tmp3_;
	gchar* foreground = NULL;
	gchar* _tmp4_;
	GtkCssProvider* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_theme;
	_tmp2_ = terminal_themes_get_rgba_palette (_tmp0_, &_tmp1_);
	theme_palette = _tmp2_;
	theme_palette_length1 = _tmp1_;
	_theme_palette_size_ = theme_palette_length1;
	_tmp3_ = gdk_rgba_to_string (&theme_palette[TERMINAL_THEMES_PALETTE_SIZE - 3]);
	background = _tmp3_;
	_tmp4_ = gdk_rgba_to_string (&theme_palette[TERMINAL_THEMES_PALETTE_SIZE - 2]);
	foreground = _tmp4_;
	_tmp5_ = self->priv->css_provider;
	_tmp6_ = self->priv->_theme;
	_tmp7_ = g_strdup_printf (TERMINAL_SETTINGS_POPOVER_THEME_CHECK_BUTTON_STYLE_CSS, _tmp6_, background, foreground);
	_tmp8_ = _tmp7_;
	gtk_css_provider_load_from_string (_tmp5_, _tmp8_);
	_g_free0 (_tmp8_);
	_g_free0 (foreground);
	_g_free0 (background);
	theme_palette = (g_free (theme_palette), NULL);
}

static const gchar*
terminal_settings_popover_theme_check_button_get_theme (TerminalSettingsPopoverThemeCheckButton* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_theme;
	result = _tmp0_;
	return result;
}

static void
terminal_settings_popover_theme_check_button_set_theme (TerminalSettingsPopoverThemeCheckButton* self,
                                                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = terminal_settings_popover_theme_check_button_get_theme (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_theme);
		self->priv->_theme = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, terminal_settings_popover_theme_check_button_properties[TERMINAL_SETTINGS_POPOVER_THEME_CHECK_BUTTON_THEME_PROPERTY]);
	}
}

static GObject *
terminal_settings_popover_theme_check_button_constructor (GType type,
                                                          guint n_construct_properties,
                                                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TerminalSettingsPopoverThemeCheckButton * self;
	const gchar* _tmp0_;
	GVariant* _tmp1_;
	GVariant* _tmp2_;
	const gchar* _tmp3_;
	GtkCssProvider* _tmp4_;
	GdkDisplay* _tmp5_;
	GtkCssProvider* _tmp6_;
	parent_class = G_OBJECT_CLASS (terminal_settings_popover_theme_check_button_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_SETTINGS_POPOVER_TYPE_THEME_CHECK_BUTTON, TerminalSettingsPopoverThemeCheckButton);
	gtk_actionable_set_action_name ((GtkActionable*) self, TERMINAL_SETTINGS_POPOVER_ACTION_GROUP_PREFIX "theme");
	_tmp0_ = self->priv->_theme;
	_tmp1_ = g_variant_new_string (_tmp0_);
	g_variant_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	g_object_set ((GtkActionable*) self, "action-target", _tmp2_, NULL);
	_g_variant_unref0 (_tmp2_);
	gtk_widget_set_halign ((GtkWidget*) self, GTK_ALIGN_CENTER);
	gtk_widget_add_css_class ((GtkWidget*) self, GRANITE_STYLE_CLASS_COLOR_BUTTON);
	_tmp3_ = self->priv->_theme;
	gtk_widget_add_css_class ((GtkWidget*) self, _tmp3_);
	_tmp4_ = gtk_css_provider_new ();
	_g_object_unref0 (self->priv->css_provider);
	self->priv->css_provider = _tmp4_;
	_tmp5_ = gdk_display_get_default ();
	_tmp6_ = self->priv->css_provider;
	gtk_style_context_add_provider_for_display (_tmp5_, (GtkStyleProvider*) _tmp6_, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
	terminal_settings_popover_theme_check_button_update_theme_provider (self);
	return obj;
}

static void
terminal_settings_popover_theme_check_button_class_init (TerminalSettingsPopoverThemeCheckButtonClass * klass,
                                                         gpointer klass_data)
{
	terminal_settings_popover_theme_check_button_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TerminalSettingsPopoverThemeCheckButton_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_terminal_settings_popover_theme_check_button_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_terminal_settings_popover_theme_check_button_set_property;
	G_OBJECT_CLASS (klass)->constructor = terminal_settings_popover_theme_check_button_constructor;
	G_OBJECT_CLASS (klass)->finalize = terminal_settings_popover_theme_check_button_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TERMINAL_SETTINGS_POPOVER_THEME_CHECK_BUTTON_THEME_PROPERTY, terminal_settings_popover_theme_check_button_properties[TERMINAL_SETTINGS_POPOVER_THEME_CHECK_BUTTON_THEME_PROPERTY] = g_param_spec_string ("theme", "theme", "theme", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
terminal_settings_popover_theme_check_button_instance_init (TerminalSettingsPopoverThemeCheckButton * self,
                                                            gpointer klass)
{
	self->priv = terminal_settings_popover_theme_check_button_get_instance_private (self);
}

static void
terminal_settings_popover_theme_check_button_finalize (GObject * obj)
{
	TerminalSettingsPopoverThemeCheckButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_SETTINGS_POPOVER_TYPE_THEME_CHECK_BUTTON, TerminalSettingsPopoverThemeCheckButton);
	_g_free0 (self->priv->_theme);
	_g_object_unref0 (self->priv->css_provider);
	G_OBJECT_CLASS (terminal_settings_popover_theme_check_button_parent_class)->finalize (obj);
}

static GType
terminal_settings_popover_theme_check_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TerminalSettingsPopoverThemeCheckButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) terminal_settings_popover_theme_check_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TerminalSettingsPopoverThemeCheckButton), 0, (GInstanceInitFunc) terminal_settings_popover_theme_check_button_instance_init, NULL };
	GType terminal_settings_popover_theme_check_button_type_id;
	terminal_settings_popover_theme_check_button_type_id = g_type_register_static (gtk_check_button_get_type (), "TerminalSettingsPopoverThemeCheckButton", &g_define_type_info, 0);
	TerminalSettingsPopoverThemeCheckButton_private_offset = g_type_add_instance_private (terminal_settings_popover_theme_check_button_type_id, sizeof (TerminalSettingsPopoverThemeCheckButtonPrivate));
	return terminal_settings_popover_theme_check_button_type_id;
}

static GType
terminal_settings_popover_theme_check_button_get_type (void)
{
	static volatile gsize terminal_settings_popover_theme_check_button_type_id__once = 0;
	if (g_once_init_enter (&terminal_settings_popover_theme_check_button_type_id__once)) {
		GType terminal_settings_popover_theme_check_button_type_id;
		terminal_settings_popover_theme_check_button_type_id = terminal_settings_popover_theme_check_button_get_type_once ();
		g_once_init_leave (&terminal_settings_popover_theme_check_button_type_id__once, terminal_settings_popover_theme_check_button_type_id);
	}
	return terminal_settings_popover_theme_check_button_type_id__once;
}

static void
_vala_terminal_settings_popover_theme_check_button_get_property (GObject * object,
                                                                 guint property_id,
                                                                 GValue * value,
                                                                 GParamSpec * pspec)
{
	TerminalSettingsPopoverThemeCheckButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TERMINAL_SETTINGS_POPOVER_TYPE_THEME_CHECK_BUTTON, TerminalSettingsPopoverThemeCheckButton);
	switch (property_id) {
		case TERMINAL_SETTINGS_POPOVER_THEME_CHECK_BUTTON_THEME_PROPERTY:
		g_value_set_string (value, terminal_settings_popover_theme_check_button_get_theme (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_terminal_settings_popover_theme_check_button_set_property (GObject * object,
                                                                 guint property_id,
                                                                 const GValue * value,
                                                                 GParamSpec * pspec)
{
	TerminalSettingsPopoverThemeCheckButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TERMINAL_SETTINGS_POPOVER_TYPE_THEME_CHECK_BUTTON, TerminalSettingsPopoverThemeCheckButton);
	switch (property_id) {
		case TERMINAL_SETTINGS_POPOVER_THEME_CHECK_BUTTON_THEME_PROPERTY:
		terminal_settings_popover_theme_check_button_set_theme (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static Block2Data*
block2_data_ref (Block2Data* _data2_)
{
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}

static void
block2_data_unref (void * _userdata_)
{
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		TerminalSettingsPopover* self;
		self = _data2_->self;
		_g_object_unref0 (_data2_->auto_hide_button);
		_g_object_unref0 (_data2_->custom_button);
		_g_object_unref0 (self);
		g_slice_free (Block2Data, _data2_);
	}
}

static void
_terminal_settings_popover___lambda23_ (TerminalSettingsPopover* self)
{
	TerminalTerminalWidget* _tmp0_;
	TerminalTerminalWidget* _tmp1_;
	TerminalTerminalWidget* _tmp2_;
	_tmp0_ = terminal_settings_popover_get_terminal (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	g_signal_emit_by_name ((VteTerminal*) _tmp2_, "decrease-font-size");
	_g_object_unref0 (_tmp2_);
}

static void
__terminal_settings_popover___lambda23__gtk_button_clicked (GtkButton* _sender,
                                                            gpointer self)
{
	_terminal_settings_popover___lambda23_ ((TerminalSettingsPopover*) self);
}

static void
_terminal_settings_popover___lambda24_ (TerminalSettingsPopover* self)
{
	TerminalTerminalWidget* _tmp0_;
	TerminalTerminalWidget* _tmp1_;
	TerminalTerminalWidget* _tmp2_;
	_tmp0_ = terminal_settings_popover_get_terminal (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	terminal_terminal_widget_default_font_size (_tmp2_);
	_g_object_unref0 (_tmp2_);
}

static void
__terminal_settings_popover___lambda24__gtk_button_clicked (GtkButton* _sender,
                                                            gpointer self)
{
	_terminal_settings_popover___lambda24_ ((TerminalSettingsPopover*) self);
}

static void
_terminal_settings_popover___lambda25_ (TerminalSettingsPopover* self)
{
	TerminalTerminalWidget* _tmp0_;
	TerminalTerminalWidget* _tmp1_;
	TerminalTerminalWidget* _tmp2_;
	_tmp0_ = terminal_settings_popover_get_terminal (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	g_signal_emit_by_name ((VteTerminal*) _tmp2_, "increase-font-size");
	_g_object_unref0 (_tmp2_);
}

static void
__terminal_settings_popover___lambda25__gtk_button_clicked (GtkButton* _sender,
                                                            gpointer self)
{
	_terminal_settings_popover___lambda25_ ((TerminalSettingsPopover*) self);
}

static void
_terminal_settings_popover___lambda27_ (Block2Data* _data2_,
                                        gint n,
                                        gdouble x,
                                        gdouble y)
{
	TerminalSettingsPopover* self;
	TerminalSettingsPopoverThemeCheckButton* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data2_->self;
	_tmp0_ = _data2_->custom_button;
	_tmp1_ = gtk_check_button_get_active ((GtkCheckButton*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		g_signal_emit (self, terminal_settings_popover_signals[TERMINAL_SETTINGS_POPOVER_SHOW_THEME_EDITOR_SIGNAL], 0);
		gtk_popover_popdown ((GtkPopover*) self);
	}
}

static void
__terminal_settings_popover___lambda27__gtk_gesture_click_released (GtkGestureClick* _sender,
                                                                    gint n_press,
                                                                    gdouble x,
                                                                    gdouble y,
                                                                    gpointer self)
{
	_terminal_settings_popover___lambda27_ (self, n_press, x, y);
}

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

static void
_terminal_settings_popover___lambda28_ (Block2Data* _data2_)
{
	TerminalSettingsPopover* self;
	gint _tmp0_ = 0;
	GraniteSwitchModelButton* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	GSettings* _tmp4_;
	self = _data2_->self;
	_tmp1_ = _data2_->auto_hide_button;
	_tmp2_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		_tmp0_ = 1;
	} else {
		_tmp0_ = 0;
	}
	_tmp4_ = terminal_application_settings;
	g_settings_set_enum (_tmp4_, "tab-bar-behavior", _tmp0_);
}

static void
__terminal_settings_popover___lambda28__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                   gpointer self)
{
	_terminal_settings_popover___lambda28_ (self);
}

static void
_terminal_settings_popover___lambda29_ (Block2Data* _data2_)
{
	TerminalSettingsPopover* self;
	TerminalSettingsPopoverThemeCheckButton* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data2_->self;
	_tmp0_ = _data2_->custom_button;
	_tmp1_ = gtk_check_button_get_active ((GtkCheckButton*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		g_signal_emit (self, terminal_settings_popover_signals[TERMINAL_SETTINGS_POPOVER_SHOW_THEME_EDITOR_SIGNAL], 0);
		gtk_popover_popdown ((GtkPopover*) self);
	}
}

static void
__terminal_settings_popover___lambda29__gtk_check_button_toggled (GtkCheckButton* _sender,
                                                                  gpointer self)
{
	_terminal_settings_popover___lambda29_ (self);
}

static gboolean
_terminal_settings_popover_font_scale_to_zoom_gbinding_transform_func (GBinding* binding,
                                                                       GValue* from_value,
                                                                       GValue* to_value,
                                                                       gpointer self)
{
	gboolean result;
	result = terminal_settings_popover_font_scale_to_zoom (binding, from_value, to_value);
	return result;
}

static void
_terminal_settings_popover___lambda30_ (Block2Data* _data2_,
                                        GSettings* s,
                                        const gchar* n)
{
	TerminalSettingsPopover* self;
	gboolean _tmp0_ = FALSE;
	self = _data2_->self;
	g_return_if_fail (s != NULL);
	g_return_if_fail (n != NULL);
	if (g_strcmp0 (n, "background") == 0) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (n, "foreground") == 0;
	}
	if (_tmp0_) {
		TerminalSettingsPopoverThemeCheckButton* _tmp1_;
		_tmp1_ = _data2_->custom_button;
		terminal_settings_popover_theme_check_button_update_theme_provider (_tmp1_);
	} else {
		if (g_strcmp0 (n, "tab-bar-behavior") == 0) {
			GraniteSwitchModelButton* _tmp2_;
			GSettings* _tmp3_;
			_tmp2_ = _data2_->auto_hide_button;
			_tmp3_ = terminal_application_settings;
			gtk_toggle_button_set_active ((GtkToggleButton*) _tmp2_, g_settings_get_enum (_tmp3_, "tab-bar-behavior") == 1);
		}
	}
}

static void
__terminal_settings_popover___lambda30__g_settings_changed (GSettings* _sender,
                                                            const gchar* key,
                                                            gpointer self)
{
	_terminal_settings_popover___lambda30_ (self, _sender, key);
}

static GObject *
terminal_settings_popover_constructor (GType type,
                                       guint n_construct_properties,
                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TerminalSettingsPopover * self;
	Block2Data* _data2_;
	GtkButton* zoom_out_button = NULL;
	gchar* _tmp0_;
	GtkButton* _tmp1_ = NULL;
	GtkButton* _tmp2_;
	GtkButton* zoom_default_button = NULL;
	gchar* _tmp3_;
	GtkButton* _tmp4_ = NULL;
	GtkButton* _tmp5_;
	GtkButton* zoom_in_button = NULL;
	gchar* _tmp6_;
	GtkButton* _tmp7_ = NULL;
	GtkButton* _tmp8_;
	GraniteBox* font_size_box = NULL;
	GraniteBox* _tmp9_ = NULL;
	GraniteBox* _tmp10_;
	GtkButton* _tmp11_;
	GraniteBox* _tmp12_;
	GtkButton* _tmp13_;
	GraniteBox* _tmp14_;
	GtkButton* _tmp15_;
	GraniteSwitchModelButton* follow_system_button = NULL;
	gchar* _tmp16_;
	GraniteSwitchModelButton* _tmp17_ = NULL;
	TerminalSettingsPopoverThemeCheckButton* hc_button = NULL;
	gchar* _tmp18_;
	TerminalSettingsPopoverThemeCheckButton* _tmp19_ = NULL;
	TerminalSettingsPopoverThemeCheckButton* light_button = NULL;
	gchar* _tmp20_;
	TerminalSettingsPopoverThemeCheckButton* _tmp21_ = NULL;
	TerminalSettingsPopoverThemeCheckButton* dark_button = NULL;
	gchar* _tmp22_;
	TerminalSettingsPopoverThemeCheckButton* _tmp23_ = NULL;
	gchar* _tmp24_;
	TerminalSettingsPopoverThemeCheckButton* _tmp25_ = NULL;
	GtkGestureClick* custom_button_controller = NULL;
	GtkGestureClick* _tmp26_ = NULL;
	GtkGestureClick* _tmp27_;
	TerminalSettingsPopoverThemeCheckButton* _tmp28_;
	GtkGestureClick* _tmp29_;
	GtkEventController* _tmp30_;
	GtkBox* theme_buttons = NULL;
	GtkBox* _tmp31_ = NULL;
	GtkBox* _tmp32_;
	TerminalSettingsPopoverThemeCheckButton* _tmp33_;
	GtkBox* _tmp34_;
	TerminalSettingsPopoverThemeCheckButton* _tmp35_;
	GtkBox* _tmp36_;
	TerminalSettingsPopoverThemeCheckButton* _tmp37_;
	GtkBox* _tmp38_;
	TerminalSettingsPopoverThemeCheckButton* _tmp39_;
	GtkRevealer* theme_revealer = NULL;
	GtkBox* _tmp40_;
	GtkWidget* _tmp41_;
	GtkRevealer* _tmp42_ = NULL;
	GtkBox* theme_box = NULL;
	GtkBox* _tmp43_;
	GtkBox* _tmp44_;
	GraniteSwitchModelButton* _tmp45_;
	GtkBox* _tmp46_;
	GtkRevealer* _tmp47_;
	GraniteSwitchModelButton* natural_copy_paste_button = NULL;
	gchar* _tmp48_;
	gchar* _tmp49_;
	GraniteSwitchModelButton* _tmp50_ = NULL;
	GraniteSwitchModelButton* unsafe_paste_alert_button = NULL;
	gchar* _tmp51_;
	gchar* _tmp52_;
	GraniteSwitchModelButton* _tmp53_ = NULL;
	GraniteSwitchModelButton* audible_bell_button = NULL;
	gchar* _tmp54_;
	gchar* _tmp55_;
	GraniteSwitchModelButton* _tmp56_ = NULL;
	gchar* _tmp57_;
	GSettings* _tmp58_;
	GraniteSwitchModelButton* _tmp59_ = NULL;
	GraniteSwitchModelButton* _tmp60_;
	GtkBox* box = NULL;
	GtkBox* _tmp61_ = NULL;
	GtkBox* _tmp62_;
	GraniteBox* _tmp63_;
	GtkBox* _tmp64_;
	GtkSeparator* _tmp65_;
	GtkSeparator* _tmp66_;
	GtkBox* _tmp67_;
	GtkBox* _tmp68_;
	GtkBox* _tmp69_;
	GtkSeparator* _tmp70_;
	GtkSeparator* _tmp71_;
	GtkBox* _tmp72_;
	GraniteSwitchModelButton* _tmp73_;
	GtkBox* _tmp74_;
	GraniteSwitchModelButton* _tmp75_;
	GtkBox* _tmp76_;
	GraniteSwitchModelButton* _tmp77_;
	GtkBox* _tmp78_;
	GraniteSwitchModelButton* _tmp79_;
	GtkBox* _tmp80_;
	GAction* theme_action = NULL;
	GSettings* _tmp81_;
	GAction* _tmp82_;
	GAction* natural_copy_paste_action = NULL;
	GSettings* _tmp83_;
	GAction* _tmp84_;
	GAction* unsafe_paste_alert_action = NULL;
	GSettings* _tmp85_;
	GAction* _tmp86_;
	GAction* audible_bell_action = NULL;
	GSettings* _tmp87_;
	GAction* _tmp88_;
	GAction* follow_system_style_action = NULL;
	GSettings* _tmp89_;
	GAction* _tmp90_;
	GSimpleActionGroup* action_group = NULL;
	GSimpleActionGroup* _tmp91_;
	GSimpleActionGroup* _tmp92_;
	GAction* _tmp93_;
	GSimpleActionGroup* _tmp94_;
	GAction* _tmp95_;
	GSimpleActionGroup* _tmp96_;
	GAction* _tmp97_;
	GSimpleActionGroup* _tmp98_;
	GAction* _tmp99_;
	GSimpleActionGroup* _tmp100_;
	GAction* _tmp101_;
	GSimpleActionGroup* _tmp102_;
	TerminalSettingsPopoverThemeCheckButton* _tmp103_;
	GBindingGroup* _tmp104_;
	GBindingGroup* _tmp105_;
	GtkButton* _tmp106_;
	GraniteSwitchModelButton* _tmp107_;
	GtkRevealer* _tmp108_;
	GSettings* _tmp109_;
	parent_class = G_OBJECT_CLASS (terminal_settings_popover_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_TYPE_SETTINGS_POPOVER, TerminalSettingsPopover);
	_data2_ = g_slice_new0 (Block2Data);
	_data2_->_ref_count_ = 1;
	_data2_->self = g_object_ref (self);
	_tmp0_ = granite_markup_accel_tooltip (TERMINAL_TERMINAL_WIDGET_ACCELS_ZOOM_OUT, (gint) G_N_ELEMENTS (TERMINAL_TERMINAL_WIDGET_ACCELS_ZOOM_OUT), _ ("Zoom out"));
	_tmp1_ = (GtkButton*) gtk_button_new_from_icon_name ("zoom-out-symbolic");
	gtk_widget_set_tooltip_markup ((GtkWidget*) _tmp1_, _tmp0_);
	_g_free0 (_tmp0_);
	g_object_ref_sink (_tmp1_);
	zoom_out_button = _tmp1_;
	_tmp2_ = zoom_out_button;
	g_signal_connect_object (_tmp2_, "clicked", (GCallback) __terminal_settings_popover___lambda23__gtk_button_clicked, self, 0);
	_tmp3_ = granite_markup_accel_tooltip (TERMINAL_TERMINAL_WIDGET_ACCELS_ZOOM_DEFAULT, (gint) G_N_ELEMENTS (TERMINAL_TERMINAL_WIDGET_ACCELS_ZOOM_DEFAULT), _ ("Default zoom level"));
	_tmp4_ = (GtkButton*) gtk_button_new ();
	gtk_widget_set_tooltip_markup ((GtkWidget*) _tmp4_, _tmp3_);
	_g_free0 (_tmp3_);
	g_object_ref_sink (_tmp4_);
	zoom_default_button = _tmp4_;
	_tmp5_ = zoom_default_button;
	g_signal_connect_object (_tmp5_, "clicked", (GCallback) __terminal_settings_popover___lambda24__gtk_button_clicked, self, 0);
	_tmp6_ = granite_markup_accel_tooltip (TERMINAL_TERMINAL_WIDGET_ACCELS_ZOOM_IN, (gint) G_N_ELEMENTS (TERMINAL_TERMINAL_WIDGET_ACCELS_ZOOM_IN), _ ("Zoom in"));
	_tmp7_ = (GtkButton*) gtk_button_new_from_icon_name ("zoom-in-symbolic");
	gtk_widget_set_tooltip_markup ((GtkWidget*) _tmp7_, _tmp6_);
	_g_free0 (_tmp6_);
	g_object_ref_sink (_tmp7_);
	zoom_in_button = _tmp7_;
	_tmp8_ = zoom_in_button;
	g_signal_connect_object (_tmp8_, "clicked", (GCallback) __terminal_settings_popover___lambda25__gtk_button_clicked, self, 0);
	_tmp9_ = granite_box_new (GTK_ORIENTATION_HORIZONTAL, GRANITE_BOX_SPACING_LINKED);
	gtk_box_set_homogeneous ((GtkBox*) _tmp9_, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp9_, TRUE);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp9_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp9_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp9_, 6);
	g_object_ref_sink (_tmp9_);
	font_size_box = _tmp9_;
	_tmp10_ = font_size_box;
	_tmp11_ = zoom_out_button;
	gtk_box_append ((GtkBox*) _tmp10_, (GtkWidget*) _tmp11_);
	_tmp12_ = font_size_box;
	_tmp13_ = zoom_default_button;
	gtk_box_append ((GtkBox*) _tmp12_, (GtkWidget*) _tmp13_);
	_tmp14_ = font_size_box;
	_tmp15_ = zoom_in_button;
	gtk_box_append ((GtkBox*) _tmp14_, (GtkWidget*) _tmp15_);
	_tmp16_ = g_strdup (TERMINAL_SETTINGS_POPOVER_ACTION_GROUP_PREFIX "follow-system-style");
	_tmp17_ = granite_switch_model_button_new (_ ("Follow System Style"));
	gtk_actionable_set_action_name ((GtkActionable*) _tmp17_, _tmp16_);
	_g_free0 (_tmp16_);
	g_object_ref_sink (_tmp17_);
	follow_system_button = _tmp17_;
	_tmp18_ = g_strdup (_ ("High Contrast"));
	_tmp19_ = terminal_settings_popover_theme_check_button_new (TERMINAL_THEMES_HIGH_CONTRAST);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp19_, _tmp18_);
	_g_free0 (_tmp18_);
	g_object_ref_sink (_tmp19_);
	hc_button = _tmp19_;
	_tmp20_ = g_strdup (_ ("Solarized Light"));
	_tmp21_ = terminal_settings_popover_theme_check_button_new (TERMINAL_THEMES_LIGHT);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp21_, _tmp20_);
	_g_free0 (_tmp20_);
	g_object_ref_sink (_tmp21_);
	light_button = _tmp21_;
	_tmp22_ = g_strdup (_ ("Dark"));
	_tmp23_ = terminal_settings_popover_theme_check_button_new (TERMINAL_THEMES_DARK);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp23_, _tmp22_);
	_g_free0 (_tmp22_);
	g_object_ref_sink (_tmp23_);
	dark_button = _tmp23_;
	_tmp24_ = g_strdup (_ ("Custom"));
	_tmp25_ = terminal_settings_popover_theme_check_button_new (TERMINAL_THEMES_CUSTOM);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp25_, _tmp24_);
	_g_free0 (_tmp24_);
	g_object_ref_sink (_tmp25_);
	_data2_->custom_button = _tmp25_;
	_tmp26_ = (GtkGestureClick*) gtk_gesture_click_new ();
	gtk_event_controller_set_propagation_phase ((GtkEventController*) _tmp26_, GTK_PHASE_CAPTURE);
	custom_button_controller = _tmp26_;
	_tmp27_ = custom_button_controller;
	g_signal_connect_data (_tmp27_, "released", (GCallback) __terminal_settings_popover___lambda27__gtk_gesture_click_released, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
	_tmp28_ = _data2_->custom_button;
	_tmp29_ = custom_button_controller;
	_tmp30_ = _g_object_ref0 ((GtkEventController*) _tmp29_);
	gtk_widget_add_controller ((GtkWidget*) _tmp28_, _tmp30_);
	_tmp31_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	gtk_box_set_homogeneous (_tmp31_, TRUE);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp31_, 6);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp31_, 6);
	g_object_ref_sink (_tmp31_);
	theme_buttons = _tmp31_;
	_tmp32_ = theme_buttons;
	_tmp33_ = hc_button;
	gtk_box_append (_tmp32_, (GtkWidget*) _tmp33_);
	_tmp34_ = theme_buttons;
	_tmp35_ = light_button;
	gtk_box_append (_tmp34_, (GtkWidget*) _tmp35_);
	_tmp36_ = theme_buttons;
	_tmp37_ = dark_button;
	gtk_box_append (_tmp36_, (GtkWidget*) _tmp37_);
	_tmp38_ = theme_buttons;
	_tmp39_ = _data2_->custom_button;
	gtk_box_append (_tmp38_, (GtkWidget*) _tmp39_);
	_tmp40_ = theme_buttons;
	_tmp41_ = _g_object_ref0 ((GtkWidget*) _tmp40_);
	_tmp42_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_child (_tmp42_, _tmp41_);
	_g_object_unref0 (_tmp41_);
	g_object_ref_sink (_tmp42_);
	theme_revealer = _tmp42_;
	_tmp43_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp43_);
	theme_box = _tmp43_;
	_tmp44_ = theme_box;
	_tmp45_ = follow_system_button;
	gtk_box_append (_tmp44_, (GtkWidget*) _tmp45_);
	_tmp46_ = theme_box;
	_tmp47_ = theme_revealer;
	gtk_box_append (_tmp46_, (GtkWidget*) _tmp47_);
	_tmp48_ = g_strdup (_ ("Shortcuts don’t require Shift; may interfere with CLI apps"));
	_tmp49_ = g_strdup (TERMINAL_SETTINGS_POPOVER_ACTION_GROUP_PREFIX "natural-copy-paste");
	_tmp50_ = granite_switch_model_button_new (_ ("Natural Copy/Paste"));
	granite_switch_model_button_set_description (_tmp50_, _tmp48_);
	_g_free0 (_tmp48_);
	gtk_actionable_set_action_name ((GtkActionable*) _tmp50_, _tmp49_);
	_g_free0 (_tmp49_);
	g_object_ref_sink (_tmp50_);
	natural_copy_paste_button = _tmp50_;
	_tmp51_ = g_strdup (_ ("Warn when pasted text contains multiple or administrative commands"));
	_tmp52_ = g_strdup (TERMINAL_SETTINGS_POPOVER_ACTION_GROUP_PREFIX "unsafe-paste-alert");
	_tmp53_ = granite_switch_model_button_new (_ ("Unsafe Paste Alert"));
	granite_switch_model_button_set_description (_tmp53_, _tmp51_);
	_g_free0 (_tmp51_);
	gtk_actionable_set_action_name ((GtkActionable*) _tmp53_, _tmp52_);
	_g_free0 (_tmp52_);
	g_object_ref_sink (_tmp53_);
	unsafe_paste_alert_button = _tmp53_;
	_tmp54_ = g_strdup (_ ("Notify for invalid input or multiple possible completions (subject to " \
"System Settings → Sound)"));
	_tmp55_ = g_strdup (TERMINAL_SETTINGS_POPOVER_ACTION_GROUP_PREFIX "audible-bell");
	_tmp56_ = granite_switch_model_button_new (_ ("Event Alerts"));
	granite_switch_model_button_set_description (_tmp56_, _tmp54_);
	_g_free0 (_tmp54_);
	gtk_actionable_set_action_name ((GtkActionable*) _tmp56_, _tmp55_);
	_g_free0 (_tmp55_);
	g_object_ref_sink (_tmp56_);
	audible_bell_button = _tmp56_;
	_tmp57_ = g_strdup (_ ("Hide the tab bar when there is only one tab"));
	_tmp58_ = terminal_application_settings;
	_tmp59_ = granite_switch_model_button_new (_ ("Auto-hide Tab Bar"));
	granite_switch_model_button_set_description (_tmp59_, _tmp57_);
	_g_free0 (_tmp57_);
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp59_, g_settings_get_enum (_tmp58_, "tab-bar-behavior") == 1);
	g_object_ref_sink (_tmp59_);
	_data2_->auto_hide_button = _tmp59_;
	_tmp60_ = _data2_->auto_hide_button;
	g_signal_connect_data ((GtkToggleButton*) _tmp60_, "toggled", (GCallback) __terminal_settings_popover___lambda28__gtk_toggle_button_toggled, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
	_tmp61_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp61_, 6);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp61_, 12);
	g_object_ref_sink (_tmp61_);
	box = _tmp61_;
	_tmp62_ = box;
	_tmp63_ = font_size_box;
	gtk_box_append (_tmp62_, (GtkWidget*) _tmp63_);
	_tmp64_ = box;
	_tmp65_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp65_);
	_tmp66_ = _tmp65_;
	gtk_box_append (_tmp64_, (GtkWidget*) _tmp66_);
	_g_object_unref0 (_tmp66_);
	_tmp67_ = box;
	_tmp68_ = theme_box;
	gtk_box_append (_tmp67_, (GtkWidget*) _tmp68_);
	_tmp69_ = box;
	_tmp70_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp70_);
	_tmp71_ = _tmp70_;
	gtk_box_append (_tmp69_, (GtkWidget*) _tmp71_);
	_g_object_unref0 (_tmp71_);
	_tmp72_ = box;
	_tmp73_ = natural_copy_paste_button;
	gtk_box_append (_tmp72_, (GtkWidget*) _tmp73_);
	_tmp74_ = box;
	_tmp75_ = unsafe_paste_alert_button;
	gtk_box_append (_tmp74_, (GtkWidget*) _tmp75_);
	_tmp76_ = box;
	_tmp77_ = audible_bell_button;
	gtk_box_append (_tmp76_, (GtkWidget*) _tmp77_);
	_tmp78_ = box;
	_tmp79_ = _data2_->auto_hide_button;
	gtk_box_append (_tmp78_, (GtkWidget*) _tmp79_);
	_tmp80_ = box;
	gtk_popover_set_child ((GtkPopover*) self, (GtkWidget*) _tmp80_);
	_tmp81_ = terminal_application_settings;
	_tmp82_ = g_settings_create_action (_tmp81_, "theme");
	theme_action = _tmp82_;
	_tmp83_ = terminal_application_settings;
	_tmp84_ = g_settings_create_action (_tmp83_, "natural-copy-paste");
	natural_copy_paste_action = _tmp84_;
	_tmp85_ = terminal_application_settings;
	_tmp86_ = g_settings_create_action (_tmp85_, "unsafe-paste-alert");
	unsafe_paste_alert_action = _tmp86_;
	_tmp87_ = terminal_application_settings;
	_tmp88_ = g_settings_create_action (_tmp87_, "audible-bell");
	audible_bell_action = _tmp88_;
	_tmp89_ = terminal_application_settings;
	_tmp90_ = g_settings_create_action (_tmp89_, "follow-system-style");
	follow_system_style_action = _tmp90_;
	_tmp91_ = g_simple_action_group_new ();
	action_group = _tmp91_;
	_tmp92_ = action_group;
	_tmp93_ = theme_action;
	g_action_map_add_action ((GActionMap*) _tmp92_, _tmp93_);
	_tmp94_ = action_group;
	_tmp95_ = natural_copy_paste_action;
	g_action_map_add_action ((GActionMap*) _tmp94_, _tmp95_);
	_tmp96_ = action_group;
	_tmp97_ = unsafe_paste_alert_action;
	g_action_map_add_action ((GActionMap*) _tmp96_, _tmp97_);
	_tmp98_ = action_group;
	_tmp99_ = audible_bell_action;
	g_action_map_add_action ((GActionMap*) _tmp98_, _tmp99_);
	_tmp100_ = action_group;
	_tmp101_ = follow_system_style_action;
	g_action_map_add_action ((GActionMap*) _tmp100_, _tmp101_);
	_tmp102_ = action_group;
	gtk_widget_insert_action_group ((GtkWidget*) self, TERMINAL_SETTINGS_POPOVER_ACTION_GROUP_NAME, (GActionGroup*) _tmp102_);
	_tmp103_ = _data2_->custom_button;
	g_signal_connect_data ((GtkCheckButton*) _tmp103_, "toggled", (GCallback) __terminal_settings_popover___lambda29__gtk_check_button_toggled, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
	_tmp104_ = g_binding_group_new ();
	_g_object_unref0 (self->priv->terminal_binding);
	self->priv->terminal_binding = _tmp104_;
	_tmp105_ = self->priv->terminal_binding;
	_tmp106_ = zoom_default_button;
	g_binding_group_bind_with_closures (_tmp105_, "font-scale", (GObject*) _tmp106_, "label", G_BINDING_SYNC_CREATE, (GClosure*) g_cclosure_new ((GCallback) _terminal_settings_popover_font_scale_to_zoom_gbinding_transform_func, NULL, (GClosureNotify) NULL), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp107_ = follow_system_button;
	_tmp108_ = theme_revealer;
	g_object_bind_property_with_closures ((GObject*) _tmp107_, "active", (GObject*) _tmp108_, "reveal-child", G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp109_ = terminal_application_settings;
	g_signal_connect_data (_tmp109_, "changed", (GCallback) __terminal_settings_popover___lambda30__g_settings_changed, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
	_g_object_unref0 (action_group);
	_g_object_unref0 (follow_system_style_action);
	_g_object_unref0 (audible_bell_action);
	_g_object_unref0 (unsafe_paste_alert_action);
	_g_object_unref0 (natural_copy_paste_action);
	_g_object_unref0 (theme_action);
	_g_object_unref0 (box);
	_g_object_unref0 (audible_bell_button);
	_g_object_unref0 (unsafe_paste_alert_button);
	_g_object_unref0 (natural_copy_paste_button);
	_g_object_unref0 (theme_box);
	_g_object_unref0 (theme_revealer);
	_g_object_unref0 (theme_buttons);
	_g_object_unref0 (custom_button_controller);
	_g_object_unref0 (dark_button);
	_g_object_unref0 (light_button);
	_g_object_unref0 (hc_button);
	_g_object_unref0 (follow_system_button);
	_g_object_unref0 (font_size_box);
	_g_object_unref0 (zoom_in_button);
	_g_object_unref0 (zoom_default_button);
	_g_object_unref0 (zoom_out_button);
	block2_data_unref (_data2_);
	_data2_ = NULL;
	return obj;
}

static void
terminal_settings_popover_class_init (TerminalSettingsPopoverClass * klass,
                                      gpointer klass_data)
{
	terminal_settings_popover_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TerminalSettingsPopover_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_terminal_settings_popover_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_terminal_settings_popover_set_property;
	G_OBJECT_CLASS (klass)->constructor = terminal_settings_popover_constructor;
	G_OBJECT_CLASS (klass)->finalize = terminal_settings_popover_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TERMINAL_SETTINGS_POPOVER_TERMINAL_PROPERTY, terminal_settings_popover_properties[TERMINAL_SETTINGS_POPOVER_TERMINAL_PROPERTY] = g_param_spec_object ("terminal", "terminal", "terminal", TERMINAL_TYPE_TERMINAL_WIDGET, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	terminal_settings_popover_signals[TERMINAL_SETTINGS_POPOVER_SHOW_THEME_EDITOR_SIGNAL] = g_signal_new ("show-theme-editor", TERMINAL_TYPE_SETTINGS_POPOVER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
terminal_settings_popover_instance_init (TerminalSettingsPopover * self,
                                         gpointer klass)
{
	self->priv = terminal_settings_popover_get_instance_private (self);
}

static void
terminal_settings_popover_finalize (GObject * obj)
{
	TerminalSettingsPopover * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_TYPE_SETTINGS_POPOVER, TerminalSettingsPopover);
	_g_object_unref0 (self->priv->terminal_binding);
	G_OBJECT_CLASS (terminal_settings_popover_parent_class)->finalize (obj);
}

static GType
terminal_settings_popover_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TerminalSettingsPopoverClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) terminal_settings_popover_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TerminalSettingsPopover), 0, (GInstanceInitFunc) terminal_settings_popover_instance_init, NULL };
	GType terminal_settings_popover_type_id;
	terminal_settings_popover_type_id = g_type_register_static (gtk_popover_get_type (), "TerminalSettingsPopover", &g_define_type_info, 0);
	TerminalSettingsPopover_private_offset = g_type_add_instance_private (terminal_settings_popover_type_id, sizeof (TerminalSettingsPopoverPrivate));
	return terminal_settings_popover_type_id;
}

GType
terminal_settings_popover_get_type (void)
{
	static volatile gsize terminal_settings_popover_type_id__once = 0;
	if (g_once_init_enter (&terminal_settings_popover_type_id__once)) {
		GType terminal_settings_popover_type_id;
		terminal_settings_popover_type_id = terminal_settings_popover_get_type_once ();
		g_once_init_leave (&terminal_settings_popover_type_id__once, terminal_settings_popover_type_id);
	}
	return terminal_settings_popover_type_id__once;
}

static void
_vala_terminal_settings_popover_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec)
{
	TerminalSettingsPopover * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TERMINAL_TYPE_SETTINGS_POPOVER, TerminalSettingsPopover);
	switch (property_id) {
		case TERMINAL_SETTINGS_POPOVER_TERMINAL_PROPERTY:
		g_value_take_object (value, terminal_settings_popover_get_terminal (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_terminal_settings_popover_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec)
{
	TerminalSettingsPopover * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TERMINAL_TYPE_SETTINGS_POPOVER, TerminalSettingsPopover);
	switch (property_id) {
		case TERMINAL_SETTINGS_POPOVER_TERMINAL_PROPERTY:
		terminal_settings_popover_set_terminal (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

