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

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

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

#define TERMINAL_THEMES_PALETTE_SIZE 19
#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_DIALOGS_TYPE_COLOR_PREFERENCES (terminal_dialogs_color_preferences_get_type ())
#define TERMINAL_DIALOGS_COLOR_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_DIALOGS_TYPE_COLOR_PREFERENCES, TerminalDialogsColorPreferences))
#define TERMINAL_DIALOGS_COLOR_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_DIALOGS_TYPE_COLOR_PREFERENCES, TerminalDialogsColorPreferencesClass))
#define TERMINAL_DIALOGS_IS_COLOR_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_DIALOGS_TYPE_COLOR_PREFERENCES))
#define TERMINAL_DIALOGS_IS_COLOR_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_DIALOGS_TYPE_COLOR_PREFERENCES))
#define TERMINAL_DIALOGS_COLOR_PREFERENCES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_DIALOGS_TYPE_COLOR_PREFERENCES, TerminalDialogsColorPreferencesClass))

typedef struct _TerminalDialogsColorPreferences TerminalDialogsColorPreferences;
typedef struct _TerminalDialogsColorPreferencesClass TerminalDialogsColorPreferencesClass;
typedef struct _TerminalDialogsColorPreferencesPrivate TerminalDialogsColorPreferencesPrivate;
enum  {
	TERMINAL_DIALOGS_COLOR_PREFERENCES_0_PROPERTY,
	TERMINAL_DIALOGS_COLOR_PREFERENCES_NUM_PROPERTIES
};
static GParamSpec* terminal_dialogs_color_preferences_properties[TERMINAL_DIALOGS_COLOR_PREFERENCES_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))
typedef struct _Block1Data Block1Data;

struct _TerminalDialogsColorPreferences {
	GraniteDialog parent_instance;
	TerminalDialogsColorPreferencesPrivate * priv;
};

struct _TerminalDialogsColorPreferencesClass {
	GraniteDialogClass parent_class;
};

struct _TerminalDialogsColorPreferencesPrivate {
	GtkColorDialogButton* black_button;
	GtkColorDialogButton* red_button;
	GtkColorDialogButton* green_button;
	GtkColorDialogButton* yellow_button;
	GtkColorDialogButton* blue_button;
	GtkColorDialogButton* magenta_button;
	GtkColorDialogButton* cyan_button;
	GtkColorDialogButton* light_gray_button;
	GtkColorDialogButton* dark_gray_button;
	GtkColorDialogButton* light_red_button;
	GtkColorDialogButton* light_green_button;
	GtkColorDialogButton* light_yellow_button;
	GtkColorDialogButton* light_blue_button;
	GtkColorDialogButton* light_magenta_button;
	GtkColorDialogButton* light_cyan_button;
	GtkColorDialogButton* white_button;
	GtkColorDialogButton* background_button;
	GtkColorDialogButton* foreground_button;
	GtkColorDialogButton* cursor_button;
	GtkColorDialog* color_dialog;
};

struct _Block1Data {
	int _ref_count_;
	TerminalDialogsColorPreferences* self;
	GtkLabel* contrast_top_label;
	GtkLabel* contrast_bottom_label;
	GtkImage* contrast_image;
};

static gint TerminalDialogsColorPreferences_private_offset;
static gpointer terminal_dialogs_color_preferences_parent_class = NULL;
VALA_EXTERN GSettings* terminal_application_settings;

VALA_EXTERN GType terminal_dialogs_color_preferences_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TerminalDialogsColorPreferences, g_object_unref)
VALA_EXTERN TerminalDialogsColorPreferences* terminal_dialogs_color_preferences_new (GtkWindow* parent);
VALA_EXTERN TerminalDialogsColorPreferences* terminal_dialogs_color_preferences_construct (GType object_type,
                                                                               GtkWindow* parent);
static void terminal_dialogs_color_preferences_update_palette_settings (TerminalDialogsColorPreferences* self,
                                                                 GParamSpec* param);
static void terminal_dialogs_color_preferences_update_buttons_from_settings (TerminalDialogsColorPreferences* self);
static void terminal_dialogs_color_preferences_update_contrast (TerminalDialogsColorPreferences* self,
                                                         GtkImage* contrast_image);
static gdouble terminal_dialogs_color_preferences_get_contrast_ratio (TerminalDialogsColorPreferences* self,
                                                               GdkRGBA* foreground,
                                                               GdkRGBA* background);
static gdouble terminal_dialogs_color_preferences_get_luminance (TerminalDialogsColorPreferences* self,
                                                          GdkRGBA* color);
static gdouble terminal_dialogs_color_preferences_sanitize_color (TerminalDialogsColorPreferences* self,
                                                           gdouble color);
static GtkLabel* terminal_dialogs_color_preferences_settings_label (TerminalDialogsColorPreferences* self,
                                                             const gchar* text);
static GObject * terminal_dialogs_color_preferences_constructor (GType type,
                                                          guint n_construct_properties,
                                                          GObjectConstructParam * construct_properties);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void _terminal_dialogs_color_preferences___lambda60_ (TerminalDialogsColorPreferences* self);
static void __terminal_dialogs_color_preferences___lambda60__gtk_button_clicked (GtkButton* _sender,
                                                                          gpointer self);
static void _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify (GObject* _sender,
                                                                                  GParamSpec* pspec,
                                                                                  gpointer self);
static void _terminal_dialogs_color_preferences___lambda61_ (TerminalDialogsColorPreferences* self);
static void __terminal_dialogs_color_preferences___lambda61__gtk_button_clicked (GtkButton* _sender,
                                                                          gpointer self);
static void _terminal_dialogs_color_preferences___lambda62_ (Block1Data* _data1_);
static void __terminal_dialogs_color_preferences___lambda62__g_object_notify (GObject* _sender,
                                                                       GParamSpec* pspec,
                                                                       gpointer self);
static void _terminal_dialogs_color_preferences___lambda63_ (Block1Data* _data1_);
static void __terminal_dialogs_color_preferences___lambda63__g_object_notify (GObject* _sender,
                                                                       GParamSpec* pspec,
                                                                       gpointer self);
static void _terminal_dialogs_color_preferences___lambda64_ (TerminalDialogsColorPreferences* self);
static void __terminal_dialogs_color_preferences___lambda64__g_object_notify (GObject* _sender,
                                                                       GParamSpec* pspec,
                                                                       gpointer self);
static void _terminal_dialogs_color_preferences___lambda65_ (Block1Data* _data1_,
                                                      GtkStateFlags previous_flags);
static void __terminal_dialogs_color_preferences___lambda65__gtk_widget_state_flags_changed (GtkWidget* _sender,
                                                                                      GtkStateFlags previous_state_flags,
                                                                                      gpointer self);
static void terminal_dialogs_color_preferences_finalize (GObject * obj);
static GType terminal_dialogs_color_preferences_get_type_once (void);
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_dialogs_color_preferences_get_instance_private (TerminalDialogsColorPreferences* self)
{
	return G_STRUCT_MEMBER_P (self, TerminalDialogsColorPreferences_private_offset);
}

TerminalDialogsColorPreferences*
terminal_dialogs_color_preferences_construct (GType object_type,
                                              GtkWindow* parent)
{
	TerminalDialogsColorPreferences * self = NULL;
	self = (TerminalDialogsColorPreferences*) g_object_new (object_type, "transient-for", parent, NULL);
	return self;
}

TerminalDialogsColorPreferences*
terminal_dialogs_color_preferences_new (GtkWindow* parent)
{
	return terminal_dialogs_color_preferences_construct (TERMINAL_DIALOGS_TYPE_COLOR_PREFERENCES, parent);
}

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

