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

/*-
 * Copyright 2014–2024 elementary, Inc.
 *           2014–2018 Corentin Noël <corentin@elementary.io>
 *
 * This software is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this software; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

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

#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

enum  {
	DISPLAY_DISPLAY_WIDGET_0_PROPERTY,
	DISPLAY_DISPLAY_WIDGET_VIRTUAL_MONITOR_PROPERTY,
	DISPLAY_DISPLAY_WIDGET_BG_COLOR_PROPERTY,
	DISPLAY_DISPLAY_WIDGET_TEXT_COLOR_PROPERTY,
	DISPLAY_DISPLAY_WIDGET_DISPLAY_NAME_PROPERTY,
	DISPLAY_DISPLAY_WIDGET_WINDOW_RATIO_PROPERTY,
	DISPLAY_DISPLAY_WIDGET_CONNECTED_PROPERTY,
	DISPLAY_DISPLAY_WIDGET_NUM_PROPERTIES
};
static GParamSpec* display_display_widget_properties[DISPLAY_DISPLAY_WIDGET_NUM_PROPERTIES];
typedef enum  {
	DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_NAME,
	DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_WIDTH,
	DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_HEIGHT,
	DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_TOTAL
} DisplayDisplayWidgetResolutionColumns;

#define DISPLAY_DISPLAY_WIDGET_TYPE_RESOLUTION_COLUMNS (display_display_widget_resolution_columns_get_type ())
typedef enum  {
	DISPLAY_DISPLAY_WIDGET_ROTATION_COLUMNS_NAME,
	DISPLAY_DISPLAY_WIDGET_ROTATION_COLUMNS_VALUE,
	DISPLAY_DISPLAY_WIDGET_ROTATION_COLUMNS_TOTAL
} DisplayDisplayWidgetRotationColumns;

#define DISPLAY_DISPLAY_WIDGET_TYPE_ROTATION_COLUMNS (display_display_widget_rotation_columns_get_type ())
typedef enum  {
	DISPLAY_DISPLAY_WIDGET_REFRESH_COLUMNS_NAME,
	DISPLAY_DISPLAY_WIDGET_REFRESH_COLUMNS_VALUE,
	DISPLAY_DISPLAY_WIDGET_REFRESH_COLUMNS_TOTAL
} DisplayDisplayWidgetRefreshColumns;

#define DISPLAY_DISPLAY_WIDGET_TYPE_REFRESH_COLUMNS (display_display_widget_refresh_columns_get_type ())
#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 _Block4Data Block4Data;
typedef struct _Block5Data Block5Data;
typedef struct _Block6Data Block6Data;
#define _gtk_expression_unref0(var) ((var == NULL) ? NULL : (var = (gtk_expression_unref (var), NULL)))
enum  {
	DISPLAY_DISPLAY_WIDGET_SET_AS_PRIMARY_SIGNAL,
	DISPLAY_DISPLAY_WIDGET_CHECK_POSITION_SIGNAL,
	DISPLAY_DISPLAY_WIDGET_CONFIGURATION_CHANGED_SIGNAL,
	DISPLAY_DISPLAY_WIDGET_ACTIVE_CHANGED_SIGNAL,
	DISPLAY_DISPLAY_WIDGET_NUM_SIGNALS
};
static guint display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_NUM_SIGNALS] = {0};

struct _DisplayDisplayWidgetPrivate {
	DisplayVirtualMonitor* _virtual_monitor;
	gchar* _bg_color;
	gchar* _text_color;
	gdouble _window_ratio;
	gboolean _connected;
	GtkButton* primary_image;
	GraniteSwitchModelButton* use_switch;
	GtkComboBox* resolution_combobox;
	GtkTreeStore* resolution_tree_store;
	GtkComboBox* refresh_combobox;
	GtkListStore* refresh_list_store;
	GtkDropDown* scale_drop_down;
	gint real_width;
	gint real_height;
};

struct _Block4Data {
	int _ref_count_;
	DisplayDisplayWidget* self;
	gboolean _result_;
};

struct _Block5Data {
	int _ref_count_;
	Block4Data * _data4_;
	DisplayMonitorMode* mode;
};

struct _Block6Data {
	int _ref_count_;
	DisplayDisplayWidget* self;
	gchar* virtual_monitor_name;
	GtkLabel* label;
	GtkPopover* popover;
};

static gint DisplayDisplayWidget_private_offset;
static gpointer display_display_widget_parent_class = NULL;

static GType display_display_widget_resolution_columns_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static GType display_display_widget_rotation_columns_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static GType display_display_widget_refresh_columns_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void display_display_widget_populate_refresh_rates (DisplayDisplayWidget* self);
static gboolean _vala_double_array_contains (gdouble * stack,
                                      gssize stack_length,
                                      const gdouble needle);
static void _vala_array_add4 (gdouble* * array,
                       gint* length,
                       gint* size,
                       gdouble value);
static void display_display_widget_on_monitor_modes_changed (DisplayDisplayWidget* self);
static gboolean display_display_widget_set_active_resolution_from_current_mode (DisplayDisplayWidget* self);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static Block5Data* block5_data_ref (Block5Data* _data5_);
static void block5_data_unref (void * _userdata_);
static gboolean ____lambda5_ (Block5Data* _data5_,
                       GtkTreeModel* model,
                       GtkTreePath* path,
                       GtkTreeIter* iter);
static gboolean _____lambda5__gtk_tree_model_foreach_func (GtkTreeModel* model,
                                                    GtkTreePath* path,
                                                    GtkTreeIter* iter,
                                                    gpointer self);
static void display_display_widget_set_window_ratio (DisplayDisplayWidget* self,
                                              gdouble value);
static GObject * display_display_widget_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
static void _display_display_widget___lambda6_ (DisplayDisplayWidget* self);
static void __display_display_widget___lambda6__gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self);
static gint _display_monitor_mode_resolution_compare_func_gcompare_data_func (gconstpointer a,
                                                                       gconstpointer b,
                                                                       gpointer self);
static void _vala_array_add5 (DisplayResolution* * array,
                       gint* length,
                       gint* size,
                       const DisplayResolution* value);
static void _vala_array_add6 (DisplayResolution* * array,
                       gint* length,
                       gint* size,
                       const DisplayResolution* value);
static void _vala_array_add7 (DisplayResolution* * array,
                       gint* length,
                       gint* size,
                       const DisplayResolution* value);
static void _display_display_widget___lambda7_ (DisplayDisplayWidget* self);
static void __display_display_widget___lambda7__g_object_notify (GObject* _sender,
                                                          GParamSpec* pspec,
                                                          gpointer self);
static void _display_display_widget___lambda8_ (Block6Data* _data6_);
static void __display_display_widget___lambda8__gtk_combo_box_changed (GtkComboBox* _sender,
                                                                gpointer self);
static void _display_display_widget___lambda9_ (Block6Data* _data6_);
static void __display_display_widget___lambda9__gtk_selection_model_selection_changed (GtkSelectionModel* _sender,
                                                                                guint position,
                                                                                guint n_items,
                                                                                gpointer self);
static void _display_display_widget___lambda10_ (Block6Data* _data6_);
static void __display_display_widget___lambda10__gtk_combo_box_changed (GtkComboBox* _sender,
                                                                 gpointer self);
static void _display_display_widget___lambda11_ (Block6Data* _data6_);
static void __display_display_widget___lambda11__g_object_notify (GObject* _sender,
                                                           GParamSpec* pspec,
                                                           gpointer self);
static void _display_display_widget_on_monitor_modes_changed_display_virtual_monitor_modes_changed (DisplayVirtualMonitor* _sender,
                                                                                             gpointer self);
static void display_display_widget_finalize (GObject * obj);
static GType display_display_widget_get_type_once (void);
static void _vala_display_display_widget_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec);
static void _vala_display_display_widget_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

DisplayResolution*
display_resolution_dup (const DisplayResolution* self)
{
	DisplayResolution* dup;
	dup = g_new0 (DisplayResolution, 1);
	memcpy (dup, self, sizeof (DisplayResolution));
	return dup;
}

void
display_resolution_free (DisplayResolution* self)
{
	g_free (self);
}

static GType
display_resolution_get_type_once (void)
{
	GType display_resolution_type_id;
	display_resolution_type_id = g_boxed_type_register_static ("DisplayResolution", (GBoxedCopyFunc) display_resolution_dup, (GBoxedFreeFunc) display_resolution_free);
	return display_resolution_type_id;
}

GType
display_resolution_get_type (void)
{
	static volatile gsize display_resolution_type_id__once = 0;
	if (g_once_init_enter (&display_resolution_type_id__once)) {
		GType display_resolution_type_id;
		display_resolution_type_id = display_resolution_get_type_once ();
		g_once_init_leave (&display_resolution_type_id__once, display_resolution_type_id);
	}
	return display_resolution_type_id__once;
}

static inline gpointer
display_display_widget_get_instance_private (DisplayDisplayWidget* self)
{
	return G_STRUCT_MEMBER_P (self, DisplayDisplayWidget_private_offset);
}

static GType
display_display_widget_resolution_columns_get_type_once (void)
{
	static const GEnumValue values[] = {{DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_NAME, "DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_NAME", "name"}, {DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_WIDTH, "DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_WIDTH", "width"}, {DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_HEIGHT, "DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_HEIGHT", "height"}, {DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_TOTAL, "DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_TOTAL", "total"}, {0, NULL, NULL}};
	GType display_display_widget_resolution_columns_type_id;
	display_display_widget_resolution_columns_type_id = g_enum_register_static ("DisplayDisplayWidgetResolutionColumns", values);
	return display_display_widget_resolution_columns_type_id;
}

static GType
display_display_widget_resolution_columns_get_type (void)
{
	static volatile gsize display_display_widget_resolution_columns_type_id__once = 0;
	if (g_once_init_enter (&display_display_widget_resolution_columns_type_id__once)) {
		GType display_display_widget_resolution_columns_type_id;
		display_display_widget_resolution_columns_type_id = display_display_widget_resolution_columns_get_type_once ();
		g_once_init_leave (&display_display_widget_resolution_columns_type_id__once, display_display_widget_resolution_columns_type_id);
	}
	return display_display_widget_resolution_columns_type_id__once;
}

static GType
display_display_widget_rotation_columns_get_type_once (void)
{
	static const GEnumValue values[] = {{DISPLAY_DISPLAY_WIDGET_ROTATION_COLUMNS_NAME, "DISPLAY_DISPLAY_WIDGET_ROTATION_COLUMNS_NAME", "name"}, {DISPLAY_DISPLAY_WIDGET_ROTATION_COLUMNS_VALUE, "DISPLAY_DISPLAY_WIDGET_ROTATION_COLUMNS_VALUE", "value"}, {DISPLAY_DISPLAY_WIDGET_ROTATION_COLUMNS_TOTAL, "DISPLAY_DISPLAY_WIDGET_ROTATION_COLUMNS_TOTAL", "total"}, {0, NULL, NULL}};
	GType display_display_widget_rotation_columns_type_id;
	display_display_widget_rotation_columns_type_id = g_enum_register_static ("DisplayDisplayWidgetRotationColumns", values);
	return display_display_widget_rotation_columns_type_id;
}

static GType
display_display_widget_rotation_columns_get_type (void)
{
	static volatile gsize display_display_widget_rotation_columns_type_id__once = 0;
	if (g_once_init_enter (&display_display_widget_rotation_columns_type_id__once)) {
		GType display_display_widget_rotation_columns_type_id;
		display_display_widget_rotation_columns_type_id = display_display_widget_rotation_columns_get_type_once ();
		g_once_init_leave (&display_display_widget_rotation_columns_type_id__once, display_display_widget_rotation_columns_type_id);
	}
	return display_display_widget_rotation_columns_type_id__once;
}

static GType
display_display_widget_refresh_columns_get_type_once (void)
{
	static const GEnumValue values[] = {{DISPLAY_DISPLAY_WIDGET_REFRESH_COLUMNS_NAME, "DISPLAY_DISPLAY_WIDGET_REFRESH_COLUMNS_NAME", "name"}, {DISPLAY_DISPLAY_WIDGET_REFRESH_COLUMNS_VALUE, "DISPLAY_DISPLAY_WIDGET_REFRESH_COLUMNS_VALUE", "value"}, {DISPLAY_DISPLAY_WIDGET_REFRESH_COLUMNS_TOTAL, "DISPLAY_DISPLAY_WIDGET_REFRESH_COLUMNS_TOTAL", "total"}, {0, NULL, NULL}};
	GType display_display_widget_refresh_columns_type_id;
	display_display_widget_refresh_columns_type_id = g_enum_register_static ("DisplayDisplayWidgetRefreshColumns", values);
	return display_display_widget_refresh_columns_type_id;
}

static GType
display_display_widget_refresh_columns_get_type (void)
{
	static volatile gsize display_display_widget_refresh_columns_type_id__once = 0;
	if (g_once_init_enter (&display_display_widget_refresh_columns_type_id__once)) {
		GType display_display_widget_refresh_columns_type_id;
		display_display_widget_refresh_columns_type_id = display_display_widget_refresh_columns_get_type_once ();
		g_once_init_leave (&display_display_widget_refresh_columns_type_id__once, display_display_widget_refresh_columns_type_id);
	}
	return display_display_widget_refresh_columns_type_id__once;
}

DisplayDisplayWidget*
display_display_widget_construct (GType object_type,
                                  DisplayVirtualMonitor* virtual_monitor,
                                  const gchar* bg_color,
                                  const gchar* text_color)
{
	DisplayDisplayWidget * self = NULL;
	g_return_val_if_fail (virtual_monitor != NULL, NULL);
	g_return_val_if_fail (bg_color != NULL, NULL);
	g_return_val_if_fail (text_color != NULL, NULL);
	self = (DisplayDisplayWidget*) g_object_new (object_type, "virtual-monitor", virtual_monitor, "bg-color", bg_color, "text-color", text_color, NULL);
	return self;
}

DisplayDisplayWidget*
display_display_widget_new (DisplayVirtualMonitor* virtual_monitor,
                            const gchar* bg_color,
                            const gchar* text_color)
{
	return display_display_widget_construct (DISPLAY_TYPE_DISPLAY_WIDGET, virtual_monitor, bg_color, text_color);
}

static gboolean
_vala_double_array_contains (gdouble * stack,
                             gssize stack_length,
                             const gdouble needle)
{
	gssize i;
	for (i = 0; i < stack_length; i++) {
		if (needle == stack[i]) {
			return TRUE;
		}
	}
	return FALSE;
}

static void
_vala_array_add4 (gdouble* * array,
                  gint* length,
                  gint* size,
                  gdouble value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gdouble, *array, *size);
	}
	(*array)[(*length)++] = value;
}

static void
display_display_widget_populate_refresh_rates (DisplayDisplayWidget* self)
{
	GtkListStore* _tmp0_;
	GtkTreeIter iter = {0};
	gint added = 0;
	GtkComboBox* _tmp1_;
	GtkTreeIter _tmp2_ = {0};
	gboolean _tmp3_;
	GtkComboBox* _tmp56_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->refresh_list_store;
	gtk_list_store_clear (_tmp0_);
	added = 0;
	_tmp1_ = self->priv->resolution_combobox;
	_tmp3_ = gtk_combo_box_get_active_iter (_tmp1_, &_tmp2_);
	iter = _tmp2_;
	if (_tmp3_) {
		gint active_width = 0;
		gint active_height = 0;
		GtkComboBox* _tmp4_;
		GtkTreeIter _tmp5_ = {0};
		gboolean _tmp6_;
		gdouble* frequencies = NULL;
		gdouble* _tmp11_;
		gint frequencies_length1;
		gint _frequencies_size_;
		gboolean refresh_set = FALSE;
		_tmp4_ = self->priv->resolution_combobox;
		_tmp6_ = gtk_combo_box_get_active_iter (_tmp4_, &_tmp5_);
		iter = _tmp5_;
		if (_tmp6_) {
			GtkTreeStore* _tmp7_;
			GtkTreeIter _tmp8_;
			gint _tmp9_ = 0;
			gint _tmp10_ = 0;
			_tmp7_ = self->priv->resolution_tree_store;
			_tmp8_ = iter;
			gtk_tree_model_get ((GtkTreeModel*) _tmp7_, &_tmp8_, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_WIDTH, &_tmp9_, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_HEIGHT, &_tmp10_, -1);
			active_width = _tmp9_;
			active_height = _tmp10_;
		} else {
			return;
		}
		_tmp11_ = g_new0 (gdouble, 0);
		frequencies = _tmp11_;
		frequencies_length1 = 0;
		_frequencies_size_ = frequencies_length1;
		refresh_set = FALSE;
		{
			GeeLinkedList* _mode_list = NULL;
			DisplayVirtualMonitor* _tmp12_;
			GeeLinkedList* _tmp13_;
			gint _mode_size = 0;
			GeeLinkedList* _tmp14_;
			gint _tmp15_;
			gint _tmp16_;
			gint _mode_index = 0;
			_tmp12_ = self->priv->_virtual_monitor;
			_tmp13_ = display_virtual_monitor_get_available_modes (_tmp12_);
			_mode_list = _tmp13_;
			_tmp14_ = _mode_list;
			_tmp15_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp14_);
			_tmp16_ = _tmp15_;
			_mode_size = _tmp16_;
			_mode_index = -1;
			while (TRUE) {
				gint _tmp17_;
				gint _tmp18_;
				DisplayMonitorMode* mode = NULL;
				GeeLinkedList* _tmp19_;
				gpointer _tmp20_;
				gboolean _tmp21_ = FALSE;
				DisplayMonitorMode* _tmp22_;
				gint _tmp23_;
				gint _tmp24_;
				DisplayMonitorMode* _tmp28_;
				gdouble _tmp29_;
				gdouble _tmp30_;
				gdouble* _tmp31_;
				gint _tmp31__length1;
				gboolean freq_already_added = FALSE;
				gdouble* _tmp32_;
				gint _tmp32__length1;
				DisplayMonitorMode* _tmp36_;
				gdouble _tmp37_;
				gdouble _tmp38_;
				gchar* freq_name = NULL;
				DisplayMonitorMode* _tmp39_;
				gdouble _tmp40_;
				gdouble _tmp41_;
				gchar* _tmp42_;
				GtkListStore* _tmp43_;
				GtkTreeIter _tmp44_ = {0};
				GtkListStore* _tmp45_;
				GtkTreeIter _tmp46_;
				const gchar* _tmp47_;
				DisplayMonitorMode* _tmp48_;
				gint _tmp49_;
				DisplayMonitorMode* _tmp50_;
				gboolean _tmp51_;
				gboolean _tmp52_;
				_mode_index = _mode_index + 1;
				_tmp17_ = _mode_index;
				_tmp18_ = _mode_size;
				if (!(_tmp17_ < _tmp18_)) {
					break;
				}
				_tmp19_ = _mode_list;
				_tmp20_ = gee_abstract_list_get ((GeeAbstractList*) _tmp19_, _mode_index);
				mode = (DisplayMonitorMode*) _tmp20_;
				_tmp22_ = mode;
				_tmp23_ = display_monitor_mode_get_width (_tmp22_);
				_tmp24_ = _tmp23_;
				if (_tmp24_ != active_width) {
					_tmp21_ = TRUE;
				} else {
					DisplayMonitorMode* _tmp25_;
					gint _tmp26_;
					gint _tmp27_;
					_tmp25_ = mode;
					_tmp26_ = display_monitor_mode_get_height (_tmp25_);
					_tmp27_ = _tmp26_;
					_tmp21_ = _tmp27_ != active_height;
				}
				if (_tmp21_) {
					_g_object_unref0 (mode);
					continue;
				}
				_tmp28_ = mode;
				_tmp29_ = display_monitor_mode_get_frequency (_tmp28_);
				_tmp30_ = _tmp29_;
				_tmp31_ = frequencies;
				_tmp31__length1 = frequencies_length1;
				if (_vala_double_array_contains (_tmp31_, _tmp31__length1, _tmp30_)) {
					_g_object_unref0 (mode);
					continue;
				}
				freq_already_added = FALSE;
				_tmp32_ = frequencies;
				_tmp32__length1 = frequencies_length1;
				{
					gdouble* freq_collection = NULL;
					gint freq_collection_length1 = 0;
					gint _freq_collection_size_ = 0;
					gint freq_it = 0;
					freq_collection = _tmp32_;
					freq_collection_length1 = _tmp32__length1;
					for (freq_it = 0; freq_it < freq_collection_length1; freq_it = freq_it + 1) {
						gdouble freq = 0.0;
						freq = freq_collection[freq_it];
						{
							DisplayMonitorMode* _tmp33_;
							gdouble _tmp34_;
							gdouble _tmp35_;
							_tmp33_ = mode;
							_tmp34_ = display_monitor_mode_get_frequency (_tmp33_);
							_tmp35_ = _tmp34_;
							if (fabs (_tmp35_ - freq) < ((gdouble) 1)) {
								freq_already_added = TRUE;
								break;
							}
						}
					}
				}
				if (freq_already_added) {
					_g_object_unref0 (mode);
					continue;
				}
				_tmp36_ = mode;
				_tmp37_ = display_monitor_mode_get_frequency (_tmp36_);
				_tmp38_ = _tmp37_;
				_vala_array_add4 (&frequencies, &frequencies_length1, &_frequencies_size_, _tmp38_);
				_tmp39_ = mode;
				_tmp40_ = display_monitor_mode_get_frequency (_tmp39_);
				_tmp41_ = _tmp40_;
				_tmp42_ = g_strdup_printf (_ ("%g Hz"), (gdouble) roundf ((gfloat) _tmp41_));
				freq_name = _tmp42_;
				_tmp43_ = self->priv->refresh_list_store;
				gtk_list_store_append (_tmp43_, &_tmp44_);
				iter = _tmp44_;
				_tmp45_ = self->priv->refresh_list_store;
				_tmp46_ = iter;
				_tmp47_ = freq_name;
				_tmp48_ = mode;
				gtk_list_store_set (_tmp45_, &_tmp46_, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_NAME, _tmp47_, DISPLAY_DISPLAY_WIDGET_REFRESH_COLUMNS_VALUE, _tmp48_, -1);
				_tmp49_ = added;
				added = _tmp49_ + 1;
				_tmp50_ = mode;
				_tmp51_ = display_monitor_mode_get_is_current (_tmp50_);
				_tmp52_ = _tmp51_;
				if (_tmp52_) {
					GtkComboBox* _tmp53_;
					GtkTreeIter _tmp54_;
					_tmp53_ = self->priv->refresh_combobox;
					_tmp54_ = iter;
					gtk_combo_box_set_active_iter (_tmp53_, &_tmp54_);
					refresh_set = TRUE;
				}
				_g_free0 (freq_name);
				_g_object_unref0 (mode);
			}
			_g_object_unref0 (_mode_list);
		}
		if (!refresh_set) {
			GtkComboBox* _tmp55_;
			_tmp55_ = self->priv->refresh_combobox;
			gtk_combo_box_set_active (_tmp55_, 0);
		}
		frequencies = (g_free (frequencies), NULL);
	}
	_tmp56_ = self->priv->refresh_combobox;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp56_, added > 1);
}

static void
display_display_widget_on_monitor_modes_changed (DisplayDisplayWidget* self)
{
	g_return_if_fail (self != NULL);
	display_display_widget_set_active_resolution_from_current_mode (self);
}

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

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

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

static void
block5_data_unref (void * _userdata_)
{
	Block5Data* _data5_;
	_data5_ = (Block5Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
		DisplayDisplayWidget* self;
		self = _data5_->_data4_->self;
		_g_object_unref0 (_data5_->mode);
		block4_data_unref (_data5_->_data4_);
		_data5_->_data4_ = NULL;
		g_slice_free (Block5Data, _data5_);
	}
}

static gboolean
____lambda5_ (Block5Data* _data5_,
              GtkTreeModel* model,
              GtkTreePath* path,
              GtkTreeIter* iter)
{
	Block4Data* _data4_;
	DisplayDisplayWidget* self;
	gint width = 0;
	gint height = 0;
	GtkTreeStore* _tmp0_;
	GtkTreeIter _tmp1_;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	gboolean _tmp4_ = FALSE;
	DisplayMonitorMode* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gboolean result;
	_data4_ = _data5_->_data4_;
	self = _data4_->self;
	g_return_val_if_fail (model != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	g_return_val_if_fail (iter != NULL, FALSE);
	_tmp0_ = self->priv->resolution_tree_store;
	_tmp1_ = *iter;
	gtk_tree_model_get ((GtkTreeModel*) _tmp0_, &_tmp1_, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_WIDTH, &_tmp2_, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_HEIGHT, &_tmp3_, -1);
	width = _tmp2_;
	height = _tmp3_;
	_tmp5_ = _data5_->mode;
	_tmp6_ = display_monitor_mode_get_width (_tmp5_);
	_tmp7_ = _tmp6_;
	if (_tmp7_ == width) {
		DisplayMonitorMode* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		_tmp8_ = _data5_->mode;
		_tmp9_ = display_monitor_mode_get_height (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp4_ = _tmp10_ == height;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		GtkComboBox* _tmp11_;
		GtkTreeIter _tmp12_;
		_tmp11_ = self->priv->resolution_combobox;
		_tmp12_ = *iter;
		gtk_combo_box_set_active_iter (_tmp11_, &_tmp12_);
		_data4_->_result_ = TRUE;
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static gboolean
_____lambda5__gtk_tree_model_foreach_func (GtkTreeModel* model,
                                           GtkTreePath* path,
                                           GtkTreeIter* iter,
                                           gpointer self)
{
	gboolean result;
	result = ____lambda5_ (self, model, path, iter);
	return result;
}

static gboolean
display_display_widget_set_active_resolution_from_current_mode (DisplayDisplayWidget* self)
{
	Block4Data* _data4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_data4_ = g_slice_new0 (Block4Data);
	_data4_->_ref_count_ = 1;
	_data4_->self = g_object_ref (self);
	_data4_->_result_ = FALSE;
	{
		GeeLinkedList* _mode_list = NULL;
		DisplayVirtualMonitor* _tmp0_;
		GeeLinkedList* _tmp1_;
		gint _mode_size = 0;
		GeeLinkedList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _mode_index = 0;
		_tmp0_ = self->priv->_virtual_monitor;
		_tmp1_ = display_virtual_monitor_get_available_modes (_tmp0_);
		_mode_list = _tmp1_;
		_tmp2_ = _mode_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_mode_size = _tmp4_;
		_mode_index = -1;
		while (TRUE) {
			Block5Data* _data5_;
			gint _tmp5_;
			gint _tmp6_;
			GeeLinkedList* _tmp7_;
			gpointer _tmp8_;
			DisplayMonitorMode* _tmp9_;
			gboolean _tmp10_;
			gboolean _tmp11_;
			GtkTreeStore* _tmp12_;
			_data5_ = g_slice_new0 (Block5Data);
			_data5_->_ref_count_ = 1;
			_data5_->_data4_ = block4_data_ref (_data4_);
			_mode_index = _mode_index + 1;
			_tmp5_ = _mode_index;
			_tmp6_ = _mode_size;
			if (!(_tmp5_ < _tmp6_)) {
				block5_data_unref (_data5_);
				_data5_ = NULL;
				break;
			}
			_tmp7_ = _mode_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _mode_index);
			_data5_->mode = (DisplayMonitorMode*) _tmp8_;
			_tmp9_ = _data5_->mode;
			_tmp10_ = display_monitor_mode_get_is_current (_tmp9_);
			_tmp11_ = _tmp10_;
			if (!_tmp11_) {
				block5_data_unref (_data5_);
				_data5_ = NULL;
				continue;
			}
			_tmp12_ = self->priv->resolution_tree_store;
			gtk_tree_model_foreach ((GtkTreeModel*) _tmp12_, _____lambda5__gtk_tree_model_foreach_func, _data5_);
			block5_data_unref (_data5_);
			_data5_ = NULL;
		}
		_g_object_unref0 (_mode_list);
	}
	result = _data4_->_result_;
	block4_data_unref (_data4_);
	_data4_ = NULL;
	return result;
}

void
display_display_widget_set_primary (DisplayDisplayWidget* self,
                                    gboolean is_primary)
{
	GraniteSwitchModelButton* _tmp4_;
	g_return_if_fail (self != NULL);
	if (is_primary) {
		GtkButton* _tmp0_;
		GtkButton* _tmp1_;
		_tmp0_ = self->priv->primary_image;
		gtk_button_set_icon_name (_tmp0_, "starred-symbolic");
		_tmp1_ = self->priv->primary_image;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp1_, _ ("Is the primary display"));
	} else {
		GtkButton* _tmp2_;
		GtkButton* _tmp3_;
		_tmp2_ = self->priv->primary_image;
		gtk_button_set_icon_name (_tmp2_, "non-starred-symbolic");
		_tmp3_ = self->priv->primary_image;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp3_, _ ("Set as primary display"));
	}
	_tmp4_ = self->priv->use_switch;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp4_, !is_primary);
}

void
display_display_widget_get_preferred_size (DisplayDisplayWidget* self,
                                           GtkRequisition* minimum_size,
                                           GtkRequisition* natural_size)
{
	GtkRequisition _vala_minimum_size = {0};
	GtkRequisition _vala_natural_size = {0};
	gdouble _tmp0_;
	gdouble _tmp1_;
	GtkRequisition _tmp2_ = {0};
	GtkRequisition _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_window_ratio;
	_tmp1_ = self->priv->_window_ratio;
	memset (&_tmp2_, 0, sizeof (GtkRequisition));
	_tmp2_.height = (gint) (self->priv->real_height * _tmp0_);
	_tmp2_.width = (gint) (self->priv->real_width * _tmp1_);
	_vala_minimum_size = _tmp2_;
	_tmp3_ = _vala_minimum_size;
	_vala_natural_size = _tmp3_;
	if (minimum_size) {
		*minimum_size = _vala_minimum_size;
	}
	if (natural_size) {
		*natural_size = _vala_natural_size;
	}
}

void
display_display_widget_get_virtual_monitor_geometry (DisplayDisplayWidget* self,
                                                     gint* x,
                                                     gint* y,
                                                     gint* width,
                                                     gint* height)
{
	gint _vala_x = 0;
	gint _vala_y = 0;
	gint _vala_width = 0;
	gint _vala_height = 0;
	DisplayVirtualMonitor* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	DisplayVirtualMonitor* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_virtual_monitor;
	_tmp1_ = display_virtual_monitor_get_x (_tmp0_);
	_tmp2_ = _tmp1_;
	_vala_x = _tmp2_;
	_tmp3_ = self->priv->_virtual_monitor;
	_tmp4_ = display_virtual_monitor_get_y (_tmp3_);
	_tmp5_ = _tmp4_;
	_vala_y = _tmp5_;
	_vala_width = self->priv->real_width;
	_vala_height = self->priv->real_height;
	if (x) {
		*x = _vala_x;
	}
	if (y) {
		*y = _vala_y;
	}
	if (width) {
		*width = _vala_width;
	}
	if (height) {
		*height = _vala_height;
	}
}

void
display_display_widget_set_virtual_monitor_geometry (DisplayDisplayWidget* self,
                                                     gint x,
                                                     gint y,
                                                     gint width,
                                                     gint height)
{
	DisplayVirtualMonitor* _tmp0_;
	DisplayVirtualMonitor* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_virtual_monitor;
	display_virtual_monitor_set_x (_tmp0_, x);
	_tmp1_ = self->priv->_virtual_monitor;
	display_virtual_monitor_set_y (_tmp1_, y);
	self->priv->real_width = width;
	self->priv->real_height = height;
	gtk_widget_queue_resize ((GtkWidget*) self);
}

void
display_display_widget_move_x (DisplayDisplayWidget* self,
                               gint dx)
{
	DisplayVirtualMonitor* _tmp0_;
	DisplayVirtualMonitor* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_virtual_monitor;
	_tmp1_ = self->priv->_virtual_monitor;
	_tmp2_ = display_virtual_monitor_get_x (_tmp1_);
	_tmp3_ = _tmp2_;
	display_virtual_monitor_set_x (_tmp1_, _tmp3_ + dx);
	gtk_widget_queue_resize ((GtkWidget*) self);
}

void
display_display_widget_move_y (DisplayDisplayWidget* self,
                               gint dy)
{
	DisplayVirtualMonitor* _tmp0_;
	DisplayVirtualMonitor* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_virtual_monitor;
	_tmp1_ = self->priv->_virtual_monitor;
	_tmp2_ = display_virtual_monitor_get_y (_tmp1_);
	_tmp3_ = _tmp2_;
	display_virtual_monitor_set_y (_tmp1_, _tmp3_ + dy);
	gtk_widget_queue_resize ((GtkWidget*) self);
}

gboolean
display_display_widget_equals (DisplayDisplayWidget* self,
                               DisplayDisplayWidget* sibling)
{
	DisplayVirtualMonitor* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	DisplayVirtualMonitor* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gboolean _tmp8_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (sibling != NULL, FALSE);
	_tmp0_ = self->priv->_virtual_monitor;
	_tmp1_ = display_virtual_monitor_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = sibling->priv->_virtual_monitor;
	_tmp5_ = display_virtual_monitor_get_id (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strcmp0 (_tmp3_, _tmp7_) == 0;
	_g_free0 (_tmp7_);
	_g_free0 (_tmp3_);
	result = _tmp8_;
	return result;
}

DisplayVirtualMonitor*
display_display_widget_get_virtual_monitor (DisplayDisplayWidget* self)
{
	DisplayVirtualMonitor* result;
	DisplayVirtualMonitor* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_virtual_monitor;
	result = _tmp0_;
	return result;
}

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

static void
display_display_widget_set_virtual_monitor (DisplayDisplayWidget* self,
                                            DisplayVirtualMonitor* value)
{
	DisplayVirtualMonitor* old_value;
	g_return_if_fail (self != NULL);
	old_value = display_display_widget_get_virtual_monitor (self);
	if (old_value != value) {
		DisplayVirtualMonitor* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_virtual_monitor);
		self->priv->_virtual_monitor = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, display_display_widget_properties[DISPLAY_DISPLAY_WIDGET_VIRTUAL_MONITOR_PROPERTY]);
	}
}

const gchar*
display_display_widget_get_bg_color (DisplayDisplayWidget* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_bg_color;
	result = _tmp0_;
	return result;
}

static void
display_display_widget_set_bg_color (DisplayDisplayWidget* self,
                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = display_display_widget_get_bg_color (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_bg_color);
		self->priv->_bg_color = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, display_display_widget_properties[DISPLAY_DISPLAY_WIDGET_BG_COLOR_PROPERTY]);
	}
}

const gchar*
display_display_widget_get_text_color (DisplayDisplayWidget* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_text_color;
	result = _tmp0_;
	return result;
}

static void
display_display_widget_set_text_color (DisplayDisplayWidget* self,
                                       const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = display_display_widget_get_text_color (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_text_color);
		self->priv->_text_color = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, display_display_widget_properties[DISPLAY_DISPLAY_WIDGET_TEXT_COLOR_PROPERTY]);
	}
}

const gchar*
display_display_widget_get_display_name (DisplayDisplayWidget* self)
{
	const gchar* result;
	DisplayVirtualMonitor* _tmp0_;
	const gchar* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_virtual_monitor;
	_tmp1_ = display_virtual_monitor_get_display_name (_tmp0_);
	result = _tmp1_;
	return result;
}

gdouble
display_display_widget_get_window_ratio (DisplayDisplayWidget* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_window_ratio;
	return result;
}

static void
display_display_widget_set_window_ratio (DisplayDisplayWidget* self,
                                         gdouble value)
{
	gdouble old_value;
	g_return_if_fail (self != NULL);
	old_value = display_display_widget_get_window_ratio (self);
	if (old_value != value) {
		self->priv->_window_ratio = value;
		g_object_notify_by_pspec ((GObject *) self, display_display_widget_properties[DISPLAY_DISPLAY_WIDGET_WINDOW_RATIO_PROPERTY]);
	}
}

gboolean
display_display_widget_get_connected (DisplayDisplayWidget* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_connected;
	return result;
}

void
display_display_widget_set_connected (DisplayDisplayWidget* self,
                                      gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = display_display_widget_get_connected (self);
	if (old_value != value) {
		self->priv->_connected = value;
		g_object_notify_by_pspec ((GObject *) self, display_display_widget_properties[DISPLAY_DISPLAY_WIDGET_CONNECTED_PROPERTY]);
	}
}

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

static void
block6_data_unref (void * _userdata_)
{
	Block6Data* _data6_;
	_data6_ = (Block6Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
		DisplayDisplayWidget* self;
		self = _data6_->self;
		_g_object_unref0 (_data6_->popover);
		_g_object_unref0 (_data6_->label);
		_g_free0 (_data6_->virtual_monitor_name);
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}

static void
_display_display_widget___lambda6_ (DisplayDisplayWidget* self)
{
	g_signal_emit (self, display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_SET_AS_PRIMARY_SIGNAL], 0);
}

static void
__display_display_widget___lambda6__gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self)
{
	_display_display_widget___lambda6_ ((DisplayDisplayWidget*) self);
}

static gpointer
_gtk_expression_ref0 (gpointer self)
{
	return self ? gtk_expression_ref (self) : NULL;
}

static gint
_display_monitor_mode_resolution_compare_func_gcompare_data_func (gconstpointer a,
                                                                  gconstpointer b,
                                                                  gpointer self)
{
	gint result;
	result = display_monitor_mode_resolution_compare_func ((DisplayMonitorMode*) a, (DisplayMonitorMode*) b);
	return result;
}

static void
_vala_array_add5 (DisplayResolution* * array,
                  gint* length,
                  gint* size,
                  const DisplayResolution* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (DisplayResolution, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add6 (DisplayResolution* * array,
                  gint* length,
                  gint* size,
                  const DisplayResolution* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (DisplayResolution, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add7 (DisplayResolution* * array,
                  gint* length,
                  gint* size,
                  const DisplayResolution* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (DisplayResolution, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_display_display_widget___lambda7_ (DisplayDisplayWidget* self)
{
	GtkComboBox* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	GtkComboBox* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	GraniteSwitchModelButton* _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	_tmp0_ = self->priv->resolution_combobox;
	_tmp1_ = gtk_combo_box_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == -1) {
		GtkComboBox* _tmp3_;
		_tmp3_ = self->priv->resolution_combobox;
		gtk_combo_box_set_active (_tmp3_, 0);
	}
	_tmp4_ = self->priv->refresh_combobox;
	_tmp5_ = gtk_combo_box_get_active (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_ == -1) {
		GtkComboBox* _tmp7_;
		_tmp7_ = self->priv->refresh_combobox;
		gtk_combo_box_set_active (_tmp7_, 0);
	}
	_tmp8_ = self->priv->use_switch;
	_tmp9_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp8_);
	_tmp10_ = _tmp9_;
	if (_tmp10_) {
		gtk_widget_remove_css_class ((GtkWidget*) self, "disabled");
	} else {
		gtk_widget_add_css_class ((GtkWidget*) self, "disabled");
	}
	g_signal_emit (self, display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_CONFIGURATION_CHANGED_SIGNAL], 0);
	g_signal_emit (self, display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_ACTIVE_CHANGED_SIGNAL], 0);
}

static void
__display_display_widget___lambda7__g_object_notify (GObject* _sender,
                                                     GParamSpec* pspec,
                                                     gpointer self)
{
	_display_display_widget___lambda7_ ((DisplayDisplayWidget*) self);
}

static void
_display_display_widget___lambda8_ (Block6Data* _data6_)
{
	DisplayDisplayWidget* self;
	GtkPopover* _tmp0_;
	gint active_width = 0;
	gint active_height = 0;
	GtkTreeIter iter = {0};
	GtkComboBox* _tmp1_;
	GtkTreeIter _tmp2_ = {0};
	gboolean _tmp3_;
	DisplayVirtualMonitor* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	DisplayVirtualMonitor* _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	DisplayMonitorMode* new_mode = NULL;
	DisplayVirtualMonitor* _tmp14_;
	DisplayMonitorMode* _tmp15_;
	DisplayMonitorMode* _tmp16_;
	DisplayVirtualMonitor* _tmp17_;
	DisplayMonitorMode* _tmp18_;
	self = _data6_->self;
	_tmp0_ = _data6_->popover;
	gtk_popover_popdown (_tmp0_);
	_tmp1_ = self->priv->resolution_combobox;
	_tmp3_ = gtk_combo_box_get_active_iter (_tmp1_, &_tmp2_);
	iter = _tmp2_;
	if (_tmp3_) {
		GtkTreeStore* _tmp4_;
		GtkTreeIter _tmp5_;
		gint _tmp6_ = 0;
		gint _tmp7_ = 0;
		_tmp4_ = self->priv->resolution_tree_store;
		_tmp5_ = iter;
		gtk_tree_model_get ((GtkTreeModel*) _tmp4_, &_tmp5_, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_WIDTH, &_tmp6_, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_HEIGHT, &_tmp7_, -1);
		active_width = _tmp6_;
		active_height = _tmp7_;
	} else {
		return;
	}
	_tmp8_ = self->priv->_virtual_monitor;
	_tmp9_ = display_virtual_monitor_get_x (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = self->priv->_virtual_monitor;
	_tmp12_ = display_virtual_monitor_get_y (_tmp11_);
	_tmp13_ = _tmp12_;
	display_display_widget_set_virtual_monitor_geometry (self, _tmp10_, _tmp13_, active_width, active_height);
	_tmp14_ = self->priv->_virtual_monitor;
	_tmp15_ = display_virtual_monitor_get_mode_for_resolution (_tmp14_, active_width, active_height);
	new_mode = _tmp15_;
	_tmp16_ = new_mode;
	if (_tmp16_ == NULL) {
		_g_object_unref0 (new_mode);
		return;
	}
	_tmp17_ = self->priv->_virtual_monitor;
	_tmp18_ = new_mode;
	display_virtual_monitor_set_current_mode (_tmp17_, _tmp18_);
	display_display_widget_populate_refresh_rates (self);
	g_signal_emit (self, display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_CONFIGURATION_CHANGED_SIGNAL], 0);
	g_signal_emit (self, display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_CHECK_POSITION_SIGNAL], 0);
	_g_object_unref0 (new_mode);
}

static void
__display_display_widget___lambda8__gtk_combo_box_changed (GtkComboBox* _sender,
                                                           gpointer self)
{
	_display_display_widget___lambda8_ (self);
}

static void
_display_display_widget___lambda9_ (Block6Data* _data6_)
{
	DisplayDisplayWidget* self;
	GtkPopover* _tmp0_;
	GtkLabel* _tmp1_;
	gchar* _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	DisplayVirtualMonitor* _tmp5_;
	DisplayTransform _tmp6_;
	DisplayTransform _tmp7_;
	self = _data6_->self;
	_tmp0_ = _data6_->popover;
	gtk_popover_popdown (_tmp0_);
	_tmp1_ = _data6_->label;
	_tmp2_ = g_strdup ("");
	_tmp3_ = g_new0 (gchar*, 1 + 1);
	_tmp3_[0] = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp4__length1 = 1;
	gtk_widget_set_css_classes ((GtkWidget*) _tmp1_, _tmp4_);
	_tmp4_ = (_vala_array_free (_tmp4_, _tmp4__length1, (GDestroyNotify) g_free), NULL);
	_tmp5_ = self->priv->_virtual_monitor;
	_tmp6_ = display_virtual_monitor_get_transform (_tmp5_);
	_tmp7_ = _tmp6_;
	switch (_tmp7_) {
		case DISPLAY_TRANSFORM_NORMAL:
		{
			DisplayVirtualMonitor* _tmp8_;
			gint _tmp9_ = 0;
			gint _tmp10_ = 0;
			GtkLabel* _tmp11_;
			const gchar* _tmp12_;
			_tmp8_ = self->priv->_virtual_monitor;
			display_virtual_monitor_get_current_mode_size (_tmp8_, &_tmp9_, &_tmp10_);
			self->priv->real_width = _tmp9_;
			self->priv->real_height = _tmp10_;
			_tmp11_ = _data6_->label;
			_tmp12_ = _data6_->virtual_monitor_name;
			gtk_label_set_label (_tmp11_, _tmp12_);
			break;
		}
		case DISPLAY_TRANSFORM_ROTATION_90:
		{
			DisplayVirtualMonitor* _tmp13_;
			gint _tmp14_ = 0;
			gint _tmp15_ = 0;
			GtkLabel* _tmp16_;
			GtkLabel* _tmp17_;
			const gchar* _tmp18_;
			_tmp13_ = self->priv->_virtual_monitor;
			display_virtual_monitor_get_current_mode_size (_tmp13_, &_tmp14_, &_tmp15_);
			self->priv->real_height = _tmp14_;
			self->priv->real_width = _tmp15_;
			_tmp16_ = _data6_->label;
			gtk_widget_add_css_class ((GtkWidget*) _tmp16_, "rotate-270");
			_tmp17_ = _data6_->label;
			_tmp18_ = _data6_->virtual_monitor_name;
			gtk_label_set_label (_tmp17_, _tmp18_);
			break;
		}
		case DISPLAY_TRANSFORM_ROTATION_180:
		{
			DisplayVirtualMonitor* _tmp19_;
			gint _tmp20_ = 0;
			gint _tmp21_ = 0;
			GtkLabel* _tmp22_;
			GtkLabel* _tmp23_;
			const gchar* _tmp24_;
			_tmp19_ = self->priv->_virtual_monitor;
			display_virtual_monitor_get_current_mode_size (_tmp19_, &_tmp20_, &_tmp21_);
			self->priv->real_width = _tmp20_;
			self->priv->real_height = _tmp21_;
			_tmp22_ = _data6_->label;
			gtk_widget_add_css_class ((GtkWidget*) _tmp22_, "rotate-180");
			_tmp23_ = _data6_->label;
			_tmp24_ = _data6_->virtual_monitor_name;
			gtk_label_set_label (_tmp23_, _tmp24_);
			break;
		}
		case DISPLAY_TRANSFORM_ROTATION_270:
		{
			DisplayVirtualMonitor* _tmp25_;
			gint _tmp26_ = 0;
			gint _tmp27_ = 0;
			GtkLabel* _tmp28_;
			GtkLabel* _tmp29_;
			const gchar* _tmp30_;
			_tmp25_ = self->priv->_virtual_monitor;
			display_virtual_monitor_get_current_mode_size (_tmp25_, &_tmp26_, &_tmp27_);
			self->priv->real_height = _tmp26_;
			self->priv->real_width = _tmp27_;
			_tmp28_ = _data6_->label;
			gtk_widget_add_css_class ((GtkWidget*) _tmp28_, "rotate-90");
			_tmp29_ = _data6_->label;
			_tmp30_ = _data6_->virtual_monitor_name;
			gtk_label_set_label (_tmp29_, _tmp30_);
			break;
		}
		case DISPLAY_TRANSFORM_FLIPPED:
		{
			DisplayVirtualMonitor* _tmp31_;
			gint _tmp32_ = 0;
			gint _tmp33_ = 0;
			GtkLabel* _tmp34_;
			const gchar* _tmp35_;
			gchar* _tmp36_;
			gchar* _tmp37_;
			_tmp31_ = self->priv->_virtual_monitor;
			display_virtual_monitor_get_current_mode_size (_tmp31_, &_tmp32_, &_tmp33_);
			self->priv->real_width = _tmp32_;
			self->priv->real_height = _tmp33_;
			_tmp34_ = _data6_->label;
			_tmp35_ = _data6_->virtual_monitor_name;
			_tmp36_ = g_utf8_strreverse (_tmp35_, (gssize) -1);
			_tmp37_ = _tmp36_;
			gtk_label_set_label (_tmp34_, _tmp37_);
			_g_free0 (_tmp37_);
			break;
		}
		case DISPLAY_TRANSFORM_FLIPPED_ROTATION_90:
		{
			DisplayVirtualMonitor* _tmp38_;
			gint _tmp39_ = 0;
			gint _tmp40_ = 0;
			GtkLabel* _tmp41_;
			GtkLabel* _tmp42_;
			const gchar* _tmp43_;
			gchar* _tmp44_;
			gchar* _tmp45_;
			_tmp38_ = self->priv->_virtual_monitor;
			display_virtual_monitor_get_current_mode_size (_tmp38_, &_tmp39_, &_tmp40_);
			self->priv->real_height = _tmp39_;
			self->priv->real_width = _tmp40_;
			_tmp41_ = _data6_->label;
			gtk_widget_add_css_class ((GtkWidget*) _tmp41_, "rotate-270");
			_tmp42_ = _data6_->label;
			_tmp43_ = _data6_->virtual_monitor_name;
			_tmp44_ = g_utf8_strreverse (_tmp43_, (gssize) -1);
			_tmp45_ = _tmp44_;
			gtk_label_set_label (_tmp42_, _tmp45_);
			_g_free0 (_tmp45_);
			break;
		}
		case DISPLAY_TRANSFORM_FLIPPED_ROTATION_180:
		{
			DisplayVirtualMonitor* _tmp46_;
			gint _tmp47_ = 0;
			gint _tmp48_ = 0;
			GtkLabel* _tmp49_;
			GtkLabel* _tmp50_;
			const gchar* _tmp51_;
			gchar* _tmp52_;
			gchar* _tmp53_;
			_tmp46_ = self->priv->_virtual_monitor;
			display_virtual_monitor_get_current_mode_size (_tmp46_, &_tmp47_, &_tmp48_);
			self->priv->real_width = _tmp47_;
			self->priv->real_height = _tmp48_;
			_tmp49_ = _data6_->label;
			gtk_widget_add_css_class ((GtkWidget*) _tmp49_, "rotate-180");
			_tmp50_ = _data6_->label;
			_tmp51_ = _data6_->virtual_monitor_name;
			_tmp52_ = g_utf8_strreverse (_tmp51_, (gssize) -1);
			_tmp53_ = _tmp52_;
			gtk_label_set_label (_tmp50_, _tmp53_);
			_g_free0 (_tmp53_);
			break;
		}
		case DISPLAY_TRANSFORM_FLIPPED_ROTATION_270:
		{
			DisplayVirtualMonitor* _tmp54_;
			gint _tmp55_ = 0;
			gint _tmp56_ = 0;
			GtkLabel* _tmp57_;
			GtkLabel* _tmp58_;
			const gchar* _tmp59_;
			gchar* _tmp60_;
			gchar* _tmp61_;
			_tmp54_ = self->priv->_virtual_monitor;
			display_virtual_monitor_get_current_mode_size (_tmp54_, &_tmp55_, &_tmp56_);
			self->priv->real_height = _tmp55_;
			self->priv->real_width = _tmp56_;
			_tmp57_ = _data6_->label;
			gtk_widget_add_css_class ((GtkWidget*) _tmp57_, "rotate-90");
			_tmp58_ = _data6_->label;
			_tmp59_ = _data6_->virtual_monitor_name;
			_tmp60_ = g_utf8_strreverse (_tmp59_, (gssize) -1);
			_tmp61_ = _tmp60_;
			gtk_label_set_label (_tmp58_, _tmp61_);
			_g_free0 (_tmp61_);
			break;
		}
		default:
		break;
	}
	g_signal_emit (self, display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_CONFIGURATION_CHANGED_SIGNAL], 0);
	g_signal_emit (self, display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_CHECK_POSITION_SIGNAL], 0);
}

static void
__display_display_widget___lambda9__gtk_selection_model_selection_changed (GtkSelectionModel* _sender,
                                                                           guint position,
                                                                           guint n_items,
                                                                           gpointer self)
{
	_display_display_widget___lambda9_ (self);
}

static void
_display_display_widget___lambda10_ (Block6Data* _data6_)
{
	DisplayDisplayWidget* self;
	GtkPopover* _tmp0_;
	GValue val = {0};
	GtkTreeIter iter = {0};
	GtkComboBox* _tmp1_;
	GtkTreeIter _tmp2_ = {0};
	gboolean _tmp3_;
	self = _data6_->self;
	_tmp0_ = _data6_->popover;
	gtk_popover_popdown (_tmp0_);
	_tmp1_ = self->priv->refresh_combobox;
	_tmp3_ = gtk_combo_box_get_active_iter (_tmp1_, &_tmp2_);
	iter = _tmp2_;
	if (_tmp3_) {
		GtkListStore* _tmp4_;
		GtkTreeIter _tmp5_;
		GValue _tmp6_ = {0};
		DisplayMonitorMode* new_mode = NULL;
		GValue _tmp7_;
		DisplayMonitorMode* _tmp8_;
		DisplayVirtualMonitor* _tmp9_;
		DisplayMonitorMode* _tmp10_;
		_tmp4_ = self->priv->refresh_list_store;
		_tmp5_ = iter;
		gtk_tree_model_get_value ((GtkTreeModel*) _tmp4_, &_tmp5_, (gint) DISPLAY_DISPLAY_WIDGET_REFRESH_COLUMNS_VALUE, &_tmp6_);
		G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
		val = _tmp6_;
		_tmp7_ = val;
		_tmp8_ = _g_object_ref0 (g_value_get_object (&_tmp7_));
		new_mode = _tmp8_;
		_tmp9_ = self->priv->_virtual_monitor;
		_tmp10_ = new_mode;
		display_virtual_monitor_set_current_mode (_tmp9_, _tmp10_);
		g_signal_emit (self, display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_CONFIGURATION_CHANGED_SIGNAL], 0);
		g_signal_emit (self, display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_CHECK_POSITION_SIGNAL], 0);
		_g_object_unref0 (new_mode);
	}
	G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
}

static void
__display_display_widget___lambda10__gtk_combo_box_changed (GtkComboBox* _sender,
                                                            gpointer self)
{
	_display_display_widget___lambda10_ (self);
}

static void
_display_display_widget___lambda11_ (Block6Data* _data6_)
{
	DisplayDisplayWidget* self;
	GtkPopover* _tmp0_;
	DisplayVirtualMonitor* _tmp1_;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	self = _data6_->self;
	_tmp0_ = _data6_->popover;
	gtk_popover_popdown (_tmp0_);
	_tmp1_ = self->priv->_virtual_monitor;
	display_virtual_monitor_get_current_mode_size (_tmp1_, &_tmp2_, &_tmp3_);
	self->priv->real_height = _tmp2_;
	self->priv->real_width = _tmp3_;
	g_signal_emit (self, display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_CONFIGURATION_CHANGED_SIGNAL], 0);
	g_signal_emit (self, display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_CHECK_POSITION_SIGNAL], 0);
}

static void
__display_display_widget___lambda11__g_object_notify (GObject* _sender,
                                                      GParamSpec* pspec,
                                                      gpointer self)
{
	_display_display_widget___lambda11_ (self);
}

static void
_display_display_widget_on_monitor_modes_changed_display_virtual_monitor_modes_changed (DisplayVirtualMonitor* _sender,
                                                                                        gpointer self)
{
	display_display_widget_on_monitor_modes_changed ((DisplayDisplayWidget*) self);
}

static GObject *
display_display_widget_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DisplayDisplayWidget * self;
	Block6Data* _data6_;
	DisplayVirtualMonitor* _tmp0_;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	GtkButton* _tmp3_ = NULL;
	GtkButton* _tmp4_;
	DisplayVirtualMonitor* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	GtkLabel* _tmp9_ = NULL;
	GraniteSwitchModelButton* _tmp10_;
	DisplayVirtualMonitor* _tmp11_;
	GraniteSwitchModelButton* _tmp12_;
	GtkTreeStore* _tmp13_;
	GtkTreeStore* _tmp14_;
	GtkComboBox* _tmp15_ = NULL;
	GraniteHeaderLabel* resolution_label = NULL;
	GtkComboBox* _tmp16_;
	GtkWidget* _tmp17_;
	GraniteHeaderLabel* _tmp18_ = NULL;
	GtkCellRendererText* text_renderer = NULL;
	GtkCellRendererText* _tmp19_;
	GtkComboBox* _tmp20_;
	GtkCellRendererText* _tmp21_;
	GtkComboBox* _tmp22_;
	GtkCellRendererText* _tmp23_;
	GtkPropertyExpression* rotation_name_expression = NULL;
	GtkPropertyExpression* _tmp24_;
	GtkDropDown* rotation_drop_down = NULL;
	DisplayVirtualMonitor* _tmp25_;
	GtkSingleSelection* _tmp26_;
	GtkSingleSelection* _tmp27_;
	GListModel* _tmp28_;
	GtkPropertyExpression* _tmp29_;
	GtkExpression* _tmp30_;
	GtkDropDown* _tmp31_ = NULL;
	DisplayVirtualMonitor* _tmp32_;
	GtkSingleSelection* _tmp33_;
	GtkSingleSelection* _tmp34_;
	GtkDropDown* _tmp35_;
	GraniteHeaderLabel* rotation_label = NULL;
	GtkDropDown* _tmp36_;
	GtkWidget* _tmp37_;
	GraniteHeaderLabel* _tmp38_ = NULL;
	GtkListStore* _tmp39_;
	GtkListStore* _tmp40_;
	GtkComboBox* _tmp41_ = NULL;
	GraniteHeaderLabel* refresh_label = NULL;
	GtkComboBox* _tmp42_;
	GtkWidget* _tmp43_;
	GraniteHeaderLabel* _tmp44_ = NULL;
	GtkCellRendererText* _tmp45_;
	GtkComboBox* _tmp46_;
	GtkCellRendererText* _tmp47_;
	GtkComboBox* _tmp48_;
	GtkCellRendererText* _tmp49_;
	DisplayResolution* resolutions = NULL;
	DisplayResolution* _tmp50_;
	gint resolutions_length1;
	gint _resolutions_size_;
	DisplayResolution* recommended_resolutions = NULL;
	DisplayResolution* _tmp51_;
	gint recommended_resolutions_length1;
	gint _recommended_resolutions_size_;
	DisplayResolution* other_resolutions = NULL;
	DisplayResolution* _tmp52_;
	gint other_resolutions_length1;
	gint _other_resolutions_size_;
	gint max_width = 0;
	gint max_height = 0;
	guint usable_resolutions = 0U;
	gint current_width = 0;
	gint current_height = 0;
	DisplayVirtualMonitor* _tmp53_;
	gint _tmp54_ = 0;
	gint _tmp55_ = 0;
	GeeTreeSet* resolution_set = NULL;
	GeeTreeSet* _tmp56_;
	gint native_ratio = 0;
	DisplayResolution* _tmp90_;
	gint _tmp90__length1;
	DisplayResolution* _tmp102_;
	gint _tmp102__length1;
	DisplayResolution* _tmp113_;
	gint _tmp113__length1;
	GtkComboBox* _tmp131_;
	GtkPropertyExpression* scale_name_expression = NULL;
	GtkPropertyExpression* _tmp132_;
	DisplayVirtualMonitor* _tmp133_;
	GtkSingleSelection* _tmp134_;
	GtkSingleSelection* _tmp135_;
	GListModel* _tmp136_;
	GtkPropertyExpression* _tmp137_;
	GtkExpression* _tmp138_;
	GtkDropDown* _tmp139_ = NULL;
	DisplayVirtualMonitor* _tmp140_;
	GtkSingleSelection* _tmp141_;
	GtkSingleSelection* _tmp142_;
	GtkDropDown* _tmp143_;
	GraniteHeaderLabel* scale_label = NULL;
	GtkDropDown* _tmp144_;
	GtkWidget* _tmp145_;
	GraniteHeaderLabel* _tmp146_ = NULL;
	GtkBox* popover_box = NULL;
	GtkBox* _tmp147_ = NULL;
	GtkBox* _tmp148_;
	GraniteSwitchModelButton* _tmp149_;
	GtkBox* _tmp150_;
	GraniteHeaderLabel* _tmp151_;
	GtkBox* _tmp152_;
	GtkComboBox* _tmp153_;
	GtkBox* _tmp154_;
	GraniteHeaderLabel* _tmp155_;
	GtkBox* _tmp156_;
	GtkDropDown* _tmp157_;
	GtkBox* _tmp158_;
	GraniteHeaderLabel* _tmp159_;
	GtkBox* _tmp160_;
	GtkComboBox* _tmp161_;
	DisplayMonitorManager* _tmp162_;
	gboolean _tmp163_;
	gboolean _tmp164_;
	GtkBox* _tmp169_;
	GtkWidget* _tmp170_;
	GtkPopover* _tmp171_ = NULL;
	GtkMenuButton* toggle_settings = NULL;
	gchar* _tmp172_;
	GtkPopover* _tmp173_;
	GtkPopover* _tmp174_;
	gchar* _tmp175_;
	GtkMenuButton* _tmp176_ = NULL;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp177_;
	GtkGrid* _tmp178_;
	GtkButton* _tmp179_;
	GtkGrid* _tmp180_;
	GtkMenuButton* _tmp181_;
	GtkGrid* _tmp182_;
	GtkLabel* _tmp183_;
	GtkGrid* _tmp184_;
	DisplayVirtualMonitor* _tmp185_;
	gboolean _tmp186_;
	gboolean _tmp187_;
	GraniteSwitchModelButton* _tmp188_;
	GtkComboBox* _tmp189_;
	GraniteSwitchModelButton* _tmp190_;
	GtkDropDown* _tmp191_;
	GraniteSwitchModelButton* _tmp192_;
	GtkComboBox* _tmp193_;
	GraniteSwitchModelButton* _tmp194_;
	GtkDropDown* _tmp195_;
	GraniteSwitchModelButton* _tmp196_;
	DisplayVirtualMonitor* _tmp197_;
	gboolean _tmp198_;
	gboolean _tmp199_;
	GtkComboBox* _tmp200_;
	DisplayVirtualMonitor* _tmp201_;
	GtkSingleSelection* _tmp202_;
	GtkSingleSelection* _tmp203_;
	GtkComboBox* _tmp204_;
	GtkDropDown* _tmp205_;
	DisplayVirtualMonitor* _tmp206_;
	parent_class = G_OBJECT_CLASS (display_display_widget_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DISPLAY_TYPE_DISPLAY_WIDGET, DisplayDisplayWidget);
	_data6_ = g_slice_new0 (Block6Data);
	_data6_->_ref_count_ = 1;
	_data6_->self = g_object_ref (self);
	_tmp0_ = self->priv->_virtual_monitor;
	display_virtual_monitor_get_current_mode_size (_tmp0_, &_tmp1_, &_tmp2_);
	self->priv->real_width = _tmp1_;
	self->priv->real_height = _tmp2_;
	_tmp3_ = (GtkButton*) gtk_button_new_from_icon_name ("non-starred-symbolic");
	gtk_button_set_has_frame (_tmp3_, FALSE);
	gtk_widget_set_halign ((GtkWidget*) _tmp3_, GTK_ALIGN_START);
	gtk_widget_set_valign ((GtkWidget*) _tmp3_, GTK_ALIGN_START);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->primary_image);
	self->priv->primary_image = _tmp3_;
	_tmp4_ = self->priv->primary_image;
	g_signal_connect_object (_tmp4_, "clicked", (GCallback) __display_display_widget___lambda6__gtk_button_clicked, self, 0);
	_tmp5_ = self->priv->_virtual_monitor;
	_tmp6_ = display_virtual_monitor_get_display_name (_tmp5_);
	_tmp7_ = g_strdup (_tmp6_);
	_data6_->virtual_monitor_name = _tmp7_;
	_tmp8_ = _data6_->virtual_monitor_name;
	_tmp9_ = (GtkLabel*) gtk_label_new (_tmp8_);
	gtk_widget_set_halign ((GtkWidget*) _tmp9_, GTK_ALIGN_CENTER);
	gtk_widget_set_valign ((GtkWidget*) _tmp9_, GTK_ALIGN_CENTER);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp9_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp9_, TRUE);
	g_object_ref_sink (_tmp9_);
	_data6_->label = _tmp9_;
	_tmp10_ = granite_switch_model_button_new (_ ("Use This Display"));
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->use_switch);
	self->priv->use_switch = _tmp10_;
	_tmp11_ = self->priv->_virtual_monitor;
	_tmp12_ = self->priv->use_switch;
	g_object_bind_property_with_closures ((GObject*) _tmp11_, "is-active", (GObject*) _tmp12_, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp13_ = gtk_tree_store_new ((gint) DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_TOTAL, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT);
	_g_object_unref0 (self->priv->resolution_tree_store);
	self->priv->resolution_tree_store = _tmp13_;
	_tmp14_ = self->priv->resolution_tree_store;
	_tmp15_ = (GtkComboBox*) gtk_combo_box_new_with_model ((GtkTreeModel*) _tmp14_);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp15_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp15_, 12);
	g_object_ref_sink (_tmp15_);
	_g_object_unref0 (self->priv->resolution_combobox);
	self->priv->resolution_combobox = _tmp15_;
	_tmp16_ = self->priv->resolution_combobox;
	_tmp17_ = _g_object_ref0 ((GtkWidget*) _tmp16_);
	_tmp18_ = granite_header_label_new (_ ("Resolution"));
	granite_header_label_set_mnemonic_widget (_tmp18_, _tmp17_);
	_g_object_unref0 (_tmp17_);
	g_object_ref_sink (_tmp18_);
	resolution_label = _tmp18_;
	_tmp19_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp19_);
	text_renderer = _tmp19_;
	_tmp20_ = self->priv->resolution_combobox;
	_tmp21_ = text_renderer;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp20_, (GtkCellRenderer*) _tmp21_, TRUE);
	_tmp22_ = self->priv->resolution_combobox;
	_tmp23_ = text_renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp22_, (GtkCellRenderer*) _tmp23_, "text", (gint) DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_NAME);
	_tmp24_ = (GtkPropertyExpression*) gtk_property_expression_new (DISPLAY_VIRTUAL_MONITOR_TYPE_TRANSFORM, NULL, "string-representation");
	rotation_name_expression = _tmp24_;
	_tmp25_ = self->priv->_virtual_monitor;
	_tmp26_ = display_virtual_monitor_get_available_transforms (_tmp25_);
	_tmp27_ = _tmp26_;
	_tmp28_ = _g_object_ref0 ((GListModel*) _tmp27_);
	_tmp29_ = rotation_name_expression;
	_tmp30_ = _gtk_expression_ref0 ((GtkExpression*) _tmp29_);
	_tmp31_ = (GtkDropDown*) gtk_drop_down_new (_tmp28_, _tmp30_);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp31_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp31_, 12);
	g_object_ref_sink (_tmp31_);
	rotation_drop_down = _tmp31_;
	_tmp32_ = self->priv->_virtual_monitor;
	_tmp33_ = display_virtual_monitor_get_available_transforms (_tmp32_);
	_tmp34_ = _tmp33_;
	_tmp35_ = rotation_drop_down;
	g_object_bind_property_with_closures ((GObject*) _tmp34_, "selected", (GObject*) _tmp35_, "selected", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp36_ = rotation_drop_down;
	_tmp37_ = _g_object_ref0 ((GtkWidget*) _tmp36_);
	_tmp38_ = granite_header_label_new (_ ("Screen Rotation"));
	granite_header_label_set_mnemonic_widget (_tmp38_, _tmp37_);
	_g_object_unref0 (_tmp37_);
	g_object_ref_sink (_tmp38_);
	rotation_label = _tmp38_;
	_tmp39_ = gtk_list_store_new ((gint) DISPLAY_DISPLAY_WIDGET_REFRESH_COLUMNS_TOTAL, G_TYPE_STRING, DISPLAY_TYPE_MONITOR_MODE, -1);
	_g_object_unref0 (self->priv->refresh_list_store);
	self->priv->refresh_list_store = _tmp39_;
	_tmp40_ = self->priv->refresh_list_store;
	_tmp41_ = (GtkComboBox*) gtk_combo_box_new_with_model ((GtkTreeModel*) _tmp40_);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp41_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp41_, 12);
	g_object_ref_sink (_tmp41_);
	_g_object_unref0 (self->priv->refresh_combobox);
	self->priv->refresh_combobox = _tmp41_;
	_tmp42_ = self->priv->refresh_combobox;
	_tmp43_ = _g_object_ref0 ((GtkWidget*) _tmp42_);
	_tmp44_ = granite_header_label_new (_ ("Refresh Rate"));
	granite_header_label_set_mnemonic_widget (_tmp44_, _tmp43_);
	_g_object_unref0 (_tmp43_);
	g_object_ref_sink (_tmp44_);
	refresh_label = _tmp44_;
	_tmp45_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp45_);
	_g_object_unref0 (text_renderer);
	text_renderer = _tmp45_;
	_tmp46_ = self->priv->refresh_combobox;
	_tmp47_ = text_renderer;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp46_, (GtkCellRenderer*) _tmp47_, TRUE);
	_tmp48_ = self->priv->refresh_combobox;
	_tmp49_ = text_renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp48_, (GtkCellRenderer*) _tmp49_, "text", (gint) DISPLAY_DISPLAY_WIDGET_REFRESH_COLUMNS_NAME);
	_tmp50_ = g_new0 (DisplayResolution, 0);
	resolutions = _tmp50_;
	resolutions_length1 = 0;
	_resolutions_size_ = resolutions_length1;
	_tmp51_ = g_new0 (DisplayResolution, 0);
	recommended_resolutions = _tmp51_;
	recommended_resolutions_length1 = 0;
	_recommended_resolutions_size_ = recommended_resolutions_length1;
	_tmp52_ = g_new0 (DisplayResolution, 0);
	other_resolutions = _tmp52_;
	other_resolutions_length1 = 0;
	_other_resolutions_size_ = other_resolutions_length1;
	max_width = -1;
	max_height = -1;
	usable_resolutions = (guint) 0;
	_tmp53_ = self->priv->_virtual_monitor;
	display_virtual_monitor_get_current_mode_size (_tmp53_, &_tmp54_, &_tmp55_);
	current_width = _tmp54_;
	current_height = _tmp55_;
	_tmp56_ = gee_tree_set_new (DISPLAY_TYPE_MONITOR_MODE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _display_monitor_mode_resolution_compare_func_gcompare_data_func, NULL, NULL);
	resolution_set = _tmp56_;
	{
		GeeLinkedList* _mode_list = NULL;
		DisplayVirtualMonitor* _tmp57_;
		GeeLinkedList* _tmp58_;
		gint _mode_size = 0;
		GeeLinkedList* _tmp59_;
		gint _tmp60_;
		gint _tmp61_;
		gint _mode_index = 0;
		_tmp57_ = self->priv->_virtual_monitor;
		_tmp58_ = display_virtual_monitor_get_available_modes (_tmp57_);
		_mode_list = _tmp58_;
		_tmp59_ = _mode_list;
		_tmp60_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp59_);
		_tmp61_ = _tmp60_;
		_mode_size = _tmp61_;
		_mode_index = -1;
		while (TRUE) {
			gint _tmp62_;
			gint _tmp63_;
			DisplayMonitorMode* mode = NULL;
			GeeLinkedList* _tmp64_;
			gpointer _tmp65_;
			GeeTreeSet* _tmp66_;
			DisplayMonitorMode* _tmp67_;
			_mode_index = _mode_index + 1;
			_tmp62_ = _mode_index;
			_tmp63_ = _mode_size;
			if (!(_tmp62_ < _tmp63_)) {
				break;
			}
			_tmp64_ = _mode_list;
			_tmp65_ = gee_abstract_list_get ((GeeAbstractList*) _tmp64_, _mode_index);
			mode = (DisplayMonitorMode*) _tmp65_;
			_tmp66_ = resolution_set;
			_tmp67_ = mode;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp66_, _tmp67_);
			_g_object_unref0 (mode);
		}
		_g_object_unref0 (_mode_list);
	}
	{
		GeeIterator* _mode_it = NULL;
		GeeTreeSet* _tmp68_;
		GeeIterator* _tmp69_;
		_tmp68_ = resolution_set;
		_tmp69_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) _tmp68_);
		_mode_it = _tmp69_;
		while (TRUE) {
			GeeIterator* _tmp70_;
			DisplayMonitorMode* mode = NULL;
			GeeIterator* _tmp71_;
			gpointer _tmp72_;
			gint mode_width = 0;
			DisplayMonitorMode* _tmp73_;
			gint _tmp74_;
			gint _tmp75_;
			gint mode_height = 0;
			DisplayMonitorMode* _tmp76_;
			gint _tmp77_;
			gint _tmp78_;
			DisplayMonitorMode* _tmp79_;
			gboolean _tmp80_;
			gboolean _tmp81_;
			DisplayResolution res = {0};
			DisplayMonitorMode* _tmp82_;
			gboolean _tmp83_;
			gboolean _tmp84_;
			DisplayMonitorMode* _tmp85_;
			gboolean _tmp86_;
			gboolean _tmp87_;
			DisplayResolution _tmp88_ = {0};
			DisplayResolution _tmp89_;
			_tmp70_ = _mode_it;
			if (!gee_iterator_next (_tmp70_)) {
				break;
			}
			_tmp71_ = _mode_it;
			_tmp72_ = gee_iterator_get (_tmp71_);
			mode = (DisplayMonitorMode*) _tmp72_;
			_tmp73_ = mode;
			_tmp74_ = display_monitor_mode_get_width (_tmp73_);
			_tmp75_ = _tmp74_;
			mode_width = _tmp75_;
			_tmp76_ = mode;
			_tmp77_ = display_monitor_mode_get_height (_tmp76_);
			_tmp78_ = _tmp77_;
			mode_height = _tmp78_;
			_tmp79_ = mode;
			_tmp80_ = display_monitor_mode_get_is_preferred (_tmp79_);
			_tmp81_ = _tmp80_;
			if (_tmp81_) {
				max_width = MAX (max_width, mode_width);
				max_height = MAX (max_height, mode_height);
			}
			_tmp82_ = mode;
			_tmp83_ = display_monitor_mode_get_is_preferred (_tmp82_);
			_tmp84_ = _tmp83_;
			_tmp85_ = mode;
			_tmp86_ = display_monitor_mode_get_is_current (_tmp85_);
			_tmp87_ = _tmp86_;
			_tmp88_.width = mode_width;
			_tmp88_.height = mode_height;
			_tmp88_.aspect = (mode_width * 10) / mode_height;
			_tmp88_.is_preferred = _tmp84_;
			_tmp88_.is_current = _tmp87_;
			res = _tmp88_;
			_tmp89_ = res;
			_vala_array_add5 (&resolutions, &resolutions_length1, &_resolutions_size_, &_tmp89_);
			_g_object_unref0 (mode);
		}
		_g_object_unref0 (_mode_it);
	}
	native_ratio = (max_width * 10) / max_height;
	_tmp90_ = resolutions;
	_tmp90__length1 = resolutions_length1;
	{
		DisplayResolution* resolution_collection = NULL;
		gint resolution_collection_length1 = 0;
		gint _resolution_collection_size_ = 0;
		gint resolution_it = 0;
		resolution_collection = _tmp90_;
		resolution_collection_length1 = _tmp90__length1;
		for (resolution_it = 0; resolution_it < resolution_collection_length1; resolution_it = resolution_it + 1) {
			DisplayResolution resolution = {0};
			resolution = resolution_collection[resolution_it];
			{
				gboolean _tmp91_ = FALSE;
				DisplayResolution _tmp92_;
				gboolean _tmp94_ = FALSE;
				gboolean _tmp95_ = FALSE;
				DisplayResolution _tmp96_;
				guint _tmp101_;
				_tmp92_ = resolution;
				if (_tmp92_.width < 1024) {
					_tmp91_ = TRUE;
				} else {
					DisplayResolution _tmp93_;
					_tmp93_ = resolution;
					_tmp91_ = _tmp93_.height < 768;
				}
				if (_tmp91_) {
					continue;
				}
				_tmp96_ = resolution;
				if (_tmp96_.is_preferred) {
					_tmp95_ = TRUE;
				} else {
					DisplayResolution _tmp97_;
					_tmp97_ = resolution;
					_tmp95_ = _tmp97_.is_current;
				}
				if (_tmp95_) {
					_tmp94_ = TRUE;
				} else {
					DisplayResolution _tmp98_;
					_tmp98_ = resolution;
					_tmp94_ = _tmp98_.aspect == native_ratio;
				}
				if (_tmp94_) {
					DisplayResolution _tmp99_;
					_tmp99_ = resolution;
					_vala_array_add6 (&recommended_resolutions, &recommended_resolutions_length1, &_recommended_resolutions_size_, &_tmp99_);
				} else {
					DisplayResolution _tmp100_;
					_tmp100_ = resolution;
					_vala_array_add7 (&other_resolutions, &other_resolutions_length1, &_other_resolutions_size_, &_tmp100_);
				}
				_tmp101_ = usable_resolutions;
				usable_resolutions = _tmp101_ + 1;
			}
		}
	}
	_tmp102_ = recommended_resolutions;
	_tmp102__length1 = recommended_resolutions_length1;
	{
		DisplayResolution* resolution_collection = NULL;
		gint resolution_collection_length1 = 0;
		gint _resolution_collection_size_ = 0;
		gint resolution_it = 0;
		resolution_collection = _tmp102_;
		resolution_collection_length1 = _tmp102__length1;
		for (resolution_it = 0; resolution_it < resolution_collection_length1; resolution_it = resolution_it + 1) {
			DisplayResolution resolution = {0};
			resolution = resolution_collection[resolution_it];
			{
				GtkTreeIter iter = {0};
				GtkTreeStore* _tmp103_;
				GtkTreeIter _tmp104_ = {0};
				GtkTreeStore* _tmp105_;
				GtkTreeIter _tmp106_;
				DisplayResolution _tmp107_;
				DisplayResolution _tmp108_;
				gchar* _tmp109_;
				gchar* _tmp110_;
				DisplayResolution _tmp111_;
				DisplayResolution _tmp112_;
				_tmp103_ = self->priv->resolution_tree_store;
				gtk_tree_store_append (_tmp103_, &_tmp104_, NULL);
				iter = _tmp104_;
				_tmp105_ = self->priv->resolution_tree_store;
				_tmp106_ = iter;
				_tmp107_ = resolution;
				_tmp108_ = resolution;
				_tmp109_ = display_monitor_mode_get_resolution_string (_tmp107_.width, _tmp108_.height, FALSE);
				_tmp110_ = _tmp109_;
				_tmp111_ = resolution;
				_tmp112_ = resolution;
				gtk_tree_store_set (_tmp105_, &_tmp106_, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_NAME, _tmp110_, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_WIDTH, _tmp111_.width, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_HEIGHT, _tmp112_.height, -1);
				_g_free0 (_tmp110_);
			}
		}
	}
	_tmp113_ = other_resolutions;
	_tmp113__length1 = other_resolutions_length1;
	if (_tmp113__length1 > 0) {
		GtkTreeIter iter = {0};
		GtkTreeIter parent_iter = {0};
		GtkTreeStore* _tmp114_;
		GtkTreeIter _tmp115_ = {0};
		GtkTreeStore* _tmp116_;
		GtkTreeIter _tmp117_;
		DisplayResolution* _tmp118_;
		gint _tmp118__length1;
		_tmp114_ = self->priv->resolution_tree_store;
		gtk_tree_store_append (_tmp114_, &_tmp115_, NULL);
		parent_iter = _tmp115_;
		_tmp116_ = self->priv->resolution_tree_store;
		_tmp117_ = parent_iter;
		gtk_tree_store_set (_tmp116_, &_tmp117_, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_NAME, _ ("Other…"), DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_WIDTH, -1, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_HEIGHT, -1, -1);
		_tmp118_ = other_resolutions;
		_tmp118__length1 = other_resolutions_length1;
		{
			DisplayResolution* resolution_collection = NULL;
			gint resolution_collection_length1 = 0;
			gint _resolution_collection_size_ = 0;
			gint resolution_it = 0;
			resolution_collection = _tmp118_;
			resolution_collection_length1 = _tmp118__length1;
			for (resolution_it = 0; resolution_it < resolution_collection_length1; resolution_it = resolution_it + 1) {
				DisplayResolution resolution = {0};
				resolution = resolution_collection[resolution_it];
				{
					GtkTreeStore* _tmp119_;
					GtkTreeIter _tmp120_;
					GtkTreeIter _tmp121_ = {0};
					GtkTreeStore* _tmp122_;
					GtkTreeIter _tmp123_;
					DisplayResolution _tmp124_;
					DisplayResolution _tmp125_;
					gchar* _tmp126_;
					gchar* _tmp127_;
					DisplayResolution _tmp128_;
					DisplayResolution _tmp129_;
					_tmp119_ = self->priv->resolution_tree_store;
					_tmp120_ = parent_iter;
					gtk_tree_store_append (_tmp119_, &_tmp121_, &_tmp120_);
					iter = _tmp121_;
					_tmp122_ = self->priv->resolution_tree_store;
					_tmp123_ = iter;
					_tmp124_ = resolution;
					_tmp125_ = resolution;
					_tmp126_ = display_monitor_mode_get_resolution_string (_tmp124_.width, _tmp125_.height, TRUE);
					_tmp127_ = _tmp126_;
					_tmp128_ = resolution;
					_tmp129_ = resolution;
					gtk_tree_store_set (_tmp122_, &_tmp123_, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_NAME, _tmp127_, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_WIDTH, _tmp128_.width, DISPLAY_DISPLAY_WIDGET_RESOLUTION_COLUMNS_HEIGHT, _tmp129_.height, -1);
					_g_free0 (_tmp127_);
				}
			}
		}
	}
	if (!display_display_widget_set_active_resolution_from_current_mode (self)) {
		GtkComboBox* _tmp130_;
		_tmp130_ = self->priv->resolution_combobox;
		gtk_combo_box_set_active (_tmp130_, 0);
	}
	_tmp131_ = self->priv->resolution_combobox;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp131_, usable_resolutions > ((guint) 1));
	display_display_widget_populate_refresh_rates (self);
	_tmp132_ = (GtkPropertyExpression*) gtk_property_expression_new (DISPLAY_VIRTUAL_MONITOR_TYPE_SCALE, NULL, "string-representation");
	scale_name_expression = _tmp132_;
	_tmp133_ = self->priv->_virtual_monitor;
	_tmp134_ = display_virtual_monitor_get_available_scales (_tmp133_);
	_tmp135_ = _tmp134_;
	_tmp136_ = _g_object_ref0 ((GListModel*) _tmp135_);
	_tmp137_ = scale_name_expression;
	_tmp138_ = _gtk_expression_ref0 ((GtkExpression*) _tmp137_);
	_tmp139_ = (GtkDropDown*) gtk_drop_down_new (_tmp136_, _tmp138_);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp139_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp139_, 12);
	g_object_ref_sink (_tmp139_);
	_g_object_unref0 (self->priv->scale_drop_down);
	self->priv->scale_drop_down = _tmp139_;
	_tmp140_ = self->priv->_virtual_monitor;
	_tmp141_ = display_virtual_monitor_get_available_scales (_tmp140_);
	_tmp142_ = _tmp141_;
	_tmp143_ = self->priv->scale_drop_down;
	g_object_bind_property_with_closures ((GObject*) _tmp142_, "selected", (GObject*) _tmp143_, "selected", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp144_ = self->priv->scale_drop_down;
	_tmp145_ = _g_object_ref0 ((GtkWidget*) _tmp144_);
	_tmp146_ = granite_header_label_new (_ ("Scaling factor"));
	granite_header_label_set_mnemonic_widget (_tmp146_, _tmp145_);
	_g_object_unref0 (_tmp145_);
	g_object_ref_sink (_tmp146_);
	scale_label = _tmp146_;
	_tmp147_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp147_, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp147_, 12);
	g_object_ref_sink (_tmp147_);
	popover_box = _tmp147_;
	_tmp148_ = popover_box;
	_tmp149_ = self->priv->use_switch;
	gtk_box_append (_tmp148_, (GtkWidget*) _tmp149_);
	_tmp150_ = popover_box;
	_tmp151_ = resolution_label;
	gtk_box_append (_tmp150_, (GtkWidget*) _tmp151_);
	_tmp152_ = popover_box;
	_tmp153_ = self->priv->resolution_combobox;
	gtk_box_append (_tmp152_, (GtkWidget*) _tmp153_);
	_tmp154_ = popover_box;
	_tmp155_ = rotation_label;
	gtk_box_append (_tmp154_, (GtkWidget*) _tmp155_);
	_tmp156_ = popover_box;
	_tmp157_ = rotation_drop_down;
	gtk_box_append (_tmp156_, (GtkWidget*) _tmp157_);
	_tmp158_ = popover_box;
	_tmp159_ = refresh_label;
	gtk_box_append (_tmp158_, (GtkWidget*) _tmp159_);
	_tmp160_ = popover_box;
	_tmp161_ = self->priv->refresh_combobox;
	gtk_box_append (_tmp160_, (GtkWidget*) _tmp161_);
	_tmp162_ = display_monitor_manager_get_default ();
	_tmp163_ = display_monitor_manager_get_global_scale_required (_tmp162_);
	_tmp164_ = _tmp163_;
	if (!_tmp164_) {
		GtkBox* _tmp165_;
		GraniteHeaderLabel* _tmp166_;
		GtkBox* _tmp167_;
		GtkDropDown* _tmp168_;
		_tmp165_ = popover_box;
		_tmp166_ = scale_label;
		gtk_box_append (_tmp165_, (GtkWidget*) _tmp166_);
		_tmp167_ = popover_box;
		_tmp168_ = self->priv->scale_drop_down;
		gtk_box_append (_tmp167_, (GtkWidget*) _tmp168_);
	}
	_tmp169_ = popover_box;
	_tmp170_ = _g_object_ref0 ((GtkWidget*) _tmp169_);
	_tmp171_ = (GtkPopover*) gtk_popover_new ();
	gtk_popover_set_child (_tmp171_, _tmp170_);
	_g_object_unref0 (_tmp170_);
	gtk_popover_set_position (_tmp171_, GTK_POS_BOTTOM);
	g_object_ref_sink (_tmp171_);
	_data6_->popover = _tmp171_;
	_tmp172_ = g_strdup ("open-menu-symbolic");
	_tmp173_ = _data6_->popover;
	_tmp174_ = _g_object_ref0 (_tmp173_);
	_tmp175_ = g_strdup (_ ("Configure display"));
	_tmp176_ = (GtkMenuButton*) gtk_menu_button_new ();
	gtk_menu_button_set_has_frame (_tmp176_, FALSE);
	gtk_widget_set_halign ((GtkWidget*) _tmp176_, GTK_ALIGN_END);
	gtk_widget_set_valign ((GtkWidget*) _tmp176_, GTK_ALIGN_START);
	gtk_menu_button_set_icon_name (_tmp176_, _tmp172_);
	_g_free0 (_tmp172_);
	gtk_menu_button_set_popover (_tmp176_, _tmp174_);
	_g_object_unref0 (_tmp174_);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp176_, _tmp175_);
	_g_free0 (_tmp175_);
	g_object_ref_sink (_tmp176_);
	toggle_settings = _tmp176_;
	_tmp177_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp177_);
	grid = _tmp177_;
	_tmp178_ = grid;
	_tmp179_ = self->priv->primary_image;
	gtk_grid_attach (_tmp178_, (GtkWidget*) _tmp179_, 0, 0, 1, 1);
	_tmp180_ = grid;
	_tmp181_ = toggle_settings;
	gtk_grid_attach (_tmp180_, (GtkWidget*) _tmp181_, 2, 0, 1, 1);
	_tmp182_ = grid;
	_tmp183_ = _data6_->label;
	gtk_grid_attach (_tmp182_, (GtkWidget*) _tmp183_, 0, 0, 3, 2);
	_tmp184_ = grid;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp184_);
	_tmp185_ = self->priv->_virtual_monitor;
	_tmp186_ = display_virtual_monitor_get_primary (_tmp185_);
	_tmp187_ = _tmp186_;
	display_display_widget_set_primary (self, _tmp187_);
	_tmp188_ = self->priv->use_switch;
	_tmp189_ = self->priv->resolution_combobox;
	g_object_bind_property_with_closures ((GObject*) _tmp188_, "active", (GObject*) _tmp189_, "sensitive", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp190_ = self->priv->use_switch;
	_tmp191_ = rotation_drop_down;
	g_object_bind_property_with_closures ((GObject*) _tmp190_, "active", (GObject*) _tmp191_, "sensitive", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp192_ = self->priv->use_switch;
	_tmp193_ = self->priv->refresh_combobox;
	g_object_bind_property_with_closures ((GObject*) _tmp192_, "active", (GObject*) _tmp193_, "sensitive", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp194_ = self->priv->use_switch;
	_tmp195_ = self->priv->scale_drop_down;
	g_object_bind_property_with_closures ((GObject*) _tmp194_, "active", (GObject*) _tmp195_, "sensitive", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp196_ = self->priv->use_switch;
	g_signal_connect_object ((GObject*) _tmp196_, "notify::active", (GCallback) __display_display_widget___lambda7__g_object_notify, self, 0);
	_tmp197_ = self->priv->_virtual_monitor;
	_tmp198_ = display_virtual_monitor_get_is_active (_tmp197_);
	_tmp199_ = _tmp198_;
	if (!_tmp199_) {
		gtk_widget_add_css_class ((GtkWidget*) self, "disabled");
	}
	_tmp200_ = self->priv->resolution_combobox;
	g_signal_connect_data (_tmp200_, "changed", (GCallback) __display_display_widget___lambda8__gtk_combo_box_changed, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_tmp201_ = self->priv->_virtual_monitor;
	_tmp202_ = display_virtual_monitor_get_available_transforms (_tmp201_);
	_tmp203_ = _tmp202_;
	g_signal_connect_data ((GtkSelectionModel*) _tmp203_, "selection-changed", (GCallback) __display_display_widget___lambda9__gtk_selection_model_selection_changed, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_tmp204_ = self->priv->refresh_combobox;
	g_signal_connect_data (_tmp204_, "changed", (GCallback) __display_display_widget___lambda10__gtk_combo_box_changed, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_tmp205_ = self->priv->scale_drop_down;
	g_signal_connect_data ((GObject*) _tmp205_, "notify::selected-item", (GCallback) __display_display_widget___lambda11__g_object_notify, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_tmp206_ = self->priv->_virtual_monitor;
	g_signal_connect_object (_tmp206_, "modes-changed", (GCallback) _display_display_widget_on_monitor_modes_changed_display_virtual_monitor_modes_changed, self, 0);
	g_signal_emit (self, display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_CONFIGURATION_CHANGED_SIGNAL], 0);
	g_signal_emit (self, display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_CHECK_POSITION_SIGNAL], 0);
	_g_object_unref0 (grid);
	_g_object_unref0 (toggle_settings);
	_g_object_unref0 (popover_box);
	_g_object_unref0 (scale_label);
	_gtk_expression_unref0 (scale_name_expression);
	_g_object_unref0 (resolution_set);
	other_resolutions = (g_free (other_resolutions), NULL);
	recommended_resolutions = (g_free (recommended_resolutions), NULL);
	resolutions = (g_free (resolutions), NULL);
	_g_object_unref0 (refresh_label);
	_g_object_unref0 (rotation_label);
	_g_object_unref0 (rotation_drop_down);
	_gtk_expression_unref0 (rotation_name_expression);
	_g_object_unref0 (text_renderer);
	_g_object_unref0 (resolution_label);
	block6_data_unref (_data6_);
	_data6_ = NULL;
	return obj;
}

static void
display_display_widget_base_init (DisplayDisplayWidgetClass * klass)
{
	gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (klass), "display-widget");
}

static void
display_display_widget_class_init (DisplayDisplayWidgetClass * klass,
                                   gpointer klass_data)
{
	display_display_widget_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DisplayDisplayWidget_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_display_display_widget_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_display_display_widget_set_property;
	G_OBJECT_CLASS (klass)->constructor = display_display_widget_constructor;
	G_OBJECT_CLASS (klass)->finalize = display_display_widget_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DISPLAY_DISPLAY_WIDGET_VIRTUAL_MONITOR_PROPERTY, display_display_widget_properties[DISPLAY_DISPLAY_WIDGET_VIRTUAL_MONITOR_PROPERTY] = g_param_spec_object ("virtual-monitor", "virtual-monitor", "virtual-monitor", DISPLAY_TYPE_VIRTUAL_MONITOR, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DISPLAY_DISPLAY_WIDGET_BG_COLOR_PROPERTY, display_display_widget_properties[DISPLAY_DISPLAY_WIDGET_BG_COLOR_PROPERTY] = g_param_spec_string ("bg-color", "bg-color", "bg-color", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DISPLAY_DISPLAY_WIDGET_TEXT_COLOR_PROPERTY, display_display_widget_properties[DISPLAY_DISPLAY_WIDGET_TEXT_COLOR_PROPERTY] = g_param_spec_string ("text-color", "text-color", "text-color", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DISPLAY_DISPLAY_WIDGET_DISPLAY_NAME_PROPERTY, display_display_widget_properties[DISPLAY_DISPLAY_WIDGET_DISPLAY_NAME_PROPERTY] = g_param_spec_string ("display-name", "display-name", "display-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DISPLAY_DISPLAY_WIDGET_WINDOW_RATIO_PROPERTY, display_display_widget_properties[DISPLAY_DISPLAY_WIDGET_WINDOW_RATIO_PROPERTY] = g_param_spec_double ("window-ratio", "window-ratio", "window-ratio", -G_MAXDOUBLE, G_MAXDOUBLE, 1.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DISPLAY_DISPLAY_WIDGET_CONNECTED_PROPERTY, display_display_widget_properties[DISPLAY_DISPLAY_WIDGET_CONNECTED_PROPERTY] = g_param_spec_boolean ("connected", "connected", "connected", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_SET_AS_PRIMARY_SIGNAL] = g_signal_new ("set-as-primary", DISPLAY_TYPE_DISPLAY_WIDGET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_CHECK_POSITION_SIGNAL] = g_signal_new ("check-position", DISPLAY_TYPE_DISPLAY_WIDGET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_CONFIGURATION_CHANGED_SIGNAL] = g_signal_new ("configuration-changed", DISPLAY_TYPE_DISPLAY_WIDGET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	display_display_widget_signals[DISPLAY_DISPLAY_WIDGET_ACTIVE_CHANGED_SIGNAL] = g_signal_new ("active-changed", DISPLAY_TYPE_DISPLAY_WIDGET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
display_display_widget_instance_init (DisplayDisplayWidget * self,
                                      gpointer klass)
{
	self->priv = display_display_widget_get_instance_private (self);
	self->priv->_window_ratio = 1.0;
	self->priv->real_width = 0;
	self->priv->real_height = 0;
}

static void
display_display_widget_finalize (GObject * obj)
{
	DisplayDisplayWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DISPLAY_TYPE_DISPLAY_WIDGET, DisplayDisplayWidget);
	_g_object_unref0 (self->priv->_virtual_monitor);
	_g_free0 (self->priv->_bg_color);
	_g_free0 (self->priv->_text_color);
	_g_object_unref0 (self->priv->primary_image);
	_g_object_unref0 (self->priv->use_switch);
	_g_object_unref0 (self->priv->resolution_combobox);
	_g_object_unref0 (self->priv->resolution_tree_store);
	_g_object_unref0 (self->priv->refresh_combobox);
	_g_object_unref0 (self->priv->refresh_list_store);
	_g_object_unref0 (self->priv->scale_drop_down);
	G_OBJECT_CLASS (display_display_widget_parent_class)->finalize (obj);
}

static GType
display_display_widget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DisplayDisplayWidgetClass), (GBaseInitFunc) display_display_widget_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) display_display_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DisplayDisplayWidget), 0, (GInstanceInitFunc) display_display_widget_instance_init, NULL };
	GType display_display_widget_type_id;
	display_display_widget_type_id = g_type_register_static (gtk_box_get_type (), "DisplayDisplayWidget", &g_define_type_info, 0);
	DisplayDisplayWidget_private_offset = g_type_add_instance_private (display_display_widget_type_id, sizeof (DisplayDisplayWidgetPrivate));
	return display_display_widget_type_id;
}

GType
display_display_widget_get_type (void)
{
	static volatile gsize display_display_widget_type_id__once = 0;
	if (g_once_init_enter (&display_display_widget_type_id__once)) {
		GType display_display_widget_type_id;
		display_display_widget_type_id = display_display_widget_get_type_once ();
		g_once_init_leave (&display_display_widget_type_id__once, display_display_widget_type_id);
	}
	return display_display_widget_type_id__once;
}

static void
_vala_display_display_widget_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec)
{
	DisplayDisplayWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DISPLAY_TYPE_DISPLAY_WIDGET, DisplayDisplayWidget);
	switch (property_id) {
		case DISPLAY_DISPLAY_WIDGET_VIRTUAL_MONITOR_PROPERTY:
		g_value_set_object (value, display_display_widget_get_virtual_monitor (self));
		break;
		case DISPLAY_DISPLAY_WIDGET_BG_COLOR_PROPERTY:
		g_value_set_string (value, display_display_widget_get_bg_color (self));
		break;
		case DISPLAY_DISPLAY_WIDGET_TEXT_COLOR_PROPERTY:
		g_value_set_string (value, display_display_widget_get_text_color (self));
		break;
		case DISPLAY_DISPLAY_WIDGET_DISPLAY_NAME_PROPERTY:
		g_value_set_string (value, display_display_widget_get_display_name (self));
		break;
		case DISPLAY_DISPLAY_WIDGET_WINDOW_RATIO_PROPERTY:
		g_value_set_double (value, display_display_widget_get_window_ratio (self));
		break;
		case DISPLAY_DISPLAY_WIDGET_CONNECTED_PROPERTY:
		g_value_set_boolean (value, display_display_widget_get_connected (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_display_display_widget_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec)
{
	DisplayDisplayWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DISPLAY_TYPE_DISPLAY_WIDGET, DisplayDisplayWidget);
	switch (property_id) {
		case DISPLAY_DISPLAY_WIDGET_VIRTUAL_MONITOR_PROPERTY:
		display_display_widget_set_virtual_monitor (self, g_value_get_object (value));
		break;
		case DISPLAY_DISPLAY_WIDGET_BG_COLOR_PROPERTY:
		display_display_widget_set_bg_color (self, g_value_get_string (value));
		break;
		case DISPLAY_DISPLAY_WIDGET_TEXT_COLOR_PROPERTY:
		display_display_widget_set_text_color (self, g_value_get_string (value));
		break;
		case DISPLAY_DISPLAY_WIDGET_WINDOW_RATIO_PROPERTY:
		display_display_widget_set_window_ratio (self, g_value_get_double (value));
		break;
		case DISPLAY_DISPLAY_WIDGET_CONNECTED_PROPERTY:
		display_display_widget_set_connected (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

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

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

