/* SuppliesView.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from SuppliesView.vala, do not modify */

/*
 * SPDX-License-Identifier: LGPL-3.0-or-later
 * SPDX-FileCopyrightText: 2015-2023 elementary, Inc. (https://elementary.io)
 *
 * Authored by: Corentin Noël <corentin@elementary.io>
 */

#include "io.elementary.settings.printers.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <granite-7.h>
#include <gee.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.h>

#define PRINTERS_SUPPLIES_VIEW_STYLE_CLASS "\n" \
"    levelbar.color-%s block.filled {\n" \
"        background-color: #%s;\n" \
"    }\n" \
"    "
#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  {
	PRINTERS_SUPPLIES_VIEW_0_PROPERTY,
	PRINTERS_SUPPLIES_VIEW_PRINTER_PROPERTY,
	PRINTERS_SUPPLIES_VIEW_NUM_PROPERTIES
};
static GParamSpec* printers_supplies_view_properties[PRINTERS_SUPPLIES_VIEW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _printers_printer_color_level_unref0(var) ((var == NULL) ? NULL : (var = (printers_printer_color_level_unref (var), NULL)))

struct _PrintersSuppliesViewPrivate {
	PrintersPrinter* _printer;
};

static gint PrintersSuppliesView_private_offset;
static gpointer printers_supplies_view_parent_class = NULL;

static const gchar* printers_supplies_view_get_translated_name (PrintersSuppliesView* self,
                                                         const gchar* name);
static GObject * printers_supplies_view_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties);
static void printers_supplies_view_finalize (GObject * obj);
static GType printers_supplies_view_get_type_once (void);
static void _vala_printers_supplies_view_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec);
static void _vala_printers_supplies_view_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static inline gpointer
printers_supplies_view_get_instance_private (PrintersSuppliesView* self)
{
	return G_STRUCT_MEMBER_P (self, PrintersSuppliesView_private_offset);
}

PrintersSuppliesView*
printers_supplies_view_construct (GType object_type,
                                  PrintersPrinter* printer)
{
	PrintersSuppliesView * self = NULL;
	g_return_val_if_fail (printer != NULL, NULL);
	self = (PrintersSuppliesView*) g_object_new (object_type, "printer", printer, NULL);
	return self;
}

PrintersSuppliesView*
printers_supplies_view_new (PrintersPrinter* printer)
{
	return printers_supplies_view_construct (PRINTERS_TYPE_SUPPLIES_VIEW, printer);
}