static void
terminal_dialogs_color_preferences_update_palette_settings (TerminalDialogsColorPreferences* self,
                                                            GParamSpec* param)
{
	gchar** colors = NULL;
	GtkColorDialogButton* _tmp0_;
	GdkRGBA _tmp1_;
	gchar* _tmp2_;
	GtkColorDialogButton* _tmp3_;
	GdkRGBA _tmp4_;
	gchar* _tmp5_;
	GtkColorDialogButton* _tmp6_;
	GdkRGBA _tmp7_;
	gchar* _tmp8_;
	GtkColorDialogButton* _tmp9_;
	GdkRGBA _tmp10_;
	gchar* _tmp11_;
	GtkColorDialogButton* _tmp12_;
	GdkRGBA _tmp13_;
	gchar* _tmp14_;
	GtkColorDialogButton* _tmp15_;
	GdkRGBA _tmp16_;
	gchar* _tmp17_;
	GtkColorDialogButton* _tmp18_;
	GdkRGBA _tmp19_;
	gchar* _tmp20_;
	GtkColorDialogButton* _tmp21_;
	GdkRGBA _tmp22_;
	gchar* _tmp23_;
	GtkColorDialogButton* _tmp24_;
	GdkRGBA _tmp25_;
	gchar* _tmp26_;
	GtkColorDialogButton* _tmp27_;
	GdkRGBA _tmp28_;
	gchar* _tmp29_;
	GtkColorDialogButton* _tmp30_;
	GdkRGBA _tmp31_;
	gchar* _tmp32_;
	GtkColorDialogButton* _tmp33_;
	GdkRGBA _tmp34_;
	gchar* _tmp35_;
	GtkColorDialogButton* _tmp36_;
	GdkRGBA _tmp37_;
	gchar* _tmp38_;
	GtkColorDialogButton* _tmp39_;
	GdkRGBA _tmp40_;
	gchar* _tmp41_;
	GtkColorDialogButton* _tmp42_;
	GdkRGBA _tmp43_;
	gchar* _tmp44_;
	GtkColorDialogButton* _tmp45_;
	GdkRGBA _tmp46_;
	gchar* _tmp47_;
	gchar** _tmp48_;
	gint colors_length1;
	gint _colors_size_;
	GSettings* _tmp49_;
	gchar* _tmp50_;
	gchar* _tmp51_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (param != NULL);
	_tmp0_ = self->priv->black_button;
	_tmp1_ = *gtk_color_dialog_button_get_rgba (_tmp0_);
	_tmp2_ = gdk_rgba_to_string (&_tmp1_);
	_tmp3_ = self->priv->red_button;
	_tmp4_ = *gtk_color_dialog_button_get_rgba (_tmp3_);
	_tmp5_ = gdk_rgba_to_string (&_tmp4_);
	_tmp6_ = self->priv->green_button;
	_tmp7_ = *gtk_color_dialog_button_get_rgba (_tmp6_);
	_tmp8_ = gdk_rgba_to_string (&_tmp7_);
	_tmp9_ = self->priv->yellow_button;
	_tmp10_ = *gtk_color_dialog_button_get_rgba (_tmp9_);
	_tmp11_ = gdk_rgba_to_string (&_tmp10_);
	_tmp12_ = self->priv->blue_button;
	_tmp13_ = *gtk_color_dialog_button_get_rgba (_tmp12_);
	_tmp14_ = gdk_rgba_to_string (&_tmp13_);
	_tmp15_ = self->priv->magenta_button;
	_tmp16_ = *gtk_color_dialog_button_get_rgba (_tmp15_);
	_tmp17_ = gdk_rgba_to_string (&_tmp16_);
	_tmp18_ = self->priv->cyan_button;
	_tmp19_ = *gtk_color_dialog_button_get_rgba (_tmp18_);
	_tmp20_ = gdk_rgba_to_string (&_tmp19_);
	_tmp21_ = self->priv->light_gray_button;
	_tmp22_ = *gtk_color_dialog_button_get_rgba (_tmp21_);
	_tmp23_ = gdk_rgba_to_string (&_tmp22_);
	_tmp24_ = self->priv->dark_gray_button;
	_tmp25_ = *gtk_color_dialog_button_get_rgba (_tmp24_);
	_tmp26_ = gdk_rgba_to_string (&_tmp25_);
	_tmp27_ = self->priv->light_red_button;
	_tmp28_ = *gtk_color_dialog_button_get_rgba (_tmp27_);
	_tmp29_ = gdk_rgba_to_string (&_tmp28_);
	_tmp30_ = self->priv->light_green_button;
	_tmp31_ = *gtk_color_dialog_button_get_rgba (_tmp30_);
	_tmp32_ = gdk_rgba_to_string (&_tmp31_);
	_tmp33_ = self->priv->light_yellow_button;
	_tmp34_ = *gtk_color_dialog_button_get_rgba (_tmp33_);
	_tmp35_ = gdk_rgba_to_string (&_tmp34_);
	_tmp36_ = self->priv->light_blue_button;
	_tmp37_ = *gtk_color_dialog_button_get_rgba (_tmp36_);
	_tmp38_ = gdk_rgba_to_string (&_tmp37_);
	_tmp39_ = self->priv->light_magenta_button;
	_tmp40_ = *gtk_color_dialog_button_get_rgba (_tmp39_);
	_tmp41_ = gdk_rgba_to_string (&_tmp40_);
	_tmp42_ = self->priv->light_cyan_button;
	_tmp43_ = *gtk_color_dialog_button_get_rgba (_tmp42_);
	_tmp44_ = gdk_rgba_to_string (&_tmp43_);
	_tmp45_ = self->priv->white_button;
	_tmp46_ = *gtk_color_dialog_button_get_rgba (_tmp45_);
	_tmp47_ = gdk_rgba_to_string (&_tmp46_);
	_tmp48_ = g_new0 (gchar*, 16 + 1);
	_tmp48_[0] = _tmp2_;
	_tmp48_[1] = _tmp5_;
	_tmp48_[2] = _tmp8_;
	_tmp48_[3] = _tmp11_;
	_tmp48_[4] = _tmp14_;
	_tmp48_[5] = _tmp17_;
	_tmp48_[6] = _tmp20_;
	_tmp48_[7] = _tmp23_;
	_tmp48_[8] = _tmp26_;
	_tmp48_[9] = _tmp29_;
	_tmp48_[10] = _tmp32_;
	_tmp48_[11] = _tmp35_;
	_tmp48_[12] = _tmp38_;
	_tmp48_[13] = _tmp41_;
	_tmp48_[14] = _tmp44_;
	_tmp48_[15] = _tmp47_;
	colors = _tmp48_;
	colors_length1 = 16;
	_colors_size_ = colors_length1;
	_tmp49_ = terminal_application_settings;
	_tmp50_ = _vala_g_strjoinv (":", colors, (gint) colors_length1);
	_tmp51_ = _tmp50_;
	g_settings_set_string (_tmp49_, "palette", _tmp51_);
	_g_free0 (_tmp51_);
	colors = (_vala_array_free (colors, colors_length1, (GDestroyNotify) g_free), NULL);
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

static void
terminal_dialogs_color_preferences_update_buttons_from_settings (TerminalDialogsColorPreferences* self)
{
	GdkRGBA* color_palette = NULL;
	GdkRGBA* _tmp0_;
	gint color_palette_length1;
	gint _color_palette_size_;
	gchar* palette = NULL;
	GSettings* _tmp1_;
	gchar* _tmp2_;
	gchar* background = NULL;
	GSettings* _tmp3_;
	gchar* _tmp4_;
	gchar* foreground = NULL;
	GSettings* _tmp5_;
	gchar* _tmp6_;
	gchar* cursor = NULL;
	GSettings* _tmp7_;
	gchar* _tmp8_;
	gchar** input_palette = NULL;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar** _tmp19_;
	gchar** _tmp20_;
	gchar** _tmp21_;
	gint _tmp21__length1;
	gint input_palette_length1;
	gint _input_palette_size_;
	GtkColorDialogButton* _tmp28_;
	GdkRGBA* _tmp29_;
	gint _tmp29__length1;
	GdkRGBA _tmp30_;
	GtkColorDialogButton* _tmp31_;
	GdkRGBA* _tmp32_;
	gint _tmp32__length1;
	GdkRGBA _tmp33_;
	GtkColorDialogButton* _tmp34_;
	GdkRGBA* _tmp35_;
	gint _tmp35__length1;
	GdkRGBA _tmp36_;
	GtkColorDialogButton* _tmp37_;
	GdkRGBA* _tmp38_;
	gint _tmp38__length1;
	GdkRGBA _tmp39_;
	GtkColorDialogButton* _tmp40_;
	GdkRGBA* _tmp41_;
	gint _tmp41__length1;
	GdkRGBA _tmp42_;
	GtkColorDialogButton* _tmp43_;
	GdkRGBA* _tmp44_;
	gint _tmp44__length1;
	GdkRGBA _tmp45_;
	GtkColorDialogButton* _tmp46_;
	GdkRGBA* _tmp47_;
	gint _tmp47__length1;
	GdkRGBA _tmp48_;
	GtkColorDialogButton* _tmp49_;
	GdkRGBA* _tmp50_;
	gint _tmp50__length1;
	GdkRGBA _tmp51_;
	GtkColorDialogButton* _tmp52_;
	GdkRGBA* _tmp53_;
	gint _tmp53__length1;
	GdkRGBA _tmp54_;
	GtkColorDialogButton* _tmp55_;
	GdkRGBA* _tmp56_;
	gint _tmp56__length1;
	GdkRGBA _tmp57_;
	GtkColorDialogButton* _tmp58_;
	GdkRGBA* _tmp59_;
	gint _tmp59__length1;
	GdkRGBA _tmp60_;
	GtkColorDialogButton* _tmp61_;
	GdkRGBA* _tmp62_;
	gint _tmp62__length1;
	GdkRGBA _tmp63_;
	GtkColorDialogButton* _tmp64_;
	GdkRGBA* _tmp65_;
	gint _tmp65__length1;
	GdkRGBA _tmp66_;
	GtkColorDialogButton* _tmp67_;
	GdkRGBA* _tmp68_;
	gint _tmp68__length1;
	GdkRGBA _tmp69_;
	GtkColorDialogButton* _tmp70_;
	GdkRGBA* _tmp71_;
	gint _tmp71__length1;
	GdkRGBA _tmp72_;
	GtkColorDialogButton* _tmp73_;
	GdkRGBA* _tmp74_;
	gint _tmp74__length1;
	GdkRGBA _tmp75_;
	GtkColorDialogButton* _tmp76_;
	GdkRGBA* _tmp77_;
	gint _tmp77__length1;
	GdkRGBA _tmp78_;
	GtkColorDialogButton* _tmp79_;
	GdkRGBA* _tmp80_;
	gint _tmp80__length1;
	GdkRGBA _tmp81_;
	GtkColorDialogButton* _tmp82_;
	GdkRGBA* _tmp83_;
	gint _tmp83__length1;
	GdkRGBA _tmp84_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_new0 (GdkRGBA, TERMINAL_THEMES_PALETTE_SIZE);
	color_palette = _tmp0_;
	color_palette_length1 = TERMINAL_THEMES_PALETTE_SIZE;
	_color_palette_size_ = color_palette_length1;
	_tmp1_ = terminal_application_settings;
	_tmp2_ = g_settings_get_string (_tmp1_, "palette");
	palette = _tmp2_;
	_tmp3_ = terminal_application_settings;
	_tmp4_ = g_settings_get_string (_tmp3_, "background");
	background = _tmp4_;
	_tmp5_ = terminal_application_settings;
	_tmp6_ = g_settings_get_string (_tmp5_, "foreground");
	foreground = _tmp6_;
	_tmp7_ = terminal_application_settings;
	_tmp8_ = g_settings_get_string (_tmp7_, "cursor-color");
	cursor = _tmp8_;
	_tmp9_ = palette;
	_tmp10_ = string_to_string (_tmp9_);
	_tmp11_ = background;
	_tmp12_ = string_to_string (_tmp11_);
	_tmp13_ = foreground;
	_tmp14_ = string_to_string (_tmp13_);
	_tmp15_ = cursor;
	_tmp16_ = string_to_string (_tmp15_);
	_tmp17_ = g_strconcat (_tmp10_, ":", _tmp12_, ":", _tmp14_, ":", _tmp16_, NULL);
	_tmp18_ = _tmp17_;
	_tmp20_ = _tmp19_ = g_strsplit (_tmp18_, ":", 0);
	_tmp21_ = _tmp20_;
	_tmp21__length1 = _vala_array_length (_tmp19_);
	_g_free0 (_tmp18_);
	input_palette = _tmp21_;
	input_palette_length1 = _tmp21__length1;
	_input_palette_size_ = input_palette_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp22_ = FALSE;
			_tmp22_ = TRUE;
			while (TRUE) {
				gchar** _tmp24_;
				gint _tmp24__length1;
				GdkRGBA* _tmp25_;
				gint _tmp25__length1;
				gchar** _tmp26_;
				gint _tmp26__length1;
				const gchar* _tmp27_;
				if (!_tmp22_) {
					gint _tmp23_;
					_tmp23_ = i;
					i = _tmp23_ + 1;
				}
				_tmp22_ = FALSE;
				_tmp24_ = input_palette;
				_tmp24__length1 = input_palette_length1;
				if (!(i < _tmp24__length1)) {
					break;
				}
				_tmp25_ = color_palette;
				_tmp25__length1 = color_palette_length1;
				_tmp26_ = input_palette;
				_tmp26__length1 = input_palette_length1;
				_tmp27_ = _tmp26_[i];
				if (!gdk_rgba_parse (&_tmp25_[i], _tmp27_)) {
					g_warning ("ColorPreferencesDialog.vala:265: Found invalid color in one of the col" \
"or palette settings");
					input_palette = (_vala_array_free (input_palette, input_palette_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (cursor);
					_g_free0 (foreground);
					_g_free0 (background);
					_g_free0 (palette);
					color_palette = (g_free (color_palette), NULL);
					return;
				}
			}
		}
	}
	_tmp28_ = self->priv->black_button;
	_tmp29_ = color_palette;
	_tmp29__length1 = color_palette_length1;
	_tmp30_ = _tmp29_[0];
	gtk_color_dialog_button_set_rgba (_tmp28_, &_tmp30_);
	_tmp31_ = self->priv->red_button;
	_tmp32_ = color_palette;
	_tmp32__length1 = color_palette_length1;
	_tmp33_ = _tmp32_[1];
	gtk_color_dialog_button_set_rgba (_tmp31_, &_tmp33_);
	_tmp34_ = self->priv->green_button;
	_tmp35_ = color_palette;
	_tmp35__length1 = color_palette_length1;
	_tmp36_ = _tmp35_[2];
	gtk_color_dialog_button_set_rgba (_tmp34_, &_tmp36_);
	_tmp37_ = self->priv->yellow_button;
	_tmp38_ = color_palette;
	_tmp38__length1 = color_palette_length1;
	_tmp39_ = _tmp38_[3];
	gtk_color_dialog_button_set_rgba (_tmp37_, &_tmp39_);
	_tmp40_ = self->priv->blue_button;
	_tmp41_ = color_palette;
	_tmp41__length1 = color_palette_length1;
	_tmp42_ = _tmp41_[4];
	gtk_color_dialog_button_set_rgba (_tmp40_, &_tmp42_);
	_tmp43_ = self->priv->magenta_button;
	_tmp44_ = color_palette;
	_tmp44__length1 = color_palette_length1;
	_tmp45_ = _tmp44_[5];
	gtk_color_dialog_button_set_rgba (_tmp43_, &_tmp45_);
	_tmp46_ = self->priv->cyan_button;
	_tmp47_ = color_palette;
	_tmp47__length1 = color_palette_length1;
	_tmp48_ = _tmp47_[6];
	gtk_color_dialog_button_set_rgba (_tmp46_, &_tmp48_);
	_tmp49_ = self->priv->light_gray_button;
	_tmp50_ = color_palette;
	_tmp50__length1 = color_palette_length1;
	_tmp51_ = _tmp50_[7];
	gtk_color_dialog_button_set_rgba (_tmp49_, &_tmp51_);
	_tmp52_ = self->priv->dark_gray_button;
	_tmp53_ = color_palette;
	_tmp53__length1 = color_palette_length1;
	_tmp54_ = _tmp53_[8];
	gtk_color_dialog_button_set_rgba (_tmp52_, &_tmp54_);
	_tmp55_ = self->priv->light_red_button;
	_tmp56_ = color_palette;
	_tmp56__length1 = color_palette_length1;
	_tmp57_ = _tmp56_[9];
	gtk_color_dialog_button_set_rgba (_tmp55_, &_tmp57_);
	_tmp58_ = self->priv->light_green_button;
	_tmp59_ = color_palette;
	_tmp59__length1 = color_palette_length1;
	_tmp60_ = _tmp59_[10];
	gtk_color_dialog_button_set_rgba (_tmp58_, &_tmp60_);
	_tmp61_ = self->priv->light_yellow_button;
	_tmp62_ = color_palette;
	_tmp62__length1 = color_palette_length1;
	_tmp63_ = _tmp62_[11];
	gtk_color_dialog_button_set_rgba (_tmp61_, &_tmp63_);
	_tmp64_ = self->priv->light_blue_button;
	_tmp65_ = color_palette;
	_tmp65__length1 = color_palette_length1;
	_tmp66_ = _tmp65_[12];
	gtk_color_dialog_button_set_rgba (_tmp64_, &_tmp66_);
	_tmp67_ = self->priv->light_magenta_button;
	_tmp68_ = color_palette;
	_tmp68__length1 = color_palette_length1;
	_tmp69_ = _tmp68_[13];
	gtk_color_dialog_button_set_rgba (_tmp67_, &_tmp69_);
	_tmp70_ = self->priv->light_cyan_button;
	_tmp71_ = color_palette;
	_tmp71__length1 = color_palette_length1;
	_tmp72_ = _tmp71_[14];
	gtk_color_dialog_button_set_rgba (_tmp70_, &_tmp72_);
	_tmp73_ = self->priv->white_button;
	_tmp74_ = color_palette;
	_tmp74__length1 = color_palette_length1;
	_tmp75_ = _tmp74_[15];
	gtk_color_dialog_button_set_rgba (_tmp73_, &_tmp75_);
	_tmp76_ = self->priv->background_button;
	_tmp77_ = color_palette;
	_tmp77__length1 = color_palette_length1;
	_tmp78_ = _tmp77_[16];
	gtk_color_dialog_button_set_rgba (_tmp76_, &_tmp78_);
	_tmp79_ = self->priv->foreground_button;
	_tmp80_ = color_palette;
	_tmp80__length1 = color_palette_length1;
	_tmp81_ = _tmp80_[17];
	gtk_color_dialog_button_set_rgba (_tmp79_, &_tmp81_);
	_tmp82_ = self->priv->cursor_button;
	_tmp83_ = color_palette;
	_tmp83__length1 = color_palette_length1;
	_tmp84_ = _tmp83_[18];
	gtk_color_dialog_button_set_rgba (_tmp82_, &_tmp84_);
	input_palette = (_vala_array_free (input_palette, input_palette_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (cursor);
	_g_free0 (foreground);
	_g_free0 (background);
	_g_free0 (palette);
	color_palette = (g_free (color_palette), NULL);
}

static void
terminal_dialogs_color_preferences_update_contrast (TerminalDialogsColorPreferences* self,
                                                    GtkImage* contrast_image)
{
	gdouble contrast_ratio = 0.0;
	GtkColorDialogButton* _tmp0_;
	GtkColorDialogButton* _tmp1_;
	GdkRGBA _tmp2_;
	GdkRGBA _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (contrast_image != NULL);
	_tmp0_ = self->priv->foreground_button;
	_tmp1_ = self->priv->background_button;
	_tmp2_ = *gtk_color_dialog_button_get_rgba (_tmp0_);
	_tmp3_ = *gtk_color_dialog_button_get_rgba (_tmp1_);
	contrast_ratio = terminal_dialogs_color_preferences_get_contrast_ratio (self, &_tmp2_, &_tmp3_);
	if (contrast_ratio < ((gdouble) 3)) {
		g_object_set (contrast_image, "icon-name", "dialog-warning", NULL);
		gtk_widget_set_tooltip_text ((GtkWidget*) contrast_image, _ ("Contrast is very low"));
	} else {
		if (contrast_ratio < 4.5) {
			g_object_set (contrast_image, "icon-name", "dialog-warning", NULL);
			gtk_widget_set_tooltip_text ((GtkWidget*) contrast_image, _ ("Contrast is low"));
		} else {
			if (contrast_ratio < ((gdouble) 7)) {
				g_object_set (contrast_image, "icon-name", "process-completed", NULL);
				gtk_widget_set_tooltip_text ((GtkWidget*) contrast_image, _ ("Contrast is good"));
			} else {
				g_object_set (contrast_image, "icon-name", "process-completed", NULL);
				gtk_widget_set_tooltip_text ((GtkWidget*) contrast_image, _ ("Contrast is high"));
			}
		}
	}
}

static gdouble
terminal_dialogs_color_preferences_get_contrast_ratio (TerminalDialogsColorPreferences* self,
                                                       GdkRGBA* foreground,
                                                       GdkRGBA* background)
{
	gdouble foreground_luminance = 0.0;
	GdkRGBA _tmp0_;
	gdouble background_luminance = 0.0;
	GdkRGBA _tmp1_;
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	g_return_val_if_fail (foreground != NULL, -1.0);
	g_return_val_if_fail (background != NULL, -1.0);
	_tmp0_ = *foreground;
	foreground_luminance = terminal_dialogs_color_preferences_get_luminance (self, &_tmp0_);
	_tmp1_ = *background;
	background_luminance = terminal_dialogs_color_preferences_get_luminance (self, &_tmp1_);
	if (background_luminance > foreground_luminance) {
		result = (background_luminance + 0.05) / (foreground_luminance + 0.05);
		return result;
	} else {
		result = (foreground_luminance + 0.05) / (background_luminance + 0.05);
		return result;
	}
}

static gdouble
terminal_dialogs_color_preferences_get_luminance (TerminalDialogsColorPreferences* self,
                                                  GdkRGBA* color)
{
	gdouble red = 0.0;
	GdkRGBA _tmp0_;
	gdouble green = 0.0;
	GdkRGBA _tmp1_;
	gdouble blue = 0.0;
	GdkRGBA _tmp2_;
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	g_return_val_if_fail (color != NULL, -1.0);
	_tmp0_ = *color;
	red = terminal_dialogs_color_preferences_sanitize_color (self, (gdouble) _tmp0_.red) * 0.2126;
	_tmp1_ = *color;
	green = terminal_dialogs_color_preferences_sanitize_color (self, (gdouble) _tmp1_.green) * 0.7152;
	_tmp2_ = *color;
	blue = terminal_dialogs_color_preferences_sanitize_color (self, (gdouble) _tmp2_.blue) * 0.0722;
	result = (red + green) + blue;
	return result;
}

static gdouble
terminal_dialogs_color_preferences_sanitize_color (TerminalDialogsColorPreferences* self,
                                                   gdouble color)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	if (color <= 0.03928) {
		color = color / 12.92;
	} else {
		color = pow ((color + 0.055) / 1.055, 2.4);
	}
	result = color;
	return result;
}

static GtkLabel*
terminal_dialogs_color_preferences_settings_label (TerminalDialogsColorPreferences* self,
                                                   const gchar* text)
{
	GtkLabel* _tmp0_ = NULL;
	GtkLabel* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (text);
	gtk_widget_set_halign ((GtkWidget*) _tmp0_, GTK_ALIGN_END);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp0_, 12);
	g_object_ref_sink (_tmp0_);
	result = _tmp0_;
	return result;
}

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		TerminalDialogsColorPreferences* self;
		self = _data1_->self;
		_g_object_unref0 (_data1_->contrast_image);
		_g_object_unref0 (_data1_->contrast_bottom_label);
		_g_object_unref0 (_data1_->contrast_top_label);
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}

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

