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

#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <glib-object.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.h>
#include <gio/gio.h>
#include <pango/pango.h>
#include <glib/gi18n-lib.h>

#define G4_PAGE_NAME_ALBUM "album"
#define G4_PAGE_NAME_ARTIST "artist"
#define G4_PAGE_NAME_PLAYING "playing"
#define G4_PAGE_NAME_PLAYLIST "playlist"
#define G4_SORT_MODE_ALBUM ((guint) 0)
#define G4_SORT_MODE_ARTIST ((guint) 1)
#define G4_SORT_MODE_ARTIST_ALBUM ((guint) 2)
#define G4_SORT_MODE_RECENT ((guint) 4)
#define G4_LIBRARY_SCHEME "library://"
#define G4_ACTION_APP "app."
#define G4_ACTION_PLAY "play"
#define G4_ACTION_RANDOM_PLAY "random-play"
#define G4_ACTION_PLAY_AT_NEXT "play-at-next"
#define G4_ACTION_ADD_TO_QUEUE "add-to-queue"
#define G4_ACTION_ADD_TO_PLAYLIST "add-to-playlist"
#define G4_ACTION_SHOW_FILE "show-file"
#define G4_ACTION_TRASH_FILE "trash-file"
#define G4_ACTION_WIN "win."
#define G4_ACTION_SEARCH "search"
#define G4_ACTION_EXPORT_COVER "export-cover"
#define G4_ACTION_SHOW_TAGS "show-tags"
#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_MUSIC_WIDGET (g4_music_widget_get_type ())
#define G4_MUSIC_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_MUSIC_WIDGET, G4MusicWidget))
#define G4_MUSIC_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_MUSIC_WIDGET, G4MusicWidgetClass))
#define G4_IS_MUSIC_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_MUSIC_WIDGET))
#define G4_IS_MUSIC_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_MUSIC_WIDGET))
#define G4_MUSIC_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_MUSIC_WIDGET, G4MusicWidgetClass))

typedef struct _G4MusicWidget G4MusicWidget;
typedef struct _G4MusicWidgetClass G4MusicWidgetClass;
typedef struct _G4MusicWidgetPrivate G4MusicWidgetPrivate;

#define G4_TYPE_STABLE_LABEL (g4_stable_label_get_type ())
#define G4_STABLE_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_STABLE_LABEL, G4StableLabel))
#define G4_STABLE_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_STABLE_LABEL, G4StableLabelClass))
#define G4_IS_STABLE_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_STABLE_LABEL))
#define G4_IS_STABLE_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_STABLE_LABEL))
#define G4_STABLE_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_STABLE_LABEL, G4StableLabelClass))

typedef struct _G4StableLabel G4StableLabel;
typedef struct _G4StableLabelClass G4StableLabelClass;

#define G4_TYPE_BASE_PAINTABLE (g4_base_paintable_get_type ())
#define G4_BASE_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_BASE_PAINTABLE, G4BasePaintable))
#define G4_BASE_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_BASE_PAINTABLE, G4BasePaintableClass))
#define G4_IS_BASE_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_BASE_PAINTABLE))
#define G4_IS_BASE_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_BASE_PAINTABLE))
#define G4_BASE_PAINTABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_BASE_PAINTABLE, G4BasePaintableClass))

typedef struct _G4BasePaintable G4BasePaintable;
typedef struct _G4BasePaintableClass G4BasePaintableClass;

#define G4_TYPE_ROUND_PAINTABLE (g4_round_paintable_get_type ())
#define G4_ROUND_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_ROUND_PAINTABLE, G4RoundPaintable))
#define G4_ROUND_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_ROUND_PAINTABLE, G4RoundPaintableClass))
#define G4_IS_ROUND_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_ROUND_PAINTABLE))
#define G4_IS_ROUND_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_ROUND_PAINTABLE))
#define G4_ROUND_PAINTABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_ROUND_PAINTABLE, G4RoundPaintableClass))

typedef struct _G4RoundPaintable G4RoundPaintable;
typedef struct _G4RoundPaintableClass G4RoundPaintableClass;

#define G4_TYPE_MUSIC (g4_music_get_type ())
#define G4_MUSIC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_MUSIC, G4Music))
#define G4_MUSIC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_MUSIC, G4MusicClass))
#define G4_IS_MUSIC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_MUSIC))
#define G4_IS_MUSIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_MUSIC))
#define G4_MUSIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_MUSIC, G4MusicClass))

typedef struct _G4Music G4Music;
typedef struct _G4MusicClass G4MusicClass;
enum  {
	G4_MUSIC_WIDGET_0_PROPERTY,
	G4_MUSIC_WIDGET_COVER_PROPERTY,
	G4_MUSIC_WIDGET_IMAGE_PROPERTY,
	G4_MUSIC_WIDGET_PAINTABLE_PROPERTY,
	G4_MUSIC_WIDGET_PLAYING_PROPERTY,
	G4_MUSIC_WIDGET_TITLE_PROPERTY,
	G4_MUSIC_WIDGET_SUBTITLE_PROPERTY,
	G4_MUSIC_WIDGET_NUM_PROPERTIES
};
static GParamSpec* g4_music_widget_properties[G4_MUSIC_WIDGET_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	G4_MUSIC_WIDGET_CREATE_MUSIC_MENU_SIGNAL,
	G4_MUSIC_WIDGET_NUM_SIGNALS
};
static guint g4_music_widget_signals[G4_MUSIC_WIDGET_NUM_SIGNALS] = {0};

#define G4_TYPE_MUSIC_CELL (g4_music_cell_get_type ())
#define G4_MUSIC_CELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_MUSIC_CELL, G4MusicCell))
#define G4_MUSIC_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_MUSIC_CELL, G4MusicCellClass))
#define G4_IS_MUSIC_CELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_MUSIC_CELL))
#define G4_IS_MUSIC_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_MUSIC_CELL))
#define G4_MUSIC_CELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_MUSIC_CELL, G4MusicCellClass))

typedef struct _G4MusicCell G4MusicCell;
typedef struct _G4MusicCellClass G4MusicCellClass;
typedef struct _G4MusicCellPrivate G4MusicCellPrivate;
enum  {
	G4_MUSIC_CELL_0_PROPERTY,
	G4_MUSIC_CELL_NUM_PROPERTIES
};
static GParamSpec* g4_music_cell_properties[G4_MUSIC_CELL_NUM_PROPERTIES];
typedef enum  {
	G4_ELLIPSIZE_MODE_NONE = PANGO_ELLIPSIZE_NONE,
	G4_ELLIPSIZE_MODE_START = PANGO_ELLIPSIZE_START,
	G4_ELLIPSIZE_MODE_MIDDLE = PANGO_ELLIPSIZE_MIDDLE,
	G4_ELLIPSIZE_MODE_END = PANGO_ELLIPSIZE_END,
	G4_ELLIPSIZE_MODE_MARQUEE
} G4EllipsizeMode;

#define G4_TYPE_ELLIPSIZE_MODE (g4_ellipsize_mode_get_type ())

#define G4_TYPE_MUSIC_ENTRY (g4_music_entry_get_type ())
#define G4_MUSIC_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_MUSIC_ENTRY, G4MusicEntry))
#define G4_MUSIC_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_MUSIC_ENTRY, G4MusicEntryClass))
#define G4_IS_MUSIC_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_MUSIC_ENTRY))
#define G4_IS_MUSIC_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_MUSIC_ENTRY))
#define G4_MUSIC_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_MUSIC_ENTRY, G4MusicEntryClass))

typedef struct _G4MusicEntry G4MusicEntry;
typedef struct _G4MusicEntryClass G4MusicEntryClass;
typedef struct _G4MusicEntryPrivate G4MusicEntryPrivate;
enum  {
	G4_MUSIC_ENTRY_0_PROPERTY,
	G4_MUSIC_ENTRY_NUM_PROPERTIES
};
static GParamSpec* g4_music_entry_properties[G4_MUSIC_ENTRY_NUM_PROPERTIES];
typedef struct _G4MusicPrivate G4MusicPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))

#define G4_TYPE_ALBUM (g4_album_get_type ())
#define G4_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_ALBUM, G4Album))
#define G4_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_ALBUM, G4AlbumClass))
#define G4_IS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_ALBUM))
#define G4_IS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_ALBUM))
#define G4_ALBUM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_ALBUM, G4AlbumClass))

typedef struct _G4Album G4Album;
typedef struct _G4AlbumClass G4AlbumClass;

#define G4_TYPE_PLAYLIST (g4_playlist_get_type ())
#define G4_PLAYLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_PLAYLIST, G4Playlist))
#define G4_PLAYLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_PLAYLIST, G4PlaylistClass))
#define G4_IS_PLAYLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_PLAYLIST))
#define G4_IS_PLAYLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_PLAYLIST))
#define G4_PLAYLIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_PLAYLIST, G4PlaylistClass))

typedef struct _G4Playlist G4Playlist;
typedef struct _G4PlaylistClass G4PlaylistClass;

#define G4_TYPE_ARTIST (g4_artist_get_type ())
#define G4_ARTIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_ARTIST, G4Artist))
#define G4_ARTIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_ARTIST, G4ArtistClass))
#define G4_IS_ARTIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_ARTIST))
#define G4_IS_ARTIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_ARTIST))
#define G4_ARTIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_ARTIST, G4ArtistClass))

typedef struct _G4Artist G4Artist;
typedef struct _G4ArtistClass G4ArtistClass;
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _G4AlbumPrivate G4AlbumPrivate;
typedef struct _G4PlaylistPrivate G4PlaylistPrivate;
typedef void (*G4Pressed) (GtkWidget* widget, gdouble x, gdouble y, gpointer user_data);
typedef struct _Block27Data Block27Data;
typedef struct _Block28Data Block28Data;

struct _G4MusicWidget {
	GtkBox parent_instance;
	G4MusicWidgetPrivate * priv;
	GtkImage* _image;
	G4StableLabel* _title;
	G4StableLabel* _subtitle;
	G4RoundPaintable* _paintable;
	GtkImage* _playing;
	gulong first_draw_handler;
	G4Music* music;
};

struct _G4MusicWidgetClass {
	GtkBoxClass parent_class;
};

struct _G4MusicCell {
	G4MusicWidget parent_instance;
	G4MusicCellPrivate * priv;
};

struct _G4MusicCellClass {
	G4MusicWidgetClass parent_class;
};

struct _G4MusicEntry {
	G4MusicWidget parent_instance;
	G4MusicEntryPrivate * priv;
};

struct _G4MusicEntryClass {
	G4MusicWidgetClass parent_class;
};

struct _G4Music {
	GObject parent_instance;
	G4MusicPrivate * priv;
	gchar* album;
	gchar* artist;
	gchar* title;
	gchar* album_artist;
	guint32 date;
	gchar* genre;
	gint track;
	gint disc;
	gboolean has_cover;
	gint64 modified_time;
	gchar* uri;
	gchar* cover_uri;
	gchar* _album_key;
	gchar* _artist_key;
	gchar* _title_key;
	gint _order;
};

struct _G4MusicClass {
	GObjectClass parent_class;
	gchar* (*get_abbreviation) (G4Music* self);
};

struct _G4Album {
	G4Music parent_instance;
	G4AlbumPrivate * priv;
	GHashTable* _musics;
};

struct _G4AlbumClass {
	G4MusicClass parent_class;
	void (*get_sorted_musics) (G4Album* self, GPtrArray* musics);
	void (*sort) (G4Album* self, GPtrArray* arr);
};