static const gchar*
printers_supplies_view_get_translated_name (PrintersSuppliesView* self,
                                            const gchar* name)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	static GQuark _tmp1_label2 = 0;
	static GQuark _tmp1_label3 = 0;
	static GQuark _tmp1_label4 = 0;
	static GQuark _tmp1_label5 = 0;
	static GQuark _tmp1_label6 = 0;
	static GQuark _tmp1_label7 = 0;
	static GQuark _tmp1_label8 = 0;
	static GQuark _tmp1_label9 = 0;
	static GQuark _tmp1_label10 = 0;
	static GQuark _tmp1_label11 = 0;
	static GQuark _tmp1_label12 = 0;
	static GQuark _tmp1_label13 = 0;
	static GQuark _tmp1_label14 = 0;
	static GQuark _tmp1_label15 = 0;
	static GQuark _tmp1_label16 = 0;
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = name;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if ((_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("black(PGBK)")))) || (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("Black(PGBK)"))))) {
		switch (0) {
			default:
			{
				result = _ ("Black (PGBK)");
				return result;
			}
		}
	} else if ((_tmp2_ == ((0 != _tmp1_label2) ? _tmp1_label2 : (_tmp1_label2 = g_quark_from_static_string ("black(BK)")))) || (_tmp2_ == ((0 != _tmp1_label3) ? _tmp1_label3 : (_tmp1_label3 = g_quark_from_static_string ("Black(BK)"))))) {
		switch (0) {
			default:
			{
				result = _ ("Black (BK)");
				return result;
			}
		}
	} else if (((_tmp2_ == ((0 != _tmp1_label4) ? _tmp1_label4 : (_tmp1_label4 = g_quark_from_static_string ("black")))) || (_tmp2_ == ((0 != _tmp1_label5) ? _tmp1_label5 : (_tmp1_label5 = g_quark_from_static_string ("black ink"))))) || (_tmp2_ == ((0 != _tmp1_label6) ? _tmp1_label6 : (_tmp1_label6 = g_quark_from_static_string ("Black"))))) {
		switch (0) {
			default:
			{
				result = _ ("Black");
				return result;
			}
		}
	} else if (((_tmp2_ == ((0 != _tmp1_label7) ? _tmp1_label7 : (_tmp1_label7 = g_quark_from_static_string ("yellow")))) || (_tmp2_ == ((0 != _tmp1_label8) ? _tmp1_label8 : (_tmp1_label8 = g_quark_from_static_string ("yellow ink"))))) || (_tmp2_ == ((0 != _tmp1_label9) ? _tmp1_label9 : (_tmp1_label9 = g_quark_from_static_string ("Yellow"))))) {
		switch (0) {
			default:
			{
				result = _ ("Yellow");
				return result;
			}
		}
	} else if (((_tmp2_ == ((0 != _tmp1_label10) ? _tmp1_label10 : (_tmp1_label10 = g_quark_from_static_string ("cyan")))) || (_tmp2_ == ((0 != _tmp1_label11) ? _tmp1_label11 : (_tmp1_label11 = g_quark_from_static_string ("cyan ink"))))) || (_tmp2_ == ((0 != _tmp1_label12) ? _tmp1_label12 : (_tmp1_label12 = g_quark_from_static_string ("Cyan"))))) {
		switch (0) {
			default:
			{
				result = _ ("Cyan");
				return result;
			}
		}
	} else if (((_tmp2_ == ((0 != _tmp1_label13) ? _tmp1_label13 : (_tmp1_label13 = g_quark_from_static_string ("magenta")))) || (_tmp2_ == ((0 != _tmp1_label14) ? _tmp1_label14 : (_tmp1_label14 = g_quark_from_static_string ("magenta ink"))))) || (_tmp2_ == ((0 != _tmp1_label15) ? _tmp1_label15 : (_tmp1_label15 = g_quark_from_static_string ("Magenta"))))) {
		switch (0) {
			default:
			{
				result = _ ("Magenta");
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label16) ? _tmp1_label16 : (_tmp1_label16 = g_quark_from_static_string ("tri-color ink")))) {
		switch (0) {
			default:
			{
				result = _ ("Tri-color");
				return result;
			}
		}
	}
	result = name;
	return result;
}

PrintersPrinter*
printers_supplies_view_get_printer (PrintersSuppliesView* self)
{
	PrintersPrinter* result;
	PrintersPrinter* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_printer;
	result = _tmp0_;
	return result;
}

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