static void
_terminal_dialogs_color_preferences___lambda60_ (TerminalDialogsColorPreferences* self)
{
	g_signal_emit_by_name ((GtkDialog*) self, "close");
}

static void
__terminal_dialogs_color_preferences___lambda60__gtk_button_clicked (GtkButton* _sender,
                                                                     gpointer self)
{
	_terminal_dialogs_color_preferences___lambda60_ ((TerminalDialogsColorPreferences*) self);
}

static void
_terminal_dialogs_color_preferences_update_palette_settings_g_object_notify (GObject* _sender,
                                                                             GParamSpec* pspec,
                                                                             gpointer self)
{
	terminal_dialogs_color_preferences_update_palette_settings ((TerminalDialogsColorPreferences*) self, pspec);
}

static void
_terminal_dialogs_color_preferences___lambda61_ (TerminalDialogsColorPreferences* self)
{
	GSettings* _tmp0_;
	GSettings* _tmp1_;
	GSettings* _tmp2_;
	GSettings* _tmp3_;
	_tmp0_ = terminal_application_settings;
	g_settings_reset (_tmp0_, "palette");
	_tmp1_ = terminal_application_settings;
	g_settings_reset (_tmp1_, "background");
	_tmp2_ = terminal_application_settings;
	g_settings_reset (_tmp2_, "foreground");
	_tmp3_ = terminal_application_settings;
	g_settings_reset (_tmp3_, "cursor-color");
	terminal_dialogs_color_preferences_update_buttons_from_settings (self);
}

