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

/*-
 * Copyright (c) 2017 elementary LLC. (https://elementary.io)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include <gio/gio.h>
#include <granite-7.h>
#include <glib/gi18n-lib.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_SHORTCUT_LABEL (shortcut_label_get_type ())
#define SHORTCUT_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SHORTCUT_LABEL, ShortcutLabel))
#define SHORTCUT_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SHORTCUT_LABEL, ShortcutLabelClass))
#define IS_SHORTCUT_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SHORTCUT_LABEL))
#define IS_SHORTCUT_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SHORTCUT_LABEL))
#define SHORTCUT_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SHORTCUT_LABEL, ShortcutLabelClass))

typedef struct _ShortcutLabel ShortcutLabel;
typedef struct _ShortcutLabelClass ShortcutLabelClass;
typedef struct _ShortcutLabelPrivate ShortcutLabelPrivate;
enum  {
	SHORTCUT_LABEL_0_PROPERTY,
	SHORTCUT_LABEL_LABEL_PROPERTY,
	SHORTCUT_LABEL_ACCELS_PROPERTY,
	SHORTCUT_LABEL_NUM_PROPERTIES
};
static GParamSpec* shortcut_label_properties[SHORTCUT_LABEL_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ShortcutLabel {
	GtkBox parent_instance;
	ShortcutLabelPrivate * priv;
};

struct _ShortcutLabelClass {
	GtkBoxClass parent_class;
};

struct _ShortcutLabelPrivate {
	gchar* _label;
	gchar** _accels;
	gint _accels_length1;
	gint __accels_size_;
};

static gint ShortcutLabel_private_offset;
static gpointer shortcut_label_parent_class = NULL;
static GtkSizeGroup* shortcut_label_sizegroup;
static GtkSizeGroup* shortcut_label_sizegroup = NULL;
static GtkSizeGroup* shortcut_label_shortcut_sizegroup;
static GtkSizeGroup* shortcut_label_shortcut_sizegroup = NULL;
static GeeArrayList* shortcut_label_settings_list;
static GeeArrayList* shortcut_label_settings_list = NULL;

VALA_EXTERN GType shortcut_label_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ShortcutLabel, g_object_unref)
VALA_EXTERN ShortcutLabel* shortcut_label_new (const gchar* label,
                                   gchar** accels,
                                   gint accels_length1);
VALA_EXTERN ShortcutLabel* shortcut_label_construct (GType object_type,
                                         const gchar* label,
                                         gchar** accels,
                                         gint accels_length1);
VALA_EXTERN ShortcutLabel* shortcut_label_new_from_gsettings (const gchar* label,
                                                  const gchar* schema_id,
                                                  const gchar* key);
VALA_EXTERN ShortcutLabel* shortcut_label_construct_from_gsettings (GType object_type,
                                                        const gchar* label,
                                                        const gchar* schema_id,
                                                        const gchar* key);
static GSettings* shortcut_label_get_settings_for_schema (const gchar* schema_id);
VALA_EXTERN const gchar* shortcut_label_get_label (ShortcutLabel* self);
static void shortcut_label_set_label (ShortcutLabel* self,
                               const gchar* value);
VALA_EXTERN gchar** shortcut_label_get_accels (ShortcutLabel* self,
                                   gint* result_length1);
static void shortcut_label_set_accels (ShortcutLabel* self,
                                gchar** value,
                                gint value_length1);
static gchar** _vala_array_dup1 (gchar** self,
                          gssize length);
static GObject * shortcut_label_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties);
static void shortcut_label_finalize (GObject * obj);
static GType shortcut_label_get_type_once (void);
static void _vala_shortcut_label_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec);
static void _vala_shortcut_label_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
shortcut_label_get_instance_private (ShortcutLabel* self)
{
	return G_STRUCT_MEMBER_P (self, ShortcutLabel_private_offset);
}

ShortcutLabel*
shortcut_label_construct (GType object_type,
                          const gchar* label,
                          gchar** accels,
                          gint accels_length1)
{
	ShortcutLabel * self = NULL;
	g_return_val_if_fail (label != NULL, NULL);
	self = (ShortcutLabel*) g_object_new (object_type, "accels", accels, "label", label, NULL);
	return self;
}

ShortcutLabel*
shortcut_label_new (const gchar* label,
                    gchar** accels,
                    gint accels_length1)
{
	return shortcut_label_construct (TYPE_SHORTCUT_LABEL, label, accels, accels_length1);
}

ShortcutLabel*
shortcut_label_construct_from_gsettings (GType object_type,
                                         const gchar* label,
                                         const gchar* schema_id,
                                         const gchar* key)
{
	ShortcutLabel * self = NULL;
	GSettings* settings = NULL;
	GSettings* _tmp0_;
	GVariant* key_value = NULL;
	GSettings* _tmp1_;
	GVariant* _tmp2_;
	gchar** accels = NULL;
	gchar* _tmp3_;
	gchar** _tmp4_;
	gint accels_length1;
	gint _accels_size_;
	GVariant* _tmp5_;
	const GVariantType* _tmp6_;
	gchar** _tmp27_;
	gint _tmp27__length1;
	g_return_val_if_fail (label != NULL, NULL);
	g_return_val_if_fail (schema_id != NULL, NULL);
	g_return_val_if_fail (key != NULL, NULL);
	_tmp0_ = shortcut_label_get_settings_for_schema (schema_id);
	settings = _tmp0_;
	_tmp1_ = settings;
	_tmp2_ = g_settings_get_value (_tmp1_, key);
	key_value = _tmp2_;
	_tmp3_ = g_strdup ("");
	_tmp4_ = g_new0 (gchar*, 1 + 1);
	_tmp4_[0] = _tmp3_;
	accels = _tmp4_;
	accels_length1 = 1;
	_accels_size_ = accels_length1;
	_tmp5_ = key_value;
	_tmp6_ = G_VARIANT_TYPE_ARRAY;
	if (g_variant_is_of_type (_tmp5_, _tmp6_)) {
		const gchar** key_value_strv = NULL;
		GVariant* _tmp7_;
		gsize _tmp8_ = 0;
		const gchar** _tmp9_;
		gint key_value_strv_length1;
		gint _key_value_strv_size_;
		gboolean _tmp10_ = FALSE;
		const gchar** _tmp11_;
		gint _tmp11__length1;
		_tmp7_ = key_value;
		_tmp9_ = g_variant_get_strv (_tmp7_, &_tmp8_);
		key_value_strv = _tmp9_;
		key_value_strv_length1 = _tmp8_;
		_key_value_strv_size_ = key_value_strv_length1;
		_tmp11_ = key_value_strv;
		_tmp11__length1 = key_value_strv_length1;
		if (_tmp11__length1 > 0) {
			const gchar** _tmp12_;
			gint _tmp12__length1;
			const gchar* _tmp13_;
			_tmp12_ = key_value_strv;
			_tmp12__length1 = key_value_strv_length1;
			_tmp13_ = _tmp12_[0];
			_tmp10_ = g_strcmp0 (_tmp13_, "") != 0;
		} else {
			_tmp10_ = FALSE;
		}
		if (_tmp10_) {
			const gchar** _tmp14_;
			gint _tmp14__length1;
			const gchar* _tmp15_;
			gchar* _tmp16_;
			gchar* _tmp17_;
			gchar** _tmp18_;
			gchar** _tmp19_;
			_tmp14_ = key_value_strv;
			_tmp14__length1 = key_value_strv_length1;
			_tmp15_ = _tmp14_[0];
			_tmp16_ = granite_accel_to_string (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp19_ = _tmp18_ = g_strsplit (_tmp17_, " + ", 0);
			accels = (_vala_array_free (accels, accels_length1, (GDestroyNotify) g_free), NULL);
			accels = _tmp19_;
			accels_length1 = _vala_array_length (_tmp18_);
			_accels_size_ = accels_length1;
			_g_free0 (_tmp17_);
		}
		key_value_strv = (g_free (key_value_strv), NULL);
	} else {
		GVariant* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		gchar* _tmp23_;
		gchar* _tmp24_;
		gchar** _tmp25_;
		gchar** _tmp26_;
		_tmp20_ = key_value;
		_tmp21_ = g_variant_dup_string (_tmp20_, NULL);
		_tmp22_ = _tmp21_;
		_tmp23_ = granite_accel_to_string (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp26_ = _tmp25_ = g_strsplit (_tmp24_, " + ", 0);
		accels = (_vala_array_free (accels, accels_length1, (GDestroyNotify) g_free), NULL);
		accels = _tmp26_;
		accels_length1 = _vala_array_length (_tmp25_);
		_accels_size_ = accels_length1;
		_g_free0 (_tmp24_);
		_g_free0 (_tmp22_);
	}
	_tmp27_ = accels;
	_tmp27__length1 = accels_length1;
	self = (ShortcutLabel*) g_object_new (object_type, "accels", _tmp27_, "label", label, NULL);
	accels = (_vala_array_free (accels, accels_length1, (GDestroyNotify) g_free), NULL);
	_g_variant_unref0 (key_value);
	_g_object_unref0 (settings);
	return self;
}

ShortcutLabel*
shortcut_label_new_from_gsettings (const gchar* label,
                                   const gchar* schema_id,
                                   const gchar* key)
{
	return shortcut_label_construct_from_gsettings (TYPE_SHORTCUT_LABEL, label, schema_id, key);
}

static GSettings*
shortcut_label_get_settings_for_schema (const gchar* schema_id)
{
	GeeArrayList* _tmp0_;
	GSettings* settings = NULL;
	GSettings* _tmp18_;
	GeeArrayList* _tmp19_;
	GSettings* _tmp20_;
	GSettings* result;
	g_return_val_if_fail (schema_id != NULL, NULL);
	_tmp0_ = shortcut_label_settings_list;
	if (_tmp0_ == NULL) {
		GeeArrayList* _tmp1_;
		_tmp1_ = gee_array_list_new (g_settings_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
		_g_object_unref0 (shortcut_label_settings_list);
		shortcut_label_settings_list = _tmp1_;
	} else {
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		_tmp2_ = shortcut_label_settings_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		if (_tmp4_ > 0) {
			{
				GeeArrayList* _settings_list = NULL;
				GeeArrayList* _tmp5_;
				gint _settings_size = 0;
				GeeArrayList* _tmp6_;
				gint _tmp7_;
				gint _tmp8_;
				gint _settings_index = 0;
				_tmp5_ = shortcut_label_settings_list;
				_settings_list = _tmp5_;
				_tmp6_ = _settings_list;
				_tmp7_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp6_);
				_tmp8_ = _tmp7_;
				_settings_size = _tmp8_;
				_settings_index = -1;
				while (TRUE) {
					gint _tmp9_;
					gint _tmp10_;
					GSettings* settings = NULL;
					GeeArrayList* _tmp11_;
					gpointer _tmp12_;
					GSettings* _tmp13_;
					gchar* _tmp14_;
					gchar* _tmp15_;
					gchar* _tmp16_;
					gboolean _tmp17_;
					_settings_index = _settings_index + 1;
					_tmp9_ = _settings_index;
					_tmp10_ = _settings_size;
					if (!(_tmp9_ < _tmp10_)) {
						break;
					}
					_tmp11_ = _settings_list;
					_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _tmp11_, _settings_index);
					settings = (GSettings*) _tmp12_;
					_tmp13_ = settings;
					g_object_get (_tmp13_, "schema-id", &_tmp14_, NULL);
					_tmp15_ = _tmp14_;
					_tmp16_ = _tmp15_;
					_tmp17_ = g_strcmp0 (_tmp16_, schema_id) == 0;
					_g_free0 (_tmp16_);
					if (_tmp17_) {
						result = settings;
						return result;
					}
					_g_object_unref0 (settings);
				}
			}
		}
	}
	_tmp18_ = g_settings_new (schema_id);
	settings = _tmp18_;
	_tmp19_ = shortcut_label_settings_list;
	_tmp20_ = settings;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp19_, _tmp20_);
	result = settings;
	return result;
}

const gchar*
shortcut_label_get_label (ShortcutLabel* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_label;
	result = _tmp0_;
	return result;
}

static void
shortcut_label_set_label (ShortcutLabel* self,
                          const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = shortcut_label_get_label (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_label);
		self->priv->_label = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, shortcut_label_properties[SHORTCUT_LABEL_LABEL_PROPERTY]);
	}
}

gchar**
shortcut_label_get_accels (ShortcutLabel* self,
                           gint* result_length1)
{
	gchar** result;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_accels;
	_tmp0__length1 = self->priv->_accels_length1;
	_tmp1_ = _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

static gchar**
_vala_array_dup1 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static void
shortcut_label_set_accels (ShortcutLabel* self,
                           gchar** value,
                           gint value_length1)
{
	gchar** old_value;
	gint old_value_length;
	g_return_if_fail (self != NULL);
	old_value = shortcut_label_get_accels (self, &old_value_length);
	if (old_value != value) {
		gchar** _tmp0_;
		gint _tmp0__length1;
		_tmp0_ = (value != NULL) ? _vala_array_dup1 (value, value_length1) : value;
		_tmp0__length1 = value_length1;
		self->priv->_accels = (_vala_array_free (self->priv->_accels, self->priv->_accels_length1, (GDestroyNotify) g_free), NULL);
		self->priv->_accels = _tmp0_;
		self->priv->_accels_length1 = _tmp0__length1;
		self->priv->__accels_size_ = self->priv->_accels_length1;
		g_object_notify_by_pspec ((GObject *) self, shortcut_label_properties[SHORTCUT_LABEL_ACCELS_PROPERTY]);
	}
}

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

static GObject *
shortcut_label_constructor (GType type,
                            guint n_construct_properties,
                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ShortcutLabel * self;
	GtkBox* accel_box = NULL;
	GtkBox* _tmp0_;
	GtkLabel* label_widget = NULL;
	const gchar* _tmp1_;
	GtkBox* _tmp2_;
	GtkWidget* _tmp3_;
	GtkLabel* _tmp4_ = NULL;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gint _tmp6_ = 0;
	gchar** _tmp7_;
	gint _tmp7__length1;
	const gchar* _tmp8_;
	GtkLabel* _tmp22_;
	GtkBox* _tmp23_;
	GtkSizeGroup* _tmp24_;
	GtkSizeGroup* _tmp25_;
	GtkBox* _tmp26_;
	parent_class = G_OBJECT_CLASS (shortcut_label_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SHORTCUT_LABEL, ShortcutLabel);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp0_);
	accel_box = _tmp0_;
	_tmp1_ = self->priv->_label;
	_tmp2_ = accel_box;
	_tmp3_ = _g_object_ref0 ((GtkWidget*) _tmp2_);
	_tmp4_ = (GtkLabel*) gtk_label_new (_tmp1_);
	gtk_widget_set_halign ((GtkWidget*) _tmp4_, GTK_ALIGN_START);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp4_, TRUE);
	gtk_label_set_mnemonic_widget (_tmp4_, _tmp3_);
	_g_object_unref0 (_tmp3_);
	g_object_ref_sink (_tmp4_);
	label_widget = _tmp4_;
	_tmp5_ = shortcut_label_get_accels (self, &_tmp6_);
	_tmp5__length1 = _tmp6_;
	_tmp7_ = _tmp5_;
	_tmp7__length1 = _tmp5__length1;
	_tmp8_ = _tmp7_[0];
	if (g_strcmp0 (_tmp8_, "") != 0) {
		gchar** _tmp9_;
		gint _tmp9__length1;
		gint _tmp10_ = 0;
		gchar** _tmp11_;
		gint _tmp11__length1;
		_tmp9_ = shortcut_label_get_accels (self, &_tmp10_);
		_tmp9__length1 = _tmp10_;
		_tmp11_ = _tmp9_;
		_tmp11__length1 = _tmp9__length1;
		{
			gchar** accel_collection = NULL;
			gint accel_collection_length1 = 0;
			gint _accel_collection_size_ = 0;
			gint accel_it = 0;
			accel_collection = _tmp11_;
			accel_collection_length1 = _tmp11__length1;
			for (accel_it = 0; accel_it < accel_collection_length1; accel_it = accel_it + 1) {
				const gchar* accel = NULL;
				accel = accel_collection[accel_it];
				{
					const gchar* _tmp12_;
					GtkLabel* label = NULL;
					const gchar* _tmp13_;
					GtkLabel* _tmp14_;
					GtkLabel* _tmp15_;
					GtkBox* _tmp16_;
					GtkLabel* _tmp17_;
					_tmp12_ = accel;
					if (g_strcmp0 (_tmp12_, "") == 0) {
						continue;
					}
					_tmp13_ = accel;
					_tmp14_ = (GtkLabel*) gtk_label_new (_tmp13_);
					g_object_ref_sink (_tmp14_);
					label = _tmp14_;
					_tmp15_ = label;
					gtk_widget_add_css_class ((GtkWidget*) _tmp15_, "keycap");
					_tmp16_ = accel_box;
					_tmp17_ = label;
					gtk_box_append (_tmp16_, (GtkWidget*) _tmp17_);
					_g_object_unref0 (label);
				}
			}
		}
	} else {
		GtkLabel* disabled_label = NULL;
		GtkLabel* _tmp18_;
		GtkLabel* _tmp19_;
		GtkBox* _tmp20_;
		GtkLabel* _tmp21_;
		_tmp18_ = (GtkLabel*) gtk_label_new (_ ("Disabled"));
		g_object_ref_sink (_tmp18_);
		disabled_label = _tmp18_;
		_tmp19_ = disabled_label;
		gtk_widget_add_css_class ((GtkWidget*) _tmp19_, GRANITE_STYLE_CLASS_DIM_LABEL);
		_tmp20_ = accel_box;
		_tmp21_ = disabled_label;
		gtk_box_append (_tmp20_, (GtkWidget*) _tmp21_);
		_g_object_unref0 (disabled_label);
	}
	gtk_box_set_spacing ((GtkBox*) self, 12);
	_tmp22_ = label_widget;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp22_);
	_tmp23_ = accel_box;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp23_);
	_tmp24_ = shortcut_label_sizegroup;
	gtk_size_group_add_widget (_tmp24_, (GtkWidget*) self);
	_tmp25_ = shortcut_label_shortcut_sizegroup;
	_tmp26_ = accel_box;
	gtk_size_group_add_widget (_tmp25_, (GtkWidget*) _tmp26_);
	_g_object_unref0 (label_widget);
	_g_object_unref0 (accel_box);
	return obj;
}

static void
shortcut_label_class_init (ShortcutLabelClass * klass,
                           gpointer klass_data)
{
	GtkSizeGroup* _tmp0_;
	GtkSizeGroup* _tmp1_;
	shortcut_label_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ShortcutLabel_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_shortcut_label_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_shortcut_label_set_property;
	G_OBJECT_CLASS (klass)->constructor = shortcut_label_constructor;
	G_OBJECT_CLASS (klass)->finalize = shortcut_label_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SHORTCUT_LABEL_LABEL_PROPERTY, shortcut_label_properties[SHORTCUT_LABEL_LABEL_PROPERTY] = g_param_spec_string ("label", "label", "label", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SHORTCUT_LABEL_ACCELS_PROPERTY, shortcut_label_properties[SHORTCUT_LABEL_ACCELS_PROPERTY] = g_param_spec_boxed ("accels", "accels", "accels", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	_tmp0_ = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
	_g_object_unref0 (shortcut_label_sizegroup);
	shortcut_label_sizegroup = _tmp0_;
	_tmp1_ = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
	_g_object_unref0 (shortcut_label_shortcut_sizegroup);
	shortcut_label_shortcut_sizegroup = _tmp1_;
}

static void
shortcut_label_instance_init (ShortcutLabel * self,
                              gpointer klass)
{
	self->priv = shortcut_label_get_instance_private (self);
}

static void
shortcut_label_finalize (GObject * obj)
{
	ShortcutLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SHORTCUT_LABEL, ShortcutLabel);
	_g_free0 (self->priv->_label);
	self->priv->_accels = (_vala_array_free (self->priv->_accels, self->priv->_accels_length1, (GDestroyNotify) g_free), NULL);
	G_OBJECT_CLASS (shortcut_label_parent_class)->finalize (obj);
}

static GType
shortcut_label_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ShortcutLabelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) shortcut_label_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ShortcutLabel), 0, (GInstanceInitFunc) shortcut_label_instance_init, NULL };
	GType shortcut_label_type_id;
	shortcut_label_type_id = g_type_register_static (gtk_box_get_type (), "ShortcutLabel", &g_define_type_info, 0);
	ShortcutLabel_private_offset = g_type_add_instance_private (shortcut_label_type_id, sizeof (ShortcutLabelPrivate));
	return shortcut_label_type_id;
}

GType
shortcut_label_get_type (void)
{
	static volatile gsize shortcut_label_type_id__once = 0;
	if (g_once_init_enter (&shortcut_label_type_id__once)) {
		GType shortcut_label_type_id;
		shortcut_label_type_id = shortcut_label_get_type_once ();
		g_once_init_leave (&shortcut_label_type_id__once, shortcut_label_type_id);
	}
	return shortcut_label_type_id__once;
}

static void
_vala_shortcut_label_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec)
{
	ShortcutLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_SHORTCUT_LABEL, ShortcutLabel);
	switch (property_id) {
		case SHORTCUT_LABEL_LABEL_PROPERTY:
		g_value_set_string (value, shortcut_label_get_label (self));
		break;
		case SHORTCUT_LABEL_ACCELS_PROPERTY:
		{
			int length;
			g_value_set_boxed (value, shortcut_label_get_accels (self, &length));
		}
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_shortcut_label_set_property (GObject * object,
                                   guint property_id,
                                   const GValue * value,
                                   GParamSpec * pspec)
{
	ShortcutLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_SHORTCUT_LABEL, ShortcutLabel);
	switch (property_id) {
		case SHORTCUT_LABEL_LABEL_PROPERTY:
		shortcut_label_set_label (self, g_value_get_string (value));
		break;
		case SHORTCUT_LABEL_ACCELS_PROPERTY:
		{
			gpointer boxed;
			boxed = g_value_get_boxed (value);
			shortcut_label_set_accels (self, boxed, (boxed == NULL) ? 0 : g_strv_length (boxed));
		}
		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;
}

