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

#include <glib.h>
#include <adwaita.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <gst/gst.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>

#define G4_TAG_GROUP_BASIC 1
#define G4_TAG_GROUP_SORT 2
#define G4_TAG_GROUP_FORMAT 3
#define G4_TAG_GROUP_OTHER 4
#define G4_TAG_LIST_DIALOG_GST_DOMAIN "gstreamer-1.0"
#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 G4_TYPE_DIALOG (g4_dialog_get_type ())
#define G4_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_DIALOG, G4Dialog))
#define G4_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_DIALOG, G4DialogClass))
#define G4_IS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_DIALOG))
#define G4_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_DIALOG))
#define G4_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_DIALOG, G4DialogClass))

typedef struct _G4Dialog G4Dialog;
typedef struct _G4DialogClass G4DialogClass;
typedef struct _G4DialogPrivate G4DialogPrivate;

#define G4_TYPE_TAG_LIST_DIALOG (g4_tag_list_dialog_get_type ())
#define G4_TAG_LIST_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_TAG_LIST_DIALOG, G4TagListDialog))
#define G4_TAG_LIST_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_TAG_LIST_DIALOG, G4TagListDialogClass))
#define G4_IS_TAG_LIST_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_TAG_LIST_DIALOG))
#define G4_IS_TAG_LIST_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_TAG_LIST_DIALOG))
#define G4_TAG_LIST_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_TAG_LIST_DIALOG, G4TagListDialogClass))

typedef struct _G4TagListDialog G4TagListDialog;
typedef struct _G4TagListDialogClass G4TagListDialogClass;
typedef struct _G4TagListDialogPrivate G4TagListDialogPrivate;

#define G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM (g4_tag_list_dialog_tag_item_get_type ())
#define G4_TAG_LIST_DIALOG_TAG_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, G4TagListDialogTagItem))
#define G4_TAG_LIST_DIALOG_TAG_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, G4TagListDialogTagItemClass))
#define G4_TAG_LIST_DIALOG_IS_TAG_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM))
#define G4_TAG_LIST_DIALOG_IS_TAG_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM))
#define G4_TAG_LIST_DIALOG_TAG_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, G4TagListDialogTagItemClass))

typedef struct _G4TagListDialogTagItem G4TagListDialogTagItem;
typedef struct _G4TagListDialogTagItemClass G4TagListDialogTagItemClass;
enum  {
	G4_TAG_LIST_DIALOG_0_PROPERTY,
	G4_TAG_LIST_DIALOG_NUM_PROPERTIES
};
static GParamSpec* g4_tag_list_dialog_properties[G4_TAG_LIST_DIALOG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
typedef struct _G4TagListDialogTagItemPrivate G4TagListDialogTagItemPrivate;
typedef gpointer (*G4TaskFunc) (gpointer user_data);
#define _gst_tag_list_unref0(var) ((var == NULL) ? NULL : (var = (gst_tag_list_unref (var), NULL)))
typedef struct _G4TagListDialogLaodTagsAsyncData G4TagListDialogLaodTagsAsyncData;
typedef struct _Block44Data Block44Data;
enum  {
	G4_TAG_LIST_DIALOG_TAG_ITEM_0_PROPERTY,
	G4_TAG_LIST_DIALOG_TAG_ITEM_NUM_PROPERTIES
};
static GParamSpec* g4_tag_list_dialog_tag_item_properties[G4_TAG_LIST_DIALOG_TAG_ITEM_NUM_PROPERTIES];

#define G4_TAG_LIST_DIALOG_TYPE_TAG_ORDER (g4_tag_list_dialog_tag_order_get_type ())
typedef struct _G4TagListDialogTagOrder G4TagListDialogTagOrder;

struct _G4Dialog {
	AdwDialog parent_instance;
	G4DialogPrivate * priv;
};

struct _G4DialogClass {
	AdwDialogClass parent_class;
};

struct _G4TagListDialog {
	G4Dialog parent_instance;
	G4TagListDialogPrivate * priv;
};

struct _G4TagListDialogClass {
	G4DialogClass parent_class;
};

struct _G4TagListDialogPrivate {
	GFile* file;
	GPtrArray* items;
	GtkButton* copy_btn;
	GtkBox* group;
	GtkSpinner* spinner;
};

struct _G4TagListDialogTagItem {
	GObject parent_instance;
	G4TagListDialogTagItemPrivate * priv;
	gint group;
	gchar* tag;
	gchar* value;
	gchar* description;
};

struct _G4TagListDialogTagItemClass {
	GObjectClass parent_class;
};

struct _G4TagListDialogLaodTagsAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	G4TagListDialog* self;
	gchar* uri;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	GtkButton* _tmp2_;
	GtkSpinner* _tmp3_;
	GstTagList* tags;
	gpointer _tmp4_;
	GstTagList* _tmp5_;
	GstTagList* _tmp6_;
	GtkButton* _tmp7_;
	GtkSpinner* _tmp8_;
};

struct _Block44Data {
	int _ref_count_;
	GPtrArray* self;
	GCompareFunc compare_func;
};

struct _G4TagListDialogTagItemPrivate {
	gchar* _key;
	gint _order;
};

struct _G4TagListDialogTagOrder {
	const gchar* tag;
	gint order;
};

static gint G4TagListDialog_private_offset;
static gpointer g4_tag_list_dialog_parent_class = NULL;
VALA_EXTERN GHashTable* g4_tag_list_dialog_ORDERS;
GHashTable* g4_tag_list_dialog_ORDERS = NULL;
static gint G4TagListDialogTagItem_private_offset;
static gpointer g4_tag_list_dialog_tag_item_parent_class = NULL;

VALA_EXTERN GType g4_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4Dialog, g_object_unref)
VALA_EXTERN GType g4_tag_list_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4TagListDialog, g_object_unref)
VALA_EXTERN GType g4_tag_list_dialog_tag_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4TagListDialogTagItem, g_object_unref)
static void _g_free0_ (gpointer var);
static void _g_object_unref0_ (gpointer var);
VALA_EXTERN gchar* g4_tag_list_dialog_embellish_tag_name (const gchar* name);
VALA_EXTERN G4TagListDialog* g4_tag_list_dialog_new (const gchar* uri,
                                         GstTagList* tags);
VALA_EXTERN G4TagListDialog* g4_tag_list_dialog_construct (GType object_type,
                                               const gchar* uri,
                                               GstTagList* tags);
VALA_EXTERN G4Dialog* g4_dialog_new (void);
VALA_EXTERN G4Dialog* g4_dialog_construct (GType object_type);
static void g4_tag_list_dialog_copy_to_clipboard (G4TagListDialog* self);
static void _g4_tag_list_dialog_copy_to_clipboard_gtk_button_clicked (GtkButton* _sender,
                                                               gpointer self);
static void g4_tag_list_dialog_load_tags (G4TagListDialog* self,
                                   GstTagList* tags);
