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

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

#define G4_THUMBNAILER_ICON_SIZE 48
#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_PLAYLIST_DIALOG (g4_playlist_dialog_get_type ())
#define G4_PLAYLIST_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_PLAYLIST_DIALOG, G4PlaylistDialog))
#define G4_PLAYLIST_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_PLAYLIST_DIALOG, G4PlaylistDialogClass))
#define G4_IS_PLAYLIST_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_PLAYLIST_DIALOG))
#define G4_IS_PLAYLIST_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_PLAYLIST_DIALOG))
#define G4_PLAYLIST_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_PLAYLIST_DIALOG, G4PlaylistDialogClass))

typedef struct _G4PlaylistDialog G4PlaylistDialog;
typedef struct _G4PlaylistDialogClass G4PlaylistDialogClass;
typedef struct _G4PlaylistDialogPrivate G4PlaylistDialogPrivate;

#define G4_TYPE_APPLICATION (g4_application_get_type ())
#define G4_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_APPLICATION, G4Application))
#define G4_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_APPLICATION, G4ApplicationClass))
#define G4_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_APPLICATION))
#define G4_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_APPLICATION))
#define G4_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_APPLICATION, G4ApplicationClass))

typedef struct _G4Application G4Application;
typedef struct _G4ApplicationClass G4ApplicationClass;

#define G4_TYPE_MUSIC_LIST (g4_music_list_get_type ())
#define G4_MUSIC_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_MUSIC_LIST, G4MusicList))
#define G4_MUSIC_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_MUSIC_LIST, G4MusicListClass))
#define G4_IS_MUSIC_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_MUSIC_LIST))
#define G4_IS_MUSIC_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_MUSIC_LIST))
#define G4_MUSIC_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_MUSIC_LIST, G4MusicListClass))

typedef struct _G4MusicList G4MusicList;
typedef struct _G4MusicListClass G4MusicListClass;

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

#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;
enum  {
	G4_PLAYLIST_DIALOG_0_PROPERTY,
	G4_PLAYLIST_DIALOG_NUM_PROPERTIES
};
static GParamSpec* g4_playlist_dialog_properties[G4_PLAYLIST_DIALOG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block33Data Block33Data;

#define G4_TYPE_THUMBNAILER (g4_thumbnailer_get_type ())
#define G4_THUMBNAILER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_THUMBNAILER, G4Thumbnailer))
#define G4_THUMBNAILER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_THUMBNAILER, G4ThumbnailerClass))
#define G4_IS_THUMBNAILER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_THUMBNAILER))
#define G4_IS_THUMBNAILER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_THUMBNAILER))
#define G4_THUMBNAILER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_THUMBNAILER, G4ThumbnailerClass))

typedef struct _G4Thumbnailer G4Thumbnailer;
typedef struct _G4ThumbnailerClass G4ThumbnailerClass;

#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;
typedef struct _G4MusicPrivate G4MusicPrivate;
typedef struct _G4PlaylistDialogChooseData G4PlaylistDialogChooseData;
typedef struct _Block34Data Block34Data;
typedef void (*G4VoidFunc) (gpointer user_data);
typedef struct _G4AlbumPrivate G4AlbumPrivate;
typedef struct _G4PlaylistPrivate G4PlaylistPrivate;

#define G4_TYPE_MUSIC_LIBRARY (g4_music_library_get_type ())
#define G4_MUSIC_LIBRARY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_MUSIC_LIBRARY, G4MusicLibrary))
#define G4_MUSIC_LIBRARY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_MUSIC_LIBRARY, G4MusicLibraryClass))
#define G4_IS_MUSIC_LIBRARY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_MUSIC_LIBRARY))
#define G4_IS_MUSIC_LIBRARY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_MUSIC_LIBRARY))
#define G4_MUSIC_LIBRARY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_MUSIC_LIBRARY, G4MusicLibraryClass))

typedef struct _G4MusicLibrary G4MusicLibrary;
typedef struct _G4MusicLibraryClass G4MusicLibraryClass;

#define G4_TYPE_MUSIC_LOADER (g4_music_loader_get_type ())
#define G4_MUSIC_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_MUSIC_LOADER, G4MusicLoader))
#define G4_MUSIC_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_MUSIC_LOADER, G4MusicLoaderClass))
#define G4_IS_MUSIC_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_MUSIC_LOADER))
#define G4_IS_MUSIC_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_MUSIC_LOADER))
#define G4_MUSIC_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_MUSIC_LOADER, G4MusicLoaderClass))

typedef struct _G4MusicLoader G4MusicLoader;
typedef struct _G4MusicLoaderClass G4MusicLoaderClass;

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

struct _G4DialogClass {
	AdwDialogClass parent_class;
};

struct _G4PlaylistDialog {
	G4Dialog parent_instance;
	G4PlaylistDialogPrivate * priv;
};

struct _G4PlaylistDialogClass {
	G4DialogClass parent_class;
};

struct _G4PlaylistDialogPrivate {
	GtkToggleButton* search_btn;
	GtkSearchEntry* search_entry;
	G4Application* _app;
	GSourceFunc _callback;
	gpointer _callback_target;
	GDestroyNotify _callback_target_destroy_notify;
	G4MusicList* _list;
	G4Playlist* _playlist;
	gchar* _search_text;
};

struct _Block33Data {
	int _ref_count_;
	G4PlaylistDialog* self;
	GdkPaintable* loading_paintable;
};

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 _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 _G4PlaylistDialogChooseData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	G4PlaylistDialog* self;
	GtkWindow* parent;
	G4Playlist* result;
	G4Playlist* _tmp0_;
	G4Playlist* _tmp1_;
};