static void
printers_supplies_view_set_printer (PrintersSuppliesView* self,
                                    PrintersPrinter* value)
{
	PrintersPrinter* old_value;
	g_return_if_fail (self != NULL);
	old_value = printers_supplies_view_get_printer (self);
	if (old_value != value) {
		PrintersPrinter* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_printer);
		self->priv->_printer = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, printers_supplies_view_properties[PRINTERS_SUPPLIES_VIEW_PRINTER_PROPERTY]);
	}
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static guint8*
string_get_data (const gchar* self,
                 gint* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res;
	_tmp2__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static GObject *
printers_supplies_view_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	PrintersSuppliesView * self;
	GtkEntry* name_entry = NULL;
	gchar* _tmp0_;
	GtkEntry* _tmp1_ = NULL;
	GraniteHeaderLabel* name_label = NULL;
	GtkEntry* _tmp2_;
	GtkWidget* _tmp3_;
	GraniteHeaderLabel* _tmp4_ = NULL;
	GtkEntry* location_entry = NULL;
	gchar* _tmp5_;
	GtkEntry* _tmp6_ = NULL;
	GraniteHeaderLabel* location_label = NULL;
	GtkEntry* _tmp7_;
	GtkWidget* _tmp8_;
	GraniteHeaderLabel* _tmp9_ = NULL;
	GtkFlowBox* ink_flowbox = NULL;
	GtkFlowBox* _tmp10_ = NULL;
	GraniteHeaderLabel* _tmp11_;
	GtkEntry* _tmp12_;
	GraniteHeaderLabel* _tmp13_;
	GtkEntry* _tmp14_;
	GtkFlowBox* _tmp15_;
	PrintersPrinter* _tmp16_;
	GtkEntry* _tmp17_;
	PrintersPrinter* _tmp18_;
	GtkEntry* _tmp19_;
	GeeArrayList* colors = NULL;
	PrintersPrinter* _tmp20_;
	GeeArrayList* _tmp21_;
	GtkSizeGroup* size_group = NULL;
	GtkSizeGroup* _tmp22_;
	GError* _inner_error0_ = NULL;
	parent_class = G_OBJECT_CLASS (printers_supplies_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PRINTERS_TYPE_SUPPLIES_VIEW, PrintersSuppliesView);
	_tmp0_ = g_strdup (_ ("BrandPrinter X3000"));
	_tmp1_ = (GtkEntry*) gtk_entry_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp1_, TRUE);
	gtk_entry_set_placeholder_text (_tmp1_, _tmp0_);
	_g_free0 (_tmp0_);
	g_object_ref_sink (_tmp1_);
	name_entry = _tmp1_;
	_tmp2_ = name_entry;
	_tmp3_ = _g_object_ref0 ((GtkWidget*) _tmp2_);
	_tmp4_ = granite_header_label_new (_ ("Description"));
	granite_header_label_set_mnemonic_widget (_tmp4_, _tmp3_);
	_g_object_unref0 (_tmp3_);
	g_object_ref_sink (_tmp4_);
	name_label = _tmp4_;
	_tmp5_ = g_strdup (_ ("Lab 1 or John's Desk"));
	_tmp6_ = (GtkEntry*) gtk_entry_new ();
	gtk_entry_set_placeholder_text (_tmp6_, _tmp5_);
	_g_free0 (_tmp5_);
	g_object_ref_sink (_tmp6_);
	location_entry = _tmp6_;
	_tmp7_ = location_entry;
	_tmp8_ = _g_object_ref0 ((GtkWidget*) _tmp7_);
	_tmp9_ = granite_header_label_new (_ ("Location"));
	gtk_widget_set_margin_top ((GtkWidget*) _tmp9_, 9);
	granite_header_label_set_mnemonic_widget (_tmp9_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	g_object_ref_sink (_tmp9_);
	location_label = _tmp9_;
	_tmp10_ = (GtkFlowBox*) gtk_flow_box_new ();
	gtk_flow_box_set_column_spacing (_tmp10_, (guint) 12);
	gtk_flow_box_set_homogeneous (_tmp10_, TRUE);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp10_, 21);
	gtk_flow_box_set_max_children_per_line (_tmp10_, (guint) 30);
	gtk_flow_box_set_row_spacing (_tmp10_, (guint) 24);
	g_object_ref_sink (_tmp10_);
	ink_flowbox = _tmp10_;
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_VERTICAL);
	gtk_box_set_spacing ((GtkBox*) self, 3);
	_tmp11_ = name_label;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp11_);
	_tmp12_ = name_entry;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp12_);
	_tmp13_ = location_label;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp13_);
	_tmp14_ = location_entry;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp14_);
	_tmp15_ = ink_flowbox;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp15_);
	_tmp16_ = self->priv->_printer;
	_tmp17_ = name_entry;
	g_object_bind_property_with_closures ((GObject*) _tmp16_, "info", (GObject*) _tmp17_, "text", 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)));
	_tmp18_ = self->priv->_printer;
	_tmp19_ = location_entry;
	g_object_bind_property_with_closures ((GObject*) _tmp18_, "location", (GObject*) _tmp19_, "text", 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)));
	_tmp20_ = self->priv->_printer;
	_tmp21_ = printers_printer_get_color_levels (_tmp20_);
	colors = _tmp21_;
	_tmp22_ = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
	size_group = _tmp22_;
	{
		GeeArrayList* _color_list = NULL;
		GeeArrayList* _tmp23_;
		gint _color_size = 0;
		GeeArrayList* _tmp24_;
		gint _tmp25_;
		gint _tmp26_;
		gint _color_index = 0;
		_tmp23_ = colors;
		_color_list = _tmp23_;
		_tmp24_ = _color_list;
		_tmp25_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp24_);
		_tmp26_ = _tmp25_;
		_color_size = _tmp26_;
		_color_index = -1;
		while (TRUE) {
			gint _tmp27_;
			gint _tmp28_;
			PrintersPrinterColorLevel* color = NULL;
			GeeArrayList* _tmp29_;
			gpointer _tmp30_;
			gchar** colors_codes = NULL;
			gchar* _tmp31_;
			gchar** _tmp32_;
			gint colors_codes_length1;
			gint _colors_codes_size_;
			PrintersPrinterColorLevel* _tmp33_;
			const gchar* _tmp34_;
			GtkBox* ink_box = NULL;
			GtkBox* _tmp39_;
			const gchar* _tmp70_ = NULL;
			PrintersPrinterColorLevel* _tmp71_;
			const gchar* _tmp72_;
			GtkLabel* label = NULL;
			const gchar* _tmp73_;
			GtkLabel* _tmp74_ = NULL;
			GtkBox* color_box = NULL;
			GtkBox* _tmp75_;
			GtkBox* _tmp76_;
			GtkBox* _tmp77_;
			GtkBox* _tmp78_;
			GtkLabel* _tmp79_;
			GtkSizeGroup* _tmp80_;
			GtkLabel* _tmp81_;
			GtkFlowBox* _tmp82_;
			GtkBox* _tmp83_;
			_color_index = _color_index + 1;
			_tmp27_ = _color_index;
			_tmp28_ = _color_size;
			if (!(_tmp27_ < _tmp28_)) {
				break;
			}
			_tmp29_ = _color_list;
			_tmp30_ = gee_abstract_list_get ((GeeAbstractList*) _tmp29_, _color_index);
			color = (PrintersPrinterColorLevel*) _tmp30_;
			_tmp31_ = g_strdup ("3689E6");
			_tmp32_ = g_new0 (gchar*, 2 + 1);
			_tmp32_[0] = NULL;
			_tmp32_[1] = _tmp31_;
			colors_codes = _tmp32_;
			colors_codes_length1 = 2;
			_colors_codes_size_ = colors_codes_length1;
			_tmp33_ = color;
			_tmp34_ = _tmp33_->color;
			if (string_contains (_tmp34_, "#")) {
				PrintersPrinterColorLevel* _tmp35_;
				const gchar* _tmp36_;
				gchar** _tmp37_;
				gchar** _tmp38_;
				_tmp35_ = color;
				_tmp36_ = _tmp35_->color;
				_tmp38_ = _tmp37_ = g_strsplit (_tmp36_, "#", 0);
				colors_codes = (_vala_array_free (colors_codes, colors_codes_length1, (GDestroyNotify) g_free), NULL);
				colors_codes = _tmp38_;
				colors_codes_length1 = _vala_array_length (_tmp37_);
				_colors_codes_size_ = colors_codes_length1;
			}
			_tmp39_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
			g_object_ref_sink (_tmp39_);
			ink_box = _tmp39_;
			{
				gint i = 0;
				i = 1;
				{
					gboolean _tmp40_ = FALSE;
					_tmp40_ = TRUE;
					while (TRUE) {
						gchar** _tmp42_;
						gint _tmp42__length1;
						gchar* css_color = NULL;
						gchar** _tmp43_;
						gint _tmp43__length1;
						const gchar* _tmp44_;
						gchar** _tmp45_;
						gint _tmp45__length1;
						const gchar* _tmp46_;
						gchar* _tmp47_;
						GtkLevelBar* level = NULL;
						PrintersPrinterColorLevel* _tmp48_;
						PrintersPrinterColorLevel* _tmp49_;
						PrintersPrinterColorLevel* _tmp50_;
						GtkLevelBar* _tmp51_ = NULL;
						GtkLevelBar* _tmp52_;
						gchar** _tmp53_;
						gint _tmp53__length1;
						const gchar* _tmp54_;
						gchar* _tmp55_;
						gchar* _tmp56_;
						GtkCssProvider* provider = NULL;
						GtkCssProvider* _tmp57_;
						GtkBox* _tmp68_;
						GtkLevelBar* _tmp69_;
						if (!_tmp40_) {
							gint _tmp41_;
							_tmp41_ = i;
							i = _tmp41_ + 1;
						}
						_tmp40_ = FALSE;
						_tmp42_ = colors_codes;
						_tmp42__length1 = colors_codes_length1;
						if (!(i < _tmp42__length1)) {
							break;
						}
						_tmp43_ = colors_codes;
						_tmp43__length1 = colors_codes_length1;
						_tmp44_ = _tmp43_[i];
						_tmp45_ = colors_codes;
						_tmp45__length1 = colors_codes_length1;
						_tmp46_ = _tmp45_[i];
						_tmp47_ = g_strdup_printf (PRINTERS_SUPPLIES_VIEW_STYLE_CLASS, _tmp44_, _tmp46_);
						css_color = _tmp47_;
						_tmp48_ = color;
						_tmp49_ = color;
						_tmp50_ = color;
						_tmp51_ = (GtkLevelBar*) gtk_level_bar_new_for_interval ((gdouble) _tmp48_->level_min, (gdouble) _tmp49_->level_max);
						g_object_set ((GtkWidget*) _tmp51_, "height-request", 64, NULL);
						gtk_widget_set_hexpand ((GtkWidget*) _tmp51_, TRUE);
						gtk_widget_set_vexpand ((GtkWidget*) _tmp51_, TRUE);
						gtk_level_bar_set_inverted (_tmp51_, TRUE);
						gtk_orientable_set_orientation ((GtkOrientable*) _tmp51_, GTK_ORIENTATION_VERTICAL);
						gtk_level_bar_set_value (_tmp51_, (gdouble) _tmp50_->level);
						g_object_ref_sink (_tmp51_);
						level = _tmp51_;
						_tmp52_ = level;
						_tmp53_ = colors_codes;
						_tmp53__length1 = colors_codes_length1;
						_tmp54_ = _tmp53_[i];
						_tmp55_ = g_strconcat ("color-", _tmp54_, NULL);
						_tmp56_ = _tmp55_;
						gtk_widget_add_css_class ((GtkWidget*) _tmp52_, _tmp56_);
						_g_free0 (_tmp56_);
						_tmp57_ = gtk_css_provider_new ();
						provider = _tmp57_;
						{
							GtkCssProvider* _tmp58_;
							const gchar* _tmp59_;
							guint8* _tmp60_;
							gint _tmp60__length1;
							gint _tmp61_ = 0;
							guint8* _tmp62_;
							gint _tmp62__length1;
							GdkDisplay* _tmp63_;
							GtkCssProvider* _tmp64_;
							_tmp58_ = provider;
							_tmp59_ = css_color;
							_tmp60_ = string_get_data (_tmp59_, &_tmp61_);
							_tmp60__length1 = _tmp61_;
							_tmp62_ = _tmp60_;
							_tmp62__length1 = _tmp60__length1;
							gtk_css_provider_load_from_data (_tmp58_, (const char*) _tmp62_, (gssize) _tmp62__length1);
							_tmp63_ = gdk_display_get_default ();
							_tmp64_ = provider;
							gtk_style_context_add_provider_for_display (_tmp63_, (GtkStyleProvider*) _tmp64_, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
						}
						goto __finally0;
						__catch0_g_error:
						{
							GError* e = NULL;
							GError* _tmp65_;
							const gchar* _tmp66_;
							const gchar* _tmp67_;
							e = _inner_error0_;
							_inner_error0_ = NULL;
							_tmp65_ = e;
							_tmp66_ = _tmp65_->message;
							_tmp67_ = css_color;
							g_warning ("SuppliesView.vala:90: Could not create CSS Provider: %s\n" \
"Stylesheet:\n" \
"%s", _tmp66_, _tmp67_);
							_g_error_free0 (e);
						}
						__finally0:
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							_g_object_unref0 (provider);
							_g_object_unref0 (level);
							_g_free0 (css_color);
							_g_object_unref0 (ink_box);
							colors_codes = (_vala_array_free (colors_codes, colors_codes_length1, (GDestroyNotify) g_free), NULL);
							_printers_printer_color_level_unref0 (color);
							_g_object_unref0 (size_group);
							_g_object_unref0 (colors);
							_g_object_unref0 (ink_flowbox);
							_g_object_unref0 (location_label);
							_g_object_unref0 (location_entry);
							_g_object_unref0 (name_label);
							_g_object_unref0 (name_entry);
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
						}
						_tmp68_ = ink_box;
						_tmp69_ = level;
						gtk_box_append (_tmp68_, (GtkWidget*) _tmp69_);
						_g_object_unref0 (provider);
						_g_object_unref0 (level);
						_g_free0 (css_color);
					}
				}
			}
			_tmp71_ = color;
			_tmp72_ = _tmp71_->name;
			_tmp70_ = _tmp72_;
			if (_tmp70_ == NULL) {
				_tmp70_ = "black";
			}
			_tmp73_ = printers_supplies_view_get_translated_name (self, _tmp70_);
			_tmp74_ = (GtkLabel*) gtk_label_new (_tmp73_);
			gtk_label_set_justify (_tmp74_, GTK_JUSTIFY_CENTER);
			gtk_label_set_wrap (_tmp74_, TRUE);
			gtk_label_set_max_width_chars (_tmp74_, 10);
			gtk_label_set_yalign (_tmp74_, (gfloat) 0);
			g_object_ref_sink (_tmp74_);
			label = _tmp74_;
			_tmp75_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
			g_object_ref_sink (_tmp75_);
			color_box = _tmp75_;
			_tmp76_ = color_box;
			_tmp77_ = ink_box;
			gtk_box_append (_tmp76_, (GtkWidget*) _tmp77_);
			_tmp78_ = color_box;
			_tmp79_ = label;
			gtk_box_append (_tmp78_, (GtkWidget*) _tmp79_);
			_tmp80_ = size_group;
			_tmp81_ = label;
			gtk_size_group_add_widget (_tmp80_, (GtkWidget*) _tmp81_);
			_tmp82_ = ink_flowbox;
			_tmp83_ = color_box;
			gtk_flow_box_append (_tmp82_, (GtkWidget*) _tmp83_);
			_g_object_unref0 (color_box);
			_g_object_unref0 (label);
			_g_object_unref0 (ink_box);
			colors_codes = (_vala_array_free (colors_codes, colors_codes_length1, (GDestroyNotify) g_free), NULL);
			_printers_printer_color_level_unref0 (color);
		}
	}
	_g_object_unref0 (size_group);
	_g_object_unref0 (colors);
	_g_object_unref0 (ink_flowbox);
	_g_object_unref0 (location_label);
	_g_object_unref0 (location_entry);
	_g_object_unref0 (name_label);
	_g_object_unref0 (name_entry);
	return obj;
}