static void g4_tag_list_dialog_laod_tags_async (G4TagListDialog* self,
                                         const gchar* uri,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void g4_tag_list_dialog_laod_tags_finish (G4TagListDialog* self,
                                          GAsyncResult* _res_);
static void ___lambda157_ (G4TagListDialog* self,
                    GObject* obj,
                    GAsyncResult* res);
static void ____lambda157__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static GtkListBox* g4_tag_list_dialog_create_list_box (G4TagListDialog* self,
                                                GtkListBox* previous);
static void g4_tag_list_dialog_laod_tags_async_data_free (gpointer _data);
static gboolean g4_tag_list_dialog_laod_tags_async_co (G4TagListDialogLaodTagsAsyncData* _data_);
VALA_EXTERN void g4_run_async (GType v_type,
                   GBoxedCopyFunc v_dup_func,
                   GDestroyNotify v_destroy_func,
                   G4TaskFunc task,
                   gpointer task_target,
                   gboolean front,
                   gboolean in_single_pool,
                   GAsyncReadyCallback _callback_,
                   gpointer _user_data_);
VALA_EXTERN gpointer g4_run_finish (GAsyncResult* _res_);
static GstTagList* __lambda156_ (G4TagListDialog* self);
VALA_EXTERN GstTagList* g4_parse_gst_tags (GFile* file);
static gpointer ___lambda156__g4_task_func (gpointer self);
static void g4_tag_list_dialog_laod_tags_async_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
VALA_EXTERN void g4_get_one_tag (GstTagList* tags,
                     const gchar* tag,
                     GPtrArray* values);
VALA_EXTERN G4TagListDialogTagItem* g4_tag_list_dialog_tag_item_new (const gchar* t,
                                                         const gchar* v);
VALA_EXTERN G4TagListDialogTagItem* g4_tag_list_dialog_tag_item_construct (GType object_type,
                                                               const gchar* t,
                                                               const gchar* v);
static Block44Data* block44_data_ref (Block44Data* _data44_);
static void block44_data_unref (void * _userdata_);
static gint ___lambda0__gcompare_data_func (gconstpointer a,
                                     gconstpointer b,
                                     gpointer self);
VALA_EXTERN gint g4_tag_list_dialog_tag_item_compare_by_name (G4TagListDialogTagItem* ti1,
                                                  G4TagListDialogTagItem* ti2);
static gint _g4_tag_list_dialog_tag_item_compare_by_name_gcompare_func (gconstpointer a,
                                                                 gconstpointer b);
static void g4_tag_list_dialog_tag_item_finalize (GObject * obj);
static GType g4_tag_list_dialog_tag_item_get_type_once (void);
VALA_EXTERN GType g4_tag_list_dialog_tag_order_get_type (void) G_GNUC_CONST ;
VALA_EXTERN G4TagListDialogTagOrder* g4_tag_list_dialog_tag_order_dup (const G4TagListDialogTagOrder* self);
VALA_EXTERN void g4_tag_list_dialog_tag_order_free (G4TagListDialogTagOrder* self);
static void g4_tag_list_dialog_finalize (GObject * obj);
static GType g4_tag_list_dialog_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 _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
g4_tag_list_dialog_get_instance_private (G4TagListDialog* self)
{
	return G_STRUCT_MEMBER_P (self, G4TagListDialog_private_offset);
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

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

static gboolean
string_get_next_char (const gchar* self,
                      gint* index,
                      gunichar* c)
{
	gunichar _vala_c = 0U;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_vala_c = g_utf8_get_char (((gchar*) self) + (*index));
	if (_vala_c != ((gunichar) 0)) {
		gchar* _tmp0_;
		_tmp0_ = g_utf8_next_char (((gchar*) self) + (*index));
		*index = (gint) (_tmp0_ - ((gchar*) self));
		result = TRUE;
		if (c) {
			*c = _vala_c;
		}
		return result;
	} else {
		result = FALSE;
		if (c) {
			*c = _vala_c;
		}
		return result;
	}
}

static gchar*
g_unichar_to_string (gunichar self)
{
	gchar* str = NULL;
	gchar* _tmp0_;
	gchar* result;
	_tmp0_ = g_new0 (gchar, 7);
	str = (gchar*) _tmp0_;
	g_unichar_to_utf8 (self, str);
	result = str;
	return result;
}

gchar*
g4_tag_list_dialog_embellish_tag_name (const gchar* name)
{
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_;
	gchar* text = NULL;
	gchar* _tmp2_;
	GString* sb = NULL;
	GString* _tmp3_;
	gchar** arr = NULL;
	const gchar* _tmp4_;
	gchar** _tmp5_;
	gchar** _tmp6_;
	gint arr_length1;
	gint _arr_size_;
	gint count = 0;
	gchar** _tmp7_;
	gint _tmp7__length1;
	GString* _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* result;
	g_return_val_if_fail (name != NULL, NULL);
	_tmp1_ = gst_tag_get_nick (name);
	_tmp0_ = _tmp1_;
	if (_tmp0_ == NULL) {
		_tmp0_ = name;
	}
	_tmp2_ = g_strdup (g_dgettext (G4_TAG_LIST_DIALOG_GST_DOMAIN, (const gchar*) _tmp0_));
	text = _tmp2_;
	_tmp3_ = g_string_new ("");
	sb = _tmp3_;
	_tmp4_ = text;
	_tmp6_ = _tmp5_ = g_strsplit (_tmp4_, " ", 0);
	arr = _tmp6_;
	arr_length1 = _vala_array_length (_tmp5_);
	_arr_size_ = arr_length1;
	_tmp7_ = arr;
	_tmp7__length1 = arr_length1;
	count = _tmp7__length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp8_ = FALSE;
			_tmp8_ = TRUE;
			while (TRUE) {
				gchar* str = NULL;
				gchar** _tmp10_;
				gint _tmp10__length1;
				const gchar* _tmp11_;
				gchar* _tmp12_;
				gboolean first = FALSE;
				gint next = 0;
				gunichar c = 0U;
				if (!_tmp8_) {
					gint _tmp9_;
					_tmp9_ = i;
					i = _tmp9_ + 1;
				}
				_tmp8_ = FALSE;
				if (!(i < count)) {
					break;
				}
				_tmp10_ = arr;
				_tmp10__length1 = arr_length1;
				_tmp11_ = _tmp10_[i];
				_tmp12_ = g_strdup (_tmp11_);
				str = _tmp12_;
				first = TRUE;
				next = 0;
				c = (gunichar) 0;
				while (TRUE) {
					const gchar* _tmp13_;
					gunichar _tmp14_ = 0U;
					gboolean _tmp15_;
					gchar* s = NULL;
					gchar* _tmp16_;
					_tmp13_ = str;
					_tmp15_ = string_get_next_char (_tmp13_, &next, &_tmp14_);
					c = _tmp14_;
					if (!_tmp15_) {
						break;
					}
					_tmp16_ = g_unichar_to_string (c);
					s = _tmp16_;
					if (first) {
						GString* _tmp17_;
						const gchar* _tmp18_;
						gchar* _tmp19_;
						gchar* _tmp20_;
						first = FALSE;
						_tmp17_ = sb;
						_tmp18_ = s;
						_tmp19_ = g_utf8_strup (_tmp18_, (gssize) -1);
						_tmp20_ = _tmp19_;
						g_string_append (_tmp17_, _tmp20_);
						_g_free0 (_tmp20_);
					} else {
						GString* _tmp21_;
						const gchar* _tmp22_;
						_tmp21_ = sb;
						_tmp22_ = s;
						g_string_append (_tmp21_, _tmp22_);
					}
					_g_free0 (s);
				}
				if (i < (count - 1)) {
					GString* _tmp23_;
					_tmp23_ = sb;
					g_string_append_c (_tmp23_, ' ');
				}
				_g_free0 (str);
			}
		}
	}
	_tmp24_ = sb;
	_tmp25_ = _tmp24_->str;
	_tmp26_ = g_strdup (_tmp25_);
	result = _tmp26_;
	arr = (_vala_array_free (arr, arr_length1, (GDestroyNotify) g_free), NULL);
	_g_string_free0 (sb);
	_g_free0 (text);
	return result;
}

static void
_g4_tag_list_dialog_copy_to_clipboard_gtk_button_clicked (GtkButton* _sender,
                                                          gpointer self)
{
	g4_tag_list_dialog_copy_to_clipboard ((G4TagListDialog*) self);
}