struct _G4Playlist {
	G4Album parent_instance;
	G4PlaylistPrivate * priv;
	GPtrArray* items;
	gchar* list_uri;
};

struct _G4PlaylistClass {
	G4AlbumClass parent_class;
};

struct _Block27Data {
	int _ref_count_;
	GtkWidget* widget;
	G4Pressed pressed;
	gpointer pressed_target;
};

struct _Block28Data {
	int _ref_count_;
	GtkWidget* widget;
	G4Pressed pressed;
	gpointer pressed_target;
};

static gpointer g4_music_widget_parent_class = NULL;
static gpointer g4_music_cell_parent_class = NULL;
static gpointer g4_music_entry_parent_class = NULL;

VALA_EXTERN GType g4_music_widget_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4MusicWidget, g_object_unref)
VALA_EXTERN GType g4_stable_label_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4StableLabel, g_object_unref)
VALA_EXTERN GType g4_base_paintable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4BasePaintable, g_object_unref)
VALA_EXTERN GType g4_round_paintable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4RoundPaintable, g_object_unref)
VALA_EXTERN GType g4_music_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4Music, g_object_unref)
VALA_EXTERN G4StableLabel* g4_stable_label_new (void);
VALA_EXTERN G4StableLabel* g4_stable_label_construct (GType object_type);
VALA_EXTERN G4RoundPaintable* g4_round_paintable_new (GdkPaintable* paintable,
                                          gdouble ratio);
VALA_EXTERN G4RoundPaintable* g4_round_paintable_construct (GType object_type,
                                                GdkPaintable* paintable,
                                                gdouble ratio);
VALA_EXTERN G4MusicWidget* g4_music_widget_new (void);
VALA_EXTERN G4MusicWidget* g4_music_widget_construct (GType object_type);
VALA_EXTERN void g4_music_widget_disconnect_first_draw (G4MusicWidget* self);
VALA_EXTERN void g4_music_widget_show_popover_menu (G4MusicWidget* self,
                                        GtkWidget* widget,
                                        gdouble x,
                                        gdouble y);
VALA_EXTERN GtkPopoverMenu* g4_create_popover_menu (GMenu* menu,
                                        gdouble x,
                                        gdouble y);
VALA_EXTERN G4RoundPaintable* g4_music_widget_get_cover (G4MusicWidget* self);
VALA_EXTERN GtkImage* g4_music_widget_get_image (G4MusicWidget* self);
VALA_EXTERN void g4_music_widget_set_paintable (G4MusicWidget* self,
                                    GdkPaintable* value);
VALA_EXTERN void g4_base_paintable_set_paintable (G4BasePaintable* self,
                                      GdkPaintable* value);
VALA_EXTERN GtkImage* g4_music_widget_get_playing (G4MusicWidget* self);
VALA_EXTERN void g4_music_widget_set_title (G4MusicWidget* self,
                                const gchar* value);
VALA_EXTERN void g4_stable_label_set_label (G4StableLabel* self,
                                const gchar* value);
VALA_EXTERN void g4_music_widget_set_subtitle (G4MusicWidget* self,
                                   const gchar* value);
static void g_cclosure_user_marshal_OBJECT__OBJECT (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data);
static void g4_music_widget_finalize (GObject * obj);
static GType g4_music_widget_get_type_once (void);
static void _vala_g4_music_widget_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec);
static void _vala_g4_music_widget_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec);
VALA_EXTERN GType g4_music_cell_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4MusicCell, g_object_unref)
VALA_EXTERN G4MusicCell* g4_music_cell_new (void);
VALA_EXTERN G4MusicCell* g4_music_cell_construct (GType object_type);
static void _gtk_widget_queue_draw_g4_base_paintable_queue_draw (G4BasePaintable* _sender,
                                                          gpointer self);
VALA_EXTERN GType g4_ellipsize_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void g4_stable_label_set_ellipsize (G4StableLabel* self,
                                    G4EllipsizeMode value);
static GType g4_music_cell_get_type_once (void);
VALA_EXTERN GType g4_music_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4MusicEntry, g_object_unref)
VALA_EXTERN G4MusicEntry* g4_music_entry_new (gboolean compact);
VALA_EXTERN G4MusicEntry* g4_music_entry_construct (GType object_type,
                                        gboolean compact);
VALA_EXTERN void g4_music_entry_set_titles (G4MusicEntry* self,
                                G4Music* music,
                                guint sort);
static GType g4_music_entry_get_type_once (void);
VALA_EXTERN GType g4_album_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4Album, g_object_unref)
VALA_EXTERN gchar** g4_build_action_target_for_album (G4Album* album,
                                          gint* result_length1);
VALA_EXTERN const gchar* g4_music_get_album_key (G4Music* self);
VALA_EXTERN GType g4_playlist_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4Playlist, g_object_unref)
VALA_EXTERN GType g4_artist_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4Artist, g_object_unref)
VALA_EXTERN gchar* g4_build_library_uri (G4Artist* artist,
                             G4Album* album);
VALA_EXTERN const gchar* g4_music_get_artist_name (G4Music* self);
VALA_EXTERN gchar* g4_build_library_uri_from_sa (gchar** arr,
                                     gint arr_length1);
VALA_EXTERN gboolean g4_parse_library_uri (const gchar* uri_str,
                               gchar** artist,
                               gchar** album,
                               gchar** playlist,
                               gchar** host);
VALA_EXTERN GMenuItem* g4_create_menu_item_for_strv (gchar** strv,
                                         gint strv_length1,
                                         const gchar* label,
                                         const gchar* action);
VALA_EXTERN GMenuItem* g4_create_menu_item_for_uri (const gchar* uri,
                                        const gchar* label,
                                        const gchar* action);
VALA_EXTERN GMenu* g4_create_menu_for_album (G4Album* album);
VALA_EXTERN GMenu* g4_create_menu_for_artist (G4Artist* artist);
VALA_EXTERN GMenu* g4_create_menu_for_music (G4Music* music,
                                 gboolean has_cover);
VALA_EXTERN GtkGestureLongPress* g4_make_long_pressable (GtkWidget* widget,
                                             G4Pressed pressed,
                                             gpointer pressed_target);
static Block27Data* block27_data_ref (Block27Data* _data27_);
static void block27_data_unref (void * _userdata_);
static void __lambda93_ (Block27Data* _data27_,
                  gdouble x,
                  gdouble y);
static void ___lambda93__gtk_gesture_long_press_pressed (GtkGestureLongPress* _sender,
                                                  gdouble x,
                                                  gdouble y,
                                                  gpointer self);
VALA_EXTERN GtkGestureClick* g4_make_right_clickable (GtkWidget* widget,
                                          G4Pressed pressed,
                                          gpointer pressed_target);
static Block28Data* block28_data_ref (Block28Data* _data28_);
static void block28_data_unref (void * _userdata_);
static void __lambda92_ (Block28Data* _data28_,
                  gint n,
                  gdouble x,
                  gdouble y);
static void ___lambda92__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                             gint n_press,
                                             gdouble x,
                                             gdouble y,
                                             gpointer self);
VALA_EXTERN void g4_remove_controllers (GtkWidget* widget);
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);

G4MusicWidget*
g4_music_widget_construct (GType object_type)
{
	G4MusicWidget * self = NULL;
	GtkImage* _tmp0_;
	GtkImage* _tmp1_;
	GtkImage* _tmp2_;
	GtkImage* _tmp3_;
	GtkImage* _tmp4_;
	GtkImage* _tmp5_;
	GtkImage* _tmp6_;
	self = (G4MusicWidget*) g_object_new (object_type, NULL);
	_tmp0_ = self->_playing;
	gtk_widget_set_halign ((GtkWidget*) _tmp0_, GTK_ALIGN_END);
	_tmp1_ = self->_playing;
	gtk_widget_set_valign ((GtkWidget*) _tmp1_, GTK_ALIGN_CENTER);
	_tmp2_ = self->_playing;
	g_object_set (_tmp2_, "icon-name", "media-playback-start-symbolic", NULL);
	_tmp3_ = self->_playing;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp3_, 4);
	_tmp4_ = self->_playing;
	gtk_image_set_pixel_size (_tmp4_, 10);
	_tmp5_ = self->_playing;
	gtk_widget_set_visible ((GtkWidget*) _tmp5_, FALSE);
	_tmp6_ = self->_playing;
	gtk_widget_add_css_class ((GtkWidget*) _tmp6_, "dim-label");
	return self;
}

G4MusicWidget*
g4_music_widget_new (void)
{
	return g4_music_widget_construct (G4_TYPE_MUSIC_WIDGET);
}

void
g4_music_widget_disconnect_first_draw (G4MusicWidget* self)
{
	g_return_if_fail (self != NULL);
	if (self->first_draw_handler != ((gulong) 0)) {
		G4RoundPaintable* _tmp0_;
		_tmp0_ = self->_paintable;
		g_signal_handler_disconnect ((GObject*) _tmp0_, self->first_draw_handler);
		self->first_draw_handler = (gulong) 0;
	}
}

void
g4_music_widget_show_popover_menu (G4MusicWidget* self,
                                   GtkWidget* widget,
                                   gdouble x,
                                   gdouble y)
{
	GMenu* menu = NULL;
	G4Music* _tmp0_;
	GMenu* _tmp1_ = NULL;
	GMenu* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->music;
	g_signal_emit (self, g4_music_widget_signals[G4_MUSIC_WIDGET_CREATE_MUSIC_MENU_SIGNAL], 0, _tmp0_, &_tmp1_);
	menu = _tmp1_;
	_tmp2_ = menu;
	if (_tmp2_ != NULL) {
		GtkPopoverMenu* popover = NULL;
		GMenu* _tmp3_;
		GtkPopoverMenu* _tmp4_;
		GtkPopoverMenu* _tmp5_;
		GtkPopoverMenu* _tmp6_;
		_tmp3_ = menu;
		_tmp4_ = g4_create_popover_menu (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, g_menu_get_type (), GMenu), x, y);
		popover = _tmp4_;
		_tmp5_ = popover;
		gtk_widget_set_parent ((GtkWidget*) _tmp5_, widget);
		_tmp6_ = popover;
		gtk_popover_popup ((GtkPopover*) _tmp6_);
		_g_object_unref0 (popover);
	}
	_g_object_unref0 (menu);
}

G4RoundPaintable*
g4_music_widget_get_cover (G4MusicWidget* self)
{
	G4RoundPaintable* result;
	G4RoundPaintable* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->_paintable;
	result = _tmp0_;
	return result;
}

GtkImage*
g4_music_widget_get_image (G4MusicWidget* self)
{
	GtkImage* result;
	GtkImage* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->_image;
	result = _tmp0_;
	return result;
}

void
g4_music_widget_set_paintable (G4MusicWidget* self,
                               GdkPaintable* value)
{
	G4RoundPaintable* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->_paintable;
	g4_base_paintable_set_paintable ((G4BasePaintable*) _tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, g4_music_widget_properties[G4_MUSIC_WIDGET_PAINTABLE_PROPERTY]);
}

GtkImage*
g4_music_widget_get_playing (G4MusicWidget* self)
{
	GtkImage* result;
	GtkImage* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->_playing;
	result = _tmp0_;
	return result;
}

void
g4_music_widget_set_title (G4MusicWidget* self,
                           const gchar* value)
{
	G4StableLabel* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->_title;
	g4_stable_label_set_label (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, g4_music_widget_properties[G4_MUSIC_WIDGET_TITLE_PROPERTY]);
}