static void
__terminal_dialogs_color_preferences___lambda61__gtk_button_clicked (GtkButton* _sender,
                                                                     gpointer self)
{
	_terminal_dialogs_color_preferences___lambda61_ ((TerminalDialogsColorPreferences*) self);
}

static void
_terminal_dialogs_color_preferences___lambda62_ (Block1Data* _data1_)
{
	TerminalDialogsColorPreferences* self;
	GSettings* _tmp0_;
	GtkColorDialogButton* _tmp1_;
	GdkRGBA _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GtkImage* _tmp5_;
	self = _data1_->self;
	_tmp0_ = terminal_application_settings;
	_tmp1_ = self->priv->background_button;
	_tmp2_ = *gtk_color_dialog_button_get_rgba (_tmp1_);
	_tmp3_ = gdk_rgba_to_string (&_tmp2_);
	_tmp4_ = _tmp3_;
	g_settings_set_string (_tmp0_, "background", _tmp4_);
	_g_free0 (_tmp4_);
	_tmp5_ = _data1_->contrast_image;
	terminal_dialogs_color_preferences_update_contrast (self, _tmp5_);
}

static void
__terminal_dialogs_color_preferences___lambda62__g_object_notify (GObject* _sender,
                                                                  GParamSpec* pspec,
                                                                  gpointer self)
{
	_terminal_dialogs_color_preferences___lambda62_ (self);
}

static void
_terminal_dialogs_color_preferences___lambda63_ (Block1Data* _data1_)
{
	TerminalDialogsColorPreferences* self;
	GSettings* _tmp0_;
	GtkColorDialogButton* _tmp1_;
	GdkRGBA _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GtkImage* _tmp5_;
	self = _data1_->self;
	_tmp0_ = terminal_application_settings;
	_tmp1_ = self->priv->foreground_button;
	_tmp2_ = *gtk_color_dialog_button_get_rgba (_tmp1_);
	_tmp3_ = gdk_rgba_to_string (&_tmp2_);
	_tmp4_ = _tmp3_;
	g_settings_set_string (_tmp0_, "foreground", _tmp4_);
	_g_free0 (_tmp4_);
	_tmp5_ = _data1_->contrast_image;
	terminal_dialogs_color_preferences_update_contrast (self, _tmp5_);
}

static void
__terminal_dialogs_color_preferences___lambda63__g_object_notify (GObject* _sender,
                                                                  GParamSpec* pspec,
                                                                  gpointer self)
{
	_terminal_dialogs_color_preferences___lambda63_ (self);
}

static void
_terminal_dialogs_color_preferences___lambda64_ (TerminalDialogsColorPreferences* self)
{
	GSettings* _tmp0_;
	GtkColorDialogButton* _tmp1_;
	GdkRGBA _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	_tmp0_ = terminal_application_settings;
	_tmp1_ = self->priv->cursor_button;
	_tmp2_ = *gtk_color_dialog_button_get_rgba (_tmp1_);
	_tmp3_ = gdk_rgba_to_string (&_tmp2_);
	_tmp4_ = _tmp3_;
	g_settings_set_string (_tmp0_, "cursor-color", _tmp4_);
	_g_free0 (_tmp4_);
}

static void
__terminal_dialogs_color_preferences___lambda64__g_object_notify (GObject* _sender,
                                                                  GParamSpec* pspec,
                                                                  gpointer self)
{
	_terminal_dialogs_color_preferences___lambda64_ ((TerminalDialogsColorPreferences*) self);
}

static void
_terminal_dialogs_color_preferences___lambda65_ (Block1Data* _data1_,
                                                 GtkStateFlags previous_flags)
{
	TerminalDialogsColorPreferences* self;
	GtkStateFlags state_flags = 0U;
	const gchar* _tmp0_ = NULL;
	GtkLabel* _tmp1_;
	const gchar* _tmp2_ = NULL;
	GtkLabel* _tmp3_;
	self = _data1_->self;
	state_flags = gtk_widget_get_state_flags ((GtkWidget*) self);
	if ((state_flags & GTK_STATE_FLAG_DIR_LTR) == GTK_STATE_FLAG_DIR_LTR) {
		_tmp0_ = "┐";
	} else {
		_tmp0_ = "┌";
	}
	_tmp1_ = _data1_->contrast_top_label;
	gtk_label_set_label (_tmp1_, _tmp0_);
	if ((state_flags & GTK_STATE_FLAG_DIR_LTR) == GTK_STATE_FLAG_DIR_LTR) {
		_tmp2_ = "┘";
	} else {
		_tmp2_ = "└";
	}
	_tmp3_ = _data1_->contrast_bottom_label;
	gtk_label_set_label (_tmp3_, _tmp2_);
}

static void
__terminal_dialogs_color_preferences___lambda65__gtk_widget_state_flags_changed (GtkWidget* _sender,
                                                                                 GtkStateFlags previous_state_flags,
                                                                                 gpointer self)
{
	_terminal_dialogs_color_preferences___lambda65_ (self, previous_state_flags);
}