static void
___lambda157_ (G4TagListDialog* self,
               GObject* obj,
               GAsyncResult* res)
{
	g_return_if_fail (res != NULL);
	g4_tag_list_dialog_laod_tags_finish (self, res);
}

static void
____lambda157__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	___lambda157_ ((G4TagListDialog*) self, source_object, res);
	g_object_unref (self);
}

G4TagListDialog*
g4_tag_list_dialog_construct (GType object_type,
                              const gchar* uri,
                              GstTagList* tags)
{
	G4TagListDialog * self = NULL;
	GtkBox* content = NULL;
	GtkBox* _tmp0_;
	GtkBox* _tmp1_;
	GFile* _tmp2_;
	GtkHeaderBar* header = NULL;
	GtkHeaderBar* _tmp3_;
	GtkHeaderBar* _tmp4_;
	GtkHeaderBar* _tmp5_;
	GtkLabel* _tmp6_;
	GtkLabel* _tmp7_;
	GtkHeaderBar* _tmp8_;
	GtkBox* _tmp9_;
	GtkHeaderBar* _tmp10_;
	GtkButton* _tmp11_;
	GtkButton* _tmp12_;
	GtkHeaderBar* _tmp13_;
	GtkButton* _tmp14_;
	GtkSpinner* _tmp15_;
	GtkHeaderBar* _tmp16_;
	GtkSpinner* _tmp17_;
	GtkScrolledWindow* scroll_view = NULL;
	GtkScrolledWindow* _tmp18_;
	GtkScrolledWindow* _tmp19_;
	GtkScrolledWindow* _tmp20_;
	GtkScrolledWindow* _tmp21_;
	GtkScrolledWindow* _tmp22_;
	GtkBox* _tmp23_;
	GtkScrolledWindow* _tmp24_;
	GtkViewport* viewport = NULL;
	GtkScrolledWindow* _tmp25_;
	GtkAdjustment* _tmp26_;
	GtkAdjustment* _tmp27_;
	GtkViewport* _tmp28_;
	GtkViewport* _tmp29_;
	GtkBox* _tmp30_;
	GtkScrolledWindow* _tmp31_;
	GtkViewport* _tmp32_;
	g_return_val_if_fail (uri != NULL, NULL);
	self = (G4TagListDialog*) g4_dialog_construct (object_type);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp0_);
	content = _tmp0_;
	_tmp1_ = content;
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) _tmp1_);
	_tmp2_ = g_file_new_for_uri (uri);
	_g_object_unref0 (self->priv->file);
	self->priv->file = _tmp2_;
	_tmp3_ = (GtkHeaderBar*) gtk_header_bar_new ();
	g_object_ref_sink (_tmp3_);
	header = _tmp3_;
	_tmp4_ = header;
	gtk_header_bar_set_show_title_buttons (_tmp4_, TRUE);
	_tmp5_ = header;
	_tmp6_ = (GtkLabel*) gtk_label_new (NULL);
	g_object_ref_sink (_tmp6_);
	_tmp7_ = _tmp6_;
	gtk_header_bar_set_title_widget (_tmp5_, (GtkWidget*) _tmp7_);
	_g_object_unref0 (_tmp7_);
	_tmp8_ = header;
	gtk_widget_add_css_class ((GtkWidget*) _tmp8_, "flat");
	_tmp9_ = content;
	_tmp10_ = header;
	gtk_box_append (_tmp9_, (GtkWidget*) _tmp10_);
	_tmp11_ = self->priv->copy_btn;
	g_signal_connect_object (_tmp11_, "clicked", (GCallback) _g4_tag_list_dialog_copy_to_clipboard_gtk_button_clicked, self, 0);
	_tmp12_ = self->priv->copy_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp12_, _ ("Copy"));
	_tmp13_ = header;
	_tmp14_ = self->priv->copy_btn;
	gtk_header_bar_pack_start (_tmp13_, (GtkWidget*) _tmp14_);
	_tmp15_ = self->priv->spinner;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp15_, 6);
	_tmp16_ = header;
	_tmp17_ = self->priv->spinner;
	gtk_header_bar_pack_start (_tmp16_, (GtkWidget*) _tmp17_);
	_tmp18_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp18_);
	scroll_view = _tmp18_;
	_tmp19_ = scroll_view;
	g_object_set (_tmp19_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	_tmp20_ = scroll_view;
	g_object_set (_tmp20_, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL);
	_tmp21_ = scroll_view;
	gtk_scrolled_window_set_propagate_natural_height (_tmp21_, TRUE);
	_tmp22_ = scroll_view;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp22_, TRUE);
	_tmp23_ = content;
	_tmp24_ = scroll_view;
	gtk_box_append (_tmp23_, (GtkWidget*) _tmp24_);
	_tmp25_ = scroll_view;
	_tmp26_ = gtk_scrolled_window_get_vadjustment (_tmp25_);
	_tmp27_ = _tmp26_;
	_tmp28_ = (GtkViewport*) gtk_viewport_new (NULL, _tmp27_);
	g_object_ref_sink (_tmp28_);
	viewport = _tmp28_;
	_tmp29_ = viewport;
	_tmp30_ = self->priv->group;
	gtk_viewport_set_child (_tmp29_, (GtkWidget*) _tmp30_);
	_tmp31_ = scroll_view;
	_tmp32_ = viewport;
	gtk_scrolled_window_set_child (_tmp31_, (GtkWidget*) _tmp32_);
	if (tags != NULL) {
		g4_tag_list_dialog_load_tags (self, (GstTagList*) tags);
	} else {
		g4_tag_list_dialog_laod_tags_async (self, uri, ____lambda157__gasync_ready_callback, g_object_ref (self));
	}
	_g_object_unref0 (viewport);
	_g_object_unref0 (scroll_view);
	_g_object_unref0 (header);
	_g_object_unref0 (content);
	return self;
}

G4TagListDialog*
g4_tag_list_dialog_new (const gchar* uri,
                        GstTagList* tags)
{
	return g4_tag_list_dialog_construct (G4_TYPE_TAG_LIST_DIALOG, uri, tags);
}