void
g4_music_widget_set_subtitle (G4MusicWidget* self,
                              const gchar* value)
{
	G4StableLabel* _tmp0_;
	G4StableLabel* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->_subtitle;
	g4_stable_label_set_label (_tmp0_, value);
	_tmp1_ = self->_subtitle;
	_tmp2_ = strlen (value);
	_tmp3_ = _tmp2_;
	gtk_widget_set_visible ((GtkWidget*) _tmp1_, _tmp3_ > 0);
	g_object_notify_by_pspec ((GObject *) self, g4_music_widget_properties[G4_MUSIC_WIDGET_SUBTITLE_PROPERTY]);
}

static void
g_cclosure_user_marshal_OBJECT__OBJECT (GClosure * closure,
                                        GValue * return_value,
                                        guint n_param_values,
                                        const GValue * param_values,
                                        gpointer invocation_hint,
                                        gpointer marshal_data)
{
	typedef gpointer (*GMarshalFunc_OBJECT__OBJECT) (gpointer data1, gpointer arg_1, gpointer data2);
	register GMarshalFunc_OBJECT__OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	gpointer v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 2);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_OBJECT__OBJECT) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, g_value_get_object (param_values + 1), data2);
	g_value_take_object (return_value, v_return);
}

static void
g4_music_widget_class_init (G4MusicWidgetClass * klass,
                            gpointer klass_data)
{
	g4_music_widget_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->get_property = _vala_g4_music_widget_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_g4_music_widget_set_property;
	G_OBJECT_CLASS (klass)->finalize = g4_music_widget_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MUSIC_WIDGET_COVER_PROPERTY, g4_music_widget_properties[G4_MUSIC_WIDGET_COVER_PROPERTY] = g_param_spec_object ("cover", "cover", "cover", G4_TYPE_ROUND_PAINTABLE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MUSIC_WIDGET_IMAGE_PROPERTY, g4_music_widget_properties[G4_MUSIC_WIDGET_IMAGE_PROPERTY] = g_param_spec_object ("image", "image", "image", gtk_image_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MUSIC_WIDGET_PAINTABLE_PROPERTY, g4_music_widget_properties[G4_MUSIC_WIDGET_PAINTABLE_PROPERTY] = g_param_spec_object ("paintable", "paintable", "paintable", gdk_paintable_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MUSIC_WIDGET_PLAYING_PROPERTY, g4_music_widget_properties[G4_MUSIC_WIDGET_PLAYING_PROPERTY] = g_param_spec_object ("playing", "playing", "playing", gtk_image_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MUSIC_WIDGET_TITLE_PROPERTY, g4_music_widget_properties[G4_MUSIC_WIDGET_TITLE_PROPERTY] = g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MUSIC_WIDGET_SUBTITLE_PROPERTY, g4_music_widget_properties[G4_MUSIC_WIDGET_SUBTITLE_PROPERTY] = g_param_spec_string ("subtitle", "subtitle", "subtitle", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	g4_music_widget_signals[G4_MUSIC_WIDGET_CREATE_MUSIC_MENU_SIGNAL] = g_signal_new ("create-music-menu", G4_TYPE_MUSIC_WIDGET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_OBJECT__OBJECT, g_menu_get_type (), 1, G4_TYPE_MUSIC);
}

static void
g4_music_widget_instance_init (G4MusicWidget * self,
                               gpointer klass)
{
	GtkImage* _tmp0_;
	G4StableLabel* _tmp1_;
	G4StableLabel* _tmp2_;
	G4RoundPaintable* _tmp3_;
	GtkImage* _tmp4_;
	_tmp0_ = (GtkImage*) gtk_image_new ();
	g_object_ref_sink (_tmp0_);
	self->_image = _tmp0_;
	_tmp1_ = g4_stable_label_new ();
	g_object_ref_sink (_tmp1_);
	self->_title = _tmp1_;
	_tmp2_ = g4_stable_label_new ();
	g_object_ref_sink (_tmp2_);
	self->_subtitle = _tmp2_;
	_tmp3_ = g4_round_paintable_new (NULL, 0.1);
	self->_paintable = _tmp3_;
	_tmp4_ = (GtkImage*) gtk_image_new ();
	g_object_ref_sink (_tmp4_);
	self->_playing = _tmp4_;
	self->first_draw_handler = (gulong) 0;
	self->music = NULL;
}

static void
g4_music_widget_finalize (GObject * obj)
{
	G4MusicWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TYPE_MUSIC_WIDGET, G4MusicWidget);
	_g_object_unref0 (self->_image);
	_g_object_unref0 (self->_title);
	_g_object_unref0 (self->_subtitle);
	_g_object_unref0 (self->_paintable);
	_g_object_unref0 (self->_playing);
	_g_object_unref0 (self->music);
	G_OBJECT_CLASS (g4_music_widget_parent_class)->finalize (obj);
}

static GType
g4_music_widget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4MusicWidgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_music_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4MusicWidget), 0, (GInstanceInitFunc) g4_music_widget_instance_init, NULL };
	GType g4_music_widget_type_id;
	g4_music_widget_type_id = g_type_register_static (gtk_box_get_type (), "G4MusicWidget", &g_define_type_info, 0);
	return g4_music_widget_type_id;
}

GType
g4_music_widget_get_type (void)
{
	static volatile gsize g4_music_widget_type_id__once = 0;
	if (g_once_init_enter (&g4_music_widget_type_id__once)) {
		GType g4_music_widget_type_id;
		g4_music_widget_type_id = g4_music_widget_get_type_once ();
		g_once_init_leave (&g4_music_widget_type_id__once, g4_music_widget_type_id);
	}
	return g4_music_widget_type_id__once;
}

static void
_vala_g4_music_widget_get_property (GObject * object,
                                    guint property_id,
                                    GValue * value,
                                    GParamSpec * pspec)
{
	G4MusicWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_MUSIC_WIDGET, G4MusicWidget);
	switch (property_id) {
		case G4_MUSIC_WIDGET_COVER_PROPERTY:
		g_value_set_object (value, g4_music_widget_get_cover (self));
		break;
		case G4_MUSIC_WIDGET_IMAGE_PROPERTY:
		g_value_set_object (value, g4_music_widget_get_image (self));
		break;
		case G4_MUSIC_WIDGET_PLAYING_PROPERTY:
		g_value_set_object (value, g4_music_widget_get_playing (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_g4_music_widget_set_property (GObject * object,
                                    guint property_id,
                                    const GValue * value,
                                    GParamSpec * pspec)
{
	G4MusicWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_MUSIC_WIDGET, G4MusicWidget);
	switch (property_id) {
		case G4_MUSIC_WIDGET_PAINTABLE_PROPERTY:
		g4_music_widget_set_paintable (self, g_value_get_object (value));
		break;
		case G4_MUSIC_WIDGET_TITLE_PROPERTY:
		g4_music_widget_set_title (self, g_value_get_string (value));
		break;
		case G4_MUSIC_WIDGET_SUBTITLE_PROPERTY:
		g4_music_widget_set_subtitle (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_gtk_widget_queue_draw_g4_base_paintable_queue_draw (G4BasePaintable* _sender,
                                                     gpointer self)
{
	gtk_widget_queue_draw ((GtkWidget*) self);
}

G4MusicCell*
g4_music_cell_construct (GType object_type)
{
	G4MusicCell * self = NULL;
	GtkOverlay* overlay = NULL;
	GtkOverlay* _tmp0_;
	GtkOverlay* _tmp1_;
	GtkOverlay* _tmp2_;
	GtkImage* _tmp3_;
	GtkOverlay* _tmp4_;
	GtkImage* _tmp5_;
	GtkOverlay* _tmp6_;
	GtkImage* _tmp7_;
	GtkImage* _tmp8_;
	GtkImage* _tmp9_;
	G4RoundPaintable* _tmp10_;
	G4RoundPaintable* _tmp11_;
	GtkImage* _tmp12_;
	G4StableLabel* _tmp13_;
	G4StableLabel* _tmp14_;
	G4StableLabel* _tmp15_;
	G4StableLabel* _tmp16_;
	G4StableLabel* _tmp17_;
	G4StableLabel* _tmp18_;
	G4StableLabel* _tmp19_;
	G4StableLabel* _tmp20_;
	G4StableLabel* _tmp21_;
	G4StableLabel* _tmp22_;
	G4StableLabel* _tmp23_;
	G4StableLabel* _tmp24_;
	gint font_size = 0;
	G4StableLabel* _tmp25_;
	PangoContext* _tmp26_;
	PangoFontDescription* _tmp27_;
	G4StableLabel* _tmp29_;
	self = (G4MusicCell*) g4_music_widget_construct (object_type);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_VERTICAL);
	gtk_widget_set_margin_top ((GtkWidget*) self, 10);
	gtk_widget_set_margin_bottom ((GtkWidget*) self, 10);
	g_object_set ((GtkWidget*) self, "width-request", 200, NULL);
	_tmp0_ = (GtkOverlay*) gtk_overlay_new ();
	g_object_ref_sink (_tmp0_);
	overlay = _tmp0_;
	_tmp1_ = overlay;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp1_, 8);
	_tmp2_ = overlay;
	_tmp3_ = ((G4MusicWidget*) self)->_image;
	gtk_overlay_set_child (_tmp2_, (GtkWidget*) _tmp3_);
	_tmp4_ = overlay;
	_tmp5_ = ((G4MusicWidget*) self)->_playing;
	gtk_overlay_add_overlay (_tmp4_, (GtkWidget*) _tmp5_);
	_tmp6_ = overlay;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp6_);
	_tmp7_ = ((G4MusicWidget*) self)->_image;
	gtk_widget_set_halign ((GtkWidget*) _tmp7_, GTK_ALIGN_CENTER);
	_tmp8_ = ((G4MusicWidget*) self)->_image;
	gtk_image_set_pixel_size (_tmp8_, 160);
	_tmp9_ = ((G4MusicWidget*) self)->_image;
	_tmp10_ = ((G4MusicWidget*) self)->_paintable;
	g_object_set (_tmp9_, "paintable", (GdkPaintable*) _tmp10_, NULL);
	_tmp11_ = ((G4MusicWidget*) self)->_paintable;
	_tmp12_ = ((G4MusicWidget*) self)->_image;
	g_signal_connect_object ((G4BasePaintable*) _tmp11_, "queue-draw", (GCallback) _gtk_widget_queue_draw_g4_base_paintable_queue_draw, (GtkWidget*) _tmp12_, 0);
	_tmp13_ = ((G4MusicWidget*) self)->_title;
	gtk_widget_set_halign ((GtkWidget*) _tmp13_, GTK_ALIGN_CENTER);
	_tmp14_ = ((G4MusicWidget*) self)->_title;
	g4_stable_label_set_ellipsize (_tmp14_, G4_ELLIPSIZE_MODE_MIDDLE);
	_tmp15_ = ((G4MusicWidget*) self)->_title;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp15_, 2);
	_tmp16_ = ((G4MusicWidget*) self)->_title;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp16_, 2);
	_tmp17_ = ((G4MusicWidget*) self)->_title;
	gtk_widget_add_css_class ((GtkWidget*) _tmp17_, "title-leading");
	_tmp18_ = ((G4MusicWidget*) self)->_title;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp18_);
	_tmp19_ = ((G4MusicWidget*) self)->_subtitle;
	gtk_widget_set_halign ((GtkWidget*) _tmp19_, GTK_ALIGN_CENTER);
	_tmp20_ = ((G4MusicWidget*) self)->_subtitle;
	g4_stable_label_set_ellipsize (_tmp20_, G4_ELLIPSIZE_MODE_MIDDLE);
	_tmp21_ = ((G4MusicWidget*) self)->_subtitle;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp21_, 2);
	_tmp22_ = ((G4MusicWidget*) self)->_subtitle;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp22_, 2);
	_tmp23_ = ((G4MusicWidget*) self)->_subtitle;
	gtk_widget_set_visible ((GtkWidget*) _tmp23_, FALSE);
	_tmp24_ = ((G4MusicWidget*) self)->_subtitle;
	gtk_widget_add_css_class ((GtkWidget*) _tmp24_, "dim-label");
	_tmp25_ = ((G4MusicWidget*) self)->_subtitle;
	_tmp26_ = gtk_widget_get_pango_context ((GtkWidget*) _tmp25_);
	_tmp27_ = pango_context_get_font_description (_tmp26_);
	font_size = pango_font_description_get_size (_tmp27_) / PANGO_SCALE;
	if (font_size >= 13) {
		G4StableLabel* _tmp28_;
		_tmp28_ = ((G4MusicWidget*) self)->_subtitle;
		gtk_widget_add_css_class ((GtkWidget*) _tmp28_, "title-secondly");
	}
	_tmp29_ = ((G4MusicWidget*) self)->_subtitle;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp29_);
	_g_object_unref0 (overlay);
	return self;
}