struct _Block34Data {
	int _ref_count_;
	G4PlaylistDialog* self;
	G4MusicList* list;
};

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

static gint G4PlaylistDialog_private_offset;
static gpointer g4_playlist_dialog_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_playlist_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4PlaylistDialog, g_object_unref)
VALA_EXTERN GType g4_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4Application, g_object_unref)
VALA_EXTERN GType g4_music_list_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4MusicList, 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 GType g4_album_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4Album, g_object_unref)
VALA_EXTERN GType g4_playlist_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4Playlist, g_object_unref)
VALA_EXTERN G4PlaylistDialog* g4_playlist_dialog_new (G4Application* app);
VALA_EXTERN G4PlaylistDialog* g4_playlist_dialog_construct (GType object_type,
                                                G4Application* app);
static Block33Data* block33_data_ref (Block33Data* _data33_);
static void block33_data_unref (void * _userdata_);
VALA_EXTERN G4Dialog* g4_dialog_new (void);
VALA_EXTERN G4Dialog* g4_dialog_construct (GType object_type);
static void __lambda76_ (G4PlaylistDialog* self);
static void g4_playlist_dialog_close_with_result (G4PlaylistDialog* self,
                                           G4Playlist* playlist);
VALA_EXTERN G4Playlist* g4_playlist_new (const gchar* name,
                             const gchar* uri);
VALA_EXTERN G4Playlist* g4_playlist_construct (GType object_type,
                                   const gchar* name,
                                   const gchar* uri);
static void ___lambda76__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void g4_playlist_dialog_on_search_btn_toggled (G4PlaylistDialog* self);
static void _g4_playlist_dialog_on_search_btn_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                          gpointer self);
static void g4_playlist_dialog_on_search_text_changed (G4PlaylistDialog* self);
static void _g4_playlist_dialog_on_search_text_changed_gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                                                 gpointer self);
VALA_EXTERN GType g4_thumbnailer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4Thumbnailer, g_object_unref)
VALA_EXTERN G4Thumbnailer* g4_application_get_thumbnailer (G4Application* self);
VALA_EXTERN GdkPaintable* g4_thumbnailer_create_simple_text_paintable (G4Thumbnailer* self,
                                                           const gchar* text,
                                                           gint size,
                                                           guint color_index);
VALA_EXTERN G4MusicList* g4_music_list_new (G4Application* app,
                                GType item_type,
                                G4Music* node,
                                gboolean editable,
                                gboolean selectable);
VALA_EXTERN G4MusicList* g4_music_list_construct (GType object_type,
                                      G4Application* app,
                                      GType item_type,
                                      G4Music* node,
                                      gboolean editable,
                                      gboolean selectable);
static void __lambda77_ (G4PlaylistDialog* self,
                  guint position,
                  GObject* obj);
static void ___lambda77__g4_music_list_item_activated (G4MusicList* _sender,
                                                guint position,
                                                GObject* obj,
                                                gpointer self);
static void __lambda78_ (G4PlaylistDialog* self,
                  GtkListItem* item);
VALA_EXTERN GType g4_music_widget_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4MusicWidget, g_object_unref)
VALA_EXTERN GtkImage* g4_music_widget_get_playing (G4MusicWidget* self);
static void ___lambda78__g4_music_list_item_created (G4MusicList* _sender,
                                              GtkListItem* item,
                                              gpointer self);
static void __lambda79_ (Block33Data* _data33_,
                  GtkListItem* item);
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 void g4_music_widget_set_paintable (G4MusicWidget* self,
                                    GdkPaintable* value);
VALA_EXTERN void g4_music_widget_set_title (G4MusicWidget* self,
                                const gchar* value);
static void ___lambda79__g4_music_list_item_binded (G4MusicList* _sender,
                                             GtkListItem* item,
                                             gpointer self);
static void g4_playlist_dialog_on_music_library_changed (G4PlaylistDialog* self,
                                                  gboolean external);
static void _g4_playlist_dialog_on_music_library_changed_g4_application_music_library_changed (G4Application* _sender,
                                                                                        gboolean external,
                                                                                        gpointer self);
static void g4_playlist_dialog_choose_data_free (gpointer _data);
VALA_EXTERN void g4_playlist_dialog_choose (G4PlaylistDialog* self,
                                GtkWindow* parent,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN G4Playlist* g4_playlist_dialog_choose_finish (G4PlaylistDialog* self,
                                              GAsyncResult* _res_);
static gboolean g4_playlist_dialog_choose_co (G4PlaylistDialogChooseData* _data_);
static gboolean _g4_playlist_dialog_choose_co_gsource_func (gpointer self);
VALA_EXTERN void g4_dialog_present (G4Dialog* self,
                        GtkWidget* parent);
static void g4_playlist_dialog_real_closed (AdwDialog* base);
static Block34Data* block34_data_ref (Block34Data* _data34_);
static void block34_data_unref (void * _userdata_);
VALA_EXTERN guint g4_run_idle_once (G4VoidFunc func,
                        gpointer func_target,
                        GDestroyNotify func_target_destroy_notify,
                        gint priority);
static void __lambda83_ (Block34Data* _data34_);
static void ___lambda83__g4_void_func (gpointer self);
static gint* _int_dup (gint* self);
VALA_EXTERN GSettings* g4_application_get_settings (G4Application* self);
VALA_EXTERN GType g4_music_library_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4MusicLibrary, g_object_unref)
VALA_EXTERN GType g4_music_loader_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4MusicLoader, g_object_unref)
VALA_EXTERN G4MusicLoader* g4_application_get_loader (G4Application* self);
VALA_EXTERN G4MusicLibrary* g4_music_loader_get_library (G4MusicLoader* self);
VALA_EXTERN GListStore* g4_music_list_get_data_store (G4MusicList* self);
VALA_EXTERN gchar* g4_get_display_name (const gchar* uri);
VALA_EXTERN const gchar* g4_application_get_music_folder (G4Application* self);
VALA_EXTERN void g4_music_library_overwrite_playlists_to (G4MusicLibrary* self,
                                              GListStore* store);