static GtkListBox*
g4_tag_list_dialog_create_list_box (G4TagListDialog* self,
                                    GtkListBox* previous)
{
	GtkListBox* box = NULL;
	GtkListBox* _tmp0_;
	GtkListBox* _tmp1_;
	GtkListBox* _tmp2_;
	gint _tmp3_ = 0;
	GtkListBox* _tmp4_;
	GtkListBox* _tmp5_;
	GtkListBox* _tmp6_;
	GtkListBox* _tmp7_;
	GtkListBox* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp0_);
	box = _tmp0_;
	_tmp1_ = box;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp1_, 16);
	_tmp2_ = box;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp2_, 16);
	if (previous == NULL) {
		_tmp3_ = 8;
	} else {
		_tmp3_ = 0;
	}
	_tmp4_ = box;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp4_, _tmp3_);
	_tmp5_ = box;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp5_, 16);
	_tmp6_ = box;
	gtk_list_box_set_selection_mode (_tmp6_, GTK_SELECTION_NONE);
	_tmp7_ = box;
	gtk_widget_add_css_class ((GtkWidget*) _tmp7_, "boxed-list");
	result = box;
	return result;
}

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

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 void
g4_tag_list_dialog_copy_to_clipboard (G4TagListDialog* self)
{
	gchar* _tmp0_ = NULL;
	GFile* _tmp1_;
	gchar* _tmp2_;
	gchar* path = NULL;
	gchar* _tmp5_;
	GString* sb = NULL;
	const gchar* _tmp6_;
	GString* _tmp7_;
	GString* _tmp8_;
	GPtrArray* _tmp9_;
	GdkClipboard* _tmp22_;
	GString* _tmp23_;
	const gchar* _tmp24_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->file;
	_tmp2_ = g_file_get_path (_tmp1_);
	_tmp0_ = _tmp2_;
	if (_tmp0_ == NULL) {
		GFile* _tmp3_;
		gchar* _tmp4_;
		_tmp3_ = self->priv->file;
		_tmp4_ = g_file_get_parse_name (_tmp3_);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp4_;
	}
	_tmp5_ = _tmp0_;
	_tmp0_ = NULL;
	path = (gchar*) _tmp5_;
	_tmp6_ = path;
	_tmp7_ = g_string_new (_tmp6_);
	sb = _tmp7_;
	_tmp8_ = sb;
	g_string_append_c (_tmp8_, '\n');
	_tmp9_ = self->priv->items;
	{
		GPtrArray* ti_collection = NULL;
		guint ti_index = 0U;
		ti_collection = _tmp9_;
		for (ti_index = 0; ti_index < ti_collection->len; ti_index = ti_index + 1) {
			G4TagListDialogTagItem* _tmp10_;
			G4TagListDialogTagItem* ti = NULL;
			_tmp10_ = _g_object_ref0 ((G4TagListDialogTagItem*) g_ptr_array_index (ti_collection, ti_index));
			ti = _tmp10_;
			{
				GString* _tmp11_;
				G4TagListDialogTagItem* _tmp12_;
				const gchar* _tmp13_;
				const gchar* _tmp14_ = NULL;
				G4TagListDialogTagItem* _tmp15_;
				const gchar* _tmp16_;
				GString* _tmp17_;
				GString* _tmp18_;
				G4TagListDialogTagItem* _tmp19_;
				const gchar* _tmp20_;
				GString* _tmp21_;
				_tmp11_ = sb;
				_tmp12_ = ti;
				_tmp13_ = _tmp12_->tag;
				g_string_append (_tmp11_, _tmp13_);
				_tmp15_ = ti;
				_tmp16_ = _tmp15_->value;
				if (string_contains (_tmp16_, "\n")) {
					_tmp14_ = ":\n";
				} else {
					_tmp14_ = "=";
				}
				_tmp17_ = sb;
				g_string_append (_tmp17_, _tmp14_);
				_tmp18_ = sb;
				_tmp19_ = ti;
				_tmp20_ = _tmp19_->value;
				g_string_append (_tmp18_, _tmp20_);
				_tmp21_ = sb;
				g_string_append_c (_tmp21_, '\n');
				_g_object_unref0 (ti);
			}
		}
	}
	_tmp22_ = gtk_widget_get_clipboard ((GtkWidget*) self);
	_tmp23_ = sb;
	_tmp24_ = _tmp23_->str;
	gdk_clipboard_set_text (_tmp22_, _tmp24_);
	_g_string_free0 (sb);
	_g_free0 (path);
	_g_free0 (_tmp0_);
}

static void
g4_tag_list_dialog_laod_tags_async_data_free (gpointer _data)
{
	G4TagListDialogLaodTagsAsyncData* _data_;
	_data_ = _data;
	_g_free0 (_data_->uri);
	_g_object_unref0 (_data_->self);
	g_slice_free (G4TagListDialogLaodTagsAsyncData, _data_);
}

