static gboolean monitor_control_new(Control *ctrl)
{
    t_global_monitor *global;

    global = monitor_new();

    gtk_container_add(GTK_CONTAINER(ctrl->base), GTK_WIDGET(global->ebox));

    run_update( global );

    ctrl->data = (gpointer)global;
    ctrl->with_popup = FALSE;

    gtk_widget_set_size_request(ctrl->base, -1, -1);

    return TRUE;
}
static GObject * main_window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	MainWindow * self;
	GdkEventMask _tmp0_;
	GdkEventMask _tmp1_;
	GtkAccelGroup* _tmp2_;
	GtkAccelGroup* accel_group;
	GtkAccelGroup* _tmp3_;
	GdkRGBA bg_color = {0};
	gchar* _tmp4_ = NULL;
	gchar* _tmp5_;
	GdkRGBA _tmp6_;
	AtkObject* _tmp7_ = NULL;
	const gchar* _tmp8_ = NULL;
	GdkWindow* _tmp9_ = NULL;
	cairo_t* _tmp10_ = NULL;
	cairo_t* _tmp11_;
	cairo_surface_t* _tmp12_ = NULL;
	Background* _tmp13_;
	Background* _tmp14_;
	gboolean _tmp15_ = FALSE;
	Background* _tmp16_;
	gchar* _tmp17_ = NULL;
	gchar* _tmp18_;
	Background* _tmp19_;
	gchar* _tmp20_ = NULL;
	gchar* _tmp21_;
	gchar* _tmp22_ = NULL;
	gchar* _tmp23_;
	Background* _tmp24_;
	Background* _tmp25_;
	Background* _tmp26_;
	GtkBox* _tmp27_;
	GtkBox* _tmp28_;
	Background* _tmp29_;
	GtkBox* _tmp30_;
	GtkEventBox* _tmp31_;
	GtkEventBox* menubox;
	GtkAlignment* _tmp32_;
	GtkAlignment* menualign;
	gchar* _tmp33_ = NULL;
	gchar* shadow_path;
	gchar* _tmp34_;
	gchar* shadow_style;
	const gchar* _tmp35_;
	gboolean _tmp36_ = FALSE;
	GtkEventBox* _tmp51_;
	GtkEventBox* _tmp52_;
	GtkAlignment* _tmp53_;
	GtkEventBox* _tmp54_;
	GtkAlignment* _tmp55_;
	GtkBox* _tmp56_;
	GtkEventBox* _tmp57_;
	GtkAlignment* _tmp58_;
	GtkEventBox* _tmp59_;
	Background* _tmp60_;
	GtkAccelGroup* _tmp61_;
	MenuBar* _tmp62_;
	MenuBar* _tmp63_;
	GtkAlignment* _tmp64_;
	MenuBar* _tmp65_;
	MenuBar* _tmp66_;
	GtkBox* _tmp67_;
	GtkBox* _tmp68_;
	GtkBox* _tmp69_;
	GtkBox* _tmp70_;
	GtkBox* _tmp71_;
	GtkAlignment* _tmp72_;
	GtkAlignment* align;
	GtkAlignment* _tmp73_;
	GtkAlignment* _tmp74_;
	GtkAlignment* _tmp75_;
	GtkBox* _tmp76_;
	GtkAlignment* _tmp77_;
	FlatButton* _tmp78_;
	GtkButton* _tmp79_;
	gchar* _tmp80_ = NULL;
	gchar* _tmp81_;
	GtkImage* _tmp82_;
	GtkImage* _tmp83_;
	GtkImage* image;
	GtkImage* _tmp84_;
	GtkButton* _tmp85_;
	GtkButton* _tmp86_;
	GtkImage* _tmp87_;
	GtkButton* _tmp88_;
	GtkAlignment* _tmp89_;
	GtkButton* _tmp90_;
	GtkAlignment* _tmp91_;
	GtkAlignment* _tmp92_;
	GtkBox* _tmp93_;
	GtkAlignment* _tmp94_;
	ListStack* _tmp95_;
	ListStack* _tmp96_;
	GtkAlignment* _tmp97_;
	ListStack* _tmp98_;
	UnityGreeter* _tmp99_;
	gboolean _tmp100_;
	GError * _inner_error_ = NULL;
	parent_class = G_OBJECT_CLASS (main_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAIN_WINDOW, MainWindow);
	_tmp0_ = gtk_widget_get_events ((GtkWidget*) self);
	_tmp1_ = _tmp0_;
	gtk_widget_set_events ((GtkWidget*) self, _tmp1_ | GDK_POINTER_MOTION_MASK);
	_tmp2_ = gtk_accel_group_new ();
	accel_group = _tmp2_;
	_tmp3_ = accel_group;
	gtk_window_add_accel_group ((GtkWindow*) self, _tmp3_);
	memset (&bg_color, 0, sizeof (GdkRGBA));
	_tmp4_ = ug_settings_get_string (UG_SETTINGS_KEY_BACKGROUND_COLOR);
	_tmp5_ = _tmp4_;
	gdk_rgba_parse (&bg_color, _tmp5_);
	_g_free0 (_tmp5_);
	_tmp6_ = bg_color;
	gtk_widget_override_background_color ((GtkWidget*) self, GTK_STATE_FLAG_NORMAL, &_tmp6_);
	_tmp7_ = gtk_widget_get_accessible ((GtkWidget*) self);
	_tmp8_ = _ ("Login Screen");
	atk_object_set_name (_tmp7_, _tmp8_);
	gtk_window_set_has_resize_grip ((GtkWindow*) self, FALSE);
	unity_greeter_add_style_class ((GtkWidget*) self);
	gtk_widget_realize ((GtkWidget*) self);
	_tmp9_ = gtk_widget_get_window ((GtkWidget*) self);
	_tmp10_ = gdk_cairo_create (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = cairo_get_target (_tmp11_);
	_tmp13_ = background_new (_tmp12_);
	g_object_ref_sink (_tmp13_);
	_g_object_unref0 (self->priv->background);
	self->priv->background = _tmp13_;
	_cairo_destroy0 (_tmp11_);
	_tmp14_ = self->priv->background;
	_tmp15_ = ug_settings_get_boolean (UG_SETTINGS_KEY_DRAW_GRID);
	background_set_draw_grid (_tmp14_, _tmp15_);
	_tmp16_ = self->priv->background;
	_tmp17_ = ug_settings_get_string (UG_SETTINGS_KEY_BACKGROUND);
	_tmp18_ = _tmp17_;
	background_set_default_background (_tmp16_, _tmp18_);
	_g_free0 (_tmp18_);
	_tmp19_ = self->priv->background;
	_tmp20_ = ug_settings_get_string (UG_SETTINGS_KEY_LOGO);
	_tmp21_ = _tmp20_;
	_tmp22_ = ug_settings_get_string (UG_SETTINGS_KEY_BACKGROUND_LOGO);
	_tmp23_ = _tmp22_;
	background_set_logo (_tmp19_, _tmp21_, _tmp23_);
	_g_free0 (_tmp23_);
	_g_free0 (_tmp21_);
	_tmp24_ = self->priv->background;
	gtk_widget_show ((GtkWidget*) _tmp24_);
	_tmp25_ = self->priv->background;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp25_);
	_tmp26_ = self->priv->background;
	unity_greeter_add_style_class ((GtkWidget*) _tmp26_);
	_tmp27_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp27_);
	_g_object_unref0 (self->priv->login_box);
	self->priv->login_box = _tmp27_;
	_tmp28_ = self->priv->login_box;
	gtk_widget_show ((GtkWidget*) _tmp28_);
	_tmp29_ = self->priv->background;
	_tmp30_ = self->priv->login_box;
	gtk_container_add ((GtkContainer*) _tmp29_, (GtkWidget*) _tmp30_);
	_tmp31_ = (GtkEventBox*) gtk_event_box_new ();
	g_object_ref_sink (_tmp31_);
	menubox = _tmp31_;
	_tmp32_ = (GtkAlignment*) gtk_alignment_new (0.0f, 0.0f, 1.0f, 0.0f);
	g_object_ref_sink (_tmp32_);
	menualign = _tmp32_;
	_tmp33_ = g_build_filename (PKGDATADIR, "shadow.png", NULL, NULL);
	shadow_path = _tmp33_;
	_tmp34_ = g_strdup ("");
	shadow_style = _tmp34_;
	_tmp35_ = shadow_path;
	_tmp36_ = g_file_test (_tmp35_, G_FILE_TEST_EXISTS);
	if (_tmp36_) {
		const gchar* _tmp37_;
		gchar* _tmp38_ = NULL;
		_tmp37_ = shadow_path;
		_tmp38_ = g_strdup_printf ("background-image: url('%s');\n" \
"                            background-repeat: repeat;", _tmp37_);
		_g_free0 (shadow_style);
		shadow_style = _tmp38_;
	}
	{
		GtkCssProvider* _tmp39_;
		GtkCssProvider* style;
		GtkCssProvider* _tmp40_;
		const gchar* _tmp41_;
		gchar* _tmp42_ = NULL;
		gchar* _tmp43_;
		GtkEventBox* _tmp44_;
		GtkStyleContext* _tmp45_ = NULL;
		GtkStyleContext* _tmp46_;
		GtkStyleContext* context;
		GtkStyleContext* _tmp47_;
		GtkCssProvider* _tmp48_;
		_tmp39_ = gtk_css_provider_new ();
		style = _tmp39_;
		_tmp40_ = style;
		_tmp41_ = shadow_style;
		_tmp42_ = g_strdup_printf ("* {background-color: transparent;\n" \
"                                      %s\n" \
"                                     }", _tmp41_);
		_tmp43_ = _tmp42_;
		gtk_css_provider_load_from_data (_tmp40_, _tmp43_, (gssize) (-1), &_inner_error_);
		_g_free0 (_tmp43_);
		if (_inner_error_ != NULL) {
			_g_object_unref0 (style);
			goto __catch11_g_error;
		}
		_tmp44_ = menubox;
		_tmp45_ = gtk_widget_get_style_context ((GtkWidget*) _tmp44_);
		_tmp46_ = _g_object_ref0 (_tmp45_);
		context = _tmp46_;
		_tmp47_ = context;
		_tmp48_ = style;
		gtk_style_context_add_provider (_tmp47_, (GtkStyleProvider*) _tmp48_, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
		_g_object_unref0 (context);
		_g_object_unref0 (style);
	}
	goto __finally11;
	__catch11_g_error:
	{
		GError* e = NULL;
		GError* _tmp49_;
		const gchar* _tmp50_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp49_ = e;
		_tmp50_ = _tmp49_->message;
		g_debug ("main-window.vala:87: Internal error loading menubox style: %s", _tmp50_);
		_g_error_free0 (e);
	}
	__finally11:
	if (_inner_error_ != NULL) {
		_g_free0 (shadow_style);
		_g_free0 (shadow_path);
		_g_object_unref0 (menualign);
		_g_object_unref0 (menubox);
		_g_object_unref0 (accel_group);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
	}
	_tmp51_ = menubox;
	gtk_widget_set_size_request ((GtkWidget*) _tmp51_, -1, MAIN_WINDOW_MENUBAR_HEIGHT);
	_tmp52_ = menubox;
	gtk_widget_show ((GtkWidget*) _tmp52_);
	_tmp53_ = menualign;
	gtk_widget_show ((GtkWidget*) _tmp53_);
	_tmp54_ = menubox;
	_tmp55_ = menualign;
	gtk_container_add ((GtkContainer*) _tmp54_, (GtkWidget*) _tmp55_);
	_tmp56_ = self->priv->login_box;
	_tmp57_ = menubox;
	gtk_container_add ((GtkContainer*) _tmp56_, (GtkWidget*) _tmp57_);
	_tmp58_ = menualign;
	unity_greeter_add_style_class ((GtkWidget*) _tmp58_);
	_tmp59_ = menubox;
	unity_greeter_add_style_class ((GtkWidget*) _tmp59_);
	_tmp60_ = self->priv->background;
	_tmp61_ = accel_group;
	_tmp62_ = menu_bar_new (_tmp60_, _tmp61_);
	g_object_ref_sink (_tmp62_);
	_g_object_unref0 (self->menubar);
	self->menubar = _tmp62_;
	_tmp63_ = self->menubar;
	gtk_widget_show ((GtkWidget*) _tmp63_);
	_tmp64_ = menualign;
	_tmp65_ = self->menubar;
	gtk_container_add ((GtkContainer*) _tmp64_, (GtkWidget*) _tmp65_);
	_tmp66_ = self->menubar;
	unity_greeter_add_style_class ((GtkWidget*) _tmp66_);
	_tmp67_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	g_object_ref_sink (_tmp67_);
	_g_object_unref0 (self->priv->hbox);
	self->priv->hbox = _tmp67_;
	_tmp68_ = self->priv->hbox;
	g_object_set ((GtkWidget*) _tmp68_, "expand", TRUE, NULL);
	_tmp69_ = self->priv->hbox;
	gtk_widget_show ((GtkWidget*) _tmp69_);
	_tmp70_ = self->priv->login_box;
	_tmp71_ = self->priv->hbox;
	gtk_container_add ((GtkContainer*) _tmp70_, (GtkWidget*) _tmp71_);
	_tmp72_ = (GtkAlignment*) gtk_alignment_new (0.5f, 0.5f, 0.0f, 0.0f);
	g_object_ref_sink (_tmp72_);
	align = _tmp72_;
	_tmp73_ = align;
	gtk_widget_set_size_request ((GtkWidget*) _tmp73_, grid_size, -1);
	_tmp74_ = align;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp74_, MAIN_WINDOW_MENUBAR_HEIGHT);
	_tmp75_ = align;
	gtk_widget_show ((GtkWidget*) _tmp75_);
	_tmp76_ = self->priv->hbox;
	_tmp77_ = align;
	gtk_container_add ((GtkContainer*) _tmp76_, (GtkWidget*) _tmp77_);
	_tmp78_ = flat_button_new ();
	g_object_ref_sink (_tmp78_);
	_g_object_unref0 (self->priv->back_button);
	self->priv->back_button = (GtkButton*) _tmp78_;
	_tmp79_ = self->priv->back_button;
	gtk_button_set_focus_on_click (_tmp79_, FALSE);
	_tmp80_ = g_build_filename (PKGDATADIR, "arrow_left.png", NULL, NULL);
	_tmp81_ = _tmp80_;
	_tmp82_ = (GtkImage*) gtk_image_new_from_file (_tmp81_);
	g_object_ref_sink (_tmp82_);
	_tmp83_ = _tmp82_;
	_g_free0 (_tmp81_);
	image = _tmp83_;
	_tmp84_ = image;
	gtk_widget_show ((GtkWidget*) _tmp84_);
	_tmp85_ = self->priv->back_button;
	gtk_widget_set_size_request ((GtkWidget*) _tmp85_, grid_size - (GREETER_LIST_BORDER * 2), grid_size - (GREETER_LIST_BORDER * 2));
	_tmp86_ = self->priv->back_button;
	_tmp87_ = image;
	gtk_container_add ((GtkContainer*) _tmp86_, (GtkWidget*) _tmp87_);
	_tmp88_ = self->priv->back_button;
	g_signal_connect_object (_tmp88_, "clicked", (GCallback) _main_window_pop_list_gtk_button_clicked, self, 0);
	_tmp89_ = align;
	_tmp90_ = self->priv->back_button;
	gtk_container_add ((GtkContainer*) _tmp89_, (GtkWidget*) _tmp90_);
	_tmp91_ = (GtkAlignment*) gtk_alignment_new (0.0f, 0.5f, 0.0f, 1.0f);
	g_object_ref_sink (_tmp91_);
	_g_object_unref0 (align);
	align = _tmp91_;
	_tmp92_ = align;
	gtk_widget_show ((GtkWidget*) _tmp92_);
	_tmp93_ = self->priv->hbox;
	_tmp94_ = align;
	gtk_container_add ((GtkContainer*) _tmp93_, (GtkWidget*) _tmp94_);
	_tmp95_ = list_stack_new ();
	g_object_ref_sink (_tmp95_);
	_g_object_unref0 (self->stack);
	self->stack = _tmp95_;
	_tmp96_ = self->stack;
	gtk_widget_show ((GtkWidget*) _tmp96_);
	_tmp97_ = align;
	_tmp98_ = self->stack;
	gtk_container_add ((GtkContainer*) _tmp97_, (GtkWidget*) _tmp98_);
	main_window_add_user_list (self);
	_tmp99_ = unity_greeter_singleton;
	_tmp100_ = _tmp99_->test_mode;
	if (_tmp100_) {
		Monitor* _tmp101_;
		Monitor* _tmp102_;
		Background* _tmp103_;
		GList* _tmp104_;
		GList* _tmp105_;
		gconstpointer _tmp106_ = NULL;
		__g_list_free__monitor_unref0_0 (self->priv->monitors);
		self->priv->monitors = NULL;
		_tmp101_ = monitor_new (0, 0, 800, 600);
		self->priv->monitors = g_list_append (self->priv->monitors, _tmp101_);
		_tmp102_ = monitor_new (800, 120, 640, 480);
		self->priv->monitors = g_list_append (self->priv->monitors, _tmp102_);
		_tmp103_ = self->priv->background;
		_tmp104_ = self->priv->monitors;
		background_set_monitors (_tmp103_, _tmp104_);
		_tmp105_ = self->priv->monitors;
		_tmp106_ = g_list_nth_data (_tmp105_, (guint) 0);
		main_window_move_to_monitor (self, (Monitor*) _tmp106_);
		gtk_window_resize ((GtkWindow*) self, 800 + 640, 600);
	} else {
		GdkScreen* _tmp107_ = NULL;
		GdkScreen* _tmp108_;
		GdkScreen* screen;
		GdkScreen* _tmp109_;
		GdkScreen* _tmp110_;
		_tmp107_ = gtk_window_get_screen ((GtkWindow*) self);
		_tmp108_ = _g_object_ref0 (_tmp107_);
		screen = _tmp108_;
		_tmp109_ = screen;
		g_signal_connect_object (_tmp109_, "monitors-changed", (GCallback) _main_window_monitors_changed_cb_gdk_screen_monitors_changed, self, 0);
		_tmp110_ = screen;
		main_window_monitors_changed_cb (self, _tmp110_);
		_g_object_unref0 (screen);
	}
	_g_object_unref0 (image);
	_g_object_unref0 (align);
	_g_free0 (shadow_style);
	_g_free0 (shadow_path);
	_g_object_unref0 (menualign);
	_g_object_unref0 (menubox);
	_g_object_unref0 (accel_group);
	return obj;
}
static void main_window_monitors_changed_cb (MainWindow* self, GdkScreen* screen) {
	GdkScreen* _tmp0_;
	gint _tmp1_ = 0;
	GdkScreen* _tmp2_;
	gint _tmp3_ = 0;
	Background* _tmp34_;
	GList* _tmp35_;
	GdkScreen* _tmp36_;
	gint _tmp37_ = 0;
	GdkScreen* _tmp38_;
	gint _tmp39_ = 0;
	GList* _tmp40_;
	gconstpointer _tmp41_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (screen != NULL);
	_tmp0_ = screen;
	_tmp1_ = gdk_screen_get_width (_tmp0_);
	_tmp2_ = screen;
	_tmp3_ = gdk_screen_get_height (_tmp2_);
	g_debug ("main-window.vala:181: Screen is %dx%d pixels", _tmp1_, _tmp3_);
	__g_list_free__monitor_unref0_0 (self->priv->monitors);
	self->priv->monitors = NULL;
	{
		gint i;
		i = 0;
		{
			gboolean _tmp4_;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp5_;
				gint _tmp7_;
				GdkScreen* _tmp8_;
				gint _tmp9_ = 0;
				GdkRectangle geometry = {0};
				GdkScreen* _tmp10_;
				gint _tmp11_;
				GdkRectangle _tmp12_ = {0};
				gint _tmp13_;
				GdkRectangle _tmp14_;
				gint _tmp15_;
				GdkRectangle _tmp16_;
				gint _tmp17_;
				GdkRectangle _tmp18_;
				gint _tmp19_;
				GdkRectangle _tmp20_;
				gint _tmp21_;
				GdkScreen* _tmp22_;
				gint _tmp23_;
				gboolean _tmp24_ = FALSE;
				_tmp5_ = _tmp4_;
				if (!_tmp5_) {
					gint _tmp6_;
					_tmp6_ = i;
					i = _tmp6_ + 1;
				}
				_tmp4_ = FALSE;
				_tmp7_ = i;
				_tmp8_ = screen;
				_tmp9_ = gdk_screen_get_n_monitors (_tmp8_);
				if (!(_tmp7_ < _tmp9_)) {
					break;
				}
				_tmp10_ = screen;
				_tmp11_ = i;
				gdk_screen_get_monitor_geometry (_tmp10_, _tmp11_, &_tmp12_);
				geometry = _tmp12_;
				_tmp13_ = i;
				_tmp14_ = geometry;
				_tmp15_ = _tmp14_.width;
				_tmp16_ = geometry;
				_tmp17_ = _tmp16_.height;
				_tmp18_ = geometry;
				_tmp19_ = _tmp18_.x;
				_tmp20_ = geometry;
				_tmp21_ = _tmp20_.y;
				g_debug ("main-window.vala:187: Monitor %d is %dx%d pixels at %d,%d", _tmp13_, _tmp15_, _tmp17_, _tmp19_, _tmp21_);
				_tmp22_ = screen;
				_tmp23_ = i;
				_tmp24_ = main_window_monitor_is_unique_position (self, _tmp22_, _tmp23_);
				if (_tmp24_) {
					GdkRectangle _tmp25_;
					gint _tmp26_;
					GdkRectangle _tmp27_;
					gint _tmp28_;
					GdkRectangle _tmp29_;
					gint _tmp30_;
					GdkRectangle _tmp31_;
					gint _tmp32_;
					Monitor* _tmp33_;
					_tmp25_ = geometry;
					_tmp26_ = _tmp25_.x;
					_tmp27_ = geometry;
					_tmp28_ = _tmp27_.y;
					_tmp29_ = geometry;
					_tmp30_ = _tmp29_.width;
					_tmp31_ = geometry;
					_tmp32_ = _tmp31_.height;
					_tmp33_ = monitor_new (_tmp26_, _tmp28_, _tmp30_, _tmp32_);
					self->priv->monitors = g_list_append (self->priv->monitors, _tmp33_);
				}
			}
		}
	}
	_tmp34_ = self->priv->background;
	_tmp35_ = self->priv->monitors;
	background_set_monitors (_tmp34_, _tmp35_);
	_tmp36_ = screen;
	_tmp37_ = gdk_screen_get_width (_tmp36_);
	_tmp38_ = screen;
	_tmp39_ = gdk_screen_get_height (_tmp38_);
	gtk_window_resize ((GtkWindow*) self, _tmp37_, _tmp39_);
	gtk_window_move ((GtkWindow*) self, 0, 0);
	_tmp40_ = self->priv->monitors;
	_tmp41_ = g_list_nth_data (_tmp40_, (guint) 0);
	main_window_move_to_monitor (self, (Monitor*) _tmp41_);
}