VALA_EXTERN void g4_music_list_set_empty_text (G4MusicList* self,
                                   const gchar* text);
VALA_EXTERN G4Playlist* g4_music_library_get_playlist (G4MusicLibrary* self,
                                           const gchar* key);
VALA_EXTERN void g4_music_list_set_current_node (G4MusicList* self,
                                     G4Music* value);
VALA_EXTERN gint g4_music_list_set_to_current_item (G4MusicList* self,
                                        gboolean scroll);
static gboolean g4_playlist_dialog_on_search_match (G4PlaylistDialog* self,
                                             GObject* obj);
VALA_EXTERN GtkFilterListModel* g4_music_list_get_filter_model (G4MusicList* self);
static gboolean _g4_playlist_dialog_on_search_match_gtk_custom_filter_func (GObject* item,
                                                                     gpointer self);
static void g4_playlist_dialog_finalize (GObject * obj);
static GType g4_playlist_dialog_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
g4_playlist_dialog_get_instance_private (G4PlaylistDialog* self)
{
	return G_STRUCT_MEMBER_P (self, G4PlaylistDialog_private_offset);
}

static Block33Data*
block33_data_ref (Block33Data* _data33_)
{
	g_atomic_int_inc (&_data33_->_ref_count_);
	return _data33_;
}

static void
block33_data_unref (void * _userdata_)
{
	Block33Data* _data33_;
	_data33_ = (Block33Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data33_->_ref_count_)) {
		G4PlaylistDialog* self;
		self = _data33_->self;
		_g_object_unref0 (_data33_->loading_paintable);
		_g_object_unref0 (self);
		g_slice_free (Block33Data, _data33_);
	}
}

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

static void
__lambda76_ (G4PlaylistDialog* self)
{
	G4Playlist* _tmp0_;
	G4Playlist* _tmp1_;
	_tmp0_ = g4_playlist_new ("", "");
	_tmp1_ = _tmp0_;
	g4_playlist_dialog_close_with_result (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
}

static void
___lambda76__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda76_ ((G4PlaylistDialog*) self);
}

static void
_g4_playlist_dialog_on_search_btn_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                     gpointer self)
{
	g4_playlist_dialog_on_search_btn_toggled ((G4PlaylistDialog*) self);
}

static void
_g4_playlist_dialog_on_search_text_changed_gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                                            gpointer self)
{
	g4_playlist_dialog_on_search_text_changed ((G4PlaylistDialog*) self);
}

static void
__lambda77_ (G4PlaylistDialog* self,
             guint position,
             GObject* obj)
{
	g4_playlist_dialog_close_with_result (self, G4_IS_PLAYLIST (obj) ? ((G4Playlist*) obj) : NULL);
}

static void
___lambda77__g4_music_list_item_activated (G4MusicList* _sender,
                                           guint position,
                                           GObject* obj,
                                           gpointer self)
{
	__lambda77_ ((G4PlaylistDialog*) self, position, obj);
}

static void
__lambda78_ (G4PlaylistDialog* self,
             GtkListItem* item)
{
	G4MusicWidget* cell = NULL;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	G4MusicWidget* _tmp2_;
	GtkImage* _tmp3_;
	GtkImage* _tmp4_;
	g_return_if_fail (item != NULL);
	_tmp0_ = gtk_list_item_get_child (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, G4_TYPE_MUSIC_WIDGET, G4MusicWidget));
	cell = _tmp2_;
	_tmp3_ = g4_music_widget_get_playing (cell);
	_tmp4_ = _tmp3_;
	g_object_set (_tmp4_, "icon-name", "document-open-recent-symbolic", NULL);
	_g_object_unref0 (cell);
}

static void
___lambda78__g4_music_list_item_created (G4MusicList* _sender,
                                         GtkListItem* item,
                                         gpointer self)
{
	__lambda78_ ((G4PlaylistDialog*) self, item);
}

static void
__lambda79_ (Block33Data* _data33_,
             GtkListItem* item)
{
	G4PlaylistDialog* self;
	G4MusicWidget* cell = NULL;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	G4MusicWidget* _tmp2_;
	G4Playlist* playlist = NULL;
	GObject* _tmp3_;
	GObject* _tmp4_;
	G4Playlist* _tmp5_;
	G4Music* _tmp6_;
	const gchar* _tmp7_;
	self = _data33_->self;
	g_return_if_fail (item != NULL);
	_tmp0_ = gtk_list_item_get_child (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, G4_TYPE_MUSIC_WIDGET, G4MusicWidget));
	cell = _tmp2_;
	_tmp3_ = gtk_list_item_get_item (item);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, G4_TYPE_PLAYLIST, G4Playlist));
	playlist = _tmp5_;
	_tmp6_ = _g_object_ref0 ((G4Music*) playlist);
	_g_object_unref0 (cell->music);
	cell->music = _tmp6_;
	g4_music_widget_set_paintable (cell, _data33_->loading_paintable);
	_tmp7_ = ((G4Music*) playlist)->title;
	g4_music_widget_set_title (cell, _tmp7_);
	_g_object_unref0 (playlist);
	_g_object_unref0 (cell);
}

static void
___lambda79__g4_music_list_item_binded (G4MusicList* _sender,
                                        GtkListItem* item,
                                        gpointer self)
{
	__lambda79_ (self, item);
}

