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

/*
 * SPDX-License-Identifier: GPL-2.0-or-later
 * SPDX-FileCopyrightText: 2017-2025 elementary, Inc. (https://elementary.io)
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "keyboard.h"
#include <glib/gi18n-lib.h>
#include <granite-7.h>
#include <gio/gdesktopappinfo.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

#define KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_LIST_BOX (keyboard_shortcuts_custom_shortcut_list_box_get_type ())
#define KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUT_LIST_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_LIST_BOX, KeyboardShortcutsCustomShortcutListBox))
#define KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUT_LIST_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_LIST_BOX, KeyboardShortcutsCustomShortcutListBoxClass))
#define KEYBOARD_SHORTCUTS_IS_CUSTOM_SHORTCUT_LIST_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_LIST_BOX))
#define KEYBOARD_SHORTCUTS_IS_CUSTOM_SHORTCUT_LIST_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_LIST_BOX))
#define KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUT_LIST_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_LIST_BOX, KeyboardShortcutsCustomShortcutListBoxClass))

typedef struct _KeyboardShortcutsCustomShortcutListBox KeyboardShortcutsCustomShortcutListBox;
typedef struct _KeyboardShortcutsCustomShortcutListBoxClass KeyboardShortcutsCustomShortcutListBoxClass;
typedef struct _KeyboardShortcutsCustomShortcutListBoxPrivate KeyboardShortcutsCustomShortcutListBoxPrivate;
enum  {
	KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUT_LIST_BOX_0_PROPERTY,
	KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUT_LIST_BOX_NUM_PROPERTIES
};
static GParamSpec* keyboard_shortcuts_custom_shortcut_list_box_properties[KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUT_LIST_BOX_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

#define KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_ROW (keyboard_shortcuts_custom_shortcut_row_get_type ())
#define KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUT_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_ROW, KeyboardShortcutsCustomShortcutRow))
#define KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_ROW, KeyboardShortcutsCustomShortcutRowClass))
#define KEYBOARD_SHORTCUTS_IS_CUSTOM_SHORTCUT_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_ROW))
#define KEYBOARD_SHORTCUTS_IS_CUSTOM_SHORTCUT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_ROW))
#define KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUT_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_ROW, KeyboardShortcutsCustomShortcutRowClass))

typedef struct _KeyboardShortcutsCustomShortcutRow KeyboardShortcutsCustomShortcutRow;
typedef struct _KeyboardShortcutsCustomShortcutRowClass KeyboardShortcutsCustomShortcutRowClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))

struct _KeyboardShortcutsCustomShortcutListBox {
	GtkBox parent_instance;
	KeyboardShortcutsCustomShortcutListBoxPrivate * priv;
};

struct _KeyboardShortcutsCustomShortcutListBoxClass {
	GtkBoxClass parent_class;
};

struct _KeyboardShortcutsCustomShortcutListBoxPrivate {
	GSettings* settings;
	gchar** preferred_languages;
	gint preferred_languages_length1;
	gint _preferred_languages_size_;
	gulong settings_load_id;
	GtkListBox* list_box;
	KeyboardShortcutsAppChooser* app_chooser;
};

static gint KeyboardShortcutsCustomShortcutListBox_private_offset;
static gpointer keyboard_shortcuts_custom_shortcut_list_box_parent_class = NULL;

VALA_EXTERN GType keyboard_shortcuts_custom_shortcut_list_box_get_type (void) G_GNUC_CONST ;
static void keyboard_shortcuts_custom_shortcut_list_box_load_and_display_custom_shortcuts (KeyboardShortcutsCustomShortcutListBox* self);
static KeyboardShortcutsCustomShortcutsParsedShortcut* _variant_get2 (GVariant* value,
                                                               gint* result_length1);
VALA_EXTERN GType keyboard_shortcuts_custom_shortcut_row_get_type (void) G_GNUC_CONST ;
VALA_EXTERN KeyboardShortcutsCustomShortcutRow* keyboard_shortcuts_custom_shortcut_row_new (KeyboardShortcutsCustomShortcutsParsedShortcut* shortcut);
VALA_EXTERN KeyboardShortcutsCustomShortcutRow* keyboard_shortcuts_custom_shortcut_row_construct (GType object_type,
                                                                                      KeyboardShortcutsCustomShortcutsParsedShortcut* shortcut);
static void keyboard_shortcuts_custom_shortcut_list_box_sync_shortcuts (KeyboardShortcutsCustomShortcutListBox* self);
static void _keyboard_shortcuts_custom_shortcut_list_box_sync_shortcuts_keyboard_shortcuts_custom_shortcut_row_shortcut_changed (KeyboardShortcutsCustomShortcutRow* _sender,
                                                                                                                          gpointer self);
static void _vala_KeyboardShortcutsCustomShortcutsParsedShortcut_array_free (KeyboardShortcutsCustomShortcutsParsedShortcut * array,
                                                                      gssize array_length);
static void keyboard_shortcuts_custom_shortcut_list_box_add_new_shortcut (KeyboardShortcutsCustomShortcutListBox* self,
                                                                   KeyboardShortcutsCustomShortcutsActionType type,
                                                                   const gchar* target,
                                                                   GHashTable* parameters);
static KeyboardShortcutsCustomShortcutsParsedShortcut* _variant_get3 (GVariant* value,
                                                               gint* result_length1);
static void _vala_array_add16 (KeyboardShortcutsCustomShortcutsParsedShortcut* * array,
                        gint* length,
                        gint* size,
                        const KeyboardShortcutsCustomShortcutsParsedShortcut* value);
static GVariant* _variant_new2 (KeyboardShortcutsCustomShortcutsParsedShortcut* value,
                         gint value_length1);
VALA_EXTERN KeyboardShortcutsCustomShortcutsParsedShortcut* keyboard_shortcuts_custom_shortcut_row_get_shortcut (KeyboardShortcutsCustomShortcutRow* self);
static void _vala_array_add17 (KeyboardShortcutsCustomShortcutsParsedShortcut* * array,
                        gint* length,
                        gint* size,
                        const KeyboardShortcutsCustomShortcutsParsedShortcut* value);
static GVariant* _variant_new3 (KeyboardShortcutsCustomShortcutsParsedShortcut* value,
                         gint value_length1);
VALA_EXTERN KeyboardShortcutsCustomShortcutListBox* keyboard_shortcuts_custom_shortcut_list_box_new (void);
VALA_EXTERN KeyboardShortcutsCustomShortcutListBox* keyboard_shortcuts_custom_shortcut_list_box_construct (GType object_type);
static GObject * keyboard_shortcuts_custom_shortcut_list_box_constructor (GType type,
                                                                   guint n_construct_properties,
                                                                   GObjectConstructParam * construct_properties);
static gchar** _vala_array_dup7 (gchar** self,
                          gssize length);
static void _keyboard_shortcuts_custom_shortcut_list_box_load_and_display_custom_shortcuts_g_settings_changed (GSettings* _sender,
                                                                                                        const gchar* key,
                                                                                                        gpointer self);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static void _keyboard_shortcuts_custom_shortcut_list_box___lambda74_ (KeyboardShortcutsCustomShortcutListBox* self);
static void __keyboard_shortcuts_custom_shortcut_list_box___lambda74__gtk_button_clicked (GtkButton* _sender,
                                                                                   gpointer self);
static void _keyboard_shortcuts_custom_shortcut_list_box___lambda75_ (KeyboardShortcutsCustomShortcutListBox* self,
                                                               const gchar* filename,
                                                               GHashTable* parameters);
static void __keyboard_shortcuts_custom_shortcut_list_box___lambda75__keyboard_shortcuts_app_chooser_app_chosen (KeyboardShortcutsAppChooser* _sender,
                                                                                                          const gchar* filename,
                                                                                                          GHashTable* parameters,
                                                                                                          gpointer self);
static void _keyboard_shortcuts_custom_shortcut_list_box___lambda76_ (KeyboardShortcutsCustomShortcutListBox* self,
                                                               const gchar* command,
                                                               GHashTable* parameters);
static void __keyboard_shortcuts_custom_shortcut_list_box___lambda76__keyboard_shortcuts_app_chooser_custom_command_chosen (KeyboardShortcutsAppChooser* _sender,
                                                                                                                     const gchar* command,
                                                                                                                     GHashTable* parameters,
                                                                                                                     gpointer self);
static void keyboard_shortcuts_custom_shortcut_list_box_finalize (GObject * obj);
static GType keyboard_shortcuts_custom_shortcut_list_box_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static inline gpointer
keyboard_shortcuts_custom_shortcut_list_box_get_instance_private (KeyboardShortcutsCustomShortcutListBox* self)
{
	return G_STRUCT_MEMBER_P (self, KeyboardShortcutsCustomShortcutListBox_private_offset);
}

static KeyboardShortcutsCustomShortcutsParsedShortcut*
_variant_get2 (GVariant* value,
               gint* result_length1)
{
	KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp0_;
	gint _tmp0__length;
	gint _tmp0__size;
	gint _tmp0__length1;
	GVariantIter _tmp1_;
	GVariant* _tmp2_;
	_tmp0_ = g_new (KeyboardShortcutsCustomShortcutsParsedShortcut, 5);
	_tmp0__length = 0;
	_tmp0__size = 4;
	_tmp0__length1 = 0;
	g_variant_iter_init (&_tmp1_, value);
	for (; (_tmp2_ = g_variant_iter_next_value (&_tmp1_)) != NULL; _tmp0__length1++) {
		KeyboardShortcutsCustomShortcutsParsedShortcut _tmp3_;
		GVariantIter _tmp4_;
		GVariant* _tmp5_;
		GVariant* _tmp6_;
		GVariant* _tmp7_;
		GHashTable* _tmp8_;
		GVariantIter _tmp9_;
		GVariant* _tmp10_;
		GVariant* _tmp11_;
		GVariant* _tmp12_;
		gchar** _tmp13_;
		gint _tmp13__length;
		gint _tmp13__size;
		gint _tmp13__length1;
		GVariantIter _tmp14_;
		GVariant* _tmp15_;
		if (_tmp0__size == _tmp0__length) {
			_tmp0__size = 2 * _tmp0__size;
			_tmp0_ = g_renew (KeyboardShortcutsCustomShortcutsParsedShortcut, _tmp0_, _tmp0__size + 1);
		}
		g_variant_iter_init (&_tmp4_, _tmp2_);
		_tmp5_ = g_variant_iter_next_value (&_tmp4_);
		_tmp3_.type = g_variant_get_int32 (_tmp5_);
		g_variant_unref (_tmp5_);
		_tmp6_ = g_variant_iter_next_value (&_tmp4_);
		_tmp3_.target = g_variant_dup_string (_tmp6_, NULL);
		g_variant_unref (_tmp6_);
		_tmp7_ = g_variant_iter_next_value (&_tmp4_);
		_tmp8_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref);
		g_variant_iter_init (&_tmp9_, _tmp7_);
		while (g_variant_iter_loop (&_tmp9_, "{?*}", &_tmp10_, &_tmp11_)) {
			g_hash_table_insert (_tmp8_, g_variant_dup_string (_tmp10_, NULL), g_variant_get_variant (_tmp11_));
		}
		_tmp3_.parameters = _tmp8_;
		g_variant_unref (_tmp7_);
		_tmp12_ = g_variant_iter_next_value (&_tmp4_);
		_tmp13_ = g_new (gchar*, 5);
		_tmp13__length = 0;
		_tmp13__size = 4;
		_tmp13__length1 = 0;
		g_variant_iter_init (&_tmp14_, _tmp12_);
		for (; (_tmp15_ = g_variant_iter_next_value (&_tmp14_)) != NULL; _tmp13__length1++) {
			if (_tmp13__size == _tmp13__length) {
				_tmp13__size = 2 * _tmp13__size;
				_tmp13_ = g_renew (gchar*, _tmp13_, _tmp13__size + 1);
			}
			_tmp13_[_tmp13__length++] = g_variant_dup_string (_tmp15_, NULL);
			g_variant_unref (_tmp15_);
		}
		_tmp3_.keybindings_length1 = _tmp13__length1;
		_tmp13_[_tmp13__length] = NULL;
		_tmp3_.keybindings = _tmp13_;
		g_variant_unref (_tmp12_);
		_tmp0_[_tmp0__length++] = _tmp3_;
		g_variant_unref (_tmp2_);
	}
	*result_length1 = _tmp0__length1;
	return _tmp0_;
}

static void
_keyboard_shortcuts_custom_shortcut_list_box_sync_shortcuts_keyboard_shortcuts_custom_shortcut_row_shortcut_changed (KeyboardShortcutsCustomShortcutRow* _sender,
                                                                                                                     gpointer self)
{
	keyboard_shortcuts_custom_shortcut_list_box_sync_shortcuts ((KeyboardShortcutsCustomShortcutListBox*) self);
}

static void
_vala_KeyboardShortcutsCustomShortcutsParsedShortcut_array_free (KeyboardShortcutsCustomShortcutsParsedShortcut * array,
                                                                 gssize array_length)
{
	if (array != NULL) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			keyboard_shortcuts_custom_shortcuts_parsed_shortcut_destroy (&array[i]);
		}
	}
	g_free (array);
}

static void
keyboard_shortcuts_custom_shortcut_list_box_load_and_display_custom_shortcuts (KeyboardShortcutsCustomShortcutListBox* self)
{
	KeyboardShortcutsCustomShortcutsParsedShortcut* shortcuts = NULL;
	GSettings* _tmp5_;
	GVariant* _tmp6_;
	GVariant* _tmp7_;
	KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp8_ = NULL;
	gint _tmp8__length1 = 0;
	KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp9_;
	gint _tmp9__length1;
	gint shortcuts_length1;
	gint _shortcuts_size_;
	g_return_if_fail (self != NULL);
	while (TRUE) {
		GtkListBox* _tmp0_;
		GtkListBoxRow* _tmp1_;
		GtkListBox* _tmp2_;
		GtkListBox* _tmp3_;
		GtkListBoxRow* _tmp4_;
		_tmp0_ = self->priv->list_box;
		_tmp1_ = gtk_list_box_get_row_at_index (_tmp0_, 0);
		if (!(_tmp1_ != NULL)) {
			break;
		}
		_tmp2_ = self->priv->list_box;
		_tmp3_ = self->priv->list_box;
		_tmp4_ = gtk_list_box_get_row_at_index (_tmp3_, 0);
		gtk_list_box_remove (_tmp2_, (GtkWidget*) _tmp4_);
	}
	_tmp5_ = self->priv->settings;
	_tmp6_ = g_settings_get_value (_tmp5_, KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUTS_APPLICATION_SHORTCUTS);
	_tmp7_ = _tmp6_;
	_tmp8_ = _variant_get2 (_tmp7_, &_tmp8__length1);
	_tmp9_ = _tmp8_;
	_tmp9__length1 = _tmp8__length1;
	_g_variant_unref0 (_tmp7_);
	shortcuts = _tmp9_;
	shortcuts_length1 = _tmp9__length1;
	_shortcuts_size_ = shortcuts_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp10_ = FALSE;
			_tmp10_ = TRUE;
			while (TRUE) {
				KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp12_;
				gint _tmp12__length1;
				KeyboardShortcutsCustomShortcutRow* row = NULL;
				KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp13_;
				gint _tmp13__length1;
				KeyboardShortcutsCustomShortcutsParsedShortcut _tmp14_;
				KeyboardShortcutsCustomShortcutRow* _tmp15_;
				KeyboardShortcutsCustomShortcutRow* _tmp16_;
				GtkListBox* _tmp17_;
				KeyboardShortcutsCustomShortcutRow* _tmp18_;
				if (!_tmp10_) {
					gint _tmp11_;
					_tmp11_ = i;
					i = _tmp11_ + 1;
				}
				_tmp10_ = FALSE;
				_tmp12_ = shortcuts;
				_tmp12__length1 = shortcuts_length1;
				if (!(i < _tmp12__length1)) {
					break;
				}
				_tmp13_ = shortcuts;
				_tmp13__length1 = shortcuts_length1;
				_tmp14_ = _tmp13_[i];
				_tmp15_ = keyboard_shortcuts_custom_shortcut_row_new (&_tmp14_);
				g_object_ref_sink (_tmp15_);
				row = _tmp15_;
				_tmp16_ = row;
				g_signal_connect_object (_tmp16_, "shortcut-changed", (GCallback) _keyboard_shortcuts_custom_shortcut_list_box_sync_shortcuts_keyboard_shortcuts_custom_shortcut_row_shortcut_changed, self, 0);
				_tmp17_ = self->priv->list_box;
				_tmp18_ = row;
				gtk_list_box_append (_tmp17_, (GtkWidget*) _tmp18_);
				_g_object_unref0 (row);
			}
		}
	}
	shortcuts = (_vala_KeyboardShortcutsCustomShortcutsParsedShortcut_array_free (shortcuts, shortcuts_length1), NULL);
}

static gpointer
_g_hash_table_ref0 (gpointer self)
{
	return self ? g_hash_table_ref (self) : NULL;
}

static KeyboardShortcutsCustomShortcutsParsedShortcut*
_variant_get3 (GVariant* value,
               gint* result_length1)
{
	KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp0_;
	gint _tmp0__length;
	gint _tmp0__size;
	gint _tmp0__length1;
	GVariantIter _tmp1_;
	GVariant* _tmp2_;
	_tmp0_ = g_new (KeyboardShortcutsCustomShortcutsParsedShortcut, 5);
	_tmp0__length = 0;
	_tmp0__size = 4;
	_tmp0__length1 = 0;
	g_variant_iter_init (&_tmp1_, value);
	for (; (_tmp2_ = g_variant_iter_next_value (&_tmp1_)) != NULL; _tmp0__length1++) {
		KeyboardShortcutsCustomShortcutsParsedShortcut _tmp3_;
		GVariantIter _tmp4_;
		GVariant* _tmp5_;
		GVariant* _tmp6_;
		GVariant* _tmp7_;
		GHashTable* _tmp8_;
		GVariantIter _tmp9_;
		GVariant* _tmp10_;
		GVariant* _tmp11_;
		GVariant* _tmp12_;
		gchar** _tmp13_;
		gint _tmp13__length;
		gint _tmp13__size;
		gint _tmp13__length1;
		GVariantIter _tmp14_;
		GVariant* _tmp15_;
		if (_tmp0__size == _tmp0__length) {
			_tmp0__size = 2 * _tmp0__size;
			_tmp0_ = g_renew (KeyboardShortcutsCustomShortcutsParsedShortcut, _tmp0_, _tmp0__size + 1);
		}
		g_variant_iter_init (&_tmp4_, _tmp2_);
		_tmp5_ = g_variant_iter_next_value (&_tmp4_);
		_tmp3_.type = g_variant_get_int32 (_tmp5_);
		g_variant_unref (_tmp5_);
		_tmp6_ = g_variant_iter_next_value (&_tmp4_);
		_tmp3_.target = g_variant_dup_string (_tmp6_, NULL);
		g_variant_unref (_tmp6_);
		_tmp7_ = g_variant_iter_next_value (&_tmp4_);
		_tmp8_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref);
		g_variant_iter_init (&_tmp9_, _tmp7_);
		while (g_variant_iter_loop (&_tmp9_, "{?*}", &_tmp10_, &_tmp11_)) {
			g_hash_table_insert (_tmp8_, g_variant_dup_string (_tmp10_, NULL), g_variant_get_variant (_tmp11_));
		}
		_tmp3_.parameters = _tmp8_;
		g_variant_unref (_tmp7_);
		_tmp12_ = g_variant_iter_next_value (&_tmp4_);
		_tmp13_ = g_new (gchar*, 5);
		_tmp13__length = 0;
		_tmp13__size = 4;
		_tmp13__length1 = 0;
		g_variant_iter_init (&_tmp14_, _tmp12_);
		for (; (_tmp15_ = g_variant_iter_next_value (&_tmp14_)) != NULL; _tmp13__length1++) {
			if (_tmp13__size == _tmp13__length) {
				_tmp13__size = 2 * _tmp13__size;
				_tmp13_ = g_renew (gchar*, _tmp13_, _tmp13__size + 1);
			}
			_tmp13_[_tmp13__length++] = g_variant_dup_string (_tmp15_, NULL);
			g_variant_unref (_tmp15_);
		}
		_tmp3_.keybindings_length1 = _tmp13__length1;
		_tmp13_[_tmp13__length] = NULL;
		_tmp3_.keybindings = _tmp13_;
		g_variant_unref (_tmp12_);
		_tmp0_[_tmp0__length++] = _tmp3_;
		g_variant_unref (_tmp2_);
	}
	*result_length1 = _tmp0__length1;
	return _tmp0_;
}

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

static GVariant*
_variant_new2 (KeyboardShortcutsCustomShortcutsParsedShortcut* value,
               gint value_length1)
{
	KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp14_;
	GVariantBuilder _tmp15_;
	gint _tmp16_;
	_tmp14_ = value;
	g_variant_builder_init (&_tmp15_, G_VARIANT_TYPE ("a(isa{sv}as)"));
	for (_tmp16_ = 0; _tmp16_ < value_length1; _tmp16_++) {
		GVariantBuilder _tmp17_;
		GVariantBuilder _tmp18_;
		GHashTableIter _tmp19_;
		gpointer _tmp20_;
		gpointer _tmp21_;
		gchar** _tmp22_;
		GVariantBuilder _tmp23_;
		gint _tmp24_;
		g_variant_builder_init (&_tmp17_, G_VARIANT_TYPE_TUPLE);
		g_variant_builder_add_value (&_tmp17_, g_variant_new_int32 ((*_tmp14_).type));
		g_variant_builder_add_value (&_tmp17_, g_variant_new_string ((*_tmp14_).target));
		g_hash_table_iter_init (&_tmp19_, (*_tmp14_).parameters);
		g_variant_builder_init (&_tmp18_, G_VARIANT_TYPE ("a{sv}"));
		while (g_hash_table_iter_next (&_tmp19_, &_tmp20_, &_tmp21_)) {
			gchar* _key;
			GVariant* _value;
			_key = (gchar*) _tmp20_;
			_value = (GVariant*) _tmp21_;
			g_variant_builder_add (&_tmp18_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
		}
		g_variant_builder_add_value (&_tmp17_, g_variant_builder_end (&_tmp18_));
		_tmp22_ = (*_tmp14_).keybindings;
		g_variant_builder_init (&_tmp23_, G_VARIANT_TYPE ("as"));
		for (_tmp24_ = 0; _tmp24_ < (*_tmp14_).keybindings_length1; _tmp24_++) {
			g_variant_builder_add_value (&_tmp23_, g_variant_new_string (*_tmp22_));
			_tmp22_++;
		}
		g_variant_builder_add_value (&_tmp17_, g_variant_builder_end (&_tmp23_));
		g_variant_builder_add_value (&_tmp15_, g_variant_builder_end (&_tmp17_));
		_tmp14_++;
	}
	return g_variant_ref_sink (g_variant_builder_end (&_tmp15_));
}

static void
keyboard_shortcuts_custom_shortcut_list_box_add_new_shortcut (KeyboardShortcutsCustomShortcutListBox* self,
                                                              KeyboardShortcutsCustomShortcutsActionType type,
                                                              const gchar* target,
                                                              GHashTable* parameters)
{
	KeyboardShortcutsCustomShortcutsParsedShortcut new_shortcut = {0};
	gchar* _tmp0_;
	GHashTable* _tmp1_;
	gchar** _tmp2_;
	KeyboardShortcutsCustomShortcutsParsedShortcut _tmp3_ = {0};
	KeyboardShortcutsCustomShortcutsParsedShortcut* shortcuts = NULL;
	GSettings* _tmp4_;
	GVariant* _tmp5_;
	GVariant* _tmp6_;
	KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp7_ = NULL;
	gint _tmp7__length1 = 0;
	KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp8_;
	gint _tmp8__length1;
	gint shortcuts_length1;
	gint _shortcuts_size_;
	KeyboardShortcutsCustomShortcutsParsedShortcut _tmp9_;
	KeyboardShortcutsCustomShortcutsParsedShortcut _tmp10_;
	KeyboardShortcutsCustomShortcutsParsedShortcut _tmp11_ = {0};
	GSettings* _tmp12_;
	KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp13_;
	gint _tmp13__length1;
	GVariant* _tmp25_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (target != NULL);
	g_return_if_fail (parameters != NULL);
	_tmp0_ = g_strdup (target);
	_tmp1_ = _g_hash_table_ref0 (parameters);
	_tmp2_ = g_new0 (gchar*, 0 + 1);
	_tmp3_.type = type;
	_g_free0 (_tmp3_.target);
	_tmp3_.target = _tmp0_;
	_g_hash_table_unref0 (_tmp3_.parameters);
	_tmp3_.parameters = _tmp1_;
	_tmp3_.keybindings = (_vala_array_free (_tmp3_.keybindings, _tmp3_.keybindings_length1, (GDestroyNotify) g_free), NULL);
	_tmp3_.keybindings = _tmp2_;
	_tmp3_.keybindings_length1 = 0;
	new_shortcut = _tmp3_;
	_tmp4_ = self->priv->settings;
	_tmp5_ = g_settings_get_value (_tmp4_, KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUTS_APPLICATION_SHORTCUTS);
	_tmp6_ = _tmp5_;
	_tmp7_ = _variant_get3 (_tmp6_, &_tmp7__length1);
	_tmp8_ = _tmp7_;
	_tmp8__length1 = _tmp7__length1;
	_g_variant_unref0 (_tmp6_);
	shortcuts = _tmp8_;
	shortcuts_length1 = _tmp8__length1;
	_shortcuts_size_ = shortcuts_length1;
	_tmp9_ = new_shortcut;
	_tmp10_ = _tmp9_;
	keyboard_shortcuts_custom_shortcuts_parsed_shortcut_copy (&_tmp10_, &_tmp11_);
	_vala_array_add16 (&shortcuts, &shortcuts_length1, &_shortcuts_size_, &_tmp11_);
	_tmp12_ = self->priv->settings;
	_tmp13_ = shortcuts;
	_tmp13__length1 = shortcuts_length1;
	_tmp25_ = _variant_new2 (_tmp13_, _tmp13__length1);
	g_settings_set_value (_tmp12_, KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUTS_APPLICATION_SHORTCUTS, _tmp25_);
	_g_variant_unref0 (_tmp25_);
	shortcuts = (_vala_KeyboardShortcutsCustomShortcutsParsedShortcut_array_free (shortcuts, shortcuts_length1), NULL);
	keyboard_shortcuts_custom_shortcuts_parsed_shortcut_destroy (&new_shortcut);
}

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

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

static GVariant*
_variant_new3 (KeyboardShortcutsCustomShortcutsParsedShortcut* value,
               gint value_length1)
{
	KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp23_;
	GVariantBuilder _tmp24_;
	gint _tmp25_;
	_tmp23_ = value;
	g_variant_builder_init (&_tmp24_, G_VARIANT_TYPE ("a(isa{sv}as)"));
	for (_tmp25_ = 0; _tmp25_ < value_length1; _tmp25_++) {
		GVariantBuilder _tmp26_;
		GVariantBuilder _tmp27_;
		GHashTableIter _tmp28_;
		gpointer _tmp29_;
		gpointer _tmp30_;
		gchar** _tmp31_;
		GVariantBuilder _tmp32_;
		gint _tmp33_;
		g_variant_builder_init (&_tmp26_, G_VARIANT_TYPE_TUPLE);
		g_variant_builder_add_value (&_tmp26_, g_variant_new_int32 ((*_tmp23_).type));
		g_variant_builder_add_value (&_tmp26_, g_variant_new_string ((*_tmp23_).target));
		g_hash_table_iter_init (&_tmp28_, (*_tmp23_).parameters);
		g_variant_builder_init (&_tmp27_, G_VARIANT_TYPE ("a{sv}"));
		while (g_hash_table_iter_next (&_tmp28_, &_tmp29_, &_tmp30_)) {
			gchar* _key;
			GVariant* _value;
			_key = (gchar*) _tmp29_;
			_value = (GVariant*) _tmp30_;
			g_variant_builder_add (&_tmp27_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
		}
		g_variant_builder_add_value (&_tmp26_, g_variant_builder_end (&_tmp27_));
		_tmp31_ = (*_tmp23_).keybindings;
		g_variant_builder_init (&_tmp32_, G_VARIANT_TYPE ("as"));
		for (_tmp33_ = 0; _tmp33_ < (*_tmp23_).keybindings_length1; _tmp33_++) {
			g_variant_builder_add_value (&_tmp32_, g_variant_new_string (*_tmp31_));
			_tmp31_++;
		}
		g_variant_builder_add_value (&_tmp26_, g_variant_builder_end (&_tmp32_));
		g_variant_builder_add_value (&_tmp24_, g_variant_builder_end (&_tmp26_));
		_tmp23_++;
	}
	return g_variant_ref_sink (g_variant_builder_end (&_tmp24_));
}

static void
keyboard_shortcuts_custom_shortcut_list_box_sync_shortcuts (KeyboardShortcutsCustomShortcutListBox* self)
{
	GtkWidget* _row = NULL;
	GtkListBox* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkWidget* _tmp3_;
	gboolean should_rebuild_list = FALSE;
	KeyboardShortcutsCustomShortcutsParsedShortcut* shortcuts = NULL;
	KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp4_;
	gint shortcuts_length1;
	gint _shortcuts_size_;
	GSettings* _tmp21_;
	KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp22_;
	gint _tmp22__length1;
	GVariant* _tmp34_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->list_box;
	_tmp1_ = gtk_widget_get_first_child ((GtkWidget*) _tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_row = _tmp2_;
	_tmp3_ = _row;
	if (_tmp3_ == NULL) {
		_g_object_unref0 (_row);
		return;
	}
	should_rebuild_list = FALSE;
	_tmp4_ = g_new0 (KeyboardShortcutsCustomShortcutsParsedShortcut, 0);
	shortcuts = _tmp4_;
	shortcuts_length1 = 0;
	_shortcuts_size_ = shortcuts_length1;
	{
		gboolean _tmp5_ = FALSE;
		_tmp5_ = TRUE;
		while (TRUE) {
			KeyboardShortcutsCustomShortcutRow* row = NULL;
			GtkWidget* _tmp10_;
			KeyboardShortcutsCustomShortcutRow* _tmp11_;
			KeyboardShortcutsCustomShortcutRow* _tmp12_;
			KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp13_;
			KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp14_;
			KeyboardShortcutsCustomShortcutRow* _tmp15_;
			KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp16_;
			KeyboardShortcutsCustomShortcutsParsedShortcut* _tmp17_;
			KeyboardShortcutsCustomShortcutsParsedShortcut _tmp18_;
			KeyboardShortcutsCustomShortcutsParsedShortcut _tmp19_ = {0};
			if (!_tmp5_) {
				GtkWidget* _tmp6_;
				GtkWidget* _tmp7_;
				GtkWidget* _tmp8_;
				GtkWidget* _tmp9_;
				_tmp6_ = _row;
				_tmp7_ = gtk_widget_get_next_sibling (_tmp6_);
				_tmp8_ = _g_object_ref0 (_tmp7_);
				_g_object_unref0 (_row);
				_row = _tmp8_;
				_tmp9_ = _row;
				if (!(_tmp9_ != NULL)) {
					break;
				}
			}
			_tmp5_ = FALSE;
			_tmp10_ = _row;
			_tmp11_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_ROW, KeyboardShortcutsCustomShortcutRow));
			row = _tmp11_;
			_tmp12_ = row;
			_tmp13_ = keyboard_shortcuts_custom_shortcut_row_get_shortcut (_tmp12_);
			_tmp14_ = _tmp13_;
			if (_tmp14_ == NULL) {
				should_rebuild_list = TRUE;
				_g_object_unref0 (row);
				continue;
			}
			_tmp15_ = row;
			_tmp16_ = keyboard_shortcuts_custom_shortcut_row_get_shortcut (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp18_ = *_tmp17_;
			keyboard_shortcuts_custom_shortcuts_parsed_shortcut_copy (&_tmp18_, &_tmp19_);
			_vala_array_add17 (&shortcuts, &shortcuts_length1, &_shortcuts_size_, &_tmp19_);
			_g_object_unref0 (row);
		}
	}
	if (!should_rebuild_list) {
		GSettings* _tmp20_;
		_tmp20_ = self->priv->settings;
		g_signal_handler_block (_tmp20_, self->priv->settings_load_id);
	}
	_tmp21_ = self->priv->settings;
	_tmp22_ = shortcuts;
	_tmp22__length1 = shortcuts_length1;
	_tmp34_ = _variant_new3 (_tmp22_, _tmp22__length1);
	g_settings_set_value (_tmp21_, KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUTS_APPLICATION_SHORTCUTS, _tmp34_);
	_g_variant_unref0 (_tmp34_);
	if (!should_rebuild_list) {
		GSettings* _tmp35_;
		_tmp35_ = self->priv->settings;
		g_signal_handler_unblock (_tmp35_, self->priv->settings_load_id);
	}
	shortcuts = (_vala_KeyboardShortcutsCustomShortcutsParsedShortcut_array_free (shortcuts, shortcuts_length1), NULL);
	_g_object_unref0 (_row);
}

KeyboardShortcutsCustomShortcutListBox*
keyboard_shortcuts_custom_shortcut_list_box_construct (GType object_type)
{
	KeyboardShortcutsCustomShortcutListBox * self = NULL;
	self = (KeyboardShortcutsCustomShortcutListBox*) g_object_new (object_type, NULL);
	return self;
}

KeyboardShortcutsCustomShortcutListBox*
keyboard_shortcuts_custom_shortcut_list_box_new (void)
{
	return keyboard_shortcuts_custom_shortcut_list_box_construct (KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_LIST_BOX);
}

static gchar**
_vala_array_dup7 (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
_keyboard_shortcuts_custom_shortcut_list_box_load_and_display_custom_shortcuts_g_settings_changed (GSettings* _sender,
                                                                                                   const gchar* key,
                                                                                                   gpointer self)
{
	keyboard_shortcuts_custom_shortcut_list_box_load_and_display_custom_shortcuts ((KeyboardShortcutsCustomShortcutListBox*) self);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static void
_keyboard_shortcuts_custom_shortcut_list_box___lambda74_ (KeyboardShortcutsCustomShortcutListBox* self)
{
	KeyboardShortcutsAppChooser* _tmp0_;
	GtkRoot* _tmp1_;
	KeyboardShortcutsAppChooser* _tmp2_;
	_tmp0_ = self->priv->app_chooser;
	_tmp1_ = gtk_widget_get_root ((GtkWidget*) self);
	gtk_window_set_transient_for ((GtkWindow*) _tmp0_, G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_window_get_type (), GtkWindow));
	_tmp2_ = self->priv->app_chooser;
	gtk_window_present ((GtkWindow*) _tmp2_);
}

static void
__keyboard_shortcuts_custom_shortcut_list_box___lambda74__gtk_button_clicked (GtkButton* _sender,
                                                                              gpointer self)
{
	_keyboard_shortcuts_custom_shortcut_list_box___lambda74_ ((KeyboardShortcutsCustomShortcutListBox*) self);
}

static void
_keyboard_shortcuts_custom_shortcut_list_box___lambda75_ (KeyboardShortcutsCustomShortcutListBox* self,
                                                          const gchar* filename,
                                                          GHashTable* parameters)
{
	g_return_if_fail (filename != NULL);
	g_return_if_fail (parameters != NULL);
	keyboard_shortcuts_custom_shortcut_list_box_add_new_shortcut (self, KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUTS_ACTION_TYPE_DESKTOP_FILE, filename, parameters);
}

static void
__keyboard_shortcuts_custom_shortcut_list_box___lambda75__keyboard_shortcuts_app_chooser_app_chosen (KeyboardShortcutsAppChooser* _sender,
                                                                                                     const gchar* filename,
                                                                                                     GHashTable* parameters,
                                                                                                     gpointer self)
{
	_keyboard_shortcuts_custom_shortcut_list_box___lambda75_ ((KeyboardShortcutsCustomShortcutListBox*) self, filename, parameters);
}

static void
_keyboard_shortcuts_custom_shortcut_list_box___lambda76_ (KeyboardShortcutsCustomShortcutListBox* self,
                                                          const gchar* command,
                                                          GHashTable* parameters)
{
	g_return_if_fail (command != NULL);
	g_return_if_fail (parameters != NULL);
	keyboard_shortcuts_custom_shortcut_list_box_add_new_shortcut (self, KEYBOARD_SHORTCUTS_CUSTOM_SHORTCUTS_ACTION_TYPE_COMMAND_LINE, command, parameters);
}

static void
__keyboard_shortcuts_custom_shortcut_list_box___lambda76__keyboard_shortcuts_app_chooser_custom_command_chosen (KeyboardShortcutsAppChooser* _sender,
                                                                                                                const gchar* command,
                                                                                                                GHashTable* parameters,
                                                                                                                gpointer self)
{
	_keyboard_shortcuts_custom_shortcut_list_box___lambda76_ ((KeyboardShortcutsCustomShortcutListBox*) self, command, parameters);
}

static GObject *
keyboard_shortcuts_custom_shortcut_list_box_constructor (GType type,
                                                         guint n_construct_properties,
                                                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	KeyboardShortcutsCustomShortcutListBox * self;
	GtkListBox* _tmp0_ = NULL;
	GtkLabel* add_button_label = NULL;
	GtkLabel* _tmp1_;
	GtkBox* add_button_box = NULL;
	GtkBox* _tmp2_;
	GtkBox* _tmp3_;
	GtkImage* _tmp4_;
	GtkImage* _tmp5_;
	GtkBox* _tmp6_;
	GtkLabel* _tmp7_;
	GtkButton* add_button = NULL;
	GtkBox* _tmp8_;
	GtkWidget* _tmp9_;
	GtkButton* _tmp10_ = NULL;
	GtkButton* _tmp11_;
	GtkLabel* _tmp12_;
	GtkButton* _tmp13_;
	GtkActionBar* actionbar = NULL;
	GtkActionBar* _tmp14_ = NULL;
	GtkActionBar* _tmp15_;
	GtkActionBar* _tmp16_;
	GtkButton* _tmp17_;
	GtkListBox* _tmp18_;
	GtkActionBar* _tmp19_;
	GSettings* _tmp20_;
	gchar** _tmp21_;
	gchar** _tmp22_;
	gchar** _tmp23_;
	gint _tmp23__length1;
	GSettings* _tmp24_;
	gulong _tmp25_;
	GList* app_infos = NULL;
	GList* _tmp26_;
	KeyboardShortcutsAppChooser* _tmp33_;
	KeyboardShortcutsAppChooser* _tmp34_;
	GList* _tmp35_;
	GtkButton* _tmp36_;
	KeyboardShortcutsAppChooser* _tmp37_;
	KeyboardShortcutsAppChooser* _tmp38_;
	parent_class = G_OBJECT_CLASS (keyboard_shortcuts_custom_shortcut_list_box_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_LIST_BOX, KeyboardShortcutsCustomShortcutListBox);
	_tmp0_ = (GtkListBox*) gtk_list_box_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp0_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp0_, TRUE);
	gtk_list_box_set_selection_mode (_tmp0_, GTK_SELECTION_BROWSE);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->list_box);
	self->priv->list_box = _tmp0_;
	_tmp1_ = (GtkLabel*) gtk_label_new (_ ("Add Shortcut"));
	g_object_ref_sink (_tmp1_);
	add_button_label = _tmp1_;
	_tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	g_object_ref_sink (_tmp2_);
	add_button_box = _tmp2_;
	_tmp3_ = add_button_box;
	_tmp4_ = (GtkImage*) gtk_image_new_from_icon_name ("list-add-symbolic");
	g_object_ref_sink (_tmp4_);
	_tmp5_ = _tmp4_;
	gtk_box_append (_tmp3_, (GtkWidget*) _tmp5_);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = add_button_box;
	_tmp7_ = add_button_label;
	gtk_box_append (_tmp6_, (GtkWidget*) _tmp7_);
	_tmp8_ = add_button_box;
	_tmp9_ = _g_object_ref0 ((GtkWidget*) _tmp8_);
	_tmp10_ = (GtkButton*) gtk_button_new ();
	gtk_button_set_child (_tmp10_, _tmp9_);
	_g_object_unref0 (_tmp9_);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp10_, 3);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp10_, 3);
	g_object_ref_sink (_tmp10_);
	add_button = _tmp10_;
	_tmp11_ = add_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp11_, GRANITE_STYLE_CLASS_FLAT);
	_tmp12_ = add_button_label;
	_tmp13_ = add_button;
	gtk_label_set_mnemonic_widget (_tmp12_, (GtkWidget*) _tmp13_);
	_tmp14_ = (GtkActionBar*) gtk_action_bar_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp14_, TRUE);
	g_object_ref_sink (_tmp14_);
	actionbar = _tmp14_;
	_tmp15_ = actionbar;
	gtk_widget_add_css_class ((GtkWidget*) _tmp15_, GRANITE_STYLE_CLASS_FLAT);
	_tmp16_ = actionbar;
	_tmp17_ = add_button;
	gtk_action_bar_pack_start (_tmp16_, (GtkWidget*) _tmp17_);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_VERTICAL);
	_tmp18_ = self->priv->list_box;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp18_);
	_tmp19_ = actionbar;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp19_);
	_tmp20_ = g_settings_new ("io.elementary.settings-daemon.applications");
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp20_;
	_tmp22_ = _tmp21_ = g_get_language_names ();
	_tmp23_ = (_tmp22_ != NULL) ? _vala_array_dup7 (_tmp22_, _vala_array_length (_tmp21_)) : _tmp22_;
	_tmp23__length1 = _vala_array_length (_tmp21_);
	self->priv->preferred_languages = (_vala_array_free (self->priv->preferred_languages, self->priv->preferred_languages_length1, (GDestroyNotify) g_free), NULL);
	self->priv->preferred_languages = _tmp23_;
	self->priv->preferred_languages_length1 = _tmp23__length1;
	self->priv->_preferred_languages_size_ = self->priv->preferred_languages_length1;
	keyboard_shortcuts_custom_shortcut_list_box_load_and_display_custom_shortcuts (self);
	_tmp24_ = self->priv->settings;
	_tmp25_ = g_signal_connect_object (_tmp24_, "changed", (GCallback) _keyboard_shortcuts_custom_shortcut_list_box_load_and_display_custom_shortcuts_g_settings_changed, self, 0);
	self->priv->settings_load_id = _tmp25_;
	app_infos = NULL;
	_tmp26_ = g_app_info_get_all ();
	{
		GList* app_info_collection = NULL;
		GList* app_info_it = NULL;
		app_info_collection = _tmp26_;
		for (app_info_it = app_info_collection; app_info_it != NULL; app_info_it = app_info_it->next) {
			GAppInfo* _tmp27_;
			GAppInfo* app_info = NULL;
			_tmp27_ = _g_object_ref0 ((GAppInfo*) app_info_it->data);
			app_info = _tmp27_;
			{
				gboolean _tmp28_ = FALSE;
				GAppInfo* _tmp29_;
				_tmp29_ = app_info;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp29_, G_TYPE_DESKTOP_APP_INFO)) {
					GAppInfo* _tmp30_;
					_tmp30_ = app_info;
					_tmp28_ = g_app_info_should_show (_tmp30_);
				} else {
					_tmp28_ = FALSE;
				}
				if (_tmp28_) {
					GAppInfo* _tmp31_;
					GDesktopAppInfo* _tmp32_;
					_tmp31_ = app_info;
					_tmp32_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp31_, G_TYPE_DESKTOP_APP_INFO, GDesktopAppInfo));
					app_infos = g_list_append (app_infos, _tmp32_);
				}
				_g_object_unref0 (app_info);
			}
		}
		(app_info_collection == NULL) ? NULL : (app_info_collection = (_g_list_free__g_object_unref0_ (app_info_collection), NULL));
	}
	_tmp33_ = keyboard_shortcuts_app_chooser_new ();
	g_object_ref_sink (_tmp33_);
	_g_object_unref0 (self->priv->app_chooser);
	self->priv->app_chooser = _tmp33_;
	_tmp34_ = self->priv->app_chooser;
	_tmp35_ = app_infos;
	keyboard_shortcuts_app_chooser_init_list (_tmp34_, _tmp35_);
	_tmp36_ = add_button;
	g_signal_connect_object (_tmp36_, "clicked", (GCallback) __keyboard_shortcuts_custom_shortcut_list_box___lambda74__gtk_button_clicked, self, 0);
	_tmp37_ = self->priv->app_chooser;
	g_signal_connect_object (_tmp37_, "app-chosen", (GCallback) __keyboard_shortcuts_custom_shortcut_list_box___lambda75__keyboard_shortcuts_app_chooser_app_chosen, self, 0);
	_tmp38_ = self->priv->app_chooser;
	g_signal_connect_object (_tmp38_, "custom-command-chosen", (GCallback) __keyboard_shortcuts_custom_shortcut_list_box___lambda76__keyboard_shortcuts_app_chooser_custom_command_chosen, self, 0);
	(app_infos == NULL) ? NULL : (app_infos = (_g_list_free__g_object_unref0_ (app_infos), NULL));
	_g_object_unref0 (actionbar);
	_g_object_unref0 (add_button);
	_g_object_unref0 (add_button_box);
	_g_object_unref0 (add_button_label);
	return obj;
}

static void
keyboard_shortcuts_custom_shortcut_list_box_class_init (KeyboardShortcutsCustomShortcutListBoxClass * klass,
                                                        gpointer klass_data)
{
	keyboard_shortcuts_custom_shortcut_list_box_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &KeyboardShortcutsCustomShortcutListBox_private_offset);
	G_OBJECT_CLASS (klass)->constructor = keyboard_shortcuts_custom_shortcut_list_box_constructor;
	G_OBJECT_CLASS (klass)->finalize = keyboard_shortcuts_custom_shortcut_list_box_finalize;
}

static void
keyboard_shortcuts_custom_shortcut_list_box_instance_init (KeyboardShortcutsCustomShortcutListBox * self,
                                                           gpointer klass)
{
	self->priv = keyboard_shortcuts_custom_shortcut_list_box_get_instance_private (self);
	self->priv->settings_load_id = (gulong) 0;
}

static void
keyboard_shortcuts_custom_shortcut_list_box_finalize (GObject * obj)
{
	KeyboardShortcutsCustomShortcutListBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, KEYBOARD_SHORTCUTS_TYPE_CUSTOM_SHORTCUT_LIST_BOX, KeyboardShortcutsCustomShortcutListBox);
	_g_object_unref0 (self->priv->settings);
	self->priv->preferred_languages = (_vala_array_free (self->priv->preferred_languages, self->priv->preferred_languages_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (self->priv->list_box);
	_g_object_unref0 (self->priv->app_chooser);
	G_OBJECT_CLASS (keyboard_shortcuts_custom_shortcut_list_box_parent_class)->finalize (obj);
}

static GType
keyboard_shortcuts_custom_shortcut_list_box_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (KeyboardShortcutsCustomShortcutListBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) keyboard_shortcuts_custom_shortcut_list_box_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (KeyboardShortcutsCustomShortcutListBox), 0, (GInstanceInitFunc) keyboard_shortcuts_custom_shortcut_list_box_instance_init, NULL };
	GType keyboard_shortcuts_custom_shortcut_list_box_type_id;
	keyboard_shortcuts_custom_shortcut_list_box_type_id = g_type_register_static (gtk_box_get_type (), "KeyboardShortcutsCustomShortcutListBox", &g_define_type_info, 0);
	KeyboardShortcutsCustomShortcutListBox_private_offset = g_type_add_instance_private (keyboard_shortcuts_custom_shortcut_list_box_type_id, sizeof (KeyboardShortcutsCustomShortcutListBoxPrivate));
	return keyboard_shortcuts_custom_shortcut_list_box_type_id;
}

GType
keyboard_shortcuts_custom_shortcut_list_box_get_type (void)
{
	static volatile gsize keyboard_shortcuts_custom_shortcut_list_box_type_id__once = 0;
	if (g_once_init_enter (&keyboard_shortcuts_custom_shortcut_list_box_type_id__once)) {
		GType keyboard_shortcuts_custom_shortcut_list_box_type_id;
		keyboard_shortcuts_custom_shortcut_list_box_type_id = keyboard_shortcuts_custom_shortcut_list_box_get_type_once ();
		g_once_init_leave (&keyboard_shortcuts_custom_shortcut_list_box_type_id__once, keyboard_shortcuts_custom_shortcut_list_box_type_id);
	}
	return keyboard_shortcuts_custom_shortcut_list_box_type_id__once;
}

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

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

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