static void
printers_supplies_view_class_init (PrintersSuppliesViewClass * klass,
                                   gpointer klass_data)
{
	printers_supplies_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PrintersSuppliesView_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_printers_supplies_view_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_printers_supplies_view_set_property;
	G_OBJECT_CLASS (klass)->constructor = printers_supplies_view_constructor;
	G_OBJECT_CLASS (klass)->finalize = printers_supplies_view_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PRINTERS_SUPPLIES_VIEW_PRINTER_PROPERTY, printers_supplies_view_properties[PRINTERS_SUPPLIES_VIEW_PRINTER_PROPERTY] = g_param_spec_object ("printer", "printer", "printer", PRINTERS_TYPE_PRINTER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
printers_supplies_view_instance_init (PrintersSuppliesView * self,
                                      gpointer klass)
{
	self->priv = printers_supplies_view_get_instance_private (self);
}

static void
printers_supplies_view_finalize (GObject * obj)
{
	PrintersSuppliesView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PRINTERS_TYPE_SUPPLIES_VIEW, PrintersSuppliesView);
	_g_object_unref0 (self->priv->_printer);
	G_OBJECT_CLASS (printers_supplies_view_parent_class)->finalize (obj);
}

static GType
printers_supplies_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PrintersSuppliesViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) printers_supplies_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PrintersSuppliesView), 0, (GInstanceInitFunc) printers_supplies_view_instance_init, NULL };
	GType printers_supplies_view_type_id;
	printers_supplies_view_type_id = g_type_register_static (gtk_box_get_type (), "PrintersSuppliesView", &g_define_type_info, 0);
	PrintersSuppliesView_private_offset = g_type_add_instance_private (printers_supplies_view_type_id, sizeof (PrintersSuppliesViewPrivate));
	return printers_supplies_view_type_id;
}

GType
printers_supplies_view_get_type (void)
{
	static volatile gsize printers_supplies_view_type_id__once = 0;
	if (g_once_init_enter (&printers_supplies_view_type_id__once)) {
		GType printers_supplies_view_type_id;
		printers_supplies_view_type_id = printers_supplies_view_get_type_once ();
		g_once_init_leave (&printers_supplies_view_type_id__once, printers_supplies_view_type_id);
	}
	return printers_supplies_view_type_id__once;
}

static void
_vala_printers_supplies_view_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec)
{
	PrintersSuppliesView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PRINTERS_TYPE_SUPPLIES_VIEW, PrintersSuppliesView);
	switch (property_id) {
		case PRINTERS_SUPPLIES_VIEW_PRINTER_PROPERTY:
		g_value_set_object (value, printers_supplies_view_get_printer (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_printers_supplies_view_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec)
{
	PrintersSuppliesView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PRINTERS_TYPE_SUPPLIES_VIEW, PrintersSuppliesView);
	switch (property_id) {
		case PRINTERS_SUPPLIES_VIEW_PRINTER_PROPERTY:
		printers_supplies_view_set_printer (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

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

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