G4MusicCell*
g4_music_cell_new (void)
{
	return g4_music_cell_construct (G4_TYPE_MUSIC_CELL);
}

static void
g4_music_cell_class_init (G4MusicCellClass * klass,
                          gpointer klass_data)
{
	g4_music_cell_parent_class = g_type_class_peek_parent (klass);
}

static void
g4_music_cell_instance_init (G4MusicCell * self,
                             gpointer klass)
{
}

static GType
g4_music_cell_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4MusicCellClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_music_cell_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4MusicCell), 0, (GInstanceInitFunc) g4_music_cell_instance_init, NULL };
	GType g4_music_cell_type_id;
	g4_music_cell_type_id = g_type_register_static (G4_TYPE_MUSIC_WIDGET, "G4MusicCell", &g_define_type_info, 0);
	return g4_music_cell_type_id;
}

GType
g4_music_cell_get_type (void)
{
	static volatile gsize g4_music_cell_type_id__once = 0;
	if (g_once_init_enter (&g4_music_cell_type_id__once)) {
		GType g4_music_cell_type_id;
		g4_music_cell_type_id = g4_music_cell_get_type_once ();
		g_once_init_leave (&g4_music_cell_type_id__once, g4_music_cell_type_id);
	}
	return g4_music_cell_type_id__once;
}

G4MusicEntry*
g4_music_entry_construct (GType object_type,
                          gboolean compact)
{
	G4MusicEntry * self = NULL;
	gint _tmp0_ = 0;
	gint cover_margin = 0;
	gint _tmp1_ = 0;
	gint cover_size = 0;
	GtkImage* _tmp2_;
	GtkImage* _tmp3_;
	GtkImage* _tmp4_;
	GtkImage* _tmp5_;
	GtkImage* _tmp6_;
	G4RoundPaintable* _tmp7_;
	G4RoundPaintable* _tmp8_;
	GtkImage* _tmp9_;
	GtkImage* _tmp10_;
	gint _tmp11_ = 0;
	gint spacing = 0;
	GtkBox* vbox = NULL;
	GtkBox* _tmp12_;
	GtkBox* _tmp13_;
	GtkBox* _tmp14_;
	GtkBox* _tmp15_;
	GtkBox* _tmp16_;
	GtkBox* _tmp17_;
	G4StableLabel* _tmp18_;
	GtkBox* _tmp19_;
	G4StableLabel* _tmp20_;
	GtkBox* _tmp21_;
	G4StableLabel* _tmp22_;
	G4StableLabel* _tmp23_;
	G4StableLabel* _tmp24_;
	G4StableLabel* _tmp25_;
	G4StableLabel* _tmp26_;
	G4StableLabel* _tmp27_;
	gint font_size = 0;
	G4StableLabel* _tmp28_;
	PangoContext* _tmp29_;
	PangoFontDescription* _tmp30_;
	GtkImage* _tmp32_;
	self = (G4MusicEntry*) g4_music_widget_construct (object_type);
	g_object_set ((GtkWidget*) self, "width-request", 324, NULL);
	if (compact) {
		_tmp0_ = 3;
	} else {
		_tmp0_ = 4;
	}
	cover_margin = _tmp0_;
	if (compact) {
		_tmp1_ = 36;
	} else {
		_tmp1_ = 48;
	}
	cover_size = _tmp1_;
	_tmp2_ = ((G4MusicWidget*) self)->_image;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp2_, cover_margin);
	_tmp3_ = ((G4MusicWidget*) self)->_image;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp3_, cover_margin);
	_tmp4_ = ((G4MusicWidget*) self)->_image;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp4_, 4);
	_tmp5_ = ((G4MusicWidget*) self)->_image;
	gtk_image_set_pixel_size (_tmp5_, cover_size);
	_tmp6_ = ((G4MusicWidget*) self)->_image;
	_tmp7_ = ((G4MusicWidget*) self)->_paintable;
	g_object_set (_tmp6_, "paintable", (GdkPaintable*) _tmp7_, NULL);
	_tmp8_ = ((G4MusicWidget*) self)->_paintable;
	_tmp9_ = ((G4MusicWidget*) self)->_image;
	g_signal_connect_object ((G4BasePaintable*) _tmp8_, "queue-draw", (GCallback) _gtk_widget_queue_draw_g4_base_paintable_queue_draw, (GtkWidget*) _tmp9_, 0);
	_tmp10_ = ((G4MusicWidget*) self)->_image;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp10_);
	if (compact) {
		_tmp11_ = 2;
	} else {
		_tmp11_ = 6;
	}
	spacing = _tmp11_;
	_tmp12_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, spacing);
	g_object_ref_sink (_tmp12_);
	vbox = _tmp12_;
	_tmp13_ = vbox;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp13_, TRUE);
	_tmp14_ = vbox;
	gtk_widget_set_valign ((GtkWidget*) _tmp14_, GTK_ALIGN_CENTER);
	_tmp15_ = vbox;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp15_, 12);
	_tmp16_ = vbox;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp16_, 4);
	_tmp17_ = vbox;
	_tmp18_ = ((G4MusicWidget*) self)->_title;
	gtk_box_append (_tmp17_, (GtkWidget*) _tmp18_);
	_tmp19_ = vbox;
	_tmp20_ = ((G4MusicWidget*) self)->_subtitle;
	gtk_box_append (_tmp19_, (GtkWidget*) _tmp20_);
	_tmp21_ = vbox;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp21_);
	_tmp22_ = ((G4MusicWidget*) self)->_title;
	gtk_widget_set_halign ((GtkWidget*) _tmp22_, GTK_ALIGN_START);
	_tmp23_ = ((G4MusicWidget*) self)->_title;
	g4_stable_label_set_ellipsize (_tmp23_, G4_ELLIPSIZE_MODE_END);
	_tmp24_ = ((G4MusicWidget*) self)->_title;
	gtk_widget_add_css_class ((GtkWidget*) _tmp24_, "title-leading");
	_tmp25_ = ((G4MusicWidget*) self)->_subtitle;
	gtk_widget_set_halign ((GtkWidget*) _tmp25_, GTK_ALIGN_START);
	_tmp26_ = ((G4MusicWidget*) self)->_subtitle;
	g4_stable_label_set_ellipsize (_tmp26_, G4_ELLIPSIZE_MODE_END);
	_tmp27_ = ((G4MusicWidget*) self)->_subtitle;
	gtk_widget_add_css_class ((GtkWidget*) _tmp27_, "dim-label");
	_tmp28_ = ((G4MusicWidget*) self)->_subtitle;
	_tmp29_ = gtk_widget_get_pango_context ((GtkWidget*) _tmp28_);
	_tmp30_ = pango_context_get_font_description (_tmp29_);
	font_size = pango_font_description_get_size (_tmp30_) / PANGO_SCALE;
	if (font_size >= 13) {
		G4StableLabel* _tmp31_;
		_tmp31_ = ((G4MusicWidget*) self)->_subtitle;
		gtk_widget_add_css_class ((GtkWidget*) _tmp31_, "title-secondly");
	}
	_tmp32_ = ((G4MusicWidget*) self)->_playing;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp32_);
	_g_object_unref0 (vbox);
	return self;
}

G4MusicEntry*
g4_music_entry_new (gboolean compact)
{
	return g4_music_entry_construct (G4_TYPE_MUSIC_ENTRY, compact);
}

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

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