static void
_g4_playlist_dialog_on_music_library_changed_g4_application_music_library_changed (G4Application* _sender,
                                                                                   gboolean external,
                                                                                   gpointer self)
{
	g4_playlist_dialog_on_music_library_changed ((G4PlaylistDialog*) self, external);
}

G4PlaylistDialog*
g4_playlist_dialog_construct (GType object_type,
                              G4Application* app)
{
	G4PlaylistDialog * self = NULL;
	Block33Data* _data33_;
	G4Application* _tmp0_;
	GtkBox* content = NULL;
	GtkBox* _tmp1_;
	GtkHeaderBar* header = NULL;
	GtkHeaderBar* _tmp2_;
	GtkLabel* _tmp3_;
	GtkLabel* _tmp4_;
	GtkButton* new_btn = NULL;
	GtkButton* _tmp5_;
	GtkToggleButton* _tmp6_;
	GtkSearchBar* search_bar = NULL;
	GtkSearchBar* _tmp7_;
	GtkSearchEntry* _tmp8_;
	GtkToggleButton* _tmp9_;
	GtkToggleButton* _tmp10_;
	GtkToggleButton* _tmp11_;
	GtkToggleButton* _tmp12_;
	GtkSearchEntry* _tmp13_;
	GtkSearchEntry* _tmp14_;
	G4Thumbnailer* _tmp15_;
	G4Thumbnailer* _tmp16_;
	GdkPaintable* _tmp17_;
	G4MusicList* list = NULL;
	G4MusicList* _tmp18_;
	G4MusicList* _tmp19_;
	g_return_val_if_fail (app != NULL, NULL);
	_data33_ = g_slice_new0 (Block33Data);
	_data33_->_ref_count_ = 1;
	self = (G4PlaylistDialog*) g4_dialog_construct (object_type);
	_data33_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (app);
	_g_object_unref0 (self->priv->_app);
	self->priv->_app = _tmp0_;
	_tmp1_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp1_);
	content = _tmp1_;
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) content);
	_tmp2_ = (GtkHeaderBar*) gtk_header_bar_new ();
	g_object_ref_sink (_tmp2_);
	header = _tmp2_;
	_tmp3_ = (GtkLabel*) gtk_label_new (_ ("Add to Playlist"));
	g_object_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	gtk_header_bar_set_title_widget (header, (GtkWidget*) _tmp4_);
	_g_object_unref0 (_tmp4_);
	gtk_widget_add_css_class ((GtkWidget*) header, "flat");
	gtk_box_append (content, (GtkWidget*) header);
	_tmp5_ = (GtkButton*) gtk_button_new_from_icon_name ("folder-new-symbolic");
	g_object_ref_sink (_tmp5_);
	new_btn = _tmp5_;
	gtk_widget_set_tooltip_text ((GtkWidget*) new_btn, _ ("New Playlist"));
	g_signal_connect_object (new_btn, "clicked", (GCallback) ___lambda76__gtk_button_clicked, self, 0);
	gtk_header_bar_pack_start (header, (GtkWidget*) new_btn);
	_tmp6_ = self->priv->search_btn;
	gtk_header_bar_pack_end (header, (GtkWidget*) _tmp6_);
	_tmp7_ = (GtkSearchBar*) gtk_search_bar_new ();
	g_object_ref_sink (_tmp7_);
	search_bar = _tmp7_;
	_tmp8_ = self->priv->search_entry;
	gtk_search_bar_set_child (search_bar, (GtkWidget*) _tmp8_);
	gtk_search_bar_set_key_capture_widget (search_bar, (GtkWidget*) content);
	gtk_box_append (content, (GtkWidget*) search_bar);
	_tmp9_ = self->priv->search_btn;
	gtk_button_set_icon_name ((GtkButton*) _tmp9_, "edit-find-symbolic");
	_tmp10_ = self->priv->search_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp10_, _ ("Search"));
	_tmp11_ = self->priv->search_btn;
	g_signal_connect_object (_tmp11_, "toggled", (GCallback) _g4_playlist_dialog_on_search_btn_toggled_gtk_toggle_button_toggled, self, 0);
	_tmp12_ = self->priv->search_btn;
	g_object_bind_property_with_closures ((GObject*) _tmp12_, "active", (GObject*) search_bar, "search-mode-enabled", G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp13_ = self->priv->search_entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp13_, TRUE);
	_tmp14_ = self->priv->search_entry;
	g_signal_connect_object (_tmp14_, "search-changed", (GCallback) _g4_playlist_dialog_on_search_text_changed_gtk_search_entry_search_changed, self, 0);
	_tmp15_ = g4_application_get_thumbnailer (app);
	_tmp16_ = _tmp15_;
	_tmp17_ = g4_thumbnailer_create_simple_text_paintable (_tmp16_, "...", G4_THUMBNAILER_ICON_SIZE, (guint) 0x7fffffff);
	_data33_->loading_paintable = _tmp17_;
	_tmp18_ = g4_music_list_new (app, G4_TYPE_PLAYLIST, NULL, FALSE, FALSE);
	g_object_ref_sink (_tmp18_);
	list = _tmp18_;
	gtk_widget_set_hexpand ((GtkWidget*) list, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) list, TRUE);
	gtk_widget_set_margin_bottom ((GtkWidget*) list, 2);
	g_signal_connect_object (list, "item-activated", (GCallback) ___lambda77__g4_music_list_item_activated, self, 0);
	g_signal_connect_object (list, "item-created", (GCallback) ___lambda78__g4_music_list_item_created, self, 0);
	g_signal_connect_data (list, "item-binded", (GCallback) ___lambda79__g4_music_list_item_binded, block33_data_ref (_data33_), (GClosureNotify) block33_data_unref, 0);
	gtk_box_append (content, (GtkWidget*) list);
	_tmp19_ = _g_object_ref0 (list);
	_g_object_unref0 (self->priv->_list);
	self->priv->_list = _tmp19_;
	g_signal_connect_object (app, "music-library-changed", (GCallback) _g4_playlist_dialog_on_music_library_changed_g4_application_music_library_changed, self, 0);
	g4_playlist_dialog_on_music_library_changed (self, TRUE);
	_g_object_unref0 (list);
	_g_object_unref0 (search_bar);
	_g_object_unref0 (new_btn);
	_g_object_unref0 (header);
	_g_object_unref0 (content);
	block33_data_unref (_data33_);
	_data33_ = NULL;
	return self;
}