static void
g4_tag_list_dialog_laod_tags_async (G4TagListDialog* self,
                                    const gchar* uri,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	G4TagListDialogLaodTagsAsyncData* _data_;
	G4TagListDialog* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (uri != NULL);
	_data_ = g_slice_new0 (G4TagListDialogLaodTagsAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, g4_tag_list_dialog_laod_tags_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (uri);
	_g_free0 (_data_->uri);
	_data_->uri = _tmp1_;
	g4_tag_list_dialog_laod_tags_async_co (_data_);
}

static void
g4_tag_list_dialog_laod_tags_finish (G4TagListDialog* self,
                                     GAsyncResult* _res_)
{
	G4TagListDialogLaodTagsAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static GstTagList*
__lambda156_ (G4TagListDialog* self)
{
	GFile* _tmp0_;
	GstTagList* _tmp1_;
	GstTagList* result;
	_tmp0_ = self->priv->file;
	_tmp1_ = g4_parse_gst_tags (_tmp0_);
	result = _tmp1_;
	return result;
}

static gpointer
___lambda156__g4_task_func (gpointer self)
{
	gpointer result;
	result = __lambda156_ ((G4TagListDialog*) self);
	return result;
}

static void
g4_tag_list_dialog_laod_tags_async_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	G4TagListDialogLaodTagsAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	g4_tag_list_dialog_laod_tags_async_co (_data_);
}

static gboolean
g4_tag_list_dialog_laod_tags_async_co (G4TagListDialogLaodTagsAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = adw_dialog_get_child ((AdwDialog*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	g_object_set (_data_->_tmp1_, "height-request", 480, NULL);
	_data_->_tmp2_ = _data_->self->priv->copy_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp2_, FALSE);
	_data_->_tmp3_ = _data_->self->priv->spinner;
	gtk_spinner_start (_data_->_tmp3_);
	_data_->_state_ = 1;
	g4_run_async (gst_tag_list_get_type (), (GBoxedCopyFunc) gst_tag_list_ref, (GDestroyNotify) gst_tag_list_unref, ___lambda156__g4_task_func, _data_->self, FALSE, FALSE, g4_tag_list_dialog_laod_tags_async_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp4_ = g4_run_finish (_data_->_res_);
	_data_->tags = (GstTagList*) _data_->_tmp4_;
	_data_->_tmp5_ = _data_->tags;
	if (_data_->_tmp5_ != NULL) {
		_data_->_tmp6_ = _data_->tags;
		g4_tag_list_dialog_load_tags (_data_->self, (GstTagList*) _data_->_tmp6_);
	}
	_data_->_tmp7_ = _data_->self->priv->copy_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp7_, TRUE);
	_data_->_tmp8_ = _data_->self->priv->spinner;
	gtk_spinner_stop (_data_->_tmp8_);
	_gst_tag_list_unref0 (_data_->tags);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gint
vala_g_ptr_array_get_length (GPtrArray* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = (gint) self->len;
	return result;
}

static Block44Data*
block44_data_ref (Block44Data* _data44_)
{
	g_atomic_int_inc (&_data44_->_ref_count_);
	return _data44_;
}

static void
block44_data_unref (void * _userdata_)
{
	Block44Data* _data44_;
	_data44_ = (Block44Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data44_->_ref_count_)) {
		GPtrArray* self;
		self = _data44_->self;
		_g_ptr_array_unref0 (self);
		g_slice_free (Block44Data, _data44_);
	}
}

static gint
__lambda0_ (Block44Data* _data44_,
            gconstpointer** a,
            gconstpointer** b)
{
	GPtrArray* self;
	gint result;
	self = _data44_->self;
	result = _data44_->compare_func ((gconstpointer**) (*a), (gconstpointer**) (*b));
	return result;
}

static gint
___lambda0__gcompare_data_func (gconstpointer a,
                                gconstpointer b,
                                gpointer self)
{
	gint result;
	result = __lambda0_ (self, a, b);
	return result;
}

static void
vala_g_ptr_array_sort (GPtrArray* self,
                       GCompareFunc compare_func)
{
	Block44Data* _data44_;
	g_return_if_fail (self != NULL);
	_data44_ = g_slice_new0 (Block44Data);
	_data44_->_ref_count_ = 1;
	_data44_->self = g_ptr_array_ref (self);
	_data44_->compare_func = compare_func;
	g_ptr_array_sort_with_data (self, ___lambda0__gcompare_data_func, _data44_);
	block44_data_unref (_data44_);
	_data44_ = NULL;
}

static gint
_g4_tag_list_dialog_tag_item_compare_by_name_gcompare_func (gconstpointer a,
                                                            gconstpointer b)
{
	gint result;
	result = g4_tag_list_dialog_tag_item_compare_by_name ((G4TagListDialogTagItem*) a, (G4TagListDialogTagItem*) b);
	return result;
}

static void
g4_tag_list_dialog_load_tags (G4TagListDialog* self,
                              GstTagList* tags)
{
	G4TagListDialogTagItem* tag_track_count = NULL;
	G4TagListDialogTagItem* tag_track_number = NULL;
	G4TagListDialogTagItem* tag_volumn_count = NULL;
	G4TagListDialogTagItem* tag_volumn_number = NULL;
	gint count = 0;
	G4TagListDialogTagItem* _tmp39_;
	G4TagListDialogTagItem* _tmp52_;
	GPtrArray* _tmp65_;
	gint tag_group = 0;
	GtkListBox* list_box = NULL;
	GPtrArray* _tmp66_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tags != NULL);
	tag_track_count = NULL;
	tag_track_number = NULL;
	tag_volumn_count = NULL;
	tag_volumn_number = NULL;
	count = gst_tag_list_n_tags (tags);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				gchar* tag = NULL;
				const gchar* _tmp2_;
				gchar* _tmp3_;
				GPtrArray* values = NULL;
				GPtrArray* _tmp4_;
				const gchar* _tmp5_;
				GPtrArray* _tmp6_;
				GPtrArray* _tmp7_;
				gint _tmp8_;
				gint _tmp9_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(i < count)) {
					break;
				}
				_tmp2_ = gst_tag_list_nth_tag_name (tags, (guint) i);
				_tmp3_ = g_strdup (_tmp2_);
				tag = _tmp3_;
				_tmp4_ = g_ptr_array_new_full ((guint) 4, _g_free0_);
				values = _tmp4_;
				_tmp5_ = tag;
				_tmp6_ = values;
				g4_get_one_tag (tags, _tmp5_, _tmp6_);
				_tmp7_ = values;
				_tmp8_ = vala_g_ptr_array_get_length (_tmp7_);
				_tmp9_ = _tmp8_;
				if (_tmp9_ > 0) {
					GString* sb = NULL;
					GString* _tmp10_;
					gint size = 0;
					GPtrArray* _tmp11_;
					gint _tmp12_;
					gint _tmp13_;
					G4TagListDialogTagItem* ti = NULL;
					const gchar* _tmp20_;
					GString* _tmp21_;
					const gchar* _tmp22_;
					G4TagListDialogTagItem* _tmp23_;
					const gchar* _tmp24_;
					_tmp10_ = g_string_new ("");
					sb = _tmp10_;
					_tmp11_ = values;
					_tmp12_ = vala_g_ptr_array_get_length (_tmp11_);
					_tmp13_ = _tmp12_;
					size = _tmp13_;
					{
						gint j = 0;
						j = 0;
						{
							gboolean _tmp14_ = FALSE;
							_tmp14_ = TRUE;
							while (TRUE) {
								GString* _tmp16_;
								GPtrArray* _tmp17_;
								gconstpointer _tmp18_;
								if (!_tmp14_) {
									gint _tmp15_;
									_tmp15_ = j;
									j = _tmp15_ + 1;
								}
								_tmp14_ = FALSE;
								if (!(j < size)) {
									break;
								}
								_tmp16_ = sb;
								_tmp17_ = values;
								_tmp18_ = g_ptr_array_index (_tmp17_, (guint) j);
								g_string_append (_tmp16_, (const gchar*) _tmp18_);
								if (j != (size - 1)) {
									GString* _tmp19_;
									_tmp19_ = sb;
									g_string_append_c (_tmp19_, '\n');
								}
							}
						}
					}
					_tmp20_ = tag;
					_tmp21_ = sb;
					_tmp22_ = _tmp21_->str;
					_tmp23_ = g4_tag_list_dialog_tag_item_new (_tmp20_, _tmp22_);
					ti = _tmp23_;
					_tmp24_ = tag;
					if (g_strcmp0 (_tmp24_, GST_TAG_TRACK_COUNT) == 0) {
						G4TagListDialogTagItem* _tmp25_;
						G4TagListDialogTagItem* _tmp26_;
						_tmp25_ = ti;
						_tmp26_ = _g_object_ref0 (_tmp25_);
						_g_object_unref0 (tag_track_count);
						tag_track_count = _tmp26_;
					} else {
						const gchar* _tmp27_;
						_tmp27_ = tag;
						if (g_strcmp0 (_tmp27_, GST_TAG_TRACK_NUMBER) == 0) {
							G4TagListDialogTagItem* _tmp28_;
							G4TagListDialogTagItem* _tmp29_;
							_tmp28_ = ti;
							_tmp29_ = _g_object_ref0 (_tmp28_);
							_g_object_unref0 (tag_track_number);
							tag_track_number = _tmp29_;
						} else {
							const gchar* _tmp30_;
							_tmp30_ = tag;
							if (g_strcmp0 (_tmp30_, GST_TAG_ALBUM_VOLUME_COUNT) == 0) {
								G4TagListDialogTagItem* _tmp31_;
								G4TagListDialogTagItem* _tmp32_;
								_tmp31_ = ti;
								_tmp32_ = _g_object_ref0 (_tmp31_);
								_g_object_unref0 (tag_volumn_count);
								tag_volumn_count = _tmp32_;
							} else {
								const gchar* _tmp33_;
								_tmp33_ = tag;
								if (g_strcmp0 (_tmp33_, GST_TAG_ALBUM_VOLUME_NUMBER) == 0) {
									G4TagListDialogTagItem* _tmp34_;
									G4TagListDialogTagItem* _tmp35_;
									_tmp34_ = ti;
									_tmp35_ = _g_object_ref0 (_tmp34_);
									_g_object_unref0 (tag_volumn_number);
									tag_volumn_number = _tmp35_;
								} else {
									GPtrArray* _tmp36_;
									G4TagListDialogTagItem* _tmp37_;
									G4TagListDialogTagItem* _tmp38_;
									_tmp36_ = self->priv->items;
									_tmp37_ = ti;
									_tmp38_ = _g_object_ref0 (_tmp37_);
									g_ptr_array_add (_tmp36_, _tmp38_);
								}
							}
						}
					}
					_g_object_unref0 (ti);
					_g_string_free0 (sb);
				}
				_g_ptr_array_unref0 (values);
				_g_free0 (tag);
			}
		}
	}
	_tmp39_ = tag_track_number;
	if (_tmp39_ != NULL) {
		G4TagListDialogTagItem* _tmp40_;
		GPtrArray* _tmp49_;
		G4TagListDialogTagItem* _tmp50_;
		G4TagListDialogTagItem* _tmp51_;
		_tmp40_ = tag_track_count;
		if (_tmp40_ != NULL) {
			G4TagListDialogTagItem* _tmp41_;
			G4TagListDialogTagItem* _tmp42_;
			const gchar* _tmp43_;
			G4TagListDialogTagItem* _tmp44_;
			const gchar* _tmp45_;
			gchar* _tmp46_;
			gchar* _tmp47_;
			gchar* _tmp48_;
			_tmp41_ = tag_track_number;
			_tmp42_ = tag_track_number;
			_tmp43_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp42_, G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, G4TagListDialogTagItem)->value;
			_tmp44_ = tag_track_count;
			_tmp45_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp44_, G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, G4TagListDialogTagItem)->value;
			_tmp46_ = g_strconcat ("/", _tmp45_, NULL);
			_tmp47_ = _tmp46_;
			_tmp48_ = g_strconcat (_tmp43_, _tmp47_, NULL);
			_g_free0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp42_, G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, G4TagListDialogTagItem)->value);
			G_TYPE_CHECK_INSTANCE_CAST (_tmp42_, G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, G4TagListDialogTagItem)->value = _tmp48_;
			_g_free0 (_tmp47_);
		}
		_tmp49_ = self->priv->items;
		_tmp50_ = tag_track_number;
		_tmp51_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp50_, G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, G4TagListDialogTagItem));
		g_ptr_array_add (_tmp49_, _tmp51_);
	}
	_tmp52_ = tag_volumn_number;
	if (_tmp52_ != NULL) {
		G4TagListDialogTagItem* _tmp53_;
		GPtrArray* _tmp62_;
		G4TagListDialogTagItem* _tmp63_;
		G4TagListDialogTagItem* _tmp64_;
		_tmp53_ = tag_volumn_count;
		if (_tmp53_ != NULL) {
			G4TagListDialogTagItem* _tmp54_;
			G4TagListDialogTagItem* _tmp55_;
			const gchar* _tmp56_;
			G4TagListDialogTagItem* _tmp57_;
			const gchar* _tmp58_;
			gchar* _tmp59_;
			gchar* _tmp60_;
			gchar* _tmp61_;
			_tmp54_ = tag_volumn_number;
			_tmp55_ = tag_volumn_number;
			_tmp56_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp55_, G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, G4TagListDialogTagItem)->value;
			_tmp57_ = tag_volumn_count;
			_tmp58_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp57_, G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, G4TagListDialogTagItem)->value;
			_tmp59_ = g_strconcat ("/", _tmp58_, NULL);
			_tmp60_ = _tmp59_;
			_tmp61_ = g_strconcat (_tmp56_, _tmp60_, NULL);
			_g_free0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp55_, G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, G4TagListDialogTagItem)->value);
			G_TYPE_CHECK_INSTANCE_CAST (_tmp55_, G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, G4TagListDialogTagItem)->value = _tmp61_;
			_g_free0 (_tmp60_);
		}
		_tmp62_ = self->priv->items;
		_tmp63_ = tag_volumn_number;
		_tmp64_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp63_, G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, G4TagListDialogTagItem));
		g_ptr_array_add (_tmp62_, _tmp64_);
	}
	_tmp65_ = self->priv->items;
	vala_g_ptr_array_sort (_tmp65_, _g4_tag_list_dialog_tag_item_compare_by_name_gcompare_func);
	tag_group = -1;
	list_box = NULL;
	_tmp66_ = self->priv->items;
	{
		GPtrArray* ti_collection = NULL;
		guint ti_index = 0U;
		ti_collection = _tmp66_;
		for (ti_index = 0; ti_index < ti_collection->len; ti_index = ti_index + 1) {
			G4TagListDialogTagItem* _tmp67_;
			G4TagListDialogTagItem* ti = NULL;
			_tmp67_ = _g_object_ref0 ((G4TagListDialogTagItem*) g_ptr_array_index (ti_collection, ti_index));
			ti = _tmp67_;
			{
				AdwActionRow* row = NULL;
				AdwActionRow* _tmp68_;
				AdwActionRow* _tmp69_;
				G4TagListDialogTagItem* _tmp70_;
				const gchar* _tmp71_;
				AdwActionRow* _tmp72_;
				G4TagListDialogTagItem* _tmp73_;
				const gchar* _tmp74_;
				AdwActionRow* _tmp75_;
				AdwActionRow* _tmp76_;
				AdwActionRow* _tmp77_;
				G4TagListDialogTagItem* _tmp78_;
				const gchar* _tmp79_;
				AdwActionRow* _tmp80_;
				gboolean _tmp81_ = FALSE;
				G4TagListDialogTagItem* _tmp82_;
				GtkListBox* _tmp89_ = NULL;
				GtkListBox* _tmp90_;
				_tmp68_ = (AdwActionRow*) adw_action_row_new ();
				g_object_ref_sink (_tmp68_);
				row = _tmp68_;
				_tmp69_ = row;
				_tmp70_ = ti;
				_tmp71_ = _tmp70_->tag;
				adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp69_, _tmp71_);
				_tmp72_ = row;
				_tmp73_ = ti;
				_tmp74_ = _tmp73_->description;
				gtk_widget_set_tooltip_text ((GtkWidget*) _tmp72_, g_dgettext (G4_TAG_LIST_DIALOG_GST_DOMAIN, _tmp74_));
				_tmp75_ = row;
				adw_preferences_row_set_use_markup ((AdwPreferencesRow*) _tmp75_, FALSE);
				_tmp76_ = row;
				adw_action_row_set_subtitle_selectable (_tmp76_, TRUE);
				_tmp77_ = row;
				_tmp78_ = ti;
				_tmp79_ = _tmp78_->value;
				adw_action_row_set_subtitle (_tmp77_, _tmp79_);
				_tmp80_ = row;
				gtk_widget_add_css_class ((GtkWidget*) _tmp80_, "property");
				_tmp82_ = ti;
				if (tag_group != _tmp82_->group) {
					_tmp81_ = TRUE;
				} else {
					GtkListBox* _tmp83_;
					_tmp83_ = list_box;
					_tmp81_ = _tmp83_ == NULL;
				}
				if (_tmp81_) {
					G4TagListDialogTagItem* _tmp84_;
					GtkListBox* _tmp85_;
					GtkListBox* _tmp86_;
					GtkBox* _tmp87_;
					GtkListBox* _tmp88_;
					_tmp84_ = ti;
					tag_group = _tmp84_->group;
					_tmp85_ = list_box;
					_tmp86_ = g4_tag_list_dialog_create_list_box (self, _tmp85_);
					_g_object_unref0 (list_box);
					list_box = _tmp86_;
					_tmp87_ = self->priv->group;
					_tmp88_ = list_box;
					gtk_box_append (_tmp87_, (GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (_tmp88_, gtk_list_box_get_type (), GtkListBox));
				}
				_tmp90_ = list_box;
				_tmp89_ = _tmp90_;
				if (_tmp89_ != NULL) {
					AdwActionRow* _tmp91_;
					_tmp91_ = row;
					gtk_list_box_append (G_TYPE_CHECK_INSTANCE_CAST (_tmp89_, gtk_list_box_get_type (), GtkListBox), (GtkWidget*) _tmp91_);
				}
				_g_object_unref0 (row);
				_g_object_unref0 (ti);
			}
		}
	}
	_g_object_unref0 (list_box);
	_g_object_unref0 (tag_volumn_number);
	_g_object_unref0 (tag_volumn_count);
	_g_object_unref0 (tag_track_number);
	_g_object_unref0 (tag_track_count);
}