void
g4_music_entry_set_titles (G4MusicEntry* self,
                           G4Music* music,
                           guint sort)
{
	G4Music* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (music != NULL);
	_tmp0_ = _g_object_ref0 (music);
	_g_object_unref0 (((G4MusicWidget*) self)->music);
	((G4MusicWidget*) self)->music = _tmp0_;
	switch (sort) {
		case G4_SORT_MODE_ALBUM:
		{
			G4StableLabel* _tmp1_;
			const gchar* _tmp2_;
			gchar* _tmp3_ = NULL;
			gint _tmp4_;
			G4StableLabel* _tmp12_;
			_tmp1_ = ((G4MusicWidget*) self)->_title;
			_tmp2_ = music->album;
			g4_stable_label_set_label (_tmp1_, _tmp2_);
			_tmp4_ = music->track;
			if ((0 < _tmp4_) && (_tmp4_ < G_MAXINT)) {
				gchar* _tmp5_;
				gchar* _tmp6_;
				const gchar* _tmp7_;
				const gchar* _tmp8_;
				gchar* _tmp9_;
				_tmp5_ = g_strdup_printf ("%i", music->track);
				_tmp6_ = _tmp5_;
				_tmp7_ = music->title;
				_tmp8_ = string_to_string (_tmp7_);
				_tmp9_ = g_strconcat (_tmp6_, ". ", _tmp8_, NULL);
				_g_free0 (_tmp3_);
				_tmp3_ = _tmp9_;
				_g_free0 (_tmp6_);
			} else {
				const gchar* _tmp10_;
				gchar* _tmp11_;
				_tmp10_ = music->title;
				_tmp11_ = g_strdup (_tmp10_);
				_g_free0 (_tmp3_);
				_tmp3_ = _tmp11_;
			}
			_tmp12_ = ((G4MusicWidget*) self)->_subtitle;
			g4_stable_label_set_label (_tmp12_, _tmp3_);
			_g_free0 (_tmp3_);
			break;
		}
		case G4_SORT_MODE_ARTIST:
		{
			G4StableLabel* _tmp13_;
			const gchar* _tmp14_;
			G4StableLabel* _tmp15_;
			const gchar* _tmp16_;
			_tmp13_ = ((G4MusicWidget*) self)->_title;
			_tmp14_ = music->artist;
			g4_stable_label_set_label (_tmp13_, _tmp14_);
			_tmp15_ = ((G4MusicWidget*) self)->_subtitle;
			_tmp16_ = music->title;
			g4_stable_label_set_label (_tmp15_, _tmp16_);
			break;
		}
		case G4_SORT_MODE_ARTIST_ALBUM:
		{
			G4StableLabel* _tmp17_;
			const gchar* _tmp18_;
			const gchar* _tmp19_;
			const gchar* _tmp20_;
			const gchar* _tmp21_;
			gchar* _tmp22_;
			gchar* _tmp23_;
			gchar* _tmp24_ = NULL;
			gint _tmp25_;
			G4StableLabel* _tmp33_;
			_tmp17_ = ((G4MusicWidget*) self)->_title;
			_tmp18_ = music->artist;
			_tmp19_ = string_to_string (_tmp18_);
			_tmp20_ = music->album;
			_tmp21_ = string_to_string (_tmp20_);
			_tmp22_ = g_strconcat (_tmp19_, ": ", _tmp21_, NULL);
			_tmp23_ = _tmp22_;
			g4_stable_label_set_label (_tmp17_, _tmp23_);
			_g_free0 (_tmp23_);
			_tmp25_ = music->track;
			if ((0 < _tmp25_) && (_tmp25_ < G_MAXINT)) {
				gchar* _tmp26_;
				gchar* _tmp27_;
				const gchar* _tmp28_;
				const gchar* _tmp29_;
				gchar* _tmp30_;
				_tmp26_ = g_strdup_printf ("%i", music->track);
				_tmp27_ = _tmp26_;
				_tmp28_ = music->title;
				_tmp29_ = string_to_string (_tmp28_);
				_tmp30_ = g_strconcat (_tmp27_, ". ", _tmp29_, NULL);
				_g_free0 (_tmp24_);
				_tmp24_ = _tmp30_;
				_g_free0 (_tmp27_);
			} else {
				const gchar* _tmp31_;
				gchar* _tmp32_;
				_tmp31_ = music->title;
				_tmp32_ = g_strdup (_tmp31_);
				_g_free0 (_tmp24_);
				_tmp24_ = _tmp32_;
			}
			_tmp33_ = ((G4MusicWidget*) self)->_subtitle;
			g4_stable_label_set_label (_tmp33_, _tmp24_);
			_g_free0 (_tmp24_);
			break;
		}
		case G4_SORT_MODE_RECENT:
		{
			GDateTime* date = NULL;
			GDateTime* _tmp34_;
			G4StableLabel* _tmp35_;
			const gchar* _tmp36_;
			G4StableLabel* _tmp37_;
			GDateTime* _tmp38_;
			gchar* _tmp39_;
			gchar* _tmp40_;
			_tmp34_ = g_date_time_new_from_unix_local (music->modified_time);
			date = _tmp34_;
			_tmp35_ = ((G4MusicWidget*) self)->_title;
			_tmp36_ = music->title;
			g4_stable_label_set_label (_tmp35_, _tmp36_);
			_tmp37_ = ((G4MusicWidget*) self)->_subtitle;
			_tmp38_ = date;
			_tmp39_ = g_date_time_format (_tmp38_, "%x %H:%M");
			_tmp40_ = _tmp39_;
			g4_stable_label_set_label (_tmp37_, _tmp40_);
			_g_free0 (_tmp40_);
			_g_date_time_unref0 (date);
			break;
		}
		default:
		{
			G4StableLabel* _tmp41_;
			const gchar* _tmp42_;
			G4StableLabel* _tmp43_;
			const gchar* _tmp44_;
			_tmp41_ = ((G4MusicWidget*) self)->_title;
			_tmp42_ = music->title;
			g4_stable_label_set_label (_tmp41_, _tmp42_);
			_tmp43_ = ((G4MusicWidget*) self)->_subtitle;
			_tmp44_ = music->artist;
			g4_stable_label_set_label (_tmp43_, _tmp44_);
			break;
		}
	}
}

static void
g4_music_entry_class_init (G4MusicEntryClass * klass,
                           gpointer klass_data)
{
	g4_music_entry_parent_class = g_type_class_peek_parent (klass);
}

static void
g4_music_entry_instance_init (G4MusicEntry * self,
                              gpointer klass)
{
}

static GType
g4_music_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4MusicEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_music_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4MusicEntry), 0, (GInstanceInitFunc) g4_music_entry_instance_init, NULL };
	GType g4_music_entry_type_id;
	g4_music_entry_type_id = g_type_register_static (G4_TYPE_MUSIC_WIDGET, "G4MusicEntry", &g_define_type_info, 0);
	return g4_music_entry_type_id;
}

GType
g4_music_entry_get_type (void)
{
	static volatile gsize g4_music_entry_type_id__once = 0;
	if (g_once_init_enter (&g4_music_entry_type_id__once)) {
		GType g4_music_entry_type_id;
		g4_music_entry_type_id = g4_music_entry_get_type_once ();
		g_once_init_leave (&g4_music_entry_type_id__once, g4_music_entry_type_id);
	}
	return g4_music_entry_type_id__once;
}

gchar**
g4_build_action_target_for_album (G4Album* album,
                                  gint* result_length1)
{
	const gchar* album_artist = NULL;
	const gchar* _tmp0_;
	const gchar* album_key = NULL;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean is_playlist = FALSE;
	gchar** result;
	g_return_val_if_fail (album != NULL, NULL);
	_tmp0_ = ((G4Music*) album)->album_artist;
	album_artist = _tmp0_;
	_tmp1_ = g4_music_get_album_key ((G4Music*) album);
	_tmp2_ = _tmp1_;
	album_key = _tmp2_;
	is_playlist = G4_IS_PLAYLIST (album);
	if (is_playlist) {
		gchar* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar** _tmp6_;
		gchar** _tmp7_;
		gint _tmp7__length1;
		_tmp3_ = g_strdup (G4_PAGE_NAME_PLAYLIST);
		_tmp4_ = album_key;
		_tmp5_ = g_strdup (_tmp4_);
		_tmp6_ = g_new0 (gchar*, 2 + 1);
		_tmp6_[0] = _tmp3_;
		_tmp6_[1] = _tmp5_;
		_tmp7_ = _tmp6_;
		_tmp7__length1 = 2;
		if (result_length1) {
			*result_length1 = _tmp7__length1;
		}
		result = _tmp7_;
		return result;
	} else {
		const gchar* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		_tmp8_ = album_artist;
		_tmp9_ = strlen (_tmp8_);
		_tmp10_ = _tmp9_;
		if (_tmp10_ > 0) {
			gchar* _tmp11_;
			const gchar* _tmp12_;
			gchar* _tmp13_;
			const gchar* _tmp14_;
			gchar* _tmp15_;
			gchar** _tmp16_;
			gchar** _tmp17_;
			gint _tmp17__length1;
			_tmp11_ = g_strdup (G4_PAGE_NAME_ARTIST);
			_tmp12_ = album_artist;
			_tmp13_ = g_strdup (_tmp12_);
			_tmp14_ = album_key;
			_tmp15_ = g_strdup (_tmp14_);
			_tmp16_ = g_new0 (gchar*, 3 + 1);
			_tmp16_[0] = _tmp11_;
			_tmp16_[1] = _tmp13_;
			_tmp16_[2] = _tmp15_;
			_tmp17_ = _tmp16_;
			_tmp17__length1 = 3;
			if (result_length1) {
				*result_length1 = _tmp17__length1;
			}
			result = _tmp17_;
			return result;
		} else {
			gchar* _tmp18_;
			const gchar* _tmp19_;
			gchar* _tmp20_;
			gchar** _tmp21_;
			gchar** _tmp22_;
			gint _tmp22__length1;
			_tmp18_ = g_strdup (G4_PAGE_NAME_ALBUM);
			_tmp19_ = album_key;
			_tmp20_ = g_strdup (_tmp19_);
			_tmp21_ = g_new0 (gchar*, 2 + 1);
			_tmp21_[0] = _tmp18_;
			_tmp21_[1] = _tmp20_;
			_tmp22_ = _tmp21_;
			_tmp22__length1 = 2;
			if (result_length1) {
				*result_length1 = _tmp22__length1;
			}
			result = _tmp22_;
			return result;
		}
	}
}