G4PlaylistDialog*
g4_playlist_dialog_new (G4Application* app)
{
	return g4_playlist_dialog_construct (G4_TYPE_PLAYLIST_DIALOG, app);
}

static void
g4_playlist_dialog_choose_data_free (gpointer _data)
{
	G4PlaylistDialogChooseData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->parent);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (G4PlaylistDialogChooseData, _data_);
}

void
g4_playlist_dialog_choose (G4PlaylistDialog* self,
                           GtkWindow* parent,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_)
{
	G4PlaylistDialogChooseData* _data_;
	G4PlaylistDialog* _tmp0_;
	GtkWindow* _tmp1_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (G4PlaylistDialogChooseData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, g4_playlist_dialog_choose_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (parent);
	_g_object_unref0 (_data_->parent);
	_data_->parent = _tmp1_;
	g4_playlist_dialog_choose_co (_data_);
}

G4Playlist*
g4_playlist_dialog_choose_finish (G4PlaylistDialog* self,
                                  GAsyncResult* _res_)
{
	G4Playlist* result;
	G4PlaylistDialogChooseData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static gboolean
_g4_playlist_dialog_choose_co_gsource_func (gpointer self)
{
	gboolean result;
	result = g4_playlist_dialog_choose_co (self);
	return result;
}

static gboolean
g4_playlist_dialog_choose_co (G4PlaylistDialogChooseData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	(_data_->self->priv->_callback_target_destroy_notify == NULL) ? NULL : (_data_->self->priv->_callback_target_destroy_notify (_data_->self->priv->_callback_target), NULL);
	_data_->self->priv->_callback = NULL;
	_data_->self->priv->_callback_target = NULL;
	_data_->self->priv->_callback_target_destroy_notify = NULL;
	_data_->self->priv->_callback = _g4_playlist_dialog_choose_co_gsource_func;
	_data_->self->priv->_callback_target = _data_;
	_data_->self->priv->_callback_target_destroy_notify = NULL;
	g4_dialog_present ((G4Dialog*) _data_->self, (GtkWidget*) _data_->parent);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp0_ = _data_->self->priv->_playlist;
	_data_->_tmp1_ = _g_object_ref0 (_data_->_tmp0_);
	_data_->result = _data_->_tmp1_;
	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 Block34Data*
block34_data_ref (Block34Data* _data34_)
{
	g_atomic_int_inc (&_data34_->_ref_count_);
	return _data34_;
}

static void
block34_data_unref (void * _userdata_)
{
	Block34Data* _data34_;
	_data34_ = (Block34Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data34_->_ref_count_)) {
		G4PlaylistDialog* self;
		self = _data34_->self;
		_g_object_unref0 (_data34_->list);
		_g_object_unref0 (self);
		g_slice_free (Block34Data, _data34_);
	}
}

static void
__lambda83_ (Block34Data* _data34_)
{
	G4PlaylistDialog* self;
	G4MusicList* _tmp0_ = NULL;
	G4MusicList* _tmp1_;
	self = _data34_->self;
	_tmp1_ = _data34_->list;
	_tmp0_ = _tmp1_;
	if (_tmp0_ != NULL) {
		gtk_widget_unparent ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, G4_TYPE_MUSIC_LIST, G4MusicList));
	}
}

static void
___lambda83__g4_void_func (gpointer self)
{
	__lambda83_ (self);
}

static void
g4_playlist_dialog_real_closed (AdwDialog* base)
{
	G4PlaylistDialog * self;
	Block34Data* _data34_;
	G4Application* _tmp0_;
	guint _tmp1_;
	G4MusicList* _tmp2_;
	G4MusicList* _tmp3_;
	GSourceFunc callback = NULL;
	GSourceFunc _tmp4_;
	gpointer _tmp4__target;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
	GSourceFunc _tmp5_;
	gpointer _tmp5__target;
	self = (G4PlaylistDialog*) base;
	_data34_ = g_slice_new0 (Block34Data);
	_data34_->_ref_count_ = 1;
	_data34_->self = g_object_ref (self);
	_tmp0_ = self->priv->_app;
	g_signal_parse_name ("music-library-changed", G4_TYPE_APPLICATION, &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _g4_playlist_dialog_on_music_library_changed_g4_application_music_library_changed, self);
	_tmp2_ = self->priv->_list;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_data34_->list = _tmp3_;
	_g_object_unref0 (self->priv->_list);
	self->priv->_list = NULL;
	g4_run_idle_once (___lambda83__g4_void_func, block34_data_ref (_data34_), block34_data_unref, G_PRIORITY_LOW);
	_tmp4_ = self->priv->_callback;
	_tmp4__target = self->priv->_callback_target;
	callback = _tmp4_;
	callback_target = _tmp4__target;
	callback_target_destroy_notify = NULL;
	(self->priv->_callback_target_destroy_notify == NULL) ? NULL : (self->priv->_callback_target_destroy_notify (self->priv->_callback_target), NULL);
	self->priv->_callback = NULL;
	self->priv->_callback_target = NULL;
	self->priv->_callback_target_destroy_notify = NULL;
	self->priv->_callback = NULL;
	self->priv->_callback_target = NULL;
	self->priv->_callback_target_destroy_notify = NULL;
	_tmp5_ = callback;
	_tmp5__target = callback_target;
	if (_tmp5_ != NULL) {
		GSourceFunc _tmp6_;
		gpointer _tmp6__target;
		_tmp6_ = callback;
		_tmp6__target = callback_target;
		g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, (GSourceFunc) _tmp6_, _tmp6__target, NULL);
	}
	(callback_target_destroy_notify == NULL) ? NULL : (callback_target_destroy_notify (callback_target), NULL);
	callback = NULL;
	callback_target = NULL;
	callback_target_destroy_notify = NULL;
	block34_data_unref (_data34_);
	_data34_ = NULL;
}