static GObject *
terminal_dialogs_color_preferences_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TerminalDialogsColorPreferences * self;
	Block1Data* _data1_;
	GtkLabel* window_theme_label = NULL;
	GtkLabel* _tmp0_;
	GraniteModeSwitch* window_theme_switch = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GraniteModeSwitch* _tmp3_ = NULL;
	GSettings* _tmp4_;
	GraniteModeSwitch* _tmp5_;
	GtkLabel* palette_header = NULL;
	GtkLabel* _tmp6_ = NULL;
	GtkLabel* _tmp7_;
	GtkButton* default_button = NULL;
	gchar* _tmp8_;
	GtkButton* _tmp9_ = NULL;
	GtkLabel* black_color_label = NULL;
	GtkLabel* _tmp10_;
	GtkLabel* red_color_label = NULL;
	GtkLabel* _tmp11_;
	GtkLabel* green_color_label = NULL;
	GtkLabel* _tmp12_;
	GtkLabel* yellow_color_label = NULL;
	GtkLabel* _tmp13_;
	GtkLabel* blue_color_label = NULL;
	GtkLabel* _tmp14_;
	GtkLabel* magenta_color_label = NULL;
	GtkLabel* _tmp15_;
	GtkLabel* cyan_color_label = NULL;
	GtkLabel* _tmp16_;
	GtkLabel* dark_gray_color_label = NULL;
	GtkLabel* _tmp17_;
	GtkLabel* white_color_label = NULL;
	GtkLabel* _tmp18_;
	GtkLabel* light_red_color_label = NULL;
	GtkLabel* _tmp19_;
	GtkLabel* light_green_color_label = NULL;
	GtkLabel* _tmp20_;
	GtkLabel* light_yellow_color_label = NULL;
	GtkLabel* _tmp21_;
	GtkLabel* light_blue_color_label = NULL;
	GtkLabel* _tmp22_;
	GtkLabel* light_magenta_color_label = NULL;
	GtkLabel* _tmp23_;
	GtkLabel* light_cyan_color_label = NULL;
	GtkLabel* _tmp24_;
	GtkLabel* light_gray_color_label = NULL;
	GtkLabel* _tmp25_;
	GtkLabel* background_label = NULL;
	GtkLabel* _tmp26_;
	GtkLabel* foreground_label = NULL;
	GtkLabel* _tmp27_;
	GtkLabel* cursor_label = NULL;
	GtkLabel* _tmp28_;
	GtkColorDialog* _tmp29_;
	GtkColorDialog* _tmp30_;
	GtkColorDialog* _tmp31_;
	GtkColorDialogButton* _tmp32_;
	GtkColorDialog* _tmp33_;
	GtkColorDialog* _tmp34_;
	GtkColorDialogButton* _tmp35_;
	GtkColorDialog* _tmp36_;
	GtkColorDialog* _tmp37_;
	GtkColorDialogButton* _tmp38_;
	GtkColorDialog* _tmp39_;
	GtkColorDialog* _tmp40_;
	GtkColorDialogButton* _tmp41_;
	GtkColorDialog* _tmp42_;
	GtkColorDialog* _tmp43_;
	GtkColorDialogButton* _tmp44_;
	GtkColorDialog* _tmp45_;
	GtkColorDialog* _tmp46_;
	GtkColorDialogButton* _tmp47_;
	GtkColorDialog* _tmp48_;
	GtkColorDialog* _tmp49_;
	GtkColorDialogButton* _tmp50_;
	GtkColorDialog* _tmp51_;
	GtkColorDialog* _tmp52_;
	GtkColorDialogButton* _tmp53_;
	GtkColorDialog* _tmp54_;
	GtkColorDialog* _tmp55_;
	GtkColorDialogButton* _tmp56_;
	GtkColorDialog* _tmp57_;
	GtkColorDialog* _tmp58_;
	GtkColorDialogButton* _tmp59_;
	GtkColorDialog* _tmp60_;
	GtkColorDialog* _tmp61_;
	GtkColorDialogButton* _tmp62_;
	GtkColorDialog* _tmp63_;
	GtkColorDialog* _tmp64_;
	GtkColorDialogButton* _tmp65_;
	GtkColorDialog* _tmp66_;
	GtkColorDialog* _tmp67_;
	GtkColorDialogButton* _tmp68_;
	GtkColorDialog* _tmp69_;
	GtkColorDialog* _tmp70_;
	GtkColorDialogButton* _tmp71_;
	GtkColorDialog* _tmp72_;
	GtkColorDialog* _tmp73_;
	GtkColorDialogButton* _tmp74_;
	GtkColorDialog* _tmp75_;
	GtkColorDialog* _tmp76_;
	GtkColorDialogButton* _tmp77_;
	GtkColorDialog* _tmp78_;
	GtkColorDialog* _tmp79_;
	GtkColorDialogButton* _tmp80_;
	GtkColorDialog* _tmp81_;
	GtkColorDialog* _tmp82_;
	GtkColorDialogButton* _tmp83_;
	GtkColorDialog* _tmp84_;
	GtkColorDialog* _tmp85_;
	GtkColorDialogButton* _tmp86_;
	GtkLabel* _tmp87_;
	GtkLabel* _tmp88_;
	GtkImage* _tmp89_ = NULL;
	GtkGrid* contrast_grid = NULL;
	GtkGrid* _tmp90_ = NULL;
	GtkGrid* _tmp91_;
	GtkLabel* _tmp92_;
	GtkGrid* _tmp93_;
	GtkImage* _tmp94_;
	GtkGrid* _tmp95_;
	GtkLabel* _tmp96_;
	GtkGrid* colors_grid = NULL;
	GtkGrid* _tmp97_ = NULL;
	GtkGrid* _tmp98_;
	GtkLabel* _tmp99_;
	GtkGrid* _tmp100_;
	GraniteModeSwitch* _tmp101_;
	GtkGrid* _tmp102_;
	GtkLabel* _tmp103_;
	GtkGrid* _tmp104_;
	GtkButton* _tmp105_;
	GtkGrid* _tmp106_;
	GtkLabel* _tmp107_;
	GtkGrid* _tmp108_;
	GtkColorDialogButton* _tmp109_;
	GtkGrid* _tmp110_;
	GtkLabel* _tmp111_;
	GtkGrid* _tmp112_;
	GtkColorDialogButton* _tmp113_;
	GtkGrid* _tmp114_;
	GtkGrid* _tmp115_;
	GtkGrid* _tmp116_;
	GtkLabel* _tmp117_;
	GtkGrid* _tmp118_;
	GtkColorDialogButton* _tmp119_;
	GtkGrid* _tmp120_;
	GtkLabel* _tmp121_;
	GtkGrid* _tmp122_;
	GtkColorDialogButton* _tmp123_;
	GtkGrid* _tmp124_;
	GtkLabel* _tmp125_;
	GtkGrid* _tmp126_;
	GtkColorDialogButton* _tmp127_;
	GtkGrid* _tmp128_;
	GtkLabel* _tmp129_;
	GtkGrid* _tmp130_;
	GtkColorDialogButton* _tmp131_;
	GtkGrid* _tmp132_;
	GtkLabel* _tmp133_;
	GtkGrid* _tmp134_;
	GtkColorDialogButton* _tmp135_;
	GtkGrid* _tmp136_;
	GtkLabel* _tmp137_;
	GtkGrid* _tmp138_;
	GtkColorDialogButton* _tmp139_;
	GtkGrid* _tmp140_;
	GtkLabel* _tmp141_;
	GtkGrid* _tmp142_;
	GtkColorDialogButton* _tmp143_;
	GtkGrid* _tmp144_;
	GtkLabel* _tmp145_;
	GtkGrid* _tmp146_;
	GtkColorDialogButton* _tmp147_;
	GtkGrid* _tmp148_;
	GtkLabel* _tmp149_;
	GtkGrid* _tmp150_;
	GtkColorDialogButton* _tmp151_;
	GtkGrid* _tmp152_;
	GtkLabel* _tmp153_;
	GtkGrid* _tmp154_;
	GtkColorDialogButton* _tmp155_;
	GtkGrid* _tmp156_;
	GtkLabel* _tmp157_;
	GtkGrid* _tmp158_;
	GtkColorDialogButton* _tmp159_;
	GtkGrid* _tmp160_;
	GtkLabel* _tmp161_;
	GtkGrid* _tmp162_;
	GtkColorDialogButton* _tmp163_;
	GtkGrid* _tmp164_;
	GtkLabel* _tmp165_;
	GtkGrid* _tmp166_;
	GtkColorDialogButton* _tmp167_;
	GtkGrid* _tmp168_;
	GtkLabel* _tmp169_;
	GtkGrid* _tmp170_;
	GtkColorDialogButton* _tmp171_;
	GtkGrid* _tmp172_;
	GtkLabel* _tmp173_;
	GtkGrid* _tmp174_;
	GtkColorDialogButton* _tmp175_;
	GtkGrid* _tmp176_;
	GtkLabel* _tmp177_;
	GtkGrid* _tmp178_;
	GtkColorDialogButton* _tmp179_;
	GtkGrid* _tmp180_;
	GtkLabel* _tmp181_;
	GtkGrid* _tmp182_;
	GtkColorDialogButton* _tmp183_;
	GtkImage* _tmp184_;
	GtkBox* _tmp185_;
	GtkGrid* _tmp186_;
	GtkButton* close_button = NULL;
	GtkWidget* _tmp187_;
	GtkButton* _tmp188_;
	GtkButton* _tmp189_;
	GSettings* _tmp190_;
	GtkColorDialogButton* _tmp191_;
	GtkColorDialogButton* _tmp192_;
	GtkColorDialogButton* _tmp193_;
	GtkColorDialogButton* _tmp194_;
	GtkColorDialogButton* _tmp195_;
	GtkColorDialogButton* _tmp196_;
	GtkColorDialogButton* _tmp197_;
	GtkColorDialogButton* _tmp198_;
	GtkColorDialogButton* _tmp199_;
	GtkColorDialogButton* _tmp200_;
	GtkColorDialogButton* _tmp201_;
	GtkColorDialogButton* _tmp202_;
	GtkColorDialogButton* _tmp203_;
	GtkColorDialogButton* _tmp204_;
	GtkColorDialogButton* _tmp205_;
	GtkColorDialogButton* _tmp206_;
	GtkButton* _tmp207_;
	GtkColorDialogButton* _tmp208_;
	GtkColorDialogButton* _tmp209_;
	GtkColorDialogButton* _tmp210_;
	GtkLabel* _tmp211_;
	parent_class = G_OBJECT_CLASS (terminal_dialogs_color_preferences_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_DIALOGS_TYPE_COLOR_PREFERENCES, TerminalDialogsColorPreferences);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->self = g_object_ref (self);
	gtk_window_set_hide_on_close ((GtkWindow*) self, TRUE);
	gtk_window_set_resizable ((GtkWindow*) self, FALSE);
	gtk_window_set_title ((GtkWindow*) self, _ ("Color Preferences"));
	_tmp0_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Window style:"));
	window_theme_label = _tmp0_;
	_tmp1_ = g_strdup (_ ("Light"));
	_tmp2_ = g_strdup (_ ("Dark"));
	_tmp3_ = granite_mode_switch_new_from_icon_name ("display-brightness-symbolic", "weather-clear-night-symbolic");
	granite_mode_switch_set_primary_icon_tooltip_text (_tmp3_, _tmp1_);
	_g_free0 (_tmp1_);
	granite_mode_switch_set_secondary_icon_tooltip_text (_tmp3_, _tmp2_);
	_g_free0 (_tmp2_);
	g_object_ref_sink (_tmp3_);
	window_theme_switch = _tmp3_;
	_tmp4_ = terminal_application_settings;
	_tmp5_ = window_theme_switch;
	g_settings_bind (_tmp4_, "prefer-dark-style", (GObject*) _tmp5_, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp6_ = (GtkLabel*) gtk_label_new (_ ("Color Palette"));
	gtk_widget_set_margin_top ((GtkWidget*) _tmp6_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp6_, 12);
	g_object_ref_sink (_tmp6_);
	palette_header = _tmp6_;
	_tmp7_ = palette_header;
	gtk_widget_add_css_class ((GtkWidget*) _tmp7_, GRANITE_STYLE_CLASS_TITLE_LABEL);
	_tmp8_ = g_strdup (_ ("Reset to default"));
	_tmp9_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-clear-all-symbolic");
	gtk_widget_set_halign ((GtkWidget*) _tmp9_, GTK_ALIGN_END);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp9_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp9_, 6);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp9_, _tmp8_);
	_g_free0 (_tmp8_);
	g_object_ref_sink (_tmp9_);
	default_button = _tmp9_;
	_tmp10_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Black:"));
	black_color_label = _tmp10_;
	_tmp11_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Red:"));
	red_color_label = _tmp11_;
	_tmp12_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Green:"));
	green_color_label = _tmp12_;
	_tmp13_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Yellow:"));
	yellow_color_label = _tmp13_;
	_tmp14_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Blue:"));
	blue_color_label = _tmp14_;
	_tmp15_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Magenta:"));
	magenta_color_label = _tmp15_;
	_tmp16_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Cyan:"));
	cyan_color_label = _tmp16_;
	_tmp17_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Gray:"));
	dark_gray_color_label = _tmp17_;
	_tmp18_ = terminal_dialogs_color_preferences_settings_label (self, _ ("White:"));
	white_color_label = _tmp18_;
	_tmp19_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Light Red:"));
	light_red_color_label = _tmp19_;
	_tmp20_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Light Green:"));
	light_green_color_label = _tmp20_;
	_tmp21_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Light Yellow:"));
	light_yellow_color_label = _tmp21_;
	_tmp22_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Light Blue:"));
	light_blue_color_label = _tmp22_;
	_tmp23_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Light Magenta:"));
	light_magenta_color_label = _tmp23_;
	_tmp24_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Light Cyan:"));
	light_cyan_color_label = _tmp24_;
	_tmp25_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Light Gray:"));
	light_gray_color_label = _tmp25_;
	_tmp26_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Background:"));
	background_label = _tmp26_;
	_tmp27_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Foreground:"));
	foreground_label = _tmp27_;
	_tmp28_ = terminal_dialogs_color_preferences_settings_label (self, _ ("Cursor:"));
	cursor_label = _tmp28_;
	_tmp29_ = gtk_color_dialog_new ();
	_g_object_unref0 (self->priv->color_dialog);
	self->priv->color_dialog = _tmp29_;
	_tmp30_ = self->priv->color_dialog;
	_tmp31_ = _g_object_ref0 (_tmp30_);
	_tmp32_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp31_);
	g_object_ref_sink (_tmp32_);
	_g_object_unref0 (self->priv->black_button);
	self->priv->black_button = _tmp32_;
	_tmp33_ = self->priv->color_dialog;
	_tmp34_ = _g_object_ref0 (_tmp33_);
	_tmp35_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp34_);
	g_object_ref_sink (_tmp35_);
	_g_object_unref0 (self->priv->red_button);
	self->priv->red_button = _tmp35_;
	_tmp36_ = self->priv->color_dialog;
	_tmp37_ = _g_object_ref0 (_tmp36_);
	_tmp38_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp37_);
	g_object_ref_sink (_tmp38_);
	_g_object_unref0 (self->priv->green_button);
	self->priv->green_button = _tmp38_;
	_tmp39_ = self->priv->color_dialog;
	_tmp40_ = _g_object_ref0 (_tmp39_);
	_tmp41_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp40_);
	g_object_ref_sink (_tmp41_);
	_g_object_unref0 (self->priv->yellow_button);
	self->priv->yellow_button = _tmp41_;
	_tmp42_ = self->priv->color_dialog;
	_tmp43_ = _g_object_ref0 (_tmp42_);
	_tmp44_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp43_);
	g_object_ref_sink (_tmp44_);
	_g_object_unref0 (self->priv->blue_button);
	self->priv->blue_button = _tmp44_;
	_tmp45_ = self->priv->color_dialog;
	_tmp46_ = _g_object_ref0 (_tmp45_);
	_tmp47_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp46_);
	g_object_ref_sink (_tmp47_);
	_g_object_unref0 (self->priv->magenta_button);
	self->priv->magenta_button = _tmp47_;
	_tmp48_ = self->priv->color_dialog;
	_tmp49_ = _g_object_ref0 (_tmp48_);
	_tmp50_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp49_);
	g_object_ref_sink (_tmp50_);
	_g_object_unref0 (self->priv->cyan_button);
	self->priv->cyan_button = _tmp50_;
	_tmp51_ = self->priv->color_dialog;
	_tmp52_ = _g_object_ref0 (_tmp51_);
	_tmp53_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp52_);
	g_object_ref_sink (_tmp53_);
	_g_object_unref0 (self->priv->light_gray_button);
	self->priv->light_gray_button = _tmp53_;
	_tmp54_ = self->priv->color_dialog;
	_tmp55_ = _g_object_ref0 (_tmp54_);
	_tmp56_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp55_);
	g_object_ref_sink (_tmp56_);
	_g_object_unref0 (self->priv->dark_gray_button);
	self->priv->dark_gray_button = _tmp56_;
	_tmp57_ = self->priv->color_dialog;
	_tmp58_ = _g_object_ref0 (_tmp57_);
	_tmp59_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp58_);
	g_object_ref_sink (_tmp59_);
	_g_object_unref0 (self->priv->light_red_button);
	self->priv->light_red_button = _tmp59_;
	_tmp60_ = self->priv->color_dialog;
	_tmp61_ = _g_object_ref0 (_tmp60_);
	_tmp62_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp61_);
	g_object_ref_sink (_tmp62_);
	_g_object_unref0 (self->priv->light_green_button);
	self->priv->light_green_button = _tmp62_;
	_tmp63_ = self->priv->color_dialog;
	_tmp64_ = _g_object_ref0 (_tmp63_);
	_tmp65_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp64_);
	g_object_ref_sink (_tmp65_);
	_g_object_unref0 (self->priv->light_yellow_button);
	self->priv->light_yellow_button = _tmp65_;
	_tmp66_ = self->priv->color_dialog;
	_tmp67_ = _g_object_ref0 (_tmp66_);
	_tmp68_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp67_);
	g_object_ref_sink (_tmp68_);
	_g_object_unref0 (self->priv->light_blue_button);
	self->priv->light_blue_button = _tmp68_;
	_tmp69_ = self->priv->color_dialog;
	_tmp70_ = _g_object_ref0 (_tmp69_);
	_tmp71_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp70_);
	g_object_ref_sink (_tmp71_);
	_g_object_unref0 (self->priv->light_magenta_button);
	self->priv->light_magenta_button = _tmp71_;
	_tmp72_ = self->priv->color_dialog;
	_tmp73_ = _g_object_ref0 (_tmp72_);
	_tmp74_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp73_);
	g_object_ref_sink (_tmp74_);
	_g_object_unref0 (self->priv->light_cyan_button);
	self->priv->light_cyan_button = _tmp74_;
	_tmp75_ = self->priv->color_dialog;
	_tmp76_ = _g_object_ref0 (_tmp75_);
	_tmp77_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp76_);
	g_object_ref_sink (_tmp77_);
	_g_object_unref0 (self->priv->white_button);
	self->priv->white_button = _tmp77_;
	_tmp78_ = self->priv->color_dialog;
	_tmp79_ = _g_object_ref0 (_tmp78_);
	_tmp80_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp79_);
	g_object_ref_sink (_tmp80_);
	_g_object_unref0 (self->priv->background_button);
	self->priv->background_button = _tmp80_;
	_tmp81_ = self->priv->color_dialog;
	_tmp82_ = _g_object_ref0 (_tmp81_);
	_tmp83_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp82_);
	g_object_ref_sink (_tmp83_);
	_g_object_unref0 (self->priv->foreground_button);
	self->priv->foreground_button = _tmp83_;
	_tmp84_ = self->priv->color_dialog;
	_tmp85_ = _g_object_ref0 (_tmp84_);
	_tmp86_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp85_);
	g_object_ref_sink (_tmp86_);
	_g_object_unref0 (self->priv->cursor_button);
	self->priv->cursor_button = _tmp86_;
	_tmp87_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp87_);
	_data1_->contrast_top_label = _tmp87_;
	_tmp88_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp88_);
	_data1_->contrast_bottom_label = _tmp88_;
	_tmp89_ = (GtkImage*) gtk_image_new_from_icon_name ("process-completed");
	gtk_image_set_pixel_size (_tmp89_, 24);
	g_object_ref_sink (_tmp89_);
	_data1_->contrast_image = _tmp89_;
	_tmp90_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_row_spacing (_tmp90_, 3);
	g_object_ref_sink (_tmp90_);
	contrast_grid = _tmp90_;
	_tmp91_ = contrast_grid;
	_tmp92_ = _data1_->contrast_top_label;
	gtk_grid_attach (_tmp91_, (GtkWidget*) _tmp92_, 0, 0, 1, 1);
	_tmp93_ = contrast_grid;
	_tmp94_ = _data1_->contrast_image;
	gtk_grid_attach (_tmp93_, (GtkWidget*) _tmp94_, 0, 1, 1, 1);
	_tmp95_ = contrast_grid;
	_tmp96_ = _data1_->contrast_bottom_label;
	gtk_grid_attach (_tmp95_, (GtkWidget*) _tmp96_, 0, 2, 1, 1);
	_tmp97_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_spacing (_tmp97_, 12);
	gtk_grid_set_row_spacing (_tmp97_, 6);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp97_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp97_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp97_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp97_, 12);
	gtk_widget_set_halign ((GtkWidget*) _tmp97_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp97_);
	colors_grid = _tmp97_;
	_tmp98_ = colors_grid;
	_tmp99_ = window_theme_label;
	gtk_grid_attach (_tmp98_, (GtkWidget*) _tmp99_, 0, 1, 1, 1);
	_tmp100_ = colors_grid;
	_tmp101_ = window_theme_switch;
	gtk_grid_attach (_tmp100_, (GtkWidget*) _tmp101_, 1, 1, 2, 1);
	_tmp102_ = colors_grid;
	_tmp103_ = palette_header;
	gtk_grid_attach (_tmp102_, (GtkWidget*) _tmp103_, 0, 2, 1, 1);
	_tmp104_ = colors_grid;
	_tmp105_ = default_button;
	gtk_grid_attach (_tmp104_, (GtkWidget*) _tmp105_, 3, 2, 1, 1);
	_tmp106_ = colors_grid;
	_tmp107_ = background_label;
	gtk_grid_attach (_tmp106_, (GtkWidget*) _tmp107_, 0, 4, 1, 1);
	_tmp108_ = colors_grid;
	_tmp109_ = self->priv->background_button;
	gtk_grid_attach (_tmp108_, (GtkWidget*) _tmp109_, 1, 4, 1, 1);
	_tmp110_ = colors_grid;
	_tmp111_ = foreground_label;
	gtk_grid_attach (_tmp110_, (GtkWidget*) _tmp111_, 0, 5, 1, 1);
	_tmp112_ = colors_grid;
	_tmp113_ = self->priv->foreground_button;
	gtk_grid_attach (_tmp112_, (GtkWidget*) _tmp113_, 1, 5, 1, 1);
	_tmp114_ = colors_grid;
	_tmp115_ = contrast_grid;
	gtk_grid_attach (_tmp114_, (GtkWidget*) _tmp115_, 2, 4, 1, 2);
	_tmp116_ = colors_grid;
	_tmp117_ = cursor_label;
	gtk_grid_attach (_tmp116_, (GtkWidget*) _tmp117_, 0, 6, 1, 1);
	_tmp118_ = colors_grid;
	_tmp119_ = self->priv->cursor_button;
	gtk_grid_attach (_tmp118_, (GtkWidget*) _tmp119_, 1, 6, 1, 1);
	_tmp120_ = colors_grid;
	_tmp121_ = black_color_label;
	gtk_grid_attach (_tmp120_, (GtkWidget*) _tmp121_, 0, 8, 1, 1);
	_tmp122_ = colors_grid;
	_tmp123_ = self->priv->black_button;
	gtk_grid_attach (_tmp122_, (GtkWidget*) _tmp123_, 1, 8, 1, 1);
	_tmp124_ = colors_grid;
	_tmp125_ = dark_gray_color_label;
	gtk_grid_attach (_tmp124_, (GtkWidget*) _tmp125_, 2, 8, 1, 1);
	_tmp126_ = colors_grid;
	_tmp127_ = self->priv->dark_gray_button;
	gtk_grid_attach (_tmp126_, (GtkWidget*) _tmp127_, 3, 8, 1, 1);
	_tmp128_ = colors_grid;
	_tmp129_ = red_color_label;
	gtk_grid_attach (_tmp128_, (GtkWidget*) _tmp129_, 0, 9, 1, 1);
	_tmp130_ = colors_grid;
	_tmp131_ = self->priv->red_button;
	gtk_grid_attach (_tmp130_, (GtkWidget*) _tmp131_, 1, 9, 1, 1);
	_tmp132_ = colors_grid;
	_tmp133_ = light_red_color_label;
	gtk_grid_attach (_tmp132_, (GtkWidget*) _tmp133_, 2, 9, 1, 1);
	_tmp134_ = colors_grid;
	_tmp135_ = self->priv->light_red_button;
	gtk_grid_attach (_tmp134_, (GtkWidget*) _tmp135_, 3, 9, 1, 1);
	_tmp136_ = colors_grid;
	_tmp137_ = green_color_label;
	gtk_grid_attach (_tmp136_, (GtkWidget*) _tmp137_, 0, 10, 1, 1);
	_tmp138_ = colors_grid;
	_tmp139_ = self->priv->green_button;
	gtk_grid_attach (_tmp138_, (GtkWidget*) _tmp139_, 1, 10, 1, 1);
	_tmp140_ = colors_grid;
	_tmp141_ = light_green_color_label;
	gtk_grid_attach (_tmp140_, (GtkWidget*) _tmp141_, 2, 10, 1, 1);
	_tmp142_ = colors_grid;
	_tmp143_ = self->priv->light_green_button;
	gtk_grid_attach (_tmp142_, (GtkWidget*) _tmp143_, 3, 10, 1, 1);
	_tmp144_ = colors_grid;
	_tmp145_ = yellow_color_label;
	gtk_grid_attach (_tmp144_, (GtkWidget*) _tmp145_, 0, 11, 1, 1);
	_tmp146_ = colors_grid;
	_tmp147_ = self->priv->yellow_button;
	gtk_grid_attach (_tmp146_, (GtkWidget*) _tmp147_, 1, 11, 1, 1);
	_tmp148_ = colors_grid;
	_tmp149_ = light_yellow_color_label;
	gtk_grid_attach (_tmp148_, (GtkWidget*) _tmp149_, 2, 11, 1, 1);
	_tmp150_ = colors_grid;
	_tmp151_ = self->priv->light_yellow_button;
	gtk_grid_attach (_tmp150_, (GtkWidget*) _tmp151_, 3, 11, 1, 1);
	_tmp152_ = colors_grid;
	_tmp153_ = blue_color_label;
	gtk_grid_attach (_tmp152_, (GtkWidget*) _tmp153_, 0, 12, 1, 1);
	_tmp154_ = colors_grid;
	_tmp155_ = self->priv->blue_button;
	gtk_grid_attach (_tmp154_, (GtkWidget*) _tmp155_, 1, 12, 1, 1);
	_tmp156_ = colors_grid;
	_tmp157_ = light_blue_color_label;
	gtk_grid_attach (_tmp156_, (GtkWidget*) _tmp157_, 2, 12, 1, 1);
	_tmp158_ = colors_grid;
	_tmp159_ = self->priv->light_blue_button;
	gtk_grid_attach (_tmp158_, (GtkWidget*) _tmp159_, 3, 12, 1, 1);
	_tmp160_ = colors_grid;
	_tmp161_ = magenta_color_label;
	gtk_grid_attach (_tmp160_, (GtkWidget*) _tmp161_, 0, 13, 1, 1);
	_tmp162_ = colors_grid;
	_tmp163_ = self->priv->magenta_button;
	gtk_grid_attach (_tmp162_, (GtkWidget*) _tmp163_, 1, 13, 1, 1);
	_tmp164_ = colors_grid;
	_tmp165_ = light_magenta_color_label;
	gtk_grid_attach (_tmp164_, (GtkWidget*) _tmp165_, 2, 13, 1, 1);
	_tmp166_ = colors_grid;
	_tmp167_ = self->priv->light_magenta_button;
	gtk_grid_attach (_tmp166_, (GtkWidget*) _tmp167_, 3, 13, 1, 1);
	_tmp168_ = colors_grid;
	_tmp169_ = cyan_color_label;
	gtk_grid_attach (_tmp168_, (GtkWidget*) _tmp169_, 0, 14, 1, 1);
	_tmp170_ = colors_grid;
	_tmp171_ = self->priv->cyan_button;
	gtk_grid_attach (_tmp170_, (GtkWidget*) _tmp171_, 1, 14, 1, 1);
	_tmp172_ = colors_grid;
	_tmp173_ = light_cyan_color_label;
	gtk_grid_attach (_tmp172_, (GtkWidget*) _tmp173_, 2, 14, 1, 1);
	_tmp174_ = colors_grid;
	_tmp175_ = self->priv->light_cyan_button;
	gtk_grid_attach (_tmp174_, (GtkWidget*) _tmp175_, 3, 14, 1, 1);
	_tmp176_ = colors_grid;
	_tmp177_ = light_gray_color_label;
	gtk_grid_attach (_tmp176_, (GtkWidget*) _tmp177_, 0, 15, 1, 1);
	_tmp178_ = colors_grid;
	_tmp179_ = self->priv->light_gray_button;
	gtk_grid_attach (_tmp178_, (GtkWidget*) _tmp179_, 1, 15, 1, 1);
	_tmp180_ = colors_grid;
	_tmp181_ = white_color_label;
	gtk_grid_attach (_tmp180_, (GtkWidget*) _tmp181_, 2, 15, 1, 1);
	_tmp182_ = colors_grid;
	_tmp183_ = self->priv->white_button;
	gtk_grid_attach (_tmp182_, (GtkWidget*) _tmp183_, 3, 15, 1, 1);
	terminal_dialogs_color_preferences_update_buttons_from_settings (self);
	_tmp184_ = _data1_->contrast_image;
	terminal_dialogs_color_preferences_update_contrast (self, _tmp184_);
	_tmp185_ = gtk_dialog_get_content_area ((GtkDialog*) self);
	_tmp186_ = colors_grid;
	gtk_box_append (_tmp185_, (GtkWidget*) _tmp186_);
	_tmp187_ = granite_dialog_add_button ((GraniteDialog*) self, _ ("Close"), (gint) GTK_RESPONSE_CLOSE);
	_tmp188_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp187_, gtk_button_get_type (), GtkButton));
	close_button = _tmp188_;
	_tmp189_ = close_button;
	g_signal_connect_object (_tmp189_, "clicked", (GCallback) __terminal_dialogs_color_preferences___lambda60__gtk_button_clicked, self, 0);
	_tmp190_ = terminal_application_settings;
	g_settings_set_string (_tmp190_, "theme", TERMINAL_THEMES_CUSTOM);
	_tmp191_ = self->priv->black_button;
	g_signal_connect_object ((GObject*) _tmp191_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp192_ = self->priv->red_button;
	g_signal_connect_object ((GObject*) _tmp192_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp193_ = self->priv->green_button;
	g_signal_connect_object ((GObject*) _tmp193_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp194_ = self->priv->yellow_button;
	g_signal_connect_object ((GObject*) _tmp194_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp195_ = self->priv->blue_button;
	g_signal_connect_object ((GObject*) _tmp195_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp196_ = self->priv->magenta_button;
	g_signal_connect_object ((GObject*) _tmp196_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp197_ = self->priv->cyan_button;
	g_signal_connect_object ((GObject*) _tmp197_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp198_ = self->priv->light_gray_button;
	g_signal_connect_object ((GObject*) _tmp198_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp199_ = self->priv->dark_gray_button;
	g_signal_connect_object ((GObject*) _tmp199_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp200_ = self->priv->light_red_button;
	g_signal_connect_object ((GObject*) _tmp200_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp201_ = self->priv->light_green_button;
	g_signal_connect_object ((GObject*) _tmp201_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp202_ = self->priv->light_yellow_button;
	g_signal_connect_object ((GObject*) _tmp202_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp203_ = self->priv->light_blue_button;
	g_signal_connect_object ((GObject*) _tmp203_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp204_ = self->priv->light_magenta_button;
	g_signal_connect_object ((GObject*) _tmp204_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp205_ = self->priv->light_cyan_button;
	g_signal_connect_object ((GObject*) _tmp205_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp206_ = self->priv->white_button;
	g_signal_connect_object ((GObject*) _tmp206_, "notify::rgba", (GCallback) _terminal_dialogs_color_preferences_update_palette_settings_g_object_notify, self, 0);
	_tmp207_ = default_button;
	g_signal_connect_object (_tmp207_, "clicked", (GCallback) __terminal_dialogs_color_preferences___lambda61__gtk_button_clicked, self, 0);
	_tmp208_ = self->priv->background_button;
	g_signal_connect_data ((GObject*) _tmp208_, "notify::rgba", (GCallback) __terminal_dialogs_color_preferences___lambda62__g_object_notify, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
	_tmp209_ = self->priv->foreground_button;
	g_signal_connect_data ((GObject*) _tmp209_, "notify::rgba", (GCallback) __terminal_dialogs_color_preferences___lambda63__g_object_notify, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
	_tmp210_ = self->priv->cursor_button;
	g_signal_connect_object ((GObject*) _tmp210_, "notify::rgba", (GCallback) __terminal_dialogs_color_preferences___lambda64__g_object_notify, self, 0);
	_tmp211_ = _data1_->contrast_top_label;
	g_signal_connect_data ((GtkWidget*) _tmp211_, "state-flags-changed", (GCallback) __terminal_dialogs_color_preferences___lambda65__gtk_widget_state_flags_changed, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
	_g_object_unref0 (close_button);
	_g_object_unref0 (colors_grid);
	_g_object_unref0 (contrast_grid);
	_g_object_unref0 (cursor_label);
	_g_object_unref0 (foreground_label);
	_g_object_unref0 (background_label);
	_g_object_unref0 (light_gray_color_label);
	_g_object_unref0 (light_cyan_color_label);
	_g_object_unref0 (light_magenta_color_label);
	_g_object_unref0 (light_blue_color_label);
	_g_object_unref0 (light_yellow_color_label);
	_g_object_unref0 (light_green_color_label);
	_g_object_unref0 (light_red_color_label);
	_g_object_unref0 (white_color_label);
	_g_object_unref0 (dark_gray_color_label);
	_g_object_unref0 (cyan_color_label);
	_g_object_unref0 (magenta_color_label);
	_g_object_unref0 (blue_color_label);
	_g_object_unref0 (yellow_color_label);
	_g_object_unref0 (green_color_label);
	_g_object_unref0 (red_color_label);
	_g_object_unref0 (black_color_label);
	_g_object_unref0 (default_button);
	_g_object_unref0 (palette_header);
	_g_object_unref0 (window_theme_switch);
	_g_object_unref0 (window_theme_label);
	block1_data_unref (_data1_);
	_data1_ = NULL;
	return obj;
}

static void
terminal_dialogs_color_preferences_class_init (TerminalDialogsColorPreferencesClass * klass,
                                               gpointer klass_data)
{
	terminal_dialogs_color_preferences_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TerminalDialogsColorPreferences_private_offset);
	G_OBJECT_CLASS (klass)->constructor = terminal_dialogs_color_preferences_constructor;
	G_OBJECT_CLASS (klass)->finalize = terminal_dialogs_color_preferences_finalize;
}

static void
terminal_dialogs_color_preferences_instance_init (TerminalDialogsColorPreferences * self,
                                                  gpointer klass)
{
	self->priv = terminal_dialogs_color_preferences_get_instance_private (self);
}

static void
terminal_dialogs_color_preferences_finalize (GObject * obj)
{
	TerminalDialogsColorPreferences * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_DIALOGS_TYPE_COLOR_PREFERENCES, TerminalDialogsColorPreferences);
	_g_object_unref0 (self->priv->black_button);
	_g_object_unref0 (self->priv->red_button);
	_g_object_unref0 (self->priv->green_button);
	_g_object_unref0 (self->priv->yellow_button);
	_g_object_unref0 (self->priv->blue_button);
	_g_object_unref0 (self->priv->magenta_button);
	_g_object_unref0 (self->priv->cyan_button);
	_g_object_unref0 (self->priv->light_gray_button);
	_g_object_unref0 (self->priv->dark_gray_button);
	_g_object_unref0 (self->priv->light_red_button);
	_g_object_unref0 (self->priv->light_green_button);
	_g_object_unref0 (self->priv->light_yellow_button);
	_g_object_unref0 (self->priv->light_blue_button);
	_g_object_unref0 (self->priv->light_magenta_button);
	_g_object_unref0 (self->priv->light_cyan_button);
	_g_object_unref0 (self->priv->white_button);
	_g_object_unref0 (self->priv->background_button);
	_g_object_unref0 (self->priv->foreground_button);
	_g_object_unref0 (self->priv->cursor_button);
	_g_object_unref0 (self->priv->color_dialog);
	G_OBJECT_CLASS (terminal_dialogs_color_preferences_parent_class)->finalize (obj);
}

static GType
terminal_dialogs_color_preferences_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TerminalDialogsColorPreferencesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) terminal_dialogs_color_preferences_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TerminalDialogsColorPreferences), 0, (GInstanceInitFunc) terminal_dialogs_color_preferences_instance_init, NULL };
	GType terminal_dialogs_color_preferences_type_id;
	terminal_dialogs_color_preferences_type_id = g_type_register_static (GRANITE_TYPE_DIALOG, "TerminalDialogsColorPreferences", &g_define_type_info, 0);
	TerminalDialogsColorPreferences_private_offset = g_type_add_instance_private (terminal_dialogs_color_preferences_type_id, sizeof (TerminalDialogsColorPreferencesPrivate));
	return terminal_dialogs_color_preferences_type_id;
}

GType
terminal_dialogs_color_preferences_get_type (void)
{
	static volatile gsize terminal_dialogs_color_preferences_type_id__once = 0;
	if (g_once_init_enter (&terminal_dialogs_color_preferences_type_id__once)) {
		GType terminal_dialogs_color_preferences_type_id;
		terminal_dialogs_color_preferences_type_id = terminal_dialogs_color_preferences_get_type_once ();
		g_once_init_leave (&terminal_dialogs_color_preferences_type_id__once, terminal_dialogs_color_preferences_type_id);
	}
	return terminal_dialogs_color_preferences_type_id__once;
}

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