gchar*
g4_build_library_uri (G4Artist* artist,
                      G4Album* album)
{
	G4Album* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp4_ = NULL;
	gchar* album_key = NULL;
	gchar* _tmp5_;
	gchar** _tmp6_ = NULL;
	gint _tmp6__length1 = 0;
	gint __tmp6__size_ = 0;
	gchar** arr = NULL;
	gchar** _tmp28_;
	gint _tmp28__length1;
	gint arr_length1;
	gint _arr_size_;
	gchar* _tmp29_;
	gchar* result;
	_tmp0_ = album;
	_tmp1_ = NULL;
	if (_tmp0_ != NULL) {
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		_tmp2_ = g4_music_get_album_key ((G4Music*) G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, G4_TYPE_ALBUM, G4Album));
		_tmp3_ = _tmp2_;
		_tmp1_ = _tmp3_;
	}
	_tmp4_ = _tmp1_;
	if (_tmp4_ == NULL) {
		_tmp4_ = "";
	}
	_tmp5_ = g_strdup ((const gchar*) _tmp4_);
	album_key = _tmp5_;
	if (artist != NULL) {
		gchar* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		const gchar* _tmp11_;
		gchar* _tmp12_;
		gchar** _tmp13_;
		_tmp7_ = g_strdup (G4_PAGE_NAME_ARTIST);
		_tmp8_ = g4_music_get_artist_name ((G4Music*) G_TYPE_CHECK_INSTANCE_CAST (artist, G4_TYPE_ARTIST, G4Artist));
		_tmp9_ = _tmp8_;
		_tmp10_ = g_strdup (_tmp9_);
		_tmp11_ = album_key;
		_tmp12_ = g_strdup (_tmp11_);
		_tmp13_ = g_new0 (gchar*, 3 + 1);
		_tmp13_[0] = _tmp7_;
		_tmp13_[1] = _tmp10_;
		_tmp13_[2] = _tmp12_;
		_tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL);
		_tmp6_ = _tmp13_;
		_tmp6__length1 = 3;
		__tmp6__size_ = _tmp6__length1;
	} else {
		gchar** _tmp14_ = NULL;
		gint _tmp14__length1 = 0;
		gint __tmp14__size_ = 0;
		gchar** _tmp27_;
		gint _tmp27__length1;
		if (G4_IS_PLAYLIST (album)) {
			gchar* _tmp15_;
			const gchar* _tmp16_;
			gchar* _tmp17_;
			gchar** _tmp18_;
			_tmp15_ = g_strdup (G4_PAGE_NAME_PLAYLIST);
			_tmp16_ = album_key;
			_tmp17_ = g_strdup (_tmp16_);
			_tmp18_ = g_new0 (gchar*, 2 + 1);
			_tmp18_[0] = _tmp15_;
			_tmp18_[1] = _tmp17_;
			_tmp14_ = (_vala_array_free (_tmp14_, _tmp14__length1, (GDestroyNotify) g_free), NULL);
			_tmp14_ = _tmp18_;
			_tmp14__length1 = 2;
			__tmp14__size_ = _tmp14__length1;
		} else {
			gchar** _tmp19_ = NULL;
			gint _tmp19__length1 = 0;
			gint __tmp19__size_ = 0;
			gchar** _tmp26_;
			gint _tmp26__length1;
			if (album != NULL) {
				gchar* _tmp20_;
				const gchar* _tmp21_;
				gchar* _tmp22_;
				gchar** _tmp23_;
				_tmp20_ = g_strdup (G4_PAGE_NAME_ALBUM);
				_tmp21_ = album_key;
				_tmp22_ = g_strdup (_tmp21_);
				_tmp23_ = g_new0 (gchar*, 2 + 1);
				_tmp23_[0] = _tmp20_;
				_tmp23_[1] = _tmp22_;
				_tmp19_ = (_vala_array_free (_tmp19_, _tmp19__length1, (GDestroyNotify) g_free), NULL);
				_tmp19_ = _tmp23_;
				_tmp19__length1 = 2;
				__tmp19__size_ = _tmp19__length1;
			} else {
				gchar* _tmp24_;
				gchar** _tmp25_;
				_tmp24_ = g_strdup (G4_PAGE_NAME_PLAYING);
				_tmp25_ = g_new0 (gchar*, 1 + 1);
				_tmp25_[0] = _tmp24_;
				_tmp19_ = (_vala_array_free (_tmp19_, _tmp19__length1, (GDestroyNotify) g_free), NULL);
				_tmp19_ = _tmp25_;
				_tmp19__length1 = 1;
				__tmp19__size_ = _tmp19__length1;
			}
			_tmp26_ = _tmp19_;
			_tmp26__length1 = _tmp19__length1;
			_tmp19_ = NULL;
			_tmp19__length1 = 0;
			_tmp14_ = (_vala_array_free (_tmp14_, _tmp14__length1, (GDestroyNotify) g_free), NULL);
			_tmp14_ = _tmp26_;
			_tmp14__length1 = _tmp26__length1;
			__tmp14__size_ = _tmp14__length1;
			_tmp19_ = (_vala_array_free (_tmp19_, _tmp19__length1, (GDestroyNotify) g_free), NULL);
		}
		_tmp27_ = _tmp14_;
		_tmp27__length1 = _tmp14__length1;
		_tmp14_ = NULL;
		_tmp14__length1 = 0;
		_tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL);
		_tmp6_ = _tmp27_;
		_tmp6__length1 = _tmp27__length1;
		__tmp6__size_ = _tmp6__length1;
		_tmp14_ = (_vala_array_free (_tmp14_, _tmp14__length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp28_ = _tmp6_;
	_tmp28__length1 = _tmp6__length1;
	_tmp6_ = NULL;
	_tmp6__length1 = 0;
	arr = _tmp28_;
	arr_length1 = _tmp28__length1;
	_arr_size_ = arr_length1;
	_tmp29_ = g4_build_library_uri_from_sa (arr, (gint) arr_length1);
	result = _tmp29_;
	arr = (_vala_array_free (arr, arr_length1, (GDestroyNotify) g_free), NULL);
	_tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (album_key);
	return result;
}

gchar*
g4_build_library_uri_from_sa (gchar** arr,
                              gint arr_length1)
{
	GString* sb = NULL;
	GString* _tmp0_;
	GString* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* result;
	_tmp0_ = g_string_new (G4_LIBRARY_SCHEME);
	sb = _tmp0_;
	if (arr_length1 > 0) {
		GString* _tmp1_;
		const gchar* _tmp2_;
		_tmp1_ = sb;
		_tmp2_ = arr[0];
		g_string_append (_tmp1_, _tmp2_);
		{
			gint i = 0;
			i = 1;
			{
				gboolean _tmp3_ = FALSE;
				_tmp3_ = TRUE;
				while (TRUE) {
					GString* _tmp5_;
					GString* _tmp6_;
					const gchar* _tmp7_;
					gchar* _tmp8_;
					gchar* _tmp9_;
					if (!_tmp3_) {
						gint _tmp4_;
						_tmp4_ = i;
						i = _tmp4_ + 1;
					}
					_tmp3_ = FALSE;
					if (!(i < arr_length1)) {
						break;
					}
					_tmp5_ = sb;
					g_string_append_c (_tmp5_, '/');
					_tmp6_ = sb;
					_tmp7_ = arr[i];
					_tmp8_ = g_uri_escape_string (_tmp7_, NULL, TRUE);
					_tmp9_ = _tmp8_;
					g_string_append (_tmp6_, _tmp9_);
					_g_free0 (_tmp9_);
				}
			}
		}
	}
	_tmp10_ = sb;
	_tmp11_ = _tmp10_->str;
	_tmp12_ = g_strdup (_tmp11_);
	result = _tmp12_;
	_g_string_free0 (sb);
	return result;
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

gboolean
g4_parse_library_uri (const gchar* uri_str,
                      gchar** artist,
                      gchar** album,
                      gchar** playlist,
                      gchar** host)
{
	gchar* _vala_artist = NULL;
	gchar* _vala_album = NULL;
	gchar* _vala_playlist = NULL;
	gchar* _vala_host = NULL;
	gboolean result;
	g_return_val_if_fail (uri_str != NULL, FALSE);
	_g_free0 (_vala_host);
	_vala_host = NULL;
	_g_free0 (_vala_artist);
	_vala_artist = NULL;
	_g_free0 (_vala_album);
	_vala_album = NULL;
	_g_free0 (_vala_playlist);
	_vala_playlist = NULL;
	if (g_str_has_prefix (uri_str, G4_LIBRARY_SCHEME)) {
		gchar* path = NULL;
		gint _tmp0_;
		gint _tmp1_;
		gchar* _tmp2_;
		gchar** arr = NULL;
		const gchar* _tmp3_;
		gchar** _tmp4_;
		gchar** _tmp5_;
		gint arr_length1;
		gint _arr_size_;
		gchar** _tmp6_;
		gint _tmp6__length1;
		gchar** _tmp28_;
		gint _tmp28__length1;
		const gchar* _tmp29_;
		gchar* _tmp30_;
		_tmp0_ = strlen (G4_LIBRARY_SCHEME);
		_tmp1_ = _tmp0_;
		_tmp2_ = string_substring (uri_str, (glong) _tmp1_, (glong) -1);
		path = _tmp2_;
		_tmp3_ = path;
		_tmp5_ = _tmp4_ = g_strsplit (_tmp3_, "/", 0);
		arr = _tmp5_;
		arr_length1 = _vala_array_length (_tmp4_);
		_arr_size_ = arr_length1;
		_tmp6_ = arr;
		_tmp6__length1 = arr_length1;
		if (_tmp6__length1 > 1) {
			gchar* _tmp7_ = NULL;
			gchar** _tmp8_;
			gint _tmp8__length1;
			const gchar* _tmp9_;
			gchar* _tmp10_;
			gchar* key = NULL;
			gchar* _tmp12_;
			gchar** _tmp13_;
			gint _tmp13__length1;
			const gchar* _tmp14_;
			const gchar* _tmp15_;
			GQuark _tmp17_ = 0U;
			static GQuark _tmp16_label0 = 0;
			static GQuark _tmp16_label1 = 0;
			static GQuark _tmp16_label2 = 0;
			_tmp8_ = arr;
			_tmp8__length1 = arr_length1;
			_tmp9_ = _tmp8_[1];
			_tmp10_ = g_uri_unescape_string (_tmp9_, NULL);
			_tmp7_ = _tmp10_;
			if (_tmp7_ == NULL) {
				gchar* _tmp11_;
				_tmp11_ = g_strdup ("");
				_g_free0 (_tmp7_);
				_tmp7_ = _tmp11_;
			}
			_tmp12_ = _tmp7_;
			_tmp7_ = NULL;
			key = (gchar*) _tmp12_;
			_tmp13_ = arr;
			_tmp13__length1 = arr_length1;
			_tmp14_ = _tmp13_[0];
			_tmp15_ = _tmp14_;
			_tmp17_ = (NULL == _tmp15_) ? 0 : g_quark_from_string (_tmp15_);
			if (_tmp17_ == ((0 != _tmp16_label0) ? _tmp16_label0 : (_tmp16_label0 = g_quark_from_static_string (G4_PAGE_NAME_ALBUM)))) {
				switch (0) {
					default:
					{
						const gchar* _tmp18_;
						gchar* _tmp19_;
						_tmp18_ = key;
						_tmp19_ = g_strdup (_tmp18_);
						_g_free0 (_vala_album);
						_vala_album = _tmp19_;
						break;
					}
				}
			} else if (_tmp17_ == ((0 != _tmp16_label1) ? _tmp16_label1 : (_tmp16_label1 = g_quark_from_static_string (G4_PAGE_NAME_ARTIST)))) {
				switch (0) {
					default:
					{
						const gchar* _tmp20_;
						gchar* _tmp21_;
						gchar** _tmp22_;
						gint _tmp22__length1;
						_tmp20_ = key;
						_tmp21_ = g_strdup (_tmp20_);
						_g_free0 (_vala_artist);
						_vala_artist = _tmp21_;
						_tmp22_ = arr;
						_tmp22__length1 = arr_length1;
						if (_tmp22__length1 > 2) {
							gchar** _tmp23_;
							gint _tmp23__length1;
							const gchar* _tmp24_;
							gchar* _tmp25_;
							_tmp23_ = arr;
							_tmp23__length1 = arr_length1;
							_tmp24_ = _tmp23_[2];
							_tmp25_ = g_uri_unescape_string (_tmp24_, NULL);
							_g_free0 (_vala_album);
							_vala_album = _tmp25_;
						}
						break;
					}
				}
			} else if (_tmp17_ == ((0 != _tmp16_label2) ? _tmp16_label2 : (_tmp16_label2 = g_quark_from_static_string (G4_PAGE_NAME_PLAYLIST)))) {
				switch (0) {
					default:
					{
						const gchar* _tmp26_;
						gchar* _tmp27_;
						_tmp26_ = key;
						_tmp27_ = g_strdup (_tmp26_);
						_g_free0 (_vala_playlist);
						_vala_playlist = _tmp27_;
						break;
					}
				}
			}
			_g_free0 (key);
			_g_free0 (_tmp7_);
		}
		_tmp28_ = arr;
		_tmp28__length1 = arr_length1;
		_tmp29_ = _tmp28_[0];
		_tmp30_ = g_strdup (_tmp29_);
		_g_free0 (_vala_host);
		_vala_host = _tmp30_;
		result = TRUE;
		arr = (_vala_array_free (arr, arr_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (path);
		if (artist) {
			*artist = _vala_artist;
		} else {
			_g_free0 (_vala_artist);
		}
		if (album) {
			*album = _vala_album;
		} else {
			_g_free0 (_vala_album);
		}
		if (playlist) {
			*playlist = _vala_playlist;
		} else {
			_g_free0 (_vala_playlist);
		}
		if (host) {
			*host = _vala_host;
		} else {
			_g_free0 (_vala_host);
		}
		return result;
	}
	result = FALSE;
	if (artist) {
		*artist = _vala_artist;
	} else {
		_g_free0 (_vala_artist);
	}
	if (album) {
		*album = _vala_album;
	} else {
		_g_free0 (_vala_album);
	}
	if (playlist) {
		*playlist = _vala_playlist;
	} else {
		_g_free0 (_vala_playlist);
	}
	if (host) {
		*host = _vala_host;
	} else {
		_g_free0 (_vala_host);
	}
	return result;
}

GMenuItem*
g4_create_menu_item_for_strv (gchar** strv,
                              gint strv_length1,
                              const gchar* label,
                              const gchar* action)
{
	GMenuItem* item = NULL;
	GMenuItem* _tmp0_;
	GVariant* _tmp1_;
	GVariant* _tmp2_;
	GMenuItem* result;
	g_return_val_if_fail (label != NULL, NULL);
	g_return_val_if_fail (action != NULL, NULL);
	_tmp0_ = g_menu_item_new (label, NULL);
	item = _tmp0_;
	_tmp1_ = g_variant_new_strv (strv, strv_length1);
	g_variant_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	g_menu_item_set_action_and_target_value (item, action, _tmp2_);
	_g_variant_unref0 (_tmp2_);
	result = item;
	return result;
}

GMenuItem*
g4_create_menu_item_for_uri (const gchar* uri,
                             const gchar* label,
                             const gchar* action)
{
	GMenuItem* item = NULL;
	GMenuItem* _tmp0_;
	GVariant* _tmp1_;
	GVariant* _tmp2_;
	GMenuItem* result;
	g_return_val_if_fail (uri != NULL, NULL);
	g_return_val_if_fail (label != NULL, NULL);
	g_return_val_if_fail (action != NULL, NULL);
	_tmp0_ = g_menu_item_new (label, NULL);
	item = _tmp0_;
	_tmp1_ = g_variant_new_string (uri);
	g_variant_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	g_menu_item_set_action_and_target_value (item, action, _tmp2_);
	_g_variant_unref0 (_tmp2_);
	result = item;
	return result;
}

GMenu*
g4_create_menu_for_album (G4Album* album)
{
	gchar* uri = NULL;
	gchar* _tmp0_;
	GMenu* menu = NULL;
	GMenu* _tmp1_;
	GMenu* _tmp2_;
	const gchar* _tmp3_;
	GMenuItem* _tmp4_;
	GMenuItem* _tmp5_;
	GMenu* _tmp6_;
	const gchar* _tmp7_;
	GMenuItem* _tmp8_;
	GMenuItem* _tmp9_;
	GMenu* section = NULL;
	GMenu* _tmp10_;
	GMenu* _tmp11_;
	const gchar* _tmp12_;
	GMenuItem* _tmp13_;
	GMenuItem* _tmp14_;
	GMenu* _tmp15_;
	const gchar* _tmp16_;
	GMenuItem* _tmp17_;
	GMenuItem* _tmp18_;
	GMenu* _tmp19_;
	const gchar* _tmp20_;
	GMenuItem* _tmp21_;
	GMenuItem* _tmp22_;
	GMenu* _tmp23_;
	GMenu* _tmp24_;
	GMenu* result;
	g_return_val_if_fail (album != NULL, NULL);
	_tmp0_ = g4_build_library_uri (NULL, album);
	uri = _tmp0_;
	_tmp1_ = g_menu_new ();
	menu = _tmp1_;
	_tmp2_ = menu;
	_tmp3_ = uri;
	_tmp4_ = g4_create_menu_item_for_uri (_tmp3_, _ ("Play"), G4_ACTION_APP G4_ACTION_PLAY);
	_tmp5_ = _tmp4_;
	g_menu_append_item (_tmp2_, _tmp5_);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = menu;
	_tmp7_ = uri;
	_tmp8_ = g4_create_menu_item_for_uri (_tmp7_, _ ("_Random Play"), G4_ACTION_APP G4_ACTION_RANDOM_PLAY);
	_tmp9_ = _tmp8_;
	g_menu_append_item (_tmp6_, _tmp9_);
	_g_object_unref0 (_tmp9_);
	_tmp10_ = g_menu_new ();
	section = _tmp10_;
	_tmp11_ = section;
	_tmp12_ = uri;
	_tmp13_ = g4_create_menu_item_for_uri (_tmp12_, _ ("Play at _Next"), G4_ACTION_APP G4_ACTION_PLAY_AT_NEXT);
	_tmp14_ = _tmp13_;
	g_menu_append_item (_tmp11_, _tmp14_);
	_g_object_unref0 (_tmp14_);
	_tmp15_ = section;
	_tmp16_ = uri;
	_tmp17_ = g4_create_menu_item_for_uri (_tmp16_, _ ("Add to _Queue"), G4_ACTION_APP G4_ACTION_ADD_TO_QUEUE);
	_tmp18_ = _tmp17_;
	g_menu_append_item (_tmp15_, _tmp18_);
	_g_object_unref0 (_tmp18_);
	_tmp19_ = section;
	_tmp20_ = uri;
	_tmp21_ = g4_create_menu_item_for_uri (_tmp20_, _ ("Add to _Playlist…"), G4_ACTION_APP G4_ACTION_ADD_TO_PLAYLIST);
	_tmp22_ = _tmp21_;
	g_menu_append_item (_tmp19_, _tmp22_);
	_g_object_unref0 (_tmp22_);
	_tmp23_ = menu;
	_tmp24_ = section;
	g_menu_append_section (_tmp23_, NULL, (GMenuModel*) _tmp24_);
	if (G4_IS_PLAYLIST (album)) {
		const gchar* list_uri = NULL;
		const gchar* _tmp25_;
		const gchar* _tmp26_;
		gint _tmp27_;
		gint _tmp28_;
		_tmp25_ = G_TYPE_CHECK_INSTANCE_CAST (album, G4_TYPE_PLAYLIST, G4Playlist)->list_uri;
		list_uri = _tmp25_;
		_tmp26_ = list_uri;
		_tmp27_ = strlen (_tmp26_);
		_tmp28_ = _tmp27_;
		if (_tmp28_ > 0) {
			GMenu* section2 = NULL;
			GMenu* _tmp29_;
			GMenu* _tmp30_;
			const gchar* _tmp31_;
			GMenuItem* _tmp32_;
			GMenuItem* _tmp33_;
			GMenu* _tmp34_;
			const gchar* _tmp35_;
			GMenuItem* _tmp36_;
			GMenuItem* _tmp37_;
			GMenu* _tmp38_;
			GMenu* _tmp39_;
			_tmp29_ = g_menu_new ();
			section2 = _tmp29_;
			_tmp30_ = section2;
			_tmp31_ = list_uri;
			_tmp32_ = g4_create_menu_item_for_uri (_tmp31_, _ ("Show List _File"), G4_ACTION_APP G4_ACTION_SHOW_FILE);
			_tmp33_ = _tmp32_;
			g_menu_append_item (_tmp30_, _tmp33_);
			_g_object_unref0 (_tmp33_);
			_tmp34_ = section2;
			_tmp35_ = list_uri;
			_tmp36_ = g4_create_menu_item_for_uri (_tmp35_, _ ("_Move to Trash"), G4_ACTION_APP G4_ACTION_TRASH_FILE);
			_tmp37_ = _tmp36_;
			g_menu_append_item (_tmp34_, _tmp37_);
			_g_object_unref0 (_tmp37_);
			_tmp38_ = menu;
			_tmp39_ = section2;
			g_menu_append_section (_tmp38_, NULL, (GMenuModel*) _tmp39_);
			_g_object_unref0 (section2);
		}
	}
	result = menu;
	_g_object_unref0 (section);
	_g_free0 (uri);
	return result;
}

GMenu*
g4_create_menu_for_artist (G4Artist* artist)
{
	gchar* uri = NULL;
	gchar* _tmp0_;
	GMenu* menu = NULL;
	GMenu* _tmp1_;
	GMenuItem* _tmp2_;
	GMenuItem* _tmp3_;
	GMenuItem* _tmp4_;
	GMenuItem* _tmp5_;
	GMenu* section = NULL;
	GMenu* _tmp6_;
	GMenuItem* _tmp7_;
	GMenuItem* _tmp8_;
	GMenuItem* _tmp9_;
	GMenuItem* _tmp10_;
	GMenuItem* _tmp11_;
	GMenuItem* _tmp12_;
	GMenu* result;
	g_return_val_if_fail (artist != NULL, NULL);
	_tmp0_ = g4_build_library_uri (artist, NULL);
	uri = _tmp0_;
	_tmp1_ = g_menu_new ();
	menu = _tmp1_;
	_tmp2_ = g4_create_menu_item_for_uri (uri, _ ("Play"), G4_ACTION_APP G4_ACTION_PLAY);
	_tmp3_ = _tmp2_;
	g_menu_append_item (menu, _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = g4_create_menu_item_for_uri (uri, _ ("_Random Play"), G4_ACTION_APP G4_ACTION_RANDOM_PLAY);
	_tmp5_ = _tmp4_;
	g_menu_append_item (menu, _tmp5_);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = g_menu_new ();
	section = _tmp6_;
	_tmp7_ = g4_create_menu_item_for_uri (uri, _ ("Play at _Next"), G4_ACTION_APP G4_ACTION_PLAY_AT_NEXT);
	_tmp8_ = _tmp7_;
	g_menu_append_item (section, _tmp8_);
	_g_object_unref0 (_tmp8_);
	_tmp9_ = g4_create_menu_item_for_uri (uri, _ ("Add to _Queue"), G4_ACTION_APP G4_ACTION_ADD_TO_QUEUE);
	_tmp10_ = _tmp9_;
	g_menu_append_item (section, _tmp10_);
	_g_object_unref0 (_tmp10_);
	_tmp11_ = g4_create_menu_item_for_uri (uri, _ ("Add to _Playlist…"), G4_ACTION_APP G4_ACTION_ADD_TO_PLAYLIST);
	_tmp12_ = _tmp11_;
	g_menu_append_item (section, _tmp12_);
	_g_object_unref0 (_tmp12_);
	g_menu_append_section (menu, NULL, (GMenuModel*) section);
	result = menu;
	_g_object_unref0 (section);
	_g_free0 (uri);
	return result;
}

GMenu*
g4_create_menu_for_music (G4Music* music,
                          gboolean has_cover)
{
	GMenu* section = NULL;
	GMenu* _tmp0_;
	GMenu* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar** _tmp5_;
	gchar** _tmp6_;
	gint _tmp6__length1;
	GMenuItem* _tmp7_;
	GMenuItem* _tmp8_;
	GMenu* _tmp9_;
	gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gchar** _tmp13_;
	gchar** _tmp14_;
	gint _tmp14__length1;
	GMenuItem* _tmp15_;
	GMenuItem* _tmp16_;
	GMenu* _tmp17_;
	gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gchar** _tmp21_;
	gchar** _tmp22_;
	gint _tmp22__length1;
	GMenuItem* _tmp23_;
	GMenuItem* _tmp24_;
	const gchar* uri = NULL;
	const gchar* _tmp25_;
	GMenu* section2 = NULL;
	GMenu* _tmp26_;
	const gchar* _tmp27_;
	GMenu* _tmp36_;
	const gchar* _tmp37_;
	GMenuItem* _tmp38_;
	GMenuItem* _tmp39_;
	GMenu* _tmp40_;
	const gchar* _tmp41_;
	GMenuItem* _tmp42_;
	GMenuItem* _tmp43_;
	GMenu* menu = NULL;
	GMenu* _tmp44_;
	const gchar* _tmp45_;
	GMenuItem* _tmp46_;
	GMenuItem* _tmp47_;
	GMenu* _tmp48_;
	GMenu* _tmp49_;
	GMenu* result;
	g_return_val_if_fail (music != NULL, NULL);
	_tmp0_ = g_menu_new ();
	section = _tmp0_;
	_tmp1_ = section;
	_tmp2_ = g_strdup ("title");
	_tmp3_ = music->title;
	_tmp4_ = g_strdup (_tmp3_);
	_tmp5_ = g_new0 (gchar*, 2 + 1);
	_tmp5_[0] = _tmp2_;
	_tmp5_[1] = _tmp4_;
	_tmp6_ = _tmp5_;
	_tmp6__length1 = 2;
	_tmp7_ = g4_create_menu_item_for_strv (_tmp6_, (gint) 2, _ ("Search Title"), G4_ACTION_WIN G4_ACTION_SEARCH);
	_tmp8_ = _tmp7_;
	g_menu_append_item (_tmp1_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	_tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL);
	_tmp9_ = section;
	_tmp10_ = g_strdup ("album");
	_tmp11_ = music->album;
	_tmp12_ = g_strdup (_tmp11_);
	_tmp13_ = g_new0 (gchar*, 2 + 1);
	_tmp13_[0] = _tmp10_;
	_tmp13_[1] = _tmp12_;
	_tmp14_ = _tmp13_;
	_tmp14__length1 = 2;
	_tmp15_ = g4_create_menu_item_for_strv (_tmp14_, (gint) 2, _ ("Search Album"), G4_ACTION_WIN G4_ACTION_SEARCH);
	_tmp16_ = _tmp15_;
	g_menu_append_item (_tmp9_, _tmp16_);
	_g_object_unref0 (_tmp16_);
	_tmp14_ = (_vala_array_free (_tmp14_, _tmp14__length1, (GDestroyNotify) g_free), NULL);
	_tmp17_ = section;
	_tmp18_ = g_strdup ("artist");
	_tmp19_ = music->artist;
	_tmp20_ = g_strdup (_tmp19_);
	_tmp21_ = g_new0 (gchar*, 2 + 1);
	_tmp21_[0] = _tmp18_;
	_tmp21_[1] = _tmp20_;
	_tmp22_ = _tmp21_;
	_tmp22__length1 = 2;
	_tmp23_ = g4_create_menu_item_for_strv (_tmp22_, (gint) 2, _ ("Search Artist"), G4_ACTION_WIN G4_ACTION_SEARCH);
	_tmp24_ = _tmp23_;
	g_menu_append_item (_tmp17_, _tmp24_);
	_g_object_unref0 (_tmp24_);
	_tmp22_ = (_vala_array_free (_tmp22_, _tmp22__length1, (GDestroyNotify) g_free), NULL);
	_tmp25_ = music->uri;
	uri = _tmp25_;
	_tmp26_ = g_menu_new ();
	section2 = _tmp26_;
	_tmp27_ = music->cover_uri;
	if (_tmp27_ != NULL) {
		GMenu* _tmp28_;
		const gchar* _tmp29_;
		GMenuItem* _tmp30_;
		GMenuItem* _tmp31_;
		_tmp28_ = section2;
		_tmp29_ = music->cover_uri;
		_tmp30_ = g4_create_menu_item_for_uri ((const gchar*) _tmp29_, _ ("Show Cover _File"), G4_ACTION_APP G4_ACTION_SHOW_FILE);
		_tmp31_ = _tmp30_;
		g_menu_append_item (_tmp28_, _tmp31_);
		_g_object_unref0 (_tmp31_);
	} else {
		if (has_cover) {
			GMenu* _tmp32_;
			const gchar* _tmp33_;
			GMenuItem* _tmp34_;
			GMenuItem* _tmp35_;
			_tmp32_ = section2;
			_tmp33_ = uri;
			_tmp34_ = g4_create_menu_item_for_uri (_tmp33_, _ ("_Export Cover"), G4_ACTION_APP G4_ACTION_EXPORT_COVER);
			_tmp35_ = _tmp34_;
			g_menu_append_item (_tmp32_, _tmp35_);
			_g_object_unref0 (_tmp35_);
		}
	}
	_tmp36_ = section2;
	_tmp37_ = uri;
	_tmp38_ = g4_create_menu_item_for_uri (_tmp37_, _ ("Show _Tags…"), G4_ACTION_APP G4_ACTION_SHOW_TAGS);
	_tmp39_ = _tmp38_;
	g_menu_append_item (_tmp36_, _tmp39_);
	_g_object_unref0 (_tmp39_);
	_tmp40_ = section2;
	_tmp41_ = uri;
	_tmp42_ = g4_create_menu_item_for_uri (_tmp41_, _ ("Show Music _File"), G4_ACTION_APP G4_ACTION_SHOW_FILE);
	_tmp43_ = _tmp42_;
	g_menu_append_item (_tmp40_, _tmp43_);
	_g_object_unref0 (_tmp43_);
	_tmp44_ = g_menu_new ();
	menu = _tmp44_;
	_tmp45_ = uri;
	_tmp46_ = g4_create_menu_item_for_uri (_tmp45_, _ ("Add to _Playlist…"), G4_ACTION_APP G4_ACTION_ADD_TO_PLAYLIST);
	_tmp47_ = _tmp46_;
	g_menu_append_item (menu, _tmp47_);
	_g_object_unref0 (_tmp47_);
	_tmp48_ = section;
	g_menu_append_section (menu, NULL, (GMenuModel*) _tmp48_);
	_tmp49_ = section2;
	g_menu_append_section (menu, NULL, (GMenuModel*) _tmp49_);
	result = menu;
	_g_object_unref0 (section2);
	_g_object_unref0 (section);
	return result;
}

GtkPopoverMenu*
g4_create_popover_menu (GMenu* menu,
                        gdouble x,
                        gdouble y)
{
	GdkRectangle rect = {0};
	GtkPopoverMenu* popover = NULL;
	GtkPopoverMenu* _tmp0_;
	GdkRectangle _tmp1_;
	GtkPopoverMenu* result;
	g_return_val_if_fail (menu != NULL, NULL);
	memset (&rect, 0, sizeof (GdkRectangle));
	rect.x = (gint) x;
	rect.y = (gint) y;
	rect.height = 0;
	rect.width = rect.height;
	_tmp0_ = (GtkPopoverMenu*) gtk_popover_menu_new_from_model ((GMenuModel*) menu);
	g_object_ref_sink (_tmp0_);
	popover = _tmp0_;
	gtk_popover_set_autohide ((GtkPopover*) popover, TRUE);
	gtk_widget_set_halign ((GtkWidget*) popover, GTK_ALIGN_START);
	gtk_popover_set_has_arrow ((GtkPopover*) popover, FALSE);
	_tmp1_ = rect;
	g_object_set ((GtkPopover*) popover, "pointing-to", &_tmp1_, NULL);
	result = popover;
	return result;
}

static Block27Data*
block27_data_ref (Block27Data* _data27_)
{
	g_atomic_int_inc (&_data27_->_ref_count_);
	return _data27_;
}

static void
block27_data_unref (void * _userdata_)
{
	Block27Data* _data27_;
	_data27_ = (Block27Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data27_->_ref_count_)) {
		_g_object_unref0 (_data27_->widget);
		g_slice_free (Block27Data, _data27_);
	}
}

static void
__lambda93_ (Block27Data* _data27_,
             gdouble x,
             gdouble y)
{
	_data27_->pressed (_data27_->widget, x, y, _data27_->pressed_target);
}

static void
___lambda93__gtk_gesture_long_press_pressed (GtkGestureLongPress* _sender,
                                             gdouble x,
                                             gdouble y,
                                             gpointer self)
{
	__lambda93_ (self, x, y);
}

GtkGestureLongPress*
g4_make_long_pressable (GtkWidget* widget,
                        G4Pressed pressed,
                        gpointer pressed_target)
{
	Block27Data* _data27_;
	GtkWidget* _tmp0_;
	GtkGestureLongPress* gesture = NULL;
	GtkGestureLongPress* _tmp1_;
	GtkEventController* _tmp2_;
	GtkGestureLongPress* result;
	g_return_val_if_fail (widget != NULL, NULL);
	_data27_ = g_slice_new0 (Block27Data);
	_data27_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (widget);
	_g_object_unref0 (_data27_->widget);
	_data27_->widget = _tmp0_;
	_data27_->pressed = pressed;
	_data27_->pressed_target = pressed_target;
	_tmp1_ = (GtkGestureLongPress*) gtk_gesture_long_press_new ();
	gesture = _tmp1_;
	g_signal_connect_data (gesture, "pressed", (GCallback) ___lambda93__gtk_gesture_long_press_pressed, block27_data_ref (_data27_), (GClosureNotify) block27_data_unref, 0);
	_tmp2_ = _g_object_ref0 ((GtkEventController*) gesture);
	gtk_widget_add_controller (_data27_->widget, _tmp2_);
	result = gesture;
	block27_data_unref (_data27_);
	_data27_ = NULL;
	return result;
}

static Block28Data*
block28_data_ref (Block28Data* _data28_)
{
	g_atomic_int_inc (&_data28_->_ref_count_);
	return _data28_;
}

static void
block28_data_unref (void * _userdata_)
{
	Block28Data* _data28_;
	_data28_ = (Block28Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data28_->_ref_count_)) {
		_g_object_unref0 (_data28_->widget);
		g_slice_free (Block28Data, _data28_);
	}
}

static void
__lambda92_ (Block28Data* _data28_,
             gint n,
             gdouble x,
             gdouble y)
{
	_data28_->pressed (_data28_->widget, x, y, _data28_->pressed_target);
}

static void
___lambda92__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                        gint n_press,
                                        gdouble x,
                                        gdouble y,
                                        gpointer self)
{
	__lambda92_ (self, n_press, x, y);
}

GtkGestureClick*
g4_make_right_clickable (GtkWidget* widget,
                         G4Pressed pressed,
                         gpointer pressed_target)
{
	Block28Data* _data28_;
	GtkWidget* _tmp0_;
	GtkGestureClick* gesture = NULL;
	GtkGestureClick* _tmp1_;
	GtkEventController* _tmp2_;
	GtkGestureClick* result;
	g_return_val_if_fail (widget != NULL, NULL);
	_data28_ = g_slice_new0 (Block28Data);
	_data28_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (widget);
	_g_object_unref0 (_data28_->widget);
	_data28_->widget = _tmp0_;
	_data28_->pressed = pressed;
	_data28_->pressed_target = pressed_target;
	_tmp1_ = (GtkGestureClick*) gtk_gesture_click_new ();
	gesture = _tmp1_;
	gtk_gesture_single_set_button ((GtkGestureSingle*) gesture, (guint) GDK_BUTTON_SECONDARY);
	g_signal_connect_data (gesture, "pressed", (GCallback) ___lambda92__gtk_gesture_click_pressed, block28_data_ref (_data28_), (GClosureNotify) block28_data_unref, 0);
	_tmp2_ = _g_object_ref0 ((GtkEventController*) gesture);
	gtk_widget_add_controller (_data28_->widget, _tmp2_);
	result = gesture;
	block28_data_unref (_data28_);
	_data28_ = NULL;
	return result;
}

void
g4_remove_controllers (GtkWidget* widget)
{
	GListModel* controllers = NULL;
	GListModel* _tmp0_;
	g_return_if_fail (widget != NULL);
	_tmp0_ = gtk_widget_observe_controllers (widget);
	controllers = _tmp0_;
	{
		gint i = 0;
		GListModel* _tmp1_;
		_tmp1_ = controllers;
		i = ((gint) g_list_model_get_n_items (_tmp1_)) - 1;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				GtkEventController* controller = NULL;
				GListModel* _tmp4_;
				GObject* _tmp5_;
				GtkEventController* _tmp6_;
				if (!_tmp2_) {
					gint _tmp3_;
					_tmp3_ = i;
					i = _tmp3_ - 1;
				}
				_tmp2_ = FALSE;
				if (!(i >= 0)) {
					break;
				}
				_tmp4_ = controllers;
				_tmp5_ = g_list_model_get_item (_tmp4_, (guint) i);
				controller = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, gtk_event_controller_get_type (), GtkEventController);
				_tmp6_ = controller;
				gtk_widget_remove_controller (widget, _tmp6_);
				_g_object_unref0 (controller);
			}
		}
	}
	_g_object_unref0 (controllers);
}

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;
}