static gint*
_int_dup (gint* self)
{
	gint* dup;
	dup = g_new0 (gint, 1);
	memcpy (dup, self, sizeof (gint));
	return dup;
}

static gpointer
__int_dup0 (gpointer self)
{
	return self ? _int_dup (self) : NULL;
}

static void
g4_playlist_dialog_close_with_result (G4PlaylistDialog* self,
                                      G4Playlist* playlist)
{
	G4Playlist* _tmp0_;
	G4Playlist* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	const gchar* _tmp4_ = NULL;
	gint* _tmp5_ = NULL;
	gint* _tmp9_ = NULL;
	gint* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (playlist);
	_g_object_unref0 (self->priv->_playlist);
	self->priv->_playlist = _tmp0_;
	_tmp1_ = playlist;
	_tmp2_ = NULL;
	if (_tmp1_ != NULL) {
		const gchar* _tmp3_;
		_tmp3_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, G4_TYPE_PLAYLIST, G4Playlist)->list_uri;
		_tmp2_ = _tmp3_;
	}
	_tmp4_ = _tmp2_;
	_tmp5_ = NULL;
	if (_tmp4_ != NULL) {
		gint _tmp6_;
		gint _tmp7_;
		gint* _tmp8_;
		_tmp6_ = strlen ((const gchar*) _tmp4_);
		_tmp7_ = _tmp6_;
		_tmp8_ = __int_dup0 (&_tmp7_);
		_g_free0 (_tmp5_);
		_tmp5_ = _tmp8_;
	}
	_tmp10_ = __int_dup0 (_tmp5_);
	_tmp9_ = _tmp10_;
	if (_tmp9_ == NULL) {
		gint _tmp11_;
		gint* _tmp12_;
		_tmp11_ = 0;
		_tmp12_ = __int_dup0 (&_tmp11_);
		_g_free0 (_tmp9_);
		_tmp9_ = _tmp12_;
	}
	if ((*_tmp9_) > 0) {
		G4Application* _tmp13_;
		GSettings* _tmp14_;
		GSettings* _tmp15_;
		const gchar* _tmp16_;
		_tmp13_ = self->priv->_app;
		_tmp14_ = g4_application_get_settings (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = G_TYPE_CHECK_INSTANCE_CAST (playlist, G4_TYPE_PLAYLIST, G4Playlist)->list_uri;
		g_settings_set_string (_tmp15_, "recent-playlist", _tmp16_);
	}
	adw_dialog_close ((AdwDialog*) self);
	_g_free0 (_tmp9_);
	_g_free0 (_tmp5_);
}