static inline gpointer
g4_tag_list_dialog_tag_item_get_instance_private (G4TagListDialogTagItem* self)
{
	return G_STRUCT_MEMBER_P (self, G4TagListDialogTagItem_private_offset);
}

G4TagListDialogTagItem*
g4_tag_list_dialog_tag_item_construct (GType object_type,
                                       const gchar* t,
                                       const gchar* v)
{
	G4TagListDialogTagItem * self = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_ = NULL;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* orig_key = NULL;
	GHashTable* _tmp7_;
	const gchar* _tmp8_;
	gconstpointer _tmp9_ = NULL;
	gconstpointer _tmp10_ = NULL;
	gboolean _tmp11_;
	g_return_val_if_fail (t != NULL, NULL);
	g_return_val_if_fail (v != NULL, NULL);
	self = (G4TagListDialogTagItem*) g_object_new (object_type, NULL);
	_tmp0_ = g4_tag_list_dialog_embellish_tag_name (t);
	_g_free0 (self->tag);
	self->tag = _tmp0_;
	_tmp1_ = g_strdup (v);
	_g_free0 (self->value);
	self->value = _tmp1_;
	_tmp3_ = gst_tag_get_description (t);
	_tmp2_ = _tmp3_;
	if (_tmp2_ == NULL) {
		_tmp2_ = "";
	}
	_tmp4_ = g_strdup ((const gchar*) _tmp2_);
	_g_free0 (self->description);
	self->description = _tmp4_;
	_tmp5_ = self->tag;
	_tmp6_ = g_utf8_collate_key_for_filename (_tmp5_, (gssize) -1);
	_g_free0 (self->priv->_key);
	self->priv->_key = _tmp6_;
	_tmp7_ = g4_tag_list_dialog_ORDERS;
	_tmp8_ = self->priv->_key;
	_tmp11_ = g_hash_table_lookup_extended (_tmp7_, _tmp8_, &_tmp9_, &_tmp10_);
	orig_key = (const gchar*) _tmp9_;
	self->priv->_order = (gint) ((gintptr) _tmp10_);
	if (_tmp11_) {
		self->group = G4_TAG_GROUP_BASIC;
	} else {
		gboolean _tmp12_ = FALSE;
		gboolean _tmp13_ = FALSE;
		gboolean _tmp14_ = FALSE;
		gboolean _tmp15_ = FALSE;
		self->priv->_order = G_MAXINT >> 1;
		if (string_contains (t, "bitrate")) {
			_tmp15_ = TRUE;
		} else {
			_tmp15_ = string_contains (t, "channel");
		}
		if (_tmp15_) {
			_tmp14_ = TRUE;
		} else {
			_tmp14_ = string_contains (t, "crc");
		}
		if (_tmp14_) {
			_tmp13_ = TRUE;
		} else {
			_tmp13_ = string_contains (t, "code");
		}
		if (_tmp13_) {
			_tmp12_ = TRUE;
		} else {
			_tmp12_ = string_contains (t, "format");
		}
		if (_tmp12_) {
			self->group = G4_TAG_GROUP_FORMAT;
		} else {
			if (string_contains (t, "sortname")) {
				self->group = G4_TAG_GROUP_SORT;
			} else {
				self->group = G4_TAG_GROUP_OTHER;
			}
		}
	}
	return self;
}