static void
g4_playlist_dialog_on_music_library_changed (G4PlaylistDialog* self,
                                             gboolean external)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	if (external) {
		G4MusicList* _tmp1_;
		_tmp1_ = self->priv->_list;
		_tmp0_ = _tmp1_ != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		G4MusicList* list = NULL;
		G4MusicList* _tmp2_;
		G4MusicList* _tmp3_;
		G4MusicLibrary* library = NULL;
		G4Application* _tmp4_;
		G4MusicLoader* _tmp5_;
		G4MusicLoader* _tmp6_;
		G4MusicLibrary* _tmp7_;
		G4MusicLibrary* _tmp8_;
		G4MusicLibrary* _tmp9_;
		GListStore* store = NULL;
		G4MusicList* _tmp10_;
		GListStore* _tmp11_;
		GListStore* _tmp12_;
		GListStore* _tmp13_;
		gchar* text = NULL;
		G4Application* _tmp14_;
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		G4MusicLibrary* _tmp21_;
		GListStore* _tmp22_;
		G4MusicList* _tmp23_;
		const gchar* _tmp24_;
		gchar* recent_uri = NULL;
		G4Application* _tmp25_;
		GSettings* _tmp26_;
		GSettings* _tmp27_;
		gchar* _tmp28_;
		G4MusicList* _tmp29_;
		G4MusicLibrary* _tmp30_;
		const gchar* _tmp31_;
		G4Playlist* _tmp32_;
		G4Playlist* _tmp33_;
		G4MusicList* _tmp34_;
		_tmp2_ = self->priv->_list;
		_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, G4_TYPE_MUSIC_LIST, G4MusicList));
		list = _tmp3_;
		_tmp4_ = self->priv->_app;
		_tmp5_ = g4_application_get_loader (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = g4_music_loader_get_library (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = _g_object_ref0 (_tmp8_);
		library = _tmp9_;
		_tmp10_ = list;
		_tmp11_ = g4_music_list_get_data_store (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = _g_object_ref0 (_tmp12_);
		store = _tmp13_;
		_tmp14_ = self->priv->_app;
		_tmp15_ = g4_application_get_music_folder (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = g4_get_display_name (_tmp16_);
		_tmp18_ = _tmp17_;
		_tmp19_ = g_strdup_printf (_ ("No playlist found in %s"), _tmp18_);
		_tmp20_ = _tmp19_;
		_g_free0 (_tmp18_);
		text = _tmp20_;
		_tmp21_ = library;
		_tmp22_ = store;
		g4_music_library_overwrite_playlists_to (_tmp21_, _tmp22_);
		_tmp23_ = list;
		_tmp24_ = text;
		g4_music_list_set_empty_text (_tmp23_, _tmp24_);
		_tmp25_ = self->priv->_app;
		_tmp26_ = g4_application_get_settings (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = g_settings_get_string (_tmp27_, "recent-playlist");
		recent_uri = _tmp28_;
		_tmp29_ = list;
		_tmp30_ = library;
		_tmp31_ = recent_uri;
		_tmp32_ = g4_music_library_get_playlist (_tmp30_, (const gchar*) _tmp31_);
		_tmp33_ = _tmp32_;
		g4_music_list_set_current_node (_tmp29_, (G4Music*) _tmp33_);
		_g_object_unref0 (_tmp33_);
		_tmp34_ = list;
		g4_music_list_set_to_current_item (_tmp34_, TRUE);
		_g_free0 (recent_uri);
		_g_free0 (text);
		_g_object_unref0 (store);
		_g_object_unref0 (library);
		_g_object_unref0 (list);
	}
}

static void
g4_playlist_dialog_on_search_btn_toggled (G4PlaylistDialog* self)
{
	GtkToggleButton* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->search_btn;
	_tmp1_ = gtk_toggle_button_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkSearchEntry* _tmp3_;
		_tmp3_ = self->priv->search_entry;
		gtk_widget_grab_focus ((GtkWidget*) _tmp3_);
	}
	g4_playlist_dialog_on_search_text_changed (self);
}

static gboolean
g4_playlist_dialog_on_search_match (G4PlaylistDialog* self,
                                    GObject* obj)
{
	G4Playlist* playlist = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (obj != NULL, FALSE);
	playlist = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TYPE_PLAYLIST, G4Playlist);
	_tmp0_ = self->priv->_search_text;
	_tmp1_ = ((G4Music*) playlist)->title;
	result = g_str_match_string (_tmp0_, _tmp1_, TRUE);
	return result;
}

static gboolean
_g4_playlist_dialog_on_search_match_gtk_custom_filter_func (GObject* item,
                                                            gpointer self)
{
	gboolean result;
	result = g4_playlist_dialog_on_search_match ((G4PlaylistDialog*) self, item);
	return result;
}

static void
g4_playlist_dialog_on_search_text_changed (G4PlaylistDialog* self)
{
	GtkSearchEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	G4MusicList* _tmp4_ = NULL;
	G4MusicList* _tmp5_;
	GtkFilterListModel* _tmp6_ = NULL;
	GtkFilterListModel* model = NULL;
	GtkFilterListModel* _tmp9_;
	gboolean _tmp10_ = FALSE;
	GtkToggleButton* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	GtkFilterListModel* _tmp32_ = NULL;
	GtkFilterListModel* _tmp33_;
	GtkFilter* _tmp34_ = NULL;
	GtkFilter* _tmp36_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->search_entry;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (self->priv->_search_text);
	self->priv->_search_text = _tmp3_;
	_tmp5_ = self->priv->_list;
	_tmp4_ = _tmp5_;
	_tmp6_ = NULL;
	if (_tmp4_ != NULL) {
		GtkFilterListModel* _tmp7_;
		GtkFilterListModel* _tmp8_;
		_tmp7_ = g4_music_list_get_filter_model (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, G4_TYPE_MUSIC_LIST, G4MusicList));
		_tmp8_ = _tmp7_;
		_tmp6_ = _tmp8_;
	}
	_tmp9_ = _g_object_ref0 (_tmp6_);
	model = _tmp9_;
	_tmp11_ = self->priv->search_btn;
	_tmp12_ = gtk_toggle_button_get_active (_tmp11_);
	_tmp13_ = _tmp12_;
	if (_tmp13_) {
		GtkFilterListModel* _tmp14_ = NULL;
		GtkFilterListModel* _tmp15_;
		GtkFilter* _tmp16_ = NULL;
		_tmp15_ = model;
		_tmp14_ = _tmp15_;
		_tmp16_ = NULL;
		if (_tmp14_ != NULL) {
			GtkFilter* _tmp17_;
			_tmp17_ = gtk_filter_list_model_get_filter (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, gtk_filter_list_model_get_type (), GtkFilterListModel));
			_tmp16_ = _tmp17_;
		}
		_tmp10_ = _tmp16_ == NULL;
	} else {
		_tmp10_ = FALSE;
	}
	if (_tmp10_) {
		GtkFilterListModel* _tmp18_ = NULL;
		GtkFilterListModel* _tmp19_;
		_tmp19_ = model;
		_tmp18_ = _tmp19_;
		if (_tmp18_ != NULL) {
			GtkCustomFilter* _tmp20_;
			GtkCustomFilter* _tmp21_;
			_tmp20_ = gtk_custom_filter_new (_g4_playlist_dialog_on_search_match_gtk_custom_filter_func, g_object_ref (self), g_object_unref);
			_tmp21_ = _tmp20_;
			gtk_filter_list_model_set_filter (G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, gtk_filter_list_model_get_type (), GtkFilterListModel), (GtkFilter*) _tmp21_);
			_g_object_unref0 (_tmp21_);
		}
	} else {
		gboolean _tmp22_ = FALSE;
		GtkToggleButton* _tmp23_;
		gboolean _tmp24_;
		gboolean _tmp25_;
		_tmp23_ = self->priv->search_btn;
		_tmp24_ = gtk_toggle_button_get_active (_tmp23_);
		_tmp25_ = _tmp24_;
		if (!_tmp25_) {
			GtkFilterListModel* _tmp26_ = NULL;
			GtkFilterListModel* _tmp27_;
			GtkFilter* _tmp28_ = NULL;
			_tmp27_ = model;
			_tmp26_ = _tmp27_;
			_tmp28_ = NULL;
			if (_tmp26_ != NULL) {
				GtkFilter* _tmp29_;
				_tmp29_ = gtk_filter_list_model_get_filter (G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, gtk_filter_list_model_get_type (), GtkFilterListModel));
				_tmp28_ = _tmp29_;
			}
			_tmp22_ = _tmp28_ != NULL;
		} else {
			_tmp22_ = FALSE;
		}
		if (_tmp22_) {
			GtkFilterListModel* _tmp30_ = NULL;
			GtkFilterListModel* _tmp31_;
			_tmp31_ = model;
			_tmp30_ = _tmp31_;
			if (_tmp30_ != NULL) {
				gtk_filter_list_model_set_filter (G_TYPE_CHECK_INSTANCE_CAST (_tmp30_, gtk_filter_list_model_get_type (), GtkFilterListModel), NULL);
			}
		}
	}
	_tmp33_ = model;
	_tmp32_ = _tmp33_;
	_tmp34_ = NULL;
	if (_tmp32_ != NULL) {
		GtkFilter* _tmp35_;
		_tmp35_ = gtk_filter_list_model_get_filter (G_TYPE_CHECK_INSTANCE_CAST (_tmp32_, gtk_filter_list_model_get_type (), GtkFilterListModel));
		_tmp34_ = _tmp35_;
	}
	_tmp36_ = _tmp34_;
	if (_tmp36_ != NULL) {
		gtk_filter_changed (G_TYPE_CHECK_INSTANCE_CAST (_tmp36_, gtk_filter_get_type (), GtkFilter), GTK_FILTER_CHANGE_DIFFERENT);
	}
	_g_object_unref0 (model);
}