G4TagListDialogTagItem*
g4_tag_list_dialog_tag_item_new (const gchar* t,
                                 const gchar* v)
{
	return g4_tag_list_dialog_tag_item_construct (G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, t, v);
}

gint
g4_tag_list_dialog_tag_item_compare_by_name (G4TagListDialogTagItem* ti1,
                                             G4TagListDialogTagItem* ti2)
{
	gint ret = 0;
	gint result;
	g_return_val_if_fail (ti1 != NULL, -1);
	g_return_val_if_fail (ti2 != NULL, -1);
	ret = ti1->group - ti2->group;
	if (ret == 0) {
		ret = ti1->priv->_order - ti2->priv->_order;
	}
	if (ret == 0) {
		GCompareFunc _tmp0_;
		const gchar* _tmp1_;
		const gchar* _tmp2_;
		_tmp0_ = ((GCompareFunc) g_strcmp0);
		_tmp1_ = ti1->priv->_key;
		_tmp2_ = ti2->priv->_key;
		ret = _tmp0_ (_tmp1_, _tmp2_);
	}
	result = ret;
	return result;
}

static void
g4_tag_list_dialog_tag_item_class_init (G4TagListDialogTagItemClass * klass,
                                        gpointer klass_data)
{
	g4_tag_list_dialog_tag_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &G4TagListDialogTagItem_private_offset);
	G_OBJECT_CLASS (klass)->finalize = g4_tag_list_dialog_tag_item_finalize;
}

static void
g4_tag_list_dialog_tag_item_instance_init (G4TagListDialogTagItem * self,
                                           gpointer klass)
{
	self->priv = g4_tag_list_dialog_tag_item_get_instance_private (self);
}

static void
g4_tag_list_dialog_tag_item_finalize (GObject * obj)
{
	G4TagListDialogTagItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TAG_LIST_DIALOG_TYPE_TAG_ITEM, G4TagListDialogTagItem);
	_g_free0 (self->tag);
	_g_free0 (self->value);
	_g_free0 (self->description);
	_g_free0 (self->priv->_key);
	G_OBJECT_CLASS (g4_tag_list_dialog_tag_item_parent_class)->finalize (obj);
}

static GType
g4_tag_list_dialog_tag_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4TagListDialogTagItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_tag_list_dialog_tag_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4TagListDialogTagItem), 0, (GInstanceInitFunc) g4_tag_list_dialog_tag_item_instance_init, NULL };
	GType g4_tag_list_dialog_tag_item_type_id;
	g4_tag_list_dialog_tag_item_type_id = g_type_register_static (G_TYPE_OBJECT, "G4TagListDialogTagItem", &g_define_type_info, 0);
	G4TagListDialogTagItem_private_offset = g_type_add_instance_private (g4_tag_list_dialog_tag_item_type_id, sizeof (G4TagListDialogTagItemPrivate));
	return g4_tag_list_dialog_tag_item_type_id;
}

GType
g4_tag_list_dialog_tag_item_get_type (void)
{
	static volatile gsize g4_tag_list_dialog_tag_item_type_id__once = 0;
	if (g_once_init_enter (&g4_tag_list_dialog_tag_item_type_id__once)) {
		GType g4_tag_list_dialog_tag_item_type_id;
		g4_tag_list_dialog_tag_item_type_id = g4_tag_list_dialog_tag_item_get_type_once ();
		g_once_init_leave (&g4_tag_list_dialog_tag_item_type_id__once, g4_tag_list_dialog_tag_item_type_id);
	}
	return g4_tag_list_dialog_tag_item_type_id__once;
}

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

void
g4_tag_list_dialog_tag_order_free (G4TagListDialogTagOrder* self)
{
	g_free (self);
}

static GType
g4_tag_list_dialog_tag_order_get_type_once (void)
{
	GType g4_tag_list_dialog_tag_order_type_id;
	g4_tag_list_dialog_tag_order_type_id = g_boxed_type_register_static ("G4TagListDialogTagOrder", (GBoxedCopyFunc) g4_tag_list_dialog_tag_order_dup, (GBoxedFreeFunc) g4_tag_list_dialog_tag_order_free);
	return g4_tag_list_dialog_tag_order_type_id;
}

GType
g4_tag_list_dialog_tag_order_get_type (void)
{
	static volatile gsize g4_tag_list_dialog_tag_order_type_id__once = 0;
	if (g_once_init_enter (&g4_tag_list_dialog_tag_order_type_id__once)) {
		GType g4_tag_list_dialog_tag_order_type_id;
		g4_tag_list_dialog_tag_order_type_id = g4_tag_list_dialog_tag_order_get_type_once ();
		g_once_init_leave (&g4_tag_list_dialog_tag_order_type_id__once, g4_tag_list_dialog_tag_order_type_id);
	}
	return g4_tag_list_dialog_tag_order_type_id__once;
}