static void
g4_playlist_dialog_class_init (G4PlaylistDialogClass * klass,
                               gpointer klass_data)
{
	g4_playlist_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &G4PlaylistDialog_private_offset);
	((AdwDialogClass *) klass)->closed = (void (*) (AdwDialog*)) g4_playlist_dialog_real_closed;
	G_OBJECT_CLASS (klass)->finalize = g4_playlist_dialog_finalize;
}

static void
g4_playlist_dialog_instance_init (G4PlaylistDialog * self,
                                  gpointer klass)
{
	GtkToggleButton* _tmp0_;
	GtkSearchEntry* _tmp1_;
	gchar* _tmp2_;
	self->priv = g4_playlist_dialog_get_instance_private (self);
	_tmp0_ = (GtkToggleButton*) gtk_toggle_button_new ();
	g_object_ref_sink (_tmp0_);
	self->priv->search_btn = _tmp0_;
	_tmp1_ = (GtkSearchEntry*) gtk_search_entry_new ();
	g_object_ref_sink (_tmp1_);
	self->priv->search_entry = _tmp1_;
	self->priv->_callback = NULL;
	self->priv->_callback_target = NULL;
	self->priv->_callback_target_destroy_notify = NULL;
	self->priv->_list = NULL;
	self->priv->_playlist = NULL;
	_tmp2_ = g_strdup ("");
	self->priv->_search_text = _tmp2_;
}

static void
g4_playlist_dialog_finalize (GObject * obj)
{
	G4PlaylistDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TYPE_PLAYLIST_DIALOG, G4PlaylistDialog);
	_g_object_unref0 (self->priv->search_btn);
	_g_object_unref0 (self->priv->search_entry);
	_g_object_unref0 (self->priv->_app);
	(self->priv->_callback_target_destroy_notify == NULL) ? NULL : (self->priv->_callback_target_destroy_notify (self->priv->_callback_target), NULL);
	self->priv->_callback = NULL;
	self->priv->_callback_target = NULL;
	self->priv->_callback_target_destroy_notify = NULL;
	_g_object_unref0 (self->priv->_list);
	_g_object_unref0 (self->priv->_playlist);
	_g_free0 (self->priv->_search_text);
	G_OBJECT_CLASS (g4_playlist_dialog_parent_class)->finalize (obj);
}

static GType
g4_playlist_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4PlaylistDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_playlist_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4PlaylistDialog), 0, (GInstanceInitFunc) g4_playlist_dialog_instance_init, NULL };
	GType g4_playlist_dialog_type_id;
	g4_playlist_dialog_type_id = g_type_register_static (G4_TYPE_DIALOG, "G4PlaylistDialog", &g_define_type_info, 0);
	G4PlaylistDialog_private_offset = g_type_add_instance_private (g4_playlist_dialog_type_id, sizeof (G4PlaylistDialogPrivate));
	return g4_playlist_dialog_type_id;
}

GType
g4_playlist_dialog_get_type (void)
{
	static volatile gsize g4_playlist_dialog_type_id__once = 0;
	if (g_once_init_enter (&g4_playlist_dialog_type_id__once)) {
		GType g4_playlist_dialog_type_id;
		g4_playlist_dialog_type_id = g4_playlist_dialog_get_type_once ();
		g_once_init_leave (&g4_playlist_dialog_type_id__once, g4_playlist_dialog_type_id);
	}
	return g4_playlist_dialog_type_id__once;
}

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