static void
g4_tag_list_dialog_class_init (G4TagListDialogClass * klass,
                               gpointer klass_data)
{
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	G4TagListDialogTagOrder* tag_orders = NULL;
	G4TagListDialogTagOrder _tmp3_ = {0};
	G4TagListDialogTagOrder _tmp4_ = {0};
	G4TagListDialogTagOrder _tmp5_ = {0};
	G4TagListDialogTagOrder _tmp6_ = {0};
	G4TagListDialogTagOrder _tmp7_ = {0};
	G4TagListDialogTagOrder _tmp8_ = {0};
	G4TagListDialogTagOrder _tmp9_ = {0};
	G4TagListDialogTagOrder _tmp10_ = {0};
	G4TagListDialogTagOrder _tmp11_ = {0};
	G4TagListDialogTagOrder _tmp12_ = {0};
	G4TagListDialogTagOrder _tmp13_ = {0};
	G4TagListDialogTagOrder* _tmp14_;
	gint tag_orders_length1;
	gint _tag_orders_size_;
	G4TagListDialogTagOrder* _tmp15_;
	gint _tmp15__length1;
	g4_tag_list_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &G4TagListDialog_private_offset);
	G_OBJECT_CLASS (klass)->finalize = g4_tag_list_dialog_finalize;
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, NULL);
	g4_tag_list_dialog_ORDERS = _tmp2_;
	bindtextdomain (G4_TAG_LIST_DIALOG_GST_DOMAIN, NULL);
	bind_textdomain_codeset (G4_TAG_LIST_DIALOG_GST_DOMAIN, "UTF-8");
	memset (&_tmp3_, 0, sizeof (G4TagListDialogTagOrder));
	_tmp3_.tag = GST_TAG_TITLE;
	_tmp3_.order = 1;
	memset (&_tmp4_, 0, sizeof (G4TagListDialogTagOrder));
	_tmp4_.tag = GST_TAG_ARTIST;
	_tmp4_.order = 2;
	memset (&_tmp5_, 0, sizeof (G4TagListDialogTagOrder));
	_tmp5_.tag = GST_TAG_ALBUM;
	_tmp5_.order = 3;
	memset (&_tmp6_, 0, sizeof (G4TagListDialogTagOrder));
	_tmp6_.tag = GST_TAG_ALBUM_ARTIST;
	_tmp6_.order = 4;
	memset (&_tmp7_, 0, sizeof (G4TagListDialogTagOrder));
	_tmp7_.tag = GST_TAG_COMPOSER;
	_tmp7_.order = 5;
	memset (&_tmp8_, 0, sizeof (G4TagListDialogTagOrder));
	_tmp8_.tag = GST_TAG_GENRE;
	_tmp8_.order = 6;
	memset (&_tmp9_, 0, sizeof (G4TagListDialogTagOrder));
	_tmp9_.tag = GST_TAG_DATE_TIME;
	_tmp9_.order = 7;
	memset (&_tmp10_, 0, sizeof (G4TagListDialogTagOrder));
	_tmp10_.tag = GST_TAG_TRACK_NUMBER;
	_tmp10_.order = 8;
	memset (&_tmp11_, 0, sizeof (G4TagListDialogTagOrder));
	_tmp11_.tag = GST_TAG_ALBUM_VOLUME_NUMBER;
	_tmp11_.order = 9;
	memset (&_tmp12_, 0, sizeof (G4TagListDialogTagOrder));
	_tmp12_.tag = GST_TAG_COMMENT;
	_tmp12_.order = G_MAXINT - 1;
	memset (&_tmp13_, 0, sizeof (G4TagListDialogTagOrder));
	_tmp13_.tag = GST_TAG_EXTENDED_COMMENT;
	_tmp13_.order = G_MAXINT;
	_tmp14_ = g_new0 (G4TagListDialogTagOrder, 11);
	_tmp14_[0] = _tmp3_;
	_tmp14_[1] = _tmp4_;
	_tmp14_[2] = _tmp5_;
	_tmp14_[3] = _tmp6_;
	_tmp14_[4] = _tmp7_;
	_tmp14_[5] = _tmp8_;
	_tmp14_[6] = _tmp9_;
	_tmp14_[7] = _tmp10_;
	_tmp14_[8] = _tmp11_;
	_tmp14_[9] = _tmp12_;
	_tmp14_[10] = _tmp13_;
	tag_orders = _tmp14_;
	tag_orders_length1 = 11;
	_tag_orders_size_ = tag_orders_length1;
	_tmp15_ = tag_orders;
	_tmp15__length1 = tag_orders_length1;
	{
		G4TagListDialogTagOrder* to_collection = NULL;
		gint to_collection_length1 = 0;
		gint _to_collection_size_ = 0;
		gint to_it = 0;
		to_collection = _tmp15_;
		to_collection_length1 = _tmp15__length1;
		for (to_it = 0; to_it < to_collection_length1; to_it = to_it + 1) {
			G4TagListDialogTagOrder to = {0};
			to = to_collection[to_it];
			{
				GHashTable* _tmp16_;
				G4TagListDialogTagOrder _tmp17_;
				const gchar* _tmp18_;
				gchar* _tmp19_;
				gchar* _tmp20_;
				gchar* _tmp21_;
				G4TagListDialogTagOrder _tmp22_;
				_tmp16_ = g4_tag_list_dialog_ORDERS;
				_tmp17_ = to;
				_tmp18_ = _tmp17_.tag;
				_tmp19_ = g4_tag_list_dialog_embellish_tag_name (_tmp18_);
				_tmp20_ = _tmp19_;
				_tmp21_ = g_utf8_collate_key_for_filename (_tmp20_, (gssize) -1);
				_tmp22_ = to;
				g_hash_table_insert (_tmp16_, _tmp21_, (gpointer) ((gintptr) _tmp22_.order));
				_g_free0 (_tmp20_);
			}
		}
	}
	tag_orders = (g_free (tag_orders), NULL);
}

static void
g4_tag_list_dialog_instance_init (G4TagListDialog * self,
                                  gpointer klass)
{
	GPtrArray* _tmp0_;
	GtkButton* _tmp1_;
	GtkBox* _tmp2_;
	GtkSpinner* _tmp3_;
	self->priv = g4_tag_list_dialog_get_instance_private (self);
	_tmp0_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	self->priv->items = _tmp0_;
	_tmp1_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-copy-symbolic");
	g_object_ref_sink (_tmp1_);
	self->priv->copy_btn = _tmp1_;
	_tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp2_);
	self->priv->group = _tmp2_;
	_tmp3_ = (GtkSpinner*) gtk_spinner_new ();
	g_object_ref_sink (_tmp3_);
	self->priv->spinner = _tmp3_;
}

static void
g4_tag_list_dialog_finalize (GObject * obj)
{
	G4TagListDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TYPE_TAG_LIST_DIALOG, G4TagListDialog);
	_g_object_unref0 (self->priv->file);
	_g_ptr_array_unref0 (self->priv->items);
	_g_object_unref0 (self->priv->copy_btn);
	_g_object_unref0 (self->priv->group);
	_g_object_unref0 (self->priv->spinner);
	G_OBJECT_CLASS (g4_tag_list_dialog_parent_class)->finalize (obj);
}

static GType
g4_tag_list_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4TagListDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_tag_list_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4TagListDialog), 0, (GInstanceInitFunc) g4_tag_list_dialog_instance_init, NULL };
	GType g4_tag_list_dialog_type_id;
	g4_tag_list_dialog_type_id = g_type_register_static (G4_TYPE_DIALOG, "G4TagListDialog", &g_define_type_info, 0);
	G4TagListDialog_private_offset = g_type_add_instance_private (g4_tag_list_dialog_type_id, sizeof (G4TagListDialogPrivate));
	return g4_tag_list_dialog_type_id;
}

GType
g4_tag_list_dialog_get_type (void)
{
	static volatile gsize g4_tag_list_dialog_type_id__once = 0;
	if (g_once_init_enter (&g4_tag_list_dialog_type_id__once)) {
		GType g4_tag_list_dialog_type_id;
		g4_tag_list_dialog_type_id = g4_tag_list_dialog_get_type_once ();
		g_once_init_leave (&g4_tag_list_dialog_type_id__once, g4_tag_list_dialog_type_id);
	}
	return g4_tag_list_dialog_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;
}

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

