From 1ec9d1c2ebb76c2ae5d80a4a4c3e8c1f6c60c789 Mon Sep 17 00:00:00 2001 From: Erica Z Date: Tue, 29 Oct 2024 10:48:40 +0100 Subject: [PATCH] commence the ritual --- meson.build | 4 +- src/application.c | 515 +++++ src/application.vala | 48 - src/config.vapi | 6 - src/globalconf.c | 17 + src/globalconf.vala | 3 - src/main.c | 91 + src/main.vala | 12 - src/meson.build | 22 +- src/mpris.c | 4735 +++++++++++++++++++++++++++++++++++++++ src/mpris.vala | 254 --- src/playbin.c | 3647 ++++++++++++++++++++++++++++++ src/playbin.vala | 438 ---- src/subsonic.c | 2597 +++++++++++++++++++++ src/subsonic.vala | 236 -- src/ui/play_queue.c | 1759 +++++++++++++++ src/ui/play_queue.vala | 175 -- src/ui/playbar.c | 1138 ++++++++++ src/ui/playbar.vala | 93 - src/ui/setup.c | 1478 ++++++++++++ src/ui/setup.vala | 135 -- src/ui/window.c | 1593 +++++++++++++ src/ui/window.vala | 136 -- src/vapi/libgcrypt.vapi | 829 ------- src/vapi/mpv.vapi | 177 -- 25 files changed, 17581 insertions(+), 2557 deletions(-) create mode 100644 src/application.c delete mode 100644 src/application.vala delete mode 100644 src/config.vapi create mode 100644 src/globalconf.c delete mode 100644 src/globalconf.vala create mode 100644 src/main.c delete mode 100644 src/main.vala create mode 100644 src/mpris.c delete mode 100644 src/mpris.vala create mode 100644 src/playbin.c delete mode 100644 src/playbin.vala create mode 100644 src/subsonic.c delete mode 100644 src/subsonic.vala create mode 100644 src/ui/play_queue.c delete mode 100644 src/ui/play_queue.vala create mode 100644 src/ui/playbar.c delete mode 100644 src/ui/playbar.vala create mode 100644 src/ui/setup.c delete mode 100644 src/ui/setup.vala create mode 100644 src/ui/window.c delete mode 100644 src/ui/window.vala delete mode 100644 src/vapi/libgcrypt.vapi delete mode 100644 src/vapi/mpv.vapi diff --git a/meson.build b/meson.build index f1ef59b..1542bc1 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project( 'audrey', - ['c', 'vala'], + 'c', version: '0.1.0', # AUDREY_VERSION meson_version: '>= 1.0.0', default_options: ['warning_level=0', 'werror=false'], @@ -9,7 +9,6 @@ project( i18n = import('i18n') gnome = import('gnome') cc = meson.get_compiler('c') -valac = meson.get_compiler('vala') srcdir = meson.project_source_root() / 'src' @@ -20,7 +19,6 @@ config_h.set_quoted('GETTEXT_PACKAGE', 'audrey') config_h.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir')) configure_file(output: 'config.h', configuration: config_h) -config_dep = valac.find_library('config', dirs: srcdir) config_inc = include_directories('.') add_project_arguments( diff --git a/src/application.c b/src/application.c new file mode 100644 index 0000000..8c02bfd --- /dev/null +++ b/src/application.c @@ -0,0 +1,515 @@ +/* application.c generated by valac 0.56.16, the Vala compiler + * generated from application.vala, do not modify */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#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 AUDREY_TYPE_APPLICATION (audrey_application_get_type ()) +#define AUDREY_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AUDREY_TYPE_APPLICATION, AudreyApplication)) +#define AUDREY_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AUDREY_TYPE_APPLICATION, AudreyApplicationClass)) +#define AUDREY_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AUDREY_TYPE_APPLICATION)) +#define AUDREY_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AUDREY_TYPE_APPLICATION)) +#define AUDREY_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AUDREY_TYPE_APPLICATION, AudreyApplicationClass)) + +typedef struct _AudreyApplication AudreyApplication; +typedef struct _AudreyApplicationClass AudreyApplicationClass; +typedef struct _AudreyApplicationPrivate AudreyApplicationPrivate; +enum { + AUDREY_APPLICATION_0_PROPERTY, + AUDREY_APPLICATION_NUM_PROPERTIES +}; +static GParamSpec* audrey_application_properties[AUDREY_APPLICATION_NUM_PROPERTIES]; + +#define UI_TYPE_WINDOW (ui_window_get_type ()) +#define UI_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UI_TYPE_WINDOW, UiWindow)) +#define UI_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UI_TYPE_WINDOW, UiWindowClass)) +#define UI_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UI_TYPE_WINDOW)) +#define UI_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UI_TYPE_WINDOW)) +#define UI_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UI_TYPE_WINDOW, UiWindowClass)) + +typedef struct _UiWindow UiWindow; +typedef struct _UiWindowClass UiWindowClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +typedef void (*GSimpleActionActivateCallback) (GSimpleAction* action, GVariant* parameter, gpointer user_data); + +struct _AudreyApplication { + AdwApplication parent_instance; + AudreyApplicationPrivate * priv; +}; + +struct _AudreyApplicationClass { + AdwApplicationClass parent_class; +}; + +static gpointer audrey_application_parent_class = NULL; + +VALA_EXTERN GType audrey_application_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (AudreyApplication, g_object_unref) +VALA_EXTERN AudreyApplication* audrey_application_new (void); +VALA_EXTERN AudreyApplication* audrey_application_construct (GType object_type); +static void audrey_application_real_activate (GApplication* base); +VALA_EXTERN UiWindow* ui_window_new (GtkApplication* app); +VALA_EXTERN UiWindow* ui_window_construct (GType object_type, + GtkApplication* app); +VALA_EXTERN GType ui_window_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (UiWindow, g_object_unref) +static void audrey_application_on_about_action (AudreyApplication* self); +static gchar** _vala_array_dup1 (gchar** self, + gssize length); +static void audrey_application_on_preferences_action (AudreyApplication* self); +static GObject * audrey_application_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam * construct_properties); +static void _audrey_application_on_about_action_gsimple_action_activate_callback (GSimpleAction* action, + GVariant* parameter, + gpointer self); +static void _audrey_application_on_preferences_action_gsimple_action_activate_callback (GSimpleAction* action, + GVariant* parameter, + gpointer self); +static void _g_application_quit_gsimple_action_activate_callback (GSimpleAction* action, + GVariant* parameter, + gpointer self); +static void audrey_application_finalize (GObject * obj); +static GType audrey_application_get_type_once (void); +static void _vala_array_destroy (gpointer array, + gssize array_length, + GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, + gssize array_length, + GDestroyNotify destroy_func); + +AudreyApplication* +audrey_application_construct (GType object_type) +{ + AudreyApplication * self = NULL; +#line 3 "../src/application.vala" + self = (AudreyApplication*) g_object_new (object_type, "application-id", "eu.callcc.audrey", "flags", G_APPLICATION_DEFAULT_FLAGS, NULL); +#line 2 "../src/application.vala" + return self; +#line 115 "application.c" +} + +AudreyApplication* +audrey_application_new (void) +{ +#line 2 "../src/application.vala" + return audrey_application_construct (AUDREY_TYPE_APPLICATION); +#line 123 "application.c" +} + +static gpointer +_g_object_ref0 (gpointer self) +{ +#line 22 "../src/application.vala" + return self ? g_object_ref (self) : NULL; +#line 131 "application.c" +} + +static void +audrey_application_real_activate (GApplication* base) +{ + AudreyApplication * self; + GtkWindow* _tmp0_ = NULL; + GtkWindow* _tmp1_; + GtkWindow* _tmp2_; + GtkWindow* _tmp3_; + GtkWindow* win = NULL; + GtkWindow* _tmp5_; +#line 19 "../src/application.vala" + self = (AudreyApplication*) base; +#line 20 "../src/application.vala" + G_APPLICATION_CLASS (audrey_application_parent_class)->activate ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_application_get_type (), AdwApplication)); +#line 22 "../src/application.vala" + _tmp1_ = gtk_application_get_active_window ((GtkApplication*) self); +#line 22 "../src/application.vala" + _tmp2_ = _tmp1_; +#line 22 "../src/application.vala" + _tmp3_ = _g_object_ref0 (_tmp2_); +#line 22 "../src/application.vala" + _tmp0_ = _tmp3_; +#line 22 "../src/application.vala" + if (_tmp0_ == NULL) { +#line 158 "application.c" + UiWindow* _tmp4_; +#line 22 "../src/application.vala" + _tmp4_ = ui_window_new ((GtkApplication*) self); +#line 22 "../src/application.vala" + g_object_ref_sink (_tmp4_); +#line 22 "../src/application.vala" + _g_object_unref0 (_tmp0_); +#line 22 "../src/application.vala" + _tmp0_ = (GtkWindow*) _tmp4_; +#line 168 "application.c" + } +#line 22 "../src/application.vala" + _tmp5_ = _tmp0_; +#line 22 "../src/application.vala" + _tmp0_ = NULL; +#line 22 "../src/application.vala" + win = _tmp5_; +#line 23 "../src/application.vala" + gtk_window_present (win); +#line 19 "../src/application.vala" + _g_object_unref0 (win); +#line 19 "../src/application.vala" + _g_object_unref0 (_tmp0_); +#line 182 "application.c" +} + +static gchar** +_vala_array_dup1 (gchar** self, + gssize length) +{ +#line 28 "../src/application.vala" + if (length >= 0) { +#line 191 "application.c" + gchar** result; + gssize i; +#line 28 "../src/application.vala" + result = g_new0 (gchar*, length + 1); +#line 28 "../src/application.vala" + for (i = 0; i < length; i++) { +#line 198 "application.c" + gchar* _tmp0_; +#line 28 "../src/application.vala" + _tmp0_ = g_strdup (self[i]); +#line 28 "../src/application.vala" + result[i] = _tmp0_; +#line 204 "application.c" + } +#line 28 "../src/application.vala" + return result; +#line 208 "application.c" + } +#line 28 "../src/application.vala" + return NULL; +#line 212 "application.c" +} + +static void +audrey_application_on_about_action (AudreyApplication* self) +{ + gchar** developers = NULL; + gchar* _tmp0_; + gchar** _tmp1_; + gint developers_length1; + gint _developers_size_; + AdwAboutDialog* about = NULL; + gchar* _tmp2_; + gchar* _tmp3_; + gchar* _tmp4_; + gchar* _tmp5_; + gchar* _tmp6_; + gchar** _tmp7_; + gint _tmp7__length1; + gchar* _tmp8_; + AdwAboutDialog* _tmp9_ = NULL; + GtkWindow* _tmp10_; + GtkWindow* _tmp11_; +#line 26 "../src/application.vala" + g_return_if_fail (self != NULL); +#line 27 "../src/application.vala" + _tmp0_ = g_strdup ("Erica Z"); +#line 27 "../src/application.vala" + _tmp1_ = g_new0 (gchar*, 1 + 1); +#line 27 "../src/application.vala" + _tmp1_[0] = _tmp0_; +#line 27 "../src/application.vala" + developers = _tmp1_; +#line 27 "../src/application.vala" + developers_length1 = 1; +#line 27 "../src/application.vala" + _developers_size_ = developers_length1; +#line 28 "../src/application.vala" + _tmp2_ = g_strdup ("audrey"); +#line 28 "../src/application.vala" + _tmp3_ = g_strdup ("eu.callcc.audrey"); +#line 28 "../src/application.vala" + _tmp4_ = g_strdup ("Erica Z"); +#line 28 "../src/application.vala" + _tmp5_ = g_strdup (_ ("translator-credits")); +#line 28 "../src/application.vala" + _tmp6_ = g_strdup ("0.1.0"); +#line 28 "../src/application.vala" + _tmp7_ = (developers != NULL) ? _vala_array_dup1 (developers, developers_length1) : developers; +#line 28 "../src/application.vala" + _tmp7__length1 = developers_length1; +#line 28 "../src/application.vala" + _tmp8_ = g_strdup ("© 2024 Erica Z"); +#line 28 "../src/application.vala" + _tmp9_ = (AdwAboutDialog*) adw_about_dialog_new (); +#line 28 "../src/application.vala" + adw_about_dialog_set_application_name (_tmp9_, _tmp2_); +#line 28 "../src/application.vala" + _g_free0 (_tmp2_); +#line 28 "../src/application.vala" + adw_about_dialog_set_application_icon (_tmp9_, _tmp3_); +#line 28 "../src/application.vala" + _g_free0 (_tmp3_); +#line 28 "../src/application.vala" + adw_about_dialog_set_developer_name (_tmp9_, _tmp4_); +#line 28 "../src/application.vala" + _g_free0 (_tmp4_); +#line 28 "../src/application.vala" + adw_about_dialog_set_translator_credits (_tmp9_, _tmp5_); +#line 28 "../src/application.vala" + _g_free0 (_tmp5_); +#line 28 "../src/application.vala" + adw_about_dialog_set_version (_tmp9_, _tmp6_); +#line 28 "../src/application.vala" + _g_free0 (_tmp6_); +#line 28 "../src/application.vala" + adw_about_dialog_set_developers (_tmp9_, _tmp7_); +#line 28 "../src/application.vala" + _tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_free), NULL); +#line 28 "../src/application.vala" + adw_about_dialog_set_copyright (_tmp9_, _tmp8_); +#line 28 "../src/application.vala" + _g_free0 (_tmp8_); +#line 28 "../src/application.vala" + g_object_ref_sink (_tmp9_); +#line 28 "../src/application.vala" + about = _tmp9_; +#line 38 "../src/application.vala" + _tmp10_ = gtk_application_get_active_window ((GtkApplication*) self); +#line 38 "../src/application.vala" + _tmp11_ = _tmp10_; +#line 38 "../src/application.vala" + adw_dialog_present ((AdwDialog*) about, (GtkWidget*) _tmp11_); +#line 26 "../src/application.vala" + _g_object_unref0 (about); +#line 26 "../src/application.vala" + developers = (_vala_array_free (developers, developers_length1, (GDestroyNotify) g_free), NULL); +#line 309 "application.c" +} + +static void +audrey_application_on_preferences_action (AudreyApplication* self) +{ +#line 41 "../src/application.vala" + g_return_if_fail (self != NULL); +#line 42 "../src/application.vala" + g_message ("application.vala:42: app.preferences action activated"); +#line 319 "application.c" +} + +static void +_audrey_application_on_about_action_gsimple_action_activate_callback (GSimpleAction* action, + GVariant* parameter, + gpointer self) +{ +#line 10 "../src/application.vala" + audrey_application_on_about_action ((AudreyApplication*) self); +#line 329 "application.c" +} + +static void +_audrey_application_on_preferences_action_gsimple_action_activate_callback (GSimpleAction* action, + GVariant* parameter, + gpointer self) +{ +#line 10 "../src/application.vala" + audrey_application_on_preferences_action ((AudreyApplication*) self); +#line 339 "application.c" +} + +static void +_g_application_quit_gsimple_action_activate_callback (GSimpleAction* action, + GVariant* parameter, + gpointer self) +{ +#line 10 "../src/application.vala" + g_application_quit ((GApplication*) self); +#line 349 "application.c" +} + +static GObject * +audrey_application_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam * construct_properties) +{ + GObject * obj; + GObjectClass * parent_class; + AudreyApplication * self; + GActionEntry* action_entries = NULL; + GActionEntry _tmp0_ = {0}; + GActionEntry _tmp1_ = {0}; + GActionEntry _tmp2_ = {0}; + GActionEntry* _tmp3_; + gint action_entries_length1; + gint _action_entries_size_; + GActionEntry* _tmp4_; + gint _tmp4__length1; + gchar* _tmp5_; + gchar** _tmp6_; + gchar** _tmp7_; + gint _tmp7__length1; +#line 9 "../src/application.vala" + parent_class = G_OBJECT_CLASS (audrey_application_parent_class); +#line 9 "../src/application.vala" + obj = parent_class->constructor (type, n_construct_properties, construct_properties); +#line 9 "../src/application.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, AUDREY_TYPE_APPLICATION, AudreyApplication); +#line 10 "../src/application.vala" + memset (&_tmp0_, 0, sizeof (GActionEntry)); +#line 10 "../src/application.vala" + _tmp0_.name = "about"; +#line 10 "../src/application.vala" + _tmp0_.activate = _audrey_application_on_about_action_gsimple_action_activate_callback; +#line 10 "../src/application.vala" + memset (&_tmp1_, 0, sizeof (GActionEntry)); +#line 10 "../src/application.vala" + _tmp1_.name = "preferences"; +#line 10 "../src/application.vala" + _tmp1_.activate = _audrey_application_on_preferences_action_gsimple_action_activate_callback; +#line 10 "../src/application.vala" + memset (&_tmp2_, 0, sizeof (GActionEntry)); +#line 10 "../src/application.vala" + _tmp2_.name = "quit"; +#line 10 "../src/application.vala" + _tmp2_.activate = _g_application_quit_gsimple_action_activate_callback; +#line 10 "../src/application.vala" + _tmp3_ = g_new0 (GActionEntry, 3); +#line 10 "../src/application.vala" + _tmp3_[0] = _tmp0_; +#line 10 "../src/application.vala" + _tmp3_[1] = _tmp1_; +#line 10 "../src/application.vala" + _tmp3_[2] = _tmp2_; +#line 10 "../src/application.vala" + action_entries = _tmp3_; +#line 10 "../src/application.vala" + action_entries_length1 = 3; +#line 10 "../src/application.vala" + _action_entries_size_ = action_entries_length1; +#line 15 "../src/application.vala" + _tmp4_ = action_entries; +#line 15 "../src/application.vala" + _tmp4__length1 = action_entries_length1; +#line 15 "../src/application.vala" + g_action_map_add_action_entries ((GActionMap*) self, _tmp4_, (gint) _tmp4__length1, self); +#line 16 "../src/application.vala" + _tmp5_ = g_strdup ("q"); +#line 16 "../src/application.vala" + _tmp6_ = g_new0 (gchar*, 1 + 1); +#line 16 "../src/application.vala" + _tmp6_[0] = _tmp5_; +#line 16 "../src/application.vala" + _tmp7_ = _tmp6_; +#line 16 "../src/application.vala" + _tmp7__length1 = 1; +#line 16 "../src/application.vala" + gtk_application_set_accels_for_action ((GtkApplication*) self, "app.quit", _tmp7_); +#line 16 "../src/application.vala" + _tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_free), NULL); +#line 9 "../src/application.vala" + action_entries = (g_free (action_entries), NULL); +#line 9 "../src/application.vala" + return obj; +#line 435 "application.c" +} + +static void +audrey_application_class_init (AudreyApplicationClass * klass, + gpointer klass_data) +{ +#line 1 "../src/application.vala" + audrey_application_parent_class = g_type_class_peek_parent (klass); +#line 1 "../src/application.vala" + ((GApplicationClass *) klass)->activate = (void (*) (GApplication*)) audrey_application_real_activate; +#line 1 "../src/application.vala" + G_OBJECT_CLASS (klass)->constructor = audrey_application_constructor; +#line 1 "../src/application.vala" + G_OBJECT_CLASS (klass)->finalize = audrey_application_finalize; +#line 450 "application.c" +} + +static void +audrey_application_instance_init (AudreyApplication * self, + gpointer klass) +{ +} + +static void +audrey_application_finalize (GObject * obj) +{ + AudreyApplication * self; +#line 1 "../src/application.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, AUDREY_TYPE_APPLICATION, AudreyApplication); +#line 46 "../src/application.vala" + g_debug ("application.vala:46: destroying application"); +#line 1 "../src/application.vala" + G_OBJECT_CLASS (audrey_application_parent_class)->finalize (obj); +#line 469 "application.c" +} + +static GType +audrey_application_get_type_once (void) +{ + static const GTypeInfo g_define_type_info = { sizeof (AudreyApplicationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) audrey_application_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AudreyApplication), 0, (GInstanceInitFunc) audrey_application_instance_init, NULL }; + GType audrey_application_type_id; + audrey_application_type_id = g_type_register_static (adw_application_get_type (), "AudreyApplication", &g_define_type_info, 0); + return audrey_application_type_id; +} + +GType +audrey_application_get_type (void) +{ + static volatile gsize audrey_application_type_id__once = 0; + if (g_once_init_enter (&audrey_application_type_id__once)) { + GType audrey_application_type_id; + audrey_application_type_id = audrey_application_get_type_once (); + g_once_init_leave (&audrey_application_type_id__once, audrey_application_type_id); + } + return audrey_application_type_id__once; +} + +static void +_vala_array_destroy (gpointer array, + gssize array_length, + GDestroyNotify destroy_func) +{ + if ((array != NULL) && (destroy_func != NULL)) { + gssize i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + +static void +_vala_array_free (gpointer array, + gssize array_length, + GDestroyNotify destroy_func) +{ + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + diff --git a/src/application.vala b/src/application.vala deleted file mode 100644 index 74cf982..0000000 --- a/src/application.vala +++ /dev/null @@ -1,48 +0,0 @@ -public class Audrey.Application : Adw.Application { - public Application () { - Object ( - application_id: "eu.callcc.audrey", - flags: ApplicationFlags.DEFAULT_FLAGS - ); - } - - construct { - GLib.ActionEntry[] action_entries = { - { "about", this.on_about_action }, - { "preferences", this.on_preferences_action }, - { "quit", this.quit } - }; - this.add_action_entries (action_entries, this); - this.set_accels_for_action ("app.quit", {"q"}); - } - - public override void activate () { - base.activate (); - // if this.active_window not null, this isnt the primary instance - var win = this.active_window ?? new Ui.Window (this); - win.present (); - } - - private void on_about_action () { - string[] developers = { "Erica Z" }; - var about = new Adw.AboutDialog () { - application_name = "audrey", - application_icon = "eu.callcc.audrey", - developer_name = "Erica Z", - translator_credits = _("translator-credits"), - version = "0.1.0", // AUDREY_VERSION - developers = developers, - copyright = "© 2024 Erica Z", - }; - - about.present (this.active_window); - } - - private void on_preferences_action () { - message ("app.preferences action activated"); - } - - ~Application () { - debug ("destroying application"); - } -} diff --git a/src/config.vapi b/src/config.vapi deleted file mode 100644 index d1672eb..0000000 --- a/src/config.vapi +++ /dev/null @@ -1,6 +0,0 @@ -[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")] -namespace Audrey.Config { - public const string GETTEXT_PACKAGE; - public const string LOCALEDIR; - public const string PACKAGE_VERSION; -} diff --git a/src/globalconf.c b/src/globalconf.c new file mode 100644 index 0000000..476bc20 --- /dev/null +++ b/src/globalconf.c @@ -0,0 +1,17 @@ +/* globalconf.c generated by valac 0.56.16, the Vala compiler + * generated from globalconf.vala, do not modify */ + +#include +#include +#include + +#define AUDREY_CONST_user_agent "audrey/linux" +#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 + diff --git a/src/globalconf.vala b/src/globalconf.vala deleted file mode 100644 index e031072..0000000 --- a/src/globalconf.vala +++ /dev/null @@ -1,3 +0,0 @@ -namespace Audrey.Const { - public const string user_agent = "audrey/linux"; -} diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..858af16 --- /dev/null +++ b/src/main.c @@ -0,0 +1,91 @@ +/* main.c generated by valac 0.56.16, the Vala compiler + * generated from main.vala, do not modify */ + +#include +#include +#include +#include +#include +#include "config.h" +#include +#include +#include +#include + +#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 AUDREY_TYPE_APPLICATION (audrey_application_get_type ()) +#define AUDREY_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AUDREY_TYPE_APPLICATION, AudreyApplication)) +#define AUDREY_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AUDREY_TYPE_APPLICATION, AudreyApplicationClass)) +#define AUDREY_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AUDREY_TYPE_APPLICATION)) +#define AUDREY_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AUDREY_TYPE_APPLICATION)) +#define AUDREY_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AUDREY_TYPE_APPLICATION, AudreyApplicationClass)) + +typedef struct _AudreyApplication AudreyApplication; +typedef struct _AudreyApplicationClass AudreyApplicationClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +static gint _vala_main (gchar** args, + gint args_length1); +VALA_EXTERN GType audrey_application_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (AudreyApplication, g_object_unref) +VALA_EXTERN AudreyApplication* audrey_application_new (void); +VALA_EXTERN AudreyApplication* audrey_application_construct (GType object_type); + +static gint +_vala_main (gchar** args, + gint args_length1) +{ + AudreyApplication* app = NULL; + AudreyApplication* _tmp0_; + gint result; +#line 3 "../src/main.vala" + gtk_disable_setlocale (); +#line 4 "../src/main.vala" + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); +#line 5 "../src/main.vala" + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#line 6 "../src/main.vala" + textdomain (GETTEXT_PACKAGE); +#line 7 "../src/main.vala" + setlocale (LC_ALL, ""); +#line 8 "../src/main.vala" + setlocale (LC_NUMERIC, "C.UTF-8"); +#line 10 "../src/main.vala" + _tmp0_ = audrey_application_new (); +#line 10 "../src/main.vala" + app = _tmp0_; +#line 11 "../src/main.vala" + result = g_application_run ((GApplication*) app, (gint) args_length1, args); +#line 11 "../src/main.vala" + _g_object_unref0 (app); +#line 11 "../src/main.vala" + return result; +#line 81 "main.c" +} + +int +main (int argc, + char ** argv) +{ +#line 1 "../src/main.vala" + return _vala_main (argv, argc); +#line 90 "main.c" +} + diff --git a/src/main.vala b/src/main.vala deleted file mode 100644 index db6eb0b..0000000 --- a/src/main.vala +++ /dev/null @@ -1,12 +0,0 @@ -int main (string[] args) { - // do it ourselves or it's broken - Gtk.disable_setlocale (); - Intl.bindtextdomain (Audrey.Config.GETTEXT_PACKAGE, Audrey.Config.LOCALEDIR); - Intl.bind_textdomain_codeset (Audrey.Config.GETTEXT_PACKAGE, "UTF-8"); - Intl.textdomain (Audrey.Config.GETTEXT_PACKAGE); - Intl.setlocale (LocaleCategory.ALL, ""); - Intl.setlocale (LocaleCategory.NUMERIC, "C.UTF-8"); - - var app = new Audrey.Application (); - return app.run (args); -} diff --git a/src/meson.build b/src/meson.build index d35c67e..fea601a 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,18 +1,17 @@ audrey_sources = [ - 'application.vala', - 'globalconf.vala', - 'main.vala', - 'mpris.vala', - 'playbin.vala', - 'subsonic.vala', - 'ui/play_queue.vala', - 'ui/playbar.vala', - 'ui/setup.vala', - 'ui/window.vala', + 'application.c', + 'globalconf.c', + 'main.c', + 'mpris.c', + 'playbin.c', + 'subsonic.c', + 'ui/play_queue.c', + 'ui/playbar.c', + 'ui/setup.c', + 'ui/window.c', ] audrey_deps = [ - config_dep, dependency('gtk4', version: '>= 4.16'), dependency('json-glib-1.0', version: '>= 1.10'), dependency('libadwaita-1', version: '>= 1.6'), @@ -59,5 +58,4 @@ executable( dependencies: audrey_deps, include_directories: config_inc, install: true, - vala_args: ['--vapidir', meson.current_source_dir() / 'vapi'], ) diff --git a/src/mpris.c b/src/mpris.c new file mode 100644 index 0000000..f29c684 --- /dev/null +++ b/src/mpris.c @@ -0,0 +1,4735 @@ +/* mpris.c generated by valac 0.56.16, the Vala compiler + * generated from mpris.vala, do not modify */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(VALA_STRICT_C) +#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14) +#pragma GCC diagnostic warning "-Wincompatible-pointer-types" +#elif defined(__clang__) && (__clang_major__ >= 16) +#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types" +#pragma clang diagnostic ignored "-Wincompatible-pointer-types" +#endif +#endif +#if !defined(VALA_EXTERN) +#if defined(_MSC_VER) +#define VALA_EXTERN __declspec(dllexport) extern +#elif __GNUC__ >= 4 +#define VALA_EXTERN __attribute__((visibility("default"))) extern +#else +#define VALA_EXTERN extern +#endif +#endif + +#define TYPE_MPRIS (mpris_get_type ()) +#define MPRIS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS, Mpris)) +#define MPRIS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS, MprisClass)) +#define IS_MPRIS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS)) +#define IS_MPRIS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS)) +#define MPRIS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS, MprisClass)) + +typedef struct _Mpris Mpris; +typedef struct _MprisClass MprisClass; +typedef struct _MprisPrivate MprisPrivate; +enum { + MPRIS_0_PROPERTY, + MPRIS_CAN_RAISE_PROPERTY, + MPRIS_CAN_QUIT_PROPERTY, + MPRIS_CAN_SET_FULLSCREEN_PROPERTY, + MPRIS_FULLSCREEN_PROPERTY, + MPRIS_HAS_TRACK_LIST_PROPERTY, + MPRIS_IDENTITY_PROPERTY, + MPRIS_DESKTOP_ENTRY_PROPERTY, + MPRIS_SUPPORTED_URI_SCHEMES_PROPERTY, + MPRIS_SUPPORTED_MIME_TYPES_PROPERTY, + MPRIS_NUM_PROPERTIES +}; +static GParamSpec* mpris_properties[MPRIS_NUM_PROPERTIES]; + +#define UI_TYPE_WINDOW (ui_window_get_type ()) +#define UI_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UI_TYPE_WINDOW, UiWindow)) +#define UI_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UI_TYPE_WINDOW, UiWindowClass)) +#define UI_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UI_TYPE_WINDOW)) +#define UI_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UI_TYPE_WINDOW)) +#define UI_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UI_TYPE_WINDOW, UiWindowClass)) + +typedef struct _UiWindow UiWindow; +typedef struct _UiWindowClass UiWindowClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +typedef struct _Block1Data Block1Data; +enum { + MPRIS_ON_RAISE_SIGNAL, + MPRIS_ON_QUIT_SIGNAL, + MPRIS_NUM_SIGNALS +}; +static guint mpris_signals[MPRIS_NUM_SIGNALS] = {0}; +#define _g_free0(var) (var = (g_free (var), NULL)) + +#define TYPE_MPRIS_PLAYER (mpris_player_get_type ()) +#define MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYER, MprisPlayer)) +#define MPRIS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_PLAYER, MprisPlayerClass)) +#define IS_MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYER)) +#define IS_MPRIS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_PLAYER)) +#define MPRIS_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_PLAYER, MprisPlayerClass)) + +typedef struct _MprisPlayer MprisPlayer; +typedef struct _MprisPlayerClass MprisPlayerClass; +typedef struct _MprisPlayerPrivate MprisPlayerPrivate; + +#define SUBSONIC_TYPE_CLIENT (subsonic_client_get_type ()) +#define SUBSONIC_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SUBSONIC_TYPE_CLIENT, SubsonicClient)) +#define SUBSONIC_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SUBSONIC_TYPE_CLIENT, SubsonicClientClass)) +#define SUBSONIC_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUBSONIC_TYPE_CLIENT)) +#define SUBSONIC_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SUBSONIC_TYPE_CLIENT)) +#define SUBSONIC_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SUBSONIC_TYPE_CLIENT, SubsonicClientClass)) + +typedef struct _SubsonicClient SubsonicClient; +typedef struct _SubsonicClientClass SubsonicClientClass; +enum { + MPRIS_PLAYER_0_PROPERTY, + MPRIS_PLAYER_PLAYBACK_STATUS_PROPERTY, + MPRIS_PLAYER_LOOP_STATUS_PROPERTY, + MPRIS_PLAYER_RATE_PROPERTY, + MPRIS_PLAYER_SHUFFLE_PROPERTY, + MPRIS_PLAYER_METADATA_PROPERTY, + MPRIS_PLAYER_VOLUME_PROPERTY, + MPRIS_PLAYER_POSITION_PROPERTY, + MPRIS_PLAYER_MINIMUM_RATE_PROPERTY, + MPRIS_PLAYER_MAXIMUM_RATE_PROPERTY, + MPRIS_PLAYER_CAN_GO_NEXT_PROPERTY, + MPRIS_PLAYER_CAN_GO_PREVIOUS_PROPERTY, + MPRIS_PLAYER_CAN_PLAY_PROPERTY, + MPRIS_PLAYER_CAN_PAUSE_PROPERTY, + MPRIS_PLAYER_CAN_SEEK_PROPERTY, + MPRIS_PLAYER_CAN_CONTROL_PROPERTY, + MPRIS_PLAYER_API_PROPERTY, + MPRIS_PLAYER_NUM_PROPERTIES +}; +static GParamSpec* mpris_player_properties[MPRIS_PLAYER_NUM_PROPERTIES]; +#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) + +#define TYPE_PLAYBIN (playbin_get_type ()) +#define PLAYBIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYBIN, Playbin)) +#define PLAYBIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYBIN, PlaybinClass)) +#define IS_PLAYBIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYBIN)) +#define IS_PLAYBIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYBIN)) +#define PLAYBIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYBIN, PlaybinClass)) + +typedef struct _Playbin Playbin; +typedef struct _PlaybinClass PlaybinClass; +typedef struct _Block2Data Block2Data; +typedef enum { + PLAYBIN_STATE_STOPPED, + PLAYBIN_STATE_PAUSED, + PLAYBIN_STATE_PLAYING +} PlaybinState; + +#define TYPE_PLAYBIN_STATE (playbin_state_get_type ()) + +#define TYPE_PLAYBIN_SONG (playbin_song_get_type ()) +#define PLAYBIN_SONG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYBIN_SONG, PlaybinSong)) +#define PLAYBIN_SONG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYBIN_SONG, PlaybinSongClass)) +#define IS_PLAYBIN_SONG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYBIN_SONG)) +#define IS_PLAYBIN_SONG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYBIN_SONG)) +#define PLAYBIN_SONG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYBIN_SONG, PlaybinSongClass)) + +typedef struct _PlaybinSong PlaybinSong; +typedef struct _PlaybinSongClass PlaybinSongClass; +#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL))) +#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL))) +#define _g_variant_builder_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_builder_unref (var), NULL))) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) +enum { + MPRIS_PLAYER_ON_NEXT_SIGNAL, + MPRIS_PLAYER_ON_PREVIOUS_SIGNAL, + MPRIS_PLAYER_ON_PAUSE_SIGNAL, + MPRIS_PLAYER_ON_PLAY_PAUSE_SIGNAL, + MPRIS_PLAYER_ON_STOP_SIGNAL, + MPRIS_PLAYER_ON_PLAY_SIGNAL, + MPRIS_PLAYER_ON_SEEK_SIGNAL, + MPRIS_PLAYER_ON_SET_POSITION_SIGNAL, + MPRIS_PLAYER_SEEKED_SIGNAL, + MPRIS_PLAYER_NUM_SIGNALS +}; +static guint mpris_player_signals[MPRIS_PLAYER_NUM_SIGNALS] = {0}; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _Mpris { + GObject parent_instance; + MprisPrivate * priv; +}; + +struct _MprisClass { + GObjectClass parent_class; +}; + +struct _Block1Data { + int _ref_count_; + Mpris* self; + UiWindow* window; +}; + +struct _MprisPlayer { + GObject parent_instance; + MprisPlayerPrivate * priv; +}; + +struct _MprisPlayerClass { + GObjectClass parent_class; +}; + +struct _MprisPlayerPrivate { + gchar* _playback_status; + gchar* _loop_status; + gdouble _rate; + gboolean _shuffle; + GHashTable* _metadata; + gdouble _volume; + gint64 _position; + gboolean _can_go_next; + gboolean _can_go_previous; + gboolean _can_play; + gboolean _can_pause; + gboolean _can_seek; + SubsonicClient* _api; +}; + +struct _Block2Data { + int _ref_count_; + MprisPlayer* self; + GDBusConnection* conn; + Playbin* playbin; +}; + +static gpointer mpris_parent_class = NULL; +static gint MprisPlayer_private_offset; +static gpointer mpris_player_parent_class = NULL; + +VALA_EXTERN GType mpris_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (Mpris, g_object_unref) +VALA_EXTERN guint mpris_register_object (void* object, + GDBusConnection* connection, + const gchar* path, + GError** error); +VALA_EXTERN void mpris_raise (Mpris* self, + GError** error); +VALA_EXTERN void mpris_quit (Mpris* self, + GError** error); +VALA_EXTERN GType ui_window_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (UiWindow, g_object_unref) +VALA_EXTERN Mpris* mpris_new (UiWindow* window); +VALA_EXTERN Mpris* mpris_construct (GType object_type, + UiWindow* window); +static Block1Data* block1_data_ref (Block1Data* _data1_); +static void block1_data_unref (void * _userdata_); +static void __lambda12_ (Block1Data* _data1_); +static void ___lambda12__mpris_on_raise (Mpris* _sender, + gpointer self); +static void __lambda13_ (Block1Data* _data1_); +static void ___lambda13__mpris_on_quit (Mpris* _sender, + gpointer self); +VALA_EXTERN gboolean mpris_get_can_raise (Mpris* self); +VALA_EXTERN gboolean mpris_get_can_quit (Mpris* self); +VALA_EXTERN gboolean mpris_get_can_set_fullscreen (Mpris* self); +VALA_EXTERN gboolean mpris_get_fullscreen (Mpris* self); +VALA_EXTERN void mpris_set_fullscreen (Mpris* self, + gboolean value); +VALA_EXTERN gboolean mpris_get_has_track_list (Mpris* self); +VALA_EXTERN gchar* mpris_get_identity (Mpris* self); +VALA_EXTERN gchar* mpris_get_desktop_entry (Mpris* self); +VALA_EXTERN gchar** mpris_get_supported_uri_schemes (Mpris* self, + gint* result_length1); +VALA_EXTERN gchar** mpris_get_supported_mime_types (Mpris* self, + gint* result_length1); +static void mpris_finalize (GObject * obj); +static GType mpris_get_type_once (void); +static void _vala_mpris_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec); +static void _vala_mpris_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec); +static void _dbus_mpris_raise (Mpris* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation); +static void _dbus_mpris_quit (Mpris* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation); +static void mpris_dbus_interface_method_call (GDBusConnection* connection, + const gchar* sender, + const gchar* object_path, + const gchar* interface_name, + const gchar* method_name, + GVariant* parameters, + GDBusMethodInvocation* invocation, + gpointer user_data); +static GVariant* mpris_dbus_interface_get_property (GDBusConnection* connection, + const gchar* sender, + const gchar* object_path, + const gchar* interface_name, + const gchar* property_name, + GError** error, + gpointer user_data); +static GVariant* _dbus_mpris_get_can_raise (Mpris* self); +static GVariant* _dbus_mpris_get_can_quit (Mpris* self); +static GVariant* _dbus_mpris_get_can_set_fullscreen (Mpris* self); +static GVariant* _dbus_mpris_get_fullscreen (Mpris* self); +static GVariant* _dbus_mpris_get_has_track_list (Mpris* self); +static GVariant* _dbus_mpris_get_identity (Mpris* self); +static GVariant* _dbus_mpris_get_desktop_entry (Mpris* self); +static GVariant* _dbus_mpris_get_supported_uri_schemes (Mpris* self); +static GVariant* _dbus_mpris_get_supported_mime_types (Mpris* self); +static gboolean mpris_dbus_interface_set_property (GDBusConnection* connection, + const gchar* sender, + const gchar* object_path, + const gchar* interface_name, + const gchar* property_name, + GVariant* value, + GError** error, + gpointer user_data); +static void _dbus_mpris_set_fullscreen (Mpris* self, + GVariant* _value); +static void _mpris_unregister_object (gpointer user_data); +VALA_EXTERN GType mpris_player_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (MprisPlayer, g_object_unref) +VALA_EXTERN guint mpris_player_register_object (void* object, + GDBusConnection* connection, + const gchar* path, + GError** error); +VALA_EXTERN GType subsonic_client_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (SubsonicClient, g_object_unref) +static void _g_free0_ (gpointer var); +static void _g_variant_unref0_ (gpointer var); +VALA_EXTERN void mpris_player_next (MprisPlayer* self, + GError** error); +VALA_EXTERN void mpris_player_previous (MprisPlayer* self, + GError** error); +VALA_EXTERN void mpris_player_pause (MprisPlayer* self, + GError** error); +VALA_EXTERN void mpris_player_play_pause (MprisPlayer* self, + GError** error); +VALA_EXTERN void mpris_player_stop (MprisPlayer* self, + GError** error); +VALA_EXTERN void mpris_player_play (MprisPlayer* self, + GError** error); +VALA_EXTERN void mpris_player_seek (MprisPlayer* self, + gint64 offset, + GError** error); +VALA_EXTERN void mpris_player_set_position (MprisPlayer* self, + const char* track_id, + gint64 position, + GError** error); +VALA_EXTERN void mpris_player_open_uri (MprisPlayer* self, + const gchar* uri, + GError** error); +VALA_EXTERN GType playbin_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (Playbin, g_object_unref) +VALA_EXTERN MprisPlayer* mpris_player_new (GDBusConnection* conn, + Playbin* playbin); +VALA_EXTERN MprisPlayer* mpris_player_construct (GType object_type, + GDBusConnection* conn, + Playbin* playbin); +static Block2Data* block2_data_ref (Block2Data* _data2_); +static void block2_data_unref (void * _userdata_); +static gboolean __lambda14_ (MprisPlayer* self, + GBinding* binding, + GValue* from, + GValue* to); +VALA_EXTERN GType playbin_state_get_type (void) G_GNUC_CONST ; +static void mpris_player_set_can_go_next (MprisPlayer* self, + gboolean value); +static void mpris_player_set_can_go_previous (MprisPlayer* self, + gboolean value); +static void mpris_player_set_can_play (MprisPlayer* self, + gboolean value); +static void mpris_player_set_can_pause (MprisPlayer* self, + gboolean value); +static void mpris_player_set_can_seek (MprisPlayer* self, + gboolean value); +static gboolean ___lambda14__gbinding_transform_func (GBinding* binding, + GValue* from_value, + GValue* to_value, + gpointer self); +static gboolean __lambda15_ (MprisPlayer* self, + GBinding* binding, + GValue* from, + GValue* to); +static gboolean ___lambda15__gbinding_transform_func (GBinding* binding, + GValue* from_value, + GValue* to_value, + gpointer self); +static gboolean __lambda16_ (MprisPlayer* self, + GBinding* binding, + GValue* from, + GValue* to); +static gboolean ___lambda16__gbinding_transform_func (GBinding* binding, + GValue* from_value, + GValue* to_value, + gpointer self); +static void __lambda17_ (MprisPlayer* self, + Playbin* playbin); +VALA_EXTERN GType playbin_song_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (PlaybinSong, g_object_unref) +VALA_EXTERN GListModel* playbin_get_play_queue (Playbin* self); +VALA_EXTERN gint playbin_get_play_queue_position (Playbin* self); +VALA_EXTERN const gchar* playbin_song_get_id (PlaybinSong* self); +static GVariant* _variant_new1 (char* value); +VALA_EXTERN gint64 playbin_song_get_duration (PlaybinSong* self); +static GVariant* _variant_new2 (gint64 value); +VALA_EXTERN SubsonicClient* mpris_player_get_api (MprisPlayer* self); +VALA_EXTERN gchar* subsonic_client_cover_art_uri (SubsonicClient* self, + const gchar* id, + gint size); +static GVariant* _variant_new3 (gchar* value); +VALA_EXTERN const gchar* playbin_song_get_album (PlaybinSong* self); +static GVariant* _variant_new4 (const gchar* value); +VALA_EXTERN const gchar* playbin_song_get_artist (PlaybinSong* self); +static GVariant* _variant_new5 (gchar** value, + gint value_length1); +VALA_EXTERN const gchar* playbin_song_get_genre (PlaybinSong* self); +static GVariant* _variant_new6 (const gchar* value); +VALA_EXTERN const gchar* playbin_song_get_title (PlaybinSong* self); +static GVariant* _variant_new7 (const gchar* value); +VALA_EXTERN gint64 playbin_song_get_track (PlaybinSong* self); +static GVariant* _variant_new8 (gint64 value); +VALA_EXTERN gint64 playbin_song_get_play_count (PlaybinSong* self); +static GVariant* _variant_new9 (gint64 value); +static void mpris_player_set_metadata (MprisPlayer* self, + GHashTable* value); +static void ___lambda17__playbin_new_track (Playbin* _sender, + gpointer self); +static void __lambda18_ (MprisPlayer* self); +static void ___lambda18__playbin_stopped (Playbin* _sender, + gpointer self); +static void __lambda19_ (Block2Data* _data2_); +VALA_EXTERN void playbin_go_to_next_track (Playbin* self); +static void ___lambda19__mpris_player_on_next (MprisPlayer* _sender, + gpointer self); +static void __lambda20_ (Block2Data* _data2_); +VALA_EXTERN void playbin_go_to_prev_track (Playbin* self); +static void ___lambda20__mpris_player_on_previous (MprisPlayer* _sender, + gpointer self); +static void __lambda21_ (Block2Data* _data2_); +VALA_EXTERN void playbin_play (Playbin* self); +static void ___lambda21__mpris_player_on_play (MprisPlayer* _sender, + gpointer self); +static void __lambda22_ (Block2Data* _data2_); +VALA_EXTERN void playbin_pause (Playbin* self); +static void ___lambda22__mpris_player_on_pause (MprisPlayer* _sender, + gpointer self); +static void __lambda23_ (Block2Data* _data2_); +VALA_EXTERN PlaybinState playbin_get_state (Playbin* self); +static void ___lambda23__mpris_player_on_play_pause (MprisPlayer* _sender, + gpointer self); +static void __lambda24_ (Block2Data* _data2_); +VALA_EXTERN void playbin_stop (Playbin* self); +static void ___lambda24__mpris_player_on_stop (MprisPlayer* _sender, + gpointer self); +static void __lambda25_ (Block2Data* _data2_, + GParamSpec* p); +VALA_EXTERN gchar* mpris_player_get_playback_status (MprisPlayer* self); +static GVariant* _variant_new10 (gchar* value); +VALA_EXTERN gchar* mpris_player_get_loop_status (MprisPlayer* self); +static GVariant* _variant_new11 (gchar* value); +VALA_EXTERN gdouble mpris_player_get_rate (MprisPlayer* self); +static GVariant* _variant_new12 (gdouble value); +VALA_EXTERN gboolean mpris_player_get_shuffle (MprisPlayer* self); +static GVariant* _variant_new13 (gboolean value); +VALA_EXTERN GHashTable* mpris_player_get_metadata (MprisPlayer* self); +static GVariant* _variant_new14 (GHashTable* value); +VALA_EXTERN gdouble mpris_player_get_volume (MprisPlayer* self); +static GVariant* _variant_new15 (gdouble value); +VALA_EXTERN gdouble mpris_player_get_minimum_rate (MprisPlayer* self); +static GVariant* _variant_new16 (gdouble value); +VALA_EXTERN gdouble mpris_player_get_maximum_rate (MprisPlayer* self); +static GVariant* _variant_new17 (gdouble value); +VALA_EXTERN gboolean mpris_player_get_can_go_next (MprisPlayer* self); +static GVariant* _variant_new18 (gboolean value); +VALA_EXTERN gboolean mpris_player_get_can_go_previous (MprisPlayer* self); +static GVariant* _variant_new19 (gboolean value); +VALA_EXTERN gboolean mpris_player_get_can_play (MprisPlayer* self); +static GVariant* _variant_new20 (gboolean value); +VALA_EXTERN gboolean mpris_player_get_can_pause (MprisPlayer* self); +static GVariant* _variant_new21 (gboolean value); +VALA_EXTERN gboolean mpris_player_get_can_seek (MprisPlayer* self); +static GVariant* _variant_new22 (gboolean value); +static void ___lambda25__g_object_notify (GObject* _sender, + GParamSpec* pspec, + gpointer self); +VALA_EXTERN void mpris_player_set_playback_status (MprisPlayer* self, + const gchar* value); +VALA_EXTERN void mpris_player_set_volume (MprisPlayer* self, + gdouble value); +VALA_EXTERN gint64 mpris_player_get_position (MprisPlayer* self); +VALA_EXTERN gboolean mpris_player_get_can_control (MprisPlayer* self); +VALA_EXTERN void mpris_player_set_api (MprisPlayer* self, + SubsonicClient* value); +static void g_cclosure_user_marshal_VOID__INT64 (GClosure * closure, + GValue * return_value, + guint n_param_values, + const GValue * param_values, + gpointer invocation_hint, + gpointer marshal_data); +static void g_cclosure_user_marshal_VOID__STRING_INT64 (GClosure * closure, + GValue * return_value, + guint n_param_values, + const GValue * param_values, + gpointer invocation_hint, + gpointer marshal_data); +static void mpris_player_finalize (GObject * obj); +static GType mpris_player_get_type_once (void); +static void _vala_mpris_player_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec); +static void _vala_mpris_player_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec); +static void _dbus_mpris_player_next (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation); +static void _dbus_mpris_player_previous (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation); +static void _dbus_mpris_player_pause (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation); +static void _dbus_mpris_player_play_pause (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation); +static void _dbus_mpris_player_stop (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation); +static void _dbus_mpris_player_play (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation); +static void _dbus_mpris_player_seek (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation); +static void _dbus_mpris_player_set_position (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation); +static void _dbus_mpris_player_open_uri (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation); +static void mpris_player_dbus_interface_method_call (GDBusConnection* connection, + const gchar* sender, + const gchar* object_path, + const gchar* interface_name, + const gchar* method_name, + GVariant* parameters, + GDBusMethodInvocation* invocation, + gpointer user_data); +static GVariant* mpris_player_dbus_interface_get_property (GDBusConnection* connection, + const gchar* sender, + const gchar* object_path, + const gchar* interface_name, + const gchar* property_name, + GError** error, + gpointer user_data); +static GVariant* _dbus_mpris_player_get_playback_status (MprisPlayer* self); +static GVariant* _dbus_mpris_player_get_loop_status (MprisPlayer* self); +static GVariant* _dbus_mpris_player_get_rate (MprisPlayer* self); +static GVariant* _dbus_mpris_player_get_shuffle (MprisPlayer* self); +static GVariant* _dbus_mpris_player_get_metadata (MprisPlayer* self); +static GVariant* _dbus_mpris_player_get_volume (MprisPlayer* self); +static GVariant* _dbus_mpris_player_get_position (MprisPlayer* self); +static GVariant* _dbus_mpris_player_get_minimum_rate (MprisPlayer* self); +static GVariant* _dbus_mpris_player_get_maximum_rate (MprisPlayer* self); +static GVariant* _dbus_mpris_player_get_can_go_next (MprisPlayer* self); +static GVariant* _dbus_mpris_player_get_can_go_previous (MprisPlayer* self); +static GVariant* _dbus_mpris_player_get_can_play (MprisPlayer* self); +static GVariant* _dbus_mpris_player_get_can_pause (MprisPlayer* self); +static GVariant* _dbus_mpris_player_get_can_seek (MprisPlayer* self); +static GVariant* _dbus_mpris_player_get_can_control (MprisPlayer* self); +static gboolean mpris_player_dbus_interface_set_property (GDBusConnection* connection, + const gchar* sender, + const gchar* object_path, + const gchar* interface_name, + const gchar* property_name, + GVariant* value, + GError** error, + gpointer user_data); +static void _dbus_mpris_player_set_playback_status (MprisPlayer* self, + GVariant* _value); +static void _dbus_mpris_player_set_metadata (MprisPlayer* self, + GVariant* _value); +static void _dbus_mpris_player_set_volume (MprisPlayer* self, + GVariant* _value); +static void _dbus_mpris_player_set_can_go_next (MprisPlayer* self, + GVariant* _value); +static void _dbus_mpris_player_set_can_go_previous (MprisPlayer* self, + GVariant* _value); +static void _dbus_mpris_player_set_can_play (MprisPlayer* self, + GVariant* _value); +static void _dbus_mpris_player_set_can_pause (MprisPlayer* self, + GVariant* _value); +static void _dbus_mpris_player_set_can_seek (MprisPlayer* self, + GVariant* _value); +static void _dbus_mpris_player_seeked (GObject* _sender, + gint64 position, + gpointer* _data); +static void _mpris_player_unregister_object (gpointer user_data); +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 const GDBusArgInfo * const _mpris_dbus_arg_info_raise_in[] = {NULL}; +static const GDBusArgInfo * const _mpris_dbus_arg_info_raise_out[] = {NULL}; +static const GDBusMethodInfo _mpris_dbus_method_info_raise = {-1, "Raise", (GDBusArgInfo **) (&_mpris_dbus_arg_info_raise_in), (GDBusArgInfo **) (&_mpris_dbus_arg_info_raise_out), NULL}; +static const GDBusArgInfo * const _mpris_dbus_arg_info_quit_in[] = {NULL}; +static const GDBusArgInfo * const _mpris_dbus_arg_info_quit_out[] = {NULL}; +static const GDBusMethodInfo _mpris_dbus_method_info_quit = {-1, "Quit", (GDBusArgInfo **) (&_mpris_dbus_arg_info_quit_in), (GDBusArgInfo **) (&_mpris_dbus_arg_info_quit_out), NULL}; +static const GDBusMethodInfo * const _mpris_dbus_method_info[] = {&_mpris_dbus_method_info_raise, &_mpris_dbus_method_info_quit, NULL}; +static const GDBusSignalInfo * const _mpris_dbus_signal_info[] = {NULL}; +static const GDBusPropertyInfo _mpris_dbus_property_info_can_raise = {-1, "CanRaise", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo _mpris_dbus_property_info_can_quit = {-1, "CanQuit", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo _mpris_dbus_property_info_can_set_fullscreen = {-1, "CanSetFullscreen", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo _mpris_dbus_property_info_fullscreen = {-1, "Fullscreen", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL}; +static const GDBusPropertyInfo _mpris_dbus_property_info_has_track_list = {-1, "HasTrackList", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo _mpris_dbus_property_info_identity = {-1, "Identity", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo _mpris_dbus_property_info_desktop_entry = {-1, "DesktopEntry", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo _mpris_dbus_property_info_supported_uri_schemes = {-1, "SupportedUriSchemes", "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo _mpris_dbus_property_info_supported_mime_types = {-1, "SupportedMimeTypes", "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo * const _mpris_dbus_property_info[] = {&_mpris_dbus_property_info_can_raise, &_mpris_dbus_property_info_can_quit, &_mpris_dbus_property_info_can_set_fullscreen, &_mpris_dbus_property_info_fullscreen, &_mpris_dbus_property_info_has_track_list, &_mpris_dbus_property_info_identity, &_mpris_dbus_property_info_desktop_entry, &_mpris_dbus_property_info_supported_uri_schemes, &_mpris_dbus_property_info_supported_mime_types, NULL}; +static const GDBusInterfaceInfo _mpris_dbus_interface_info = {-1, "org.mpris.MediaPlayer2", (GDBusMethodInfo **) (&_mpris_dbus_method_info), (GDBusSignalInfo **) (&_mpris_dbus_signal_info), (GDBusPropertyInfo **) (&_mpris_dbus_property_info), NULL}; +static const GDBusInterfaceVTable _mpris_dbus_interface_vtable = {mpris_dbus_interface_method_call, mpris_dbus_interface_get_property, mpris_dbus_interface_set_property}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_next_in[] = {NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_next_out[] = {NULL}; +static const GDBusMethodInfo _mpris_player_dbus_method_info_next = {-1, "Next", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_next_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_next_out), NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_previous_in[] = {NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_previous_out[] = {NULL}; +static const GDBusMethodInfo _mpris_player_dbus_method_info_previous = {-1, "Previous", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_previous_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_previous_out), NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_pause_in[] = {NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_pause_out[] = {NULL}; +static const GDBusMethodInfo _mpris_player_dbus_method_info_pause = {-1, "Pause", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_pause_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_pause_out), NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_play_pause_in[] = {NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_play_pause_out[] = {NULL}; +static const GDBusMethodInfo _mpris_player_dbus_method_info_play_pause = {-1, "PlayPause", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_play_pause_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_play_pause_out), NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_stop_in[] = {NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_stop_out[] = {NULL}; +static const GDBusMethodInfo _mpris_player_dbus_method_info_stop = {-1, "Stop", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_stop_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_stop_out), NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_play_in[] = {NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_play_out[] = {NULL}; +static const GDBusMethodInfo _mpris_player_dbus_method_info_play = {-1, "Play", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_play_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_play_out), NULL}; +static const GDBusArgInfo _mpris_player_dbus_arg_info_seek_offset = {-1, "offset", "x", NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_seek_in[] = {&_mpris_player_dbus_arg_info_seek_offset, NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_seek_out[] = {NULL}; +static const GDBusMethodInfo _mpris_player_dbus_method_info_seek = {-1, "Seek", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_seek_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_seek_out), NULL}; +static const GDBusArgInfo _mpris_player_dbus_arg_info_set_position_track_id = {-1, "track_id", "o", NULL}; +static const GDBusArgInfo _mpris_player_dbus_arg_info_set_position_position = {-1, "position", "x", NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_set_position_in[] = {&_mpris_player_dbus_arg_info_set_position_track_id, &_mpris_player_dbus_arg_info_set_position_position, NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_set_position_out[] = {NULL}; +static const GDBusMethodInfo _mpris_player_dbus_method_info_set_position = {-1, "SetPosition", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_set_position_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_set_position_out), NULL}; +static const GDBusArgInfo _mpris_player_dbus_arg_info_open_uri_uri = {-1, "uri", "s", NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_open_uri_in[] = {&_mpris_player_dbus_arg_info_open_uri_uri, NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_open_uri_out[] = {NULL}; +static const GDBusMethodInfo _mpris_player_dbus_method_info_open_uri = {-1, "OpenUri", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_open_uri_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_open_uri_out), NULL}; +static const GDBusMethodInfo * const _mpris_player_dbus_method_info[] = {&_mpris_player_dbus_method_info_next, &_mpris_player_dbus_method_info_previous, &_mpris_player_dbus_method_info_pause, &_mpris_player_dbus_method_info_play_pause, &_mpris_player_dbus_method_info_stop, &_mpris_player_dbus_method_info_play, &_mpris_player_dbus_method_info_seek, &_mpris_player_dbus_method_info_set_position, &_mpris_player_dbus_method_info_open_uri, NULL}; +static const GDBusArgInfo _mpris_player_dbus_arg_info_seeked_position = {-1, "position", "x", NULL}; +static const GDBusArgInfo * const _mpris_player_dbus_arg_info_seeked[] = {&_mpris_player_dbus_arg_info_seeked_position, NULL}; +static const GDBusSignalInfo _mpris_player_dbus_signal_info_seeked = {-1, "Seeked", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_seeked), NULL}; +static const GDBusSignalInfo * const _mpris_player_dbus_signal_info[] = {&_mpris_player_dbus_signal_info_seeked, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_playback_status = {-1, "PlaybackStatus", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_loop_status = {-1, "LoopStatus", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_rate = {-1, "Rate", "d", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_shuffle = {-1, "Shuffle", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_metadata = {-1, "Metadata", "a{sv}", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_volume = {-1, "Volume", "d", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_position = {-1, "Position", "x", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_minimum_rate = {-1, "MinimumRate", "d", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_maximum_rate = {-1, "MaximumRate", "d", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_can_go_next = {-1, "CanGoNext", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_can_go_previous = {-1, "CanGoPrevious", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_can_play = {-1, "CanPlay", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_can_pause = {-1, "CanPause", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_can_seek = {-1, "CanSeek", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL}; +static const GDBusPropertyInfo _mpris_player_dbus_property_info_can_control = {-1, "CanControl", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL}; +static const GDBusPropertyInfo * const _mpris_player_dbus_property_info[] = {&_mpris_player_dbus_property_info_playback_status, &_mpris_player_dbus_property_info_loop_status, &_mpris_player_dbus_property_info_rate, &_mpris_player_dbus_property_info_shuffle, &_mpris_player_dbus_property_info_metadata, &_mpris_player_dbus_property_info_volume, &_mpris_player_dbus_property_info_position, &_mpris_player_dbus_property_info_minimum_rate, &_mpris_player_dbus_property_info_maximum_rate, &_mpris_player_dbus_property_info_can_go_next, &_mpris_player_dbus_property_info_can_go_previous, &_mpris_player_dbus_property_info_can_play, &_mpris_player_dbus_property_info_can_pause, &_mpris_player_dbus_property_info_can_seek, &_mpris_player_dbus_property_info_can_control, NULL}; +static const GDBusInterfaceInfo _mpris_player_dbus_interface_info = {-1, "org.mpris.MediaPlayer2.Player", (GDBusMethodInfo **) (&_mpris_player_dbus_method_info), (GDBusSignalInfo **) (&_mpris_player_dbus_signal_info), (GDBusPropertyInfo **) (&_mpris_player_dbus_property_info), NULL}; +static const GDBusInterfaceVTable _mpris_player_dbus_interface_vtable = {mpris_player_dbus_interface_method_call, mpris_player_dbus_interface_get_property, mpris_player_dbus_interface_set_property}; + +void +mpris_raise (Mpris* self, + GError** error) +{ +#line 7 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 8 "../src/mpris.vala" + g_signal_emit (self, mpris_signals[MPRIS_ON_RAISE_SIGNAL], 0); +#line 678 "mpris.c" +} + +void +mpris_quit (Mpris* self, + GError** error) +{ +#line 12 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 13 "../src/mpris.vala" + g_signal_emit (self, mpris_signals[MPRIS_ON_QUIT_SIGNAL], 0); +#line 689 "mpris.c" +} + +static gpointer +_g_object_ref0 (gpointer self) +{ +#line 24 "../src/mpris.vala" + return self ? g_object_ref (self) : NULL; +#line 697 "mpris.c" +} + +static Block1Data* +block1_data_ref (Block1Data* _data1_) +{ +#line 24 "../src/mpris.vala" + g_atomic_int_inc (&_data1_->_ref_count_); +#line 24 "../src/mpris.vala" + return _data1_; +#line 707 "mpris.c" +} + +static void +block1_data_unref (void * _userdata_) +{ + Block1Data* _data1_; + _data1_ = (Block1Data*) _userdata_; +#line 24 "../src/mpris.vala" + if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) { +#line 717 "mpris.c" + Mpris* self; +#line 24 "../src/mpris.vala" + self = _data1_->self; +#line 24 "../src/mpris.vala" + _g_object_unref0 (_data1_->window); +#line 24 "../src/mpris.vala" + _g_object_unref0 (self); +#line 24 "../src/mpris.vala" + g_slice_free (Block1Data, _data1_); +#line 727 "mpris.c" + } +} + +static void +__lambda12_ (Block1Data* _data1_) +{ + Mpris* self; +#line 25 "../src/mpris.vala" + self = _data1_->self; +#line 25 "../src/mpris.vala" + gtk_window_present ((GtkWindow*) _data1_->window); +#line 739 "mpris.c" +} + +static void +___lambda12__mpris_on_raise (Mpris* _sender, + gpointer self) +{ +#line 25 "../src/mpris.vala" + __lambda12_ (self); +#line 748 "mpris.c" +} + +static void +__lambda13_ (Block1Data* _data1_) +{ + Mpris* self; +#line 26 "../src/mpris.vala" + self = _data1_->self; +#line 26 "../src/mpris.vala" + gtk_window_close ((GtkWindow*) _data1_->window); +#line 759 "mpris.c" +} + +static void +___lambda13__mpris_on_quit (Mpris* _sender, + gpointer self) +{ +#line 26 "../src/mpris.vala" + __lambda13_ (self); +#line 768 "mpris.c" +} + +Mpris* +mpris_construct (GType object_type, + UiWindow* window) +{ + Mpris * self = NULL; + Block1Data* _data1_; + UiWindow* _tmp0_; +#line 24 "../src/mpris.vala" + g_return_val_if_fail (window != NULL, NULL); +#line 24 "../src/mpris.vala" + _data1_ = g_slice_new0 (Block1Data); +#line 24 "../src/mpris.vala" + _data1_->_ref_count_ = 1; +#line 24 "../src/mpris.vala" + _tmp0_ = _g_object_ref0 (window); +#line 24 "../src/mpris.vala" + _g_object_unref0 (_data1_->window); +#line 24 "../src/mpris.vala" + _data1_->window = _tmp0_; +#line 24 "../src/mpris.vala" + self = (Mpris*) g_object_new (object_type, NULL); +#line 24 "../src/mpris.vala" + _data1_->self = g_object_ref (self); +#line 25 "../src/mpris.vala" + g_signal_connect_data (self, "on-raise", (GCallback) ___lambda12__mpris_on_raise, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0); +#line 26 "../src/mpris.vala" + g_signal_connect_data (self, "on-quit", (GCallback) ___lambda13__mpris_on_quit, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0); +#line 24 "../src/mpris.vala" + block1_data_unref (_data1_); +#line 24 "../src/mpris.vala" + _data1_ = NULL; +#line 24 "../src/mpris.vala" + return self; +#line 804 "mpris.c" +} + +Mpris* +mpris_new (UiWindow* window) +{ +#line 24 "../src/mpris.vala" + return mpris_construct (TYPE_MPRIS, window); +#line 812 "mpris.c" +} + +gboolean +mpris_get_can_raise (Mpris* self) +{ + gboolean result; +#line 6 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 6 "../src/mpris.vala" + result = TRUE; +#line 6 "../src/mpris.vala" + return result; +#line 825 "mpris.c" +} + +gboolean +mpris_get_can_quit (Mpris* self) +{ + gboolean result; +#line 11 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 11 "../src/mpris.vala" + result = TRUE; +#line 11 "../src/mpris.vala" + return result; +#line 838 "mpris.c" +} + +gboolean +mpris_get_can_set_fullscreen (Mpris* self) +{ + gboolean result; +#line 16 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 16 "../src/mpris.vala" + result = FALSE; +#line 16 "../src/mpris.vala" + return result; +#line 851 "mpris.c" +} + +gboolean +mpris_get_fullscreen (Mpris* self) +{ + gboolean result; +#line 17 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 17 "../src/mpris.vala" + result = FALSE; +#line 17 "../src/mpris.vala" + return result; +#line 864 "mpris.c" +} + +void +mpris_set_fullscreen (Mpris* self, + gboolean value) +{ +#line 17 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 17 "../src/mpris.vala" + _vala_assert (FALSE, "false"); +#line 17 "../src/mpris.vala" + g_object_notify_by_pspec ((GObject *) self, mpris_properties[MPRIS_FULLSCREEN_PROPERTY]); +#line 877 "mpris.c" +} + +gboolean +mpris_get_has_track_list (Mpris* self) +{ + gboolean result; +#line 18 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 18 "../src/mpris.vala" + result = FALSE; +#line 18 "../src/mpris.vala" + return result; +#line 890 "mpris.c" +} + +gchar* +mpris_get_identity (Mpris* self) +{ + gchar* result; + gchar* _tmp0_; +#line 19 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 19 "../src/mpris.vala" + _tmp0_ = g_strdup ("audrey"); +#line 19 "../src/mpris.vala" + result = _tmp0_; +#line 19 "../src/mpris.vala" + return result; +#line 906 "mpris.c" +} + +gchar* +mpris_get_desktop_entry (Mpris* self) +{ + gchar* result; + gchar* _tmp0_; +#line 20 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 20 "../src/mpris.vala" + _tmp0_ = g_strdup ("eu.callcc.audrey"); +#line 20 "../src/mpris.vala" + result = _tmp0_; +#line 20 "../src/mpris.vala" + return result; +#line 922 "mpris.c" +} + +gchar** +mpris_get_supported_uri_schemes (Mpris* self, + gint* result_length1) +{ + gchar** result; + gchar** _tmp0_; + gchar** _tmp1_; + gint _tmp1__length1; +#line 21 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 21 "../src/mpris.vala" + _tmp0_ = g_new0 (gchar*, 0 + 1); +#line 21 "../src/mpris.vala" + _tmp1_ = _tmp0_; +#line 21 "../src/mpris.vala" + _tmp1__length1 = 0; +#line 21 "../src/mpris.vala" + if (result_length1) { +#line 21 "../src/mpris.vala" + *result_length1 = _tmp1__length1; +#line 945 "mpris.c" + } +#line 21 "../src/mpris.vala" + result = _tmp1_; +#line 21 "../src/mpris.vala" + return result; +#line 951 "mpris.c" +} + +gchar** +mpris_get_supported_mime_types (Mpris* self, + gint* result_length1) +{ + gchar** result; + gchar** _tmp0_; + gchar** _tmp1_; + gint _tmp1__length1; +#line 22 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 22 "../src/mpris.vala" + _tmp0_ = g_new0 (gchar*, 0 + 1); +#line 22 "../src/mpris.vala" + _tmp1_ = _tmp0_; +#line 22 "../src/mpris.vala" + _tmp1__length1 = 0; +#line 22 "../src/mpris.vala" + if (result_length1) { +#line 22 "../src/mpris.vala" + *result_length1 = _tmp1__length1; +#line 974 "mpris.c" + } +#line 22 "../src/mpris.vala" + result = _tmp1_; +#line 22 "../src/mpris.vala" + return result; +#line 980 "mpris.c" +} + +static void +mpris_class_init (MprisClass * klass, + gpointer klass_data) +{ +#line 2 "../src/mpris.vala" + mpris_parent_class = g_type_class_peek_parent (klass); +#line 2 "../src/mpris.vala" + G_OBJECT_CLASS (klass)->get_property = _vala_mpris_get_property; +#line 2 "../src/mpris.vala" + G_OBJECT_CLASS (klass)->set_property = _vala_mpris_set_property; +#line 2 "../src/mpris.vala" + G_OBJECT_CLASS (klass)->finalize = mpris_finalize; +#line 2 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_CAN_RAISE_PROPERTY, mpris_properties[MPRIS_CAN_RAISE_PROPERTY] = g_param_spec_boolean ("can-raise", "can-raise", "can-raise", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 2 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_CAN_QUIT_PROPERTY, mpris_properties[MPRIS_CAN_QUIT_PROPERTY] = g_param_spec_boolean ("can-quit", "can-quit", "can-quit", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 2 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_CAN_SET_FULLSCREEN_PROPERTY, mpris_properties[MPRIS_CAN_SET_FULLSCREEN_PROPERTY] = g_param_spec_boolean ("can-set-fullscreen", "can-set-fullscreen", "can-set-fullscreen", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 2 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_FULLSCREEN_PROPERTY, mpris_properties[MPRIS_FULLSCREEN_PROPERTY] = g_param_spec_boolean ("fullscreen", "fullscreen", "fullscreen", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 2 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_HAS_TRACK_LIST_PROPERTY, mpris_properties[MPRIS_HAS_TRACK_LIST_PROPERTY] = g_param_spec_boolean ("has-track-list", "has-track-list", "has-track-list", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 2 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_IDENTITY_PROPERTY, mpris_properties[MPRIS_IDENTITY_PROPERTY] = g_param_spec_string ("identity", "identity", "identity", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 2 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_DESKTOP_ENTRY_PROPERTY, mpris_properties[MPRIS_DESKTOP_ENTRY_PROPERTY] = g_param_spec_string ("desktop-entry", "desktop-entry", "desktop-entry", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 2 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_SUPPORTED_URI_SCHEMES_PROPERTY, mpris_properties[MPRIS_SUPPORTED_URI_SCHEMES_PROPERTY] = g_param_spec_boxed ("supported-uri-schemes", "supported-uri-schemes", "supported-uri-schemes", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 2 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_SUPPORTED_MIME_TYPES_PROPERTY, mpris_properties[MPRIS_SUPPORTED_MIME_TYPES_PROPERTY] = g_param_spec_boxed ("supported-mime-types", "supported-mime-types", "supported-mime-types", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 2 "../src/mpris.vala" + mpris_signals[MPRIS_ON_RAISE_SIGNAL] = g_signal_new ("on-raise", TYPE_MPRIS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); +#line 2 "../src/mpris.vala" + mpris_signals[MPRIS_ON_QUIT_SIGNAL] = g_signal_new ("on-quit", TYPE_MPRIS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); +#line 1017 "mpris.c" +} + +static void +mpris_instance_init (Mpris * self, + gpointer klass) +{ +} + +static void +mpris_finalize (GObject * obj) +{ + Mpris * self; +#line 2 "../src/mpris.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MPRIS, Mpris); +#line 30 "../src/mpris.vala" + g_debug ("mpris.vala:30: destroying mpris"); +#line 2 "../src/mpris.vala" + G_OBJECT_CLASS (mpris_parent_class)->finalize (obj); +#line 1036 "mpris.c" +} + +static GType +mpris_get_type_once (void) +{ + static const GTypeInfo g_define_type_info = { sizeof (MprisClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) mpris_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Mpris), 0, (GInstanceInitFunc) mpris_instance_init, NULL }; + GType mpris_type_id; + mpris_type_id = g_type_register_static (G_TYPE_OBJECT, "Mpris", &g_define_type_info, 0); + g_type_set_qdata (mpris_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) mpris_register_object); + return mpris_type_id; +} + +GType +mpris_get_type (void) +{ + static volatile gsize mpris_type_id__once = 0; + if (g_once_init_enter (&mpris_type_id__once)) { + GType mpris_type_id; + mpris_type_id = mpris_get_type_once (); + g_once_init_leave (&mpris_type_id__once, mpris_type_id); + } + return mpris_type_id__once; +} + +static void +_vala_mpris_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec) +{ + Mpris * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MPRIS, Mpris); +#line 2 "../src/mpris.vala" + switch (property_id) { +#line 2 "../src/mpris.vala" + case MPRIS_CAN_RAISE_PROPERTY: +#line 2 "../src/mpris.vala" + g_value_set_boolean (value, mpris_get_can_raise (self)); +#line 2 "../src/mpris.vala" + break; +#line 2 "../src/mpris.vala" + case MPRIS_CAN_QUIT_PROPERTY: +#line 2 "../src/mpris.vala" + g_value_set_boolean (value, mpris_get_can_quit (self)); +#line 2 "../src/mpris.vala" + break; +#line 2 "../src/mpris.vala" + case MPRIS_CAN_SET_FULLSCREEN_PROPERTY: +#line 2 "../src/mpris.vala" + g_value_set_boolean (value, mpris_get_can_set_fullscreen (self)); +#line 2 "../src/mpris.vala" + break; +#line 2 "../src/mpris.vala" + case MPRIS_FULLSCREEN_PROPERTY: +#line 2 "../src/mpris.vala" + g_value_set_boolean (value, mpris_get_fullscreen (self)); +#line 2 "../src/mpris.vala" + break; +#line 2 "../src/mpris.vala" + case MPRIS_HAS_TRACK_LIST_PROPERTY: +#line 2 "../src/mpris.vala" + g_value_set_boolean (value, mpris_get_has_track_list (self)); +#line 2 "../src/mpris.vala" + break; +#line 2 "../src/mpris.vala" + case MPRIS_IDENTITY_PROPERTY: +#line 2 "../src/mpris.vala" + g_value_take_string (value, mpris_get_identity (self)); +#line 2 "../src/mpris.vala" + break; +#line 2 "../src/mpris.vala" + case MPRIS_DESKTOP_ENTRY_PROPERTY: +#line 2 "../src/mpris.vala" + g_value_take_string (value, mpris_get_desktop_entry (self)); +#line 2 "../src/mpris.vala" + break; +#line 2 "../src/mpris.vala" + case MPRIS_SUPPORTED_URI_SCHEMES_PROPERTY: +#line 1115 "mpris.c" + { + int length; +#line 2 "../src/mpris.vala" + g_value_take_boxed (value, mpris_get_supported_uri_schemes (self, &length)); +#line 1120 "mpris.c" + } +#line 2 "../src/mpris.vala" + break; +#line 2 "../src/mpris.vala" + case MPRIS_SUPPORTED_MIME_TYPES_PROPERTY: +#line 1126 "mpris.c" + { + int length; +#line 2 "../src/mpris.vala" + g_value_take_boxed (value, mpris_get_supported_mime_types (self, &length)); +#line 1131 "mpris.c" + } +#line 2 "../src/mpris.vala" + break; +#line 1135 "mpris.c" + default: +#line 2 "../src/mpris.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 2 "../src/mpris.vala" + break; +#line 1141 "mpris.c" + } +} + +static void +_vala_mpris_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec) +{ + Mpris * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MPRIS, Mpris); +#line 2 "../src/mpris.vala" + switch (property_id) { +#line 2 "../src/mpris.vala" + case MPRIS_FULLSCREEN_PROPERTY: +#line 2 "../src/mpris.vala" + mpris_set_fullscreen (self, g_value_get_boolean (value)); +#line 2 "../src/mpris.vala" + break; +#line 1161 "mpris.c" + default: +#line 2 "../src/mpris.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 2 "../src/mpris.vala" + break; +#line 1167 "mpris.c" + } +} + +static void +_dbus_mpris_raise (Mpris* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation) +{ + GError* error = NULL; + GVariantIter _arguments_iter; + GDBusMessage* _reply_message = NULL; + GVariant* _reply; + GVariantBuilder _reply_builder; + g_variant_iter_init (&_arguments_iter, _parameters_); + mpris_raise (self, &error); + if (error) { + g_dbus_method_invocation_take_error (invocation, error); + return; + } + _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); + g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); + _reply = g_variant_builder_end (&_reply_builder); + g_dbus_message_set_body (_reply_message, _reply); + g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); + g_object_unref (invocation); + g_object_unref (_reply_message); +} + +static void +_dbus_mpris_quit (Mpris* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation) +{ + GError* error = NULL; + GVariantIter _arguments_iter; + GDBusMessage* _reply_message = NULL; + GVariant* _reply; + GVariantBuilder _reply_builder; + g_variant_iter_init (&_arguments_iter, _parameters_); + mpris_quit (self, &error); + if (error) { + g_dbus_method_invocation_take_error (invocation, error); + return; + } + _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); + g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); + _reply = g_variant_builder_end (&_reply_builder); + g_dbus_message_set_body (_reply_message, _reply); + g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); + g_object_unref (invocation); + g_object_unref (_reply_message); +} + +static void +mpris_dbus_interface_method_call (GDBusConnection* connection, + const gchar* sender, + const gchar* object_path, + const gchar* interface_name, + const gchar* method_name, + GVariant* parameters, + GDBusMethodInvocation* invocation, + gpointer user_data) +{ + gpointer* data; + gpointer object; + data = user_data; + object = data[0]; + if (strcmp (method_name, "Raise") == 0) { + _dbus_mpris_raise (object, parameters, invocation); + } else if (strcmp (method_name, "Quit") == 0) { + _dbus_mpris_quit (object, parameters, invocation); + } else { + g_object_unref (invocation); + } +} + +static GVariant* +_dbus_mpris_get_can_raise (Mpris* self) +{ + gboolean result; + GVariant* _reply; + result = mpris_get_can_raise (self); + _reply = g_variant_new_boolean (result); + return _reply; +} + +static GVariant* +_dbus_mpris_get_can_quit (Mpris* self) +{ + gboolean result; + GVariant* _reply; + result = mpris_get_can_quit (self); + _reply = g_variant_new_boolean (result); + return _reply; +} + +static GVariant* +_dbus_mpris_get_can_set_fullscreen (Mpris* self) +{ + gboolean result; + GVariant* _reply; + result = mpris_get_can_set_fullscreen (self); + _reply = g_variant_new_boolean (result); + return _reply; +} + +static GVariant* +_dbus_mpris_get_fullscreen (Mpris* self) +{ + gboolean result; + GVariant* _reply; + result = mpris_get_fullscreen (self); + _reply = g_variant_new_boolean (result); + return _reply; +} + +static GVariant* +_dbus_mpris_get_has_track_list (Mpris* self) +{ + gboolean result; + GVariant* _reply; + result = mpris_get_has_track_list (self); + _reply = g_variant_new_boolean (result); + return _reply; +} + +static GVariant* +_dbus_mpris_get_identity (Mpris* self) +{ + gchar* result; + GVariant* _reply; + result = mpris_get_identity (self); + _reply = g_variant_new_string (result); + _g_free0 (result); + return _reply; +} + +static GVariant* +_dbus_mpris_get_desktop_entry (Mpris* self) +{ + gchar* result; + GVariant* _reply; + result = mpris_get_desktop_entry (self); + _reply = g_variant_new_string (result); + _g_free0 (result); + return _reply; +} + +static GVariant* +_dbus_mpris_get_supported_uri_schemes (Mpris* self) +{ + gchar** result; + gint result_length1 = 0; + GVariant* _reply; + gchar** _tmp0_; + GVariantBuilder _tmp1_; + gint _tmp2_; + result = mpris_get_supported_uri_schemes (self, &result_length1); + _tmp0_ = result; + g_variant_builder_init (&_tmp1_, G_VARIANT_TYPE ("as")); + for (_tmp2_ = 0; _tmp2_ < result_length1; _tmp2_++) { + g_variant_builder_add_value (&_tmp1_, g_variant_new_string (*_tmp0_)); + _tmp0_++; + } + _reply = g_variant_builder_end (&_tmp1_); + result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL); + return _reply; +} + +static GVariant* +_dbus_mpris_get_supported_mime_types (Mpris* self) +{ + gchar** result; + gint result_length1 = 0; + GVariant* _reply; + gchar** _tmp3_; + GVariantBuilder _tmp4_; + gint _tmp5_; + result = mpris_get_supported_mime_types (self, &result_length1); + _tmp3_ = result; + g_variant_builder_init (&_tmp4_, G_VARIANT_TYPE ("as")); + for (_tmp5_ = 0; _tmp5_ < result_length1; _tmp5_++) { + g_variant_builder_add_value (&_tmp4_, g_variant_new_string (*_tmp3_)); + _tmp3_++; + } + _reply = g_variant_builder_end (&_tmp4_); + result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL); + return _reply; +} + +static GVariant* +mpris_dbus_interface_get_property (GDBusConnection* connection, + const gchar* sender, + const gchar* object_path, + const gchar* interface_name, + const gchar* property_name, + GError** error, + gpointer user_data) +{ + gpointer* data; + gpointer object; + data = user_data; + object = data[0]; + if (strcmp (property_name, "CanRaise") == 0) { + return _dbus_mpris_get_can_raise (object); + } else if (strcmp (property_name, "CanQuit") == 0) { + return _dbus_mpris_get_can_quit (object); + } else if (strcmp (property_name, "CanSetFullscreen") == 0) { + return _dbus_mpris_get_can_set_fullscreen (object); + } else if (strcmp (property_name, "Fullscreen") == 0) { + return _dbus_mpris_get_fullscreen (object); + } else if (strcmp (property_name, "HasTrackList") == 0) { + return _dbus_mpris_get_has_track_list (object); + } else if (strcmp (property_name, "Identity") == 0) { + return _dbus_mpris_get_identity (object); + } else if (strcmp (property_name, "DesktopEntry") == 0) { + return _dbus_mpris_get_desktop_entry (object); + } else if (strcmp (property_name, "SupportedUriSchemes") == 0) { + return _dbus_mpris_get_supported_uri_schemes (object); + } else if (strcmp (property_name, "SupportedMimeTypes") == 0) { + return _dbus_mpris_get_supported_mime_types (object); + } + return NULL; +} + +static void +_dbus_mpris_set_fullscreen (Mpris* self, + GVariant* _value) +{ + gboolean value = FALSE; + value = g_variant_get_boolean (_value); + mpris_set_fullscreen (self, value); +} + +static gboolean +mpris_dbus_interface_set_property (GDBusConnection* connection, + const gchar* sender, + const gchar* object_path, + const gchar* interface_name, + const gchar* property_name, + GVariant* value, + GError** error, + gpointer user_data) +{ + gpointer* data; + gpointer object; + data = user_data; + object = data[0]; + if (strcmp (property_name, "Fullscreen") == 0) { + _dbus_mpris_set_fullscreen (object, value); + return TRUE; + } + return FALSE; +} + +guint +mpris_register_object (gpointer object, + GDBusConnection* connection, + const gchar* path, + GError** error) +{ + guint result; + gpointer *data; + data = g_new (gpointer, 3); + data[0] = g_object_ref (object); + data[1] = g_object_ref (connection); + data[2] = g_strdup (path); + result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_mpris_dbus_interface_info), &_mpris_dbus_interface_vtable, data, _mpris_unregister_object, error); + if (!result) { + return 0; + } + return result; +} + +static void +_mpris_unregister_object (gpointer user_data) +{ + gpointer* data; + data = user_data; + g_object_unref (data[0]); + g_object_unref (data[1]); + g_free (data[2]); + g_free (data); +} + +static inline gpointer +mpris_player_get_instance_private (MprisPlayer* self) +{ + return G_STRUCT_MEMBER_P (self, MprisPlayer_private_offset); +} + +static void +_g_free0_ (gpointer var) +{ +#line 61 "../src/mpris.vala" + var = (g_free (var), NULL); +#line 1464 "mpris.c" +} + +static void +_g_variant_unref0_ (gpointer var) +{ +#line 61 "../src/mpris.vala" + (var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)); +#line 1472 "mpris.c" +} + +void +mpris_player_next (MprisPlayer* self, + GError** error) +{ +#line 45 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 45 "../src/mpris.vala" + g_signal_emit (self, mpris_player_signals[MPRIS_PLAYER_ON_NEXT_SIGNAL], 0); +#line 1483 "mpris.c" +} + +void +mpris_player_previous (MprisPlayer* self, + GError** error) +{ +#line 46 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 46 "../src/mpris.vala" + g_signal_emit (self, mpris_player_signals[MPRIS_PLAYER_ON_PREVIOUS_SIGNAL], 0); +#line 1494 "mpris.c" +} + +void +mpris_player_pause (MprisPlayer* self, + GError** error) +{ +#line 47 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 47 "../src/mpris.vala" + g_print ("pause\n"); +#line 47 "../src/mpris.vala" + g_signal_emit (self, mpris_player_signals[MPRIS_PLAYER_ON_PAUSE_SIGNAL], 0); +#line 1507 "mpris.c" +} + +void +mpris_player_play_pause (MprisPlayer* self, + GError** error) +{ +#line 48 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 48 "../src/mpris.vala" + g_signal_emit (self, mpris_player_signals[MPRIS_PLAYER_ON_PLAY_PAUSE_SIGNAL], 0); +#line 1518 "mpris.c" +} + +void +mpris_player_stop (MprisPlayer* self, + GError** error) +{ +#line 49 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 49 "../src/mpris.vala" + g_signal_emit (self, mpris_player_signals[MPRIS_PLAYER_ON_STOP_SIGNAL], 0); +#line 1529 "mpris.c" +} + +void +mpris_player_play (MprisPlayer* self, + GError** error) +{ +#line 50 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 50 "../src/mpris.vala" + g_signal_emit (self, mpris_player_signals[MPRIS_PLAYER_ON_PLAY_SIGNAL], 0); +#line 1540 "mpris.c" +} + +void +mpris_player_seek (MprisPlayer* self, + gint64 offset, + GError** error) +{ +#line 51 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 51 "../src/mpris.vala" + g_signal_emit (self, mpris_player_signals[MPRIS_PLAYER_ON_SEEK_SIGNAL], 0, offset); +#line 1552 "mpris.c" +} + +void +mpris_player_set_position (MprisPlayer* self, + const char* track_id, + gint64 position, + GError** error) +{ +#line 52 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 52 "../src/mpris.vala" + g_return_if_fail (track_id != NULL); +#line 52 "../src/mpris.vala" + g_signal_emit (self, mpris_player_signals[MPRIS_PLAYER_ON_SET_POSITION_SIGNAL], 0, track_id, position); +#line 1567 "mpris.c" +} + +void +mpris_player_open_uri (MprisPlayer* self, + const gchar* uri, + GError** error) +{ +#line 53 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 53 "../src/mpris.vala" + g_return_if_fail (uri != NULL); +#line 53 "../src/mpris.vala" + _vala_assert (FALSE, "false"); +#line 1581 "mpris.c" +} + +static Block2Data* +block2_data_ref (Block2Data* _data2_) +{ +#line 77 "../src/mpris.vala" + g_atomic_int_inc (&_data2_->_ref_count_); +#line 77 "../src/mpris.vala" + return _data2_; +#line 1591 "mpris.c" +} + +static void +block2_data_unref (void * _userdata_) +{ + Block2Data* _data2_; + _data2_ = (Block2Data*) _userdata_; +#line 77 "../src/mpris.vala" + if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) { +#line 1601 "mpris.c" + MprisPlayer* self; +#line 77 "../src/mpris.vala" + self = _data2_->self; +#line 77 "../src/mpris.vala" + _g_object_unref0 (_data2_->conn); +#line 77 "../src/mpris.vala" + _g_object_unref0 (_data2_->playbin); +#line 77 "../src/mpris.vala" + _g_object_unref0 (self); +#line 77 "../src/mpris.vala" + g_slice_free (Block2Data, _data2_); +#line 1613 "mpris.c" + } +} + +static gboolean +__lambda14_ (MprisPlayer* self, + GBinding* binding, + GValue* from, + GValue* to) +{ + gboolean result; +#line 83 "../src/mpris.vala" + g_return_val_if_fail (binding != NULL, FALSE); +#line 83 "../src/mpris.vala" + g_return_val_if_fail (from != NULL, FALSE); +#line 83 "../src/mpris.vala" + g_return_val_if_fail (to != NULL, FALSE); +#line 84 "../src/mpris.vala" + switch (g_value_get_enum (from)) { +#line 84 "../src/mpris.vala" + case PLAYBIN_STATE_STOPPED: +#line 1634 "mpris.c" + { +#line 86 "../src/mpris.vala" + g_value_set_string (to, "Stopped"); +#line 87 "../src/mpris.vala" + mpris_player_set_can_go_next (self, FALSE); +#line 88 "../src/mpris.vala" + mpris_player_set_can_go_previous (self, FALSE); +#line 89 "../src/mpris.vala" + mpris_player_set_can_play (self, FALSE); +#line 90 "../src/mpris.vala" + mpris_player_set_can_pause (self, FALSE); +#line 91 "../src/mpris.vala" + mpris_player_set_can_seek (self, FALSE); +#line 92 "../src/mpris.vala" + result = TRUE; +#line 92 "../src/mpris.vala" + return result; +#line 1652 "mpris.c" + } +#line 84 "../src/mpris.vala" + case PLAYBIN_STATE_PAUSED: +#line 1656 "mpris.c" + { +#line 94 "../src/mpris.vala" + g_value_set_string (to, "Paused"); +#line 95 "../src/mpris.vala" + mpris_player_set_can_go_next (self, TRUE); +#line 96 "../src/mpris.vala" + mpris_player_set_can_go_previous (self, TRUE); +#line 97 "../src/mpris.vala" + mpris_player_set_can_play (self, TRUE); +#line 98 "../src/mpris.vala" + mpris_player_set_can_pause (self, TRUE); +#line 99 "../src/mpris.vala" + mpris_player_set_can_seek (self, TRUE); +#line 100 "../src/mpris.vala" + result = TRUE; +#line 100 "../src/mpris.vala" + return result; +#line 1674 "mpris.c" + } +#line 84 "../src/mpris.vala" + case PLAYBIN_STATE_PLAYING: +#line 1678 "mpris.c" + { +#line 102 "../src/mpris.vala" + g_value_set_string (to, "Playing"); +#line 103 "../src/mpris.vala" + mpris_player_set_can_go_next (self, TRUE); +#line 104 "../src/mpris.vala" + mpris_player_set_can_go_previous (self, TRUE); +#line 105 "../src/mpris.vala" + mpris_player_set_can_play (self, TRUE); +#line 106 "../src/mpris.vala" + mpris_player_set_can_pause (self, TRUE); +#line 107 "../src/mpris.vala" + mpris_player_set_can_seek (self, TRUE); +#line 108 "../src/mpris.vala" + result = TRUE; +#line 108 "../src/mpris.vala" + return result; +#line 1696 "mpris.c" + } + default: +#line 84 "../src/mpris.vala" + break; +#line 1701 "mpris.c" + } +#line 110 "../src/mpris.vala" + result = FALSE; +#line 110 "../src/mpris.vala" + return result; +#line 1707 "mpris.c" +} + +static gboolean +___lambda14__gbinding_transform_func (GBinding* binding, + GValue* from_value, + GValue* to_value, + gpointer self) +{ + gboolean result; + result = __lambda14_ ((MprisPlayer*) self, binding, from_value, to_value); +#line 78 "../src/mpris.vala" + return result; +#line 1720 "mpris.c" +} + +static gboolean +__lambda15_ (MprisPlayer* self, + GBinding* binding, + GValue* from, + GValue* to) +{ + gboolean result; +#line 118 "../src/mpris.vala" + g_return_val_if_fail (binding != NULL, FALSE); +#line 118 "../src/mpris.vala" + g_return_val_if_fail (from != NULL, FALSE); +#line 118 "../src/mpris.vala" + g_return_val_if_fail (to != NULL, FALSE); +#line 119 "../src/mpris.vala" + g_value_set_double (to, g_value_get_int (from) / 100.0); +#line 120 "../src/mpris.vala" + result = TRUE; +#line 120 "../src/mpris.vala" + return result; +#line 1742 "mpris.c" +} + +static gboolean +___lambda15__gbinding_transform_func (GBinding* binding, + GValue* from_value, + GValue* to_value, + gpointer self) +{ + gboolean result; + result = __lambda15_ ((MprisPlayer*) self, binding, from_value, to_value); +#line 113 "../src/mpris.vala" + return result; +#line 1755 "mpris.c" +} + +static gboolean +__lambda16_ (MprisPlayer* self, + GBinding* binding, + GValue* from, + GValue* to) +{ + gboolean result; +#line 122 "../src/mpris.vala" + g_return_val_if_fail (binding != NULL, FALSE); +#line 122 "../src/mpris.vala" + g_return_val_if_fail (from != NULL, FALSE); +#line 122 "../src/mpris.vala" + g_return_val_if_fail (to != NULL, FALSE); +#line 123 "../src/mpris.vala" + g_value_set_int (to, (gint) (g_value_get_double (from) * 100.0)); +#line 124 "../src/mpris.vala" + result = TRUE; +#line 124 "../src/mpris.vala" + return result; +#line 1777 "mpris.c" +} + +static gboolean +___lambda16__gbinding_transform_func (GBinding* binding, + GValue* from_value, + GValue* to_value, + gpointer self) +{ + gboolean result; + result = __lambda16_ ((MprisPlayer*) self, binding, from_value, to_value); +#line 113 "../src/mpris.vala" + return result; +#line 1790 "mpris.c" +} + +static const gchar* +string_to_string (const gchar* self) +{ + const gchar* result; +#line 1589 "glib-2.0.vapi" + g_return_val_if_fail (self != NULL, NULL); +#line 1590 "glib-2.0.vapi" + result = self; +#line 1590 "glib-2.0.vapi" + return result; +#line 1803 "mpris.c" +} + +static GVariant* +_variant_new1 (char* value) +{ +#line 131 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_object_path (value)); +#line 1811 "mpris.c" +} + +static GVariant* +_variant_new2 (gint64 value) +{ +#line 132 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_int64 (value)); +#line 1819 "mpris.c" +} + +static GVariant* +_variant_new3 (gchar* value) +{ +#line 133 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_string (value)); +#line 1827 "mpris.c" +} + +static GVariant* +_variant_new4 (const gchar* value) +{ +#line 134 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_string (value)); +#line 1835 "mpris.c" +} + +static GVariant* +_variant_new5 (gchar** value, + gint value_length1) +{ + gchar** _tmp47_; + GVariantBuilder _tmp48_; + gint _tmp49_; +#line 135 "../src/mpris.vala" + _tmp47_ = value; +#line 135 "../src/mpris.vala" + g_variant_builder_init (&_tmp48_, G_VARIANT_TYPE ("as")); +#line 135 "../src/mpris.vala" + for (_tmp49_ = 0; _tmp49_ < value_length1; _tmp49_++) { +#line 135 "../src/mpris.vala" + g_variant_builder_add_value (&_tmp48_, g_variant_new_string (*_tmp47_)); +#line 135 "../src/mpris.vala" + _tmp47_++; +#line 1855 "mpris.c" + } +#line 135 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_builder_end (&_tmp48_)); +#line 1859 "mpris.c" +} + +static GVariant* +_variant_new6 (const gchar* value) +{ +#line 136 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_string (value)); +#line 1867 "mpris.c" +} + +static GVariant* +_variant_new7 (const gchar* value) +{ +#line 137 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_string (value)); +#line 1875 "mpris.c" +} + +static GVariant* +_variant_new8 (gint64 value) +{ +#line 138 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_int64 (value)); +#line 1883 "mpris.c" +} + +static GVariant* +_variant_new9 (gint64 value) +{ +#line 139 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_int64 (value)); +#line 1891 "mpris.c" +} + +static void +__lambda17_ (MprisPlayer* self, + Playbin* playbin) +{ + PlaybinSong* song = NULL; + GListModel* _tmp0_; + GListModel* _tmp1_; + gint _tmp2_; + gint _tmp3_; + GObject* _tmp4_; + GHashTable* metadata = NULL; + GHashTable* _tmp5_; + GHashTable* _tmp6_; + gchar* _tmp7_; + PlaybinSong* _tmp8_; + const gchar* _tmp9_; + const gchar* _tmp10_; + const gchar* _tmp11_; + gchar* _tmp12_; + gchar* _tmp13_; + char* _tmp14_; + char* _tmp15_; + GVariant* _tmp16_; + GHashTable* _tmp17_; + gchar* _tmp18_; + PlaybinSong* _tmp19_; + gint64 _tmp20_; + gint64 _tmp21_; + GVariant* _tmp22_; + SubsonicClient* _tmp23_; + GHashTable* _tmp33_; + gchar* _tmp34_; + PlaybinSong* _tmp35_; + const gchar* _tmp36_; + const gchar* _tmp37_; + GVariant* _tmp38_; + GHashTable* _tmp39_; + gchar* _tmp40_; + PlaybinSong* _tmp41_; + const gchar* _tmp42_; + const gchar* _tmp43_; + gchar* _tmp44_; + gchar** _tmp45_; + gchar** _tmp46_; + gint _tmp46__length1; + GVariant* _tmp50_; + PlaybinSong* _tmp51_; + const gchar* _tmp52_; + const gchar* _tmp53_; + GHashTable* _tmp60_; + gchar* _tmp61_; + PlaybinSong* _tmp62_; + const gchar* _tmp63_; + const gchar* _tmp64_; + GVariant* _tmp65_; + GHashTable* _tmp66_; + gchar* _tmp67_; + PlaybinSong* _tmp68_; + gint64 _tmp69_; + gint64 _tmp70_; + GVariant* _tmp71_; + GHashTable* _tmp72_; + gchar* _tmp73_; + PlaybinSong* _tmp74_; + gint64 _tmp75_; + gint64 _tmp76_; + GVariant* _tmp77_; + GHashTable* _tmp78_; +#line 127 "../src/mpris.vala" + g_return_if_fail (playbin != NULL); +#line 128 "../src/mpris.vala" + _tmp0_ = playbin_get_play_queue (playbin); +#line 128 "../src/mpris.vala" + _tmp1_ = _tmp0_; +#line 128 "../src/mpris.vala" + _tmp2_ = playbin_get_play_queue_position (playbin); +#line 128 "../src/mpris.vala" + _tmp3_ = _tmp2_; +#line 128 "../src/mpris.vala" + _tmp4_ = g_list_model_get_item (_tmp1_, (guint) _tmp3_); +#line 128 "../src/mpris.vala" + song = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, TYPE_PLAYBIN_SONG, PlaybinSong); +#line 130 "../src/mpris.vala" + _tmp5_ = g_hash_table_new_full (NULL, NULL, _g_free0_, _g_variant_unref0_); +#line 130 "../src/mpris.vala" + metadata = _tmp5_; +#line 131 "../src/mpris.vala" + _tmp6_ = metadata; +#line 131 "../src/mpris.vala" + _tmp7_ = g_strdup ("mpris:trackid"); +#line 131 "../src/mpris.vala" + _tmp8_ = song; +#line 131 "../src/mpris.vala" + _tmp9_ = playbin_song_get_id (_tmp8_); +#line 131 "../src/mpris.vala" + _tmp10_ = _tmp9_; +#line 131 "../src/mpris.vala" + _tmp11_ = string_to_string (_tmp10_); +#line 131 "../src/mpris.vala" + _tmp12_ = g_strconcat ("/eu/callcc/audrey/track/", _tmp11_, NULL); +#line 131 "../src/mpris.vala" + _tmp13_ = _tmp12_; +#line 131 "../src/mpris.vala" + _tmp14_ = g_strdup (_tmp13_); +#line 131 "../src/mpris.vala" + _tmp15_ = _tmp14_; +#line 131 "../src/mpris.vala" + _tmp16_ = _variant_new1 (_tmp15_); +#line 131 "../src/mpris.vala" + g_hash_table_insert (_tmp6_, _tmp7_, _tmp16_); +#line 131 "../src/mpris.vala" + _g_free0 (_tmp15_); +#line 131 "../src/mpris.vala" + _g_free0 (_tmp13_); +#line 132 "../src/mpris.vala" + _tmp17_ = metadata; +#line 132 "../src/mpris.vala" + _tmp18_ = g_strdup ("mpris:length"); +#line 132 "../src/mpris.vala" + _tmp19_ = song; +#line 132 "../src/mpris.vala" + _tmp20_ = playbin_song_get_duration (_tmp19_); +#line 132 "../src/mpris.vala" + _tmp21_ = _tmp20_; +#line 132 "../src/mpris.vala" + _tmp22_ = _variant_new2 (((gint64) _tmp21_) * 1000000); +#line 132 "../src/mpris.vala" + g_hash_table_insert (_tmp17_, _tmp18_, _tmp22_); +#line 133 "../src/mpris.vala" + _tmp23_ = self->priv->_api; +#line 133 "../src/mpris.vala" + if (_tmp23_ != NULL) { +#line 2026 "mpris.c" + GHashTable* _tmp24_; + gchar* _tmp25_; + SubsonicClient* _tmp26_; + PlaybinSong* _tmp27_; + const gchar* _tmp28_; + const gchar* _tmp29_; + gchar* _tmp30_; + gchar* _tmp31_; + GVariant* _tmp32_; +#line 133 "../src/mpris.vala" + _tmp24_ = metadata; +#line 133 "../src/mpris.vala" + _tmp25_ = g_strdup ("mpris:artUrl"); +#line 133 "../src/mpris.vala" + _tmp26_ = self->priv->_api; +#line 133 "../src/mpris.vala" + _tmp27_ = song; +#line 133 "../src/mpris.vala" + _tmp28_ = playbin_song_get_id (_tmp27_); +#line 133 "../src/mpris.vala" + _tmp29_ = _tmp28_; +#line 133 "../src/mpris.vala" + _tmp30_ = subsonic_client_cover_art_uri (_tmp26_, _tmp29_, -1); +#line 133 "../src/mpris.vala" + _tmp31_ = _tmp30_; +#line 133 "../src/mpris.vala" + _tmp32_ = _variant_new3 (_tmp31_); +#line 133 "../src/mpris.vala" + g_hash_table_insert (_tmp24_, _tmp25_, _tmp32_); +#line 133 "../src/mpris.vala" + _g_free0 (_tmp31_); +#line 2058 "mpris.c" + } +#line 134 "../src/mpris.vala" + _tmp33_ = metadata; +#line 134 "../src/mpris.vala" + _tmp34_ = g_strdup ("xesam:album"); +#line 134 "../src/mpris.vala" + _tmp35_ = song; +#line 134 "../src/mpris.vala" + _tmp36_ = playbin_song_get_album (_tmp35_); +#line 134 "../src/mpris.vala" + _tmp37_ = _tmp36_; +#line 134 "../src/mpris.vala" + _tmp38_ = _variant_new4 (_tmp37_); +#line 134 "../src/mpris.vala" + g_hash_table_insert (_tmp33_, _tmp34_, _tmp38_); +#line 135 "../src/mpris.vala" + _tmp39_ = metadata; +#line 135 "../src/mpris.vala" + _tmp40_ = g_strdup ("xesam:artist"); +#line 135 "../src/mpris.vala" + _tmp41_ = song; +#line 135 "../src/mpris.vala" + _tmp42_ = playbin_song_get_artist (_tmp41_); +#line 135 "../src/mpris.vala" + _tmp43_ = _tmp42_; +#line 135 "../src/mpris.vala" + _tmp44_ = g_strdup (_tmp43_); +#line 135 "../src/mpris.vala" + _tmp45_ = g_new0 (gchar*, 1 + 1); +#line 135 "../src/mpris.vala" + _tmp45_[0] = _tmp44_; +#line 135 "../src/mpris.vala" + _tmp46_ = _tmp45_; +#line 135 "../src/mpris.vala" + _tmp46__length1 = 1; +#line 135 "../src/mpris.vala" + _tmp50_ = _variant_new5 (_tmp46_, 1); +#line 135 "../src/mpris.vala" + g_hash_table_insert (_tmp39_, _tmp40_, _tmp50_); +#line 135 "../src/mpris.vala" + _tmp46_ = (_vala_array_free (_tmp46_, _tmp46__length1, (GDestroyNotify) g_free), NULL); +#line 136 "../src/mpris.vala" + _tmp51_ = song; +#line 136 "../src/mpris.vala" + _tmp52_ = playbin_song_get_genre (_tmp51_); +#line 136 "../src/mpris.vala" + _tmp53_ = _tmp52_; +#line 136 "../src/mpris.vala" + if (_tmp53_ != NULL) { +#line 2108 "mpris.c" + GHashTable* _tmp54_; + gchar* _tmp55_; + PlaybinSong* _tmp56_; + const gchar* _tmp57_; + const gchar* _tmp58_; + GVariant* _tmp59_; +#line 136 "../src/mpris.vala" + _tmp54_ = metadata; +#line 136 "../src/mpris.vala" + _tmp55_ = g_strdup ("xesam:genre"); +#line 136 "../src/mpris.vala" + _tmp56_ = song; +#line 136 "../src/mpris.vala" + _tmp57_ = playbin_song_get_genre (_tmp56_); +#line 136 "../src/mpris.vala" + _tmp58_ = _tmp57_; +#line 136 "../src/mpris.vala" + _tmp59_ = _variant_new6 (_tmp58_); +#line 136 "../src/mpris.vala" + g_hash_table_insert (_tmp54_, _tmp55_, _tmp59_); +#line 2129 "mpris.c" + } +#line 137 "../src/mpris.vala" + _tmp60_ = metadata; +#line 137 "../src/mpris.vala" + _tmp61_ = g_strdup ("xesam:title"); +#line 137 "../src/mpris.vala" + _tmp62_ = song; +#line 137 "../src/mpris.vala" + _tmp63_ = playbin_song_get_title (_tmp62_); +#line 137 "../src/mpris.vala" + _tmp64_ = _tmp63_; +#line 137 "../src/mpris.vala" + _tmp65_ = _variant_new7 (_tmp64_); +#line 137 "../src/mpris.vala" + g_hash_table_insert (_tmp60_, _tmp61_, _tmp65_); +#line 138 "../src/mpris.vala" + _tmp66_ = metadata; +#line 138 "../src/mpris.vala" + _tmp67_ = g_strdup ("xesam:trackNumber"); +#line 138 "../src/mpris.vala" + _tmp68_ = song; +#line 138 "../src/mpris.vala" + _tmp69_ = playbin_song_get_track (_tmp68_); +#line 138 "../src/mpris.vala" + _tmp70_ = _tmp69_; +#line 138 "../src/mpris.vala" + _tmp71_ = _variant_new8 (_tmp70_); +#line 138 "../src/mpris.vala" + g_hash_table_insert (_tmp66_, _tmp67_, _tmp71_); +#line 139 "../src/mpris.vala" + _tmp72_ = metadata; +#line 139 "../src/mpris.vala" + _tmp73_ = g_strdup ("xesam:useCount"); +#line 139 "../src/mpris.vala" + _tmp74_ = song; +#line 139 "../src/mpris.vala" + _tmp75_ = playbin_song_get_play_count (_tmp74_); +#line 139 "../src/mpris.vala" + _tmp76_ = _tmp75_; +#line 139 "../src/mpris.vala" + _tmp77_ = _variant_new9 (_tmp76_); +#line 139 "../src/mpris.vala" + g_hash_table_insert (_tmp72_, _tmp73_, _tmp77_); +#line 142 "../src/mpris.vala" + _tmp78_ = metadata; +#line 142 "../src/mpris.vala" + mpris_player_set_metadata (self, _tmp78_); +#line 127 "../src/mpris.vala" + _g_hash_table_unref0 (metadata); +#line 127 "../src/mpris.vala" + _g_object_unref0 (song); +#line 2181 "mpris.c" +} + +static void +___lambda17__playbin_new_track (Playbin* _sender, + gpointer self) +{ +#line 127 "../src/mpris.vala" + __lambda17_ ((MprisPlayer*) self, _sender); +#line 2190 "mpris.c" +} + +static void +__lambda18_ (MprisPlayer* self) +{ + GHashTable* _tmp0_; + GHashTable* _tmp1_; +#line 146 "../src/mpris.vala" + _tmp0_ = g_hash_table_new_full (NULL, NULL, _g_free0_, _g_variant_unref0_); +#line 146 "../src/mpris.vala" + _tmp1_ = _tmp0_; +#line 146 "../src/mpris.vala" + mpris_player_set_metadata (self, _tmp1_); +#line 146 "../src/mpris.vala" + _g_hash_table_unref0 (_tmp1_); +#line 2206 "mpris.c" +} + +static void +___lambda18__playbin_stopped (Playbin* _sender, + gpointer self) +{ +#line 145 "../src/mpris.vala" + __lambda18_ ((MprisPlayer*) self); +#line 2215 "mpris.c" +} + +static void +__lambda19_ (Block2Data* _data2_) +{ + MprisPlayer* self; +#line 149 "../src/mpris.vala" + self = _data2_->self; +#line 149 "../src/mpris.vala" + playbin_go_to_next_track (_data2_->playbin); +#line 2226 "mpris.c" +} + +static void +___lambda19__mpris_player_on_next (MprisPlayer* _sender, + gpointer self) +{ +#line 149 "../src/mpris.vala" + __lambda19_ (self); +#line 2235 "mpris.c" +} + +static void +__lambda20_ (Block2Data* _data2_) +{ + MprisPlayer* self; +#line 150 "../src/mpris.vala" + self = _data2_->self; +#line 150 "../src/mpris.vala" + playbin_go_to_prev_track (_data2_->playbin); +#line 2246 "mpris.c" +} + +static void +___lambda20__mpris_player_on_previous (MprisPlayer* _sender, + gpointer self) +{ +#line 150 "../src/mpris.vala" + __lambda20_ (self); +#line 2255 "mpris.c" +} + +static void +__lambda21_ (Block2Data* _data2_) +{ + MprisPlayer* self; +#line 151 "../src/mpris.vala" + self = _data2_->self; +#line 151 "../src/mpris.vala" + playbin_play (_data2_->playbin); +#line 2266 "mpris.c" +} + +static void +___lambda21__mpris_player_on_play (MprisPlayer* _sender, + gpointer self) +{ +#line 151 "../src/mpris.vala" + __lambda21_ (self); +#line 2275 "mpris.c" +} + +static void +__lambda22_ (Block2Data* _data2_) +{ + MprisPlayer* self; +#line 152 "../src/mpris.vala" + self = _data2_->self; +#line 152 "../src/mpris.vala" + playbin_pause (_data2_->playbin); +#line 2286 "mpris.c" +} + +static void +___lambda22__mpris_player_on_pause (MprisPlayer* _sender, + gpointer self) +{ +#line 152 "../src/mpris.vala" + __lambda22_ (self); +#line 2295 "mpris.c" +} + +static void +__lambda23_ (Block2Data* _data2_) +{ + MprisPlayer* self; + PlaybinState _tmp0_; + PlaybinState _tmp1_; +#line 153 "../src/mpris.vala" + self = _data2_->self; +#line 154 "../src/mpris.vala" + _tmp0_ = playbin_get_state (_data2_->playbin); +#line 154 "../src/mpris.vala" + _tmp1_ = _tmp0_; +#line 154 "../src/mpris.vala" + if (_tmp1_ == PLAYBIN_STATE_PAUSED) { +#line 154 "../src/mpris.vala" + playbin_play (_data2_->playbin); +#line 2314 "mpris.c" + } else { + PlaybinState _tmp2_; + PlaybinState _tmp3_; +#line 155 "../src/mpris.vala" + _tmp2_ = playbin_get_state (_data2_->playbin); +#line 155 "../src/mpris.vala" + _tmp3_ = _tmp2_; +#line 155 "../src/mpris.vala" + if (_tmp3_ == PLAYBIN_STATE_PLAYING) { +#line 155 "../src/mpris.vala" + playbin_pause (_data2_->playbin); +#line 2326 "mpris.c" + } + } +} + +static void +___lambda23__mpris_player_on_play_pause (MprisPlayer* _sender, + gpointer self) +{ +#line 153 "../src/mpris.vala" + __lambda23_ (self); +#line 2337 "mpris.c" +} + +static void +__lambda24_ (Block2Data* _data2_) +{ + MprisPlayer* self; +#line 157 "../src/mpris.vala" + self = _data2_->self; +#line 158 "../src/mpris.vala" + playbin_stop (_data2_->playbin); +#line 2348 "mpris.c" +} + +static void +___lambda24__mpris_player_on_stop (MprisPlayer* _sender, + gpointer self) +{ +#line 157 "../src/mpris.vala" + __lambda24_ (self); +#line 2357 "mpris.c" +} + +static GVariant* +_variant_new10 (gchar* value) +{ +#line 174 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_string (value)); +#line 2365 "mpris.c" +} + +static GVariant* +_variant_new11 (gchar* value) +{ +#line 178 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_string (value)); +#line 2373 "mpris.c" +} + +static GVariant* +_variant_new12 (gdouble value) +{ +#line 182 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_double (value)); +#line 2381 "mpris.c" +} + +static GVariant* +_variant_new13 (gboolean value) +{ +#line 186 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_boolean (value)); +#line 2389 "mpris.c" +} + +static GVariant* +_variant_new14 (GHashTable* value) +{ + GVariantBuilder _tmp30_; + GHashTableIter _tmp31_; + gpointer _tmp32_; + gpointer _tmp33_; +#line 190 "../src/mpris.vala" + g_hash_table_iter_init (&_tmp31_, value); +#line 190 "../src/mpris.vala" + g_variant_builder_init (&_tmp30_, G_VARIANT_TYPE ("a{sv}")); +#line 190 "../src/mpris.vala" + while (g_hash_table_iter_next (&_tmp31_, &_tmp32_, &_tmp33_)) { +#line 2405 "mpris.c" + gchar* _key; + GVariant* _value; +#line 190 "../src/mpris.vala" + _key = (gchar*) _tmp32_; +#line 190 "../src/mpris.vala" + _value = (GVariant*) _tmp33_; +#line 190 "../src/mpris.vala" + g_variant_builder_add (&_tmp30_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value)); +#line 2414 "mpris.c" + } +#line 190 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_builder_end (&_tmp30_)); +#line 2418 "mpris.c" +} + +static GVariant* +_variant_new15 (gdouble value) +{ +#line 194 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_double (value)); +#line 2426 "mpris.c" +} + +static GVariant* +_variant_new16 (gdouble value) +{ +#line 198 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_double (value)); +#line 2434 "mpris.c" +} + +static GVariant* +_variant_new17 (gdouble value) +{ +#line 202 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_double (value)); +#line 2442 "mpris.c" +} + +static GVariant* +_variant_new18 (gboolean value) +{ +#line 206 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_boolean (value)); +#line 2450 "mpris.c" +} + +static GVariant* +_variant_new19 (gboolean value) +{ +#line 210 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_boolean (value)); +#line 2458 "mpris.c" +} + +static GVariant* +_variant_new20 (gboolean value) +{ +#line 214 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_boolean (value)); +#line 2466 "mpris.c" +} + +static GVariant* +_variant_new21 (gboolean value) +{ +#line 218 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_boolean (value)); +#line 2474 "mpris.c" +} + +static GVariant* +_variant_new22 (gboolean value) +{ +#line 222 "../src/mpris.vala" + return g_variant_ref_sink (g_variant_new_boolean (value)); +#line 2482 "mpris.c" +} + +static void +__lambda25_ (Block2Data* _data2_, + GParamSpec* p) +{ + MprisPlayer* self; + GVariantBuilder* builder = NULL; + const GVariantType* _tmp0_; + GVariantBuilder* _tmp1_; + GVariantBuilder* invalid_builder = NULL; + GVariantType* _tmp2_; + GVariantType* _tmp3_; + GVariantBuilder* _tmp4_; + GVariantBuilder* _tmp5_; + gchar* dbus_name = NULL; + GVariant* dbus_value = NULL; + const gchar* _tmp6_; + const gchar* _tmp7_; + GQuark _tmp9_ = 0U; +#line 171 "../src/mpris.vala" + static GQuark _tmp8_label0 = 0; +#line 171 "../src/mpris.vala" + static GQuark _tmp8_label1 = 0; +#line 171 "../src/mpris.vala" + static GQuark _tmp8_label2 = 0; +#line 171 "../src/mpris.vala" + static GQuark _tmp8_label3 = 0; +#line 171 "../src/mpris.vala" + static GQuark _tmp8_label4 = 0; +#line 171 "../src/mpris.vala" + static GQuark _tmp8_label5 = 0; +#line 171 "../src/mpris.vala" + static GQuark _tmp8_label6 = 0; +#line 171 "../src/mpris.vala" + static GQuark _tmp8_label7 = 0; +#line 171 "../src/mpris.vala" + static GQuark _tmp8_label8 = 0; +#line 171 "../src/mpris.vala" + static GQuark _tmp8_label9 = 0; +#line 171 "../src/mpris.vala" + static GQuark _tmp8_label10 = 0; +#line 171 "../src/mpris.vala" + static GQuark _tmp8_label11 = 0; +#line 171 "../src/mpris.vala" + static GQuark _tmp8_label12 = 0; +#line 171 "../src/mpris.vala" + static GQuark _tmp8_label13 = 0; +#line 2531 "mpris.c" + GVariantBuilder* _tmp65_; + const gchar* _tmp66_; + GVariant* _tmp67_; + GError* _inner_error0_ = NULL; +#line 164 "../src/mpris.vala" + self = _data2_->self; +#line 164 "../src/mpris.vala" + g_return_if_fail (p != NULL); +#line 165 "../src/mpris.vala" + _tmp0_ = G_VARIANT_TYPE_ARRAY; +#line 165 "../src/mpris.vala" + _tmp1_ = g_variant_builder_new (_tmp0_); +#line 165 "../src/mpris.vala" + builder = _tmp1_; +#line 166 "../src/mpris.vala" + _tmp2_ = g_variant_type_new ("as"); +#line 166 "../src/mpris.vala" + _tmp3_ = _tmp2_; +#line 166 "../src/mpris.vala" + _tmp4_ = g_variant_builder_new (_tmp3_); +#line 166 "../src/mpris.vala" + _tmp5_ = _tmp4_; +#line 166 "../src/mpris.vala" + _g_variant_type_free0 (_tmp3_); +#line 166 "../src/mpris.vala" + invalid_builder = _tmp5_; +#line 171 "../src/mpris.vala" + _tmp6_ = p->name; +#line 171 "../src/mpris.vala" + _tmp7_ = _tmp6_; +#line 171 "../src/mpris.vala" + _tmp9_ = (NULL == _tmp7_) ? 0 : g_quark_from_string (_tmp7_); +#line 171 "../src/mpris.vala" + if (_tmp9_ == ((0 != _tmp8_label0) ? _tmp8_label0 : (_tmp8_label0 = g_quark_from_static_string ("playback-status")))) { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2568 "mpris.c" + default: + { + gchar* _tmp10_; + gchar* _tmp11_; + gchar* _tmp12_; + gchar* _tmp13_; + GVariant* _tmp14_; +#line 173 "../src/mpris.vala" + _tmp10_ = g_strdup ("PlaybackStatus"); +#line 173 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 173 "../src/mpris.vala" + dbus_name = _tmp10_; +#line 174 "../src/mpris.vala" + _tmp11_ = mpris_player_get_playback_status (self); +#line 174 "../src/mpris.vala" + _tmp12_ = _tmp11_; +#line 174 "../src/mpris.vala" + _tmp13_ = _tmp12_; +#line 174 "../src/mpris.vala" + _tmp14_ = _variant_new10 (_tmp13_); +#line 174 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 174 "../src/mpris.vala" + dbus_value = _tmp14_; +#line 174 "../src/mpris.vala" + _g_free0 (_tmp13_); +#line 175 "../src/mpris.vala" + break; +#line 2598 "mpris.c" + } + } + } else if (_tmp9_ == ((0 != _tmp8_label1) ? _tmp8_label1 : (_tmp8_label1 = g_quark_from_static_string ("loop-status")))) { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2604 "mpris.c" + default: + { + gchar* _tmp15_; + gchar* _tmp16_; + gchar* _tmp17_; + gchar* _tmp18_; + GVariant* _tmp19_; +#line 177 "../src/mpris.vala" + _tmp15_ = g_strdup ("LoopStatus"); +#line 177 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 177 "../src/mpris.vala" + dbus_name = _tmp15_; +#line 178 "../src/mpris.vala" + _tmp16_ = mpris_player_get_loop_status (self); +#line 178 "../src/mpris.vala" + _tmp17_ = _tmp16_; +#line 178 "../src/mpris.vala" + _tmp18_ = _tmp17_; +#line 178 "../src/mpris.vala" + _tmp19_ = _variant_new11 (_tmp18_); +#line 178 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 178 "../src/mpris.vala" + dbus_value = _tmp19_; +#line 178 "../src/mpris.vala" + _g_free0 (_tmp18_); +#line 179 "../src/mpris.vala" + break; +#line 2634 "mpris.c" + } + } + } else if (_tmp9_ == ((0 != _tmp8_label2) ? _tmp8_label2 : (_tmp8_label2 = g_quark_from_static_string ("rate")))) { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2640 "mpris.c" + default: + { + gchar* _tmp20_; + gdouble _tmp21_; + GVariant* _tmp22_; +#line 181 "../src/mpris.vala" + _tmp20_ = g_strdup ("Rate"); +#line 181 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 181 "../src/mpris.vala" + dbus_name = _tmp20_; +#line 182 "../src/mpris.vala" + _tmp21_ = self->priv->_rate; +#line 182 "../src/mpris.vala" + _tmp22_ = _variant_new12 (_tmp21_); +#line 182 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 182 "../src/mpris.vala" + dbus_value = _tmp22_; +#line 183 "../src/mpris.vala" + break; +#line 2662 "mpris.c" + } + } + } else if (_tmp9_ == ((0 != _tmp8_label3) ? _tmp8_label3 : (_tmp8_label3 = g_quark_from_static_string ("shuffle")))) { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2668 "mpris.c" + default: + { + gchar* _tmp23_; + gboolean _tmp24_; + GVariant* _tmp25_; +#line 185 "../src/mpris.vala" + _tmp23_ = g_strdup ("Shuffle"); +#line 185 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 185 "../src/mpris.vala" + dbus_name = _tmp23_; +#line 186 "../src/mpris.vala" + _tmp24_ = self->priv->_shuffle; +#line 186 "../src/mpris.vala" + _tmp25_ = _variant_new13 (_tmp24_); +#line 186 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 186 "../src/mpris.vala" + dbus_value = _tmp25_; +#line 187 "../src/mpris.vala" + break; +#line 2690 "mpris.c" + } + } + } else if (_tmp9_ == ((0 != _tmp8_label4) ? _tmp8_label4 : (_tmp8_label4 = g_quark_from_static_string ("metadata")))) { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2696 "mpris.c" + default: + { + gchar* _tmp26_; + GHashTable* _tmp27_; + GHashTable* _tmp28_; + GHashTable* _tmp29_; + GVariant* _tmp34_; +#line 189 "../src/mpris.vala" + _tmp26_ = g_strdup ("Metadata"); +#line 189 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 189 "../src/mpris.vala" + dbus_name = _tmp26_; +#line 190 "../src/mpris.vala" + _tmp27_ = mpris_player_get_metadata (self); +#line 190 "../src/mpris.vala" + _tmp28_ = _tmp27_; +#line 190 "../src/mpris.vala" + _tmp29_ = _tmp28_; +#line 190 "../src/mpris.vala" + _tmp34_ = _variant_new14 (_tmp29_); +#line 190 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 190 "../src/mpris.vala" + dbus_value = _tmp34_; +#line 190 "../src/mpris.vala" + _g_hash_table_unref0 (_tmp29_); +#line 191 "../src/mpris.vala" + break; +#line 2726 "mpris.c" + } + } + } else if (_tmp9_ == ((0 != _tmp8_label5) ? _tmp8_label5 : (_tmp8_label5 = g_quark_from_static_string ("volume")))) { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2732 "mpris.c" + default: + { + gchar* _tmp35_; + gdouble _tmp36_; + GVariant* _tmp37_; +#line 193 "../src/mpris.vala" + _tmp35_ = g_strdup ("Volume"); +#line 193 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 193 "../src/mpris.vala" + dbus_name = _tmp35_; +#line 194 "../src/mpris.vala" + _tmp36_ = self->priv->_volume; +#line 194 "../src/mpris.vala" + _tmp37_ = _variant_new15 (_tmp36_); +#line 194 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 194 "../src/mpris.vala" + dbus_value = _tmp37_; +#line 195 "../src/mpris.vala" + break; +#line 2754 "mpris.c" + } + } + } else if (_tmp9_ == ((0 != _tmp8_label6) ? _tmp8_label6 : (_tmp8_label6 = g_quark_from_static_string ("minimum-rate")))) { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2760 "mpris.c" + default: + { + gchar* _tmp38_; + gdouble _tmp39_; + gdouble _tmp40_; + GVariant* _tmp41_; +#line 197 "../src/mpris.vala" + _tmp38_ = g_strdup ("MinimumRate"); +#line 197 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 197 "../src/mpris.vala" + dbus_name = _tmp38_; +#line 198 "../src/mpris.vala" + _tmp39_ = mpris_player_get_minimum_rate (self); +#line 198 "../src/mpris.vala" + _tmp40_ = _tmp39_; +#line 198 "../src/mpris.vala" + _tmp41_ = _variant_new16 (_tmp40_); +#line 198 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 198 "../src/mpris.vala" + dbus_value = _tmp41_; +#line 199 "../src/mpris.vala" + break; +#line 2785 "mpris.c" + } + } + } else if (_tmp9_ == ((0 != _tmp8_label7) ? _tmp8_label7 : (_tmp8_label7 = g_quark_from_static_string ("maximum-rate")))) { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2791 "mpris.c" + default: + { + gchar* _tmp42_; + gdouble _tmp43_; + gdouble _tmp44_; + GVariant* _tmp45_; +#line 201 "../src/mpris.vala" + _tmp42_ = g_strdup ("MaximumRate"); +#line 201 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 201 "../src/mpris.vala" + dbus_name = _tmp42_; +#line 202 "../src/mpris.vala" + _tmp43_ = mpris_player_get_maximum_rate (self); +#line 202 "../src/mpris.vala" + _tmp44_ = _tmp43_; +#line 202 "../src/mpris.vala" + _tmp45_ = _variant_new17 (_tmp44_); +#line 202 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 202 "../src/mpris.vala" + dbus_value = _tmp45_; +#line 203 "../src/mpris.vala" + break; +#line 2816 "mpris.c" + } + } + } else if (_tmp9_ == ((0 != _tmp8_label8) ? _tmp8_label8 : (_tmp8_label8 = g_quark_from_static_string ("can-go-next")))) { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2822 "mpris.c" + default: + { + gchar* _tmp46_; + gboolean _tmp47_; + GVariant* _tmp48_; +#line 205 "../src/mpris.vala" + _tmp46_ = g_strdup ("CanGoNext"); +#line 205 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 205 "../src/mpris.vala" + dbus_name = _tmp46_; +#line 206 "../src/mpris.vala" + _tmp47_ = self->priv->_can_go_next; +#line 206 "../src/mpris.vala" + _tmp48_ = _variant_new18 (_tmp47_); +#line 206 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 206 "../src/mpris.vala" + dbus_value = _tmp48_; +#line 207 "../src/mpris.vala" + break; +#line 2844 "mpris.c" + } + } + } else if (_tmp9_ == ((0 != _tmp8_label9) ? _tmp8_label9 : (_tmp8_label9 = g_quark_from_static_string ("can-go-previous")))) { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2850 "mpris.c" + default: + { + gchar* _tmp49_; + gboolean _tmp50_; + GVariant* _tmp51_; +#line 209 "../src/mpris.vala" + _tmp49_ = g_strdup ("CanGoPrevious"); +#line 209 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 209 "../src/mpris.vala" + dbus_name = _tmp49_; +#line 210 "../src/mpris.vala" + _tmp50_ = self->priv->_can_go_previous; +#line 210 "../src/mpris.vala" + _tmp51_ = _variant_new19 (_tmp50_); +#line 210 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 210 "../src/mpris.vala" + dbus_value = _tmp51_; +#line 211 "../src/mpris.vala" + break; +#line 2872 "mpris.c" + } + } + } else if (_tmp9_ == ((0 != _tmp8_label10) ? _tmp8_label10 : (_tmp8_label10 = g_quark_from_static_string ("can-play")))) { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2878 "mpris.c" + default: + { + gchar* _tmp52_; + gboolean _tmp53_; + GVariant* _tmp54_; +#line 213 "../src/mpris.vala" + _tmp52_ = g_strdup ("CanPlay"); +#line 213 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 213 "../src/mpris.vala" + dbus_name = _tmp52_; +#line 214 "../src/mpris.vala" + _tmp53_ = self->priv->_can_play; +#line 214 "../src/mpris.vala" + _tmp54_ = _variant_new20 (_tmp53_); +#line 214 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 214 "../src/mpris.vala" + dbus_value = _tmp54_; +#line 215 "../src/mpris.vala" + break; +#line 2900 "mpris.c" + } + } + } else if (_tmp9_ == ((0 != _tmp8_label11) ? _tmp8_label11 : (_tmp8_label11 = g_quark_from_static_string ("can-pause")))) { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2906 "mpris.c" + default: + { + gchar* _tmp55_; + gboolean _tmp56_; + GVariant* _tmp57_; +#line 217 "../src/mpris.vala" + _tmp55_ = g_strdup ("CanPause"); +#line 217 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 217 "../src/mpris.vala" + dbus_name = _tmp55_; +#line 218 "../src/mpris.vala" + _tmp56_ = self->priv->_can_pause; +#line 218 "../src/mpris.vala" + _tmp57_ = _variant_new21 (_tmp56_); +#line 218 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 218 "../src/mpris.vala" + dbus_value = _tmp57_; +#line 219 "../src/mpris.vala" + break; +#line 2928 "mpris.c" + } + } + } else if (_tmp9_ == ((0 != _tmp8_label12) ? _tmp8_label12 : (_tmp8_label12 = g_quark_from_static_string ("can-seek")))) { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2934 "mpris.c" + default: + { + gchar* _tmp58_; + gboolean _tmp59_; + GVariant* _tmp60_; +#line 221 "../src/mpris.vala" + _tmp58_ = g_strdup ("CanSeek"); +#line 221 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 221 "../src/mpris.vala" + dbus_name = _tmp58_; +#line 222 "../src/mpris.vala" + _tmp59_ = self->priv->_can_seek; +#line 222 "../src/mpris.vala" + _tmp60_ = _variant_new22 (_tmp59_); +#line 222 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 222 "../src/mpris.vala" + dbus_value = _tmp60_; +#line 223 "../src/mpris.vala" + break; +#line 2956 "mpris.c" + } + } + } else if (_tmp9_ == ((0 != _tmp8_label13) ? _tmp8_label13 : (_tmp8_label13 = g_quark_from_static_string ("api")))) { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2962 "mpris.c" + default: + { +#line 226 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 226 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 226 "../src/mpris.vala" + _g_variant_builder_unref0 (invalid_builder); +#line 226 "../src/mpris.vala" + _g_variant_builder_unref0 (builder); +#line 226 "../src/mpris.vala" + return; +#line 2975 "mpris.c" + } + } + } else { +#line 171 "../src/mpris.vala" + switch (0) { +#line 2981 "mpris.c" + default: + { + const gchar* _tmp61_; + const gchar* _tmp62_; + gchar* _tmp63_; + gchar* _tmp64_; +#line 228 "../src/mpris.vala" + _tmp61_ = p->name; +#line 228 "../src/mpris.vala" + _tmp62_ = string_to_string (_tmp61_); +#line 228 "../src/mpris.vala" + _tmp63_ = g_strconcat ("unknown mpris player property ", _tmp62_, NULL); +#line 228 "../src/mpris.vala" + _tmp64_ = _tmp63_; +#line 228 "../src/mpris.vala" + g_warning ("mpris.vala:228: %s", _tmp64_); +#line 228 "../src/mpris.vala" + _g_free0 (_tmp64_); +#line 229 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 229 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 229 "../src/mpris.vala" + _g_variant_builder_unref0 (invalid_builder); +#line 229 "../src/mpris.vala" + _g_variant_builder_unref0 (builder); +#line 229 "../src/mpris.vala" + return; +#line 3010 "mpris.c" + } + } + } +#line 232 "../src/mpris.vala" + _tmp65_ = builder; +#line 232 "../src/mpris.vala" + _tmp66_ = dbus_name; +#line 232 "../src/mpris.vala" + _tmp67_ = dbus_value; +#line 232 "../src/mpris.vala" + g_variant_builder_add (_tmp65_, "{sv}", _tmp66_, _tmp67_, NULL); +#line 3022 "mpris.c" + { + GVariantBuilder* _tmp68_; + GVariantBuilder* _tmp69_; + GVariant* _tmp70_; + GVariant* _tmp71_; +#line 235 "../src/mpris.vala" + _tmp68_ = builder; +#line 235 "../src/mpris.vala" + _tmp69_ = invalid_builder; +#line 235 "../src/mpris.vala" + _tmp70_ = g_variant_new ("(sa{sv}as)", "org.mpris.MediaPlayer2.Player", _tmp68_, _tmp69_, NULL); +#line 235 "../src/mpris.vala" + g_variant_ref_sink (_tmp70_); +#line 235 "../src/mpris.vala" + _tmp71_ = _tmp70_; +#line 235 "../src/mpris.vala" + g_dbus_connection_emit_signal (_data2_->conn, NULL, "/org/mpris/MediaPlayer2", "org.freedesktop.DBus.Properties", "PropertiesChanged", _tmp71_, &_inner_error0_); +#line 235 "../src/mpris.vala" + _g_variant_unref0 (_tmp71_); +#line 235 "../src/mpris.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 3044 "mpris.c" + goto __catch0_g_error; + } + } + goto __finally0; + __catch0_g_error: + { + GError* e = NULL; + const gchar* _tmp72_; + const gchar* _tmp73_; + gchar* _tmp74_; + gchar* _tmp75_; +#line 234 "../src/mpris.vala" + e = _inner_error0_; +#line 234 "../src/mpris.vala" + _inner_error0_ = NULL; +#line 246 "../src/mpris.vala" + _tmp72_ = e->message; +#line 246 "../src/mpris.vala" + _tmp73_ = string_to_string (_tmp72_); +#line 246 "../src/mpris.vala" + _tmp74_ = g_strconcat ("could not notify of mpris property changes: ", _tmp73_, NULL); +#line 246 "../src/mpris.vala" + _tmp75_ = _tmp74_; +#line 246 "../src/mpris.vala" + g_error ("mpris.vala:246: %s", _tmp75_); +#line 246 "../src/mpris.vala" + _g_free0 (_tmp75_); +#line 234 "../src/mpris.vala" + _g_error_free0 (e); +#line 3074 "mpris.c" + } + __finally0: +#line 234 "../src/mpris.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 234 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 234 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 234 "../src/mpris.vala" + _g_variant_builder_unref0 (invalid_builder); +#line 234 "../src/mpris.vala" + _g_variant_builder_unref0 (builder); +#line 234 "../src/mpris.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); +#line 234 "../src/mpris.vala" + g_clear_error (&_inner_error0_); +#line 234 "../src/mpris.vala" + return; +#line 3093 "mpris.c" + } +#line 164 "../src/mpris.vala" + _g_variant_unref0 (dbus_value); +#line 164 "../src/mpris.vala" + _g_free0 (dbus_name); +#line 164 "../src/mpris.vala" + _g_variant_builder_unref0 (invalid_builder); +#line 164 "../src/mpris.vala" + _g_variant_builder_unref0 (builder); +#line 3103 "mpris.c" +} + +static void +___lambda25__g_object_notify (GObject* _sender, + GParamSpec* pspec, + gpointer self) +{ +#line 164 "../src/mpris.vala" + __lambda25_ (self, pspec); +#line 3113 "mpris.c" +} + +MprisPlayer* +mpris_player_construct (GType object_type, + GDBusConnection* conn, + Playbin* playbin) +{ + MprisPlayer * self = NULL; + Block2Data* _data2_; + GDBusConnection* _tmp0_; + Playbin* _tmp1_; +#line 77 "../src/mpris.vala" + g_return_val_if_fail (conn != NULL, NULL); +#line 77 "../src/mpris.vala" + g_return_val_if_fail (playbin != NULL, NULL); +#line 77 "../src/mpris.vala" + _data2_ = g_slice_new0 (Block2Data); +#line 77 "../src/mpris.vala" + _data2_->_ref_count_ = 1; +#line 77 "../src/mpris.vala" + _tmp0_ = _g_object_ref0 (conn); +#line 77 "../src/mpris.vala" + _g_object_unref0 (_data2_->conn); +#line 77 "../src/mpris.vala" + _data2_->conn = _tmp0_; +#line 77 "../src/mpris.vala" + _tmp1_ = _g_object_ref0 (playbin); +#line 77 "../src/mpris.vala" + _g_object_unref0 (_data2_->playbin); +#line 77 "../src/mpris.vala" + _data2_->playbin = _tmp1_; +#line 77 "../src/mpris.vala" + self = (MprisPlayer*) g_object_new (object_type, NULL); +#line 77 "../src/mpris.vala" + _data2_->self = g_object_ref (self); +#line 78 "../src/mpris.vala" + g_object_bind_property_with_closures ((GObject*) _data2_->playbin, "state", (GObject*) self, "playback_status", G_BINDING_DEFAULT, (GClosure*) ((___lambda14__gbinding_transform_func == NULL) ? NULL : g_cclosure_new ((GCallback) ___lambda14__gbinding_transform_func, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL))); +#line 113 "../src/mpris.vala" + g_object_bind_property_with_closures ((GObject*) _data2_->playbin, "volume", (GObject*) self, "volume", G_BINDING_BIDIRECTIONAL, (GClosure*) ((___lambda15__gbinding_transform_func == NULL) ? NULL : g_cclosure_new ((GCallback) ___lambda15__gbinding_transform_func, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((___lambda16__gbinding_transform_func == NULL) ? NULL : g_cclosure_new ((GCallback) ___lambda16__gbinding_transform_func, g_object_ref (self), (GClosureNotify) g_object_unref))); +#line 127 "../src/mpris.vala" + g_signal_connect_object (_data2_->playbin, "new-track", (GCallback) ___lambda17__playbin_new_track, self, 0); +#line 145 "../src/mpris.vala" + g_signal_connect_object (_data2_->playbin, "stopped", (GCallback) ___lambda18__playbin_stopped, self, 0); +#line 149 "../src/mpris.vala" + g_signal_connect_data (self, "on-next", (GCallback) ___lambda19__mpris_player_on_next, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); +#line 150 "../src/mpris.vala" + g_signal_connect_data (self, "on-previous", (GCallback) ___lambda20__mpris_player_on_previous, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); +#line 151 "../src/mpris.vala" + g_signal_connect_data (self, "on-play", (GCallback) ___lambda21__mpris_player_on_play, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); +#line 152 "../src/mpris.vala" + g_signal_connect_data (self, "on-pause", (GCallback) ___lambda22__mpris_player_on_pause, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); +#line 153 "../src/mpris.vala" + g_signal_connect_data (self, "on-play-pause", (GCallback) ___lambda23__mpris_player_on_play_pause, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); +#line 157 "../src/mpris.vala" + g_signal_connect_data (self, "on-stop", (GCallback) ___lambda24__mpris_player_on_stop, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); +#line 164 "../src/mpris.vala" + g_signal_connect_data ((GObject*) self, "notify", (GCallback) ___lambda25__g_object_notify, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); +#line 77 "../src/mpris.vala" + block2_data_unref (_data2_); +#line 77 "../src/mpris.vala" + _data2_ = NULL; +#line 77 "../src/mpris.vala" + return self; +#line 3177 "mpris.c" +} + +MprisPlayer* +mpris_player_new (GDBusConnection* conn, + Playbin* playbin) +{ +#line 77 "../src/mpris.vala" + return mpris_player_construct (TYPE_MPRIS_PLAYER, conn, playbin); +#line 3186 "mpris.c" +} + +gchar* +mpris_player_get_playback_status (MprisPlayer* self) +{ + gchar* result; + const gchar* _tmp0_; + gchar* _tmp1_; +#line 57 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 57 "../src/mpris.vala" + _tmp0_ = self->priv->_playback_status; +#line 57 "../src/mpris.vala" + _tmp1_ = g_strdup (_tmp0_); +#line 57 "../src/mpris.vala" + result = _tmp1_; +#line 57 "../src/mpris.vala" + return result; +#line 3205 "mpris.c" +} + +void +mpris_player_set_playback_status (MprisPlayer* self, + const gchar* value) +{ + gchar* old_value; +#line 57 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 57 "../src/mpris.vala" + old_value = mpris_player_get_playback_status (self); +#line 57 "../src/mpris.vala" + if (g_strcmp0 (value, old_value) != 0) { +#line 3219 "mpris.c" + gchar* _tmp0_; +#line 57 "../src/mpris.vala" + _tmp0_ = g_strdup (value); +#line 57 "../src/mpris.vala" + _g_free0 (self->priv->_playback_status); +#line 57 "../src/mpris.vala" + self->priv->_playback_status = _tmp0_; +#line 57 "../src/mpris.vala" + g_object_notify_by_pspec ((GObject *) self, mpris_player_properties[MPRIS_PLAYER_PLAYBACK_STATUS_PROPERTY]); +#line 3229 "mpris.c" + } +#line 57 "../src/mpris.vala" + _g_free0 (old_value); +#line 3233 "mpris.c" +} + +gchar* +mpris_player_get_loop_status (MprisPlayer* self) +{ + gchar* result; + const gchar* _tmp0_; + gchar* _tmp1_; +#line 58 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 58 "../src/mpris.vala" + _tmp0_ = self->priv->_loop_status; +#line 58 "../src/mpris.vala" + _tmp1_ = g_strdup (_tmp0_); +#line 58 "../src/mpris.vala" + result = _tmp1_; +#line 58 "../src/mpris.vala" + return result; +#line 3252 "mpris.c" +} + +gdouble +mpris_player_get_rate (MprisPlayer* self) +{ + gdouble result; +#line 59 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, 0.0); +#line 59 "../src/mpris.vala" + result = self->priv->_rate; +#line 59 "../src/mpris.vala" + return result; +#line 3265 "mpris.c" +} + +gboolean +mpris_player_get_shuffle (MprisPlayer* self) +{ + gboolean result; +#line 60 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 60 "../src/mpris.vala" + result = self->priv->_shuffle; +#line 60 "../src/mpris.vala" + return result; +#line 3278 "mpris.c" +} + +static gpointer +_g_hash_table_ref0 (gpointer self) +{ +#line 61 "../src/mpris.vala" + return self ? g_hash_table_ref (self) : NULL; +#line 3286 "mpris.c" +} + +GHashTable* +mpris_player_get_metadata (MprisPlayer* self) +{ + GHashTable* result; + GHashTable* _tmp0_; + GHashTable* _tmp1_; +#line 61 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 61 "../src/mpris.vala" + _tmp0_ = self->priv->_metadata; +#line 61 "../src/mpris.vala" + _tmp1_ = _g_hash_table_ref0 (_tmp0_); +#line 61 "../src/mpris.vala" + result = _tmp1_; +#line 61 "../src/mpris.vala" + return result; +#line 3305 "mpris.c" +} + +static void +mpris_player_set_metadata (MprisPlayer* self, + GHashTable* value) +{ + GHashTable* old_value; +#line 61 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 61 "../src/mpris.vala" + old_value = mpris_player_get_metadata (self); +#line 61 "../src/mpris.vala" + if (old_value != value) { +#line 3319 "mpris.c" + GHashTable* _tmp0_; +#line 61 "../src/mpris.vala" + _tmp0_ = _g_hash_table_ref0 (value); +#line 61 "../src/mpris.vala" + _g_hash_table_unref0 (self->priv->_metadata); +#line 61 "../src/mpris.vala" + self->priv->_metadata = _tmp0_; +#line 61 "../src/mpris.vala" + g_object_notify_by_pspec ((GObject *) self, mpris_player_properties[MPRIS_PLAYER_METADATA_PROPERTY]); +#line 3329 "mpris.c" + } +#line 61 "../src/mpris.vala" + _g_hash_table_unref0 (old_value); +#line 3333 "mpris.c" +} + +gdouble +mpris_player_get_volume (MprisPlayer* self) +{ + gdouble result; +#line 62 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, 0.0); +#line 62 "../src/mpris.vala" + result = self->priv->_volume; +#line 62 "../src/mpris.vala" + return result; +#line 3346 "mpris.c" +} + +void +mpris_player_set_volume (MprisPlayer* self, + gdouble value) +{ + gdouble old_value; +#line 62 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 62 "../src/mpris.vala" + old_value = mpris_player_get_volume (self); +#line 62 "../src/mpris.vala" + if (old_value != value) { +#line 62 "../src/mpris.vala" + self->priv->_volume = value; +#line 62 "../src/mpris.vala" + g_object_notify_by_pspec ((GObject *) self, mpris_player_properties[MPRIS_PLAYER_VOLUME_PROPERTY]); +#line 3364 "mpris.c" + } +} + +gint64 +mpris_player_get_position (MprisPlayer* self) +{ + gint64 result; +#line 64 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, 0LL); +#line 64 "../src/mpris.vala" + result = self->priv->_position; +#line 64 "../src/mpris.vala" + return result; +#line 3378 "mpris.c" +} + +gdouble +mpris_player_get_minimum_rate (MprisPlayer* self) +{ + gdouble result; +#line 65 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, 0.0); +#line 65 "../src/mpris.vala" + result = 1.0; +#line 65 "../src/mpris.vala" + return result; +#line 3391 "mpris.c" +} + +gdouble +mpris_player_get_maximum_rate (MprisPlayer* self) +{ + gdouble result; +#line 66 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, 0.0); +#line 66 "../src/mpris.vala" + result = 1.0; +#line 66 "../src/mpris.vala" + return result; +#line 3404 "mpris.c" +} + +gboolean +mpris_player_get_can_go_next (MprisPlayer* self) +{ + gboolean result; +#line 67 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 67 "../src/mpris.vala" + result = self->priv->_can_go_next; +#line 67 "../src/mpris.vala" + return result; +#line 3417 "mpris.c" +} + +static void +mpris_player_set_can_go_next (MprisPlayer* self, + gboolean value) +{ + gboolean old_value; +#line 67 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 67 "../src/mpris.vala" + old_value = mpris_player_get_can_go_next (self); +#line 67 "../src/mpris.vala" + if (old_value != value) { +#line 67 "../src/mpris.vala" + self->priv->_can_go_next = value; +#line 67 "../src/mpris.vala" + g_object_notify_by_pspec ((GObject *) self, mpris_player_properties[MPRIS_PLAYER_CAN_GO_NEXT_PROPERTY]); +#line 3435 "mpris.c" + } +} + +gboolean +mpris_player_get_can_go_previous (MprisPlayer* self) +{ + gboolean result; +#line 68 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 68 "../src/mpris.vala" + result = self->priv->_can_go_previous; +#line 68 "../src/mpris.vala" + return result; +#line 3449 "mpris.c" +} + +static void +mpris_player_set_can_go_previous (MprisPlayer* self, + gboolean value) +{ + gboolean old_value; +#line 68 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 68 "../src/mpris.vala" + old_value = mpris_player_get_can_go_previous (self); +#line 68 "../src/mpris.vala" + if (old_value != value) { +#line 68 "../src/mpris.vala" + self->priv->_can_go_previous = value; +#line 68 "../src/mpris.vala" + g_object_notify_by_pspec ((GObject *) self, mpris_player_properties[MPRIS_PLAYER_CAN_GO_PREVIOUS_PROPERTY]); +#line 3467 "mpris.c" + } +} + +gboolean +mpris_player_get_can_play (MprisPlayer* self) +{ + gboolean result; +#line 69 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 69 "../src/mpris.vala" + result = self->priv->_can_play; +#line 69 "../src/mpris.vala" + return result; +#line 3481 "mpris.c" +} + +static void +mpris_player_set_can_play (MprisPlayer* self, + gboolean value) +{ + gboolean old_value; +#line 69 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 69 "../src/mpris.vala" + old_value = mpris_player_get_can_play (self); +#line 69 "../src/mpris.vala" + if (old_value != value) { +#line 69 "../src/mpris.vala" + self->priv->_can_play = value; +#line 69 "../src/mpris.vala" + g_object_notify_by_pspec ((GObject *) self, mpris_player_properties[MPRIS_PLAYER_CAN_PLAY_PROPERTY]); +#line 3499 "mpris.c" + } +} + +gboolean +mpris_player_get_can_pause (MprisPlayer* self) +{ + gboolean result; +#line 70 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 70 "../src/mpris.vala" + result = self->priv->_can_pause; +#line 70 "../src/mpris.vala" + return result; +#line 3513 "mpris.c" +} + +static void +mpris_player_set_can_pause (MprisPlayer* self, + gboolean value) +{ + gboolean old_value; +#line 70 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 70 "../src/mpris.vala" + old_value = mpris_player_get_can_pause (self); +#line 70 "../src/mpris.vala" + if (old_value != value) { +#line 70 "../src/mpris.vala" + self->priv->_can_pause = value; +#line 70 "../src/mpris.vala" + g_object_notify_by_pspec ((GObject *) self, mpris_player_properties[MPRIS_PLAYER_CAN_PAUSE_PROPERTY]); +#line 3531 "mpris.c" + } +} + +gboolean +mpris_player_get_can_seek (MprisPlayer* self) +{ + gboolean result; +#line 71 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 71 "../src/mpris.vala" + result = self->priv->_can_seek; +#line 71 "../src/mpris.vala" + return result; +#line 3545 "mpris.c" +} + +static void +mpris_player_set_can_seek (MprisPlayer* self, + gboolean value) +{ + gboolean old_value; +#line 71 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 71 "../src/mpris.vala" + old_value = mpris_player_get_can_seek (self); +#line 71 "../src/mpris.vala" + if (old_value != value) { +#line 71 "../src/mpris.vala" + self->priv->_can_seek = value; +#line 71 "../src/mpris.vala" + g_object_notify_by_pspec ((GObject *) self, mpris_player_properties[MPRIS_PLAYER_CAN_SEEK_PROPERTY]); +#line 3563 "mpris.c" + } +} + +gboolean +mpris_player_get_can_control (MprisPlayer* self) +{ + gboolean result; +#line 73 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 73 "../src/mpris.vala" + result = TRUE; +#line 73 "../src/mpris.vala" + return result; +#line 3577 "mpris.c" +} + +SubsonicClient* +mpris_player_get_api (MprisPlayer* self) +{ + SubsonicClient* result; + SubsonicClient* _tmp0_; +#line 75 "../src/mpris.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 75 "../src/mpris.vala" + _tmp0_ = self->priv->_api; +#line 75 "../src/mpris.vala" + result = _tmp0_; +#line 75 "../src/mpris.vala" + return result; +#line 3593 "mpris.c" +} + +void +mpris_player_set_api (MprisPlayer* self, + SubsonicClient* value) +{ + SubsonicClient* old_value; +#line 75 "../src/mpris.vala" + g_return_if_fail (self != NULL); +#line 75 "../src/mpris.vala" + old_value = mpris_player_get_api (self); +#line 75 "../src/mpris.vala" + if (old_value != value) { +#line 3607 "mpris.c" + SubsonicClient* _tmp0_; +#line 75 "../src/mpris.vala" + _tmp0_ = _g_object_ref0 (value); +#line 75 "../src/mpris.vala" + _g_object_unref0 (self->priv->_api); +#line 75 "../src/mpris.vala" + self->priv->_api = _tmp0_; +#line 75 "../src/mpris.vala" + g_object_notify_by_pspec ((GObject *) self, mpris_player_properties[MPRIS_PLAYER_API_PROPERTY]); +#line 3617 "mpris.c" + } +} + +static void +g_cclosure_user_marshal_VOID__INT64 (GClosure * closure, + GValue * return_value, + guint n_param_values, + const GValue * param_values, + gpointer invocation_hint, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__INT64) (gpointer data1, gint64 arg_1, gpointer data2); + register GMarshalFunc_VOID__INT64 callback; + register GCClosure * cc; + register gpointer data1; + register gpointer data2; + cc = (GCClosure *) closure; +#line 35 "../src/mpris.vala" + g_return_if_fail (n_param_values == 2); +#line 35 "../src/mpris.vala" + if (G_CCLOSURE_SWAP_DATA (closure)) { +#line 35 "../src/mpris.vala" + data1 = closure->data; +#line 35 "../src/mpris.vala" + data2 = param_values->data[0].v_pointer; +#line 3643 "mpris.c" + } else { +#line 35 "../src/mpris.vala" + data1 = param_values->data[0].v_pointer; +#line 35 "../src/mpris.vala" + data2 = closure->data; +#line 3649 "mpris.c" + } +#line 35 "../src/mpris.vala" + callback = (GMarshalFunc_VOID__INT64) (marshal_data ? marshal_data : cc->callback); +#line 35 "../src/mpris.vala" + callback (data1, g_value_get_int64 (param_values + 1), data2); +#line 3655 "mpris.c" +} + +static void +g_cclosure_user_marshal_VOID__STRING_INT64 (GClosure * closure, + GValue * return_value, + guint n_param_values, + const GValue * param_values, + gpointer invocation_hint, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__STRING_INT64) (gpointer data1, const char* arg_1, gint64 arg_2, gpointer data2); + register GMarshalFunc_VOID__STRING_INT64 callback; + register GCClosure * cc; + register gpointer data1; + register gpointer data2; + cc = (GCClosure *) closure; +#line 35 "../src/mpris.vala" + g_return_if_fail (n_param_values == 3); +#line 35 "../src/mpris.vala" + if (G_CCLOSURE_SWAP_DATA (closure)) { +#line 35 "../src/mpris.vala" + data1 = closure->data; +#line 35 "../src/mpris.vala" + data2 = param_values->data[0].v_pointer; +#line 3680 "mpris.c" + } else { +#line 35 "../src/mpris.vala" + data1 = param_values->data[0].v_pointer; +#line 35 "../src/mpris.vala" + data2 = closure->data; +#line 3686 "mpris.c" + } +#line 35 "../src/mpris.vala" + callback = (GMarshalFunc_VOID__STRING_INT64) (marshal_data ? marshal_data : cc->callback); +#line 35 "../src/mpris.vala" + callback (data1, g_value_get_string (param_values + 1), g_value_get_int64 (param_values + 2), data2); +#line 3692 "mpris.c" +} + +static void +mpris_player_class_init (MprisPlayerClass * klass, + gpointer klass_data) +{ +#line 35 "../src/mpris.vala" + mpris_player_parent_class = g_type_class_peek_parent (klass); +#line 35 "../src/mpris.vala" + g_type_class_adjust_private_offset (klass, &MprisPlayer_private_offset); +#line 35 "../src/mpris.vala" + G_OBJECT_CLASS (klass)->get_property = _vala_mpris_player_get_property; +#line 35 "../src/mpris.vala" + G_OBJECT_CLASS (klass)->set_property = _vala_mpris_player_set_property; +#line 35 "../src/mpris.vala" + G_OBJECT_CLASS (klass)->finalize = mpris_player_finalize; +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_PLAYBACK_STATUS_PROPERTY, mpris_player_properties[MPRIS_PLAYER_PLAYBACK_STATUS_PROPERTY] = g_param_spec_string ("playback-status", "playback-status", "playback-status", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_LOOP_STATUS_PROPERTY, mpris_player_properties[MPRIS_PLAYER_LOOP_STATUS_PROPERTY] = g_param_spec_string ("loop-status", "loop-status", "loop-status", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_RATE_PROPERTY, mpris_player_properties[MPRIS_PLAYER_RATE_PROPERTY] = g_param_spec_double ("rate", "rate", "rate", -G_MAXDOUBLE, G_MAXDOUBLE, 1.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_SHUFFLE_PROPERTY, mpris_player_properties[MPRIS_PLAYER_SHUFFLE_PROPERTY] = g_param_spec_boolean ("shuffle", "shuffle", "shuffle", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_METADATA_PROPERTY, mpris_player_properties[MPRIS_PLAYER_METADATA_PROPERTY] = g_param_spec_boxed ("metadata", "metadata", "metadata", G_TYPE_HASH_TABLE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_VOLUME_PROPERTY, mpris_player_properties[MPRIS_PLAYER_VOLUME_PROPERTY] = g_param_spec_double ("volume", "volume", "volume", -G_MAXDOUBLE, G_MAXDOUBLE, 1.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_POSITION_PROPERTY, mpris_player_properties[MPRIS_PLAYER_POSITION_PROPERTY] = g_param_spec_int64 ("position", "position", "position", G_MININT64, G_MAXINT64, (gint64) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_MINIMUM_RATE_PROPERTY, mpris_player_properties[MPRIS_PLAYER_MINIMUM_RATE_PROPERTY] = g_param_spec_double ("minimum-rate", "minimum-rate", "minimum-rate", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_MAXIMUM_RATE_PROPERTY, mpris_player_properties[MPRIS_PLAYER_MAXIMUM_RATE_PROPERTY] = g_param_spec_double ("maximum-rate", "maximum-rate", "maximum-rate", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_CAN_GO_NEXT_PROPERTY, mpris_player_properties[MPRIS_PLAYER_CAN_GO_NEXT_PROPERTY] = g_param_spec_boolean ("can-go-next", "can-go-next", "can-go-next", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_CAN_GO_PREVIOUS_PROPERTY, mpris_player_properties[MPRIS_PLAYER_CAN_GO_PREVIOUS_PROPERTY] = g_param_spec_boolean ("can-go-previous", "can-go-previous", "can-go-previous", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_CAN_PLAY_PROPERTY, mpris_player_properties[MPRIS_PLAYER_CAN_PLAY_PROPERTY] = g_param_spec_boolean ("can-play", "can-play", "can-play", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_CAN_PAUSE_PROPERTY, mpris_player_properties[MPRIS_PLAYER_CAN_PAUSE_PROPERTY] = g_param_spec_boolean ("can-pause", "can-pause", "can-pause", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_CAN_SEEK_PROPERTY, mpris_player_properties[MPRIS_PLAYER_CAN_SEEK_PROPERTY] = g_param_spec_boolean ("can-seek", "can-seek", "can-seek", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_CAN_CONTROL_PROPERTY, mpris_player_properties[MPRIS_PLAYER_CAN_CONTROL_PROPERTY] = g_param_spec_boolean ("can-control", "can-control", "can-control", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY)); +#line 35 "../src/mpris.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_API_PROPERTY, mpris_player_properties[MPRIS_PLAYER_API_PROPERTY] = g_param_spec_object ("api", "api", "api", SUBSONIC_TYPE_CLIENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 35 "../src/mpris.vala" + mpris_player_signals[MPRIS_PLAYER_ON_NEXT_SIGNAL] = g_signal_new ("on-next", TYPE_MPRIS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); +#line 35 "../src/mpris.vala" + mpris_player_signals[MPRIS_PLAYER_ON_PREVIOUS_SIGNAL] = g_signal_new ("on-previous", TYPE_MPRIS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); +#line 35 "../src/mpris.vala" + mpris_player_signals[MPRIS_PLAYER_ON_PAUSE_SIGNAL] = g_signal_new ("on-pause", TYPE_MPRIS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); +#line 35 "../src/mpris.vala" + mpris_player_signals[MPRIS_PLAYER_ON_PLAY_PAUSE_SIGNAL] = g_signal_new ("on-play-pause", TYPE_MPRIS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); +#line 35 "../src/mpris.vala" + mpris_player_signals[MPRIS_PLAYER_ON_STOP_SIGNAL] = g_signal_new ("on-stop", TYPE_MPRIS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); +#line 35 "../src/mpris.vala" + mpris_player_signals[MPRIS_PLAYER_ON_PLAY_SIGNAL] = g_signal_new ("on-play", TYPE_MPRIS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); +#line 35 "../src/mpris.vala" + mpris_player_signals[MPRIS_PLAYER_ON_SEEK_SIGNAL] = g_signal_new ("on-seek", TYPE_MPRIS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64); +#line 35 "../src/mpris.vala" + mpris_player_signals[MPRIS_PLAYER_ON_SET_POSITION_SIGNAL] = g_signal_new ("on-set-position", TYPE_MPRIS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_INT64, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_INT64); +#line 35 "../src/mpris.vala" + mpris_player_signals[MPRIS_PLAYER_SEEKED_SIGNAL] = g_signal_new ("seeked", TYPE_MPRIS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64); +#line 3759 "mpris.c" +} + +static void +mpris_player_instance_init (MprisPlayer * self, + gpointer klass) +{ + gchar* _tmp0_; + gchar* _tmp1_; + GHashTable* _tmp2_; +#line 35 "../src/mpris.vala" + self->priv = mpris_player_get_instance_private (self); +#line 57 "../src/mpris.vala" + _tmp0_ = g_strdup ("Stopped"); +#line 57 "../src/mpris.vala" + self->priv->_playback_status = _tmp0_; +#line 58 "../src/mpris.vala" + _tmp1_ = g_strdup ("None"); +#line 58 "../src/mpris.vala" + self->priv->_loop_status = _tmp1_; +#line 59 "../src/mpris.vala" + self->priv->_rate = 1.0; +#line 60 "../src/mpris.vala" + self->priv->_shuffle = FALSE; +#line 61 "../src/mpris.vala" + _tmp2_ = g_hash_table_new_full (NULL, NULL, _g_free0_, _g_variant_unref0_); +#line 61 "../src/mpris.vala" + self->priv->_metadata = _tmp2_; +#line 62 "../src/mpris.vala" + self->priv->_volume = 1.0; +#line 64 "../src/mpris.vala" + self->priv->_position = (gint64) 0; +#line 67 "../src/mpris.vala" + self->priv->_can_go_next = FALSE; +#line 68 "../src/mpris.vala" + self->priv->_can_go_previous = FALSE; +#line 69 "../src/mpris.vala" + self->priv->_can_play = FALSE; +#line 70 "../src/mpris.vala" + self->priv->_can_pause = FALSE; +#line 71 "../src/mpris.vala" + self->priv->_can_seek = FALSE; +#line 3801 "mpris.c" +} + +static void +mpris_player_finalize (GObject * obj) +{ + MprisPlayer * self; +#line 35 "../src/mpris.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MPRIS_PLAYER, MprisPlayer); +#line 252 "../src/mpris.vala" + g_debug ("mpris.vala:252: destroying mpris player"); +#line 57 "../src/mpris.vala" + _g_free0 (self->priv->_playback_status); +#line 58 "../src/mpris.vala" + _g_free0 (self->priv->_loop_status); +#line 61 "../src/mpris.vala" + _g_hash_table_unref0 (self->priv->_metadata); +#line 75 "../src/mpris.vala" + _g_object_unref0 (self->priv->_api); +#line 35 "../src/mpris.vala" + G_OBJECT_CLASS (mpris_player_parent_class)->finalize (obj); +#line 3822 "mpris.c" +} + +static GType +mpris_player_get_type_once (void) +{ + static const GTypeInfo g_define_type_info = { sizeof (MprisPlayerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) mpris_player_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MprisPlayer), 0, (GInstanceInitFunc) mpris_player_instance_init, NULL }; + GType mpris_player_type_id; + mpris_player_type_id = g_type_register_static (G_TYPE_OBJECT, "MprisPlayer", &g_define_type_info, 0); + g_type_set_qdata (mpris_player_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) mpris_player_register_object); + MprisPlayer_private_offset = g_type_add_instance_private (mpris_player_type_id, sizeof (MprisPlayerPrivate)); + return mpris_player_type_id; +} + +GType +mpris_player_get_type (void) +{ + static volatile gsize mpris_player_type_id__once = 0; + if (g_once_init_enter (&mpris_player_type_id__once)) { + GType mpris_player_type_id; + mpris_player_type_id = mpris_player_get_type_once (); + g_once_init_leave (&mpris_player_type_id__once, mpris_player_type_id); + } + return mpris_player_type_id__once; +} + +static void +_vala_mpris_player_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec) +{ + MprisPlayer * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MPRIS_PLAYER, MprisPlayer); +#line 35 "../src/mpris.vala" + switch (property_id) { +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_PLAYBACK_STATUS_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_take_string (value, mpris_player_get_playback_status (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_LOOP_STATUS_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_take_string (value, mpris_player_get_loop_status (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_RATE_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_set_double (value, mpris_player_get_rate (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_SHUFFLE_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_set_boolean (value, mpris_player_get_shuffle (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_METADATA_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_take_boxed (value, mpris_player_get_metadata (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_VOLUME_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_set_double (value, mpris_player_get_volume (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_POSITION_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_set_int64 (value, mpris_player_get_position (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_MINIMUM_RATE_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_set_double (value, mpris_player_get_minimum_rate (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_MAXIMUM_RATE_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_set_double (value, mpris_player_get_maximum_rate (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_CAN_GO_NEXT_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_set_boolean (value, mpris_player_get_can_go_next (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_CAN_GO_PREVIOUS_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_set_boolean (value, mpris_player_get_can_go_previous (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_CAN_PLAY_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_set_boolean (value, mpris_player_get_can_play (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_CAN_PAUSE_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_set_boolean (value, mpris_player_get_can_pause (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_CAN_SEEK_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_set_boolean (value, mpris_player_get_can_seek (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_CAN_CONTROL_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_set_boolean (value, mpris_player_get_can_control (self)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_API_PROPERTY: +#line 35 "../src/mpris.vala" + g_value_set_object (value, mpris_player_get_api (self)); +#line 35 "../src/mpris.vala" + break; +#line 3954 "mpris.c" + default: +#line 35 "../src/mpris.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 35 "../src/mpris.vala" + break; +#line 3960 "mpris.c" + } +} + +static void +_vala_mpris_player_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec) +{ + MprisPlayer * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MPRIS_PLAYER, MprisPlayer); +#line 35 "../src/mpris.vala" + switch (property_id) { +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_PLAYBACK_STATUS_PROPERTY: +#line 35 "../src/mpris.vala" + mpris_player_set_playback_status (self, g_value_get_string (value)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_METADATA_PROPERTY: +#line 35 "../src/mpris.vala" + mpris_player_set_metadata (self, g_value_get_boxed (value)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_VOLUME_PROPERTY: +#line 35 "../src/mpris.vala" + mpris_player_set_volume (self, g_value_get_double (value)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_CAN_GO_NEXT_PROPERTY: +#line 35 "../src/mpris.vala" + mpris_player_set_can_go_next (self, g_value_get_boolean (value)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_CAN_GO_PREVIOUS_PROPERTY: +#line 35 "../src/mpris.vala" + mpris_player_set_can_go_previous (self, g_value_get_boolean (value)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_CAN_PLAY_PROPERTY: +#line 35 "../src/mpris.vala" + mpris_player_set_can_play (self, g_value_get_boolean (value)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_CAN_PAUSE_PROPERTY: +#line 35 "../src/mpris.vala" + mpris_player_set_can_pause (self, g_value_get_boolean (value)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_CAN_SEEK_PROPERTY: +#line 35 "../src/mpris.vala" + mpris_player_set_can_seek (self, g_value_get_boolean (value)); +#line 35 "../src/mpris.vala" + break; +#line 35 "../src/mpris.vala" + case MPRIS_PLAYER_API_PROPERTY: +#line 35 "../src/mpris.vala" + mpris_player_set_api (self, g_value_get_object (value)); +#line 35 "../src/mpris.vala" + break; +#line 4028 "mpris.c" + default: +#line 35 "../src/mpris.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 35 "../src/mpris.vala" + break; +#line 4034 "mpris.c" + } +} + +static void +_dbus_mpris_player_next (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation) +{ + GError* error = NULL; + GVariantIter _arguments_iter; + GDBusMessage* _reply_message = NULL; + GVariant* _reply; + GVariantBuilder _reply_builder; + g_variant_iter_init (&_arguments_iter, _parameters_); + mpris_player_next (self, &error); + if (error) { + g_dbus_method_invocation_take_error (invocation, error); + return; + } + _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); + g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); + _reply = g_variant_builder_end (&_reply_builder); + g_dbus_message_set_body (_reply_message, _reply); + g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); + g_object_unref (invocation); + g_object_unref (_reply_message); +} + +static void +_dbus_mpris_player_previous (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation) +{ + GError* error = NULL; + GVariantIter _arguments_iter; + GDBusMessage* _reply_message = NULL; + GVariant* _reply; + GVariantBuilder _reply_builder; + g_variant_iter_init (&_arguments_iter, _parameters_); + mpris_player_previous (self, &error); + if (error) { + g_dbus_method_invocation_take_error (invocation, error); + return; + } + _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); + g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); + _reply = g_variant_builder_end (&_reply_builder); + g_dbus_message_set_body (_reply_message, _reply); + g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); + g_object_unref (invocation); + g_object_unref (_reply_message); +} + +static void +_dbus_mpris_player_pause (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation) +{ + GError* error = NULL; + GVariantIter _arguments_iter; + GDBusMessage* _reply_message = NULL; + GVariant* _reply; + GVariantBuilder _reply_builder; + g_variant_iter_init (&_arguments_iter, _parameters_); + mpris_player_pause (self, &error); + if (error) { + g_dbus_method_invocation_take_error (invocation, error); + return; + } + _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); + g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); + _reply = g_variant_builder_end (&_reply_builder); + g_dbus_message_set_body (_reply_message, _reply); + g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); + g_object_unref (invocation); + g_object_unref (_reply_message); +} + +static void +_dbus_mpris_player_play_pause (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation) +{ + GError* error = NULL; + GVariantIter _arguments_iter; + GDBusMessage* _reply_message = NULL; + GVariant* _reply; + GVariantBuilder _reply_builder; + g_variant_iter_init (&_arguments_iter, _parameters_); + mpris_player_play_pause (self, &error); + if (error) { + g_dbus_method_invocation_take_error (invocation, error); + return; + } + _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); + g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); + _reply = g_variant_builder_end (&_reply_builder); + g_dbus_message_set_body (_reply_message, _reply); + g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); + g_object_unref (invocation); + g_object_unref (_reply_message); +} + +static void +_dbus_mpris_player_stop (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation) +{ + GError* error = NULL; + GVariantIter _arguments_iter; + GDBusMessage* _reply_message = NULL; + GVariant* _reply; + GVariantBuilder _reply_builder; + g_variant_iter_init (&_arguments_iter, _parameters_); + mpris_player_stop (self, &error); + if (error) { + g_dbus_method_invocation_take_error (invocation, error); + return; + } + _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); + g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); + _reply = g_variant_builder_end (&_reply_builder); + g_dbus_message_set_body (_reply_message, _reply); + g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); + g_object_unref (invocation); + g_object_unref (_reply_message); +} + +static void +_dbus_mpris_player_play (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation) +{ + GError* error = NULL; + GVariantIter _arguments_iter; + GDBusMessage* _reply_message = NULL; + GVariant* _reply; + GVariantBuilder _reply_builder; + g_variant_iter_init (&_arguments_iter, _parameters_); + mpris_player_play (self, &error); + if (error) { + g_dbus_method_invocation_take_error (invocation, error); + return; + } + _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); + g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); + _reply = g_variant_builder_end (&_reply_builder); + g_dbus_message_set_body (_reply_message, _reply); + g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); + g_object_unref (invocation); + g_object_unref (_reply_message); +} + +static void +_dbus_mpris_player_seek (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation) +{ + GError* error = NULL; + GVariantIter _arguments_iter; + gint64 offset = 0LL; + GVariant* _tmp6_; + GDBusMessage* _reply_message = NULL; + GVariant* _reply; + GVariantBuilder _reply_builder; + g_variant_iter_init (&_arguments_iter, _parameters_); + _tmp6_ = g_variant_iter_next_value (&_arguments_iter); + offset = g_variant_get_int64 (_tmp6_); + g_variant_unref (_tmp6_); + mpris_player_seek (self, offset, &error); + if (error) { + g_dbus_method_invocation_take_error (invocation, error); + return; + } + _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); + g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); + _reply = g_variant_builder_end (&_reply_builder); + g_dbus_message_set_body (_reply_message, _reply); + g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); + g_object_unref (invocation); + g_object_unref (_reply_message); +} + +static void +_dbus_mpris_player_set_position (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation) +{ + GError* error = NULL; + GVariantIter _arguments_iter; + char* track_id = NULL; + GVariant* _tmp7_; + gint64 position = 0LL; + GVariant* _tmp8_; + GDBusMessage* _reply_message = NULL; + GVariant* _reply; + GVariantBuilder _reply_builder; + g_variant_iter_init (&_arguments_iter, _parameters_); + _tmp7_ = g_variant_iter_next_value (&_arguments_iter); + track_id = g_variant_dup_string (_tmp7_, NULL); + g_variant_unref (_tmp7_); + _tmp8_ = g_variant_iter_next_value (&_arguments_iter); + position = g_variant_get_int64 (_tmp8_); + g_variant_unref (_tmp8_); + mpris_player_set_position (self, track_id, position, &error); + if (error) { + g_dbus_method_invocation_take_error (invocation, error); + goto _error; + } + _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); + g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); + _reply = g_variant_builder_end (&_reply_builder); + g_dbus_message_set_body (_reply_message, _reply); + g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); + g_object_unref (invocation); + g_object_unref (_reply_message); + _error: + _g_free0 (track_id); + ; +} + +static void +_dbus_mpris_player_open_uri (MprisPlayer* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation) +{ + GError* error = NULL; + GVariantIter _arguments_iter; + gchar* uri = NULL; + GVariant* _tmp9_; + GDBusMessage* _reply_message = NULL; + GVariant* _reply; + GVariantBuilder _reply_builder; + g_variant_iter_init (&_arguments_iter, _parameters_); + _tmp9_ = g_variant_iter_next_value (&_arguments_iter); + uri = g_variant_dup_string (_tmp9_, NULL); + g_variant_unref (_tmp9_); + mpris_player_open_uri (self, uri, &error); + if (error) { + g_dbus_method_invocation_take_error (invocation, error); + goto _error; + } + _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); + g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); + _reply = g_variant_builder_end (&_reply_builder); + g_dbus_message_set_body (_reply_message, _reply); + g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); + g_object_unref (invocation); + g_object_unref (_reply_message); + _error: + _g_free0 (uri); + ; +} + +static void +mpris_player_dbus_interface_method_call (GDBusConnection* connection, + const gchar* sender, + const gchar* object_path, + const gchar* interface_name, + const gchar* method_name, + GVariant* parameters, + GDBusMethodInvocation* invocation, + gpointer user_data) +{ + gpointer* data; + gpointer object; + data = user_data; + object = data[0]; + if (strcmp (method_name, "Next") == 0) { + _dbus_mpris_player_next (object, parameters, invocation); + } else if (strcmp (method_name, "Previous") == 0) { + _dbus_mpris_player_previous (object, parameters, invocation); + } else if (strcmp (method_name, "Pause") == 0) { + _dbus_mpris_player_pause (object, parameters, invocation); + } else if (strcmp (method_name, "PlayPause") == 0) { + _dbus_mpris_player_play_pause (object, parameters, invocation); + } else if (strcmp (method_name, "Stop") == 0) { + _dbus_mpris_player_stop (object, parameters, invocation); + } else if (strcmp (method_name, "Play") == 0) { + _dbus_mpris_player_play (object, parameters, invocation); + } else if (strcmp (method_name, "Seek") == 0) { + _dbus_mpris_player_seek (object, parameters, invocation); + } else if (strcmp (method_name, "SetPosition") == 0) { + _dbus_mpris_player_set_position (object, parameters, invocation); + } else if (strcmp (method_name, "OpenUri") == 0) { + _dbus_mpris_player_open_uri (object, parameters, invocation); + } else { + g_object_unref (invocation); + } +} + +static GVariant* +_dbus_mpris_player_get_playback_status (MprisPlayer* self) +{ + gchar* result; + GVariant* _reply; + result = mpris_player_get_playback_status (self); + _reply = g_variant_new_string (result); + _g_free0 (result); + return _reply; +} + +static GVariant* +_dbus_mpris_player_get_loop_status (MprisPlayer* self) +{ + gchar* result; + GVariant* _reply; + result = mpris_player_get_loop_status (self); + _reply = g_variant_new_string (result); + _g_free0 (result); + return _reply; +} + +static GVariant* +_dbus_mpris_player_get_rate (MprisPlayer* self) +{ + gdouble result; + GVariant* _reply; + result = mpris_player_get_rate (self); + _reply = g_variant_new_double (result); + return _reply; +} + +static GVariant* +_dbus_mpris_player_get_shuffle (MprisPlayer* self) +{ + gboolean result; + GVariant* _reply; + result = mpris_player_get_shuffle (self); + _reply = g_variant_new_boolean (result); + return _reply; +} + +static GVariant* +_dbus_mpris_player_get_metadata (MprisPlayer* self) +{ + GHashTable* result; + GVariant* _reply; + GVariantBuilder _tmp10_; + GHashTableIter _tmp11_; + gpointer _tmp12_; + gpointer _tmp13_; + result = mpris_player_get_metadata (self); + g_hash_table_iter_init (&_tmp11_, result); + g_variant_builder_init (&_tmp10_, G_VARIANT_TYPE ("a{sv}")); + while (g_hash_table_iter_next (&_tmp11_, &_tmp12_, &_tmp13_)) { + gchar* _key; + GVariant* _value; + _key = (gchar*) _tmp12_; + _value = (GVariant*) _tmp13_; + g_variant_builder_add (&_tmp10_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value)); + } + _reply = g_variant_builder_end (&_tmp10_); + _g_hash_table_unref0 (result); + return _reply; +} + +static GVariant* +_dbus_mpris_player_get_volume (MprisPlayer* self) +{ + gdouble result; + GVariant* _reply; + result = mpris_player_get_volume (self); + _reply = g_variant_new_double (result); + return _reply; +} + +static GVariant* +_dbus_mpris_player_get_position (MprisPlayer* self) +{ + gint64 result; + GVariant* _reply; + result = mpris_player_get_position (self); + _reply = g_variant_new_int64 (result); + return _reply; +} + +static GVariant* +_dbus_mpris_player_get_minimum_rate (MprisPlayer* self) +{ + gdouble result; + GVariant* _reply; + result = mpris_player_get_minimum_rate (self); + _reply = g_variant_new_double (result); + return _reply; +} + +static GVariant* +_dbus_mpris_player_get_maximum_rate (MprisPlayer* self) +{ + gdouble result; + GVariant* _reply; + result = mpris_player_get_maximum_rate (self); + _reply = g_variant_new_double (result); + return _reply; +} + +static GVariant* +_dbus_mpris_player_get_can_go_next (MprisPlayer* self) +{ + gboolean result; + GVariant* _reply; + result = mpris_player_get_can_go_next (self); + _reply = g_variant_new_boolean (result); + return _reply; +} + +static GVariant* +_dbus_mpris_player_get_can_go_previous (MprisPlayer* self) +{ + gboolean result; + GVariant* _reply; + result = mpris_player_get_can_go_previous (self); + _reply = g_variant_new_boolean (result); + return _reply; +} + +static GVariant* +_dbus_mpris_player_get_can_play (MprisPlayer* self) +{ + gboolean result; + GVariant* _reply; + result = mpris_player_get_can_play (self); + _reply = g_variant_new_boolean (result); + return _reply; +} + +static GVariant* +_dbus_mpris_player_get_can_pause (MprisPlayer* self) +{ + gboolean result; + GVariant* _reply; + result = mpris_player_get_can_pause (self); + _reply = g_variant_new_boolean (result); + return _reply; +} + +static GVariant* +_dbus_mpris_player_get_can_seek (MprisPlayer* self) +{ + gboolean result; + GVariant* _reply; + result = mpris_player_get_can_seek (self); + _reply = g_variant_new_boolean (result); + return _reply; +} + +static GVariant* +_dbus_mpris_player_get_can_control (MprisPlayer* self) +{ + gboolean result; + GVariant* _reply; + result = mpris_player_get_can_control (self); + _reply = g_variant_new_boolean (result); + return _reply; +} + +static GVariant* +mpris_player_dbus_interface_get_property (GDBusConnection* connection, + const gchar* sender, + const gchar* object_path, + const gchar* interface_name, + const gchar* property_name, + GError** error, + gpointer user_data) +{ + gpointer* data; + gpointer object; + data = user_data; + object = data[0]; + if (strcmp (property_name, "PlaybackStatus") == 0) { + return _dbus_mpris_player_get_playback_status (object); + } else if (strcmp (property_name, "LoopStatus") == 0) { + return _dbus_mpris_player_get_loop_status (object); + } else if (strcmp (property_name, "Rate") == 0) { + return _dbus_mpris_player_get_rate (object); + } else if (strcmp (property_name, "Shuffle") == 0) { + return _dbus_mpris_player_get_shuffle (object); + } else if (strcmp (property_name, "Metadata") == 0) { + return _dbus_mpris_player_get_metadata (object); + } else if (strcmp (property_name, "Volume") == 0) { + return _dbus_mpris_player_get_volume (object); + } else if (strcmp (property_name, "Position") == 0) { + return _dbus_mpris_player_get_position (object); + } else if (strcmp (property_name, "MinimumRate") == 0) { + return _dbus_mpris_player_get_minimum_rate (object); + } else if (strcmp (property_name, "MaximumRate") == 0) { + return _dbus_mpris_player_get_maximum_rate (object); + } else if (strcmp (property_name, "CanGoNext") == 0) { + return _dbus_mpris_player_get_can_go_next (object); + } else if (strcmp (property_name, "CanGoPrevious") == 0) { + return _dbus_mpris_player_get_can_go_previous (object); + } else if (strcmp (property_name, "CanPlay") == 0) { + return _dbus_mpris_player_get_can_play (object); + } else if (strcmp (property_name, "CanPause") == 0) { + return _dbus_mpris_player_get_can_pause (object); + } else if (strcmp (property_name, "CanSeek") == 0) { + return _dbus_mpris_player_get_can_seek (object); + } else if (strcmp (property_name, "CanControl") == 0) { + return _dbus_mpris_player_get_can_control (object); + } + return NULL; +} + +static void +_dbus_mpris_player_set_playback_status (MprisPlayer* self, + GVariant* _value) +{ + gchar* value = NULL; + value = g_variant_dup_string (_value, NULL); + mpris_player_set_playback_status (self, value); + _g_free0 (value); +} + +static void +_dbus_mpris_player_set_metadata (MprisPlayer* self, + GVariant* _value) +{ + GHashTable* value = NULL; + GHashTable* _tmp14_; + GVariantIter _tmp15_; + GVariant* _tmp16_; + GVariant* _tmp17_; + _tmp14_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref); + g_variant_iter_init (&_tmp15_, _value); + while (g_variant_iter_loop (&_tmp15_, "{?*}", &_tmp16_, &_tmp17_)) { + g_hash_table_insert (_tmp14_, g_variant_dup_string (_tmp16_, NULL), g_variant_get_variant (_tmp17_)); + } + value = _tmp14_; + mpris_player_set_metadata (self, value); + _g_hash_table_unref0 (value); +} + +static void +_dbus_mpris_player_set_volume (MprisPlayer* self, + GVariant* _value) +{ + gdouble value = 0.0; + value = g_variant_get_double (_value); + mpris_player_set_volume (self, value); +} + +static void +_dbus_mpris_player_set_can_go_next (MprisPlayer* self, + GVariant* _value) +{ + gboolean value = FALSE; + value = g_variant_get_boolean (_value); + mpris_player_set_can_go_next (self, value); +} + +static void +_dbus_mpris_player_set_can_go_previous (MprisPlayer* self, + GVariant* _value) +{ + gboolean value = FALSE; + value = g_variant_get_boolean (_value); + mpris_player_set_can_go_previous (self, value); +} + +static void +_dbus_mpris_player_set_can_play (MprisPlayer* self, + GVariant* _value) +{ + gboolean value = FALSE; + value = g_variant_get_boolean (_value); + mpris_player_set_can_play (self, value); +} + +static void +_dbus_mpris_player_set_can_pause (MprisPlayer* self, + GVariant* _value) +{ + gboolean value = FALSE; + value = g_variant_get_boolean (_value); + mpris_player_set_can_pause (self, value); +} + +static void +_dbus_mpris_player_set_can_seek (MprisPlayer* self, + GVariant* _value) +{ + gboolean value = FALSE; + value = g_variant_get_boolean (_value); + mpris_player_set_can_seek (self, value); +} + +static gboolean +mpris_player_dbus_interface_set_property (GDBusConnection* connection, + const gchar* sender, + const gchar* object_path, + const gchar* interface_name, + const gchar* property_name, + GVariant* value, + GError** error, + gpointer user_data) +{ + gpointer* data; + gpointer object; + data = user_data; + object = data[0]; + if (strcmp (property_name, "PlaybackStatus") == 0) { + _dbus_mpris_player_set_playback_status (object, value); + return TRUE; + } else if (strcmp (property_name, "Metadata") == 0) { + _dbus_mpris_player_set_metadata (object, value); + return TRUE; + } else if (strcmp (property_name, "Volume") == 0) { + _dbus_mpris_player_set_volume (object, value); + return TRUE; + } else if (strcmp (property_name, "CanGoNext") == 0) { + _dbus_mpris_player_set_can_go_next (object, value); + return TRUE; + } else if (strcmp (property_name, "CanGoPrevious") == 0) { + _dbus_mpris_player_set_can_go_previous (object, value); + return TRUE; + } else if (strcmp (property_name, "CanPlay") == 0) { + _dbus_mpris_player_set_can_play (object, value); + return TRUE; + } else if (strcmp (property_name, "CanPause") == 0) { + _dbus_mpris_player_set_can_pause (object, value); + return TRUE; + } else if (strcmp (property_name, "CanSeek") == 0) { + _dbus_mpris_player_set_can_seek (object, value); + return TRUE; + } + return FALSE; +} + +static void +_dbus_mpris_player_seeked (GObject* _sender, + gint64 position, + gpointer* _data) +{ + GDBusConnection * _connection; + const gchar * _path; + GVariant *_arguments; + GVariantBuilder _arguments_builder; + _connection = _data[1]; + _path = _data[2]; + g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE); + g_variant_builder_add_value (&_arguments_builder, g_variant_new_int64 (position)); + _arguments = g_variant_builder_end (&_arguments_builder); + g_dbus_connection_emit_signal (_connection, NULL, _path, "org.mpris.MediaPlayer2.Player", "Seeked", _arguments, NULL); +} + +guint +mpris_player_register_object (gpointer object, + GDBusConnection* connection, + const gchar* path, + GError** error) +{ + guint result; + gpointer *data; + data = g_new (gpointer, 3); + data[0] = g_object_ref (object); + data[1] = g_object_ref (connection); + data[2] = g_strdup (path); + result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_mpris_player_dbus_interface_info), &_mpris_player_dbus_interface_vtable, data, _mpris_player_unregister_object, error); + if (!result) { + return 0; + } + g_signal_connect (object, "seeked", (GCallback) _dbus_mpris_player_seeked, data); + return result; +} + +static void +_mpris_player_unregister_object (gpointer user_data) +{ + gpointer* data; + data = user_data; + g_signal_handlers_disconnect_by_func (data[0], _dbus_mpris_player_seeked, data); + g_object_unref (data[0]); + g_object_unref (data[1]); + g_free (data[2]); + g_free (data); +} + +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); +} + diff --git a/src/mpris.vala b/src/mpris.vala deleted file mode 100644 index fa7e8b5..0000000 --- a/src/mpris.vala +++ /dev/null @@ -1,254 +0,0 @@ -[DBus (name = "org.mpris.MediaPlayer2")] -class Mpris : Object { - internal signal void on_raise (); - internal signal void on_quit (); - - public bool can_raise { get { return true; } } - public void raise () throws Error { - this.on_raise (); - } - - public bool can_quit { get { return true; } } - public void quit () throws Error { - this.on_quit (); - } - - public bool can_set_fullscreen { get { return false; } } - public bool fullscreen { get { return false; } set { assert (false); } } - public bool has_track_list { get { return false; } } - public string identity { owned get { return "audrey"; } } - public string desktop_entry { owned get { return "eu.callcc.audrey"; } } - public string[] supported_uri_schemes { owned get { return {}; } } - public string[] supported_mime_types { owned get { return {}; } } - - internal Mpris (Ui.Window window) { - this.on_raise.connect (() => window.present ()); - this.on_quit.connect (() => window.close ()); - } - - ~Mpris () { - debug ("destroying mpris"); - } -} - -[DBus (name = "org.mpris.MediaPlayer2.Player")] -class MprisPlayer : Object { - internal signal void on_next (); - internal signal void on_previous (); - internal signal void on_pause (); - internal signal void on_play_pause (); - internal signal void on_stop (); - internal signal void on_play (); - internal signal void on_seek (int64 offset); - internal signal void on_set_position (ObjectPath track_id, int64 position); - - public void next () throws Error { this.on_next (); } - public void previous () throws Error { this.on_previous (); } - public void pause () throws Error { print("pause\n");this.on_pause (); } - public void play_pause () throws Error { this.on_play_pause (); } - public void stop () throws Error { this.on_stop (); } - public void play () throws Error { this.on_play (); } - public void seek (int64 offset) throws Error { this.on_seek (offset); } - public void set_position (ObjectPath track_id, int64 position) throws Error { this.on_set_position (track_id, position); } - public void open_uri (string uri) throws Error { assert (false); } - - public signal void seeked (int64 position); - - public string playback_status { owned get; internal set; default = "Stopped"; } - public string loop_status { owned get; /*set;*/ default = "None"; } - public double rate { get; /*set*/ default = 1.0; } - public bool shuffle { get; /*set*/ default = false; } - public HashTable metadata { owned get; private set; default = new HashTable (null, null); } - public double volume { get; set; default = 1.0; } - [CCode (notify = false)] - public int64 position { get; default = 0; } - public double minimum_rate { get { return 1.0; } } - public double maximum_rate { get { return 1.0; } } - public bool can_go_next { get; private set; default = false; } - public bool can_go_previous { get; private set; default = false; } - public bool can_play { get; private set; default = false; } - public bool can_pause { get; private set; default = false; } - public bool can_seek { get; private set; default = false; } - [CCode (notify = false)] - public bool can_control { get { return true; } } - - internal Subsonic.Client api { get; set; } - - internal MprisPlayer (DBusConnection conn, Playbin playbin) { - playbin.bind_property ( - "state", - this, - "playback_status", - BindingFlags.DEFAULT, - (binding, from, ref to) => { - switch (from.get_enum ()) { - case PlaybinState.STOPPED: - to.set_string ("Stopped"); - this.can_go_next = false; - this.can_go_previous = false; - this.can_play = false; - this.can_pause = false; - this.can_seek = false; - return true; - case PlaybinState.PAUSED: - to.set_string ("Paused"); - this.can_go_next = true; - this.can_go_previous = true; - this.can_play = true; - this.can_pause = true; - this.can_seek = true; - return true; - case PlaybinState.PLAYING: - to.set_string ("Playing"); - this.can_go_next = true; - this.can_go_previous = true; - this.can_play = true; - this.can_pause = true; - this.can_seek = true; - return true; - } - return false; - }); - - playbin.bind_property ( - "volume", - this, - "volume", - BindingFlags.BIDIRECTIONAL, - (binding, from, ref to) => { - to.set_double (from.get_int () / 100.0); - return true; - }, - (binding, from, ref to) => { - to.set_int ((int) (from.get_double () * 100.0)); - return true; - }); - - playbin.new_track.connect ((playbin) => { - PlaybinSong song = (PlaybinSong) playbin.play_queue.get_item (playbin.play_queue_position); - - var metadata = new HashTable (null, null); - metadata["mpris:trackid"] = new ObjectPath (@"/eu/callcc/audrey/track/$(song.id)"); - metadata["mpris:length"] = (int64) song.duration * 1000000; - if (this.api != null) metadata["mpris:artUrl"] = this.api.cover_art_uri (song.id); - metadata["xesam:album"] = song.album; - metadata["xesam:artist"] = new string[] {song.artist}; - if (song.genre != null) metadata["xesam:genre"] = song.genre; - metadata["xesam:title"] = song.title; - metadata["xesam:trackNumber"] = song.track; - metadata["xesam:useCount"] = song.play_count; - // TODO metadata["xesam:userRating"] = song.starred != null ? 1.0 : 0.0; - - this.metadata = metadata; - }); - - playbin.stopped.connect (() => { - this.metadata = new HashTable (null, null); - }); - - this.on_next.connect (() => playbin.go_to_next_track ()); - this.on_previous.connect (() => playbin.go_to_prev_track ()); - this.on_play.connect (() => playbin.play ()); - this.on_pause.connect (() => playbin.pause ()); - this.on_play_pause.connect (() => { - if (playbin.state == PlaybinState.PAUSED) playbin.play (); - else if (playbin.state == PlaybinState.PLAYING) playbin.pause (); - }); - this.on_stop.connect (() => { - playbin.stop (); - }); - - // TODO: seeking from mpris - // TODO: trigger the seeked signal when applicable - - this.notify.connect ((p) => { - var builder = new VariantBuilder (VariantType.ARRAY); - var invalid_builder = new VariantBuilder (new VariantType ("as")); - - string dbus_name; - Variant dbus_value; - - switch (p.name) { - case "playback-status": - dbus_name = "PlaybackStatus"; - dbus_value = this.playback_status; - break; - case "loop-status": - dbus_name = "LoopStatus"; - dbus_value = this.loop_status; - break; - case "rate": - dbus_name = "Rate"; - dbus_value = this.rate; - break; - case "shuffle": - dbus_name = "Shuffle"; - dbus_value = this.shuffle; - break; - case "metadata": - dbus_name = "Metadata"; - dbus_value = this.metadata; - break; - case "volume": - dbus_name = "Volume"; - dbus_value = this.volume; - break; - case "minimum-rate": - dbus_name = "MinimumRate"; - dbus_value = this.minimum_rate; - break; - case "maximum-rate": - dbus_name = "MaximumRate"; - dbus_value = this.maximum_rate; - break; - case "can-go-next": - dbus_name = "CanGoNext"; - dbus_value = this.can_go_next; - break; - case "can-go-previous": - dbus_name = "CanGoPrevious"; - dbus_value = this.can_go_previous; - break; - case "can-play": - dbus_name = "CanPlay"; - dbus_value = this.can_play; - break; - case "can-pause": - dbus_name = "CanPause"; - dbus_value = this.can_pause; - break; - case "can-seek": - dbus_name = "CanSeek"; - dbus_value = this.can_seek; - break; - case "api": - // internal, ignored - return; - default: - warning (@"unknown mpris player property $(p.name)"); - return; - } - - builder.add ("{sv}", dbus_name, dbus_value); - - try { - conn.emit_signal ( - null, - "/org/mpris/MediaPlayer2", - "org.freedesktop.DBus.Properties", - "PropertiesChanged", - new Variant ( - "(sa{sv}as)", - "org.mpris.MediaPlayer2.Player", - builder, - invalid_builder)); - } catch (Error e) { - error (@"could not notify of mpris property changes: $(e.message)"); - } - }); - } - - ~MprisPlayer () { - debug ("destroying mpris player"); - } -} diff --git a/src/playbin.c b/src/playbin.c new file mode 100644 index 0000000..93fa00e --- /dev/null +++ b/src/playbin.c @@ -0,0 +1,3647 @@ +/* playbin.c generated by valac 0.56.16, the Vala compiler + * generated from playbin.vala, do not modify */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define AUDREY_CONST_user_agent "audrey/linux" +#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 + +typedef enum { + PLAYBIN_STATE_STOPPED, + PLAYBIN_STATE_PAUSED, + PLAYBIN_STATE_PLAYING +} PlaybinState; + +#define TYPE_PLAYBIN_STATE (playbin_state_get_type ()) + +#define TYPE_COMMAND_CALLBACK (command_callback_get_type ()) +typedef struct _CommandCallback CommandCallback; + +#define TYPE_PLAYBIN_SONG (playbin_song_get_type ()) +#define PLAYBIN_SONG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYBIN_SONG, PlaybinSong)) +#define PLAYBIN_SONG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYBIN_SONG, PlaybinSongClass)) +#define IS_PLAYBIN_SONG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYBIN_SONG)) +#define IS_PLAYBIN_SONG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYBIN_SONG)) +#define PLAYBIN_SONG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYBIN_SONG, PlaybinSongClass)) + +typedef struct _PlaybinSong PlaybinSong; +typedef struct _PlaybinSongClass PlaybinSongClass; +typedef struct _PlaybinSongPrivate PlaybinSongPrivate; + +#define SUBSONIC_TYPE_SONG (subsonic_song_get_type ()) +typedef struct _SubsonicSong SubsonicSong; + +#define SUBSONIC_TYPE_CLIENT (subsonic_client_get_type ()) +#define SUBSONIC_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SUBSONIC_TYPE_CLIENT, SubsonicClient)) +#define SUBSONIC_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SUBSONIC_TYPE_CLIENT, SubsonicClientClass)) +#define SUBSONIC_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUBSONIC_TYPE_CLIENT)) +#define SUBSONIC_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SUBSONIC_TYPE_CLIENT)) +#define SUBSONIC_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SUBSONIC_TYPE_CLIENT, SubsonicClientClass)) + +typedef struct _SubsonicClient SubsonicClient; +typedef struct _SubsonicClientClass SubsonicClientClass; +enum { + PLAYBIN_SONG_0_PROPERTY, + PLAYBIN_SONG_ID_PROPERTY, + PLAYBIN_SONG_TITLE_PROPERTY, + PLAYBIN_SONG_ARTIST_PROPERTY, + PLAYBIN_SONG_ALBUM_PROPERTY, + PLAYBIN_SONG_GENRE_PROPERTY, + PLAYBIN_SONG_DURATION_PROPERTY, + PLAYBIN_SONG_TRACK_PROPERTY, + PLAYBIN_SONG_PLAY_COUNT_PROPERTY, + PLAYBIN_SONG_THUMBNAIL_PROPERTY, + PLAYBIN_SONG_NUM_PROPERTIES +}; +static GParamSpec* playbin_song_properties[PLAYBIN_SONG_NUM_PROPERTIES]; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define TYPE_PLAYBIN (playbin_get_type ()) +#define PLAYBIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYBIN, Playbin)) +#define PLAYBIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYBIN, PlaybinClass)) +#define IS_PLAYBIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYBIN)) +#define IS_PLAYBIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYBIN)) +#define PLAYBIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYBIN, PlaybinClass)) + +typedef struct _Playbin Playbin; +typedef struct _PlaybinClass PlaybinClass; +typedef struct _PlaybinPrivate PlaybinPrivate; +enum { + PLAYBIN_0_PROPERTY, + PLAYBIN_STATE_PROPERTY, + PLAYBIN_VOLUME_PROPERTY, + PLAYBIN_MUTE_PROPERTY, + PLAYBIN_PLAY_QUEUE_POSITION_PROPERTY, + PLAYBIN_POSITION_PROPERTY, + PLAYBIN_DURATION_PROPERTY, + PLAYBIN_API_PROPERTY, + PLAYBIN_PLAY_QUEUE_PROPERTY, + PLAYBIN_PLAY_QUEUE_LENGTH_PROPERTY, + PLAYBIN_NUM_PROPERTIES +}; +static GParamSpec* playbin_properties[PLAYBIN_NUM_PROPERTIES]; +#define _mpv_terminate_destroy0(var) ((var == NULL) ? NULL : (var = (mpv_terminate_destroy (var), NULL))) +typedef struct _PlaybinMpvCommandAsyncData PlaybinMpvCommandAsyncData; +#define __vala_mpv_event_free0(var) ((var == NULL) ? NULL : (var = (_vala_mpv_event_free (var), NULL))) +#define __vala_mpv_event_property_free0(var) ((var == NULL) ? NULL : (var = (_vala_mpv_event_property_free (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define __vala_mpv_event_end_file_free0(var) ((var == NULL) ? NULL : (var = (_vala_mpv_event_end_file_free (var), NULL))) +typedef struct _PlaybinAppendTrackAsyncData PlaybinAppendTrackAsyncData; +enum { + PLAYBIN_NEW_TRACK_SIGNAL, + PLAYBIN_STOPPED_SIGNAL, + PLAYBIN_NUM_SIGNALS +}; +static guint playbin_signals[PLAYBIN_NUM_SIGNALS] = {0}; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _CommandCallback { + GSourceFunc callback; + gpointer callback_target; + gint error; +}; + +struct _PlaybinSong { + GObject parent_instance; + PlaybinSongPrivate * priv; +}; + +struct _PlaybinSongClass { + GObjectClass parent_class; +}; + +struct _SubsonicSong { + gchar* id; + gchar* title; + gchar* album; + gchar* artist; + gint64 track; + gint64 year; + GDateTime* starred; + gint64 duration; + gint64 play_count; + gchar* genre; + gchar* cover_art; +}; + +struct _PlaybinSongPrivate { + SubsonicSong inner; + GdkPaintable* _thumbnail; + GCancellable* cancel_loading_thumbnail; + SubsonicClient* api; +}; + +struct _Playbin { + GObject parent_instance; + PlaybinPrivate * priv; +}; + +struct _PlaybinClass { + GObjectClass parent_class; +}; + +struct _PlaybinPrivate { + mpv_handle* mpv; + gint _volume; + gboolean _mute; + GListStore* _play_queue; + gboolean is_handling_event; + PlaybinState _state; + gint _play_queue_position; + gdouble _position; + gdouble _duration; + SubsonicClient* _api; + guint _play_queue_length; +}; + +struct _PlaybinMpvCommandAsyncData { + int _state_; + GObject* _source_object_; + GAsyncResult* _res_; + GTask* _async_result; + Playbin* self; + gchar** args; + gint args_length1; + mpv_error result; + CommandCallback cc; + CommandCallback _tmp0_; + mpv_handle* _tmp1_; + CommandCallback _tmp2_; +}; + +struct _PlaybinAppendTrackAsyncData { + int _state_; + GObject* _source_object_; + GAsyncResult* _res_; + GTask* _async_result; + Playbin* self; + SubsonicSong song; + mpv_error err; + gchar* _tmp0_; + SubsonicClient* _tmp1_; + SubsonicSong _tmp2_; + const gchar* _tmp3_; + gchar* _tmp4_; + gchar* _tmp5_; + gchar** _tmp6_; + gchar** _tmp7_; + gint _tmp7__length1; + mpv_error _tmp8_; + GListStore* _tmp9_; + SubsonicClient* _tmp10_; + SubsonicSong _tmp11_; + PlaybinSong* _tmp12_; + PlaybinSong* _tmp13_; + guint _tmp14_; +}; + +static gint PlaybinSong_private_offset; +static gpointer playbin_song_parent_class = NULL; +static gint Playbin_private_offset; +static gpointer playbin_parent_class = NULL; + +VALA_EXTERN GType playbin_state_get_type (void) G_GNUC_CONST ; +VALA_EXTERN GType command_callback_get_type (void) G_GNUC_CONST ; +VALA_EXTERN CommandCallback* command_callback_dup (const CommandCallback* self); +VALA_EXTERN void command_callback_free (CommandCallback* self); +VALA_EXTERN GType playbin_song_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (PlaybinSong, g_object_unref) +VALA_EXTERN GType subsonic_song_get_type (void) G_GNUC_CONST ; +VALA_EXTERN SubsonicSong* subsonic_song_dup (const SubsonicSong* self); +VALA_EXTERN void subsonic_song_free (SubsonicSong* self); +VALA_EXTERN void subsonic_song_copy (const SubsonicSong* self, + SubsonicSong* dest); +VALA_EXTERN void subsonic_song_destroy (SubsonicSong* self); +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (SubsonicSong, subsonic_song_destroy) +VALA_EXTERN GType subsonic_client_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (SubsonicClient, g_object_unref) +VALA_EXTERN PlaybinSong* playbin_song_new (SubsonicClient* api, + SubsonicSong* song); +VALA_EXTERN PlaybinSong* playbin_song_construct (GType object_type, + SubsonicClient* api, + SubsonicSong* song); +VALA_EXTERN void playbin_song_need_cover_art (PlaybinSong* self); +VALA_EXTERN const gchar* playbin_song_get_id (PlaybinSong* self); +VALA_EXTERN const gchar* playbin_song_get_title (PlaybinSong* self); +VALA_EXTERN const gchar* playbin_song_get_artist (PlaybinSong* self); +VALA_EXTERN const gchar* playbin_song_get_album (PlaybinSong* self); +VALA_EXTERN const gchar* playbin_song_get_genre (PlaybinSong* self); +VALA_EXTERN gint64 playbin_song_get_duration (PlaybinSong* self); +VALA_EXTERN gint64 playbin_song_get_track (PlaybinSong* self); +VALA_EXTERN gint64 playbin_song_get_play_count (PlaybinSong* self); +VALA_EXTERN GdkPaintable* playbin_song_get_thumbnail (PlaybinSong* self); +static void playbin_song_set_thumbnail (PlaybinSong* self, + GdkPaintable* value); +static void playbin_song_finalize (GObject * obj); +static GType playbin_song_get_type_once (void); +static void _vala_playbin_song_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec); +static void _vala_playbin_song_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec); +VALA_EXTERN GType playbin_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (Playbin, g_object_unref) +static void playbin_mpv_command_async_data_free (gpointer _data); +static void playbin_mpv_command_async (Playbin* self, + gchar** args, + gint args_length1, + GAsyncReadyCallback _callback_, + gpointer _user_data_); +static mpv_error playbin_mpv_command_finish (Playbin* self, + GAsyncResult* _res_); +static gboolean playbin_mpv_command_async_co (PlaybinMpvCommandAsyncData* _data_); +static gboolean _playbin_mpv_command_async_co_gsource_func (gpointer self); +VALA_EXTERN Playbin* playbin_new (void); +VALA_EXTERN Playbin* playbin_construct (GType object_type); +static void __lambda4_ (Playbin* self); +static gboolean __lambda5_ (Playbin* self); +static void mpv_event_copy (const mpv_event * self, + mpv_event * dest); +static mpv_event* _mpv_event_dup (mpv_event* self); +static void _vala_mpv_event_free (mpv_event* self); +static void mpv_event_property_copy (const mpv_event_property * self, + mpv_event_property * dest); +static mpv_event_property* _mpv_event_property_dup (mpv_event_property* self); +static void playbin_set_position (Playbin* self, + gdouble value); +static void playbin_set_duration (Playbin* self, + gdouble value); +VALA_EXTERN PlaybinState playbin_get_state (Playbin* self); +VALA_EXTERN gint playbin_get_play_queue_position (Playbin* self); +static void _vala_mpv_event_property_free (mpv_event_property* self); +static void mpv_event_end_file_copy (const mpv_event_end_file * self, + mpv_event_end_file * dest); +static mpv_event_end_file* _mpv_event_end_file_dup (mpv_event_end_file* self); +static const char* _mpv_end_file_reason_to_string (mpv_end_file_reason value); +static void playbin_set_play_queue_position (Playbin* self, + gint value); +static void playbin_set_state (Playbin* self, + PlaybinState value); +static void _vala_mpv_event_end_file_free (mpv_event_end_file* self); +static gboolean ___lambda5__gsource_func (gpointer self); +static void ___lambda4__mpv_wakeup_callback (gpointer self); +VALA_EXTERN void playbin_seek (Playbin* self, + gdouble position); +VALA_EXTERN void playbin_select_track (Playbin* self, + guint position); +VALA_EXTERN GListModel* playbin_get_play_queue (Playbin* self); +VALA_EXTERN void playbin_play (Playbin* self); +VALA_EXTERN void playbin_pause (Playbin* self); +VALA_EXTERN void playbin_go_to_next_track (Playbin* self); +VALA_EXTERN void playbin_go_to_prev_track (Playbin* self); +VALA_EXTERN void playbin_remove_track (Playbin* self, + guint position); +VALA_EXTERN guint playbin_get_play_queue_length (Playbin* self); +static void playbin_set_play_queue_length (Playbin* self, + guint value); +VALA_EXTERN void playbin_clear (Playbin* self); +VALA_EXTERN void playbin_append_track (Playbin* self, + SubsonicSong* song); +VALA_EXTERN SubsonicClient* playbin_get_api (Playbin* self); +VALA_EXTERN gchar* subsonic_client_stream_uri (SubsonicClient* self, + const gchar* id); +static void playbin_append_track_async_data_free (gpointer _data); +VALA_EXTERN void playbin_append_track_async (Playbin* self, + SubsonicSong* song, + GAsyncReadyCallback _callback_, + gpointer _user_data_); +VALA_EXTERN void playbin_append_track_finish (Playbin* self, + GAsyncResult* _res_); +static gboolean playbin_append_track_async_co (PlaybinAppendTrackAsyncData* _data_); +static void playbin_append_track_async_ready (GObject* source_object, + GAsyncResult* _res_, + gpointer _user_data_); +VALA_EXTERN void playbin_move_track (Playbin* self, + guint from, + guint to); +VALA_EXTERN void playbin_stop (Playbin* self); +VALA_EXTERN gint playbin_get_volume (Playbin* self); +VALA_EXTERN void playbin_set_volume (Playbin* self, + gint value); +VALA_EXTERN gboolean playbin_get_mute (Playbin* self); +VALA_EXTERN void playbin_set_mute (Playbin* self, + gboolean value); +VALA_EXTERN gdouble playbin_get_position (Playbin* self); +VALA_EXTERN gdouble playbin_get_duration (Playbin* self); +VALA_EXTERN void playbin_set_api (Playbin* self, + SubsonicClient* value); +static void playbin_finalize (GObject * obj); +static GType playbin_get_type_once (void); +static void _vala_playbin_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec); +static void _vala_playbin_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec); +static void _vala_array_destroy (gpointer array, + gssize array_length, + GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, + gssize array_length, + GDestroyNotify destroy_func); + +static GType +playbin_state_get_type_once (void) +{ + static const GEnumValue values[] = {{PLAYBIN_STATE_STOPPED, "PLAYBIN_STATE_STOPPED", "stopped"}, {PLAYBIN_STATE_PAUSED, "PLAYBIN_STATE_PAUSED", "paused"}, {PLAYBIN_STATE_PLAYING, "PLAYBIN_STATE_PLAYING", "playing"}, {0, NULL, NULL}}; + GType playbin_state_type_id; + playbin_state_type_id = g_enum_register_static ("PlaybinState", values); + return playbin_state_type_id; +} + +GType +playbin_state_get_type (void) +{ + static volatile gsize playbin_state_type_id__once = 0; + if (g_once_init_enter (&playbin_state_type_id__once)) { + GType playbin_state_type_id; + playbin_state_type_id = playbin_state_get_type_once (); + g_once_init_leave (&playbin_state_type_id__once, playbin_state_type_id); + } + return playbin_state_type_id__once; +} + +CommandCallback* +command_callback_dup (const CommandCallback* self) +{ + CommandCallback* dup; +#line 7 "../src/playbin.vala" + dup = g_new0 (CommandCallback, 1); +#line 7 "../src/playbin.vala" + memcpy (dup, self, sizeof (CommandCallback)); +#line 7 "../src/playbin.vala" + return dup; +#line 407 "playbin.c" +} + +void +command_callback_free (CommandCallback* self) +{ +#line 7 "../src/playbin.vala" + g_free (self); +#line 415 "playbin.c" +} + +static GType +command_callback_get_type_once (void) +{ + GType command_callback_type_id; + command_callback_type_id = g_boxed_type_register_static ("CommandCallback", (GBoxedCopyFunc) command_callback_dup, (GBoxedFreeFunc) command_callback_free); + return command_callback_type_id; +} + +GType +command_callback_get_type (void) +{ + static volatile gsize command_callback_type_id__once = 0; + if (g_once_init_enter (&command_callback_type_id__once)) { + GType command_callback_type_id; + command_callback_type_id = command_callback_get_type_once (); + g_once_init_leave (&command_callback_type_id__once, command_callback_type_id); + } + return command_callback_type_id__once; +} + +static inline gpointer +playbin_song_get_instance_private (PlaybinSong* self) +{ + return G_STRUCT_MEMBER_P (self, PlaybinSong_private_offset); +} + +static gpointer +_g_object_ref0 (gpointer self) +{ +#line 28 "../src/playbin.vala" + return self ? g_object_ref (self) : NULL; +#line 449 "playbin.c" +} + +PlaybinSong* +playbin_song_construct (GType object_type, + SubsonicClient* api, + SubsonicSong* song) +{ + PlaybinSong * self = NULL; + SubsonicClient* _tmp0_; + SubsonicSong _tmp1_; + SubsonicSong _tmp2_; + SubsonicSong _tmp3_ = {0}; +#line 27 "../src/playbin.vala" + g_return_val_if_fail (api != NULL, NULL); +#line 27 "../src/playbin.vala" + g_return_val_if_fail (song != NULL, NULL); +#line 27 "../src/playbin.vala" + self = (PlaybinSong*) g_object_new (object_type, NULL); +#line 28 "../src/playbin.vala" + _tmp0_ = _g_object_ref0 (api); +#line 28 "../src/playbin.vala" + _g_object_unref0 (self->priv->api); +#line 28 "../src/playbin.vala" + self->priv->api = _tmp0_; +#line 29 "../src/playbin.vala" + _tmp1_ = *song; +#line 29 "../src/playbin.vala" + _tmp2_ = _tmp1_; +#line 29 "../src/playbin.vala" + subsonic_song_copy (&_tmp2_, &_tmp3_); +#line 29 "../src/playbin.vala" + subsonic_song_destroy (&self->priv->inner); +#line 29 "../src/playbin.vala" + self->priv->inner = _tmp3_; +#line 27 "../src/playbin.vala" + return self; +#line 486 "playbin.c" +} + +PlaybinSong* +playbin_song_new (SubsonicClient* api, + SubsonicSong* song) +{ +#line 27 "../src/playbin.vala" + return playbin_song_construct (TYPE_PLAYBIN_SONG, api, song); +#line 495 "playbin.c" +} + +void +playbin_song_need_cover_art (PlaybinSong* self) +{ +#line 34 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 503 "playbin.c" +} + +const gchar* +playbin_song_get_id (PlaybinSong* self) +{ + const gchar* result; + SubsonicSong _tmp0_; + const gchar* _tmp1_; +#line 14 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 14 "../src/playbin.vala" + _tmp0_ = self->priv->inner; +#line 14 "../src/playbin.vala" + _tmp1_ = _tmp0_.id; +#line 14 "../src/playbin.vala" + result = _tmp1_; +#line 14 "../src/playbin.vala" + return result; +#line 522 "playbin.c" +} + +const gchar* +playbin_song_get_title (PlaybinSong* self) +{ + const gchar* result; + SubsonicSong _tmp0_; + const gchar* _tmp1_; +#line 15 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 15 "../src/playbin.vala" + _tmp0_ = self->priv->inner; +#line 15 "../src/playbin.vala" + _tmp1_ = _tmp0_.title; +#line 15 "../src/playbin.vala" + result = _tmp1_; +#line 15 "../src/playbin.vala" + return result; +#line 541 "playbin.c" +} + +const gchar* +playbin_song_get_artist (PlaybinSong* self) +{ + const gchar* result; + SubsonicSong _tmp0_; + const gchar* _tmp1_; +#line 16 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 16 "../src/playbin.vala" + _tmp0_ = self->priv->inner; +#line 16 "../src/playbin.vala" + _tmp1_ = _tmp0_.artist; +#line 16 "../src/playbin.vala" + result = _tmp1_; +#line 16 "../src/playbin.vala" + return result; +#line 560 "playbin.c" +} + +const gchar* +playbin_song_get_album (PlaybinSong* self) +{ + const gchar* result; + SubsonicSong _tmp0_; + const gchar* _tmp1_; +#line 17 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 17 "../src/playbin.vala" + _tmp0_ = self->priv->inner; +#line 17 "../src/playbin.vala" + _tmp1_ = _tmp0_.album; +#line 17 "../src/playbin.vala" + result = _tmp1_; +#line 17 "../src/playbin.vala" + return result; +#line 579 "playbin.c" +} + +const gchar* +playbin_song_get_genre (PlaybinSong* self) +{ + const gchar* result; + SubsonicSong _tmp0_; + const gchar* _tmp1_; +#line 18 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 18 "../src/playbin.vala" + _tmp0_ = self->priv->inner; +#line 18 "../src/playbin.vala" + _tmp1_ = _tmp0_.genre; +#line 18 "../src/playbin.vala" + result = _tmp1_; +#line 18 "../src/playbin.vala" + return result; +#line 598 "playbin.c" +} + +gint64 +playbin_song_get_duration (PlaybinSong* self) +{ + gint64 result; + SubsonicSong _tmp0_; +#line 19 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, 0LL); +#line 19 "../src/playbin.vala" + _tmp0_ = self->priv->inner; +#line 19 "../src/playbin.vala" + result = _tmp0_.duration; +#line 19 "../src/playbin.vala" + return result; +#line 614 "playbin.c" +} + +gint64 +playbin_song_get_track (PlaybinSong* self) +{ + gint64 result; + SubsonicSong _tmp0_; +#line 20 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, 0LL); +#line 20 "../src/playbin.vala" + _tmp0_ = self->priv->inner; +#line 20 "../src/playbin.vala" + result = _tmp0_.track; +#line 20 "../src/playbin.vala" + return result; +#line 630 "playbin.c" +} + +gint64 +playbin_song_get_play_count (PlaybinSong* self) +{ + gint64 result; + SubsonicSong _tmp0_; +#line 21 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, 0LL); +#line 21 "../src/playbin.vala" + _tmp0_ = self->priv->inner; +#line 21 "../src/playbin.vala" + result = _tmp0_.play_count; +#line 21 "../src/playbin.vala" + return result; +#line 646 "playbin.c" +} + +GdkPaintable* +playbin_song_get_thumbnail (PlaybinSong* self) +{ + GdkPaintable* result; + GdkPaintable* _tmp0_; +#line 23 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 23 "../src/playbin.vala" + _tmp0_ = self->priv->_thumbnail; +#line 23 "../src/playbin.vala" + result = _tmp0_; +#line 23 "../src/playbin.vala" + return result; +#line 662 "playbin.c" +} + +static void +playbin_song_set_thumbnail (PlaybinSong* self, + GdkPaintable* value) +{ + GdkPaintable* old_value; +#line 23 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 23 "../src/playbin.vala" + old_value = playbin_song_get_thumbnail (self); +#line 23 "../src/playbin.vala" + if (old_value != value) { +#line 676 "playbin.c" + GdkPaintable* _tmp0_; +#line 23 "../src/playbin.vala" + _tmp0_ = _g_object_ref0 (value); +#line 23 "../src/playbin.vala" + _g_object_unref0 (self->priv->_thumbnail); +#line 23 "../src/playbin.vala" + self->priv->_thumbnail = _tmp0_; +#line 23 "../src/playbin.vala" + g_object_notify_by_pspec ((GObject *) self, playbin_song_properties[PLAYBIN_SONG_THUMBNAIL_PROPERTY]); +#line 686 "playbin.c" + } +} + +static void +playbin_song_class_init (PlaybinSongClass * klass, + gpointer klass_data) +{ +#line 12 "../src/playbin.vala" + playbin_song_parent_class = g_type_class_peek_parent (klass); +#line 12 "../src/playbin.vala" + g_type_class_adjust_private_offset (klass, &PlaybinSong_private_offset); +#line 12 "../src/playbin.vala" + G_OBJECT_CLASS (klass)->get_property = _vala_playbin_song_get_property; +#line 12 "../src/playbin.vala" + G_OBJECT_CLASS (klass)->set_property = _vala_playbin_song_set_property; +#line 12 "../src/playbin.vala" + G_OBJECT_CLASS (klass)->finalize = playbin_song_finalize; +#line 12 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_SONG_ID_PROPERTY, playbin_song_properties[PLAYBIN_SONG_ID_PROPERTY] = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 12 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_SONG_TITLE_PROPERTY, playbin_song_properties[PLAYBIN_SONG_TITLE_PROPERTY] = g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 12 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_SONG_ARTIST_PROPERTY, playbin_song_properties[PLAYBIN_SONG_ARTIST_PROPERTY] = g_param_spec_string ("artist", "artist", "artist", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 12 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_SONG_ALBUM_PROPERTY, playbin_song_properties[PLAYBIN_SONG_ALBUM_PROPERTY] = g_param_spec_string ("album", "album", "album", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 12 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_SONG_GENRE_PROPERTY, playbin_song_properties[PLAYBIN_SONG_GENRE_PROPERTY] = g_param_spec_string ("genre", "genre", "genre", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 12 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_SONG_DURATION_PROPERTY, playbin_song_properties[PLAYBIN_SONG_DURATION_PROPERTY] = g_param_spec_int64 ("duration", "duration", "duration", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 12 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_SONG_TRACK_PROPERTY, playbin_song_properties[PLAYBIN_SONG_TRACK_PROPERTY] = g_param_spec_int64 ("track", "track", "track", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 12 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_SONG_PLAY_COUNT_PROPERTY, playbin_song_properties[PLAYBIN_SONG_PLAY_COUNT_PROPERTY] = g_param_spec_int64 ("play-count", "play-count", "play-count", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 12 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_SONG_THUMBNAIL_PROPERTY, playbin_song_properties[PLAYBIN_SONG_THUMBNAIL_PROPERTY] = g_param_spec_object ("thumbnail", "thumbnail", "thumbnail", gdk_paintable_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 722 "playbin.c" +} + +static void +playbin_song_instance_init (PlaybinSong * self, + gpointer klass) +{ +#line 12 "../src/playbin.vala" + self->priv = playbin_song_get_instance_private (self); +#line 731 "playbin.c" +} + +static void +playbin_song_finalize (GObject * obj) +{ + PlaybinSong * self; + GCancellable* _tmp0_; +#line 12 "../src/playbin.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_PLAYBIN_SONG, PlaybinSong); +#line 56 "../src/playbin.vala" + _tmp0_ = self->priv->cancel_loading_thumbnail; +#line 56 "../src/playbin.vala" + if (_tmp0_ != NULL) { +#line 745 "playbin.c" + GCancellable* _tmp1_; +#line 57 "../src/playbin.vala" + _tmp1_ = self->priv->cancel_loading_thumbnail; +#line 57 "../src/playbin.vala" + g_cancellable_cancel (_tmp1_); +#line 751 "playbin.c" + } +#line 13 "../src/playbin.vala" + subsonic_song_destroy (&self->priv->inner); +#line 23 "../src/playbin.vala" + _g_object_unref0 (self->priv->_thumbnail); +#line 25 "../src/playbin.vala" + _g_object_unref0 (self->priv->cancel_loading_thumbnail); +#line 32 "../src/playbin.vala" + _g_object_unref0 (self->priv->api); +#line 12 "../src/playbin.vala" + G_OBJECT_CLASS (playbin_song_parent_class)->finalize (obj); +#line 763 "playbin.c" +} + +static GType +playbin_song_get_type_once (void) +{ + static const GTypeInfo g_define_type_info = { sizeof (PlaybinSongClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) playbin_song_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PlaybinSong), 0, (GInstanceInitFunc) playbin_song_instance_init, NULL }; + GType playbin_song_type_id; + playbin_song_type_id = g_type_register_static (G_TYPE_OBJECT, "PlaybinSong", &g_define_type_info, 0); + PlaybinSong_private_offset = g_type_add_instance_private (playbin_song_type_id, sizeof (PlaybinSongPrivate)); + return playbin_song_type_id; +} + +GType +playbin_song_get_type (void) +{ + static volatile gsize playbin_song_type_id__once = 0; + if (g_once_init_enter (&playbin_song_type_id__once)) { + GType playbin_song_type_id; + playbin_song_type_id = playbin_song_get_type_once (); + g_once_init_leave (&playbin_song_type_id__once, playbin_song_type_id); + } + return playbin_song_type_id__once; +} + +static void +_vala_playbin_song_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec) +{ + PlaybinSong * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_PLAYBIN_SONG, PlaybinSong); +#line 12 "../src/playbin.vala" + switch (property_id) { +#line 12 "../src/playbin.vala" + case PLAYBIN_SONG_ID_PROPERTY: +#line 12 "../src/playbin.vala" + g_value_set_string (value, playbin_song_get_id (self)); +#line 12 "../src/playbin.vala" + break; +#line 12 "../src/playbin.vala" + case PLAYBIN_SONG_TITLE_PROPERTY: +#line 12 "../src/playbin.vala" + g_value_set_string (value, playbin_song_get_title (self)); +#line 12 "../src/playbin.vala" + break; +#line 12 "../src/playbin.vala" + case PLAYBIN_SONG_ARTIST_PROPERTY: +#line 12 "../src/playbin.vala" + g_value_set_string (value, playbin_song_get_artist (self)); +#line 12 "../src/playbin.vala" + break; +#line 12 "../src/playbin.vala" + case PLAYBIN_SONG_ALBUM_PROPERTY: +#line 12 "../src/playbin.vala" + g_value_set_string (value, playbin_song_get_album (self)); +#line 12 "../src/playbin.vala" + break; +#line 12 "../src/playbin.vala" + case PLAYBIN_SONG_GENRE_PROPERTY: +#line 12 "../src/playbin.vala" + g_value_set_string (value, playbin_song_get_genre (self)); +#line 12 "../src/playbin.vala" + break; +#line 12 "../src/playbin.vala" + case PLAYBIN_SONG_DURATION_PROPERTY: +#line 12 "../src/playbin.vala" + g_value_set_int64 (value, playbin_song_get_duration (self)); +#line 12 "../src/playbin.vala" + break; +#line 12 "../src/playbin.vala" + case PLAYBIN_SONG_TRACK_PROPERTY: +#line 12 "../src/playbin.vala" + g_value_set_int64 (value, playbin_song_get_track (self)); +#line 12 "../src/playbin.vala" + break; +#line 12 "../src/playbin.vala" + case PLAYBIN_SONG_PLAY_COUNT_PROPERTY: +#line 12 "../src/playbin.vala" + g_value_set_int64 (value, playbin_song_get_play_count (self)); +#line 12 "../src/playbin.vala" + break; +#line 12 "../src/playbin.vala" + case PLAYBIN_SONG_THUMBNAIL_PROPERTY: +#line 12 "../src/playbin.vala" + g_value_set_object (value, playbin_song_get_thumbnail (self)); +#line 12 "../src/playbin.vala" + break; +#line 852 "playbin.c" + default: +#line 12 "../src/playbin.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 12 "../src/playbin.vala" + break; +#line 858 "playbin.c" + } +} + +static void +_vala_playbin_song_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec) +{ + PlaybinSong * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_PLAYBIN_SONG, PlaybinSong); +#line 12 "../src/playbin.vala" + switch (property_id) { +#line 12 "../src/playbin.vala" + case PLAYBIN_SONG_THUMBNAIL_PROPERTY: +#line 12 "../src/playbin.vala" + playbin_song_set_thumbnail (self, g_value_get_object (value)); +#line 12 "../src/playbin.vala" + break; +#line 878 "playbin.c" + default: +#line 12 "../src/playbin.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 12 "../src/playbin.vala" + break; +#line 884 "playbin.c" + } +} + +static inline gpointer +playbin_get_instance_private (Playbin* self) +{ + return G_STRUCT_MEMBER_P (self, Playbin_private_offset); +} + +static void +playbin_mpv_command_async_data_free (gpointer _data) +{ + PlaybinMpvCommandAsyncData* _data_; + _data_ = _data; +#line 62 "../src/playbin.vala" + _g_object_unref0 (_data_->self); +#line 62 "../src/playbin.vala" + g_slice_free (PlaybinMpvCommandAsyncData, _data_); +#line 903 "playbin.c" +} + +static void +playbin_mpv_command_async (Playbin* self, + gchar** args, + gint args_length1, + GAsyncReadyCallback _callback_, + gpointer _user_data_) +{ + PlaybinMpvCommandAsyncData* _data_; + Playbin* _tmp0_; +#line 62 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 62 "../src/playbin.vala" + _data_ = g_slice_new0 (PlaybinMpvCommandAsyncData); +#line 62 "../src/playbin.vala" + _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_); +#line 62 "../src/playbin.vala" + g_task_set_task_data (_data_->_async_result, _data_, playbin_mpv_command_async_data_free); +#line 62 "../src/playbin.vala" + _tmp0_ = _g_object_ref0 (self); +#line 62 "../src/playbin.vala" + _data_->self = _tmp0_; +#line 62 "../src/playbin.vala" + _data_->args = args; +#line 62 "../src/playbin.vala" + _data_->args_length1 = args_length1; +#line 62 "../src/playbin.vala" + playbin_mpv_command_async_co (_data_); +#line 933 "playbin.c" +} + +static mpv_error +playbin_mpv_command_finish (Playbin* self, + GAsyncResult* _res_) +{ + mpv_error result; + PlaybinMpvCommandAsyncData* _data_; +#line 62 "../src/playbin.vala" + _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL); +#line 62 "../src/playbin.vala" + result = _data_->result; +#line 62 "../src/playbin.vala" + return result; +#line 948 "playbin.c" +} + +static gboolean +_playbin_mpv_command_async_co_gsource_func (gpointer self) +{ + gboolean result; + result = playbin_mpv_command_async_co (self); +#line 119 "../src/playbin.vala" + return result; +#line 958 "playbin.c" +} + +static gboolean +playbin_mpv_command_async_co (PlaybinMpvCommandAsyncData* _data_) +{ +#line 114 "../src/playbin.vala" + switch (_data_->_state_) { +#line 114 "../src/playbin.vala" + case 0: +#line 968 "playbin.c" + goto _state_0; +#line 114 "../src/playbin.vala" + case 1: +#line 972 "playbin.c" + goto _state_1; + default: +#line 114 "../src/playbin.vala" + g_assert_not_reached (); +#line 977 "playbin.c" + } + _state_0: +#line 115 "../src/playbin.vala" + memset (&_data_->_tmp0_, 0, sizeof (CommandCallback)); +#line 115 "../src/playbin.vala" + _data_->cc = _data_->_tmp0_; +#line 117 "../src/playbin.vala" + _data_->_tmp1_ = _data_->self->priv->mpv; +#line 117 "../src/playbin.vala" + mpv_command_async (_data_->_tmp1_, (guint64) (&_data_->cc), _data_->args); +#line 119 "../src/playbin.vala" + _data_->cc.callback = _playbin_mpv_command_async_co_gsource_func; +#line 119 "../src/playbin.vala" + _data_->cc.callback_target = _data_; +#line 120 "../src/playbin.vala" + _data_->_state_ = 1; +#line 120 "../src/playbin.vala" + return FALSE; +#line 996 "playbin.c" + _state_1: + ; +#line 121 "../src/playbin.vala" + _data_->_tmp2_ = _data_->cc; +#line 121 "../src/playbin.vala" + _data_->result = _data_->_tmp2_.error; +#line 121 "../src/playbin.vala" + g_task_return_pointer (_data_->_async_result, _data_, NULL); +#line 121 "../src/playbin.vala" + if (_data_->_state_ != 0) { +#line 121 "../src/playbin.vala" + while (!g_task_get_completed (_data_->_async_result)) { +#line 121 "../src/playbin.vala" + g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE); +#line 1011 "playbin.c" + } + } +#line 121 "../src/playbin.vala" + g_object_unref (_data_->_async_result); +#line 121 "../src/playbin.vala" + return FALSE; +#line 1018 "playbin.c" +} + +static void +mpv_event_copy (const mpv_event * self, + mpv_event * dest) +{ + void* _tmp0_; +#line 145 "../src/playbin.vala" + (*dest).event_id = (*self).event_id; +#line 145 "../src/playbin.vala" + (*dest).error = (*self).error; +#line 145 "../src/playbin.vala" + (*dest).reply_userdata = (*self).reply_userdata; +#line 145 "../src/playbin.vala" + _tmp0_ = (*self).data; +#line 145 "../src/playbin.vala" + (*dest).data = _tmp0_; +#line 1036 "playbin.c" +} + +static mpv_event* +_mpv_event_dup (mpv_event* self) +{ + mpv_event* dup; +#line 145 "../src/playbin.vala" + dup = g_new0 (mpv_event, 1); +#line 145 "../src/playbin.vala" + mpv_event_copy (self, dup); +#line 145 "../src/playbin.vala" + return dup; +#line 1049 "playbin.c" +} + +static gpointer +__mpv_event_dup0 (gpointer self) +{ +#line 145 "../src/playbin.vala" + return self ? _mpv_event_dup (self) : NULL; +#line 1057 "playbin.c" +} + +static void +_vala_mpv_event_free (mpv_event* self) +{ +#line 146 "../src/playbin.vala" + (self); +#line 146 "../src/playbin.vala" + g_free (self); +#line 1067 "playbin.c" +} + +static mpv_event_property* +mpv_event_parse_property (mpv_event *self) +{ + void* _tmp0_; + mpv_event_property* result; +#line 120 "mpv.vapi" + _vala_return_val_if_fail ((*self).event_id == MPV_EVENT_PROPERTY_CHANGE, "event_id == EventId.PROPERTY_CHANGE", NULL); +#line 120 "mpv.vapi" + _vala_return_val_if_fail ((*self).error >= 0, "error >= 0", NULL); +#line 124 "mpv.vapi" + _tmp0_ = (*self).data; +#line 124 "mpv.vapi" + result = (mpv_event_property*) _tmp0_; +#line 124 "mpv.vapi" + return result; +#line 1085 "playbin.c" +} + +static void +mpv_event_property_copy (const mpv_event_property * self, + mpv_event_property * dest) +{ + const gchar* _tmp0_; + void* _tmp1_; +#line 150 "../src/playbin.vala" + _tmp0_ = (*self).name; +#line 150 "../src/playbin.vala" + (*dest).name = _tmp0_; +#line 150 "../src/playbin.vala" + (*dest).format = (*self).format; +#line 150 "../src/playbin.vala" + _tmp1_ = (*self).data; +#line 150 "../src/playbin.vala" + (*dest).data = _tmp1_; +#line 1104 "playbin.c" +} + +static mpv_event_property* +_mpv_event_property_dup (mpv_event_property* self) +{ + mpv_event_property* dup; +#line 150 "../src/playbin.vala" + dup = g_new0 (mpv_event_property, 1); +#line 150 "../src/playbin.vala" + mpv_event_property_copy (self, dup); +#line 150 "../src/playbin.vala" + return dup; +#line 1117 "playbin.c" +} + +static gpointer +__mpv_event_property_dup0 (gpointer self) +{ +#line 150 "../src/playbin.vala" + return self ? _mpv_event_property_dup (self) : NULL; +#line 1125 "playbin.c" +} + +static gdouble +mpv_event_property_parse_double (mpv_event_property *self) +{ + void* _tmp0_; + gdouble result; +#line 147 "mpv.vapi" + _vala_return_val_if_fail ((*self).format == MPV_FORMAT_DOUBLE, "format == Format.DOUBLE", 0.0); +#line 150 "mpv.vapi" + _tmp0_ = (*self).data; +#line 150 "mpv.vapi" + result = *((gdouble*) _tmp0_); +#line 150 "mpv.vapi" + return result; +#line 1141 "playbin.c" +} + +static gint64 +mpv_event_property_parse_int64 (mpv_event_property *self) +{ + void* _tmp0_; + gint64 result; +#line 141 "mpv.vapi" + _vala_return_val_if_fail ((*self).format == MPV_FORMAT_INT64, "format == Format.INT64", 0LL); +#line 144 "mpv.vapi" + _tmp0_ = (*self).data; +#line 144 "mpv.vapi" + result = *((gint64*) _tmp0_); +#line 144 "mpv.vapi" + return result; +#line 1157 "playbin.c" +} + +static gboolean +mpv_event_property_parse_flag (mpv_event_property *self) +{ + void* _tmp0_; + gboolean result; +#line 153 "mpv.vapi" + _vala_return_val_if_fail ((*self).format == MPV_FORMAT_FLAG, "format == Format.FLAG", FALSE); +#line 156 "mpv.vapi" + _tmp0_ = (*self).data; +#line 156 "mpv.vapi" + result = (*((gint*) _tmp0_)) == 1; +#line 156 "mpv.vapi" + return result; +#line 1173 "playbin.c" +} + +static void +_vala_mpv_event_property_free (mpv_event_property* self) +{ +#line 207 "../src/playbin.vala" + (self); +#line 207 "../src/playbin.vala" + g_free (self); +#line 1183 "playbin.c" +} + +static mpv_event_end_file* +mpv_event_parse_end_file (mpv_event *self) +{ + void* _tmp0_; + mpv_event_end_file* result; +#line 127 "mpv.vapi" + _vala_return_val_if_fail ((*self).event_id == MPV_EVENT_END_FILE, "event_id == EventId.END_FILE", NULL); +#line 127 "mpv.vapi" + _vala_return_val_if_fail ((*self).error >= 0, "error >= 0", NULL); +#line 131 "mpv.vapi" + _tmp0_ = (*self).data; +#line 131 "mpv.vapi" + result = (mpv_event_end_file*) _tmp0_; +#line 131 "mpv.vapi" + return result; +#line 1201 "playbin.c" +} + +static void +mpv_event_end_file_copy (const mpv_event_end_file * self, + mpv_event_end_file * dest) +{ +#line 220 "../src/playbin.vala" + (*dest).reason = (*self).reason; +#line 220 "../src/playbin.vala" + (*dest).error = (*self).error; +#line 220 "../src/playbin.vala" + (*dest).playlist_entry_id = (*self).playlist_entry_id; +#line 220 "../src/playbin.vala" + (*dest).playlist_insert_num_entries = (*self).playlist_insert_num_entries; +#line 1216 "playbin.c" +} + +static mpv_event_end_file* +_mpv_event_end_file_dup (mpv_event_end_file* self) +{ + mpv_event_end_file* dup; +#line 220 "../src/playbin.vala" + dup = g_new0 (mpv_event_end_file, 1); +#line 220 "../src/playbin.vala" + mpv_event_end_file_copy (self, dup); +#line 220 "../src/playbin.vala" + return dup; +#line 1229 "playbin.c" +} + +static gpointer +__mpv_event_end_file_dup0 (gpointer self) +{ +#line 220 "../src/playbin.vala" + return self ? _mpv_event_end_file_dup (self) : NULL; +#line 1237 "playbin.c" +} + +static const char* +_mpv_end_file_reason_to_string (mpv_end_file_reason value) +{ +#line 221 "../src/playbin.vala" + switch (value) { +#line 221 "../src/playbin.vala" + case MPV_END_FILE_REASON_EOF: +#line 221 "../src/playbin.vala" + return "MPV_END_FILE_REASON_EOF"; +#line 221 "../src/playbin.vala" + case MPV_END_FILE_REASON_STOP: +#line 221 "../src/playbin.vala" + return "MPV_END_FILE_REASON_STOP"; +#line 221 "../src/playbin.vala" + case MPV_END_FILE_REASON_QUIT: +#line 221 "../src/playbin.vala" + return "MPV_END_FILE_REASON_QUIT"; +#line 221 "../src/playbin.vala" + case MPV_END_FILE_REASON_ERROR: +#line 221 "../src/playbin.vala" + return "MPV_END_FILE_REASON_ERROR"; +#line 221 "../src/playbin.vala" + case MPV_END_FILE_REASON_REDIRECT: +#line 221 "../src/playbin.vala" + return "MPV_END_FILE_REASON_REDIRECT"; +#line 1265 "playbin.c" + } +#line 221 "../src/playbin.vala" + return NULL; +#line 1269 "playbin.c" +} + +static void +_vala_mpv_event_end_file_free (mpv_event_end_file* self) +{ +#line 239 "../src/playbin.vala" + (self); +#line 239 "../src/playbin.vala" + g_free (self); +#line 1279 "playbin.c" +} + +static gboolean +__lambda5_ (Playbin* self) +{ + gboolean result; +#line 138 "../src/playbin.vala" + if (self->priv->is_handling_event) { +#line 139 "../src/playbin.vala" + g_warning ("playbin.vala:139: main thread mpv wakeup callback called twice"); +#line 140 "../src/playbin.vala" + result = FALSE; +#line 140 "../src/playbin.vala" + return result; +#line 1294 "playbin.c" + } +#line 142 "../src/playbin.vala" + self->priv->is_handling_event = TRUE; +#line 144 "../src/playbin.vala" + while (TRUE) { +#line 1300 "playbin.c" + mpv_event* event = NULL; + mpv_handle* _tmp0_; + mpv_event* _tmp1_; + mpv_event* _tmp2_; + mpv_event* _tmp3_; +#line 145 "../src/playbin.vala" + _tmp0_ = self->priv->mpv; +#line 145 "../src/playbin.vala" + _tmp1_ = __mpv_event_dup0 (mpv_wait_event (_tmp0_, 0.0)); +#line 145 "../src/playbin.vala" + event = _tmp1_; +#line 146 "../src/playbin.vala" + _tmp2_ = event; +#line 146 "../src/playbin.vala" + if ((*_tmp2_).event_id == MPV_EVENT_NONE) { +#line 146 "../src/playbin.vala" + __vala_mpv_event_free0 (event); +#line 146 "../src/playbin.vala" + break; +#line 1320 "playbin.c" + } +#line 148 "../src/playbin.vala" + _tmp3_ = event; +#line 148 "../src/playbin.vala" + switch ((*_tmp3_).event_id) { +#line 148 "../src/playbin.vala" + case MPV_EVENT_PROPERTY_CHANGE: +#line 1328 "playbin.c" + { + mpv_event_property* data = NULL; + mpv_event* _tmp4_; + mpv_event_property* _tmp5_; + mpv_event* _tmp6_; +#line 150 "../src/playbin.vala" + _tmp4_ = event; +#line 150 "../src/playbin.vala" + _tmp5_ = __mpv_event_property_dup0 (mpv_event_parse_property (_tmp4_)); +#line 150 "../src/playbin.vala" + data = _tmp5_; +#line 151 "../src/playbin.vala" + _tmp6_ = event; +#line 151 "../src/playbin.vala" + switch ((*_tmp6_).reply_userdata) { +#line 151 "../src/playbin.vala" + case 0: +#line 1346 "playbin.c" + { + mpv_event_property* _tmp7_; + const gchar* _tmp8_; + mpv_event_property* _tmp9_; +#line 153 "../src/playbin.vala" + _tmp7_ = data; +#line 153 "../src/playbin.vala" + _tmp8_ = (*_tmp7_).name; +#line 153 "../src/playbin.vala" + _vala_assert (g_strcmp0 (_tmp8_, "time-pos") == 0, "data.name == \"time-pos\""); +#line 154 "../src/playbin.vala" + _tmp9_ = data; +#line 154 "../src/playbin.vala" + if ((*_tmp9_).format == MPV_FORMAT_NONE) { +#line 155 "../src/playbin.vala" + playbin_set_position (self, 0.0); +#line 1363 "playbin.c" + } else { + mpv_event_property* _tmp10_; +#line 157 "../src/playbin.vala" + _tmp10_ = data; +#line 157 "../src/playbin.vala" + playbin_set_position (self, mpv_event_property_parse_double (_tmp10_)); +#line 1370 "playbin.c" + } +#line 159 "../src/playbin.vala" + break; +#line 1374 "playbin.c" + } +#line 151 "../src/playbin.vala" + case 1: +#line 1378 "playbin.c" + { + mpv_event_property* _tmp11_; + const gchar* _tmp12_; + mpv_event_property* _tmp13_; +#line 162 "../src/playbin.vala" + _tmp11_ = data; +#line 162 "../src/playbin.vala" + _tmp12_ = (*_tmp11_).name; +#line 162 "../src/playbin.vala" + _vala_assert (g_strcmp0 (_tmp12_, "duration") == 0, "data.name == \"duration\""); +#line 163 "../src/playbin.vala" + _tmp13_ = data; +#line 163 "../src/playbin.vala" + if ((*_tmp13_).format == MPV_FORMAT_NONE) { +#line 1393 "playbin.c" + } else { + mpv_event_property* _tmp14_; +#line 166 "../src/playbin.vala" + _tmp14_ = data; +#line 166 "../src/playbin.vala" + playbin_set_duration (self, mpv_event_property_parse_double (_tmp14_)); +#line 1400 "playbin.c" + } +#line 168 "../src/playbin.vala" + break; +#line 1404 "playbin.c" + } +#line 151 "../src/playbin.vala" + case 2: +#line 1408 "playbin.c" + { + mpv_event_property* _tmp15_; + const gchar* _tmp16_; + gint64 playlist_pos = 0LL; + mpv_event_property* _tmp17_; +#line 173 "../src/playbin.vala" + _tmp15_ = data; +#line 173 "../src/playbin.vala" + _tmp16_ = (*_tmp15_).name; +#line 173 "../src/playbin.vala" + _vala_assert (g_strcmp0 (_tmp16_, "playlist-pos") == 0, "data.name == \"playlist-pos\""); +#line 174 "../src/playbin.vala" + _tmp17_ = data; +#line 174 "../src/playbin.vala" + playlist_pos = mpv_event_property_parse_int64 (_tmp17_); +#line 175 "../src/playbin.vala" + if (playlist_pos < ((gint64) 0)) { +#line 1426 "playbin.c" + PlaybinState _tmp18_; + gint _tmp20_; +#line 176 "../src/playbin.vala" + _tmp18_ = self->priv->_state; +#line 176 "../src/playbin.vala" + if (_tmp18_ != PLAYBIN_STATE_STOPPED) { +#line 1433 "playbin.c" + gint _tmp19_; +#line 177 "../src/playbin.vala" + _tmp19_ = self->priv->_play_queue_position; +#line 177 "../src/playbin.vala" + g_error ("playbin.vala:177: mpv has no current playlist entry, but we think it's" \ +" index %d", _tmp19_); +#line 1439 "playbin.c" + } +#line 179 "../src/playbin.vala" + _tmp20_ = self->priv->_play_queue_position; +#line 179 "../src/playbin.vala" + _vala_assert (_tmp20_ < 0, "this.play_queue_position < 0"); +#line 1445 "playbin.c" + } else { + PlaybinState _tmp21_; + gint _tmp22_; +#line 181 "../src/playbin.vala" + _tmp21_ = self->priv->_state; +#line 181 "../src/playbin.vala" + if (_tmp21_ == PLAYBIN_STATE_STOPPED) { +#line 182 "../src/playbin.vala" + g_error ("playbin.vala:182: mpv is at playlist entry %d, but we're stopped", (gint) playlist_pos); +#line 1455 "playbin.c" + } +#line 184 "../src/playbin.vala" + _tmp22_ = self->priv->_play_queue_position; +#line 184 "../src/playbin.vala" + if (_tmp22_ != ((gint) playlist_pos)) { +#line 1461 "playbin.c" + gint _tmp23_; +#line 185 "../src/playbin.vala" + _tmp23_ = self->priv->_play_queue_position; +#line 185 "../src/playbin.vala" + g_error ("playbin.vala:185: mpv is at playlist entry %d, but we think it's %d", (gint) playlist_pos, _tmp23_); +#line 1467 "playbin.c" + } + } +#line 188 "../src/playbin.vala" + break; +#line 1472 "playbin.c" + } +#line 151 "../src/playbin.vala" + case 3: +#line 1476 "playbin.c" + { + mpv_event_property* _tmp24_; + const gchar* _tmp25_; + gboolean pause = FALSE; + mpv_event_property* _tmp26_; + gboolean _tmp27_ = FALSE; + gboolean _tmp29_ = FALSE; +#line 193 "../src/playbin.vala" + _tmp24_ = data; +#line 193 "../src/playbin.vala" + _tmp25_ = (*_tmp24_).name; +#line 193 "../src/playbin.vala" + _vala_assert (g_strcmp0 (_tmp25_, "pause") == 0, "data.name == \"pause\""); +#line 194 "../src/playbin.vala" + _tmp26_ = data; +#line 194 "../src/playbin.vala" + pause = mpv_event_property_parse_flag (_tmp26_); +#line 195 "../src/playbin.vala" + if (pause) { +#line 1496 "playbin.c" + PlaybinState _tmp28_; +#line 195 "../src/playbin.vala" + _tmp28_ = self->priv->_state; +#line 195 "../src/playbin.vala" + _tmp27_ = _tmp28_ != PLAYBIN_STATE_PAUSED; +#line 1502 "playbin.c" + } else { +#line 195 "../src/playbin.vala" + _tmp27_ = FALSE; +#line 1506 "playbin.c" + } +#line 195 "../src/playbin.vala" + if (_tmp27_) { +#line 196 "../src/playbin.vala" + g_error ("playbin.vala:196: %s", "mpv is paused, but we are @(this.state)"); +#line 1512 "playbin.c" + } +#line 198 "../src/playbin.vala" + if (!pause) { +#line 1516 "playbin.c" + PlaybinState _tmp30_; +#line 198 "../src/playbin.vala" + _tmp30_ = self->priv->_state; +#line 198 "../src/playbin.vala" + _tmp29_ = _tmp30_ == PLAYBIN_STATE_PAUSED; +#line 1522 "playbin.c" + } else { +#line 198 "../src/playbin.vala" + _tmp29_ = FALSE; +#line 1526 "playbin.c" + } +#line 198 "../src/playbin.vala" + if (_tmp29_) { +#line 199 "../src/playbin.vala" + g_error ("playbin.vala:199: mpv is not paused, but we are paused"); +#line 1532 "playbin.c" + } +#line 201 "../src/playbin.vala" + break; +#line 1536 "playbin.c" + } + default: + { +#line 204 "../src/playbin.vala" + _vala_assert (FALSE, "false"); +#line 205 "../src/playbin.vala" + break; +#line 1544 "playbin.c" + } + } +#line 207 "../src/playbin.vala" + __vala_mpv_event_property_free0 (data); +#line 207 "../src/playbin.vala" + break; +#line 1551 "playbin.c" + } +#line 148 "../src/playbin.vala" + case MPV_EVENT_START_FILE: +#line 1555 "playbin.c" + { + GListStore* _tmp31_; + gint _tmp32_; + GObject* _tmp33_; + PlaybinSong* _tmp34_; + gint64 _tmp35_; + gint64 _tmp36_; +#line 210 "../src/playbin.vala" + g_debug ("playbin.vala:210: START_FILE received"); +#line 214 "../src/playbin.vala" + _tmp31_ = self->priv->_play_queue; +#line 214 "../src/playbin.vala" + _tmp32_ = self->priv->_play_queue_position; +#line 214 "../src/playbin.vala" + _tmp33_ = g_list_model_get_item ((GListModel*) _tmp31_, (guint) _tmp32_); +#line 214 "../src/playbin.vala" + _tmp34_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp33_, TYPE_PLAYBIN_SONG, PlaybinSong); +#line 214 "../src/playbin.vala" + _tmp35_ = playbin_song_get_duration (_tmp34_); +#line 214 "../src/playbin.vala" + _tmp36_ = _tmp35_; +#line 214 "../src/playbin.vala" + playbin_set_duration (self, (gdouble) _tmp36_); +#line 214 "../src/playbin.vala" + _g_object_unref0 (_tmp34_); +#line 216 "../src/playbin.vala" + g_signal_emit (self, playbin_signals[PLAYBIN_NEW_TRACK_SIGNAL], 0); +#line 217 "../src/playbin.vala" + break; +#line 1585 "playbin.c" + } +#line 148 "../src/playbin.vala" + case MPV_EVENT_END_FILE: +#line 1589 "playbin.c" + { + mpv_event_end_file* data = NULL; + mpv_event* _tmp37_; + mpv_event_end_file* _tmp38_; + mpv_event_end_file* _tmp39_; + const gchar* _tmp40_; + gchar* _tmp41_; + gchar* _tmp42_; + mpv_event_end_file* _tmp43_; + mpv_event_end_file* _tmp46_; +#line 220 "../src/playbin.vala" + _tmp37_ = event; +#line 220 "../src/playbin.vala" + _tmp38_ = __mpv_event_end_file_dup0 (mpv_event_parse_end_file (_tmp37_)); +#line 220 "../src/playbin.vala" + data = _tmp38_; +#line 221 "../src/playbin.vala" + _tmp39_ = data; +#line 221 "../src/playbin.vala" + _tmp40_ = _mpv_end_file_reason_to_string ((*_tmp39_).reason); +#line 221 "../src/playbin.vala" + _tmp41_ = g_strconcat ("END_FILE received (reason: ", _tmp40_, ")", NULL); +#line 221 "../src/playbin.vala" + _tmp42_ = _tmp41_; +#line 221 "../src/playbin.vala" + g_debug ("playbin.vala:221: %s", _tmp42_); +#line 221 "../src/playbin.vala" + _g_free0 (_tmp42_); +#line 223 "../src/playbin.vala" + _tmp43_ = data; +#line 223 "../src/playbin.vala" + if ((*_tmp43_).error < 0) { +#line 1622 "playbin.c" + mpv_event_end_file* _tmp44_; + const gchar* _tmp45_; +#line 224 "../src/playbin.vala" + _tmp44_ = data; +#line 224 "../src/playbin.vala" + _tmp45_ = mpv_error_string ((*_tmp44_).error); +#line 224 "../src/playbin.vala" + g_warning ("playbin.vala:224: playback of track aborted: %s", _tmp45_); +#line 1631 "playbin.c" + } +#line 227 "../src/playbin.vala" + _tmp46_ = data; +#line 227 "../src/playbin.vala" + if ((*_tmp46_).reason == MPV_END_FILE_REASON_EOF) { +#line 1637 "playbin.c" + gint _tmp47_; + gint _tmp48_; + GListStore* _tmp49_; +#line 229 "../src/playbin.vala" + _tmp47_ = self->priv->_play_queue_position; +#line 229 "../src/playbin.vala" + playbin_set_play_queue_position (self, _tmp47_ + 1); +#line 231 "../src/playbin.vala" + _tmp48_ = self->priv->_play_queue_position; +#line 231 "../src/playbin.vala" + _tmp49_ = self->priv->_play_queue; +#line 231 "../src/playbin.vala" + if (((guint) _tmp48_) == g_list_model_get_n_items ((GListModel*) _tmp49_)) { +#line 233 "../src/playbin.vala" + playbin_set_state (self, PLAYBIN_STATE_STOPPED); +#line 234 "../src/playbin.vala" + playbin_set_play_queue_position (self, -1); +#line 235 "../src/playbin.vala" + g_signal_emit (self, playbin_signals[PLAYBIN_STOPPED_SIGNAL], 0); +#line 1657 "playbin.c" + } + } +#line 239 "../src/playbin.vala" + __vala_mpv_event_end_file_free0 (data); +#line 239 "../src/playbin.vala" + break; +#line 1664 "playbin.c" + } +#line 148 "../src/playbin.vala" + case MPV_EVENT_COMMAND_REPLY: +#line 1668 "playbin.c" + { + CommandCallback* cc = NULL; + mpv_event* _tmp50_; + mpv_event* _tmp51_; + CommandCallback* _tmp52_; + GSourceFunc _tmp53_; + gpointer _tmp53__target; +#line 242 "../src/playbin.vala" + _tmp50_ = event; +#line 242 "../src/playbin.vala" + cc = (CommandCallback*) (*_tmp50_).reply_userdata; +#line 243 "../src/playbin.vala" + _tmp51_ = event; +#line 243 "../src/playbin.vala" + (*cc).error = (gint) (*_tmp51_).error; +#line 244 "../src/playbin.vala" + _tmp52_ = cc; +#line 244 "../src/playbin.vala" + _tmp53_ = (*_tmp52_).callback; +#line 244 "../src/playbin.vala" + _tmp53__target = (*_tmp52_).callback_target; +#line 244 "../src/playbin.vala" + _tmp53_ (_tmp53__target); +#line 245 "../src/playbin.vala" + break; +#line 1694 "playbin.c" + } + default: + { +#line 249 "../src/playbin.vala" + break; +#line 1700 "playbin.c" + } + } +#line 144 "../src/playbin.vala" + __vala_mpv_event_free0 (event); +#line 1705 "playbin.c" + } +#line 253 "../src/playbin.vala" + self->priv->is_handling_event = FALSE; +#line 254 "../src/playbin.vala" + result = FALSE; +#line 254 "../src/playbin.vala" + return result; +#line 1713 "playbin.c" +} + +static gboolean +___lambda5__gsource_func (gpointer self) +{ + gboolean result; + result = __lambda5_ ((Playbin*) self); +#line 137 "../src/playbin.vala" + return result; +#line 1723 "playbin.c" +} + +static void +__lambda4_ (Playbin* self) +{ +#line 137 "../src/playbin.vala" + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda5__gsource_func, g_object_ref (self), g_object_unref); +#line 1731 "playbin.c" +} + +static void +___lambda4__mpv_wakeup_callback (gpointer self) +{ +#line 136 "../src/playbin.vala" + __lambda4_ ((Playbin*) self); +#line 1739 "playbin.c" +} + +Playbin* +playbin_construct (GType object_type) +{ + Playbin * self = NULL; + mpv_handle* _tmp0_; + mpv_handle* _tmp1_; + mpv_handle* _tmp2_; + mpv_handle* _tmp3_; + mpv_handle* _tmp4_; + mpv_handle* _tmp5_; + mpv_handle* _tmp6_; + mpv_handle* _tmp7_; + mpv_handle* _tmp8_; + mpv_handle* _tmp9_; + mpv_handle* _tmp10_; +#line 124 "../src/playbin.vala" + self = (Playbin*) g_object_new (object_type, NULL); +#line 125 "../src/playbin.vala" + _tmp0_ = self->priv->mpv; +#line 125 "../src/playbin.vala" + _vala_assert (mpv_initialize (_tmp0_) >= 0, "this.mpv.initialize () >= 0"); +#line 126 "../src/playbin.vala" + _tmp1_ = self->priv->mpv; +#line 126 "../src/playbin.vala" + _vala_assert (mpv_set_property_string (_tmp1_, "audio-client-name", "audrey") >= 0, "this.mpv.set_property_string (\"audio-client-name\", \"audrey\") >= 0"); +#line 127 "../src/playbin.vala" + _tmp2_ = self->priv->mpv; +#line 127 "../src/playbin.vala" + _vala_assert (mpv_set_property_string (_tmp2_, "user-agent", AUDREY_CONST_user_agent) >= 0, "this.mpv.set_property_string (\"user-agent\", Audrey.Const.user_agent) >= 0"); +#line 128 "../src/playbin.vala" + _tmp3_ = self->priv->mpv; +#line 128 "../src/playbin.vala" + _vala_assert (mpv_set_property_string (_tmp3_, "video", "no") >= 0, "this.mpv.set_property_string (\"video\", \"no\") >= 0"); +#line 129 "../src/playbin.vala" + _tmp4_ = self->priv->mpv; +#line 129 "../src/playbin.vala" + _vala_assert (mpv_set_property_string (_tmp4_, "prefetch-playlist", "yes") >= 0, "this.mpv.set_property_string (\"prefetch-playlist\", \"yes\") >= 0"); +#line 130 "../src/playbin.vala" + _tmp5_ = self->priv->mpv; +#line 130 "../src/playbin.vala" + _vala_assert (mpv_set_property_string (_tmp5_, "gapless-audio", "yes") >= 0, "this.mpv.set_property_string (\"gapless-audio\", \"yes\") >= 0"); +#line 131 "../src/playbin.vala" + _tmp6_ = self->priv->mpv; +#line 131 "../src/playbin.vala" + _vala_assert (mpv_observe_property (_tmp6_, (guint64) 0, "time-pos", MPV_FORMAT_DOUBLE) >= 0, "this.mpv.observe_property (0, \"time-pos\", Mpv.Format.DOUBLE) >= 0"); +#line 132 "../src/playbin.vala" + _tmp7_ = self->priv->mpv; +#line 132 "../src/playbin.vala" + _vala_assert (mpv_observe_property (_tmp7_, (guint64) 1, "duration", MPV_FORMAT_DOUBLE) >= 0, "this.mpv.observe_property (1, \"duration\", Mpv.Format.DOUBLE) >= 0"); +#line 133 "../src/playbin.vala" + _tmp8_ = self->priv->mpv; +#line 133 "../src/playbin.vala" + _vala_assert (mpv_observe_property (_tmp8_, (guint64) 2, "playlist-pos", MPV_FORMAT_INT64) >= 0, "this.mpv.observe_property (2, \"playlist-pos\", Mpv.Format.INT64) >= 0"); +#line 134 "../src/playbin.vala" + _tmp9_ = self->priv->mpv; +#line 134 "../src/playbin.vala" + _vala_assert (mpv_observe_property (_tmp9_, (guint64) 3, "pause", MPV_FORMAT_FLAG) >= 0, "this.mpv.observe_property (3, \"pause\", Mpv.Format.FLAG) >= 0"); +#line 136 "../src/playbin.vala" + _tmp10_ = self->priv->mpv; +#line 136 "../src/playbin.vala" + mpv_set_wakeup_callback (_tmp10_, ___lambda4__mpv_wakeup_callback, self); +#line 124 "../src/playbin.vala" + return self; +#line 1805 "playbin.c" +} + +Playbin* +playbin_new (void) +{ +#line 124 "../src/playbin.vala" + return playbin_construct (TYPE_PLAYBIN); +#line 1813 "playbin.c" +} + +static gchar* +double_to_string (gdouble self) +{ + gchar* _tmp0_; + gchar* _tmp1_; + gint _tmp1__length1; + const gchar* _tmp2_; + gchar* _tmp3_; + gchar* _tmp4_; + gchar* result; +#line 997 "glib-2.0.vapi" + _tmp0_ = g_new0 (gchar, G_ASCII_DTOSTR_BUF_SIZE); +#line 997 "glib-2.0.vapi" + _tmp1_ = _tmp0_; +#line 997 "glib-2.0.vapi" + _tmp1__length1 = G_ASCII_DTOSTR_BUF_SIZE; +#line 997 "glib-2.0.vapi" + _tmp2_ = g_ascii_dtostr (_tmp1_, (gint) G_ASCII_DTOSTR_BUF_SIZE, self); +#line 997 "glib-2.0.vapi" + _tmp3_ = g_strdup (_tmp2_); +#line 997 "glib-2.0.vapi" + _tmp4_ = _tmp3_; +#line 997 "glib-2.0.vapi" + _tmp1_ = (g_free (_tmp1_), NULL); +#line 997 "glib-2.0.vapi" + result = _tmp4_; +#line 997 "glib-2.0.vapi" + return result; +#line 1844 "playbin.c" +} + +void +playbin_seek (Playbin* self, + gdouble position) +{ + mpv_error rc = 0; + mpv_handle* _tmp0_; + gchar* _tmp1_; + gchar* _tmp2_; + gchar* _tmp3_; + gchar** _tmp4_; + gchar** _tmp5_; + gint _tmp5__length1; + mpv_error _tmp6_; +#line 259 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 260 "../src/playbin.vala" + _tmp0_ = self->priv->mpv; +#line 260 "../src/playbin.vala" + _tmp1_ = g_strdup ("seek"); +#line 260 "../src/playbin.vala" + _tmp2_ = double_to_string (position); +#line 260 "../src/playbin.vala" + _tmp3_ = g_strdup ("absolute"); +#line 260 "../src/playbin.vala" + _tmp4_ = g_new0 (gchar*, 3 + 1); +#line 260 "../src/playbin.vala" + _tmp4_[0] = _tmp1_; +#line 260 "../src/playbin.vala" + _tmp4_[1] = _tmp2_; +#line 260 "../src/playbin.vala" + _tmp4_[2] = _tmp3_; +#line 260 "../src/playbin.vala" + _tmp5_ = _tmp4_; +#line 260 "../src/playbin.vala" + _tmp5__length1 = 3; +#line 260 "../src/playbin.vala" + _tmp6_ = mpv_command (_tmp0_, _tmp5_); +#line 260 "../src/playbin.vala" + _tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_free), NULL); +#line 260 "../src/playbin.vala" + rc = _tmp6_; +#line 261 "../src/playbin.vala" + if (rc < 0) { +#line 1890 "playbin.c" + gchar* _tmp7_; + gchar* _tmp8_; + const gchar* _tmp9_; + gchar* _tmp10_; + gchar* _tmp11_; +#line 262 "../src/playbin.vala" + _tmp7_ = double_to_string (position); +#line 262 "../src/playbin.vala" + _tmp8_ = _tmp7_; +#line 262 "../src/playbin.vala" + _tmp9_ = mpv_error_string (rc); +#line 262 "../src/playbin.vala" + _tmp10_ = g_strconcat ("could not seek to ", _tmp8_, ": ", _tmp9_, NULL); +#line 262 "../src/playbin.vala" + _tmp11_ = _tmp10_; +#line 262 "../src/playbin.vala" + g_warning ("playbin.vala:262: %s", _tmp11_); +#line 262 "../src/playbin.vala" + _g_free0 (_tmp11_); +#line 262 "../src/playbin.vala" + _g_free0 (_tmp8_); +#line 1912 "playbin.c" + } else { +#line 264 "../src/playbin.vala" + playbin_set_position (self, position); +#line 1916 "playbin.c" + } +} + +void +playbin_select_track (Playbin* self, + guint position) +{ + GListModel* _tmp0_; + GListModel* _tmp1_; + mpv_handle* _tmp2_; + gchar* _tmp3_; + gchar* _tmp4_; + gchar** _tmp5_; + gchar** _tmp6_; + gint _tmp6__length1; +#line 269 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 269 "../src/playbin.vala" + _tmp0_ = playbin_get_play_queue (self); +#line 269 "../src/playbin.vala" + _tmp1_ = _tmp0_; +#line 269 "../src/playbin.vala" + _vala_return_if_fail (position < g_list_model_get_n_items (_tmp1_), "position < this.play_queue.get_n_items ()"); +#line 272 "../src/playbin.vala" + _tmp2_ = self->priv->mpv; +#line 272 "../src/playbin.vala" + _tmp3_ = g_strdup ("playlist-play-index"); +#line 272 "../src/playbin.vala" + _tmp4_ = g_strdup_printf ("%u", position); +#line 272 "../src/playbin.vala" + _tmp5_ = g_new0 (gchar*, 2 + 1); +#line 272 "../src/playbin.vala" + _tmp5_[0] = _tmp3_; +#line 272 "../src/playbin.vala" + _tmp5_[1] = _tmp4_; +#line 272 "../src/playbin.vala" + _tmp6_ = _tmp5_; +#line 272 "../src/playbin.vala" + _tmp6__length1 = 2; +#line 272 "../src/playbin.vala" + _vala_assert (mpv_command (_tmp2_, _tmp6_) >= 0, "this.mpv.command ({\"playlist-play-index\", position.to_string ()}) >= 0"); +#line 272 "../src/playbin.vala" + _tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL); +#line 273 "../src/playbin.vala" + playbin_set_play_queue_position (self, (gint) position); +#line 274 "../src/playbin.vala" + playbin_set_state (self, PLAYBIN_STATE_PLAYING); +#line 275 "../src/playbin.vala" + playbin_play (self); +#line 1966 "playbin.c" +} + +static mpv_error +mpv_handle_set_property_flag (mpv_handle* self, + const gchar* name, + gboolean value) +{ + gint _tmp0_ = 0; + gint flag = 0; + mpv_error result; +#line 60 "mpv.vapi" + g_return_val_if_fail (self != NULL, 0); +#line 60 "mpv.vapi" + g_return_val_if_fail (name != NULL, 0); +#line 61 "mpv.vapi" + if (value) { +#line 61 "mpv.vapi" + _tmp0_ = 1; +#line 1985 "playbin.c" + } else { +#line 61 "mpv.vapi" + _tmp0_ = 0; +#line 1989 "playbin.c" + } +#line 61 "mpv.vapi" + flag = _tmp0_; +#line 62 "mpv.vapi" + result = mpv_set_property (self, name, MPV_FORMAT_FLAG, &flag); +#line 62 "mpv.vapi" + return result; +#line 1997 "playbin.c" +} + +static const gchar* +string_to_string (const gchar* self) +{ + const gchar* result; +#line 1589 "glib-2.0.vapi" + g_return_val_if_fail (self != NULL, NULL); +#line 1590 "glib-2.0.vapi" + result = self; +#line 1590 "glib-2.0.vapi" + return result; +#line 2010 "playbin.c" +} + +void +playbin_pause (Playbin* self) +{ + PlaybinState _tmp0_; + mpv_error ret = 0; + mpv_handle* _tmp1_; +#line 278 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 279 "../src/playbin.vala" + _tmp0_ = self->priv->_state; +#line 279 "../src/playbin.vala" + _vala_assert (_tmp0_ != PLAYBIN_STATE_STOPPED, "this.state != PlaybinState.STOPPED"); +#line 280 "../src/playbin.vala" + playbin_set_state (self, PLAYBIN_STATE_PAUSED); +#line 281 "../src/playbin.vala" + g_debug ("playbin.vala:281: setting state to paused"); +#line 283 "../src/playbin.vala" + _tmp1_ = self->priv->mpv; +#line 283 "../src/playbin.vala" + ret = mpv_handle_set_property_flag (_tmp1_, "pause", TRUE); +#line 284 "../src/playbin.vala" + if (ret != 0) { +#line 2035 "playbin.c" + const gchar* _tmp2_; + const gchar* _tmp3_; + const gchar* _tmp4_; + gchar* _tmp5_; + gchar* _tmp6_; +#line 285 "../src/playbin.vala" + _tmp2_ = mpv_error_string (ret); +#line 285 "../src/playbin.vala" + _tmp3_ = mpv_error_string (ret); +#line 285 "../src/playbin.vala" + _tmp4_ = string_to_string (_tmp3_); +#line 285 "../src/playbin.vala" + _tmp5_ = g_strconcat ("failed to set state to paused (", _tmp2_, "): ", _tmp4_, NULL); +#line 285 "../src/playbin.vala" + _tmp6_ = _tmp5_; +#line 285 "../src/playbin.vala" + g_debug ("playbin.vala:285: %s", _tmp6_); +#line 285 "../src/playbin.vala" + _g_free0 (_tmp6_); +#line 2055 "playbin.c" + } +} + +void +playbin_play (Playbin* self) +{ + PlaybinState _tmp0_; +#line 289 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 290 "../src/playbin.vala" + _tmp0_ = self->priv->_state; +#line 290 "../src/playbin.vala" + if (_tmp0_ == PLAYBIN_STATE_STOPPED) { +#line 2069 "playbin.c" + GListStore* _tmp1_; +#line 293 "../src/playbin.vala" + _tmp1_ = self->priv->_play_queue; +#line 293 "../src/playbin.vala" + _vala_assert (g_list_model_get_n_items ((GListModel*) _tmp1_) > ((guint) 0), "this._play_queue.get_n_items () > 0"); +#line 294 "../src/playbin.vala" + playbin_select_track (self, (guint) 0); +#line 2077 "playbin.c" + } else { + mpv_error ret = 0; + mpv_handle* _tmp2_; +#line 296 "../src/playbin.vala" + playbin_set_state (self, PLAYBIN_STATE_PLAYING); +#line 297 "../src/playbin.vala" + g_debug ("playbin.vala:297: setting state to playing"); +#line 298 "../src/playbin.vala" + _tmp2_ = self->priv->mpv; +#line 298 "../src/playbin.vala" + ret = mpv_handle_set_property_flag (_tmp2_, "pause", FALSE); +#line 299 "../src/playbin.vala" + if (ret != 0) { +#line 2091 "playbin.c" + const gchar* _tmp3_; + const gchar* _tmp4_; + const gchar* _tmp5_; + gchar* _tmp6_; + gchar* _tmp7_; +#line 300 "../src/playbin.vala" + _tmp3_ = mpv_error_string (ret); +#line 300 "../src/playbin.vala" + _tmp4_ = mpv_error_string (ret); +#line 300 "../src/playbin.vala" + _tmp5_ = string_to_string (_tmp4_); +#line 300 "../src/playbin.vala" + _tmp6_ = g_strconcat ("failed to set state to playing (", _tmp3_, "): ", _tmp5_, NULL); +#line 300 "../src/playbin.vala" + _tmp7_ = _tmp6_; +#line 300 "../src/playbin.vala" + g_debug ("playbin.vala:300: %s", _tmp7_); +#line 300 "../src/playbin.vala" + _g_free0 (_tmp7_); +#line 2111 "playbin.c" + } + } +} + +void +playbin_go_to_next_track (Playbin* self) +{ + PlaybinState _tmp0_; + gint _tmp1_; + GListStore* _tmp2_; +#line 305 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 305 "../src/playbin.vala" + _tmp0_ = self->priv->_state; +#line 305 "../src/playbin.vala" + _vala_return_if_fail (_tmp0_ != PLAYBIN_STATE_STOPPED, "this.state != PlaybinState.STOPPED"); +#line 308 "../src/playbin.vala" + _tmp1_ = self->priv->_play_queue_position; +#line 308 "../src/playbin.vala" + _tmp2_ = self->priv->_play_queue; +#line 308 "../src/playbin.vala" + if (((guint) (_tmp1_ + 1)) < g_list_model_get_n_items ((GListModel*) _tmp2_)) { +#line 2134 "playbin.c" + gint _tmp3_; + mpv_handle* _tmp4_; + gchar* _tmp5_; + gchar** _tmp6_; + gchar** _tmp7_; + gint _tmp7__length1; +#line 309 "../src/playbin.vala" + _tmp3_ = self->priv->_play_queue_position; +#line 309 "../src/playbin.vala" + playbin_set_play_queue_position (self, _tmp3_ + 1); +#line 310 "../src/playbin.vala" + _tmp4_ = self->priv->mpv; +#line 310 "../src/playbin.vala" + _tmp5_ = g_strdup ("playlist-next-playlist"); +#line 310 "../src/playbin.vala" + _tmp6_ = g_new0 (gchar*, 1 + 1); +#line 310 "../src/playbin.vala" + _tmp6_[0] = _tmp5_; +#line 310 "../src/playbin.vala" + _tmp7_ = _tmp6_; +#line 310 "../src/playbin.vala" + _tmp7__length1 = 1; +#line 310 "../src/playbin.vala" + _vala_assert (mpv_command (_tmp4_, _tmp7_) >= 0, "this.mpv.command ({\"playlist-next-playlist\"}) >= 0"); +#line 310 "../src/playbin.vala" + _tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_free), NULL); +#line 2161 "playbin.c" + } else { +#line 312 "../src/playbin.vala" + g_warning ("playbin.vala:312: tried to skip forward at end of play queue, ignoring"); +#line 2165 "playbin.c" + } +} + +void +playbin_go_to_prev_track (Playbin* self) +{ + PlaybinState _tmp0_; + gint _tmp1_; +#line 316 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 316 "../src/playbin.vala" + _tmp0_ = self->priv->_state; +#line 316 "../src/playbin.vala" + _vala_return_if_fail (_tmp0_ != PLAYBIN_STATE_STOPPED, "this.state != PlaybinState.STOPPED"); +#line 319 "../src/playbin.vala" + _tmp1_ = self->priv->_play_queue_position; +#line 319 "../src/playbin.vala" + if (_tmp1_ > 0) { +#line 2184 "playbin.c" + gint _tmp2_; + mpv_handle* _tmp3_; + gchar* _tmp4_; + gchar** _tmp5_; + gchar** _tmp6_; + gint _tmp6__length1; +#line 320 "../src/playbin.vala" + _tmp2_ = self->priv->_play_queue_position; +#line 320 "../src/playbin.vala" + playbin_set_play_queue_position (self, _tmp2_ - 1); +#line 321 "../src/playbin.vala" + _tmp3_ = self->priv->mpv; +#line 321 "../src/playbin.vala" + _tmp4_ = g_strdup ("playlist-prev-playlist"); +#line 321 "../src/playbin.vala" + _tmp5_ = g_new0 (gchar*, 1 + 1); +#line 321 "../src/playbin.vala" + _tmp5_[0] = _tmp4_; +#line 321 "../src/playbin.vala" + _tmp6_ = _tmp5_; +#line 321 "../src/playbin.vala" + _tmp6__length1 = 1; +#line 321 "../src/playbin.vala" + _vala_assert (mpv_command (_tmp3_, _tmp6_) >= 0, "this.mpv.command ({\"playlist-prev-playlist\"}) >= 0"); +#line 321 "../src/playbin.vala" + _tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL); +#line 2211 "playbin.c" + } else { +#line 323 "../src/playbin.vala" + g_warning ("playbin.vala:323: tried to skip to prev track at start of play queue, " \ +"ignoring"); +#line 2215 "playbin.c" + } +} + +void +playbin_remove_track (Playbin* self, + guint position) +{ + GListStore* _tmp0_; + mpv_handle* _tmp1_; + gchar* _tmp2_; + gchar* _tmp3_; + gchar** _tmp4_; + gchar** _tmp5_; + gint _tmp5__length1; + GListStore* _tmp6_; + guint _tmp7_; + gint _tmp8_; + gint _tmp10_; + GListStore* _tmp11_; +#line 327 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 327 "../src/playbin.vala" + _tmp0_ = self->priv->_play_queue; +#line 327 "../src/playbin.vala" + _vala_return_if_fail (position < g_list_model_get_n_items ((GListModel*) _tmp0_), "position < this._play_queue.get_n_items ()"); +#line 330 "../src/playbin.vala" + _tmp1_ = self->priv->mpv; +#line 330 "../src/playbin.vala" + _tmp2_ = g_strdup ("playlist-remove"); +#line 330 "../src/playbin.vala" + _tmp3_ = g_strdup_printf ("%u", position); +#line 330 "../src/playbin.vala" + _tmp4_ = g_new0 (gchar*, 2 + 1); +#line 330 "../src/playbin.vala" + _tmp4_[0] = _tmp2_; +#line 330 "../src/playbin.vala" + _tmp4_[1] = _tmp3_; +#line 330 "../src/playbin.vala" + _tmp5_ = _tmp4_; +#line 330 "../src/playbin.vala" + _tmp5__length1 = 2; +#line 330 "../src/playbin.vala" + _vala_assert (mpv_command (_tmp1_, _tmp5_) >= 0, "this.mpv.command({\"playlist-remove\", position.to_string ()}) >= 0"); +#line 330 "../src/playbin.vala" + _tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_free), NULL); +#line 331 "../src/playbin.vala" + _tmp6_ = self->priv->_play_queue; +#line 331 "../src/playbin.vala" + g_list_store_remove (_tmp6_, position); +#line 332 "../src/playbin.vala" + _tmp7_ = self->priv->_play_queue_length; +#line 332 "../src/playbin.vala" + playbin_set_play_queue_length (self, _tmp7_ - 1); +#line 333 "../src/playbin.vala" + _tmp8_ = self->priv->_play_queue_position; +#line 333 "../src/playbin.vala" + if (((guint) _tmp8_) > position) { +#line 2273 "playbin.c" + gint _tmp9_; +#line 333 "../src/playbin.vala" + _tmp9_ = self->priv->_play_queue_position; +#line 333 "../src/playbin.vala" + playbin_set_play_queue_position (self, _tmp9_ - 1); +#line 2279 "playbin.c" + } +#line 334 "../src/playbin.vala" + _tmp10_ = self->priv->_play_queue_position; +#line 334 "../src/playbin.vala" + _tmp11_ = self->priv->_play_queue; +#line 334 "../src/playbin.vala" + if (((guint) _tmp10_) == g_list_model_get_n_items ((GListModel*) _tmp11_)) { +#line 336 "../src/playbin.vala" + playbin_set_state (self, PLAYBIN_STATE_STOPPED); +#line 337 "../src/playbin.vala" + playbin_set_play_queue_position (self, -1); +#line 338 "../src/playbin.vala" + g_signal_emit (self, playbin_signals[PLAYBIN_STOPPED_SIGNAL], 0); +#line 2293 "playbin.c" + } +} + +void +playbin_clear (Playbin* self) +{ + mpv_handle* _tmp0_; + gchar* _tmp1_; + gchar** _tmp2_; + gchar** _tmp3_; + gint _tmp3__length1; + PlaybinState _tmp4_; + GListStore* _tmp10_; +#line 342 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 343 "../src/playbin.vala" + _tmp0_ = self->priv->mpv; +#line 343 "../src/playbin.vala" + _tmp1_ = g_strdup ("playlist-clear"); +#line 343 "../src/playbin.vala" + _tmp2_ = g_new0 (gchar*, 1 + 1); +#line 343 "../src/playbin.vala" + _tmp2_[0] = _tmp1_; +#line 343 "../src/playbin.vala" + _tmp3_ = _tmp2_; +#line 343 "../src/playbin.vala" + _tmp3__length1 = 1; +#line 343 "../src/playbin.vala" + _vala_assert (mpv_command (_tmp0_, _tmp3_) >= 0, "this.mpv.command({\"playlist-clear\"}) >= 0"); +#line 343 "../src/playbin.vala" + _tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL); +#line 344 "../src/playbin.vala" + _tmp4_ = self->priv->_state; +#line 344 "../src/playbin.vala" + if (_tmp4_ != PLAYBIN_STATE_STOPPED) { +#line 2329 "playbin.c" + mpv_handle* _tmp5_; + gchar* _tmp6_; + gchar* _tmp7_; + gchar** _tmp8_; + gchar** _tmp9_; + gint _tmp9__length1; +#line 345 "../src/playbin.vala" + _tmp5_ = self->priv->mpv; +#line 345 "../src/playbin.vala" + _tmp6_ = g_strdup ("playlist-remove"); +#line 345 "../src/playbin.vala" + _tmp7_ = g_strdup ("current"); +#line 345 "../src/playbin.vala" + _tmp8_ = g_new0 (gchar*, 2 + 1); +#line 345 "../src/playbin.vala" + _tmp8_[0] = _tmp6_; +#line 345 "../src/playbin.vala" + _tmp8_[1] = _tmp7_; +#line 345 "../src/playbin.vala" + _tmp9_ = _tmp8_; +#line 345 "../src/playbin.vala" + _tmp9__length1 = 2; +#line 345 "../src/playbin.vala" + _vala_assert (mpv_command (_tmp5_, _tmp9_) >= 0, "this.mpv.command({\"playlist-remove\", \"current\"}) >= 0"); +#line 345 "../src/playbin.vala" + _tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (GDestroyNotify) g_free), NULL); +#line 2356 "playbin.c" + } +#line 347 "../src/playbin.vala" + playbin_set_state (self, PLAYBIN_STATE_STOPPED); +#line 348 "../src/playbin.vala" + _tmp10_ = self->priv->_play_queue; +#line 348 "../src/playbin.vala" + g_list_store_remove_all (_tmp10_); +#line 349 "../src/playbin.vala" + playbin_set_play_queue_length (self, (guint) 0); +#line 350 "../src/playbin.vala" + playbin_set_play_queue_position (self, -1); +#line 352 "../src/playbin.vala" + g_signal_emit (self, playbin_signals[PLAYBIN_STOPPED_SIGNAL], 0); +#line 2370 "playbin.c" +} + +void +playbin_append_track (Playbin* self, + SubsonicSong* song) +{ + mpv_handle* _tmp0_; + gchar* _tmp1_; + SubsonicClient* _tmp2_; + SubsonicSong _tmp3_; + const gchar* _tmp4_; + gchar* _tmp5_; + gchar* _tmp6_; + gchar** _tmp7_; + gchar** _tmp8_; + gint _tmp8__length1; + GListStore* _tmp9_; + SubsonicClient* _tmp10_; + SubsonicSong _tmp11_; + PlaybinSong* _tmp12_; + PlaybinSong* _tmp13_; + guint _tmp14_; +#line 355 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 355 "../src/playbin.vala" + g_return_if_fail (song != NULL); +#line 356 "../src/playbin.vala" + _tmp0_ = self->priv->mpv; +#line 356 "../src/playbin.vala" + _tmp1_ = g_strdup ("loadfile"); +#line 356 "../src/playbin.vala" + _tmp2_ = self->priv->_api; +#line 356 "../src/playbin.vala" + _tmp3_ = *song; +#line 356 "../src/playbin.vala" + _tmp4_ = _tmp3_.id; +#line 356 "../src/playbin.vala" + _tmp5_ = subsonic_client_stream_uri (_tmp2_, _tmp4_); +#line 356 "../src/playbin.vala" + _tmp6_ = g_strdup ("append"); +#line 356 "../src/playbin.vala" + _tmp7_ = g_new0 (gchar*, 3 + 1); +#line 356 "../src/playbin.vala" + _tmp7_[0] = _tmp1_; +#line 356 "../src/playbin.vala" + _tmp7_[1] = _tmp5_; +#line 356 "../src/playbin.vala" + _tmp7_[2] = _tmp6_; +#line 356 "../src/playbin.vala" + _tmp8_ = _tmp7_; +#line 356 "../src/playbin.vala" + _tmp8__length1 = 3; +#line 356 "../src/playbin.vala" + _vala_assert (mpv_command (_tmp0_, _tmp8_) >= 0, "this.mpv.command ({ \"loadfile\", this.api.stream_uri (song.id), \"append\", }) >= 0"); +#line 356 "../src/playbin.vala" + _tmp8_ = (_vala_array_free (_tmp8_, _tmp8__length1, (GDestroyNotify) g_free), NULL); +#line 361 "../src/playbin.vala" + _tmp9_ = self->priv->_play_queue; +#line 361 "../src/playbin.vala" + _tmp10_ = self->priv->_api; +#line 361 "../src/playbin.vala" + _tmp11_ = *song; +#line 361 "../src/playbin.vala" + _tmp12_ = playbin_song_new (_tmp10_, &_tmp11_); +#line 361 "../src/playbin.vala" + _tmp13_ = _tmp12_; +#line 361 "../src/playbin.vala" + g_list_store_append (_tmp9_, (GObject*) _tmp13_); +#line 361 "../src/playbin.vala" + _g_object_unref0 (_tmp13_); +#line 362 "../src/playbin.vala" + _tmp14_ = self->priv->_play_queue_length; +#line 362 "../src/playbin.vala" + playbin_set_play_queue_length (self, _tmp14_ + 1); +#line 2445 "playbin.c" +} + +static void +playbin_append_track_async_data_free (gpointer _data) +{ + PlaybinAppendTrackAsyncData* _data_; + _data_ = _data; +#line 62 "../src/playbin.vala" + subsonic_song_destroy (&_data_->song); +#line 62 "../src/playbin.vala" + _g_object_unref0 (_data_->self); +#line 62 "../src/playbin.vala" + g_slice_free (PlaybinAppendTrackAsyncData, _data_); +#line 2459 "playbin.c" +} + +void +playbin_append_track_async (Playbin* self, + SubsonicSong* song, + GAsyncReadyCallback _callback_, + gpointer _user_data_) +{ + PlaybinAppendTrackAsyncData* _data_; + Playbin* _tmp0_; + SubsonicSong _tmp1_; + SubsonicSong _tmp2_; + SubsonicSong _tmp3_ = {0}; +#line 62 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 62 "../src/playbin.vala" + g_return_if_fail (song != NULL); +#line 62 "../src/playbin.vala" + _data_ = g_slice_new0 (PlaybinAppendTrackAsyncData); +#line 62 "../src/playbin.vala" + _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_); +#line 62 "../src/playbin.vala" + g_task_set_task_data (_data_->_async_result, _data_, playbin_append_track_async_data_free); +#line 62 "../src/playbin.vala" + _tmp0_ = _g_object_ref0 (self); +#line 62 "../src/playbin.vala" + _data_->self = _tmp0_; +#line 62 "../src/playbin.vala" + _tmp1_ = *song; +#line 62 "../src/playbin.vala" + _tmp2_ = _tmp1_; +#line 62 "../src/playbin.vala" + subsonic_song_copy (&_tmp2_, &_tmp3_); +#line 62 "../src/playbin.vala" + subsonic_song_destroy (&_data_->song); +#line 62 "../src/playbin.vala" + _data_->song = _tmp3_; +#line 62 "../src/playbin.vala" + playbin_append_track_async_co (_data_); +#line 2499 "playbin.c" +} + +void +playbin_append_track_finish (Playbin* self, + GAsyncResult* _res_) +{ + PlaybinAppendTrackAsyncData* _data_; +#line 62 "../src/playbin.vala" + _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL); +#line 2509 "playbin.c" +} + +static void +playbin_append_track_async_ready (GObject* source_object, + GAsyncResult* _res_, + gpointer _user_data_) +{ + PlaybinAppendTrackAsyncData* _data_; +#line 366 "../src/playbin.vala" + _data_ = _user_data_; +#line 366 "../src/playbin.vala" + _data_->_source_object_ = source_object; +#line 366 "../src/playbin.vala" + _data_->_res_ = _res_; +#line 366 "../src/playbin.vala" + playbin_append_track_async_co (_data_); +#line 2526 "playbin.c" +} + +static gboolean +playbin_append_track_async_co (PlaybinAppendTrackAsyncData* _data_) +{ +#line 365 "../src/playbin.vala" + switch (_data_->_state_) { +#line 365 "../src/playbin.vala" + case 0: +#line 2536 "playbin.c" + goto _state_0; +#line 365 "../src/playbin.vala" + case 1: +#line 2540 "playbin.c" + goto _state_1; + default: +#line 365 "../src/playbin.vala" + g_assert_not_reached (); +#line 2545 "playbin.c" + } + _state_0: +#line 366 "../src/playbin.vala" + _data_->_tmp0_ = g_strdup ("loadfile"); +#line 366 "../src/playbin.vala" + _data_->_tmp1_ = _data_->self->priv->_api; +#line 366 "../src/playbin.vala" + _data_->_tmp2_ = _data_->song; +#line 366 "../src/playbin.vala" + _data_->_tmp3_ = _data_->_tmp2_.id; +#line 366 "../src/playbin.vala" + _data_->_tmp4_ = subsonic_client_stream_uri (_data_->_tmp1_, _data_->_tmp3_); +#line 366 "../src/playbin.vala" + _data_->_tmp5_ = g_strdup ("append"); +#line 366 "../src/playbin.vala" + _data_->_tmp6_ = g_new0 (gchar*, 3 + 1); +#line 366 "../src/playbin.vala" + _data_->_tmp6_[0] = _data_->_tmp0_; +#line 366 "../src/playbin.vala" + _data_->_tmp6_[1] = _data_->_tmp4_; +#line 366 "../src/playbin.vala" + _data_->_tmp6_[2] = _data_->_tmp5_; +#line 366 "../src/playbin.vala" + _data_->_tmp7_ = _data_->_tmp6_; +#line 366 "../src/playbin.vala" + _data_->_tmp7__length1 = 3; +#line 366 "../src/playbin.vala" + _data_->_state_ = 1; +#line 366 "../src/playbin.vala" + playbin_mpv_command_async (_data_->self, _data_->_tmp7_, (gint) 3, playbin_append_track_async_ready, _data_); +#line 366 "../src/playbin.vala" + return FALSE; +#line 2578 "playbin.c" + _state_1: +#line 366 "../src/playbin.vala" + _data_->_tmp8_ = playbin_mpv_command_finish (_data_->self, _data_->_res_); +#line 366 "../src/playbin.vala" + _data_->_tmp7_ = (_vala_array_free (_data_->_tmp7_, _data_->_tmp7__length1, (GDestroyNotify) g_free), NULL); +#line 366 "../src/playbin.vala" + _data_->err = _data_->_tmp8_; +#line 371 "../src/playbin.vala" + _vala_assert (_data_->err >= 0, "err >= 0"); +#line 373 "../src/playbin.vala" + _data_->_tmp9_ = _data_->self->priv->_play_queue; +#line 373 "../src/playbin.vala" + _data_->_tmp10_ = _data_->self->priv->_api; +#line 373 "../src/playbin.vala" + _data_->_tmp11_ = _data_->song; +#line 373 "../src/playbin.vala" + _data_->_tmp12_ = playbin_song_new (_data_->_tmp10_, &_data_->_tmp11_); +#line 373 "../src/playbin.vala" + _data_->_tmp13_ = _data_->_tmp12_; +#line 373 "../src/playbin.vala" + g_list_store_append (_data_->_tmp9_, (GObject*) _data_->_tmp13_); +#line 373 "../src/playbin.vala" + _g_object_unref0 (_data_->_tmp13_); +#line 374 "../src/playbin.vala" + _data_->_tmp14_ = _data_->self->priv->_play_queue_length; +#line 374 "../src/playbin.vala" + playbin_set_play_queue_length (_data_->self, _data_->_tmp14_ + 1); +#line 365 "../src/playbin.vala" + g_task_return_pointer (_data_->_async_result, _data_, NULL); +#line 365 "../src/playbin.vala" + if (_data_->_state_ != 0) { +#line 365 "../src/playbin.vala" + while (!g_task_get_completed (_data_->_async_result)) { +#line 365 "../src/playbin.vala" + g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE); +#line 2614 "playbin.c" + } + } +#line 365 "../src/playbin.vala" + g_object_unref (_data_->_async_result); +#line 365 "../src/playbin.vala" + return FALSE; +#line 2621 "playbin.c" +} + +void +playbin_move_track (Playbin* self, + guint from, + guint to) +{ + GListStore* _tmp0_; + GListStore* _tmp1_; + gchar* _tmp2_; + gchar* _tmp3_; + gchar* _tmp4_; + gchar* _tmp5_; + gchar* _tmp6_; + gchar* _tmp7_; +#line 377 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 377 "../src/playbin.vala" + _tmp0_ = self->priv->_play_queue; +#line 377 "../src/playbin.vala" + _vala_return_if_fail (from < g_list_model_get_n_items ((GListModel*) _tmp0_), "from < this._play_queue.get_n_items ()"); +#line 377 "../src/playbin.vala" + _tmp1_ = self->priv->_play_queue; +#line 377 "../src/playbin.vala" + _vala_return_if_fail (to < g_list_model_get_n_items ((GListModel*) _tmp1_), "to < this._play_queue.get_n_items ()"); +#line 381 "../src/playbin.vala" + _tmp2_ = g_strdup_printf ("%u", from); +#line 381 "../src/playbin.vala" + _tmp3_ = _tmp2_; +#line 381 "../src/playbin.vala" + _tmp4_ = g_strdup_printf ("%u", to); +#line 381 "../src/playbin.vala" + _tmp5_ = _tmp4_; +#line 381 "../src/playbin.vala" + _tmp6_ = g_strconcat ("moving track ", _tmp3_, " to ", _tmp5_, NULL); +#line 381 "../src/playbin.vala" + _tmp7_ = _tmp6_; +#line 381 "../src/playbin.vala" + g_debug ("playbin.vala:381: %s", _tmp7_); +#line 381 "../src/playbin.vala" + _g_free0 (_tmp7_); +#line 381 "../src/playbin.vala" + _g_free0 (_tmp5_); +#line 381 "../src/playbin.vala" + _g_free0 (_tmp3_); +#line 383 "../src/playbin.vala" + if (from < to) { +#line 2669 "playbin.c" + mpv_handle* _tmp8_; + gchar* _tmp9_; + gchar* _tmp10_; + gchar* _tmp11_; + gchar** _tmp12_; + gchar** _tmp13_; + gint _tmp13__length1; + GObject** additions = NULL; + GObject** _tmp14_; + gint additions_length1; + gint _additions_size_; + GObject** _tmp19_; + gint _tmp19__length1; + GListStore* _tmp20_; + GObject* _tmp21_; + GObject** _tmp22_; + gint _tmp22__length1; + GListStore* _tmp23_; + GObject* _tmp24_; + GListStore* _tmp25_; + GObject** _tmp26_; + gint _tmp26__length1; + gint _tmp27_; +#line 389 "../src/playbin.vala" + _tmp8_ = self->priv->mpv; +#line 389 "../src/playbin.vala" + _tmp9_ = g_strdup ("playlist-move"); +#line 389 "../src/playbin.vala" + _tmp10_ = g_strdup_printf ("%u", from); +#line 389 "../src/playbin.vala" + _tmp11_ = g_strdup_printf ("%u", to + 1); +#line 389 "../src/playbin.vala" + _tmp12_ = g_new0 (gchar*, 3 + 1); +#line 389 "../src/playbin.vala" + _tmp12_[0] = _tmp9_; +#line 389 "../src/playbin.vala" + _tmp12_[1] = _tmp10_; +#line 389 "../src/playbin.vala" + _tmp12_[2] = _tmp11_; +#line 389 "../src/playbin.vala" + _tmp13_ = _tmp12_; +#line 389 "../src/playbin.vala" + _tmp13__length1 = 3; +#line 389 "../src/playbin.vala" + _vala_assert (mpv_command (_tmp8_, _tmp13_) >= 0, "this.mpv.command({ \"playlist-move\", from.to_string (), (to+1).to_string (), }) >= 0"); +#line 389 "../src/playbin.vala" + _tmp13_ = (_vala_array_free (_tmp13_, _tmp13__length1, (GDestroyNotify) g_free), NULL); +#line 396 "../src/playbin.vala" + _tmp14_ = g_new0 (GObject*, ((to - from) + 1) + 1); +#line 396 "../src/playbin.vala" + additions = _tmp14_; +#line 396 "../src/playbin.vala" + additions_length1 = (to - from) + 1; +#line 396 "../src/playbin.vala" + _additions_size_ = additions_length1; +#line 2725 "playbin.c" + { + guint i = 0U; +#line 397 "../src/playbin.vala" + i = from + 1; +#line 2730 "playbin.c" + { + gboolean _tmp15_ = FALSE; +#line 397 "../src/playbin.vala" + _tmp15_ = TRUE; +#line 397 "../src/playbin.vala" + while (TRUE) { +#line 2737 "playbin.c" + GObject** _tmp16_; + gint _tmp16__length1; + GListStore* _tmp17_; + GObject* _tmp18_; +#line 397 "../src/playbin.vala" + if (!_tmp15_) { +#line 397 "../src/playbin.vala" + i += (guint) 1; +#line 2746 "playbin.c" + } +#line 397 "../src/playbin.vala" + _tmp15_ = FALSE; +#line 397 "../src/playbin.vala" + if (!(i < to)) { +#line 397 "../src/playbin.vala" + break; +#line 2754 "playbin.c" + } +#line 398 "../src/playbin.vala" + _tmp16_ = additions; +#line 398 "../src/playbin.vala" + _tmp16__length1 = additions_length1; +#line 398 "../src/playbin.vala" + _tmp17_ = self->priv->_play_queue; +#line 398 "../src/playbin.vala" + _tmp18_ = g_list_model_get_item ((GListModel*) _tmp17_, i); +#line 398 "../src/playbin.vala" + _g_object_unref0 (_tmp16_[(i - from) - 1]); +#line 398 "../src/playbin.vala" + _tmp16_[(i - from) - 1] = _tmp18_; +#line 2768 "playbin.c" + } + } + } +#line 400 "../src/playbin.vala" + _tmp19_ = additions; +#line 400 "../src/playbin.vala" + _tmp19__length1 = additions_length1; +#line 400 "../src/playbin.vala" + _tmp20_ = self->priv->_play_queue; +#line 400 "../src/playbin.vala" + _tmp21_ = g_list_model_get_item ((GListModel*) _tmp20_, to); +#line 400 "../src/playbin.vala" + _g_object_unref0 (_tmp19_[(to - from) - 1]); +#line 400 "../src/playbin.vala" + _tmp19_[(to - from) - 1] = _tmp21_; +#line 401 "../src/playbin.vala" + _tmp22_ = additions; +#line 401 "../src/playbin.vala" + _tmp22__length1 = additions_length1; +#line 401 "../src/playbin.vala" + _tmp23_ = self->priv->_play_queue; +#line 401 "../src/playbin.vala" + _tmp24_ = g_list_model_get_item ((GListModel*) _tmp23_, from); +#line 401 "../src/playbin.vala" + _g_object_unref0 (_tmp22_[to - from]); +#line 401 "../src/playbin.vala" + _tmp22_[to - from] = _tmp24_; +#line 402 "../src/playbin.vala" + _tmp25_ = self->priv->_play_queue; +#line 402 "../src/playbin.vala" + _tmp26_ = additions; +#line 402 "../src/playbin.vala" + _tmp26__length1 = additions_length1; +#line 402 "../src/playbin.vala" + g_list_store_splice (_tmp25_, from, (to - from) + 1, _tmp26_, (guint) _tmp26__length1); +#line 404 "../src/playbin.vala" + _tmp27_ = self->priv->_play_queue_position; +#line 404 "../src/playbin.vala" + if (_tmp27_ == ((gint) from)) { +#line 404 "../src/playbin.vala" + playbin_set_play_queue_position (self, (gint) to); +#line 2810 "playbin.c" + } else { + gboolean _tmp28_ = FALSE; + gint _tmp29_; +#line 405 "../src/playbin.vala" + _tmp29_ = self->priv->_play_queue_position; +#line 405 "../src/playbin.vala" + if (_tmp29_ > ((gint) from)) { +#line 2818 "playbin.c" + gint _tmp30_; +#line 405 "../src/playbin.vala" + _tmp30_ = self->priv->_play_queue_position; +#line 405 "../src/playbin.vala" + _tmp28_ = _tmp30_ <= ((gint) to); +#line 2824 "playbin.c" + } else { +#line 405 "../src/playbin.vala" + _tmp28_ = FALSE; +#line 2828 "playbin.c" + } +#line 405 "../src/playbin.vala" + if (_tmp28_) { +#line 2832 "playbin.c" + gint _tmp31_; +#line 405 "../src/playbin.vala" + _tmp31_ = self->priv->_play_queue_position; +#line 405 "../src/playbin.vala" + playbin_set_play_queue_position (self, _tmp31_ - 1); +#line 2838 "playbin.c" + } + } +#line 383 "../src/playbin.vala" + additions = (_vala_array_free (additions, additions_length1, (GDestroyNotify) g_object_unref), NULL); +#line 2843 "playbin.c" + } else { +#line 406 "../src/playbin.vala" + if (from > to) { +#line 2847 "playbin.c" + mpv_handle* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar* _tmp35_; + gchar** _tmp36_; + gchar** _tmp37_; + gint _tmp37__length1; + GObject** additions = NULL; + GObject** _tmp38_; + gint additions_length1; + gint _additions_size_; + GObject** _tmp39_; + gint _tmp39__length1; + GListStore* _tmp40_; + GObject* _tmp41_; + GListStore* _tmp46_; + GObject** _tmp47_; + gint _tmp47__length1; + gint _tmp48_; +#line 407 "../src/playbin.vala" + _tmp32_ = self->priv->mpv; +#line 407 "../src/playbin.vala" + _tmp33_ = g_strdup ("playlist-move"); +#line 407 "../src/playbin.vala" + _tmp34_ = g_strdup_printf ("%u", from); +#line 407 "../src/playbin.vala" + _tmp35_ = g_strdup_printf ("%u", to); +#line 407 "../src/playbin.vala" + _tmp36_ = g_new0 (gchar*, 3 + 1); +#line 407 "../src/playbin.vala" + _tmp36_[0] = _tmp33_; +#line 407 "../src/playbin.vala" + _tmp36_[1] = _tmp34_; +#line 407 "../src/playbin.vala" + _tmp36_[2] = _tmp35_; +#line 407 "../src/playbin.vala" + _tmp37_ = _tmp36_; +#line 407 "../src/playbin.vala" + _tmp37__length1 = 3; +#line 407 "../src/playbin.vala" + _vala_assert (mpv_command (_tmp32_, _tmp37_) >= 0, "this.mpv.command({ \"playlist-move\", from.to_string (), to.to_string (), }) >= 0"); +#line 407 "../src/playbin.vala" + _tmp37_ = (_vala_array_free (_tmp37_, _tmp37__length1, (GDestroyNotify) g_free), NULL); +#line 414 "../src/playbin.vala" + _tmp38_ = g_new0 (GObject*, ((from - to) + 1) + 1); +#line 414 "../src/playbin.vala" + additions = _tmp38_; +#line 414 "../src/playbin.vala" + additions_length1 = (from - to) + 1; +#line 414 "../src/playbin.vala" + _additions_size_ = additions_length1; +#line 415 "../src/playbin.vala" + _tmp39_ = additions; +#line 415 "../src/playbin.vala" + _tmp39__length1 = additions_length1; +#line 415 "../src/playbin.vala" + _tmp40_ = self->priv->_play_queue; +#line 415 "../src/playbin.vala" + _tmp41_ = g_list_model_get_item ((GListModel*) _tmp40_, from); +#line 415 "../src/playbin.vala" + _g_object_unref0 (_tmp39_[0]); +#line 415 "../src/playbin.vala" + _tmp39_[0] = _tmp41_; +#line 2911 "playbin.c" + { + guint i = 0U; +#line 416 "../src/playbin.vala" + i = to; +#line 2916 "playbin.c" + { + gboolean _tmp42_ = FALSE; +#line 416 "../src/playbin.vala" + _tmp42_ = TRUE; +#line 416 "../src/playbin.vala" + while (TRUE) { +#line 2923 "playbin.c" + GObject** _tmp43_; + gint _tmp43__length1; + GListStore* _tmp44_; + GObject* _tmp45_; +#line 416 "../src/playbin.vala" + if (!_tmp42_) { +#line 416 "../src/playbin.vala" + i += (guint) 1; +#line 2932 "playbin.c" + } +#line 416 "../src/playbin.vala" + _tmp42_ = FALSE; +#line 416 "../src/playbin.vala" + if (!(i < from)) { +#line 416 "../src/playbin.vala" + break; +#line 2940 "playbin.c" + } +#line 417 "../src/playbin.vala" + _tmp43_ = additions; +#line 417 "../src/playbin.vala" + _tmp43__length1 = additions_length1; +#line 417 "../src/playbin.vala" + _tmp44_ = self->priv->_play_queue; +#line 417 "../src/playbin.vala" + _tmp45_ = g_list_model_get_item ((GListModel*) _tmp44_, i); +#line 417 "../src/playbin.vala" + _g_object_unref0 (_tmp43_[(i - to) + 1]); +#line 417 "../src/playbin.vala" + _tmp43_[(i - to) + 1] = _tmp45_; +#line 2954 "playbin.c" + } + } + } +#line 419 "../src/playbin.vala" + _tmp46_ = self->priv->_play_queue; +#line 419 "../src/playbin.vala" + _tmp47_ = additions; +#line 419 "../src/playbin.vala" + _tmp47__length1 = additions_length1; +#line 419 "../src/playbin.vala" + g_list_store_splice (_tmp46_, to, (from - to) + 1, _tmp47_, (guint) _tmp47__length1); +#line 421 "../src/playbin.vala" + _tmp48_ = self->priv->_play_queue_position; +#line 421 "../src/playbin.vala" + if (_tmp48_ == ((gint) from)) { +#line 421 "../src/playbin.vala" + playbin_set_play_queue_position (self, (gint) to); +#line 2972 "playbin.c" + } else { + gboolean _tmp49_ = FALSE; + gint _tmp50_; +#line 422 "../src/playbin.vala" + _tmp50_ = self->priv->_play_queue_position; +#line 422 "../src/playbin.vala" + if (_tmp50_ >= ((gint) to)) { +#line 2980 "playbin.c" + gint _tmp51_; +#line 422 "../src/playbin.vala" + _tmp51_ = self->priv->_play_queue_position; +#line 422 "../src/playbin.vala" + _tmp49_ = _tmp51_ < ((gint) from); +#line 2986 "playbin.c" + } else { +#line 422 "../src/playbin.vala" + _tmp49_ = FALSE; +#line 2990 "playbin.c" + } +#line 422 "../src/playbin.vala" + if (_tmp49_) { +#line 2994 "playbin.c" + gint _tmp52_; +#line 422 "../src/playbin.vala" + _tmp52_ = self->priv->_play_queue_position; +#line 422 "../src/playbin.vala" + playbin_set_play_queue_position (self, _tmp52_ + 1); +#line 3000 "playbin.c" + } + } +#line 406 "../src/playbin.vala" + additions = (_vala_array_free (additions, additions_length1, (GDestroyNotify) g_object_unref), NULL); +#line 3005 "playbin.c" + } + } +} + +void +playbin_stop (Playbin* self) +{ + mpv_handle* _tmp0_; + gchar* _tmp1_; + gchar* _tmp2_; + gchar** _tmp3_; + gchar** _tmp4_; + gint _tmp4__length1; +#line 426 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 427 "../src/playbin.vala" + g_debug ("playbin.vala:427: stopping playback"); +#line 429 "../src/playbin.vala" + _tmp0_ = self->priv->mpv; +#line 429 "../src/playbin.vala" + _tmp1_ = g_strdup ("stop"); +#line 429 "../src/playbin.vala" + _tmp2_ = g_strdup ("keep-playlist"); +#line 429 "../src/playbin.vala" + _tmp3_ = g_new0 (gchar*, 2 + 1); +#line 429 "../src/playbin.vala" + _tmp3_[0] = _tmp1_; +#line 429 "../src/playbin.vala" + _tmp3_[1] = _tmp2_; +#line 429 "../src/playbin.vala" + _tmp4_ = _tmp3_; +#line 429 "../src/playbin.vala" + _tmp4__length1 = 2; +#line 429 "../src/playbin.vala" + _vala_assert (mpv_command (_tmp0_, _tmp4_) >= 0, "this.mpv.command({\"stop\", \"keep-playlist\"}) >= 0"); +#line 429 "../src/playbin.vala" + _tmp4_ = (_vala_array_free (_tmp4_, _tmp4__length1, (GDestroyNotify) g_free), NULL); +#line 430 "../src/playbin.vala" + playbin_set_state (self, PLAYBIN_STATE_STOPPED); +#line 431 "../src/playbin.vala" + playbin_set_play_queue_position (self, -1); +#line 432 "../src/playbin.vala" + g_signal_emit (self, playbin_signals[PLAYBIN_STOPPED_SIGNAL], 0); +#line 3049 "playbin.c" +} + +PlaybinState +playbin_get_state (Playbin* self) +{ + PlaybinState result; +#line 71 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, 0); +#line 71 "../src/playbin.vala" + result = self->priv->_state; +#line 71 "../src/playbin.vala" + return result; +#line 3062 "playbin.c" +} + +static void +playbin_set_state (Playbin* self, + PlaybinState value) +{ + PlaybinState old_value; +#line 71 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 71 "../src/playbin.vala" + old_value = playbin_get_state (self); +#line 71 "../src/playbin.vala" + if (old_value != value) { +#line 71 "../src/playbin.vala" + self->priv->_state = value; +#line 71 "../src/playbin.vala" + g_object_notify_by_pspec ((GObject *) self, playbin_properties[PLAYBIN_STATE_PROPERTY]); +#line 3080 "playbin.c" + } +} + +gint +playbin_get_volume (Playbin* self) +{ + gint result; +#line 74 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, 0); +#line 74 "../src/playbin.vala" + result = self->priv->_volume; +#line 74 "../src/playbin.vala" + return result; +#line 3094 "playbin.c" +} + +static mpv_error +mpv_handle_set_property_int64 (mpv_handle* self, + const gchar* name, + gint64 value) +{ + mpv_error result; +#line 56 "mpv.vapi" + g_return_val_if_fail (self != NULL, 0); +#line 56 "mpv.vapi" + g_return_val_if_fail (name != NULL, 0); +#line 57 "mpv.vapi" + result = mpv_set_property (self, name, MPV_FORMAT_INT64, &value); +#line 57 "mpv.vapi" + return result; +#line 3111 "playbin.c" +} + +void +playbin_set_volume (Playbin* self, + gint value) +{ + mpv_error ret = 0; + mpv_handle* _tmp0_; +#line 75 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 76 "../src/playbin.vala" + _tmp0_ = self->priv->mpv; +#line 76 "../src/playbin.vala" + ret = mpv_handle_set_property_int64 (_tmp0_, "volume", (gint64) value); +#line 77 "../src/playbin.vala" + if (ret >= 0) { +#line 78 "../src/playbin.vala" + self->priv->_volume = value; +#line 3130 "playbin.c" + } else { + const gchar* _tmp1_; +#line 80 "../src/playbin.vala" + _tmp1_ = mpv_error_string (ret); +#line 80 "../src/playbin.vala" + g_warning ("playbin.vala:80: failed to set volume: %s", _tmp1_); +#line 3137 "playbin.c" + } +#line 75 "../src/playbin.vala" + g_object_notify_by_pspec ((GObject *) self, playbin_properties[PLAYBIN_VOLUME_PROPERTY]); +#line 3141 "playbin.c" +} + +gboolean +playbin_get_mute (Playbin* self) +{ + gboolean result; +#line 86 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 86 "../src/playbin.vala" + result = self->priv->_mute; +#line 86 "../src/playbin.vala" + return result; +#line 3154 "playbin.c" +} + +void +playbin_set_mute (Playbin* self, + gboolean value) +{ + mpv_error ret = 0; + mpv_handle* _tmp0_; +#line 87 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 88 "../src/playbin.vala" + _tmp0_ = self->priv->mpv; +#line 88 "../src/playbin.vala" + ret = mpv_handle_set_property_flag (_tmp0_, "mute", value); +#line 89 "../src/playbin.vala" + if (ret >= 0) { +#line 90 "../src/playbin.vala" + self->priv->_mute = value; +#line 3173 "playbin.c" + } else { + const gchar* _tmp1_; +#line 92 "../src/playbin.vala" + _tmp1_ = mpv_error_string (ret); +#line 92 "../src/playbin.vala" + g_warning ("playbin.vala:92: failed to set mute status: %s", _tmp1_); +#line 3180 "playbin.c" + } +#line 87 "../src/playbin.vala" + g_object_notify_by_pspec ((GObject *) self, playbin_properties[PLAYBIN_MUTE_PROPERTY]); +#line 3184 "playbin.c" +} + +gint +playbin_get_play_queue_position (Playbin* self) +{ + gint result; +#line 98 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, 0); +#line 98 "../src/playbin.vala" + result = self->priv->_play_queue_position; +#line 98 "../src/playbin.vala" + return result; +#line 3197 "playbin.c" +} + +static void +playbin_set_play_queue_position (Playbin* self, + gint value) +{ + gint old_value; +#line 98 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 98 "../src/playbin.vala" + old_value = playbin_get_play_queue_position (self); +#line 98 "../src/playbin.vala" + if (old_value != value) { +#line 98 "../src/playbin.vala" + self->priv->_play_queue_position = value; +#line 98 "../src/playbin.vala" + g_object_notify_by_pspec ((GObject *) self, playbin_properties[PLAYBIN_PLAY_QUEUE_POSITION_PROPERTY]); +#line 3215 "playbin.c" + } +} + +gdouble +playbin_get_position (Playbin* self) +{ + gdouble result; +#line 106 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, 0.0); +#line 106 "../src/playbin.vala" + result = self->priv->_position; +#line 106 "../src/playbin.vala" + return result; +#line 3229 "playbin.c" +} + +static void +playbin_set_position (Playbin* self, + gdouble value) +{ + gdouble old_value; +#line 106 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 106 "../src/playbin.vala" + old_value = playbin_get_position (self); +#line 106 "../src/playbin.vala" + if (old_value != value) { +#line 106 "../src/playbin.vala" + self->priv->_position = value; +#line 106 "../src/playbin.vala" + g_object_notify_by_pspec ((GObject *) self, playbin_properties[PLAYBIN_POSITION_PROPERTY]); +#line 3247 "playbin.c" + } +} + +gdouble +playbin_get_duration (Playbin* self) +{ + gdouble result; +#line 107 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, 0.0); +#line 107 "../src/playbin.vala" + result = self->priv->_duration; +#line 107 "../src/playbin.vala" + return result; +#line 3261 "playbin.c" +} + +static void +playbin_set_duration (Playbin* self, + gdouble value) +{ + gdouble old_value; +#line 107 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 107 "../src/playbin.vala" + old_value = playbin_get_duration (self); +#line 107 "../src/playbin.vala" + if (old_value != value) { +#line 107 "../src/playbin.vala" + self->priv->_duration = value; +#line 107 "../src/playbin.vala" + g_object_notify_by_pspec ((GObject *) self, playbin_properties[PLAYBIN_DURATION_PROPERTY]); +#line 3279 "playbin.c" + } +} + +SubsonicClient* +playbin_get_api (Playbin* self) +{ + SubsonicClient* result; + SubsonicClient* _tmp0_; +#line 109 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 109 "../src/playbin.vala" + _tmp0_ = self->priv->_api; +#line 109 "../src/playbin.vala" + result = _tmp0_; +#line 109 "../src/playbin.vala" + return result; +#line 3296 "playbin.c" +} + +void +playbin_set_api (Playbin* self, + SubsonicClient* value) +{ + SubsonicClient* old_value; +#line 109 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 109 "../src/playbin.vala" + old_value = playbin_get_api (self); +#line 109 "../src/playbin.vala" + if (old_value != value) { +#line 109 "../src/playbin.vala" + self->priv->_api = value; +#line 109 "../src/playbin.vala" + g_object_notify_by_pspec ((GObject *) self, playbin_properties[PLAYBIN_API_PROPERTY]); +#line 3314 "playbin.c" + } +} + +GListModel* +playbin_get_play_queue (Playbin* self) +{ + GListModel* result; + GListStore* _tmp0_; +#line 111 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 111 "../src/playbin.vala" + _tmp0_ = self->priv->_play_queue; +#line 111 "../src/playbin.vala" + result = (GListModel*) _tmp0_; +#line 111 "../src/playbin.vala" + return result; +#line 3331 "playbin.c" +} + +guint +playbin_get_play_queue_length (Playbin* self) +{ + guint result; +#line 112 "../src/playbin.vala" + g_return_val_if_fail (self != NULL, 0U); +#line 112 "../src/playbin.vala" + result = self->priv->_play_queue_length; +#line 112 "../src/playbin.vala" + return result; +#line 3344 "playbin.c" +} + +static void +playbin_set_play_queue_length (Playbin* self, + guint value) +{ + guint old_value; +#line 112 "../src/playbin.vala" + g_return_if_fail (self != NULL); +#line 112 "../src/playbin.vala" + old_value = playbin_get_play_queue_length (self); +#line 112 "../src/playbin.vala" + if (old_value != value) { +#line 112 "../src/playbin.vala" + self->priv->_play_queue_length = value; +#line 112 "../src/playbin.vala" + g_object_notify_by_pspec ((GObject *) self, playbin_properties[PLAYBIN_PLAY_QUEUE_LENGTH_PROPERTY]); +#line 3362 "playbin.c" + } +} + +static void +playbin_class_init (PlaybinClass * klass, + gpointer klass_data) +{ +#line 62 "../src/playbin.vala" + playbin_parent_class = g_type_class_peek_parent (klass); +#line 62 "../src/playbin.vala" + g_type_class_adjust_private_offset (klass, &Playbin_private_offset); +#line 62 "../src/playbin.vala" + G_OBJECT_CLASS (klass)->get_property = _vala_playbin_get_property; +#line 62 "../src/playbin.vala" + G_OBJECT_CLASS (klass)->set_property = _vala_playbin_set_property; +#line 62 "../src/playbin.vala" + G_OBJECT_CLASS (klass)->finalize = playbin_finalize; +#line 62 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_STATE_PROPERTY, playbin_properties[PLAYBIN_STATE_PROPERTY] = g_param_spec_enum ("state", "state", "state", TYPE_PLAYBIN_STATE, PLAYBIN_STATE_STOPPED, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 62 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_VOLUME_PROPERTY, playbin_properties[PLAYBIN_VOLUME_PROPERTY] = g_param_spec_int ("volume", "volume", "volume", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 62 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_MUTE_PROPERTY, playbin_properties[PLAYBIN_MUTE_PROPERTY] = g_param_spec_boolean ("mute", "mute", "mute", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 62 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_PLAY_QUEUE_POSITION_PROPERTY, playbin_properties[PLAYBIN_PLAY_QUEUE_POSITION_PROPERTY] = g_param_spec_int ("play-queue-position", "play-queue-position", "play-queue-position", G_MININT, G_MAXINT, -1, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 62 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_POSITION_PROPERTY, playbin_properties[PLAYBIN_POSITION_PROPERTY] = g_param_spec_double ("position", "position", "position", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 62 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_DURATION_PROPERTY, playbin_properties[PLAYBIN_DURATION_PROPERTY] = g_param_spec_double ("duration", "duration", "duration", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 62 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_API_PROPERTY, playbin_properties[PLAYBIN_API_PROPERTY] = g_param_spec_object ("api", "api", "api", SUBSONIC_TYPE_CLIENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 62 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_PLAY_QUEUE_PROPERTY, playbin_properties[PLAYBIN_PLAY_QUEUE_PROPERTY] = g_param_spec_object ("play-queue", "play-queue", "play-queue", g_list_model_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 62 "../src/playbin.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYBIN_PLAY_QUEUE_LENGTH_PROPERTY, playbin_properties[PLAYBIN_PLAY_QUEUE_LENGTH_PROPERTY] = g_param_spec_uint ("play-queue-length", "play-queue-length", "play-queue-length", 0, G_MAXUINT, (guint) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 62 "../src/playbin.vala" + playbin_signals[PLAYBIN_NEW_TRACK_SIGNAL] = g_signal_new ("new-track", TYPE_PLAYBIN, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); +#line 62 "../src/playbin.vala" + playbin_signals[PLAYBIN_STOPPED_SIGNAL] = g_signal_new ("stopped", TYPE_PLAYBIN, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); +#line 3402 "playbin.c" +} + +static void +playbin_instance_init (Playbin * self, + gpointer klass) +{ + mpv_handle* _tmp0_; + GListStore* _tmp1_; +#line 62 "../src/playbin.vala" + self->priv = playbin_get_instance_private (self); +#line 63 "../src/playbin.vala" + _tmp0_ = mpv_create (); +#line 63 "../src/playbin.vala" + self->priv->mpv = _tmp0_; +#line 64 "../src/playbin.vala" + self->priv->_volume = 100; +#line 65 "../src/playbin.vala" + self->priv->_mute = FALSE; +#line 66 "../src/playbin.vala" + _tmp1_ = g_list_store_new (TYPE_PLAYBIN_SONG); +#line 66 "../src/playbin.vala" + self->priv->_play_queue = _tmp1_; +#line 69 "../src/playbin.vala" + self->priv->is_handling_event = FALSE; +#line 71 "../src/playbin.vala" + self->priv->_state = PLAYBIN_STATE_STOPPED; +#line 98 "../src/playbin.vala" + self->priv->_play_queue_position = -1; +#line 106 "../src/playbin.vala" + self->priv->_position = 0.0; +#line 107 "../src/playbin.vala" + self->priv->_duration = 0.0; +#line 109 "../src/playbin.vala" + self->priv->_api = NULL; +#line 112 "../src/playbin.vala" + self->priv->_play_queue_length = (guint) 0; +#line 3439 "playbin.c" +} + +static void +playbin_finalize (GObject * obj) +{ + Playbin * self; +#line 62 "../src/playbin.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_PLAYBIN, Playbin); +#line 436 "../src/playbin.vala" + g_debug ("playbin.vala:436: destroying playbin"); +#line 63 "../src/playbin.vala" + _mpv_terminate_destroy0 (self->priv->mpv); +#line 66 "../src/playbin.vala" + _g_object_unref0 (self->priv->_play_queue); +#line 62 "../src/playbin.vala" + G_OBJECT_CLASS (playbin_parent_class)->finalize (obj); +#line 3456 "playbin.c" +} + +static GType +playbin_get_type_once (void) +{ + static const GTypeInfo g_define_type_info = { sizeof (PlaybinClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) playbin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Playbin), 0, (GInstanceInitFunc) playbin_instance_init, NULL }; + GType playbin_type_id; + playbin_type_id = g_type_register_static (G_TYPE_OBJECT, "Playbin", &g_define_type_info, 0); + Playbin_private_offset = g_type_add_instance_private (playbin_type_id, sizeof (PlaybinPrivate)); + return playbin_type_id; +} + +GType +playbin_get_type (void) +{ + static volatile gsize playbin_type_id__once = 0; + if (g_once_init_enter (&playbin_type_id__once)) { + GType playbin_type_id; + playbin_type_id = playbin_get_type_once (); + g_once_init_leave (&playbin_type_id__once, playbin_type_id); + } + return playbin_type_id__once; +} + +static void +_vala_playbin_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec) +{ + Playbin * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_PLAYBIN, Playbin); +#line 62 "../src/playbin.vala" + switch (property_id) { +#line 62 "../src/playbin.vala" + case PLAYBIN_STATE_PROPERTY: +#line 62 "../src/playbin.vala" + g_value_set_enum (value, playbin_get_state (self)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_VOLUME_PROPERTY: +#line 62 "../src/playbin.vala" + g_value_set_int (value, playbin_get_volume (self)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_MUTE_PROPERTY: +#line 62 "../src/playbin.vala" + g_value_set_boolean (value, playbin_get_mute (self)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_PLAY_QUEUE_POSITION_PROPERTY: +#line 62 "../src/playbin.vala" + g_value_set_int (value, playbin_get_play_queue_position (self)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_POSITION_PROPERTY: +#line 62 "../src/playbin.vala" + g_value_set_double (value, playbin_get_position (self)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_DURATION_PROPERTY: +#line 62 "../src/playbin.vala" + g_value_set_double (value, playbin_get_duration (self)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_API_PROPERTY: +#line 62 "../src/playbin.vala" + g_value_set_object (value, playbin_get_api (self)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_PLAY_QUEUE_PROPERTY: +#line 62 "../src/playbin.vala" + g_value_set_object (value, playbin_get_play_queue (self)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_PLAY_QUEUE_LENGTH_PROPERTY: +#line 62 "../src/playbin.vala" + g_value_set_uint (value, playbin_get_play_queue_length (self)); +#line 62 "../src/playbin.vala" + break; +#line 3545 "playbin.c" + default: +#line 62 "../src/playbin.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 62 "../src/playbin.vala" + break; +#line 3551 "playbin.c" + } +} + +static void +_vala_playbin_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec) +{ + Playbin * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_PLAYBIN, Playbin); +#line 62 "../src/playbin.vala" + switch (property_id) { +#line 62 "../src/playbin.vala" + case PLAYBIN_STATE_PROPERTY: +#line 62 "../src/playbin.vala" + playbin_set_state (self, g_value_get_enum (value)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_VOLUME_PROPERTY: +#line 62 "../src/playbin.vala" + playbin_set_volume (self, g_value_get_int (value)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_MUTE_PROPERTY: +#line 62 "../src/playbin.vala" + playbin_set_mute (self, g_value_get_boolean (value)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_PLAY_QUEUE_POSITION_PROPERTY: +#line 62 "../src/playbin.vala" + playbin_set_play_queue_position (self, g_value_get_int (value)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_POSITION_PROPERTY: +#line 62 "../src/playbin.vala" + playbin_set_position (self, g_value_get_double (value)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_DURATION_PROPERTY: +#line 62 "../src/playbin.vala" + playbin_set_duration (self, g_value_get_double (value)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_API_PROPERTY: +#line 62 "../src/playbin.vala" + playbin_set_api (self, g_value_get_object (value)); +#line 62 "../src/playbin.vala" + break; +#line 62 "../src/playbin.vala" + case PLAYBIN_PLAY_QUEUE_LENGTH_PROPERTY: +#line 62 "../src/playbin.vala" + playbin_set_play_queue_length (self, g_value_get_uint (value)); +#line 62 "../src/playbin.vala" + break; +#line 3613 "playbin.c" + default: +#line 62 "../src/playbin.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 62 "../src/playbin.vala" + break; +#line 3619 "playbin.c" + } +} + +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); +} + diff --git a/src/playbin.vala b/src/playbin.vala deleted file mode 100644 index 424f3ab..0000000 --- a/src/playbin.vala +++ /dev/null @@ -1,438 +0,0 @@ -public enum PlaybinState { - STOPPED, - PAUSED, - PLAYING, -} - -private struct CommandCallback { - unowned SourceFunc callback; - int error; -} - -public class PlaybinSong : Object { - private Subsonic.Song inner; - public string id { get { return inner.id; } } - public string title { get { return inner.title; } } - public string artist { get { return inner.artist; } } - public string album { get { return inner.album; } } - public string? genre { get { return inner.genre; } } - public int64 duration { get { return inner.duration; } } - public int64 track { get { return inner.track; } } - public int64 play_count { get { return inner.play_count; } } - - public Gdk.Paintable? thumbnail { get; private set; } - - private Cancellable cancel_loading_thumbnail; - - public PlaybinSong (Subsonic.Client api, Subsonic.Song song) { - this.api = api; - this.inner = song; - } - - private Subsonic.Client api; - - public void need_cover_art () { - /* TODO - if (this.cancel_loading_thumbnail != null) return; - if (this.thumbnail != null) return; - - this.cancel_loading_thumbnail = new Cancellable (); - // TODO: dpi scaling maybe?? probably - api.cover_art.begin (this.id, 50, Priority.LOW, this.cancel_loading_thumbnail, (obj, res) => { - try { - var pixbuf = api.cover_art.end (res); - this.thumbnail = Gdk.Texture.for_pixbuf (pixbuf); - } catch (Error e) { - if (!(e is IOError.CANCELLED)) { - warning ("could not fetch cover art for song %s: %s", this.id, e.message); - } - } - this.cancel_loading_thumbnail = null; - }); - */ - } - - ~PlaybinSong () { - if (this.cancel_loading_thumbnail != null) { - this.cancel_loading_thumbnail.cancel (); - } - } -} - -public class Playbin : GLib.Object { - private Mpv.Handle mpv = new Mpv.Handle (); - private int _volume = 100; - private bool _mute = false; - private ListStore _play_queue = new ListStore (typeof (PlaybinSong)); - - // try to prevent wait_event to be called twice - private bool is_handling_event = false; - - public PlaybinState state { get; private set; default = PlaybinState.STOPPED; } - - public int volume { - get { return _volume; } - set { - var ret = mpv.set_property_int64 ("volume", value); - if (ret >= 0) { - _volume = value; - } else { - warning ("failed to set volume: %s", ret.to_string ()); - } - } - } - - public bool mute { - get { return _mute; } - set { - var ret = mpv.set_property_flag ("mute", value); - if (ret >= 0) { - _mute = value; - } else { - warning ("failed to set mute status: %s", ret.to_string ()); - } - } - } - - // invariant: negative iff stopped, otherwise < play queue length - public int play_queue_position { get; private set; default = -1; } - - // signalled when a new track is current - public signal void new_track (); - // signalled when the last track is over - public signal void stopped (); - - // these are mostly synced with mpv - public double position { get; private set; default = 0.0; } - public double duration { get; private set; default = 0.0; } - - public weak Subsonic.Client api { get; set; default = null; } - - public ListModel play_queue { get { return this._play_queue; } } - public uint play_queue_length { get; private set; default = 0; } - - private async Mpv.Error mpv_command_async (string[] args) { - CommandCallback cc = {}; - - this.mpv.command_async ((uint64) &cc, args); - - cc.callback = this.mpv_command_async.callback; - yield; - return cc.error; - } - - public Playbin () { - assert (this.mpv.initialize () >= 0); - assert (this.mpv.set_property_string ("audio-client-name", "audrey") >= 0); - assert (this.mpv.set_property_string ("user-agent", Audrey.Const.user_agent) >= 0); - assert (this.mpv.set_property_string ("video", "no") >= 0); - assert (this.mpv.set_property_string ("prefetch-playlist", "yes") >= 0); - assert (this.mpv.set_property_string ("gapless-audio", "yes") >= 0); - assert (this.mpv.observe_property (0, "time-pos", Mpv.Format.DOUBLE) >= 0); - assert (this.mpv.observe_property (1, "duration", Mpv.Format.DOUBLE) >= 0); - assert (this.mpv.observe_property (2, "playlist-pos", Mpv.Format.INT64) >= 0); - assert (this.mpv.observe_property (3, "pause", Mpv.Format.FLAG) >= 0); - - this.mpv.wakeup_callback = () => { - Idle.add (() => { - if (this.is_handling_event) { - warning ("main thread mpv wakeup callback called twice"); - return false; - } - this.is_handling_event = true; - - while (true) { - var event = this.mpv.wait_event (0.0); - if (event.event_id == Mpv.EventId.NONE) break; - - switch (event.event_id) { - case Mpv.EventId.PROPERTY_CHANGE: - var data = event.parse_property (); - switch (event.reply_userdata) { - case 0: - assert (data.name == "time-pos"); - if (data.format == Mpv.Format.NONE) { - this.position = 0.0; - } else { - this.position = data.parse_double (); - } - break; - - case 1: - assert (data.name == "duration"); - if (data.format == Mpv.Format.NONE) { - // this.duration = 0.0; i think this prevents the fallback below from working - } else { - this.duration = data.parse_double (); - } - break; - - case 2: - // here as a sanity check - // should always match our own play_queu_position/state - assert (data.name == "playlist-pos"); - int64 playlist_pos = data.parse_int64 (); - if (playlist_pos < 0) { - if (this.state != PlaybinState.STOPPED) { - error ("mpv has no current playlist entry, but we think it's index %d", this.play_queue_position); - } - assert (this.play_queue_position < 0); - } else { - if (this.state == PlaybinState.STOPPED) { - error ("mpv is at playlist entry %d, but we're stopped", (int) playlist_pos); - } - if (this.play_queue_position != (int) playlist_pos) { - error ("mpv is at playlist entry %d, but we think it's %d", (int) playlist_pos, this.play_queue_position); - } - } - break; - - case 3: - // also here as a sanity check - // should always match our own state - assert (data.name == "pause"); - bool pause = data.parse_flag (); - if (pause && this.state != PlaybinState.PAUSED) { - error (@"mpv is paused, but we are @(this.state)"); - } - if (!pause && this.state == PlaybinState.PAUSED) { - error ("mpv is not paused, but we are paused"); - } - break; - - default: - assert (false); - break; - } - break; - - case Mpv.EventId.START_FILE: - debug ("START_FILE received"); - - // estimate duration from api data - // while mpv doesn't know it - this.duration = ((PlaybinSong) this._play_queue.get_item (this.play_queue_position)).duration; - - this.new_track (); - break; - - case Mpv.EventId.END_FILE: - var data = event.parse_end_file (); - debug (@"END_FILE received (reason: $(data.reason))"); - - if (data.error < 0) { - warning ("playback of track aborted: %s", data.error.to_string ()); - } - - if (data.reason == Mpv.EndFileReason.EOF) { - // assume this is a proper transition - this.play_queue_position += 1; - - if (this.play_queue_position == this._play_queue.get_n_items ()) { - // reached the end (?) - this.state = PlaybinState.STOPPED; - this.play_queue_position = -1; - this.stopped (); - } - } - - break; - - case Mpv.EventId.COMMAND_REPLY: - unowned CommandCallback *cc = (CommandCallback *) event.reply_userdata; - cc.error = event.error; - cc.callback (); - break; - - default: - // ignore by default - break; - } - } - - this.is_handling_event = false; - return false; - }); - }; - } - - public void seek (double position) { - var rc = this.mpv.command ({"seek", position.to_string (), "absolute"}); - if (rc < 0) { - warning (@"could not seek to $position: $rc"); - } else { - this.position = position; - } - } - - // manually changes which track in the play queue to play - public void select_track (uint position) - requires (position < this.play_queue.get_n_items ()) - { - assert (this.mpv.command ({"playlist-play-index", position.to_string ()}) >= 0); - this.play_queue_position = (int) position; - this.state = PlaybinState.PLAYING; - this.play (); // make sure mpv actually starts playing the track - } - - public void pause () { - assert (this.state != PlaybinState.STOPPED); - this.state = PlaybinState.PAUSED; - debug ("setting state to paused"); - // TODO: abstract away this handling around mpv api a bit for auto debug printing - var ret = this.mpv.set_property_flag("pause", true); - if (ret != 0) { - debug (@"failed to set state to paused ($(ret)): $(ret.to_string())"); - } - } - - public void play () { - if (this.state == PlaybinState.STOPPED) { - // allow only when playlist is not empty - // and start from the top - assert (this._play_queue.get_n_items () > 0); - this.select_track (0); - } else { - this.state = PlaybinState.PLAYING; - debug ("setting state to playing"); - var ret = this.mpv.set_property_flag("pause", false); - if (ret != 0) { - debug (@"failed to set state to playing ($(ret)): $(ret.to_string())"); - } - } - } - - public void go_to_next_track () - requires (this.state != PlaybinState.STOPPED) - { - if (this.play_queue_position+1 < this._play_queue.get_n_items ()) { - this.play_queue_position += 1; - assert (this.mpv.command ({"playlist-next-playlist"}) >= 0); - } else { - warning ("tried to skip forward at end of play queue, ignoring"); - } - } - - public void go_to_prev_track () - requires (this.state != PlaybinState.STOPPED) - { - if (this.play_queue_position > 0) { - this.play_queue_position -= 1; - assert (this.mpv.command ({"playlist-prev-playlist"}) >= 0); - } else { - warning ("tried to skip to prev track at start of play queue, ignoring"); - } - } - - public void remove_track (uint position) - requires (position < this._play_queue.get_n_items ()) - { - assert (this.mpv.command({"playlist-remove", position.to_string ()}) >= 0); - this._play_queue.remove (position); - this.play_queue_length -= 1; - if (this.play_queue_position > position) this.play_queue_position -= 1; - if (this.play_queue_position == this._play_queue.get_n_items ()) { - // we just killed the last track - this.state = PlaybinState.STOPPED; - this.play_queue_position = -1; - this.stopped (); - } - } - - public void clear () { - assert (this.mpv.command({"playlist-clear"}) >= 0); - if (this.state != PlaybinState.STOPPED) { - assert (this.mpv.command({"playlist-remove", "current"}) >= 0); - } - this.state = PlaybinState.STOPPED; - this._play_queue.remove_all (); - this.play_queue_length = 0; - this.play_queue_position = -1; - - this.stopped (); - } - - public void append_track (Subsonic.Song song) { - assert (this.mpv.command ({ - "loadfile", - this.api.stream_uri (song.id), - "append", - }) >= 0); - this._play_queue.append (new PlaybinSong (this.api, song)); - this.play_queue_length += 1; - } - - public async void append_track_async (Subsonic.Song song) { - var err = yield this.mpv_command_async ({ - "loadfile", - this.api.stream_uri (song.id), - "append", - }); - assert (err >= 0); - - this._play_queue.append (new PlaybinSong (this.api, song)); - this.play_queue_length += 1; - } - - public void move_track (uint from, uint to) - requires (from < this._play_queue.get_n_items ()) - requires (to < this._play_queue.get_n_items ()) - { - debug (@"moving track $from to $to"); - - if (from < to) { - // why offset to? because if the playlist is 01234, - // mpv takes "move 1 to 3" to mean 02134, not 02314 - // that is, the target is a "gap", not a playlist entry - // from -> 0 1 2 3 4 5 - // to -> 0 1 2 3 4 5 6 - assert(this.mpv.command({ - "playlist-move", - from.to_string (), - (to+1).to_string (), - }) >= 0); - - // F0123T -> 0123TF - var additions = new Object[to-from+1]; - for (uint i = from+1; i < to; i += 1) { - additions[i-from-1] = this._play_queue.get_item (i); - } - additions[to-from-1] = this._play_queue.get_item (to); - additions[to-from] = this._play_queue.get_item (from); - this._play_queue.splice(from, to-from+1, additions); - - if (this.play_queue_position == (int) from) this.play_queue_position = (int) to; - else if (this.play_queue_position > (int) from && this.play_queue_position <= (int) to) this.play_queue_position -= 1; - } else if (from > to) { - assert(this.mpv.command({ - "playlist-move", - from.to_string (), - to.to_string (), - }) >= 0); - - // T0123F -> FT0123 - var additions = new Object[from-to+1]; - additions[0] = this._play_queue.get_item (from); - for (uint i = to; i < from; i += 1) { - additions[i-to+1] = this._play_queue.get_item (i); - } - this._play_queue.splice (to, from-to+1, additions); - - if (this.play_queue_position == (int) from) this.play_queue_position = (int) to; - else if (this.play_queue_position >= (int) to && this.play_queue_position < (int) from) this.play_queue_position += 1; - } - } - - public void stop () { - debug ("stopping playback"); - // don't clear the playlist, just in case (less state changes to sync) - assert(this.mpv.command({"stop", "keep-playlist"}) >= 0); - this.state = PlaybinState.STOPPED; - this.play_queue_position = -1; - this.stopped (); - } - - ~Playbin () { - debug ("destroying playbin"); - } -} diff --git a/src/subsonic.c b/src/subsonic.c new file mode 100644 index 0000000..09dfb48 --- /dev/null +++ b/src/subsonic.c @@ -0,0 +1,2597 @@ +/* subsonic.c generated by valac 0.56.16, the Vala compiler + * generated from subsonic.vala, do not modify */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define AUDREY_CONST_user_agent "audrey/linux" +#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 SUBSONIC_TYPE_ERROR (subsonic_error_get_type ()) + +#define SUBSONIC_TYPE_SONG (subsonic_song_get_type ()) +typedef struct _SubsonicSong SubsonicSong; +typedef void (*SubsonicSongCallback) (SubsonicSong* song, gpointer user_data); + +#define SUBSONIC_TYPE_ARTIST (subsonic_artist_get_type ()) +#define SUBSONIC_ARTIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SUBSONIC_TYPE_ARTIST, SubsonicArtist)) +#define SUBSONIC_ARTIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SUBSONIC_TYPE_ARTIST, SubsonicArtistClass)) +#define SUBSONIC_IS_ARTIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUBSONIC_TYPE_ARTIST)) +#define SUBSONIC_IS_ARTIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SUBSONIC_TYPE_ARTIST)) +#define SUBSONIC_ARTIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SUBSONIC_TYPE_ARTIST, SubsonicArtistClass)) + +typedef struct _SubsonicArtist SubsonicArtist; +typedef struct _SubsonicArtistClass SubsonicArtistClass; +typedef struct _SubsonicArtistPrivate SubsonicArtistPrivate; +enum { + SUBSONIC_ARTIST_0_PROPERTY, + SUBSONIC_ARTIST_NAME_PROPERTY, + SUBSONIC_ARTIST_NUM_PROPERTIES +}; +static GParamSpec* subsonic_artist_properties[SUBSONIC_ARTIST_NUM_PROPERTIES]; +#define _g_free0(var) (var = (g_free (var), NULL)) + +#define SUBSONIC_TYPE_ALBUM (subsonic_album_get_type ()) +#define SUBSONIC_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SUBSONIC_TYPE_ALBUM, SubsonicAlbum)) +#define SUBSONIC_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SUBSONIC_TYPE_ALBUM, SubsonicAlbumClass)) +#define SUBSONIC_IS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUBSONIC_TYPE_ALBUM)) +#define SUBSONIC_IS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SUBSONIC_TYPE_ALBUM)) +#define SUBSONIC_ALBUM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SUBSONIC_TYPE_ALBUM, SubsonicAlbumClass)) + +typedef struct _SubsonicAlbum SubsonicAlbum; +typedef struct _SubsonicAlbumClass SubsonicAlbumClass; +typedef struct _SubsonicAlbumPrivate SubsonicAlbumPrivate; +enum { + SUBSONIC_ALBUM_0_PROPERTY, + SUBSONIC_ALBUM_NUM_PROPERTIES +}; +static GParamSpec* subsonic_album_properties[SUBSONIC_ALBUM_NUM_PROPERTIES]; +#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL))) + +#define SUBSONIC_TYPE_CLIENT (subsonic_client_get_type ()) +#define SUBSONIC_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SUBSONIC_TYPE_CLIENT, SubsonicClient)) +#define SUBSONIC_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SUBSONIC_TYPE_CLIENT, SubsonicClientClass)) +#define SUBSONIC_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUBSONIC_TYPE_CLIENT)) +#define SUBSONIC_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SUBSONIC_TYPE_CLIENT)) +#define SUBSONIC_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SUBSONIC_TYPE_CLIENT, SubsonicClientClass)) + +typedef struct _SubsonicClient SubsonicClient; +typedef struct _SubsonicClientClass SubsonicClientClass; +typedef struct _SubsonicClientPrivate SubsonicClientPrivate; +enum { + SUBSONIC_CLIENT_0_PROPERTY, + SUBSONIC_CLIENT_NUM_PROPERTIES +}; +static GParamSpec* subsonic_client_properties[SUBSONIC_CLIENT_NUM_PROPERTIES]; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL))) +typedef struct _SubsonicClientPingData SubsonicClientPingData; +typedef struct _SubsonicClientScrobbleData SubsonicClientScrobbleData; +typedef struct _SubsonicClientGetRandomSongsData SubsonicClientGetRandomSongsData; +typedef struct _SubsonicClientCoverArtData SubsonicClientCoverArtData; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +typedef enum { + SUBSONIC_ERROR_BAD_AUTHN, + SUBSONIC_ERROR_ERROR +} SubsonicError; +#define SUBSONIC_ERROR subsonic_error_quark () + +struct _SubsonicSong { + gchar* id; + gchar* title; + gchar* album; + gchar* artist; + gint64 track; + gint64 year; + GDateTime* starred; + gint64 duration; + gint64 play_count; + gchar* genre; + gchar* cover_art; +}; + +struct _SubsonicArtist { + GObject parent_instance; + SubsonicArtistPrivate * priv; + gchar* index; + gchar* id; + gchar* cover_art; + gchar* artist_image_url; + gint64 album_count; +}; + +struct _SubsonicArtistClass { + GObjectClass parent_class; +}; + +struct _SubsonicArtistPrivate { + gchar* _name; +}; + +struct _SubsonicAlbum { + GObject parent_instance; + SubsonicAlbumPrivate * priv; + gchar* id; + gchar* name; +}; + +struct _SubsonicAlbumClass { + GObjectClass parent_class; +}; + +struct _SubsonicClient { + GObject parent_instance; + SubsonicClientPrivate * priv; +}; + +struct _SubsonicClientClass { + GObjectClass parent_class; +}; + +struct _SubsonicClientPrivate { + SoupSession* session; + gchar* url; + gchar* parameters; +}; + +struct _SubsonicClientPingData { + int _state_; + GObject* _source_object_; + GAsyncResult* _res_; + GTask* _async_result; + SubsonicClient* self; + SoupMessage* msg; + const gchar* _tmp0_; + const gchar* _tmp1_; + const gchar* _tmp2_; + const gchar* _tmp3_; + gchar* _tmp4_; + gchar* _tmp5_; + SoupMessage* _tmp6_; + SoupMessage* _tmp7_; + GError* _tmp8_; + GBytes* bytes; + SoupSession* _tmp9_; + GBytes* _tmp10_; + JsonParser* parser; + JsonParser* _tmp11_; + JsonParser* _tmp12_; + GBytes* _tmp13_; + gsize _tmp14_; + guint8* _tmp15_; + JsonReader* reader; + JsonParser* _tmp16_; + JsonNode* _tmp17_; + JsonReader* _tmp18_; + JsonReader* _tmp19_; + GError* _inner_error0_; +}; + +struct _SubsonicClientScrobbleData { + int _state_; + GObject* _source_object_; + GAsyncResult* _res_; + GTask* _async_result; + SubsonicClient* self; + gchar* id; + SoupMessage* msg; + const gchar* _tmp0_; + const gchar* _tmp1_; + gchar* _tmp2_; + gchar* _tmp3_; + const gchar* _tmp4_; + const gchar* _tmp5_; + const gchar* _tmp6_; + gchar* _tmp7_; + gchar* _tmp8_; + SoupMessage* _tmp9_; + SoupMessage* _tmp10_; + SoupMessage* _tmp11_; + GBytes* bytes; + SoupSession* _tmp12_; + SoupMessage* _tmp13_; + GBytes* _tmp14_; + SoupMessage* _tmp15_; + JsonParser* parser; + JsonParser* _tmp16_; + JsonParser* _tmp17_; + GBytes* _tmp18_; + gsize _tmp19_; + guint8* _tmp20_; + JsonReader* reader; + JsonParser* _tmp21_; + JsonNode* _tmp22_; + JsonReader* _tmp23_; + JsonReader* _tmp24_; + GError* _inner_error0_; +}; + +struct _SubsonicClientGetRandomSongsData { + int _state_; + GObject* _source_object_; + GAsyncResult* _res_; + GTask* _async_result; + SubsonicClient* self; + gchar* parameters; + SubsonicSongCallback callback; + gpointer callback_target; + gchar* str_parameters; + gchar* _tmp0_; + const gchar* _tmp1_; + gchar* _tmp2_; + SoupMessage* msg; + const gchar* _tmp3_; + const gchar* _tmp4_; + const gchar* _tmp5_; + const gchar* _tmp6_; + const gchar* _tmp7_; + const gchar* _tmp8_; + gchar* _tmp9_; + gchar* _tmp10_; + SoupMessage* _tmp11_; + SoupMessage* _tmp12_; + SoupMessage* _tmp13_; + GBytes* bytes; + SoupSession* _tmp14_; + SoupMessage* _tmp15_; + GBytes* _tmp16_; + SoupMessage* _tmp17_; + JsonParser* parser; + JsonParser* _tmp18_; + JsonParser* _tmp19_; + GBytes* _tmp20_; + gsize _tmp21_; + guint8* _tmp22_; + JsonReader* reader; + JsonParser* _tmp23_; + JsonNode* _tmp24_; + JsonReader* _tmp25_; + JsonReader* _tmp26_; + JsonReader* _tmp27_; + JsonReader* _tmp28_; + gint i; + gboolean _tmp29_; + JsonReader* _tmp30_; + JsonReader* _tmp31_; + JsonReader* _tmp32_; + SubsonicSong _tmp33_; + SubsonicSong _tmp34_; + JsonReader* _tmp35_; + JsonReader* _tmp36_; + GError* _tmp37_; + GError* _inner_error0_; +}; + +struct _SubsonicClientCoverArtData { + int _state_; + GObject* _source_object_; + GAsyncResult* _res_; + GTask* _async_result; + SubsonicClient* self; + gchar* id; + gint size; + gint priority; + GCancellable* cancellable; + GdkPixbuf* result; + SoupMessage* msg; + gchar* _tmp0_; + gchar* _tmp1_; + SoupMessage* _tmp2_; + SoupMessage* _tmp3_; + SoupMessage* _tmp4_; + GInputStream* stream; + SoupSession* _tmp5_; + SoupMessage* _tmp6_; + GInputStream* _tmp7_; + SoupMessage* _tmp8_; + SoupMessage* _tmp9_; + const gchar* _tmp10_; + GdkPixbuf* _tmp11_; + GInputStream* _tmp12_; + GdkPixbuf* _tmp13_; + GdkPixbuf* _tmp14_; + GError* _inner_error0_; +}; + +static gint SubsonicArtist_private_offset; +static gpointer subsonic_artist_parent_class = NULL; +static gpointer subsonic_album_parent_class = NULL; +static gint SubsonicClient_private_offset; +static gpointer subsonic_client_parent_class = NULL; + +VALA_EXTERN GQuark subsonic_error_quark (void); +VALA_EXTERN GType subsonic_error_get_type (void) G_GNUC_CONST ; +VALA_EXTERN GType subsonic_song_get_type (void) G_GNUC_CONST ; +VALA_EXTERN SubsonicSong* subsonic_song_dup (const SubsonicSong* self); +VALA_EXTERN void subsonic_song_free (SubsonicSong* self); +VALA_EXTERN void subsonic_song_copy (const SubsonicSong* self, + SubsonicSong* dest); +VALA_EXTERN void subsonic_song_destroy (SubsonicSong* self); +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (SubsonicSong, subsonic_song_destroy) +VALA_EXTERN GType subsonic_artist_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (SubsonicArtist, g_object_unref) +VALA_EXTERN SubsonicArtist* subsonic_artist_new (const gchar* index, + JsonReader* reader); +VALA_EXTERN SubsonicArtist* subsonic_artist_construct (GType object_type, + const gchar* index, + JsonReader* reader); +static void subsonic_artist_set_name (SubsonicArtist* self, + const gchar* value); +VALA_EXTERN const gchar* subsonic_artist_get_name (SubsonicArtist* self); +static void subsonic_artist_finalize (GObject * obj); +static GType subsonic_artist_get_type_once (void); +static void _vala_subsonic_artist_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec); +static void _vala_subsonic_artist_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec); +VALA_EXTERN GType subsonic_album_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (SubsonicAlbum, g_object_unref) +VALA_EXTERN SubsonicAlbum* subsonic_album_new (JsonReader* reader); +VALA_EXTERN SubsonicAlbum* subsonic_album_construct (GType object_type, + JsonReader* reader); +static void subsonic_album_finalize (GObject * obj); +static GType subsonic_album_get_type_once (void); +VALA_EXTERN void subsonic_song_init (SubsonicSong *self, + JsonReader* reader); +VALA_EXTERN GType subsonic_client_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (SubsonicClient, g_object_unref) +VALA_EXTERN SubsonicClient* subsonic_client_new_with_token (const gchar* url, + const gchar* username, + const gchar* token, + const gchar* salt); +VALA_EXTERN SubsonicClient* subsonic_client_construct_with_token (GType object_type, + const gchar* url, + const gchar* username, + const gchar* token, + const gchar* salt); +static void subsonic_client_unwrap_response (SubsonicClient* self, + JsonReader* reader, + GError** error); +static void subsonic_client_ping_data_free (gpointer _data); +VALA_EXTERN void subsonic_client_ping (SubsonicClient* self, + GAsyncReadyCallback _callback_, + gpointer _user_data_); +VALA_EXTERN void subsonic_client_ping_finish (SubsonicClient* self, + GAsyncResult* _res_, + GError** error); +static gboolean subsonic_client_ping_co (SubsonicClientPingData* _data_); +static void subsonic_client_ping_ready (GObject* source_object, + GAsyncResult* _res_, + gpointer _user_data_); +static void subsonic_client_scrobble_data_free (gpointer _data); +VALA_EXTERN void subsonic_client_scrobble (SubsonicClient* self, + const gchar* id, + GAsyncReadyCallback _callback_, + gpointer _user_data_); +VALA_EXTERN void subsonic_client_scrobble_finish (SubsonicClient* self, + GAsyncResult* _res_, + GError** error); +static gboolean subsonic_client_scrobble_co (SubsonicClientScrobbleData* _data_); +static void subsonic_client_scrobble_ready (GObject* source_object, + GAsyncResult* _res_, + gpointer _user_data_); +static void subsonic_client_get_random_songs_data_free (gpointer _data); +VALA_EXTERN void subsonic_client_get_random_songs (SubsonicClient* self, + const gchar* parameters, + SubsonicSongCallback callback, + gpointer callback_target, + GAsyncReadyCallback _callback_, + gpointer _user_data_); +VALA_EXTERN void subsonic_client_get_random_songs_finish (SubsonicClient* self, + GAsyncResult* _res_, + GError** error); +static gboolean subsonic_client_get_random_songs_co (SubsonicClientGetRandomSongsData* _data_); +static void subsonic_client_get_random_songs_ready (GObject* source_object, + GAsyncResult* _res_, + gpointer _user_data_); +static gboolean _subsonic_client_get_random_songs_co_gsource_func (gpointer self); +VALA_EXTERN gchar* subsonic_client_stream_uri (SubsonicClient* self, + const gchar* id); +VALA_EXTERN gchar* subsonic_client_cover_art_uri (SubsonicClient* self, + const gchar* id, + gint size); +static void subsonic_client_cover_art_data_free (gpointer _data); +VALA_EXTERN void subsonic_client_cover_art (SubsonicClient* self, + const gchar* id, + gint size, + gint priority, + GCancellable* cancellable, + GAsyncReadyCallback _callback_, + gpointer _user_data_); +VALA_EXTERN GdkPixbuf* subsonic_client_cover_art_finish (SubsonicClient* self, + GAsyncResult* _res_, + GError** error); +static gboolean subsonic_client_cover_art_co (SubsonicClientCoverArtData* _data_); +static void subsonic_client_cover_art_ready (GObject* source_object, + GAsyncResult* _res_, + gpointer _user_data_); +VALA_EXTERN SubsonicClient* subsonic_client_new (void); +VALA_EXTERN SubsonicClient* subsonic_client_construct (GType object_type); +static void subsonic_client_finalize (GObject * obj); +static GType subsonic_client_get_type_once (void); + +GQuark +subsonic_error_quark (void) +{ + return g_quark_from_static_string ("subsonic-error-quark"); +} + +static GType +subsonic_error_get_type_once (void) +{ + static const GEnumValue values[] = {{SUBSONIC_ERROR_BAD_AUTHN, "SUBSONIC_ERROR_BAD_AUTHN", "bad-authn"}, {SUBSONIC_ERROR_ERROR, "SUBSONIC_ERROR_ERROR", "error"}, {0, NULL, NULL}}; + GType subsonic_error_type_id; + subsonic_error_type_id = g_enum_register_static ("SubsonicError", values); + return subsonic_error_type_id; +} + +GType +subsonic_error_get_type (void) +{ + static volatile gsize subsonic_error_type_id__once = 0; + if (g_once_init_enter (&subsonic_error_type_id__once)) { + GType subsonic_error_type_id; + subsonic_error_type_id = subsonic_error_get_type_once (); + g_once_init_leave (&subsonic_error_type_id__once, subsonic_error_type_id); + } + return subsonic_error_type_id__once; +} + +static inline gpointer +subsonic_artist_get_instance_private (SubsonicArtist* self) +{ + return G_STRUCT_MEMBER_P (self, SubsonicArtist_private_offset); +} + +SubsonicArtist* +subsonic_artist_construct (GType object_type, + const gchar* index, + JsonReader* reader) +{ + SubsonicArtist * self = NULL; + gchar* _tmp0_; + const gchar* _tmp1_; + gchar* _tmp2_; + const gchar* _tmp3_; + const gchar* _tmp4_; + gchar* _tmp5_; + const gchar* _tmp6_; + gchar* _tmp7_; +#line 16 "../src/subsonic.vala" + g_return_val_if_fail (index != NULL, NULL); +#line 16 "../src/subsonic.vala" + g_return_val_if_fail (reader != NULL, NULL); +#line 16 "../src/subsonic.vala" + self = (SubsonicArtist*) g_object_new (object_type, NULL); +#line 17 "../src/subsonic.vala" + _tmp0_ = g_strdup (index); +#line 17 "../src/subsonic.vala" + _g_free0 (self->index); +#line 17 "../src/subsonic.vala" + self->index = _tmp0_; +#line 19 "../src/subsonic.vala" + json_reader_read_member (reader, "id"); +#line 20 "../src/subsonic.vala" + _tmp1_ = json_reader_get_string_value (reader); +#line 20 "../src/subsonic.vala" + _tmp2_ = g_strdup (_tmp1_); +#line 20 "../src/subsonic.vala" + _g_free0 (self->id); +#line 20 "../src/subsonic.vala" + self->id = _tmp2_; +#line 21 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 23 "../src/subsonic.vala" + json_reader_read_member (reader, "name"); +#line 24 "../src/subsonic.vala" + _tmp3_ = json_reader_get_string_value (reader); +#line 24 "../src/subsonic.vala" + subsonic_artist_set_name (self, _tmp3_); +#line 25 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 27 "../src/subsonic.vala" + json_reader_read_member (reader, "coverArt"); +#line 28 "../src/subsonic.vala" + _tmp4_ = json_reader_get_string_value (reader); +#line 28 "../src/subsonic.vala" + _tmp5_ = g_strdup (_tmp4_); +#line 28 "../src/subsonic.vala" + _g_free0 (self->cover_art); +#line 28 "../src/subsonic.vala" + self->cover_art = _tmp5_; +#line 29 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 31 "../src/subsonic.vala" + json_reader_read_member (reader, "artistImageUrl"); +#line 32 "../src/subsonic.vala" + _tmp6_ = json_reader_get_string_value (reader); +#line 32 "../src/subsonic.vala" + _tmp7_ = g_strdup (_tmp6_); +#line 32 "../src/subsonic.vala" + _g_free0 (self->artist_image_url); +#line 32 "../src/subsonic.vala" + self->artist_image_url = _tmp7_; +#line 33 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 35 "../src/subsonic.vala" + json_reader_read_member (reader, "albumCount"); +#line 36 "../src/subsonic.vala" + self->album_count = json_reader_get_int_value (reader); +#line 37 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 16 "../src/subsonic.vala" + return self; +#line 555 "subsonic.c" +} + +SubsonicArtist* +subsonic_artist_new (const gchar* index, + JsonReader* reader) +{ +#line 16 "../src/subsonic.vala" + return subsonic_artist_construct (SUBSONIC_TYPE_ARTIST, index, reader); +#line 564 "subsonic.c" +} + +const gchar* +subsonic_artist_get_name (SubsonicArtist* self) +{ + const gchar* result; + const gchar* _tmp0_; +#line 11 "../src/subsonic.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 11 "../src/subsonic.vala" + _tmp0_ = self->priv->_name; +#line 11 "../src/subsonic.vala" + result = _tmp0_; +#line 11 "../src/subsonic.vala" + return result; +#line 580 "subsonic.c" +} + +static void +subsonic_artist_set_name (SubsonicArtist* self, + const gchar* value) +{ + gchar* old_value; +#line 11 "../src/subsonic.vala" + g_return_if_fail (self != NULL); +#line 11 "../src/subsonic.vala" + old_value = subsonic_artist_get_name (self); +#line 11 "../src/subsonic.vala" + if (g_strcmp0 (value, old_value) != 0) { +#line 594 "subsonic.c" + gchar* _tmp0_; +#line 11 "../src/subsonic.vala" + _tmp0_ = g_strdup (value); +#line 11 "../src/subsonic.vala" + _g_free0 (self->priv->_name); +#line 11 "../src/subsonic.vala" + self->priv->_name = _tmp0_; +#line 11 "../src/subsonic.vala" + g_object_notify_by_pspec ((GObject *) self, subsonic_artist_properties[SUBSONIC_ARTIST_NAME_PROPERTY]); +#line 604 "subsonic.c" + } +} + +static void +subsonic_artist_class_init (SubsonicArtistClass * klass, + gpointer klass_data) +{ +#line 8 "../src/subsonic.vala" + subsonic_artist_parent_class = g_type_class_peek_parent (klass); +#line 8 "../src/subsonic.vala" + g_type_class_adjust_private_offset (klass, &SubsonicArtist_private_offset); +#line 8 "../src/subsonic.vala" + G_OBJECT_CLASS (klass)->get_property = _vala_subsonic_artist_get_property; +#line 8 "../src/subsonic.vala" + G_OBJECT_CLASS (klass)->set_property = _vala_subsonic_artist_set_property; +#line 8 "../src/subsonic.vala" + G_OBJECT_CLASS (klass)->finalize = subsonic_artist_finalize; +#line 8 "../src/subsonic.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), SUBSONIC_ARTIST_NAME_PROPERTY, subsonic_artist_properties[SUBSONIC_ARTIST_NAME_PROPERTY] = g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 624 "subsonic.c" +} + +static void +subsonic_artist_instance_init (SubsonicArtist * self, + gpointer klass) +{ +#line 8 "../src/subsonic.vala" + self->priv = subsonic_artist_get_instance_private (self); +#line 633 "subsonic.c" +} + +static void +subsonic_artist_finalize (GObject * obj) +{ + SubsonicArtist * self; +#line 8 "../src/subsonic.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, SUBSONIC_TYPE_ARTIST, SubsonicArtist); +#line 9 "../src/subsonic.vala" + _g_free0 (self->index); +#line 10 "../src/subsonic.vala" + _g_free0 (self->id); +#line 11 "../src/subsonic.vala" + _g_free0 (self->priv->_name); +#line 12 "../src/subsonic.vala" + _g_free0 (self->cover_art); +#line 13 "../src/subsonic.vala" + _g_free0 (self->artist_image_url); +#line 8 "../src/subsonic.vala" + G_OBJECT_CLASS (subsonic_artist_parent_class)->finalize (obj); +#line 654 "subsonic.c" +} + +static GType +subsonic_artist_get_type_once (void) +{ + static const GTypeInfo g_define_type_info = { sizeof (SubsonicArtistClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) subsonic_artist_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SubsonicArtist), 0, (GInstanceInitFunc) subsonic_artist_instance_init, NULL }; + GType subsonic_artist_type_id; + subsonic_artist_type_id = g_type_register_static (G_TYPE_OBJECT, "SubsonicArtist", &g_define_type_info, 0); + SubsonicArtist_private_offset = g_type_add_instance_private (subsonic_artist_type_id, sizeof (SubsonicArtistPrivate)); + return subsonic_artist_type_id; +} + +GType +subsonic_artist_get_type (void) +{ + static volatile gsize subsonic_artist_type_id__once = 0; + if (g_once_init_enter (&subsonic_artist_type_id__once)) { + GType subsonic_artist_type_id; + subsonic_artist_type_id = subsonic_artist_get_type_once (); + g_once_init_leave (&subsonic_artist_type_id__once, subsonic_artist_type_id); + } + return subsonic_artist_type_id__once; +} + +static void +_vala_subsonic_artist_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec) +{ + SubsonicArtist * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, SUBSONIC_TYPE_ARTIST, SubsonicArtist); +#line 8 "../src/subsonic.vala" + switch (property_id) { +#line 8 "../src/subsonic.vala" + case SUBSONIC_ARTIST_NAME_PROPERTY: +#line 8 "../src/subsonic.vala" + g_value_set_string (value, subsonic_artist_get_name (self)); +#line 8 "../src/subsonic.vala" + break; +#line 695 "subsonic.c" + default: +#line 8 "../src/subsonic.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 8 "../src/subsonic.vala" + break; +#line 701 "subsonic.c" + } +} + +static void +_vala_subsonic_artist_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec) +{ + SubsonicArtist * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, SUBSONIC_TYPE_ARTIST, SubsonicArtist); +#line 8 "../src/subsonic.vala" + switch (property_id) { +#line 8 "../src/subsonic.vala" + case SUBSONIC_ARTIST_NAME_PROPERTY: +#line 8 "../src/subsonic.vala" + subsonic_artist_set_name (self, g_value_get_string (value)); +#line 8 "../src/subsonic.vala" + break; +#line 721 "subsonic.c" + default: +#line 8 "../src/subsonic.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 8 "../src/subsonic.vala" + break; +#line 727 "subsonic.c" + } +} + +SubsonicAlbum* +subsonic_album_construct (GType object_type, + JsonReader* reader) +{ + SubsonicAlbum * self = NULL; + const gchar* _tmp0_; + gchar* _tmp1_; + const gchar* _tmp2_; + gchar* _tmp3_; +#line 45 "../src/subsonic.vala" + g_return_val_if_fail (reader != NULL, NULL); +#line 45 "../src/subsonic.vala" + self = (SubsonicAlbum*) g_object_new (object_type, NULL); +#line 46 "../src/subsonic.vala" + json_reader_read_member (reader, "id"); +#line 47 "../src/subsonic.vala" + _tmp0_ = json_reader_get_string_value (reader); +#line 47 "../src/subsonic.vala" + _tmp1_ = g_strdup (_tmp0_); +#line 47 "../src/subsonic.vala" + _g_free0 (self->id); +#line 47 "../src/subsonic.vala" + self->id = _tmp1_; +#line 48 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 50 "../src/subsonic.vala" + json_reader_read_member (reader, "name"); +#line 51 "../src/subsonic.vala" + _tmp2_ = json_reader_get_string_value (reader); +#line 51 "../src/subsonic.vala" + _tmp3_ = g_strdup (_tmp2_); +#line 51 "../src/subsonic.vala" + _g_free0 (self->name); +#line 51 "../src/subsonic.vala" + self->name = _tmp3_; +#line 52 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 45 "../src/subsonic.vala" + return self; +#line 770 "subsonic.c" +} + +SubsonicAlbum* +subsonic_album_new (JsonReader* reader) +{ +#line 45 "../src/subsonic.vala" + return subsonic_album_construct (SUBSONIC_TYPE_ALBUM, reader); +#line 778 "subsonic.c" +} + +static void +subsonic_album_class_init (SubsonicAlbumClass * klass, + gpointer klass_data) +{ +#line 41 "../src/subsonic.vala" + subsonic_album_parent_class = g_type_class_peek_parent (klass); +#line 41 "../src/subsonic.vala" + G_OBJECT_CLASS (klass)->finalize = subsonic_album_finalize; +#line 789 "subsonic.c" +} + +static void +subsonic_album_instance_init (SubsonicAlbum * self, + gpointer klass) +{ +} + +static void +subsonic_album_finalize (GObject * obj) +{ + SubsonicAlbum * self; +#line 41 "../src/subsonic.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, SUBSONIC_TYPE_ALBUM, SubsonicAlbum); +#line 42 "../src/subsonic.vala" + _g_free0 (self->id); +#line 43 "../src/subsonic.vala" + _g_free0 (self->name); +#line 41 "../src/subsonic.vala" + G_OBJECT_CLASS (subsonic_album_parent_class)->finalize (obj); +#line 810 "subsonic.c" +} + +static GType +subsonic_album_get_type_once (void) +{ + static const GTypeInfo g_define_type_info = { sizeof (SubsonicAlbumClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) subsonic_album_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SubsonicAlbum), 0, (GInstanceInitFunc) subsonic_album_instance_init, NULL }; + GType subsonic_album_type_id; + subsonic_album_type_id = g_type_register_static (G_TYPE_OBJECT, "SubsonicAlbum", &g_define_type_info, 0); + return subsonic_album_type_id; +} + +GType +subsonic_album_get_type (void) +{ + static volatile gsize subsonic_album_type_id__once = 0; + if (g_once_init_enter (&subsonic_album_type_id__once)) { + GType subsonic_album_type_id; + subsonic_album_type_id = subsonic_album_get_type_once (); + g_once_init_leave (&subsonic_album_type_id__once, subsonic_album_type_id); + } + return subsonic_album_type_id__once; +} + +void +subsonic_song_init (SubsonicSong *self, + JsonReader* reader) +{ + const gchar* _tmp0_; + gchar* _tmp1_; + const gchar* _tmp2_; + gchar* _tmp3_; + const gchar* _tmp4_; + gchar* _tmp5_; + const gchar* _tmp6_; + gchar* _tmp7_; + const gchar* _tmp8_; + gchar* _tmp9_; + const gchar* _tmp10_; + gchar* _tmp11_; +#line 69 "../src/subsonic.vala" + g_return_if_fail (reader != NULL); +#line 69 "../src/subsonic.vala" + memset (self, 0, sizeof (SubsonicSong)); +#line 70 "../src/subsonic.vala" + json_reader_read_member (reader, "id"); +#line 71 "../src/subsonic.vala" + _tmp0_ = json_reader_get_string_value (reader); +#line 71 "../src/subsonic.vala" + _tmp1_ = g_strdup (_tmp0_); +#line 71 "../src/subsonic.vala" + _g_free0 ((*self).id); +#line 71 "../src/subsonic.vala" + (*self).id = _tmp1_; +#line 72 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 74 "../src/subsonic.vala" + json_reader_read_member (reader, "title"); +#line 75 "../src/subsonic.vala" + _tmp2_ = json_reader_get_string_value (reader); +#line 75 "../src/subsonic.vala" + _tmp3_ = g_strdup (_tmp2_); +#line 75 "../src/subsonic.vala" + _g_free0 ((*self).title); +#line 75 "../src/subsonic.vala" + (*self).title = _tmp3_; +#line 76 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 78 "../src/subsonic.vala" + json_reader_read_member (reader, "album"); +#line 79 "../src/subsonic.vala" + _tmp4_ = json_reader_get_string_value (reader); +#line 79 "../src/subsonic.vala" + _tmp5_ = g_strdup (_tmp4_); +#line 79 "../src/subsonic.vala" + _g_free0 ((*self).album); +#line 79 "../src/subsonic.vala" + (*self).album = _tmp5_; +#line 80 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 82 "../src/subsonic.vala" + json_reader_read_member (reader, "artist"); +#line 83 "../src/subsonic.vala" + _tmp6_ = json_reader_get_string_value (reader); +#line 83 "../src/subsonic.vala" + _tmp7_ = g_strdup (_tmp6_); +#line 83 "../src/subsonic.vala" + _g_free0 ((*self).artist); +#line 83 "../src/subsonic.vala" + (*self).artist = _tmp7_; +#line 84 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 86 "../src/subsonic.vala" + json_reader_read_member (reader, "track"); +#line 87 "../src/subsonic.vala" + (*self).track = json_reader_get_int_value (reader); +#line 88 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 90 "../src/subsonic.vala" + json_reader_read_member (reader, "year"); +#line 91 "../src/subsonic.vala" + (*self).year = json_reader_get_int_value (reader); +#line 92 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 94 "../src/subsonic.vala" + json_reader_read_member (reader, "duration"); +#line 95 "../src/subsonic.vala" + (*self).duration = json_reader_get_int_value (reader); +#line 96 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 98 "../src/subsonic.vala" + json_reader_read_member (reader, "playCount"); +#line 99 "../src/subsonic.vala" + (*self).play_count = json_reader_get_int_value (reader); +#line 100 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 102 "../src/subsonic.vala" + json_reader_read_member (reader, "genre"); +#line 103 "../src/subsonic.vala" + _tmp8_ = json_reader_get_string_value (reader); +#line 103 "../src/subsonic.vala" + _tmp9_ = g_strdup (_tmp8_); +#line 103 "../src/subsonic.vala" + _g_free0 ((*self).genre); +#line 103 "../src/subsonic.vala" + (*self).genre = _tmp9_; +#line 104 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 106 "../src/subsonic.vala" + json_reader_read_member (reader, "coverArt"); +#line 107 "../src/subsonic.vala" + _tmp10_ = json_reader_get_string_value (reader); +#line 107 "../src/subsonic.vala" + _tmp11_ = g_strdup (_tmp10_); +#line 107 "../src/subsonic.vala" + _g_free0 ((*self).cover_art); +#line 107 "../src/subsonic.vala" + (*self).cover_art = _tmp11_; +#line 108 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 950 "subsonic.c" +} + +static gpointer +_g_date_time_ref0 (gpointer self) +{ +#line 56 "../src/subsonic.vala" + return self ? g_date_time_ref (self) : NULL; +#line 958 "subsonic.c" +} + +void +subsonic_song_copy (const SubsonicSong* self, + SubsonicSong* dest) +{ + const gchar* _tmp0_; + gchar* _tmp1_; + const gchar* _tmp2_; + gchar* _tmp3_; + const gchar* _tmp4_; + gchar* _tmp5_; + const gchar* _tmp6_; + gchar* _tmp7_; + GDateTime* _tmp8_; + GDateTime* _tmp9_; + const gchar* _tmp10_; + gchar* _tmp11_; + const gchar* _tmp12_; + gchar* _tmp13_; +#line 56 "../src/subsonic.vala" + _tmp0_ = (*self).id; +#line 56 "../src/subsonic.vala" + _tmp1_ = g_strdup (_tmp0_); +#line 56 "../src/subsonic.vala" + _g_free0 ((*dest).id); +#line 56 "../src/subsonic.vala" + (*dest).id = _tmp1_; +#line 56 "../src/subsonic.vala" + _tmp2_ = (*self).title; +#line 56 "../src/subsonic.vala" + _tmp3_ = g_strdup (_tmp2_); +#line 56 "../src/subsonic.vala" + _g_free0 ((*dest).title); +#line 56 "../src/subsonic.vala" + (*dest).title = _tmp3_; +#line 56 "../src/subsonic.vala" + _tmp4_ = (*self).album; +#line 56 "../src/subsonic.vala" + _tmp5_ = g_strdup (_tmp4_); +#line 56 "../src/subsonic.vala" + _g_free0 ((*dest).album); +#line 56 "../src/subsonic.vala" + (*dest).album = _tmp5_; +#line 56 "../src/subsonic.vala" + _tmp6_ = (*self).artist; +#line 56 "../src/subsonic.vala" + _tmp7_ = g_strdup (_tmp6_); +#line 56 "../src/subsonic.vala" + _g_free0 ((*dest).artist); +#line 56 "../src/subsonic.vala" + (*dest).artist = _tmp7_; +#line 56 "../src/subsonic.vala" + (*dest).track = (*self).track; +#line 56 "../src/subsonic.vala" + (*dest).year = (*self).year; +#line 56 "../src/subsonic.vala" + _tmp8_ = (*self).starred; +#line 56 "../src/subsonic.vala" + _tmp9_ = _g_date_time_ref0 (_tmp8_); +#line 56 "../src/subsonic.vala" + _g_date_time_unref0 ((*dest).starred); +#line 56 "../src/subsonic.vala" + (*dest).starred = _tmp9_; +#line 56 "../src/subsonic.vala" + (*dest).duration = (*self).duration; +#line 56 "../src/subsonic.vala" + (*dest).play_count = (*self).play_count; +#line 56 "../src/subsonic.vala" + _tmp10_ = (*self).genre; +#line 56 "../src/subsonic.vala" + _tmp11_ = g_strdup (_tmp10_); +#line 56 "../src/subsonic.vala" + _g_free0 ((*dest).genre); +#line 56 "../src/subsonic.vala" + (*dest).genre = _tmp11_; +#line 56 "../src/subsonic.vala" + _tmp12_ = (*self).cover_art; +#line 56 "../src/subsonic.vala" + _tmp13_ = g_strdup (_tmp12_); +#line 56 "../src/subsonic.vala" + _g_free0 ((*dest).cover_art); +#line 56 "../src/subsonic.vala" + (*dest).cover_art = _tmp13_; +#line 1043 "subsonic.c" +} + +void +subsonic_song_destroy (SubsonicSong* self) +{ +#line 57 "../src/subsonic.vala" + _g_free0 ((*self).id); +#line 58 "../src/subsonic.vala" + _g_free0 ((*self).title); +#line 59 "../src/subsonic.vala" + _g_free0 ((*self).album); +#line 60 "../src/subsonic.vala" + _g_free0 ((*self).artist); +#line 63 "../src/subsonic.vala" + _g_date_time_unref0 ((*self).starred); +#line 66 "../src/subsonic.vala" + _g_free0 ((*self).genre); +#line 67 "../src/subsonic.vala" + _g_free0 ((*self).cover_art); +#line 1063 "subsonic.c" +} + +SubsonicSong* +subsonic_song_dup (const SubsonicSong* self) +{ + SubsonicSong* dup; +#line 56 "../src/subsonic.vala" + dup = g_new0 (SubsonicSong, 1); +#line 56 "../src/subsonic.vala" + subsonic_song_copy (self, dup); +#line 56 "../src/subsonic.vala" + return dup; +#line 1076 "subsonic.c" +} + +void +subsonic_song_free (SubsonicSong* self) +{ +#line 56 "../src/subsonic.vala" + subsonic_song_destroy (self); +#line 56 "../src/subsonic.vala" + g_free (self); +#line 1086 "subsonic.c" +} + +static GType +subsonic_song_get_type_once (void) +{ + GType subsonic_song_type_id; + subsonic_song_type_id = g_boxed_type_register_static ("SubsonicSong", (GBoxedCopyFunc) subsonic_song_dup, (GBoxedFreeFunc) subsonic_song_free); + return subsonic_song_type_id; +} + +GType +subsonic_song_get_type (void) +{ + static volatile gsize subsonic_song_type_id__once = 0; + if (g_once_init_enter (&subsonic_song_type_id__once)) { + GType subsonic_song_type_id; + subsonic_song_type_id = subsonic_song_get_type_once (); + g_once_init_leave (&subsonic_song_type_id__once, subsonic_song_type_id); + } + return subsonic_song_type_id__once; +} + +static inline gpointer +subsonic_client_get_instance_private (SubsonicClient* self) +{ + return G_STRUCT_MEMBER_P (self, SubsonicClient_private_offset); +} + +static const gchar* +string_to_string (const gchar* self) +{ + const gchar* result; +#line 1589 "glib-2.0.vapi" + g_return_val_if_fail (self != NULL, NULL); +#line 1590 "glib-2.0.vapi" + result = self; +#line 1590 "glib-2.0.vapi" + return result; +#line 1125 "subsonic.c" +} + +SubsonicClient* +subsonic_client_construct_with_token (GType object_type, + const gchar* url, + const gchar* username, + const gchar* token, + const gchar* salt) +{ + SubsonicClient * self = NULL; + gchar* _tmp0_; + gchar* _tmp1_; + gchar* _tmp2_; + const gchar* _tmp3_; + gchar* _tmp4_; + gchar* _tmp5_; + const gchar* _tmp6_; + gchar* _tmp7_; + gchar* _tmp8_; + const gchar* _tmp9_; + gchar* _tmp10_; + SoupSession* _tmp11_; + SoupSession* _tmp12_; +#line 117 "../src/subsonic.vala" + g_return_val_if_fail (url != NULL, NULL); +#line 117 "../src/subsonic.vala" + g_return_val_if_fail (username != NULL, NULL); +#line 117 "../src/subsonic.vala" + g_return_val_if_fail (token != NULL, NULL); +#line 117 "../src/subsonic.vala" + g_return_val_if_fail (salt != NULL, NULL); +#line 117 "../src/subsonic.vala" + self = (SubsonicClient*) g_object_new (object_type, NULL); +#line 118 "../src/subsonic.vala" + _tmp0_ = g_strdup (url); +#line 118 "../src/subsonic.vala" + _g_free0 (self->priv->url); +#line 118 "../src/subsonic.vala" + self->priv->url = _tmp0_; +#line 119 "../src/subsonic.vala" + _tmp1_ = g_uri_escape_string (username, NULL, TRUE); +#line 119 "../src/subsonic.vala" + _tmp2_ = _tmp1_; +#line 119 "../src/subsonic.vala" + _tmp3_ = string_to_string (_tmp2_); +#line 119 "../src/subsonic.vala" + _tmp4_ = g_uri_escape_string (token, NULL, TRUE); +#line 119 "../src/subsonic.vala" + _tmp5_ = _tmp4_; +#line 119 "../src/subsonic.vala" + _tmp6_ = string_to_string (_tmp5_); +#line 119 "../src/subsonic.vala" + _tmp7_ = g_uri_escape_string (salt, NULL, TRUE); +#line 119 "../src/subsonic.vala" + _tmp8_ = _tmp7_; +#line 119 "../src/subsonic.vala" + _tmp9_ = string_to_string (_tmp8_); +#line 119 "../src/subsonic.vala" + _tmp10_ = g_strconcat ("u=", _tmp3_, "&t=", _tmp6_, "&s=", _tmp9_, "&v=1.16.1&c=eu.callcc.audrey", NULL); +#line 119 "../src/subsonic.vala" + _g_free0 (self->priv->parameters); +#line 119 "../src/subsonic.vala" + self->priv->parameters = _tmp10_; +#line 119 "../src/subsonic.vala" + _g_free0 (_tmp8_); +#line 119 "../src/subsonic.vala" + _g_free0 (_tmp5_); +#line 119 "../src/subsonic.vala" + _g_free0 (_tmp2_); +#line 121 "../src/subsonic.vala" + _tmp11_ = soup_session_new (); +#line 121 "../src/subsonic.vala" + _g_object_unref0 (self->priv->session); +#line 121 "../src/subsonic.vala" + self->priv->session = _tmp11_; +#line 122 "../src/subsonic.vala" + _tmp12_ = self->priv->session; +#line 122 "../src/subsonic.vala" + soup_session_set_user_agent (_tmp12_, AUDREY_CONST_user_agent); +#line 117 "../src/subsonic.vala" + return self; +#line 1207 "subsonic.c" +} + +SubsonicClient* +subsonic_client_new_with_token (const gchar* url, + const gchar* username, + const gchar* token, + const gchar* salt) +{ +#line 117 "../src/subsonic.vala" + return subsonic_client_construct_with_token (SUBSONIC_TYPE_CLIENT, url, username, token, salt); +#line 1218 "subsonic.c" +} + +static void +subsonic_client_unwrap_response (SubsonicClient* self, + JsonReader* reader, + GError** error) +{ + const gchar* _tmp0_; + GError* _inner_error0_ = NULL; +#line 125 "../src/subsonic.vala" + g_return_if_fail (self != NULL); +#line 125 "../src/subsonic.vala" + g_return_if_fail (reader != NULL); +#line 126 "../src/subsonic.vala" + json_reader_read_member (reader, "subsonic-response"); +#line 128 "../src/subsonic.vala" + json_reader_read_member (reader, "status"); +#line 129 "../src/subsonic.vala" + _tmp0_ = json_reader_get_string_value (reader); +#line 129 "../src/subsonic.vala" + if (g_strcmp0 (_tmp0_, "ok") != 0) { +#line 1240 "subsonic.c" + const gchar* _tmp1_ = NULL; + const gchar* _tmp2_; + GError* _tmp3_; +#line 130 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 131 "../src/subsonic.vala" + json_reader_read_member (reader, "error"); +#line 132 "../src/subsonic.vala" + json_reader_read_member (reader, "message"); +#line 133 "../src/subsonic.vala" + _tmp2_ = json_reader_get_string_value (reader); +#line 133 "../src/subsonic.vala" + _tmp1_ = _tmp2_; +#line 133 "../src/subsonic.vala" + if (_tmp1_ == NULL) { +#line 133 "../src/subsonic.vala" + _tmp1_ = "???"; +#line 1258 "subsonic.c" + } +#line 133 "../src/subsonic.vala" + _tmp3_ = g_error_new_literal (SUBSONIC_ERROR, SUBSONIC_ERROR_ERROR, _tmp1_); +#line 133 "../src/subsonic.vala" + _inner_error0_ = _tmp3_; +#line 133 "../src/subsonic.vala" + g_propagate_error (error, _inner_error0_); +#line 133 "../src/subsonic.vala" + return; +#line 1268 "subsonic.c" + } +#line 135 "../src/subsonic.vala" + json_reader_end_member (reader); +#line 1272 "subsonic.c" +} + +static void +subsonic_client_ping_data_free (gpointer _data) +{ + SubsonicClientPingData* _data_; + _data_ = _data; +#line 112 "../src/subsonic.vala" + _g_object_unref0 (_data_->self); +#line 112 "../src/subsonic.vala" + g_slice_free (SubsonicClientPingData, _data_); +#line 1284 "subsonic.c" +} + +static gpointer +_g_object_ref0 (gpointer self) +{ +#line 112 "../src/subsonic.vala" + return self ? g_object_ref (self) : NULL; +#line 1292 "subsonic.c" +} + +void +subsonic_client_ping (SubsonicClient* self, + GAsyncReadyCallback _callback_, + gpointer _user_data_) +{ + SubsonicClientPingData* _data_; + SubsonicClient* _tmp0_; +#line 112 "../src/subsonic.vala" + g_return_if_fail (self != NULL); +#line 112 "../src/subsonic.vala" + _data_ = g_slice_new0 (SubsonicClientPingData); +#line 112 "../src/subsonic.vala" + _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_); +#line 112 "../src/subsonic.vala" + g_task_set_task_data (_data_->_async_result, _data_, subsonic_client_ping_data_free); +#line 112 "../src/subsonic.vala" + _tmp0_ = _g_object_ref0 (self); +#line 112 "../src/subsonic.vala" + _data_->self = _tmp0_; +#line 112 "../src/subsonic.vala" + subsonic_client_ping_co (_data_); +#line 1316 "subsonic.c" +} + +void +subsonic_client_ping_finish (SubsonicClient* self, + GAsyncResult* _res_, + GError** error) +{ + SubsonicClientPingData* _data_; +#line 112 "../src/subsonic.vala" + _data_ = g_task_propagate_pointer (G_TASK (_res_), error); +#line 112 "../src/subsonic.vala" + if (NULL == _data_) { +#line 112 "../src/subsonic.vala" + return; +#line 1331 "subsonic.c" + } +} + +static void +subsonic_client_ping_ready (GObject* source_object, + GAsyncResult* _res_, + gpointer _user_data_) +{ + SubsonicClientPingData* _data_; +#line 144 "../src/subsonic.vala" + _data_ = _user_data_; +#line 144 "../src/subsonic.vala" + _data_->_source_object_ = source_object; +#line 144 "../src/subsonic.vala" + _data_->_res_ = _res_; +#line 144 "../src/subsonic.vala" + subsonic_client_ping_co (_data_); +#line 1349 "subsonic.c" +} + +static gboolean +subsonic_client_ping_co (SubsonicClientPingData* _data_) +{ +#line 138 "../src/subsonic.vala" + switch (_data_->_state_) { +#line 138 "../src/subsonic.vala" + case 0: +#line 1359 "subsonic.c" + goto _state_0; +#line 138 "../src/subsonic.vala" + case 1: +#line 1363 "subsonic.c" + goto _state_1; + default: +#line 138 "../src/subsonic.vala" + g_assert_not_reached (); +#line 1368 "subsonic.c" + } + _state_0: +#line 139 "../src/subsonic.vala" + _data_->_tmp0_ = _data_->self->priv->url; +#line 139 "../src/subsonic.vala" + _data_->_tmp1_ = string_to_string (_data_->_tmp0_); +#line 139 "../src/subsonic.vala" + _data_->_tmp2_ = _data_->self->priv->parameters; +#line 139 "../src/subsonic.vala" + _data_->_tmp3_ = string_to_string (_data_->_tmp2_); +#line 139 "../src/subsonic.vala" + _data_->_tmp4_ = g_strconcat (_data_->_tmp1_, "/rest/ping?f=json&", _data_->_tmp3_, NULL); +#line 139 "../src/subsonic.vala" + _data_->_tmp5_ = _data_->_tmp4_; +#line 139 "../src/subsonic.vala" + _data_->_tmp6_ = soup_message_new ("GET", _data_->_tmp5_); +#line 139 "../src/subsonic.vala" + _data_->_tmp7_ = _data_->_tmp6_; +#line 139 "../src/subsonic.vala" + _g_free0 (_data_->_tmp5_); +#line 139 "../src/subsonic.vala" + _data_->msg = _data_->_tmp7_; +#line 140 "../src/subsonic.vala" + if (_data_->msg == NULL) { +#line 141 "../src/subsonic.vala" + _data_->_tmp8_ = g_error_new_literal (SUBSONIC_ERROR, SUBSONIC_ERROR_BAD_AUTHN, "Bad message"); +#line 141 "../src/subsonic.vala" + _data_->_inner_error0_ = _data_->_tmp8_; +#line 141 "../src/subsonic.vala" + g_task_return_error (_data_->_async_result, _data_->_inner_error0_); +#line 141 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 141 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 141 "../src/subsonic.vala" + return FALSE; +#line 1405 "subsonic.c" + } +#line 144 "../src/subsonic.vala" + _data_->_tmp9_ = _data_->self->priv->session; +#line 144 "../src/subsonic.vala" + _data_->_state_ = 1; +#line 144 "../src/subsonic.vala" + soup_session_send_and_read_async (_data_->_tmp9_, _data_->msg, G_PRIORITY_DEFAULT, NULL, subsonic_client_ping_ready, _data_); +#line 144 "../src/subsonic.vala" + return FALSE; +#line 1415 "subsonic.c" + _state_1: +#line 144 "../src/subsonic.vala" + _data_->_tmp10_ = soup_session_send_and_read_finish (_data_->_tmp9_, _data_->_res_, &_data_->_inner_error0_); +#line 144 "../src/subsonic.vala" + _data_->bytes = _data_->_tmp10_; +#line 144 "../src/subsonic.vala" + if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) { +#line 144 "../src/subsonic.vala" + g_task_return_error (_data_->_async_result, _data_->_inner_error0_); +#line 144 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 144 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 144 "../src/subsonic.vala" + return FALSE; +#line 1431 "subsonic.c" + } +#line 145 "../src/subsonic.vala" + _vala_assert (soup_message_get_status (_data_->msg) == SOUP_STATUS_OK, "msg.get_status () == Soup.Status.OK"); +#line 147 "../src/subsonic.vala" + _data_->_tmp11_ = json_parser_new (); +#line 147 "../src/subsonic.vala" + _data_->parser = _data_->_tmp11_; +#line 148 "../src/subsonic.vala" + _data_->_tmp12_ = _data_->parser; +#line 148 "../src/subsonic.vala" + _data_->_tmp13_ = _data_->bytes; +#line 148 "../src/subsonic.vala" + _data_->_tmp14_ = 0; +#line 148 "../src/subsonic.vala" + _data_->_tmp15_ = g_bytes_get_data (_data_->_tmp13_, &_data_->_tmp14_); +#line 148 "../src/subsonic.vala" + json_parser_load_from_data (_data_->_tmp12_, (const gchar*) _data_->_tmp15_, (gssize) -1, &_data_->_inner_error0_); +#line 148 "../src/subsonic.vala" + if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) { +#line 148 "../src/subsonic.vala" + g_task_return_error (_data_->_async_result, _data_->_inner_error0_); +#line 148 "../src/subsonic.vala" + _g_object_unref0 (_data_->parser); +#line 148 "../src/subsonic.vala" + _g_bytes_unref0 (_data_->bytes); +#line 148 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 148 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 148 "../src/subsonic.vala" + return FALSE; +#line 1463 "subsonic.c" + } +#line 150 "../src/subsonic.vala" + _data_->_tmp16_ = _data_->parser; +#line 150 "../src/subsonic.vala" + _data_->_tmp17_ = json_parser_get_root (_data_->_tmp16_); +#line 150 "../src/subsonic.vala" + _data_->_tmp18_ = json_reader_new (_data_->_tmp17_); +#line 150 "../src/subsonic.vala" + _data_->reader = _data_->_tmp18_; +#line 151 "../src/subsonic.vala" + _data_->_tmp19_ = _data_->reader; +#line 151 "../src/subsonic.vala" + subsonic_client_unwrap_response (_data_->self, _data_->_tmp19_, &_data_->_inner_error0_); +#line 151 "../src/subsonic.vala" + if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) { +#line 151 "../src/subsonic.vala" + g_task_return_error (_data_->_async_result, _data_->_inner_error0_); +#line 151 "../src/subsonic.vala" + _g_object_unref0 (_data_->reader); +#line 151 "../src/subsonic.vala" + _g_object_unref0 (_data_->parser); +#line 151 "../src/subsonic.vala" + _g_bytes_unref0 (_data_->bytes); +#line 151 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 151 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 151 "../src/subsonic.vala" + return FALSE; +#line 1493 "subsonic.c" + } +#line 138 "../src/subsonic.vala" + _g_object_unref0 (_data_->reader); +#line 138 "../src/subsonic.vala" + _g_object_unref0 (_data_->parser); +#line 138 "../src/subsonic.vala" + _g_bytes_unref0 (_data_->bytes); +#line 138 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 138 "../src/subsonic.vala" + g_task_return_pointer (_data_->_async_result, _data_, NULL); +#line 138 "../src/subsonic.vala" + if (_data_->_state_ != 0) { +#line 138 "../src/subsonic.vala" + while (!g_task_get_completed (_data_->_async_result)) { +#line 138 "../src/subsonic.vala" + g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE); +#line 1511 "subsonic.c" + } + } +#line 138 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 138 "../src/subsonic.vala" + return FALSE; +#line 1518 "subsonic.c" +} + +static void +subsonic_client_scrobble_data_free (gpointer _data) +{ + SubsonicClientScrobbleData* _data_; + _data_ = _data; +#line 112 "../src/subsonic.vala" + _g_free0 (_data_->id); +#line 112 "../src/subsonic.vala" + _g_object_unref0 (_data_->self); +#line 112 "../src/subsonic.vala" + g_slice_free (SubsonicClientScrobbleData, _data_); +#line 1532 "subsonic.c" +} + +void +subsonic_client_scrobble (SubsonicClient* self, + const gchar* id, + GAsyncReadyCallback _callback_, + gpointer _user_data_) +{ + SubsonicClientScrobbleData* _data_; + SubsonicClient* _tmp0_; + gchar* _tmp1_; +#line 112 "../src/subsonic.vala" + g_return_if_fail (self != NULL); +#line 112 "../src/subsonic.vala" + g_return_if_fail (id != NULL); +#line 112 "../src/subsonic.vala" + _data_ = g_slice_new0 (SubsonicClientScrobbleData); +#line 112 "../src/subsonic.vala" + _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_); +#line 112 "../src/subsonic.vala" + g_task_set_task_data (_data_->_async_result, _data_, subsonic_client_scrobble_data_free); +#line 112 "../src/subsonic.vala" + _tmp0_ = _g_object_ref0 (self); +#line 112 "../src/subsonic.vala" + _data_->self = _tmp0_; +#line 112 "../src/subsonic.vala" + _tmp1_ = g_strdup (id); +#line 112 "../src/subsonic.vala" + _g_free0 (_data_->id); +#line 112 "../src/subsonic.vala" + _data_->id = _tmp1_; +#line 112 "../src/subsonic.vala" + subsonic_client_scrobble_co (_data_); +#line 1566 "subsonic.c" +} + +void +subsonic_client_scrobble_finish (SubsonicClient* self, + GAsyncResult* _res_, + GError** error) +{ + SubsonicClientScrobbleData* _data_; +#line 112 "../src/subsonic.vala" + _data_ = g_task_propagate_pointer (G_TASK (_res_), error); +#line 112 "../src/subsonic.vala" + if (NULL == _data_) { +#line 112 "../src/subsonic.vala" + return; +#line 1581 "subsonic.c" + } +} + +static void +subsonic_client_scrobble_ready (GObject* source_object, + GAsyncResult* _res_, + gpointer _user_data_) +{ + SubsonicClientScrobbleData* _data_; +#line 158 "../src/subsonic.vala" + _data_ = _user_data_; +#line 158 "../src/subsonic.vala" + _data_->_source_object_ = source_object; +#line 158 "../src/subsonic.vala" + _data_->_res_ = _res_; +#line 158 "../src/subsonic.vala" + subsonic_client_scrobble_co (_data_); +#line 1599 "subsonic.c" +} + +static gboolean +subsonic_client_scrobble_co (SubsonicClientScrobbleData* _data_) +{ +#line 154 "../src/subsonic.vala" + switch (_data_->_state_) { +#line 154 "../src/subsonic.vala" + case 0: +#line 1609 "subsonic.c" + goto _state_0; +#line 154 "../src/subsonic.vala" + case 1: +#line 1613 "subsonic.c" + goto _state_1; + default: +#line 154 "../src/subsonic.vala" + g_assert_not_reached (); +#line 1618 "subsonic.c" + } + _state_0: +#line 155 "../src/subsonic.vala" + _data_->_tmp0_ = _data_->self->priv->url; +#line 155 "../src/subsonic.vala" + _data_->_tmp1_ = string_to_string (_data_->_tmp0_); +#line 155 "../src/subsonic.vala" + _data_->_tmp2_ = g_uri_escape_string (_data_->id, NULL, TRUE); +#line 155 "../src/subsonic.vala" + _data_->_tmp3_ = _data_->_tmp2_; +#line 155 "../src/subsonic.vala" + _data_->_tmp4_ = string_to_string (_data_->_tmp3_); +#line 155 "../src/subsonic.vala" + _data_->_tmp5_ = _data_->self->priv->parameters; +#line 155 "../src/subsonic.vala" + _data_->_tmp6_ = string_to_string (_data_->_tmp5_); +#line 155 "../src/subsonic.vala" + _data_->_tmp7_ = g_strconcat (_data_->_tmp1_, "/rest/scrobble?id=", _data_->_tmp4_, "&f=json&", _data_->_tmp6_, NULL); +#line 155 "../src/subsonic.vala" + _data_->_tmp8_ = _data_->_tmp7_; +#line 155 "../src/subsonic.vala" + _data_->_tmp9_ = soup_message_new ("GET", _data_->_tmp8_); +#line 155 "../src/subsonic.vala" + _data_->_tmp10_ = _data_->_tmp9_; +#line 155 "../src/subsonic.vala" + _g_free0 (_data_->_tmp8_); +#line 155 "../src/subsonic.vala" + _g_free0 (_data_->_tmp3_); +#line 155 "../src/subsonic.vala" + _data_->msg = _data_->_tmp10_; +#line 156 "../src/subsonic.vala" + _data_->_tmp11_ = _data_->msg; +#line 156 "../src/subsonic.vala" + _vala_assert (_data_->_tmp11_ != NULL, "msg != null"); +#line 158 "../src/subsonic.vala" + _data_->_tmp12_ = _data_->self->priv->session; +#line 158 "../src/subsonic.vala" + _data_->_tmp13_ = _data_->msg; +#line 158 "../src/subsonic.vala" + _data_->_state_ = 1; +#line 158 "../src/subsonic.vala" + soup_session_send_and_read_async (_data_->_tmp12_, _data_->_tmp13_, G_PRIORITY_DEFAULT, NULL, subsonic_client_scrobble_ready, _data_); +#line 158 "../src/subsonic.vala" + return FALSE; +#line 1663 "subsonic.c" + _state_1: +#line 158 "../src/subsonic.vala" + _data_->_tmp14_ = soup_session_send_and_read_finish (_data_->_tmp12_, _data_->_res_, &_data_->_inner_error0_); +#line 158 "../src/subsonic.vala" + _data_->bytes = _data_->_tmp14_; +#line 158 "../src/subsonic.vala" + if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) { +#line 158 "../src/subsonic.vala" + g_task_return_error (_data_->_async_result, _data_->_inner_error0_); +#line 158 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 158 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 158 "../src/subsonic.vala" + return FALSE; +#line 1679 "subsonic.c" + } +#line 159 "../src/subsonic.vala" + _data_->_tmp15_ = _data_->msg; +#line 159 "../src/subsonic.vala" + _vala_assert (soup_message_get_status (_data_->_tmp15_) == SOUP_STATUS_OK, "msg.get_status () == Soup.Status.OK"); +#line 161 "../src/subsonic.vala" + _data_->_tmp16_ = json_parser_new (); +#line 161 "../src/subsonic.vala" + _data_->parser = _data_->_tmp16_; +#line 162 "../src/subsonic.vala" + _data_->_tmp17_ = _data_->parser; +#line 162 "../src/subsonic.vala" + _data_->_tmp18_ = _data_->bytes; +#line 162 "../src/subsonic.vala" + _data_->_tmp19_ = 0; +#line 162 "../src/subsonic.vala" + _data_->_tmp20_ = g_bytes_get_data (_data_->_tmp18_, &_data_->_tmp19_); +#line 162 "../src/subsonic.vala" + json_parser_load_from_data (_data_->_tmp17_, (const gchar*) _data_->_tmp20_, (gssize) -1, &_data_->_inner_error0_); +#line 162 "../src/subsonic.vala" + if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) { +#line 162 "../src/subsonic.vala" + g_task_return_error (_data_->_async_result, _data_->_inner_error0_); +#line 162 "../src/subsonic.vala" + _g_object_unref0 (_data_->parser); +#line 162 "../src/subsonic.vala" + _g_bytes_unref0 (_data_->bytes); +#line 162 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 162 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 162 "../src/subsonic.vala" + return FALSE; +#line 1713 "subsonic.c" + } +#line 164 "../src/subsonic.vala" + _data_->_tmp21_ = _data_->parser; +#line 164 "../src/subsonic.vala" + _data_->_tmp22_ = json_parser_get_root (_data_->_tmp21_); +#line 164 "../src/subsonic.vala" + _data_->_tmp23_ = json_reader_new (_data_->_tmp22_); +#line 164 "../src/subsonic.vala" + _data_->reader = _data_->_tmp23_; +#line 165 "../src/subsonic.vala" + _data_->_tmp24_ = _data_->reader; +#line 165 "../src/subsonic.vala" + subsonic_client_unwrap_response (_data_->self, _data_->_tmp24_, &_data_->_inner_error0_); +#line 165 "../src/subsonic.vala" + if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) { +#line 165 "../src/subsonic.vala" + g_task_return_error (_data_->_async_result, _data_->_inner_error0_); +#line 165 "../src/subsonic.vala" + _g_object_unref0 (_data_->reader); +#line 165 "../src/subsonic.vala" + _g_object_unref0 (_data_->parser); +#line 165 "../src/subsonic.vala" + _g_bytes_unref0 (_data_->bytes); +#line 165 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 165 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 165 "../src/subsonic.vala" + return FALSE; +#line 1743 "subsonic.c" + } +#line 154 "../src/subsonic.vala" + _g_object_unref0 (_data_->reader); +#line 154 "../src/subsonic.vala" + _g_object_unref0 (_data_->parser); +#line 154 "../src/subsonic.vala" + _g_bytes_unref0 (_data_->bytes); +#line 154 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 154 "../src/subsonic.vala" + g_task_return_pointer (_data_->_async_result, _data_, NULL); +#line 154 "../src/subsonic.vala" + if (_data_->_state_ != 0) { +#line 154 "../src/subsonic.vala" + while (!g_task_get_completed (_data_->_async_result)) { +#line 154 "../src/subsonic.vala" + g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE); +#line 1761 "subsonic.c" + } + } +#line 154 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 154 "../src/subsonic.vala" + return FALSE; +#line 1768 "subsonic.c" +} + +static void +subsonic_client_get_random_songs_data_free (gpointer _data) +{ + SubsonicClientGetRandomSongsData* _data_; + _data_ = _data; +#line 112 "../src/subsonic.vala" + _g_free0 (_data_->parameters); +#line 112 "../src/subsonic.vala" + _g_object_unref0 (_data_->self); +#line 112 "../src/subsonic.vala" + g_slice_free (SubsonicClientGetRandomSongsData, _data_); +#line 1782 "subsonic.c" +} + +void +subsonic_client_get_random_songs (SubsonicClient* self, + const gchar* parameters, + SubsonicSongCallback callback, + gpointer callback_target, + GAsyncReadyCallback _callback_, + gpointer _user_data_) +{ + SubsonicClientGetRandomSongsData* _data_; + SubsonicClient* _tmp0_; + gchar* _tmp1_; +#line 112 "../src/subsonic.vala" + g_return_if_fail (self != NULL); +#line 112 "../src/subsonic.vala" + _data_ = g_slice_new0 (SubsonicClientGetRandomSongsData); +#line 112 "../src/subsonic.vala" + _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_); +#line 112 "../src/subsonic.vala" + g_task_set_task_data (_data_->_async_result, _data_, subsonic_client_get_random_songs_data_free); +#line 112 "../src/subsonic.vala" + _tmp0_ = _g_object_ref0 (self); +#line 112 "../src/subsonic.vala" + _data_->self = _tmp0_; +#line 112 "../src/subsonic.vala" + _tmp1_ = g_strdup (parameters); +#line 112 "../src/subsonic.vala" + _g_free0 (_data_->parameters); +#line 112 "../src/subsonic.vala" + _data_->parameters = _tmp1_; +#line 112 "../src/subsonic.vala" + _data_->callback = callback; +#line 112 "../src/subsonic.vala" + _data_->callback_target = callback_target; +#line 112 "../src/subsonic.vala" + subsonic_client_get_random_songs_co (_data_); +#line 1820 "subsonic.c" +} + +void +subsonic_client_get_random_songs_finish (SubsonicClient* self, + GAsyncResult* _res_, + GError** error) +{ + SubsonicClientGetRandomSongsData* _data_; +#line 112 "../src/subsonic.vala" + _data_ = g_task_propagate_pointer (G_TASK (_res_), error); +#line 112 "../src/subsonic.vala" + if (NULL == _data_) { +#line 112 "../src/subsonic.vala" + return; +#line 1835 "subsonic.c" + } +} + +static void +subsonic_client_get_random_songs_ready (GObject* source_object, + GAsyncResult* _res_, + gpointer _user_data_) +{ + SubsonicClientGetRandomSongsData* _data_; +#line 179 "../src/subsonic.vala" + _data_ = _user_data_; +#line 179 "../src/subsonic.vala" + _data_->_source_object_ = source_object; +#line 179 "../src/subsonic.vala" + _data_->_res_ = _res_; +#line 179 "../src/subsonic.vala" + subsonic_client_get_random_songs_co (_data_); +#line 1853 "subsonic.c" +} + +static gboolean +_subsonic_client_get_random_songs_co_gsource_func (gpointer self) +{ + gboolean result; + result = subsonic_client_get_random_songs_co (self); +#line 196 "../src/subsonic.vala" + return result; +#line 1863 "subsonic.c" +} + +static gboolean +subsonic_client_get_random_songs_co (SubsonicClientGetRandomSongsData* _data_) +{ +#line 168 "../src/subsonic.vala" + switch (_data_->_state_) { +#line 168 "../src/subsonic.vala" + case 0: +#line 1873 "subsonic.c" + goto _state_0; +#line 168 "../src/subsonic.vala" + case 1: +#line 1877 "subsonic.c" + goto _state_1; +#line 168 "../src/subsonic.vala" + case 2: +#line 1881 "subsonic.c" + goto _state_2; + default: +#line 168 "../src/subsonic.vala" + g_assert_not_reached (); +#line 1886 "subsonic.c" + } + _state_0: +#line 170 "../src/subsonic.vala" + if (_data_->parameters == NULL) { +#line 171 "../src/subsonic.vala" + _data_->_tmp0_ = g_strdup (""); +#line 171 "../src/subsonic.vala" + _g_free0 (_data_->str_parameters); +#line 171 "../src/subsonic.vala" + _data_->str_parameters = _data_->_tmp0_; +#line 1897 "subsonic.c" + } else { +#line 173 "../src/subsonic.vala" + _data_->_tmp1_ = string_to_string (_data_->parameters); +#line 173 "../src/subsonic.vala" + _data_->_tmp2_ = g_strconcat (_data_->_tmp1_, "&", NULL); +#line 173 "../src/subsonic.vala" + _g_free0 (_data_->str_parameters); +#line 173 "../src/subsonic.vala" + _data_->str_parameters = _data_->_tmp2_; +#line 1907 "subsonic.c" + } +#line 176 "../src/subsonic.vala" + _data_->_tmp3_ = _data_->self->priv->url; +#line 176 "../src/subsonic.vala" + _data_->_tmp4_ = string_to_string (_data_->_tmp3_); +#line 176 "../src/subsonic.vala" + _data_->_tmp5_ = _data_->str_parameters; +#line 176 "../src/subsonic.vala" + _data_->_tmp6_ = string_to_string (_data_->_tmp5_); +#line 176 "../src/subsonic.vala" + _data_->_tmp7_ = _data_->self->priv->parameters; +#line 176 "../src/subsonic.vala" + _data_->_tmp8_ = string_to_string (_data_->_tmp7_); +#line 176 "../src/subsonic.vala" + _data_->_tmp9_ = g_strconcat (_data_->_tmp4_, "/rest/getRandomSongs?", _data_->_tmp6_, "size=500&f=json&", _data_->_tmp8_, NULL); +#line 176 "../src/subsonic.vala" + _data_->_tmp10_ = _data_->_tmp9_; +#line 176 "../src/subsonic.vala" + _data_->_tmp11_ = soup_message_new ("GET", _data_->_tmp10_); +#line 176 "../src/subsonic.vala" + _data_->_tmp12_ = _data_->_tmp11_; +#line 176 "../src/subsonic.vala" + _g_free0 (_data_->_tmp10_); +#line 176 "../src/subsonic.vala" + _data_->msg = _data_->_tmp12_; +#line 177 "../src/subsonic.vala" + _data_->_tmp13_ = _data_->msg; +#line 177 "../src/subsonic.vala" + _vala_assert (_data_->_tmp13_ != NULL, "msg != null"); +#line 179 "../src/subsonic.vala" + _data_->_tmp14_ = _data_->self->priv->session; +#line 179 "../src/subsonic.vala" + _data_->_tmp15_ = _data_->msg; +#line 179 "../src/subsonic.vala" + _data_->_state_ = 1; +#line 179 "../src/subsonic.vala" + soup_session_send_and_read_async (_data_->_tmp14_, _data_->_tmp15_, G_PRIORITY_DEFAULT, NULL, subsonic_client_get_random_songs_ready, _data_); +#line 179 "../src/subsonic.vala" + return FALSE; +#line 1947 "subsonic.c" + _state_1: +#line 179 "../src/subsonic.vala" + _data_->_tmp16_ = soup_session_send_and_read_finish (_data_->_tmp14_, _data_->_res_, &_data_->_inner_error0_); +#line 179 "../src/subsonic.vala" + _data_->bytes = _data_->_tmp16_; +#line 179 "../src/subsonic.vala" + if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) { +#line 179 "../src/subsonic.vala" + g_task_return_error (_data_->_async_result, _data_->_inner_error0_); +#line 179 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 179 "../src/subsonic.vala" + _g_free0 (_data_->str_parameters); +#line 179 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 179 "../src/subsonic.vala" + return FALSE; +#line 1965 "subsonic.c" + } +#line 180 "../src/subsonic.vala" + _data_->_tmp17_ = _data_->msg; +#line 180 "../src/subsonic.vala" + _vala_assert (soup_message_get_status (_data_->_tmp17_) == SOUP_STATUS_OK, "msg.get_status () == Soup.Status.OK"); +#line 182 "../src/subsonic.vala" + _data_->_tmp18_ = json_parser_new (); +#line 182 "../src/subsonic.vala" + _data_->parser = _data_->_tmp18_; +#line 183 "../src/subsonic.vala" + _data_->_tmp19_ = _data_->parser; +#line 183 "../src/subsonic.vala" + _data_->_tmp20_ = _data_->bytes; +#line 183 "../src/subsonic.vala" + _data_->_tmp21_ = 0; +#line 183 "../src/subsonic.vala" + _data_->_tmp22_ = g_bytes_get_data (_data_->_tmp20_, &_data_->_tmp21_); +#line 183 "../src/subsonic.vala" + json_parser_load_from_data (_data_->_tmp19_, (const gchar*) _data_->_tmp22_, (gssize) -1, &_data_->_inner_error0_); +#line 183 "../src/subsonic.vala" + if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) { +#line 183 "../src/subsonic.vala" + g_task_return_error (_data_->_async_result, _data_->_inner_error0_); +#line 183 "../src/subsonic.vala" + _g_object_unref0 (_data_->parser); +#line 183 "../src/subsonic.vala" + _g_bytes_unref0 (_data_->bytes); +#line 183 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 183 "../src/subsonic.vala" + _g_free0 (_data_->str_parameters); +#line 183 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 183 "../src/subsonic.vala" + return FALSE; +#line 2001 "subsonic.c" + } +#line 185 "../src/subsonic.vala" + _data_->_tmp23_ = _data_->parser; +#line 185 "../src/subsonic.vala" + _data_->_tmp24_ = json_parser_get_root (_data_->_tmp23_); +#line 185 "../src/subsonic.vala" + _data_->_tmp25_ = json_reader_new (_data_->_tmp24_); +#line 185 "../src/subsonic.vala" + _data_->reader = _data_->_tmp25_; +#line 186 "../src/subsonic.vala" + _data_->_tmp26_ = _data_->reader; +#line 186 "../src/subsonic.vala" + subsonic_client_unwrap_response (_data_->self, _data_->_tmp26_, &_data_->_inner_error0_); +#line 186 "../src/subsonic.vala" + if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) { +#line 186 "../src/subsonic.vala" + g_task_return_error (_data_->_async_result, _data_->_inner_error0_); +#line 186 "../src/subsonic.vala" + _g_object_unref0 (_data_->reader); +#line 186 "../src/subsonic.vala" + _g_object_unref0 (_data_->parser); +#line 186 "../src/subsonic.vala" + _g_bytes_unref0 (_data_->bytes); +#line 186 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 186 "../src/subsonic.vala" + _g_free0 (_data_->str_parameters); +#line 186 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 186 "../src/subsonic.vala" + return FALSE; +#line 2033 "subsonic.c" + } +#line 188 "../src/subsonic.vala" + _data_->_tmp27_ = _data_->reader; +#line 188 "../src/subsonic.vala" + json_reader_read_member (_data_->_tmp27_, "randomSongs"); +#line 189 "../src/subsonic.vala" + _data_->_tmp28_ = _data_->reader; +#line 189 "../src/subsonic.vala" + json_reader_read_member (_data_->_tmp28_, "song"); +#line 2043 "subsonic.c" + { +#line 191 "../src/subsonic.vala" + _data_->i = 0; +#line 2047 "subsonic.c" + { +#line 191 "../src/subsonic.vala" + _data_->_tmp29_ = TRUE; +#line 191 "../src/subsonic.vala" + while (TRUE) { +#line 191 "../src/subsonic.vala" + if (!_data_->_tmp29_) { +#line 191 "../src/subsonic.vala" + _data_->i += 1; +#line 2057 "subsonic.c" + } +#line 191 "../src/subsonic.vala" + _data_->_tmp29_ = FALSE; +#line 191 "../src/subsonic.vala" + _data_->_tmp30_ = _data_->reader; +#line 191 "../src/subsonic.vala" + if (!(_data_->i < json_reader_count_elements (_data_->_tmp30_))) { +#line 191 "../src/subsonic.vala" + break; +#line 2067 "subsonic.c" + } +#line 192 "../src/subsonic.vala" + _data_->_tmp31_ = _data_->reader; +#line 192 "../src/subsonic.vala" + json_reader_read_element (_data_->_tmp31_, (guint) _data_->i); +#line 193 "../src/subsonic.vala" + _data_->_tmp32_ = _data_->reader; +#line 193 "../src/subsonic.vala" + memset (&_data_->_tmp33_, 0, sizeof (SubsonicSong)); +#line 193 "../src/subsonic.vala" + subsonic_song_init (&_data_->_tmp33_, _data_->_tmp32_); +#line 193 "../src/subsonic.vala" + _data_->_tmp34_ = _data_->_tmp33_; +#line 193 "../src/subsonic.vala" + _data_->callback (&_data_->_tmp34_, _data_->callback_target); +#line 193 "../src/subsonic.vala" + subsonic_song_destroy (&_data_->_tmp34_); +#line 194 "../src/subsonic.vala" + _data_->_tmp35_ = _data_->reader; +#line 194 "../src/subsonic.vala" + json_reader_end_element (_data_->_tmp35_); +#line 196 "../src/subsonic.vala" + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _subsonic_client_get_random_songs_co_gsource_func, _data_, NULL); +#line 197 "../src/subsonic.vala" + _data_->_state_ = 2; +#line 197 "../src/subsonic.vala" + return FALSE; +#line 2095 "subsonic.c" + _state_2: + ; + } + } + } +#line 200 "../src/subsonic.vala" + _data_->_tmp36_ = _data_->reader; +#line 200 "../src/subsonic.vala" + _data_->_tmp37_ = json_reader_get_error (_data_->_tmp36_); +#line 200 "../src/subsonic.vala" + _vala_assert (_data_->_tmp37_ == NULL, "reader.get_error () == null"); +#line 168 "../src/subsonic.vala" + _g_object_unref0 (_data_->reader); +#line 168 "../src/subsonic.vala" + _g_object_unref0 (_data_->parser); +#line 168 "../src/subsonic.vala" + _g_bytes_unref0 (_data_->bytes); +#line 168 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 168 "../src/subsonic.vala" + _g_free0 (_data_->str_parameters); +#line 168 "../src/subsonic.vala" + g_task_return_pointer (_data_->_async_result, _data_, NULL); +#line 168 "../src/subsonic.vala" + if (_data_->_state_ != 0) { +#line 168 "../src/subsonic.vala" + while (!g_task_get_completed (_data_->_async_result)) { +#line 168 "../src/subsonic.vala" + g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE); +#line 2125 "subsonic.c" + } + } +#line 168 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 168 "../src/subsonic.vala" + return FALSE; +#line 2132 "subsonic.c" +} + +gchar* +subsonic_client_stream_uri (SubsonicClient* self, + const gchar* id) +{ + const gchar* _tmp0_; + const gchar* _tmp1_; + gchar* _tmp2_; + gchar* _tmp3_; + const gchar* _tmp4_; + const gchar* _tmp5_; + const gchar* _tmp6_; + gchar* _tmp7_; + gchar* _tmp8_; + gchar* result; +#line 203 "../src/subsonic.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 203 "../src/subsonic.vala" + g_return_val_if_fail (id != NULL, NULL); +#line 204 "../src/subsonic.vala" + _tmp0_ = self->priv->url; +#line 204 "../src/subsonic.vala" + _tmp1_ = string_to_string (_tmp0_); +#line 204 "../src/subsonic.vala" + _tmp2_ = g_uri_escape_string (id, NULL, TRUE); +#line 204 "../src/subsonic.vala" + _tmp3_ = _tmp2_; +#line 204 "../src/subsonic.vala" + _tmp4_ = string_to_string (_tmp3_); +#line 204 "../src/subsonic.vala" + _tmp5_ = self->priv->parameters; +#line 204 "../src/subsonic.vala" + _tmp6_ = string_to_string (_tmp5_); +#line 204 "../src/subsonic.vala" + _tmp7_ = g_strconcat (_tmp1_, "/rest/stream?id=", _tmp4_, "&", _tmp6_, NULL); +#line 204 "../src/subsonic.vala" + _tmp8_ = _tmp7_; +#line 204 "../src/subsonic.vala" + _g_free0 (_tmp3_); +#line 204 "../src/subsonic.vala" + result = _tmp8_; +#line 204 "../src/subsonic.vala" + return result; +#line 2177 "subsonic.c" +} + +gchar* +subsonic_client_cover_art_uri (SubsonicClient* self, + const gchar* id, + gint size) +{ + gchar* result; +#line 207 "../src/subsonic.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 207 "../src/subsonic.vala" + g_return_val_if_fail (id != NULL, NULL); +#line 208 "../src/subsonic.vala" + if (size >= 0) { +#line 2192 "subsonic.c" + const gchar* _tmp0_; + const gchar* _tmp1_; + gchar* _tmp2_; + gchar* _tmp3_; + const gchar* _tmp4_; + const gchar* _tmp5_; + const gchar* _tmp6_; + gchar* _tmp7_; + gchar* _tmp8_; +#line 209 "../src/subsonic.vala" + _tmp0_ = self->priv->url; +#line 209 "../src/subsonic.vala" + _tmp1_ = string_to_string (_tmp0_); +#line 209 "../src/subsonic.vala" + _tmp2_ = g_uri_escape_string (id, NULL, TRUE); +#line 209 "../src/subsonic.vala" + _tmp3_ = _tmp2_; +#line 209 "../src/subsonic.vala" + _tmp4_ = string_to_string (_tmp3_); +#line 209 "../src/subsonic.vala" + _tmp5_ = self->priv->parameters; +#line 209 "../src/subsonic.vala" + _tmp6_ = string_to_string (_tmp5_); +#line 209 "../src/subsonic.vala" + _tmp7_ = g_strconcat (_tmp1_, "/rest/getCoverArt?id=", _tmp4_, "&", _tmp6_, NULL); +#line 209 "../src/subsonic.vala" + _tmp8_ = _tmp7_; +#line 209 "../src/subsonic.vala" + _g_free0 (_tmp3_); +#line 209 "../src/subsonic.vala" + result = _tmp8_; +#line 209 "../src/subsonic.vala" + return result; +#line 2226 "subsonic.c" + } else { + const gchar* _tmp9_; + const gchar* _tmp10_; + gchar* _tmp11_; + gchar* _tmp12_; + gchar* _tmp13_; + gchar* _tmp14_; + const gchar* _tmp15_; + const gchar* _tmp16_; + const gchar* _tmp17_; + gchar* _tmp18_; + gchar* _tmp19_; +#line 211 "../src/subsonic.vala" + _tmp9_ = self->priv->url; +#line 211 "../src/subsonic.vala" + _tmp10_ = string_to_string (_tmp9_); +#line 211 "../src/subsonic.vala" + _tmp11_ = g_strdup_printf ("%i", size); +#line 211 "../src/subsonic.vala" + _tmp12_ = _tmp11_; +#line 211 "../src/subsonic.vala" + _tmp13_ = g_uri_escape_string (id, NULL, TRUE); +#line 211 "../src/subsonic.vala" + _tmp14_ = _tmp13_; +#line 211 "../src/subsonic.vala" + _tmp15_ = string_to_string (_tmp14_); +#line 211 "../src/subsonic.vala" + _tmp16_ = self->priv->parameters; +#line 211 "../src/subsonic.vala" + _tmp17_ = string_to_string (_tmp16_); +#line 211 "../src/subsonic.vala" + _tmp18_ = g_strconcat (_tmp10_, "/rest/getCoverArt?size=", _tmp12_, "&id=", _tmp15_, "&", _tmp17_, NULL); +#line 211 "../src/subsonic.vala" + _tmp19_ = _tmp18_; +#line 211 "../src/subsonic.vala" + _g_free0 (_tmp14_); +#line 211 "../src/subsonic.vala" + _g_free0 (_tmp12_); +#line 211 "../src/subsonic.vala" + result = _tmp19_; +#line 211 "../src/subsonic.vala" + return result; +#line 2269 "subsonic.c" + } +} + +static void +subsonic_client_cover_art_data_free (gpointer _data) +{ + SubsonicClientCoverArtData* _data_; + _data_ = _data; +#line 112 "../src/subsonic.vala" + _g_free0 (_data_->id); +#line 112 "../src/subsonic.vala" + _g_object_unref0 (_data_->cancellable); +#line 112 "../src/subsonic.vala" + _g_object_unref0 (_data_->result); +#line 112 "../src/subsonic.vala" + _g_object_unref0 (_data_->self); +#line 112 "../src/subsonic.vala" + g_slice_free (SubsonicClientCoverArtData, _data_); +#line 2288 "subsonic.c" +} + +void +subsonic_client_cover_art (SubsonicClient* self, + const gchar* id, + gint size, + gint priority, + GCancellable* cancellable, + GAsyncReadyCallback _callback_, + gpointer _user_data_) +{ + SubsonicClientCoverArtData* _data_; + SubsonicClient* _tmp0_; + gchar* _tmp1_; + GCancellable* _tmp2_; +#line 112 "../src/subsonic.vala" + g_return_if_fail (self != NULL); +#line 112 "../src/subsonic.vala" + g_return_if_fail (id != NULL); +#line 112 "../src/subsonic.vala" + _data_ = g_slice_new0 (SubsonicClientCoverArtData); +#line 112 "../src/subsonic.vala" + _data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_); +#line 112 "../src/subsonic.vala" + g_task_set_task_data (_data_->_async_result, _data_, subsonic_client_cover_art_data_free); +#line 112 "../src/subsonic.vala" + _tmp0_ = _g_object_ref0 (self); +#line 112 "../src/subsonic.vala" + _data_->self = _tmp0_; +#line 112 "../src/subsonic.vala" + _tmp1_ = g_strdup (id); +#line 112 "../src/subsonic.vala" + _g_free0 (_data_->id); +#line 112 "../src/subsonic.vala" + _data_->id = _tmp1_; +#line 112 "../src/subsonic.vala" + _data_->size = size; +#line 112 "../src/subsonic.vala" + _data_->priority = priority; +#line 112 "../src/subsonic.vala" + _tmp2_ = _g_object_ref0 (cancellable); +#line 112 "../src/subsonic.vala" + _g_object_unref0 (_data_->cancellable); +#line 112 "../src/subsonic.vala" + _data_->cancellable = _tmp2_; +#line 112 "../src/subsonic.vala" + subsonic_client_cover_art_co (_data_); +#line 2336 "subsonic.c" +} + +GdkPixbuf* +subsonic_client_cover_art_finish (SubsonicClient* self, + GAsyncResult* _res_, + GError** error) +{ + GdkPixbuf* result; + SubsonicClientCoverArtData* _data_; +#line 112 "../src/subsonic.vala" + _data_ = g_task_propagate_pointer (G_TASK (_res_), error); +#line 112 "../src/subsonic.vala" + if (NULL == _data_) { +#line 112 "../src/subsonic.vala" + return NULL; +#line 2352 "subsonic.c" + } +#line 112 "../src/subsonic.vala" + result = _data_->result; +#line 112 "../src/subsonic.vala" + _data_->result = NULL; +#line 112 "../src/subsonic.vala" + return result; +#line 2360 "subsonic.c" +} + +static void +subsonic_client_cover_art_ready (GObject* source_object, + GAsyncResult* _res_, + gpointer _user_data_) +{ + SubsonicClientCoverArtData* _data_; +#line 226 "../src/subsonic.vala" + _data_ = _user_data_; +#line 226 "../src/subsonic.vala" + _data_->_source_object_ = source_object; +#line 226 "../src/subsonic.vala" + _data_->_res_ = _res_; +#line 226 "../src/subsonic.vala" + subsonic_client_cover_art_co (_data_); +#line 2377 "subsonic.c" +} + +static gboolean +subsonic_client_cover_art_co (SubsonicClientCoverArtData* _data_) +{ +#line 215 "../src/subsonic.vala" + switch (_data_->_state_) { +#line 215 "../src/subsonic.vala" + case 0: +#line 2387 "subsonic.c" + goto _state_0; +#line 215 "../src/subsonic.vala" + case 1: +#line 2391 "subsonic.c" + goto _state_1; +#line 215 "../src/subsonic.vala" + case 2: +#line 2395 "subsonic.c" + goto _state_2; + default: +#line 215 "../src/subsonic.vala" + g_assert_not_reached (); +#line 2400 "subsonic.c" + } + _state_0: +#line 223 "../src/subsonic.vala" + _data_->_tmp0_ = subsonic_client_cover_art_uri (_data_->self, _data_->id, _data_->size); +#line 223 "../src/subsonic.vala" + _data_->_tmp1_ = _data_->_tmp0_; +#line 223 "../src/subsonic.vala" + _data_->_tmp2_ = soup_message_new ("GET", _data_->_tmp1_); +#line 223 "../src/subsonic.vala" + _data_->_tmp3_ = _data_->_tmp2_; +#line 223 "../src/subsonic.vala" + _g_free0 (_data_->_tmp1_); +#line 223 "../src/subsonic.vala" + _data_->msg = _data_->_tmp3_; +#line 224 "../src/subsonic.vala" + _data_->_tmp4_ = _data_->msg; +#line 224 "../src/subsonic.vala" + _vala_assert (_data_->_tmp4_ != NULL, "msg != null"); +#line 226 "../src/subsonic.vala" + _data_->_tmp5_ = _data_->self->priv->session; +#line 226 "../src/subsonic.vala" + _data_->_tmp6_ = _data_->msg; +#line 226 "../src/subsonic.vala" + _data_->_state_ = 1; +#line 226 "../src/subsonic.vala" + soup_session_send_async (_data_->_tmp5_, _data_->_tmp6_, _data_->priority, _data_->cancellable, subsonic_client_cover_art_ready, _data_); +#line 226 "../src/subsonic.vala" + return FALSE; +#line 2429 "subsonic.c" + _state_1: +#line 226 "../src/subsonic.vala" + _data_->_tmp7_ = soup_session_send_finish (_data_->_tmp5_, _data_->_res_, &_data_->_inner_error0_); +#line 226 "../src/subsonic.vala" + _data_->stream = _data_->_tmp7_; +#line 226 "../src/subsonic.vala" + if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) { +#line 226 "../src/subsonic.vala" + g_task_return_error (_data_->_async_result, _data_->_inner_error0_); +#line 226 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 226 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 226 "../src/subsonic.vala" + return FALSE; +#line 2445 "subsonic.c" + } +#line 227 "../src/subsonic.vala" + _data_->_tmp8_ = _data_->msg; +#line 227 "../src/subsonic.vala" + if (soup_message_get_status (_data_->_tmp8_) != SOUP_STATUS_OK) { +#line 228 "../src/subsonic.vala" + _data_->_tmp9_ = _data_->msg; +#line 228 "../src/subsonic.vala" + _data_->_tmp10_ = soup_status_get_phrase ((guint) soup_message_get_status (_data_->_tmp9_)); +#line 228 "../src/subsonic.vala" + g_warning ("subsonic.vala:228: could not load cover art for %s: %s", _data_->id, _data_->_tmp10_); +#line 2457 "subsonic.c" + } +#line 230 "../src/subsonic.vala" + _data_->_tmp12_ = _data_->stream; +#line 230 "../src/subsonic.vala" + _data_->_state_ = 2; +#line 230 "../src/subsonic.vala" + gdk_pixbuf_new_from_stream_async (_data_->_tmp12_, _data_->cancellable, subsonic_client_cover_art_ready, _data_); +#line 230 "../src/subsonic.vala" + return FALSE; +#line 2467 "subsonic.c" + _state_2: +#line 230 "../src/subsonic.vala" + _data_->_tmp13_ = (GdkPixbuf*) gdk_pixbuf_new_from_stream_finish (_data_->_res_, &_data_->_inner_error0_); +#line 230 "../src/subsonic.vala" + _data_->_tmp11_ = _data_->_tmp13_; +#line 230 "../src/subsonic.vala" + if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) { +#line 230 "../src/subsonic.vala" + g_task_return_error (_data_->_async_result, _data_->_inner_error0_); +#line 230 "../src/subsonic.vala" + _g_object_unref0 (_data_->stream); +#line 230 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 230 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 230 "../src/subsonic.vala" + return FALSE; +#line 2485 "subsonic.c" + } +#line 230 "../src/subsonic.vala" + _data_->_tmp14_ = _data_->_tmp11_; +#line 230 "../src/subsonic.vala" + _data_->_tmp11_ = NULL; +#line 230 "../src/subsonic.vala" + _data_->result = _data_->_tmp14_; +#line 230 "../src/subsonic.vala" + _g_object_unref0 (_data_->_tmp11_); +#line 230 "../src/subsonic.vala" + _g_object_unref0 (_data_->stream); +#line 230 "../src/subsonic.vala" + _g_object_unref0 (_data_->msg); +#line 230 "../src/subsonic.vala" + g_task_return_pointer (_data_->_async_result, _data_, NULL); +#line 230 "../src/subsonic.vala" + if (_data_->_state_ != 0) { +#line 230 "../src/subsonic.vala" + while (!g_task_get_completed (_data_->_async_result)) { +#line 230 "../src/subsonic.vala" + g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE); +#line 2507 "subsonic.c" + } + } +#line 230 "../src/subsonic.vala" + g_object_unref (_data_->_async_result); +#line 230 "../src/subsonic.vala" + return FALSE; +#line 2514 "subsonic.c" +} + +SubsonicClient* +subsonic_client_construct (GType object_type) +{ + SubsonicClient * self = NULL; +#line 112 "../src/subsonic.vala" + self = (SubsonicClient*) g_object_new (object_type, NULL); +#line 112 "../src/subsonic.vala" + return self; +#line 2525 "subsonic.c" +} + +SubsonicClient* +subsonic_client_new (void) +{ +#line 112 "../src/subsonic.vala" + return subsonic_client_construct (SUBSONIC_TYPE_CLIENT); +#line 2533 "subsonic.c" +} + +static void +subsonic_client_class_init (SubsonicClientClass * klass, + gpointer klass_data) +{ +#line 112 "../src/subsonic.vala" + subsonic_client_parent_class = g_type_class_peek_parent (klass); +#line 112 "../src/subsonic.vala" + g_type_class_adjust_private_offset (klass, &SubsonicClient_private_offset); +#line 112 "../src/subsonic.vala" + G_OBJECT_CLASS (klass)->finalize = subsonic_client_finalize; +#line 2546 "subsonic.c" +} + +static void +subsonic_client_instance_init (SubsonicClient * self, + gpointer klass) +{ +#line 112 "../src/subsonic.vala" + self->priv = subsonic_client_get_instance_private (self); +#line 2555 "subsonic.c" +} + +static void +subsonic_client_finalize (GObject * obj) +{ + SubsonicClient * self; +#line 112 "../src/subsonic.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, SUBSONIC_TYPE_CLIENT, SubsonicClient); +#line 234 "../src/subsonic.vala" + g_debug ("subsonic.vala:234: destroying subsonic client"); +#line 113 "../src/subsonic.vala" + _g_object_unref0 (self->priv->session); +#line 114 "../src/subsonic.vala" + _g_free0 (self->priv->url); +#line 115 "../src/subsonic.vala" + _g_free0 (self->priv->parameters); +#line 112 "../src/subsonic.vala" + G_OBJECT_CLASS (subsonic_client_parent_class)->finalize (obj); +#line 2574 "subsonic.c" +} + +static GType +subsonic_client_get_type_once (void) +{ + static const GTypeInfo g_define_type_info = { sizeof (SubsonicClientClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) subsonic_client_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SubsonicClient), 0, (GInstanceInitFunc) subsonic_client_instance_init, NULL }; + GType subsonic_client_type_id; + subsonic_client_type_id = g_type_register_static (G_TYPE_OBJECT, "SubsonicClient", &g_define_type_info, 0); + SubsonicClient_private_offset = g_type_add_instance_private (subsonic_client_type_id, sizeof (SubsonicClientPrivate)); + return subsonic_client_type_id; +} + +GType +subsonic_client_get_type (void) +{ + static volatile gsize subsonic_client_type_id__once = 0; + if (g_once_init_enter (&subsonic_client_type_id__once)) { + GType subsonic_client_type_id; + subsonic_client_type_id = subsonic_client_get_type_once (); + g_once_init_leave (&subsonic_client_type_id__once, subsonic_client_type_id); + } + return subsonic_client_type_id__once; +} + diff --git a/src/subsonic.vala b/src/subsonic.vala deleted file mode 100644 index b9d553c..0000000 --- a/src/subsonic.vala +++ /dev/null @@ -1,236 +0,0 @@ -public errordomain Subsonic.Error { - BAD_AUTHN, - ERROR, -} - -public delegate void Subsonic.SongCallback (Song song); - -public class Subsonic.Artist : Object { - public string index; - public string id; - public string name { get; private set; } - public string? cover_art; - public string? artist_image_url; - public int64 album_count; - - public Artist (string index, Json.Reader reader) { - this.index = index; - - reader.read_member ("id"); - this.id = reader.get_string_value (); - reader.end_member (); - - reader.read_member ("name"); - this.name = reader.get_string_value (); - reader.end_member (); - - reader.read_member ("coverArt"); - this.cover_art = reader.get_string_value (); - reader.end_member (); - - reader.read_member ("artistImageUrl"); - this.artist_image_url = reader.get_string_value (); - reader.end_member (); - - reader.read_member ("albumCount"); - this.album_count = reader.get_int_value (); - reader.end_member (); - } -} - -public class Subsonic.Album : Object { - public string id; - public string name; - - public Album (Json.Reader reader) { - reader.read_member ("id"); - this.id = reader.get_string_value (); - reader.end_member (); - - reader.read_member ("name"); - this.name = reader.get_string_value (); - reader.end_member (); - } -} - -public struct Subsonic.Song { - public string id; - public string title; - public string album; - public string artist; - public int64 track; - public int64 year; - public DateTime? starred; // TODO - public int64 duration; - public int64 play_count; - public string? genre; - public string cover_art; - - public Song (Json.Reader reader) { - reader.read_member ("id"); - this.id = reader.get_string_value (); - reader.end_member (); - - reader.read_member ("title"); - this.title = reader.get_string_value (); - reader.end_member (); - - reader.read_member ("album"); - this.album = reader.get_string_value (); - reader.end_member (); - - reader.read_member ("artist"); - this.artist = reader.get_string_value (); - reader.end_member (); - - reader.read_member ("track"); - this.track = reader.get_int_value (); - reader.end_member (); - - reader.read_member ("year"); - this.year = reader.get_int_value (); - reader.end_member (); - - reader.read_member ("duration"); - this.duration = reader.get_int_value (); - reader.end_member (); - - reader.read_member ("playCount"); - this.play_count = reader.get_int_value (); - reader.end_member (); - - reader.read_member ("genre"); - this.genre = reader.get_string_value (); - reader.end_member (); - - reader.read_member ("coverArt"); - this.cover_art = reader.get_string_value (); - reader.end_member (); - } -} - -public class Subsonic.Client : Object { - private Soup.Session session; - private string url; - private string parameters; - - public Client.with_token (string url, string username, string token, string salt) { - this.url = url; - this.parameters = @"u=$(Uri.escape_string(username))&t=$(Uri.escape_string(token))&s=$(Uri.escape_string(salt))&v=1.16.1&c=eu.callcc.audrey"; - - this.session = new Soup.Session (); - this.session.user_agent = Audrey.Const.user_agent; - } - - private void unwrap_response (Json.Reader reader) throws GLib.Error { - reader.read_member ("subsonic-response"); - - reader.read_member ("status"); - if (reader.get_string_value () != "ok") { - reader.end_member (); - reader.read_member ("error"); - reader.read_member ("message"); - throw new Subsonic.Error.ERROR (reader.get_string_value () ?? "???"); - } - reader.end_member(); - } - - public async void ping () throws GLib.Error { - var msg = new Soup.Message ("GET", @"$(this.url)/rest/ping?f=json&$(this.parameters)"); - if (msg == null) { - throw new Subsonic.Error.BAD_AUTHN ("Bad message"); - } - - var bytes = yield this.session.send_and_read_async (msg, Priority.DEFAULT, null); - assert (msg.get_status () == Soup.Status.OK); - - var parser = new Json.Parser (); - parser.load_from_data ((string) bytes.get_data ()); - - var reader = new Json.Reader (parser.get_root ()); - this.unwrap_response (reader); - } - - public async void scrobble (string id) throws GLib.Error { - var msg = new Soup.Message ("GET", @"$(this.url)/rest/scrobble?id=$(Uri.escape_string (id))&f=json&$(this.parameters)"); - assert (msg != null); - - var bytes = yield this.session.send_and_read_async (msg, Priority.DEFAULT, null); - assert (msg.get_status () == Soup.Status.OK); - - var parser = new Json.Parser (); - parser.load_from_data ((string) bytes.get_data ()); - - var reader = new Json.Reader (parser.get_root ()); - this.unwrap_response (reader); - } - - public async void get_random_songs (string? parameters, SongCallback callback) throws GLib.Error { - string str_parameters; - if (parameters == null) { - str_parameters = ""; - } else { - str_parameters = @"$parameters&"; - } - - var msg = new Soup.Message("GET", @"$(this.url)/rest/getRandomSongs?$(str_parameters)size=500&f=json&$(this.parameters)"); - assert (msg != null); - - var bytes = yield this.session.send_and_read_async (msg, Priority.DEFAULT, null); - assert (msg.get_status () == Soup.Status.OK); - - var parser = new Json.Parser (); - parser.load_from_data ((string) bytes.get_data ()); - - var reader = new Json.Reader (parser.get_root ()); - this.unwrap_response (reader); - - reader.read_member ("randomSongs"); - reader.read_member ("song"); - - for (int i = 0; i < reader.count_elements (); i += 1) { - reader.read_element (i); - callback (Song (reader)); - reader.end_element (); - - Idle.add (this.get_random_songs.callback); - yield; - } - - assert (reader.get_error () == null); - } - - public string stream_uri (string id) { - return @"$(this.url)/rest/stream?id=$(Uri.escape_string(id))&$(this.parameters)"; - } - - public string cover_art_uri (string id, int size = -1) { - if (size >= 0) { - return @"$(this.url)/rest/getCoverArt?id=$(Uri.escape_string(id))&$(this.parameters)"; - } else { - return @"$(this.url)/rest/getCoverArt?size=$size&id=$(Uri.escape_string(id))&$(this.parameters)"; - } - } - - public async Gdk.Pixbuf cover_art ( - string id, - int size = -1, - int priority = Priority.DEFAULT, - Cancellable? cancellable = null - ) - throws GLib.Error - { - var msg = new Soup.Message("GET", this.cover_art_uri (id, size)); - assert (msg != null); - - var stream = yield this.session.send_async (msg, priority, cancellable); - if (msg.get_status () != Soup.Status.OK) { - warning ("could not load cover art for %s: %s", id, Soup.Status.get_phrase (msg.get_status ())); - } - return yield new Gdk.Pixbuf.from_stream_async (stream, cancellable); - } - - ~Client () { - debug ("destroying subsonic client"); - } -} diff --git a/src/ui/play_queue.c b/src/ui/play_queue.c new file mode 100644 index 0000000..9b4c2a0 --- /dev/null +++ b/src/ui/play_queue.c @@ -0,0 +1,1759 @@ +/* play_queue.c generated by valac 0.56.16, the Vala compiler + * generated from play_queue.vala, do not modify */ + +/* song widget+drag behavior taken from gnome music*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 UI_TYPE_PLAY_QUEUE_SONG (ui_play_queue_song_get_type ()) +#define UI_PLAY_QUEUE_SONG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UI_TYPE_PLAY_QUEUE_SONG, UiPlayQueueSong)) +#define UI_PLAY_QUEUE_SONG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UI_TYPE_PLAY_QUEUE_SONG, UiPlayQueueSongClass)) +#define UI_IS_PLAY_QUEUE_SONG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UI_TYPE_PLAY_QUEUE_SONG)) +#define UI_IS_PLAY_QUEUE_SONG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UI_TYPE_PLAY_QUEUE_SONG)) +#define UI_PLAY_QUEUE_SONG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UI_TYPE_PLAY_QUEUE_SONG, UiPlayQueueSongClass)) + +typedef struct _UiPlayQueueSong UiPlayQueueSong; +typedef struct _UiPlayQueueSongClass UiPlayQueueSongClass; +typedef struct _UiPlayQueueSongPrivate UiPlayQueueSongPrivate; + +#define TYPE_PLAYBIN_SONG (playbin_song_get_type ()) +#define PLAYBIN_SONG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYBIN_SONG, PlaybinSong)) +#define PLAYBIN_SONG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYBIN_SONG, PlaybinSongClass)) +#define IS_PLAYBIN_SONG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYBIN_SONG)) +#define IS_PLAYBIN_SONG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYBIN_SONG)) +#define PLAYBIN_SONG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYBIN_SONG, PlaybinSongClass)) + +typedef struct _PlaybinSong PlaybinSong; +typedef struct _PlaybinSongClass PlaybinSongClass; + +#define TYPE_PLAYBIN (playbin_get_type ()) +#define PLAYBIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYBIN, Playbin)) +#define PLAYBIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYBIN, PlaybinClass)) +#define IS_PLAYBIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYBIN)) +#define IS_PLAYBIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYBIN)) +#define PLAYBIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYBIN, PlaybinClass)) + +typedef struct _Playbin Playbin; +typedef struct _PlaybinClass PlaybinClass; +enum { + UI_PLAY_QUEUE_SONG_0_PROPERTY, + UI_PLAY_QUEUE_SONG_DRAGGABLE_PROPERTY, + UI_PLAY_QUEUE_SONG_SHOW_POSITION_PROPERTY, + UI_PLAY_QUEUE_SONG_SHOW_ARTIST_PROPERTY, + UI_PLAY_QUEUE_SONG_SHOW_COVER_PROPERTY, + UI_PLAY_QUEUE_SONG_CURRENT_PROPERTY, + UI_PLAY_QUEUE_SONG_DISPLAYED_POSITION_PROPERTY, + UI_PLAY_QUEUE_SONG_SONG_PROPERTY, + UI_PLAY_QUEUE_SONG_NUM_PROPERTIES +}; +static GParamSpec* ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_NUM_PROPERTIES]; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +typedef struct _Block3Data Block3Data; + +#define UI_TYPE_PLAY_QUEUE (ui_play_queue_get_type ()) +#define UI_PLAY_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UI_TYPE_PLAY_QUEUE, UiPlayQueue)) +#define UI_PLAY_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UI_TYPE_PLAY_QUEUE, UiPlayQueueClass)) +#define UI_IS_PLAY_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UI_TYPE_PLAY_QUEUE)) +#define UI_IS_PLAY_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UI_TYPE_PLAY_QUEUE)) +#define UI_PLAY_QUEUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UI_TYPE_PLAY_QUEUE, UiPlayQueueClass)) + +typedef struct _UiPlayQueue UiPlayQueue; +typedef struct _UiPlayQueueClass UiPlayQueueClass; +typedef struct _UiPlayQueuePrivate UiPlayQueuePrivate; +enum { + UI_PLAY_QUEUE_0_PROPERTY, + UI_PLAY_QUEUE_PLAYBIN_PROPERTY, + UI_PLAY_QUEUE_CAN_CLEAR_ALL_PROPERTY, + UI_PLAY_QUEUE_NUM_PROPERTIES +}; +static GParamSpec* ui_play_queue_properties[UI_PLAY_QUEUE_NUM_PROPERTIES]; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _UiPlayQueueSong { + GtkBox parent_instance; + UiPlayQueueSongPrivate * priv; +}; + +struct _UiPlayQueueSongClass { + GtkBoxClass parent_class; +}; + +struct _UiPlayQueueSongPrivate { + gboolean _draggable; + gboolean _show_position; + gboolean _show_artist; + gboolean _show_cover; + gboolean _current; + guint _displayed_position; + PlaybinSong* _song; + Playbin* playbin; + gulong connection; + gdouble drag_x; + gdouble drag_y; + GtkListBox* drag_widget; +}; + +struct _Block3Data { + int _ref_count_; + UiPlayQueueSong* self; + guint position; +}; + +struct _UiPlayQueue { + AdwBin parent_instance; + UiPlayQueuePrivate * priv; +}; + +struct _UiPlayQueueClass { + AdwBinClass parent_class; +}; + +struct _UiPlayQueuePrivate { + Playbin* _playbin; + gboolean _can_clear_all; +}; + +static gint UiPlayQueueSong_private_offset; +static gpointer ui_play_queue_song_parent_class = NULL; +static gint UiPlayQueue_private_offset; +static gpointer ui_play_queue_parent_class = NULL; + +VALA_EXTERN GType ui_play_queue_song_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (UiPlayQueueSong, g_object_unref) +VALA_EXTERN GType playbin_song_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (PlaybinSong, g_object_unref) +VALA_EXTERN GType playbin_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (Playbin, g_object_unref) +VALA_EXTERN UiPlayQueueSong* ui_play_queue_song_new (Playbin* playbin); +VALA_EXTERN UiPlayQueueSong* ui_play_queue_song_construct (GType object_type, + Playbin* playbin); +static void __lambda6_ (UiPlayQueueSong* self); +VALA_EXTERN void playbin_remove_track (Playbin* self, + guint position); +VALA_EXTERN guint ui_play_queue_song_get_displayed_position (UiPlayQueueSong* self); +static void ___lambda6__g_simple_action_activate (GSimpleAction* _sender, + GVariant* parameter, + gpointer self); +VALA_EXTERN void ui_play_queue_song_bind (UiPlayQueueSong* self, + guint position, + PlaybinSong* song); +static Block3Data* block3_data_ref (Block3Data* _data3_); +static void block3_data_unref (void * _userdata_); +VALA_EXTERN void ui_play_queue_song_set_displayed_position (UiPlayQueueSong* self, + guint value); +VALA_EXTERN void ui_play_queue_song_set_song (UiPlayQueueSong* self, + PlaybinSong* value); +VALA_EXTERN gint playbin_get_play_queue_position (Playbin* self); +VALA_EXTERN void ui_play_queue_song_set_current (UiPlayQueueSong* self, + gboolean value); +static void __lambda7_ (Block3Data* _data3_); +static void ___lambda7__g_object_notify (GObject* _sender, + GParamSpec* pspec, + gpointer self); +VALA_EXTERN void playbin_song_need_cover_art (PlaybinSong* self); +VALA_EXTERN void ui_play_queue_song_unbind (UiPlayQueueSong* self); +static gchar* ui_play_queue_song_format_duration (UiPlayQueueSong* self, + gint duration); +static gchar* ui_play_queue_song_star_button_icon_name (UiPlayQueueSong* self, + GDateTime* starred); +static GdkContentProvider* ui_play_queue_song_on_drag_prepare (UiPlayQueueSong* self, + gdouble x, + gdouble y); +VALA_EXTERN gboolean ui_play_queue_song_get_draggable (UiPlayQueueSong* self); +static GdkContentProvider* _ui_play_queue_song_on_drag_prepare_gtk_drag_source_prepare (GtkDragSource* _sender, + gdouble x, + gdouble y, + gpointer self); +static void ui_play_queue_song_on_drag_begin (UiPlayQueueSong* self, + GtkDragSource* source, + GdkDrag* drag); +VALA_EXTERN void ui_play_queue_song_set_draggable (UiPlayQueueSong* self, + gboolean value); +VALA_EXTERN gboolean ui_play_queue_song_get_show_position (UiPlayQueueSong* self); +VALA_EXTERN void ui_play_queue_song_set_show_position (UiPlayQueueSong* self, + gboolean value); +VALA_EXTERN gboolean ui_play_queue_song_get_show_artist (UiPlayQueueSong* self); +VALA_EXTERN void ui_play_queue_song_set_show_artist (UiPlayQueueSong* self, + gboolean value); +VALA_EXTERN gboolean ui_play_queue_song_get_show_cover (UiPlayQueueSong* self); +VALA_EXTERN void ui_play_queue_song_set_show_cover (UiPlayQueueSong* self, + gboolean value); +VALA_EXTERN PlaybinSong* ui_play_queue_song_get_song (UiPlayQueueSong* self); +static void _ui_play_queue_song_on_drag_begin_gtk_drag_source_drag_begin (GtkDragSource* _sender, + GdkDrag* drag, + gpointer self); +static gboolean ui_play_queue_song_on_drop (UiPlayQueueSong* self, + GValue* value, + gdouble x, + gdouble y); +VALA_EXTERN void playbin_move_track (Playbin* self, + guint from, + guint to); +static gboolean _ui_play_queue_song_on_drop_gtk_drop_target_drop (GtkDropTarget* _sender, + GValue* value, + gdouble x, + gdouble y, + gpointer self); +VALA_EXTERN gboolean ui_play_queue_song_get_current (UiPlayQueueSong* self); +static void ui_play_queue_song_finalize (GObject * obj); +static GType ui_play_queue_song_get_type_once (void); +static void _vala_ui_play_queue_song_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec); +static void _vala_ui_play_queue_song_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec); +VALA_EXTERN GType ui_play_queue_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (UiPlayQueue, g_object_unref) +static void ui_play_queue_on_store_items_changed (UiPlayQueue* self, + GListModel* store, + guint position, + guint removed, + guint added); +static void ui_play_queue_set_can_clear_all (UiPlayQueue* self, + gboolean value); +static void ui_play_queue_on_song_list_setup (UiPlayQueue* self, + GtkSignalListItemFactory* factory, + GObject* object); +VALA_EXTERN Playbin* ui_play_queue_get_playbin (UiPlayQueue* self); +static void _ui_play_queue_on_song_list_setup_gtk_signal_list_item_factory_setup (GtkSignalListItemFactory* _sender, + GObject* object, + gpointer self); +static void ui_play_queue_on_song_list_bind (UiPlayQueue* self, + GtkSignalListItemFactory* factory, + GObject* object); +static void _ui_play_queue_on_song_list_bind_gtk_signal_list_item_factory_bind (GtkSignalListItemFactory* _sender, + GObject* object, + gpointer self); +static void ui_play_queue_on_song_list_unbind (UiPlayQueue* self, + GtkSignalListItemFactory* factory, + GObject* object); +static void _ui_play_queue_on_song_list_unbind_gtk_signal_list_item_factory_unbind (GtkSignalListItemFactory* _sender, + GObject* object, + gpointer self); +static void ui_play_queue_on_row_activated (UiPlayQueue* self, + guint position); +VALA_EXTERN void playbin_select_track (Playbin* self, + guint position); +static void _ui_play_queue_on_row_activated_gtk_list_view_activate (GtkListView* _sender, + guint position, + gpointer self); +static gchar* ui_play_queue_visible_child_name (UiPlayQueue* self, + guint n_items); +VALA_EXTERN UiPlayQueue* ui_play_queue_new (void); +VALA_EXTERN UiPlayQueue* ui_play_queue_construct (GType object_type); +VALA_EXTERN void ui_play_queue_set_playbin (UiPlayQueue* self, + Playbin* value); +VALA_EXTERN GListModel* playbin_get_play_queue (Playbin* self); +static void _ui_play_queue_on_store_items_changed_g_list_model_items_changed (GListModel* _sender, + guint position, + guint removed, + guint added, + gpointer self); +VALA_EXTERN gboolean ui_play_queue_get_can_clear_all (UiPlayQueue* self); +static void ui_play_queue_finalize (GObject * obj); +static GType ui_play_queue_get_type_once (void); +static void _vala_ui_play_queue_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec); +static void _vala_ui_play_queue_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec); + +static inline gpointer +ui_play_queue_song_get_instance_private (UiPlayQueueSong* self) +{ + return G_STRUCT_MEMBER_P (self, UiPlayQueueSong_private_offset); +} + +static void +__lambda6_ (UiPlayQueueSong* self) +{ + Playbin* _tmp0_; + guint _tmp1_; +#line 33 "../src/ui/play_queue.vala" + _tmp0_ = self->priv->playbin; +#line 33 "../src/ui/play_queue.vala" + _tmp1_ = self->priv->_displayed_position; +#line 33 "../src/ui/play_queue.vala" + playbin_remove_track (_tmp0_, _tmp1_ - 1); +#line 315 "play_queue.c" +} + +static void +___lambda6__g_simple_action_activate (GSimpleAction* _sender, + GVariant* parameter, + gpointer self) +{ +#line 32 "../src/ui/play_queue.vala" + __lambda6_ ((UiPlayQueueSong*) self); +#line 325 "play_queue.c" +} + +UiPlayQueueSong* +ui_play_queue_song_construct (GType object_type, + Playbin* playbin) +{ + UiPlayQueueSong * self = NULL; + GSimpleActionGroup* action_group = NULL; + GSimpleActionGroup* _tmp0_; + GSimpleAction* remove = NULL; + GSimpleAction* _tmp1_; +#line 26 "../src/ui/play_queue.vala" + g_return_val_if_fail (playbin != NULL, NULL); +#line 26 "../src/ui/play_queue.vala" + self = (UiPlayQueueSong*) g_object_new (object_type, NULL); +#line 27 "../src/ui/play_queue.vala" + self->priv->playbin = playbin; +#line 29 "../src/ui/play_queue.vala" + _tmp0_ = g_simple_action_group_new (); +#line 29 "../src/ui/play_queue.vala" + action_group = _tmp0_; +#line 31 "../src/ui/play_queue.vala" + _tmp1_ = g_simple_action_new ("remove", NULL); +#line 31 "../src/ui/play_queue.vala" + remove = _tmp1_; +#line 32 "../src/ui/play_queue.vala" + g_signal_connect_object (remove, "activate", (GCallback) ___lambda6__g_simple_action_activate, self, 0); +#line 35 "../src/ui/play_queue.vala" + g_action_map_add_action ((GActionMap*) action_group, (GAction*) remove); +#line 37 "../src/ui/play_queue.vala" + gtk_widget_insert_action_group ((GtkWidget*) self, "song", (GActionGroup*) action_group); +#line 26 "../src/ui/play_queue.vala" + _g_object_unref0 (remove); +#line 26 "../src/ui/play_queue.vala" + _g_object_unref0 (action_group); +#line 26 "../src/ui/play_queue.vala" + return self; +#line 363 "play_queue.c" +} + +UiPlayQueueSong* +ui_play_queue_song_new (Playbin* playbin) +{ +#line 26 "../src/ui/play_queue.vala" + return ui_play_queue_song_construct (UI_TYPE_PLAY_QUEUE_SONG, playbin); +#line 371 "play_queue.c" +} + +static Block3Data* +block3_data_ref (Block3Data* _data3_) +{ +#line 41 "../src/ui/play_queue.vala" + g_atomic_int_inc (&_data3_->_ref_count_); +#line 41 "../src/ui/play_queue.vala" + return _data3_; +#line 381 "play_queue.c" +} + +static void +block3_data_unref (void * _userdata_) +{ + Block3Data* _data3_; + _data3_ = (Block3Data*) _userdata_; +#line 41 "../src/ui/play_queue.vala" + if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) { +#line 391 "play_queue.c" + UiPlayQueueSong* self; +#line 41 "../src/ui/play_queue.vala" + self = _data3_->self; +#line 41 "../src/ui/play_queue.vala" + _g_object_unref0 (self); +#line 41 "../src/ui/play_queue.vala" + g_slice_free (Block3Data, _data3_); +#line 399 "play_queue.c" + } +} + +static void +__lambda7_ (Block3Data* _data3_) +{ + UiPlayQueueSong* self; + Playbin* _tmp0_; + gint _tmp1_; + gint _tmp2_; +#line 45 "../src/ui/play_queue.vala" + self = _data3_->self; +#line 46 "../src/ui/play_queue.vala" + _tmp0_ = self->priv->playbin; +#line 46 "../src/ui/play_queue.vala" + _tmp1_ = playbin_get_play_queue_position (_tmp0_); +#line 46 "../src/ui/play_queue.vala" + _tmp2_ = _tmp1_; +#line 46 "../src/ui/play_queue.vala" + ui_play_queue_song_set_current (self, ((guint) _tmp2_) == _data3_->position); +#line 420 "play_queue.c" +} + +static void +___lambda7__g_object_notify (GObject* _sender, + GParamSpec* pspec, + gpointer self) +{ +#line 45 "../src/ui/play_queue.vala" + __lambda7_ (self); +#line 430 "play_queue.c" +} + +void +ui_play_queue_song_bind (UiPlayQueueSong* self, + guint position, + PlaybinSong* song) +{ + Block3Data* _data3_; + Playbin* _tmp0_; + gint _tmp1_; + gint _tmp2_; + Playbin* _tmp3_; + gulong _tmp4_; +#line 41 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 41 "../src/ui/play_queue.vala" + g_return_if_fail (song != NULL); +#line 41 "../src/ui/play_queue.vala" + _data3_ = g_slice_new0 (Block3Data); +#line 41 "../src/ui/play_queue.vala" + _data3_->_ref_count_ = 1; +#line 41 "../src/ui/play_queue.vala" + _data3_->self = g_object_ref (self); +#line 41 "../src/ui/play_queue.vala" + _data3_->position = position; +#line 42 "../src/ui/play_queue.vala" + ui_play_queue_song_set_displayed_position (self, _data3_->position + 1); +#line 43 "../src/ui/play_queue.vala" + ui_play_queue_song_set_song (self, song); +#line 44 "../src/ui/play_queue.vala" + _tmp0_ = self->priv->playbin; +#line 44 "../src/ui/play_queue.vala" + _tmp1_ = playbin_get_play_queue_position (_tmp0_); +#line 44 "../src/ui/play_queue.vala" + _tmp2_ = _tmp1_; +#line 44 "../src/ui/play_queue.vala" + ui_play_queue_song_set_current (self, ((guint) _tmp2_) == _data3_->position); +#line 45 "../src/ui/play_queue.vala" + _tmp3_ = self->priv->playbin; +#line 45 "../src/ui/play_queue.vala" + _tmp4_ = g_signal_connect_data ((GObject*) _tmp3_, "notify::play-queue-position", (GCallback) ___lambda7__g_object_notify, block3_data_ref (_data3_), (GClosureNotify) block3_data_unref, 0); +#line 45 "../src/ui/play_queue.vala" + self->priv->connection = _tmp4_; +#line 49 "../src/ui/play_queue.vala" + playbin_song_need_cover_art (song); +#line 41 "../src/ui/play_queue.vala" + block3_data_unref (_data3_); +#line 41 "../src/ui/play_queue.vala" + _data3_ = NULL; +#line 480 "play_queue.c" +} + +void +ui_play_queue_song_unbind (UiPlayQueueSong* self) +{ + Playbin* _tmp0_; +#line 52 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 53 "../src/ui/play_queue.vala" + _tmp0_ = self->priv->playbin; +#line 53 "../src/ui/play_queue.vala" + g_signal_handler_disconnect ((GObject*) _tmp0_, self->priv->connection); +#line 493 "play_queue.c" +} + +static gchar* +ui_play_queue_song_format_duration (UiPlayQueueSong* self, + gint duration) +{ + gchar* _tmp0_; + gchar* result; +#line 56 "../src/ui/play_queue.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 57 "../src/ui/play_queue.vala" + _tmp0_ = g_strdup_printf ("%02d:%02d", duration / 60, duration % 60); +#line 57 "../src/ui/play_queue.vala" + result = _tmp0_; +#line 57 "../src/ui/play_queue.vala" + return result; +#line 510 "play_queue.c" +} + +static gchar* +ui_play_queue_song_star_button_icon_name (UiPlayQueueSong* self, + GDateTime* starred) +{ + const gchar* _tmp0_ = NULL; + gchar* _tmp1_; + gchar* result; +#line 60 "../src/ui/play_queue.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 61 "../src/ui/play_queue.vala" + if (starred == NULL) { +#line 61 "../src/ui/play_queue.vala" + _tmp0_ = "non-starred"; +#line 526 "play_queue.c" + } else { +#line 61 "../src/ui/play_queue.vala" + _tmp0_ = "starred"; +#line 530 "play_queue.c" + } +#line 61 "../src/ui/play_queue.vala" + _tmp1_ = g_strdup (_tmp0_); +#line 61 "../src/ui/play_queue.vala" + result = _tmp1_; +#line 61 "../src/ui/play_queue.vala" + return result; +#line 538 "play_queue.c" +} + +static GdkContentProvider* +ui_play_queue_song_on_drag_prepare (UiPlayQueueSong* self, + gdouble x, + gdouble y) +{ + gboolean _tmp0_; + GdkContentProvider* result; +#line 67 "../src/ui/play_queue.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 68 "../src/ui/play_queue.vala" + _tmp0_ = self->priv->_draggable; +#line 68 "../src/ui/play_queue.vala" + if (_tmp0_) { +#line 554 "play_queue.c" + GValue _tmp1_ = {0}; + GdkContentProvider* _tmp2_; + GdkContentProvider* _tmp3_; +#line 69 "../src/ui/play_queue.vala" + self->priv->drag_x = x; +#line 70 "../src/ui/play_queue.vala" + self->priv->drag_y = y; +#line 71 "../src/ui/play_queue.vala" + g_value_init (&_tmp1_, UI_TYPE_PLAY_QUEUE_SONG); +#line 71 "../src/ui/play_queue.vala" + g_value_set_object (&_tmp1_, self); +#line 71 "../src/ui/play_queue.vala" + _tmp2_ = gdk_content_provider_new_for_value (&_tmp1_); +#line 71 "../src/ui/play_queue.vala" + _tmp3_ = _tmp2_; +#line 71 "../src/ui/play_queue.vala" + G_IS_VALUE (&_tmp1_) ? (g_value_unset (&_tmp1_), NULL) : NULL; +#line 71 "../src/ui/play_queue.vala" + result = _tmp3_; +#line 71 "../src/ui/play_queue.vala" + return result; +#line 576 "play_queue.c" + } else { +#line 73 "../src/ui/play_queue.vala" + result = NULL; +#line 73 "../src/ui/play_queue.vala" + return result; +#line 582 "play_queue.c" + } +} + +static GdkContentProvider* +_ui_play_queue_song_on_drag_prepare_gtk_drag_source_prepare (GtkDragSource* _sender, + gdouble x, + gdouble y, + gpointer self) +{ + GdkContentProvider* result; + result = ui_play_queue_song_on_drag_prepare ((UiPlayQueueSong*) self, x, y); +#line 4 "../src/ui/play_queue.vala" + return result; +#line 596 "play_queue.c" +} + +static gpointer +_g_object_ref0 (gpointer self) +{ +#line 97 "../src/ui/play_queue.vala" + return self ? g_object_ref (self) : NULL; +#line 604 "play_queue.c" +} + +static void +ui_play_queue_song_on_drag_begin (UiPlayQueueSong* self, + GtkDragSource* source, + GdkDrag* drag) +{ + GtkListBox* _tmp0_; + UiPlayQueueSong* drag_row = NULL; + Playbin* _tmp1_; + UiPlayQueueSong* _tmp2_; + gboolean _tmp3_; + gboolean _tmp4_; + gboolean _tmp5_; + guint _tmp6_; + PlaybinSong* _tmp7_; + GtkListBoxRow* drag_row_real = NULL; + GtkListBoxRow* _tmp8_; + GtkListBox* _tmp9_; + GtkListBox* _tmp10_; + GtkWidget* drag_icon = NULL; + GtkWidget* _tmp11_; + GtkWidget* _tmp12_; + GtkListBox* _tmp13_; +#line 78 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 78 "../src/ui/play_queue.vala" + g_return_if_fail (source != NULL); +#line 78 "../src/ui/play_queue.vala" + g_return_if_fail (drag != NULL); +#line 79 "../src/ui/play_queue.vala" + _tmp0_ = (GtkListBox*) gtk_list_box_new (); +#line 79 "../src/ui/play_queue.vala" + g_object_ref_sink (_tmp0_); +#line 79 "../src/ui/play_queue.vala" + _g_object_unref0 (self->priv->drag_widget); +#line 79 "../src/ui/play_queue.vala" + self->priv->drag_widget = _tmp0_; +#line 81 "../src/ui/play_queue.vala" + _tmp1_ = self->priv->playbin; +#line 81 "../src/ui/play_queue.vala" + _tmp2_ = ui_play_queue_song_new (_tmp1_); +#line 81 "../src/ui/play_queue.vala" + g_object_ref_sink (_tmp2_); +#line 81 "../src/ui/play_queue.vala" + drag_row = _tmp2_; +#line 82 "../src/ui/play_queue.vala" + ui_play_queue_song_set_draggable (drag_row, FALSE); +#line 83 "../src/ui/play_queue.vala" + _tmp3_ = self->priv->_show_position; +#line 83 "../src/ui/play_queue.vala" + ui_play_queue_song_set_show_position (drag_row, _tmp3_); +#line 84 "../src/ui/play_queue.vala" + _tmp4_ = self->priv->_show_artist; +#line 84 "../src/ui/play_queue.vala" + ui_play_queue_song_set_show_artist (drag_row, _tmp4_); +#line 85 "../src/ui/play_queue.vala" + _tmp5_ = self->priv->_show_cover; +#line 85 "../src/ui/play_queue.vala" + ui_play_queue_song_set_show_cover (drag_row, _tmp5_); +#line 86 "../src/ui/play_queue.vala" + ui_play_queue_song_set_current (drag_row, FALSE); +#line 87 "../src/ui/play_queue.vala" + _tmp6_ = self->priv->_displayed_position; +#line 87 "../src/ui/play_queue.vala" + ui_play_queue_song_set_displayed_position (drag_row, _tmp6_); +#line 88 "../src/ui/play_queue.vala" + _tmp7_ = self->priv->_song; +#line 88 "../src/ui/play_queue.vala" + ui_play_queue_song_set_song (drag_row, _tmp7_); +#line 89 "../src/ui/play_queue.vala" + gtk_widget_set_size_request ((GtkWidget*) drag_row, gtk_widget_get_width ((GtkWidget*) self), gtk_widget_get_height ((GtkWidget*) self)); +#line 91 "../src/ui/play_queue.vala" + _tmp8_ = (GtkListBoxRow*) gtk_list_box_row_new (); +#line 91 "../src/ui/play_queue.vala" + g_object_ref_sink (_tmp8_); +#line 91 "../src/ui/play_queue.vala" + drag_row_real = _tmp8_; +#line 92 "../src/ui/play_queue.vala" + gtk_list_box_row_set_child (drag_row_real, (GtkWidget*) drag_row); +#line 94 "../src/ui/play_queue.vala" + _tmp9_ = self->priv->drag_widget; +#line 94 "../src/ui/play_queue.vala" + gtk_list_box_append (_tmp9_, (GtkWidget*) drag_row_real); +#line 95 "../src/ui/play_queue.vala" + _tmp10_ = self->priv->drag_widget; +#line 95 "../src/ui/play_queue.vala" + gtk_list_box_drag_highlight_row (_tmp10_, drag_row_real); +#line 97 "../src/ui/play_queue.vala" + _tmp11_ = gtk_drag_icon_get_for_drag (drag); +#line 97 "../src/ui/play_queue.vala" + _tmp12_ = _g_object_ref0 (_tmp11_); +#line 97 "../src/ui/play_queue.vala" + drag_icon = _tmp12_; +#line 98 "../src/ui/play_queue.vala" + _tmp13_ = self->priv->drag_widget; +#line 98 "../src/ui/play_queue.vala" + g_object_set ((GObject*) drag_icon, "child", _tmp13_, NULL); +#line 99 "../src/ui/play_queue.vala" + gdk_drag_set_hotspot (drag, (gint) self->priv->drag_x, (gint) self->priv->drag_y); +#line 78 "../src/ui/play_queue.vala" + _g_object_unref0 (drag_icon); +#line 78 "../src/ui/play_queue.vala" + _g_object_unref0 (drag_row_real); +#line 78 "../src/ui/play_queue.vala" + _g_object_unref0 (drag_row); +#line 711 "play_queue.c" +} + +static void +_ui_play_queue_song_on_drag_begin_gtk_drag_source_drag_begin (GtkDragSource* _sender, + GdkDrag* drag, + gpointer self) +{ +#line 4 "../src/ui/play_queue.vala" + ui_play_queue_song_on_drag_begin ((UiPlayQueueSong*) self, _sender, drag); +#line 721 "play_queue.c" +} + +static gboolean +ui_play_queue_song_on_drop (UiPlayQueueSong* self, + GValue* value, + gdouble x, + gdouble y) +{ + UiPlayQueueSong* source = NULL; + GValue _tmp0_; + UiPlayQueueSong* _tmp1_; + guint _tmp2_; + guint _tmp3_; + Playbin* _tmp4_; + guint _tmp5_; + guint _tmp6_; + gboolean result; +#line 102 "../src/ui/play_queue.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 102 "../src/ui/play_queue.vala" + g_return_val_if_fail (value != NULL, FALSE); +#line 103 "../src/ui/play_queue.vala" + _g_object_unref0 (self->priv->drag_widget); +#line 103 "../src/ui/play_queue.vala" + self->priv->drag_widget = NULL; +#line 104 "../src/ui/play_queue.vala" + self->priv->drag_x = 0.0; +#line 105 "../src/ui/play_queue.vala" + self->priv->drag_y = 0.0; +#line 107 "../src/ui/play_queue.vala" + _tmp0_ = *value; +#line 107 "../src/ui/play_queue.vala" + _tmp1_ = _g_object_ref0 (g_value_get_object (&_tmp0_)); +#line 107 "../src/ui/play_queue.vala" + source = _tmp1_; +#line 108 "../src/ui/play_queue.vala" + _tmp2_ = source->priv->_displayed_position; +#line 108 "../src/ui/play_queue.vala" + _tmp3_ = self->priv->_displayed_position; +#line 108 "../src/ui/play_queue.vala" + g_debug ("play_queue.vala:108: dropped %u on %u", _tmp2_, _tmp3_); +#line 109 "../src/ui/play_queue.vala" + _tmp4_ = self->priv->playbin; +#line 109 "../src/ui/play_queue.vala" + _tmp5_ = source->priv->_displayed_position; +#line 109 "../src/ui/play_queue.vala" + _tmp6_ = self->priv->_displayed_position; +#line 109 "../src/ui/play_queue.vala" + playbin_move_track (_tmp4_, _tmp5_ - 1, _tmp6_ - 1); +#line 110 "../src/ui/play_queue.vala" + result = FALSE; +#line 110 "../src/ui/play_queue.vala" + _g_object_unref0 (source); +#line 110 "../src/ui/play_queue.vala" + return result; +#line 777 "play_queue.c" +} + +static gboolean +_ui_play_queue_song_on_drop_gtk_drop_target_drop (GtkDropTarget* _sender, + GValue* value, + gdouble x, + gdouble y, + gpointer self) +{ + gboolean result; + result = ui_play_queue_song_on_drop ((UiPlayQueueSong*) self, value, x, y); +#line 4 "../src/ui/play_queue.vala" + return result; +#line 791 "play_queue.c" +} + +gboolean +ui_play_queue_song_get_draggable (UiPlayQueueSong* self) +{ + gboolean result; +#line 5 "../src/ui/play_queue.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 5 "../src/ui/play_queue.vala" + result = self->priv->_draggable; +#line 5 "../src/ui/play_queue.vala" + return result; +#line 804 "play_queue.c" +} + +void +ui_play_queue_song_set_draggable (UiPlayQueueSong* self, + gboolean value) +{ + gboolean old_value; +#line 5 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 5 "../src/ui/play_queue.vala" + old_value = ui_play_queue_song_get_draggable (self); +#line 5 "../src/ui/play_queue.vala" + if (old_value != value) { +#line 5 "../src/ui/play_queue.vala" + self->priv->_draggable = value; +#line 5 "../src/ui/play_queue.vala" + g_object_notify_by_pspec ((GObject *) self, ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_DRAGGABLE_PROPERTY]); +#line 822 "play_queue.c" + } +} + +gboolean +ui_play_queue_song_get_show_position (UiPlayQueueSong* self) +{ + gboolean result; +#line 6 "../src/ui/play_queue.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 6 "../src/ui/play_queue.vala" + result = self->priv->_show_position; +#line 6 "../src/ui/play_queue.vala" + return result; +#line 836 "play_queue.c" +} + +void +ui_play_queue_song_set_show_position (UiPlayQueueSong* self, + gboolean value) +{ + gboolean old_value; +#line 6 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 6 "../src/ui/play_queue.vala" + old_value = ui_play_queue_song_get_show_position (self); +#line 6 "../src/ui/play_queue.vala" + if (old_value != value) { +#line 6 "../src/ui/play_queue.vala" + self->priv->_show_position = value; +#line 6 "../src/ui/play_queue.vala" + g_object_notify_by_pspec ((GObject *) self, ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_SHOW_POSITION_PROPERTY]); +#line 854 "play_queue.c" + } +} + +gboolean +ui_play_queue_song_get_show_artist (UiPlayQueueSong* self) +{ + gboolean result; +#line 7 "../src/ui/play_queue.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 7 "../src/ui/play_queue.vala" + result = self->priv->_show_artist; +#line 7 "../src/ui/play_queue.vala" + return result; +#line 868 "play_queue.c" +} + +void +ui_play_queue_song_set_show_artist (UiPlayQueueSong* self, + gboolean value) +{ + gboolean old_value; +#line 7 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 7 "../src/ui/play_queue.vala" + old_value = ui_play_queue_song_get_show_artist (self); +#line 7 "../src/ui/play_queue.vala" + if (old_value != value) { +#line 7 "../src/ui/play_queue.vala" + self->priv->_show_artist = value; +#line 7 "../src/ui/play_queue.vala" + g_object_notify_by_pspec ((GObject *) self, ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_SHOW_ARTIST_PROPERTY]); +#line 886 "play_queue.c" + } +} + +gboolean +ui_play_queue_song_get_show_cover (UiPlayQueueSong* self) +{ + gboolean result; +#line 8 "../src/ui/play_queue.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 8 "../src/ui/play_queue.vala" + result = self->priv->_show_cover; +#line 8 "../src/ui/play_queue.vala" + return result; +#line 900 "play_queue.c" +} + +void +ui_play_queue_song_set_show_cover (UiPlayQueueSong* self, + gboolean value) +{ + gboolean old_value; +#line 8 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 8 "../src/ui/play_queue.vala" + old_value = ui_play_queue_song_get_show_cover (self); +#line 8 "../src/ui/play_queue.vala" + if (old_value != value) { +#line 8 "../src/ui/play_queue.vala" + self->priv->_show_cover = value; +#line 8 "../src/ui/play_queue.vala" + g_object_notify_by_pspec ((GObject *) self, ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_SHOW_COVER_PROPERTY]); +#line 918 "play_queue.c" + } +} + +gboolean +ui_play_queue_song_get_current (UiPlayQueueSong* self) +{ + gboolean result; +#line 12 "../src/ui/play_queue.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 12 "../src/ui/play_queue.vala" + result = self->priv->_current; +#line 12 "../src/ui/play_queue.vala" + return result; +#line 932 "play_queue.c" +} + +void +ui_play_queue_song_set_current (UiPlayQueueSong* self, + gboolean value) +{ +#line 13 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 14 "../src/ui/play_queue.vala" + self->priv->_current = value; +#line 15 "../src/ui/play_queue.vala" + if (value) { +#line 16 "../src/ui/play_queue.vala" + gtk_widget_add_css_class ((GtkWidget*) self, "playing"); +#line 947 "play_queue.c" + } else { +#line 18 "../src/ui/play_queue.vala" + gtk_widget_remove_css_class ((GtkWidget*) self, "playing"); +#line 951 "play_queue.c" + } +#line 13 "../src/ui/play_queue.vala" + g_object_notify_by_pspec ((GObject *) self, ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_CURRENT_PROPERTY]); +#line 955 "play_queue.c" +} + +guint +ui_play_queue_song_get_displayed_position (UiPlayQueueSong* self) +{ + guint result; +#line 22 "../src/ui/play_queue.vala" + g_return_val_if_fail (self != NULL, 0U); +#line 22 "../src/ui/play_queue.vala" + result = self->priv->_displayed_position; +#line 22 "../src/ui/play_queue.vala" + return result; +#line 968 "play_queue.c" +} + +void +ui_play_queue_song_set_displayed_position (UiPlayQueueSong* self, + guint value) +{ + guint old_value; +#line 22 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 22 "../src/ui/play_queue.vala" + old_value = ui_play_queue_song_get_displayed_position (self); +#line 22 "../src/ui/play_queue.vala" + if (old_value != value) { +#line 22 "../src/ui/play_queue.vala" + self->priv->_displayed_position = value; +#line 22 "../src/ui/play_queue.vala" + g_object_notify_by_pspec ((GObject *) self, ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_DISPLAYED_POSITION_PROPERTY]); +#line 986 "play_queue.c" + } +} + +PlaybinSong* +ui_play_queue_song_get_song (UiPlayQueueSong* self) +{ + PlaybinSong* result; + PlaybinSong* _tmp0_; +#line 23 "../src/ui/play_queue.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 23 "../src/ui/play_queue.vala" + _tmp0_ = self->priv->_song; +#line 23 "../src/ui/play_queue.vala" + result = _tmp0_; +#line 23 "../src/ui/play_queue.vala" + return result; +#line 1003 "play_queue.c" +} + +void +ui_play_queue_song_set_song (UiPlayQueueSong* self, + PlaybinSong* value) +{ + PlaybinSong* old_value; +#line 23 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 23 "../src/ui/play_queue.vala" + old_value = ui_play_queue_song_get_song (self); +#line 23 "../src/ui/play_queue.vala" + if (old_value != value) { +#line 1017 "play_queue.c" + PlaybinSong* _tmp0_; +#line 23 "../src/ui/play_queue.vala" + _tmp0_ = _g_object_ref0 (value); +#line 23 "../src/ui/play_queue.vala" + _g_object_unref0 (self->priv->_song); +#line 23 "../src/ui/play_queue.vala" + self->priv->_song = _tmp0_; +#line 23 "../src/ui/play_queue.vala" + g_object_notify_by_pspec ((GObject *) self, ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_SONG_PROPERTY]); +#line 1027 "play_queue.c" + } +} + +static void +ui_play_queue_song_class_init (UiPlayQueueSongClass * klass, + gpointer klass_data) +{ +#line 4 "../src/ui/play_queue.vala" + ui_play_queue_song_parent_class = g_type_class_peek_parent (klass); +#line 4 "../src/ui/play_queue.vala" + g_type_class_adjust_private_offset (klass, &UiPlayQueueSong_private_offset); +#line 4 "../src/ui/play_queue.vala" + G_OBJECT_CLASS (klass)->get_property = _vala_ui_play_queue_song_get_property; +#line 4 "../src/ui/play_queue.vala" + G_OBJECT_CLASS (klass)->set_property = _vala_ui_play_queue_song_set_property; +#line 4 "../src/ui/play_queue.vala" + G_OBJECT_CLASS (klass)->finalize = ui_play_queue_song_finalize; +#line 4 "../src/ui/play_queue.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_PLAY_QUEUE_SONG_DRAGGABLE_PROPERTY, ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_DRAGGABLE_PROPERTY] = g_param_spec_boolean ("draggable", "draggable", "draggable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 4 "../src/ui/play_queue.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_PLAY_QUEUE_SONG_SHOW_POSITION_PROPERTY, ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_SHOW_POSITION_PROPERTY] = g_param_spec_boolean ("show-position", "show-position", "show-position", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 4 "../src/ui/play_queue.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_PLAY_QUEUE_SONG_SHOW_ARTIST_PROPERTY, ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_SHOW_ARTIST_PROPERTY] = g_param_spec_boolean ("show-artist", "show-artist", "show-artist", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 4 "../src/ui/play_queue.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_PLAY_QUEUE_SONG_SHOW_COVER_PROPERTY, ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_SHOW_COVER_PROPERTY] = g_param_spec_boolean ("show-cover", "show-cover", "show-cover", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 4 "../src/ui/play_queue.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_PLAY_QUEUE_SONG_CURRENT_PROPERTY, ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_CURRENT_PROPERTY] = g_param_spec_boolean ("current", "current", "current", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 4 "../src/ui/play_queue.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_PLAY_QUEUE_SONG_DISPLAYED_POSITION_PROPERTY, ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_DISPLAYED_POSITION_PROPERTY] = g_param_spec_uint ("displayed-position", "displayed-position", "displayed-position", 0, G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 4 "../src/ui/play_queue.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_PLAY_QUEUE_SONG_SONG_PROPERTY, ui_play_queue_song_properties[UI_PLAY_QUEUE_SONG_SONG_PROPERTY] = g_param_spec_object ("song", "song", "song", TYPE_PLAYBIN_SONG, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 4 "../src/ui/play_queue.vala" + gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/eu/callcc/audrey/ui/play_queue_song.ui"); +#line 4 "../src/ui/play_queue.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "format_duration", G_CALLBACK(ui_play_queue_song_format_duration)); +#line 4 "../src/ui/play_queue.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "star_button_icon_name", G_CALLBACK(ui_play_queue_song_star_button_icon_name)); +#line 4 "../src/ui/play_queue.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_drag_prepare", G_CALLBACK(_ui_play_queue_song_on_drag_prepare_gtk_drag_source_prepare)); +#line 4 "../src/ui/play_queue.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_drag_begin", G_CALLBACK(_ui_play_queue_song_on_drag_begin_gtk_drag_source_drag_begin)); +#line 4 "../src/ui/play_queue.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_drop", G_CALLBACK(_ui_play_queue_song_on_drop_gtk_drop_target_drop)); +#line 1071 "play_queue.c" +} + +static void +ui_play_queue_song_instance_init (UiPlayQueueSong * self, + gpointer klass) +{ +#line 4 "../src/ui/play_queue.vala" + self->priv = ui_play_queue_song_get_instance_private (self); +#line 5 "../src/ui/play_queue.vala" + self->priv->_draggable = FALSE; +#line 6 "../src/ui/play_queue.vala" + self->priv->_show_position = FALSE; +#line 7 "../src/ui/play_queue.vala" + self->priv->_show_artist = FALSE; +#line 8 "../src/ui/play_queue.vala" + self->priv->_show_cover = FALSE; +#line 10 "../src/ui/play_queue.vala" + self->priv->_current = FALSE; +#line 4 "../src/ui/play_queue.vala" + gtk_widget_init_template (GTK_WIDGET (self)); +#line 1092 "play_queue.c" +} + +static void +ui_play_queue_song_finalize (GObject * obj) +{ + UiPlayQueueSong * self; +#line 4 "../src/ui/play_queue.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, UI_TYPE_PLAY_QUEUE_SONG, UiPlayQueueSong); +#line 23 "../src/ui/play_queue.vala" + _g_object_unref0 (self->priv->_song); +#line 76 "../src/ui/play_queue.vala" + _g_object_unref0 (self->priv->drag_widget); +#line 4 "../src/ui/play_queue.vala" + G_OBJECT_CLASS (ui_play_queue_song_parent_class)->finalize (obj); +#line 1107 "play_queue.c" +} + +static GType +ui_play_queue_song_get_type_once (void) +{ + static const GTypeInfo g_define_type_info = { sizeof (UiPlayQueueSongClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ui_play_queue_song_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UiPlayQueueSong), 0, (GInstanceInitFunc) ui_play_queue_song_instance_init, NULL }; + GType ui_play_queue_song_type_id; + ui_play_queue_song_type_id = g_type_register_static (gtk_box_get_type (), "UiPlayQueueSong", &g_define_type_info, 0); + UiPlayQueueSong_private_offset = g_type_add_instance_private (ui_play_queue_song_type_id, sizeof (UiPlayQueueSongPrivate)); + return ui_play_queue_song_type_id; +} + +GType +ui_play_queue_song_get_type (void) +{ + static volatile gsize ui_play_queue_song_type_id__once = 0; + if (g_once_init_enter (&ui_play_queue_song_type_id__once)) { + GType ui_play_queue_song_type_id; + ui_play_queue_song_type_id = ui_play_queue_song_get_type_once (); + g_once_init_leave (&ui_play_queue_song_type_id__once, ui_play_queue_song_type_id); + } + return ui_play_queue_song_type_id__once; +} + +static void +_vala_ui_play_queue_song_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec) +{ + UiPlayQueueSong * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, UI_TYPE_PLAY_QUEUE_SONG, UiPlayQueueSong); +#line 4 "../src/ui/play_queue.vala" + switch (property_id) { +#line 4 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_SONG_DRAGGABLE_PROPERTY: +#line 4 "../src/ui/play_queue.vala" + g_value_set_boolean (value, ui_play_queue_song_get_draggable (self)); +#line 4 "../src/ui/play_queue.vala" + break; +#line 4 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_SONG_SHOW_POSITION_PROPERTY: +#line 4 "../src/ui/play_queue.vala" + g_value_set_boolean (value, ui_play_queue_song_get_show_position (self)); +#line 4 "../src/ui/play_queue.vala" + break; +#line 4 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_SONG_SHOW_ARTIST_PROPERTY: +#line 4 "../src/ui/play_queue.vala" + g_value_set_boolean (value, ui_play_queue_song_get_show_artist (self)); +#line 4 "../src/ui/play_queue.vala" + break; +#line 4 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_SONG_SHOW_COVER_PROPERTY: +#line 4 "../src/ui/play_queue.vala" + g_value_set_boolean (value, ui_play_queue_song_get_show_cover (self)); +#line 4 "../src/ui/play_queue.vala" + break; +#line 4 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_SONG_CURRENT_PROPERTY: +#line 4 "../src/ui/play_queue.vala" + g_value_set_boolean (value, ui_play_queue_song_get_current (self)); +#line 4 "../src/ui/play_queue.vala" + break; +#line 4 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_SONG_DISPLAYED_POSITION_PROPERTY: +#line 4 "../src/ui/play_queue.vala" + g_value_set_uint (value, ui_play_queue_song_get_displayed_position (self)); +#line 4 "../src/ui/play_queue.vala" + break; +#line 4 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_SONG_SONG_PROPERTY: +#line 4 "../src/ui/play_queue.vala" + g_value_set_object (value, ui_play_queue_song_get_song (self)); +#line 4 "../src/ui/play_queue.vala" + break; +#line 1184 "play_queue.c" + default: +#line 4 "../src/ui/play_queue.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 4 "../src/ui/play_queue.vala" + break; +#line 1190 "play_queue.c" + } +} + +static void +_vala_ui_play_queue_song_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec) +{ + UiPlayQueueSong * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, UI_TYPE_PLAY_QUEUE_SONG, UiPlayQueueSong); +#line 4 "../src/ui/play_queue.vala" + switch (property_id) { +#line 4 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_SONG_DRAGGABLE_PROPERTY: +#line 4 "../src/ui/play_queue.vala" + ui_play_queue_song_set_draggable (self, g_value_get_boolean (value)); +#line 4 "../src/ui/play_queue.vala" + break; +#line 4 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_SONG_SHOW_POSITION_PROPERTY: +#line 4 "../src/ui/play_queue.vala" + ui_play_queue_song_set_show_position (self, g_value_get_boolean (value)); +#line 4 "../src/ui/play_queue.vala" + break; +#line 4 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_SONG_SHOW_ARTIST_PROPERTY: +#line 4 "../src/ui/play_queue.vala" + ui_play_queue_song_set_show_artist (self, g_value_get_boolean (value)); +#line 4 "../src/ui/play_queue.vala" + break; +#line 4 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_SONG_SHOW_COVER_PROPERTY: +#line 4 "../src/ui/play_queue.vala" + ui_play_queue_song_set_show_cover (self, g_value_get_boolean (value)); +#line 4 "../src/ui/play_queue.vala" + break; +#line 4 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_SONG_CURRENT_PROPERTY: +#line 4 "../src/ui/play_queue.vala" + ui_play_queue_song_set_current (self, g_value_get_boolean (value)); +#line 4 "../src/ui/play_queue.vala" + break; +#line 4 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_SONG_DISPLAYED_POSITION_PROPERTY: +#line 4 "../src/ui/play_queue.vala" + ui_play_queue_song_set_displayed_position (self, g_value_get_uint (value)); +#line 4 "../src/ui/play_queue.vala" + break; +#line 4 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_SONG_SONG_PROPERTY: +#line 4 "../src/ui/play_queue.vala" + ui_play_queue_song_set_song (self, g_value_get_object (value)); +#line 4 "../src/ui/play_queue.vala" + break; +#line 1246 "play_queue.c" + default: +#line 4 "../src/ui/play_queue.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 4 "../src/ui/play_queue.vala" + break; +#line 1252 "play_queue.c" + } +} + +static inline gpointer +ui_play_queue_get_instance_private (UiPlayQueue* self) +{ + return G_STRUCT_MEMBER_P (self, UiPlayQueue_private_offset); +} + +static void +ui_play_queue_on_store_items_changed (UiPlayQueue* self, + GListModel* store, + guint position, + guint removed, + guint added) +{ +#line 134 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 134 "../src/ui/play_queue.vala" + g_return_if_fail (store != NULL); +#line 135 "../src/ui/play_queue.vala" + ui_play_queue_set_can_clear_all (self, g_list_model_get_n_items (store) > ((guint) 0)); +#line 1275 "play_queue.c" +} + +static void +ui_play_queue_on_song_list_setup (UiPlayQueue* self, + GtkSignalListItemFactory* factory, + GObject* object) +{ + GtkListItem* item = NULL; + GtkListItem* _tmp0_; + UiPlayQueueSong* child = NULL; + Playbin* _tmp1_; + Playbin* _tmp2_; + UiPlayQueueSong* _tmp3_; +#line 138 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 138 "../src/ui/play_queue.vala" + g_return_if_fail (factory != NULL); +#line 138 "../src/ui/play_queue.vala" + g_return_if_fail (object != NULL); +#line 139 "../src/ui/play_queue.vala" + _tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (object, gtk_list_item_get_type ()) ? ((GtkListItem*) object) : NULL); +#line 139 "../src/ui/play_queue.vala" + item = _tmp0_; +#line 140 "../src/ui/play_queue.vala" + _tmp1_ = ui_play_queue_get_playbin (self); +#line 140 "../src/ui/play_queue.vala" + _tmp2_ = _tmp1_; +#line 140 "../src/ui/play_queue.vala" + _tmp3_ = ui_play_queue_song_new (_tmp2_); +#line 140 "../src/ui/play_queue.vala" + g_object_ref_sink (_tmp3_); +#line 140 "../src/ui/play_queue.vala" + child = _tmp3_; +#line 142 "../src/ui/play_queue.vala" + ui_play_queue_song_set_draggable (child, TRUE); +#line 143 "../src/ui/play_queue.vala" + ui_play_queue_song_set_show_position (child, TRUE); +#line 144 "../src/ui/play_queue.vala" + ui_play_queue_song_set_show_artist (child, TRUE); +#line 145 "../src/ui/play_queue.vala" + ui_play_queue_song_set_show_cover (child, TRUE); +#line 147 "../src/ui/play_queue.vala" + gtk_list_item_set_child (item, (GtkWidget*) child); +#line 138 "../src/ui/play_queue.vala" + _g_object_unref0 (child); +#line 138 "../src/ui/play_queue.vala" + _g_object_unref0 (item); +#line 1323 "play_queue.c" +} + +static void +_ui_play_queue_on_song_list_setup_gtk_signal_list_item_factory_setup (GtkSignalListItemFactory* _sender, + GObject* object, + gpointer self) +{ +#line 115 "../src/ui/play_queue.vala" + ui_play_queue_on_song_list_setup ((UiPlayQueue*) self, _sender, object); +#line 1333 "play_queue.c" +} + +static void +ui_play_queue_on_song_list_bind (UiPlayQueue* self, + GtkSignalListItemFactory* factory, + GObject* object) +{ + GtkListItem* item = NULL; + GtkListItem* _tmp0_; + UiPlayQueueSong* child = NULL; + GtkWidget* _tmp1_; + GtkWidget* _tmp2_; + UiPlayQueueSong* _tmp3_; + guint _tmp4_; + guint _tmp5_; + GObject* _tmp6_; + GObject* _tmp7_; +#line 150 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 150 "../src/ui/play_queue.vala" + g_return_if_fail (factory != NULL); +#line 150 "../src/ui/play_queue.vala" + g_return_if_fail (object != NULL); +#line 151 "../src/ui/play_queue.vala" + _tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (object, gtk_list_item_get_type ()) ? ((GtkListItem*) object) : NULL); +#line 151 "../src/ui/play_queue.vala" + item = _tmp0_; +#line 152 "../src/ui/play_queue.vala" + _tmp1_ = gtk_list_item_get_child (item); +#line 152 "../src/ui/play_queue.vala" + _tmp2_ = _tmp1_; +#line 152 "../src/ui/play_queue.vala" + _tmp3_ = _g_object_ref0 (UI_IS_PLAY_QUEUE_SONG (_tmp2_) ? ((UiPlayQueueSong*) _tmp2_) : NULL); +#line 152 "../src/ui/play_queue.vala" + child = _tmp3_; +#line 154 "../src/ui/play_queue.vala" + _tmp4_ = gtk_list_item_get_position (item); +#line 154 "../src/ui/play_queue.vala" + _tmp5_ = _tmp4_; +#line 154 "../src/ui/play_queue.vala" + _tmp6_ = gtk_list_item_get_item (item); +#line 154 "../src/ui/play_queue.vala" + _tmp7_ = _tmp6_; +#line 154 "../src/ui/play_queue.vala" + ui_play_queue_song_bind (child, _tmp5_, IS_PLAYBIN_SONG (_tmp7_) ? ((PlaybinSong*) _tmp7_) : NULL); +#line 150 "../src/ui/play_queue.vala" + _g_object_unref0 (child); +#line 150 "../src/ui/play_queue.vala" + _g_object_unref0 (item); +#line 1383 "play_queue.c" +} + +static void +_ui_play_queue_on_song_list_bind_gtk_signal_list_item_factory_bind (GtkSignalListItemFactory* _sender, + GObject* object, + gpointer self) +{ +#line 115 "../src/ui/play_queue.vala" + ui_play_queue_on_song_list_bind ((UiPlayQueue*) self, _sender, object); +#line 1393 "play_queue.c" +} + +static void +ui_play_queue_on_song_list_unbind (UiPlayQueue* self, + GtkSignalListItemFactory* factory, + GObject* object) +{ + GtkListItem* item = NULL; + GtkListItem* _tmp0_; + UiPlayQueueSong* child = NULL; + GtkWidget* _tmp1_; + GtkWidget* _tmp2_; + UiPlayQueueSong* _tmp3_; +#line 157 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 157 "../src/ui/play_queue.vala" + g_return_if_fail (factory != NULL); +#line 157 "../src/ui/play_queue.vala" + g_return_if_fail (object != NULL); +#line 158 "../src/ui/play_queue.vala" + _tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (object, gtk_list_item_get_type ()) ? ((GtkListItem*) object) : NULL); +#line 158 "../src/ui/play_queue.vala" + item = _tmp0_; +#line 159 "../src/ui/play_queue.vala" + _tmp1_ = gtk_list_item_get_child (item); +#line 159 "../src/ui/play_queue.vala" + _tmp2_ = _tmp1_; +#line 159 "../src/ui/play_queue.vala" + _tmp3_ = _g_object_ref0 (UI_IS_PLAY_QUEUE_SONG (_tmp2_) ? ((UiPlayQueueSong*) _tmp2_) : NULL); +#line 159 "../src/ui/play_queue.vala" + child = _tmp3_; +#line 161 "../src/ui/play_queue.vala" + ui_play_queue_song_unbind (child); +#line 157 "../src/ui/play_queue.vala" + _g_object_unref0 (child); +#line 157 "../src/ui/play_queue.vala" + _g_object_unref0 (item); +#line 1431 "play_queue.c" +} + +static void +_ui_play_queue_on_song_list_unbind_gtk_signal_list_item_factory_unbind (GtkSignalListItemFactory* _sender, + GObject* object, + gpointer self) +{ +#line 115 "../src/ui/play_queue.vala" + ui_play_queue_on_song_list_unbind ((UiPlayQueue*) self, _sender, object); +#line 1441 "play_queue.c" +} + +static void +ui_play_queue_on_row_activated (UiPlayQueue* self, + guint position) +{ + Playbin* _tmp0_; + Playbin* _tmp1_; +#line 164 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 165 "../src/ui/play_queue.vala" + _tmp0_ = ui_play_queue_get_playbin (self); +#line 165 "../src/ui/play_queue.vala" + _tmp1_ = _tmp0_; +#line 165 "../src/ui/play_queue.vala" + playbin_select_track (_tmp1_, position); +#line 1458 "play_queue.c" +} + +static void +_ui_play_queue_on_row_activated_gtk_list_view_activate (GtkListView* _sender, + guint position, + gpointer self) +{ +#line 115 "../src/ui/play_queue.vala" + ui_play_queue_on_row_activated ((UiPlayQueue*) self, position); +#line 1468 "play_queue.c" +} + +static gchar* +ui_play_queue_visible_child_name (UiPlayQueue* self, + guint n_items) +{ + const gchar* _tmp0_ = NULL; + gchar* _tmp1_; + gchar* result; +#line 168 "../src/ui/play_queue.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 169 "../src/ui/play_queue.vala" + if (n_items > ((guint) 0)) { +#line 169 "../src/ui/play_queue.vala" + _tmp0_ = "not-empty"; +#line 1484 "play_queue.c" + } else { +#line 169 "../src/ui/play_queue.vala" + _tmp0_ = "empty"; +#line 1488 "play_queue.c" + } +#line 169 "../src/ui/play_queue.vala" + _tmp1_ = g_strdup (_tmp0_); +#line 169 "../src/ui/play_queue.vala" + result = _tmp1_; +#line 169 "../src/ui/play_queue.vala" + return result; +#line 1496 "play_queue.c" +} + +UiPlayQueue* +ui_play_queue_construct (GType object_type) +{ + UiPlayQueue * self = NULL; +#line 115 "../src/ui/play_queue.vala" + self = (UiPlayQueue*) g_object_new (object_type, NULL); +#line 115 "../src/ui/play_queue.vala" + return self; +#line 1507 "play_queue.c" +} + +UiPlayQueue* +ui_play_queue_new (void) +{ +#line 115 "../src/ui/play_queue.vala" + return ui_play_queue_construct (UI_TYPE_PLAY_QUEUE); +#line 1515 "play_queue.c" +} + +Playbin* +ui_play_queue_get_playbin (UiPlayQueue* self) +{ + Playbin* result; + Playbin* _tmp0_; +#line 118 "../src/ui/play_queue.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 118 "../src/ui/play_queue.vala" + _tmp0_ = self->priv->_playbin; +#line 118 "../src/ui/play_queue.vala" + result = _tmp0_; +#line 118 "../src/ui/play_queue.vala" + return result; +#line 1531 "play_queue.c" +} + +static void +_ui_play_queue_on_store_items_changed_g_list_model_items_changed (GListModel* _sender, + guint position, + guint removed, + guint added, + gpointer self) +{ +#line 123 "../src/ui/play_queue.vala" + ui_play_queue_on_store_items_changed ((UiPlayQueue*) self, _sender, position, removed, added); +#line 1543 "play_queue.c" +} + +void +ui_play_queue_set_playbin (UiPlayQueue* self, + Playbin* value) +{ + Playbin* _tmp0_; + Playbin* _tmp1_; + GListModel* _tmp2_; + GListModel* _tmp3_; + Playbin* _tmp4_; + GListModel* _tmp5_; + GListModel* _tmp6_; +#line 119 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 120 "../src/ui/play_queue.vala" + _tmp0_ = self->priv->_playbin; +#line 120 "../src/ui/play_queue.vala" + _vala_assert (_tmp0_ == NULL, "_playbin == null"); +#line 121 "../src/ui/play_queue.vala" + self->priv->_playbin = value; +#line 123 "../src/ui/play_queue.vala" + _tmp1_ = self->priv->_playbin; +#line 123 "../src/ui/play_queue.vala" + _tmp2_ = playbin_get_play_queue (_tmp1_); +#line 123 "../src/ui/play_queue.vala" + _tmp3_ = _tmp2_; +#line 123 "../src/ui/play_queue.vala" + g_signal_connect_object (_tmp3_, "items-changed", (GCallback) _ui_play_queue_on_store_items_changed_g_list_model_items_changed, self, 0); +#line 124 "../src/ui/play_queue.vala" + _tmp4_ = self->priv->_playbin; +#line 124 "../src/ui/play_queue.vala" + _tmp5_ = playbin_get_play_queue (_tmp4_); +#line 124 "../src/ui/play_queue.vala" + _tmp6_ = _tmp5_; +#line 124 "../src/ui/play_queue.vala" + ui_play_queue_set_can_clear_all (self, g_list_model_get_n_items (_tmp6_) > ((guint) 0)); +#line 119 "../src/ui/play_queue.vala" + g_object_notify_by_pspec ((GObject *) self, ui_play_queue_properties[UI_PLAY_QUEUE_PLAYBIN_PROPERTY]); +#line 1583 "play_queue.c" +} + +gboolean +ui_play_queue_get_can_clear_all (UiPlayQueue* self) +{ + gboolean result; +#line 128 "../src/ui/play_queue.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 128 "../src/ui/play_queue.vala" + result = self->priv->_can_clear_all; +#line 128 "../src/ui/play_queue.vala" + return result; +#line 1596 "play_queue.c" +} + +static void +ui_play_queue_set_can_clear_all (UiPlayQueue* self, + gboolean value) +{ + gboolean old_value; +#line 128 "../src/ui/play_queue.vala" + g_return_if_fail (self != NULL); +#line 128 "../src/ui/play_queue.vala" + old_value = ui_play_queue_get_can_clear_all (self); +#line 128 "../src/ui/play_queue.vala" + if (old_value != value) { +#line 128 "../src/ui/play_queue.vala" + self->priv->_can_clear_all = value; +#line 128 "../src/ui/play_queue.vala" + g_object_notify_by_pspec ((GObject *) self, ui_play_queue_properties[UI_PLAY_QUEUE_CAN_CLEAR_ALL_PROPERTY]); +#line 1614 "play_queue.c" + } +} + +static void +ui_play_queue_class_init (UiPlayQueueClass * klass, + gpointer klass_data) +{ +#line 115 "../src/ui/play_queue.vala" + ui_play_queue_parent_class = g_type_class_peek_parent (klass); +#line 115 "../src/ui/play_queue.vala" + g_type_class_adjust_private_offset (klass, &UiPlayQueue_private_offset); +#line 115 "../src/ui/play_queue.vala" + G_OBJECT_CLASS (klass)->get_property = _vala_ui_play_queue_get_property; +#line 115 "../src/ui/play_queue.vala" + G_OBJECT_CLASS (klass)->set_property = _vala_ui_play_queue_set_property; +#line 115 "../src/ui/play_queue.vala" + G_OBJECT_CLASS (klass)->finalize = ui_play_queue_finalize; +#line 115 "../src/ui/play_queue.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_PLAY_QUEUE_PLAYBIN_PROPERTY, ui_play_queue_properties[UI_PLAY_QUEUE_PLAYBIN_PROPERTY] = g_param_spec_object ("playbin", "playbin", "playbin", TYPE_PLAYBIN, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 115 "../src/ui/play_queue.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_PLAY_QUEUE_CAN_CLEAR_ALL_PROPERTY, ui_play_queue_properties[UI_PLAY_QUEUE_CAN_CLEAR_ALL_PROPERTY] = g_param_spec_boolean ("can-clear-all", "can-clear-all", "can-clear-all", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 115 "../src/ui/play_queue.vala" + gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/eu/callcc/audrey/ui/play_queue.ui"); +#line 115 "../src/ui/play_queue.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_song_list_setup", G_CALLBACK(_ui_play_queue_on_song_list_setup_gtk_signal_list_item_factory_setup)); +#line 115 "../src/ui/play_queue.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_song_list_bind", G_CALLBACK(_ui_play_queue_on_song_list_bind_gtk_signal_list_item_factory_bind)); +#line 115 "../src/ui/play_queue.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_song_list_unbind", G_CALLBACK(_ui_play_queue_on_song_list_unbind_gtk_signal_list_item_factory_unbind)); +#line 115 "../src/ui/play_queue.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_row_activated", G_CALLBACK(_ui_play_queue_on_row_activated_gtk_list_view_activate)); +#line 115 "../src/ui/play_queue.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "visible_child_name", G_CALLBACK(ui_play_queue_visible_child_name)); +#line 1648 "play_queue.c" +} + +static void +ui_play_queue_instance_init (UiPlayQueue * self, + gpointer klass) +{ +#line 115 "../src/ui/play_queue.vala" + self->priv = ui_play_queue_get_instance_private (self); +#line 115 "../src/ui/play_queue.vala" + gtk_widget_init_template (GTK_WIDGET (self)); +#line 1659 "play_queue.c" +} + +static void +ui_play_queue_finalize (GObject * obj) +{ + UiPlayQueue * self; +#line 115 "../src/ui/play_queue.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, UI_TYPE_PLAY_QUEUE, UiPlayQueue); +#line 173 "../src/ui/play_queue.vala" + g_debug ("play_queue.vala:173: destroying play queue widget"); +#line 115 "../src/ui/play_queue.vala" + G_OBJECT_CLASS (ui_play_queue_parent_class)->finalize (obj); +#line 1672 "play_queue.c" +} + +static GType +ui_play_queue_get_type_once (void) +{ + static const GTypeInfo g_define_type_info = { sizeof (UiPlayQueueClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ui_play_queue_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UiPlayQueue), 0, (GInstanceInitFunc) ui_play_queue_instance_init, NULL }; + GType ui_play_queue_type_id; + ui_play_queue_type_id = g_type_register_static (adw_bin_get_type (), "UiPlayQueue", &g_define_type_info, 0); + UiPlayQueue_private_offset = g_type_add_instance_private (ui_play_queue_type_id, sizeof (UiPlayQueuePrivate)); + return ui_play_queue_type_id; +} + +GType +ui_play_queue_get_type (void) +{ + static volatile gsize ui_play_queue_type_id__once = 0; + if (g_once_init_enter (&ui_play_queue_type_id__once)) { + GType ui_play_queue_type_id; + ui_play_queue_type_id = ui_play_queue_get_type_once (); + g_once_init_leave (&ui_play_queue_type_id__once, ui_play_queue_type_id); + } + return ui_play_queue_type_id__once; +} + +static void +_vala_ui_play_queue_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec) +{ + UiPlayQueue * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, UI_TYPE_PLAY_QUEUE, UiPlayQueue); +#line 115 "../src/ui/play_queue.vala" + switch (property_id) { +#line 115 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_PLAYBIN_PROPERTY: +#line 115 "../src/ui/play_queue.vala" + g_value_set_object (value, ui_play_queue_get_playbin (self)); +#line 115 "../src/ui/play_queue.vala" + break; +#line 115 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_CAN_CLEAR_ALL_PROPERTY: +#line 115 "../src/ui/play_queue.vala" + g_value_set_boolean (value, ui_play_queue_get_can_clear_all (self)); +#line 115 "../src/ui/play_queue.vala" + break; +#line 1719 "play_queue.c" + default: +#line 115 "../src/ui/play_queue.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 115 "../src/ui/play_queue.vala" + break; +#line 1725 "play_queue.c" + } +} + +static void +_vala_ui_play_queue_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec) +{ + UiPlayQueue * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, UI_TYPE_PLAY_QUEUE, UiPlayQueue); +#line 115 "../src/ui/play_queue.vala" + switch (property_id) { +#line 115 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_PLAYBIN_PROPERTY: +#line 115 "../src/ui/play_queue.vala" + ui_play_queue_set_playbin (self, g_value_get_object (value)); +#line 115 "../src/ui/play_queue.vala" + break; +#line 115 "../src/ui/play_queue.vala" + case UI_PLAY_QUEUE_CAN_CLEAR_ALL_PROPERTY: +#line 115 "../src/ui/play_queue.vala" + ui_play_queue_set_can_clear_all (self, g_value_get_boolean (value)); +#line 115 "../src/ui/play_queue.vala" + break; +#line 1751 "play_queue.c" + default: +#line 115 "../src/ui/play_queue.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 115 "../src/ui/play_queue.vala" + break; +#line 1757 "play_queue.c" + } +} + diff --git a/src/ui/play_queue.vala b/src/ui/play_queue.vala deleted file mode 100644 index 475ef78..0000000 --- a/src/ui/play_queue.vala +++ /dev/null @@ -1,175 +0,0 @@ -// song widget+drag behavior taken from gnome music - -[GtkTemplate (ui = "/eu/callcc/audrey/ui/play_queue_song.ui")] -class Ui.PlayQueueSong : Gtk.Box { - public bool draggable { get; set; default = false; } - public bool show_position { get; set; default = false; } - public bool show_artist { get; set; default = false; } - public bool show_cover { get; set; default = false; } - - private bool _current = false; - public bool current { - get { return _current; } - set { - this._current = value; - if (value) { - this.add_css_class ("playing"); - } else { - this.remove_css_class ("playing"); - } - } - } - public uint displayed_position { get; set; } - public PlaybinSong song { get; set; } - - private weak Playbin playbin; - public PlayQueueSong (Playbin playbin) { - this.playbin = playbin; - - var action_group = new SimpleActionGroup (); - - var remove = new SimpleAction ("remove", null); - remove.activate.connect (() => { - this.playbin.remove_track (this.displayed_position-1); - }); - action_group.add_action (remove); - - this.insert_action_group ("song", action_group); - } - - private ulong connection; - public void bind (uint position, PlaybinSong song) { - this.displayed_position = position+1; - this.song = song; - this.current = this.playbin.play_queue_position == position; - this.connection = this.playbin.notify["play-queue-position"].connect (() => { - this.current = this.playbin.play_queue_position == position; - }); - - song.need_cover_art (); - } - - public void unbind () { - this.playbin.disconnect (this.connection); - } - - [GtkCallback] private string format_duration (int duration) { - return "%02d:%02d".printf(duration/60, duration%60); - } - - [GtkCallback] private string star_button_icon_name (DateTime? starred) { - return starred == null ? "non-starred" : "starred"; - } - - private double drag_x; - private double drag_y; - - [GtkCallback] private Gdk.ContentProvider? on_drag_prepare (double x, double y) { - if (this.draggable) { - this.drag_x = x; - this.drag_y = y; - return new Gdk.ContentProvider.for_value (this); - } - else return null; - } - - private Gtk.ListBox? drag_widget; - - [GtkCallback] private void on_drag_begin (Gtk.DragSource source, Gdk.Drag drag) { - this.drag_widget = new Gtk.ListBox (); - - var drag_row = new PlayQueueSong (this.playbin); - drag_row.draggable = false; - drag_row.show_position = this.show_position; - drag_row.show_artist = this.show_artist; - drag_row.show_cover = this.show_cover; - drag_row.current = false; - drag_row.displayed_position = this.displayed_position; - drag_row.song = this.song; - drag_row.set_size_request (this.get_width (), this.get_height ()); - - var drag_row_real = new Gtk.ListBoxRow (); - drag_row_real.child = drag_row; - - this.drag_widget.append (drag_row_real); - this.drag_widget.drag_highlight_row (drag_row_real); - - var drag_icon = Gtk.DragIcon.get_for_drag (drag); - drag_icon.set("child", this.drag_widget); - drag.set_hotspot ((int) this.drag_x, (int) this.drag_y); - } - - [GtkCallback] private bool on_drop (Value value, double x, double y) { - this.drag_widget = null; - this.drag_x = 0.0; - this.drag_y = 0.0; - - var source = value as PlayQueueSong; - debug ("dropped %u on %u", source.displayed_position, this.displayed_position); - this.playbin.move_track (source.displayed_position-1, this.displayed_position-1); - return false; - } -} - -[GtkTemplate (ui = "/eu/callcc/audrey/ui/play_queue.ui")] -public class Ui.PlayQueue : Adw.Bin { - private weak Playbin _playbin; - public Playbin playbin { - get { return _playbin; } - set { - assert (_playbin == null); // only set once - _playbin = value; - - _playbin.play_queue.items_changed.connect (this.on_store_items_changed); - this.can_clear_all = _playbin.play_queue.get_n_items () > 0; - } - } - - public bool can_clear_all { get; private set; } - - /*[GtkCallback] private void on_clear () { - this.playbin.clear (); - }*/ - - private void on_store_items_changed (GLib.ListModel store, uint position, uint removed, uint added) { - this.can_clear_all = store.get_n_items () > 0; - } - - [GtkCallback] private void on_song_list_setup (Gtk.SignalListItemFactory factory, Object object) { - var item = object as Gtk.ListItem; - var child = new PlayQueueSong (this.playbin); - - child.draggable = true; - child.show_position = true; - child.show_artist = true; - child.show_cover = true; - - item.child = child; - } - - [GtkCallback] private void on_song_list_bind (Gtk.SignalListItemFactory factory, Object object) { - var item = object as Gtk.ListItem; - var child = item.child as PlayQueueSong; - - child.bind (item.position, item.item as PlaybinSong); - } - - [GtkCallback] private void on_song_list_unbind (Gtk.SignalListItemFactory factory, Object object) { - var item = object as Gtk.ListItem; - var child = item.child as PlayQueueSong; - - child.unbind (); - } - - [GtkCallback] private void on_row_activated (uint position) { - playbin.select_track (position); - } - - [GtkCallback] private string visible_child_name (uint n_items) { - return n_items > 0 ? "not-empty" : "empty"; - } - - ~PlayQueue () { - debug ("destroying play queue widget"); - } -} diff --git a/src/ui/playbar.c b/src/ui/playbar.c new file mode 100644 index 0000000..7be2706 --- /dev/null +++ b/src/ui/playbar.c @@ -0,0 +1,1138 @@ +/* playbar.c generated by valac 0.56.16, the Vala compiler + * generated from playbar.vala, do not modify */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 UI_TYPE_PLAYBAR (ui_playbar_get_type ()) +#define UI_PLAYBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UI_TYPE_PLAYBAR, UiPlaybar)) +#define UI_PLAYBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UI_TYPE_PLAYBAR, UiPlaybarClass)) +#define UI_IS_PLAYBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UI_TYPE_PLAYBAR)) +#define UI_IS_PLAYBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UI_TYPE_PLAYBAR)) +#define UI_PLAYBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UI_TYPE_PLAYBAR, UiPlaybarClass)) + +typedef struct _UiPlaybar UiPlaybar; +typedef struct _UiPlaybarClass UiPlaybarClass; +typedef struct _UiPlaybarPrivate UiPlaybarPrivate; + +#define TYPE_PLAYBIN_SONG (playbin_song_get_type ()) +#define PLAYBIN_SONG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYBIN_SONG, PlaybinSong)) +#define PLAYBIN_SONG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYBIN_SONG, PlaybinSongClass)) +#define IS_PLAYBIN_SONG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYBIN_SONG)) +#define IS_PLAYBIN_SONG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYBIN_SONG)) +#define PLAYBIN_SONG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYBIN_SONG, PlaybinSongClass)) + +typedef struct _PlaybinSong PlaybinSong; +typedef struct _PlaybinSongClass PlaybinSongClass; + +#define TYPE_PLAYBIN (playbin_get_type ()) +#define PLAYBIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYBIN, Playbin)) +#define PLAYBIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYBIN, PlaybinClass)) +#define IS_PLAYBIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYBIN)) +#define IS_PLAYBIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYBIN)) +#define PLAYBIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYBIN, PlaybinClass)) + +typedef struct _Playbin Playbin; +typedef struct _PlaybinClass PlaybinClass; +enum { + UI_PLAYBAR_0_PROPERTY, + UI_PLAYBAR_SONG_PROPERTY, + UI_PLAYBAR_PLAYING_COVER_ART_PROPERTY, + UI_PLAYBAR_PLAYBIN_PROPERTY, + UI_PLAYBAR_SHOW_COVER_ART_PROPERTY, + UI_PLAYBAR_VOLUME_PROPERTY, + UI_PLAYBAR_NUM_PROPERTIES +}; +static GParamSpec* ui_playbar_properties[UI_PLAYBAR_NUM_PROPERTIES]; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +typedef enum { + PLAYBIN_STATE_STOPPED, + PLAYBIN_STATE_PAUSED, + PLAYBIN_STATE_PLAYING +} PlaybinState; + +#define TYPE_PLAYBIN_STATE (playbin_state_get_type ()) + +struct _UiPlaybar { + AdwBin parent_instance; + UiPlaybarPrivate * priv; +}; + +struct _UiPlaybarClass { + AdwBinClass parent_class; +}; + +struct _UiPlaybarPrivate { + PlaybinSong* _song; + GdkPaintable* _playing_cover_art; + Playbin* _playbin; + gboolean _show_cover_art; +}; + +static gint UiPlaybar_private_offset; +static gpointer ui_playbar_parent_class = NULL; + +VALA_EXTERN GType ui_playbar_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (UiPlaybar, g_object_unref) +VALA_EXTERN GType playbin_song_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (PlaybinSong, g_object_unref) +VALA_EXTERN GType playbin_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (Playbin, g_object_unref) +static gchar* ui_playbar_format_timestamp (UiPlaybar* self, + gdouble s); +static gboolean ui_playbar_on_play_position_seek (UiPlaybar* self, + GtkRange* range, + GtkScrollType scroll_type, + gdouble value); +VALA_EXTERN Playbin* ui_playbar_get_playbin (UiPlaybar* self); +VALA_EXTERN void playbin_seek (Playbin* self, + gdouble position); +static gboolean _ui_playbar_on_play_position_seek_gtk_range_change_value (GtkRange* _sender, + GtkScrollType scroll, + gdouble new_value, + gpointer self); +static void ui_playbar_on_play_pause_clicked (UiPlaybar* self); +VALA_EXTERN GType playbin_state_get_type (void) G_GNUC_CONST ; +VALA_EXTERN PlaybinState playbin_get_state (Playbin* self); +VALA_EXTERN void playbin_pause (Playbin* self); +VALA_EXTERN void playbin_play (Playbin* self); +static void _ui_playbar_on_play_pause_clicked_gtk_button_clicked (GtkButton* _sender, + gpointer self); +static gchar* ui_playbar_play_pause_icon_name (UiPlaybar* self, + PlaybinState state); +static gboolean ui_playbar_playbin_active (UiPlaybar* self, + PlaybinState state); +static gboolean ui_playbar_can_press_play (UiPlaybar* self, + PlaybinState state, + guint n_items); +static gchar* ui_playbar_mute_button_icon_name (UiPlaybar* self, + gboolean mute); +static void ui_playbar_on_mute_toggle (UiPlaybar* self); +VALA_EXTERN gboolean playbin_get_mute (Playbin* self); +VALA_EXTERN void playbin_set_mute (Playbin* self, + gboolean value); +static void _ui_playbar_on_mute_toggle_gtk_button_clicked (GtkButton* _sender, + gpointer self); +static void ui_playbar_on_skip_forward_clicked (UiPlaybar* self); +VALA_EXTERN void playbin_go_to_next_track (Playbin* self); +static void _ui_playbar_on_skip_forward_clicked_gtk_button_clicked (GtkButton* _sender, + gpointer self); +static void ui_playbar_on_skip_backward_clicked (UiPlaybar* self); +VALA_EXTERN void playbin_go_to_prev_track (Playbin* self); +static void _ui_playbar_on_skip_backward_clicked_gtk_button_clicked (GtkButton* _sender, + gpointer self); +static void ui_playbar_seek_backward (UiPlaybar* self); +VALA_EXTERN gdouble playbin_get_position (Playbin* self); +static void _ui_playbar_seek_backward_gtk_button_clicked (GtkButton* _sender, + gpointer self); +static void ui_playbar_seek_forward (UiPlaybar* self); +VALA_EXTERN gdouble playbin_get_duration (Playbin* self); +static void _ui_playbar_seek_forward_gtk_button_clicked (GtkButton* _sender, + gpointer self); +static gchar* ui_playbar_song_title (UiPlaybar* self, + PlaybinSong* song); +VALA_EXTERN const gchar* playbin_song_get_title (PlaybinSong* self); +static gchar* ui_playbar_song_artist (UiPlaybar* self, + PlaybinSong* song); +VALA_EXTERN const gchar* playbin_song_get_artist (PlaybinSong* self); +static gchar* ui_playbar_song_album (UiPlaybar* self, + PlaybinSong* song); +VALA_EXTERN const gchar* playbin_song_get_album (PlaybinSong* self); +VALA_EXTERN UiPlaybar* ui_playbar_new (void); +VALA_EXTERN UiPlaybar* ui_playbar_construct (GType object_type); +VALA_EXTERN PlaybinSong* ui_playbar_get_song (UiPlaybar* self); +VALA_EXTERN void ui_playbar_set_song (UiPlaybar* self, + PlaybinSong* value); +VALA_EXTERN GdkPaintable* ui_playbar_get_playing_cover_art (UiPlaybar* self); +VALA_EXTERN void ui_playbar_set_playing_cover_art (UiPlaybar* self, + GdkPaintable* value); +VALA_EXTERN void ui_playbar_set_playbin (UiPlaybar* self, + Playbin* value); +VALA_EXTERN gboolean ui_playbar_get_show_cover_art (UiPlaybar* self); +VALA_EXTERN void ui_playbar_set_show_cover_art (UiPlaybar* self, + gboolean value); +VALA_EXTERN gint ui_playbar_get_volume (UiPlaybar* self); +VALA_EXTERN gint playbin_get_volume (Playbin* self); +VALA_EXTERN void ui_playbar_set_volume (UiPlaybar* self, + gint value); +VALA_EXTERN void playbin_set_volume (Playbin* self, + gint value); +static void ui_playbar_finalize (GObject * obj); +static GType ui_playbar_get_type_once (void); +static void _vala_ui_playbar_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec); +static void _vala_ui_playbar_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec); + +static inline gpointer +ui_playbar_get_instance_private (UiPlaybar* self) +{ + return G_STRUCT_MEMBER_P (self, UiPlaybar_private_offset); +} + +static gchar* +ui_playbar_format_timestamp (UiPlaybar* self, + gdouble s) +{ + gchar* _tmp0_; + gchar* result; +#line 13 "../src/ui/playbar.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 14 "../src/ui/playbar.vala" + _tmp0_ = g_strdup_printf ("%02d:%02d", ((gint) s) / 60, ((gint) s) % 60); +#line 14 "../src/ui/playbar.vala" + result = _tmp0_; +#line 14 "../src/ui/playbar.vala" + return result; +#line 217 "playbar.c" +} + +static gboolean +ui_playbar_on_play_position_seek (UiPlaybar* self, + GtkRange* range, + GtkScrollType scroll_type, + gdouble value) +{ + GtkAdjustment* _tmp0_; + GtkAdjustment* _tmp1_; + gdouble _tmp2_; + gdouble _tmp3_; + GtkAdjustment* _tmp4_; + GtkAdjustment* _tmp5_; + gdouble _tmp6_; + gdouble _tmp7_; + gboolean result; +#line 17 "../src/ui/playbar.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 17 "../src/ui/playbar.vala" + g_return_val_if_fail (range != NULL, FALSE); +#line 18 "../src/ui/playbar.vala" + _tmp0_ = gtk_range_get_adjustment (range); +#line 18 "../src/ui/playbar.vala" + _tmp1_ = _tmp0_; +#line 18 "../src/ui/playbar.vala" + _tmp2_ = gtk_adjustment_get_lower (_tmp1_); +#line 18 "../src/ui/playbar.vala" + _tmp3_ = _tmp2_; +#line 18 "../src/ui/playbar.vala" + _tmp4_ = gtk_range_get_adjustment (range); +#line 18 "../src/ui/playbar.vala" + _tmp5_ = _tmp4_; +#line 18 "../src/ui/playbar.vala" + _tmp6_ = gtk_adjustment_get_upper (_tmp5_); +#line 18 "../src/ui/playbar.vala" + _tmp7_ = _tmp6_; +#line 18 "../src/ui/playbar.vala" + if (_tmp3_ < _tmp7_) { +#line 257 "playbar.c" + Playbin* _tmp8_; +#line 19 "../src/ui/playbar.vala" + _tmp8_ = self->priv->_playbin; +#line 19 "../src/ui/playbar.vala" + playbin_seek (_tmp8_, (gdouble) ((gint64) value)); +#line 263 "playbar.c" + } +#line 21 "../src/ui/playbar.vala" + result = FALSE; +#line 21 "../src/ui/playbar.vala" + return result; +#line 269 "playbar.c" +} + +static gboolean +_ui_playbar_on_play_position_seek_gtk_range_change_value (GtkRange* _sender, + GtkScrollType scroll, + gdouble new_value, + gpointer self) +{ + gboolean result; + result = ui_playbar_on_play_position_seek ((UiPlaybar*) self, _sender, scroll, new_value); +#line 2 "../src/ui/playbar.vala" + return result; +#line 282 "playbar.c" +} + +static void +ui_playbar_on_play_pause_clicked (UiPlaybar* self) +{ + Playbin* _tmp0_; + PlaybinState _tmp1_; + PlaybinState _tmp2_; +#line 24 "../src/ui/playbar.vala" + g_return_if_fail (self != NULL); +#line 25 "../src/ui/playbar.vala" + _tmp0_ = self->priv->_playbin; +#line 25 "../src/ui/playbar.vala" + _tmp1_ = playbin_get_state (_tmp0_); +#line 25 "../src/ui/playbar.vala" + _tmp2_ = _tmp1_; +#line 25 "../src/ui/playbar.vala" + if (_tmp2_ == PLAYBIN_STATE_PLAYING) { +#line 301 "playbar.c" + Playbin* _tmp3_; +#line 26 "../src/ui/playbar.vala" + _tmp3_ = self->priv->_playbin; +#line 26 "../src/ui/playbar.vala" + playbin_pause (_tmp3_); +#line 307 "playbar.c" + } else { + Playbin* _tmp4_; +#line 28 "../src/ui/playbar.vala" + _tmp4_ = self->priv->_playbin; +#line 28 "../src/ui/playbar.vala" + playbin_play (_tmp4_); +#line 314 "playbar.c" + } +} + +static void +_ui_playbar_on_play_pause_clicked_gtk_button_clicked (GtkButton* _sender, + gpointer self) +{ +#line 2 "../src/ui/playbar.vala" + ui_playbar_on_play_pause_clicked ((UiPlaybar*) self); +#line 324 "playbar.c" +} + +static gchar* +ui_playbar_play_pause_icon_name (UiPlaybar* self, + PlaybinState state) +{ + gchar* result; +#line 32 "../src/ui/playbar.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 33 "../src/ui/playbar.vala" + if (state == PLAYBIN_STATE_PLAYING) { +#line 336 "playbar.c" + gchar* _tmp0_; +#line 34 "../src/ui/playbar.vala" + _tmp0_ = g_strdup ("media-playback-pause"); +#line 34 "../src/ui/playbar.vala" + result = _tmp0_; +#line 34 "../src/ui/playbar.vala" + return result; +#line 344 "playbar.c" + } else { + gchar* _tmp1_; +#line 36 "../src/ui/playbar.vala" + _tmp1_ = g_strdup ("media-playback-start"); +#line 36 "../src/ui/playbar.vala" + result = _tmp1_; +#line 36 "../src/ui/playbar.vala" + return result; +#line 353 "playbar.c" + } +} + +static gboolean +ui_playbar_playbin_active (UiPlaybar* self, + PlaybinState state) +{ + gboolean result; +#line 40 "../src/ui/playbar.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 41 "../src/ui/playbar.vala" + result = state != PLAYBIN_STATE_STOPPED; +#line 41 "../src/ui/playbar.vala" + return result; +#line 368 "playbar.c" +} + +static gboolean +ui_playbar_can_press_play (UiPlaybar* self, + PlaybinState state, + guint n_items) +{ + gboolean _tmp0_ = FALSE; + gboolean result; +#line 44 "../src/ui/playbar.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 45 "../src/ui/playbar.vala" + if (state == PLAYBIN_STATE_STOPPED) { +#line 45 "../src/ui/playbar.vala" + _tmp0_ = n_items == ((guint) 0); +#line 384 "playbar.c" + } else { +#line 45 "../src/ui/playbar.vala" + _tmp0_ = FALSE; +#line 388 "playbar.c" + } +#line 45 "../src/ui/playbar.vala" + result = !_tmp0_; +#line 45 "../src/ui/playbar.vala" + return result; +#line 394 "playbar.c" +} + +static gchar* +ui_playbar_mute_button_icon_name (UiPlaybar* self, + gboolean mute) +{ + const gchar* _tmp0_ = NULL; + gchar* _tmp1_; + gchar* result; +#line 48 "../src/ui/playbar.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 49 "../src/ui/playbar.vala" + if (mute) { +#line 49 "../src/ui/playbar.vala" + _tmp0_ = "audio-volume-muted"; +#line 410 "playbar.c" + } else { +#line 49 "../src/ui/playbar.vala" + _tmp0_ = "audio-volume-high"; +#line 414 "playbar.c" + } +#line 49 "../src/ui/playbar.vala" + _tmp1_ = g_strdup (_tmp0_); +#line 49 "../src/ui/playbar.vala" + result = _tmp1_; +#line 49 "../src/ui/playbar.vala" + return result; +#line 422 "playbar.c" +} + +static void +ui_playbar_on_mute_toggle (UiPlaybar* self) +{ + Playbin* _tmp0_; + Playbin* _tmp1_; + gboolean _tmp2_; + gboolean _tmp3_; +#line 52 "../src/ui/playbar.vala" + g_return_if_fail (self != NULL); +#line 53 "../src/ui/playbar.vala" + _tmp0_ = self->priv->_playbin; +#line 53 "../src/ui/playbar.vala" + _tmp1_ = self->priv->_playbin; +#line 53 "../src/ui/playbar.vala" + _tmp2_ = playbin_get_mute (_tmp1_); +#line 53 "../src/ui/playbar.vala" + _tmp3_ = _tmp2_; +#line 53 "../src/ui/playbar.vala" + playbin_set_mute (_tmp0_, !_tmp3_); +#line 444 "playbar.c" +} + +static void +_ui_playbar_on_mute_toggle_gtk_button_clicked (GtkButton* _sender, + gpointer self) +{ +#line 2 "../src/ui/playbar.vala" + ui_playbar_on_mute_toggle ((UiPlaybar*) self); +#line 453 "playbar.c" +} + +static void +ui_playbar_on_skip_forward_clicked (UiPlaybar* self) +{ + Playbin* _tmp0_; +#line 56 "../src/ui/playbar.vala" + g_return_if_fail (self != NULL); +#line 57 "../src/ui/playbar.vala" + _tmp0_ = self->priv->_playbin; +#line 57 "../src/ui/playbar.vala" + playbin_go_to_next_track (_tmp0_); +#line 466 "playbar.c" +} + +static void +_ui_playbar_on_skip_forward_clicked_gtk_button_clicked (GtkButton* _sender, + gpointer self) +{ +#line 2 "../src/ui/playbar.vala" + ui_playbar_on_skip_forward_clicked ((UiPlaybar*) self); +#line 475 "playbar.c" +} + +static void +ui_playbar_on_skip_backward_clicked (UiPlaybar* self) +{ + Playbin* _tmp0_; +#line 60 "../src/ui/playbar.vala" + g_return_if_fail (self != NULL); +#line 61 "../src/ui/playbar.vala" + _tmp0_ = self->priv->_playbin; +#line 61 "../src/ui/playbar.vala" + playbin_go_to_prev_track (_tmp0_); +#line 488 "playbar.c" +} + +static void +_ui_playbar_on_skip_backward_clicked_gtk_button_clicked (GtkButton* _sender, + gpointer self) +{ +#line 2 "../src/ui/playbar.vala" + ui_playbar_on_skip_backward_clicked ((UiPlaybar*) self); +#line 497 "playbar.c" +} + +static void +ui_playbar_seek_backward (UiPlaybar* self) +{ + gdouble new_position = 0.0; + Playbin* _tmp0_; + gdouble _tmp1_; + gdouble _tmp2_; + Playbin* _tmp3_; +#line 64 "../src/ui/playbar.vala" + g_return_if_fail (self != NULL); +#line 66 "../src/ui/playbar.vala" + _tmp0_ = self->priv->_playbin; +#line 66 "../src/ui/playbar.vala" + _tmp1_ = playbin_get_position (_tmp0_); +#line 66 "../src/ui/playbar.vala" + _tmp2_ = _tmp1_; +#line 66 "../src/ui/playbar.vala" + new_position = _tmp2_ - 10.0; +#line 67 "../src/ui/playbar.vala" + if (new_position < 0.0) { +#line 67 "../src/ui/playbar.vala" + new_position = 0.0; +#line 522 "playbar.c" + } +#line 68 "../src/ui/playbar.vala" + _tmp3_ = self->priv->_playbin; +#line 68 "../src/ui/playbar.vala" + playbin_seek (_tmp3_, new_position); +#line 528 "playbar.c" +} + +static void +_ui_playbar_seek_backward_gtk_button_clicked (GtkButton* _sender, + gpointer self) +{ +#line 2 "../src/ui/playbar.vala" + ui_playbar_seek_backward ((UiPlaybar*) self); +#line 537 "playbar.c" +} + +static void +ui_playbar_seek_forward (UiPlaybar* self) +{ + gdouble new_position = 0.0; + Playbin* _tmp0_; + gdouble _tmp1_; + gdouble _tmp2_; + Playbin* _tmp3_; + gdouble _tmp4_; + gdouble _tmp5_; + Playbin* _tmp9_; +#line 71 "../src/ui/playbar.vala" + g_return_if_fail (self != NULL); +#line 73 "../src/ui/playbar.vala" + _tmp0_ = self->priv->_playbin; +#line 73 "../src/ui/playbar.vala" + _tmp1_ = playbin_get_position (_tmp0_); +#line 73 "../src/ui/playbar.vala" + _tmp2_ = _tmp1_; +#line 73 "../src/ui/playbar.vala" + new_position = _tmp2_ + 10.0; +#line 74 "../src/ui/playbar.vala" + _tmp3_ = self->priv->_playbin; +#line 74 "../src/ui/playbar.vala" + _tmp4_ = playbin_get_duration (_tmp3_); +#line 74 "../src/ui/playbar.vala" + _tmp5_ = _tmp4_; +#line 74 "../src/ui/playbar.vala" + if (new_position > _tmp5_) { +#line 569 "playbar.c" + Playbin* _tmp6_; + gdouble _tmp7_; + gdouble _tmp8_; +#line 74 "../src/ui/playbar.vala" + _tmp6_ = self->priv->_playbin; +#line 74 "../src/ui/playbar.vala" + _tmp7_ = playbin_get_duration (_tmp6_); +#line 74 "../src/ui/playbar.vala" + _tmp8_ = _tmp7_; +#line 74 "../src/ui/playbar.vala" + new_position = _tmp8_; +#line 581 "playbar.c" + } +#line 75 "../src/ui/playbar.vala" + _tmp9_ = self->priv->_playbin; +#line 75 "../src/ui/playbar.vala" + playbin_seek (_tmp9_, new_position); +#line 587 "playbar.c" +} + +static void +_ui_playbar_seek_forward_gtk_button_clicked (GtkButton* _sender, + gpointer self) +{ +#line 2 "../src/ui/playbar.vala" + ui_playbar_seek_forward ((UiPlaybar*) self); +#line 596 "playbar.c" +} + +static gchar* +ui_playbar_song_title (UiPlaybar* self, + PlaybinSong* song) +{ + const gchar* _tmp0_ = NULL; + gchar* _tmp3_; + gchar* result; +#line 78 "../src/ui/playbar.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 79 "../src/ui/playbar.vala" + if (song == NULL) { +#line 79 "../src/ui/playbar.vala" + _tmp0_ = ""; +#line 612 "playbar.c" + } else { + const gchar* _tmp1_; + const gchar* _tmp2_; +#line 79 "../src/ui/playbar.vala" + _tmp1_ = playbin_song_get_title (song); +#line 79 "../src/ui/playbar.vala" + _tmp2_ = _tmp1_; +#line 79 "../src/ui/playbar.vala" + _tmp0_ = _tmp2_; +#line 622 "playbar.c" + } +#line 79 "../src/ui/playbar.vala" + _tmp3_ = g_strdup (_tmp0_); +#line 79 "../src/ui/playbar.vala" + result = _tmp3_; +#line 79 "../src/ui/playbar.vala" + return result; +#line 630 "playbar.c" +} + +static gchar* +ui_playbar_song_artist (UiPlaybar* self, + PlaybinSong* song) +{ + const gchar* _tmp0_ = NULL; + gchar* _tmp3_; + gchar* result; +#line 82 "../src/ui/playbar.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 83 "../src/ui/playbar.vala" + if (song == NULL) { +#line 83 "../src/ui/playbar.vala" + _tmp0_ = ""; +#line 646 "playbar.c" + } else { + const gchar* _tmp1_; + const gchar* _tmp2_; +#line 83 "../src/ui/playbar.vala" + _tmp1_ = playbin_song_get_artist (song); +#line 83 "../src/ui/playbar.vala" + _tmp2_ = _tmp1_; +#line 83 "../src/ui/playbar.vala" + _tmp0_ = _tmp2_; +#line 656 "playbar.c" + } +#line 83 "../src/ui/playbar.vala" + _tmp3_ = g_strdup (_tmp0_); +#line 83 "../src/ui/playbar.vala" + result = _tmp3_; +#line 83 "../src/ui/playbar.vala" + return result; +#line 664 "playbar.c" +} + +static gchar* +ui_playbar_song_album (UiPlaybar* self, + PlaybinSong* song) +{ + const gchar* _tmp0_ = NULL; + gchar* _tmp3_; + gchar* result; +#line 86 "../src/ui/playbar.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 87 "../src/ui/playbar.vala" + if (song == NULL) { +#line 87 "../src/ui/playbar.vala" + _tmp0_ = ""; +#line 680 "playbar.c" + } else { + const gchar* _tmp1_; + const gchar* _tmp2_; +#line 87 "../src/ui/playbar.vala" + _tmp1_ = playbin_song_get_album (song); +#line 87 "../src/ui/playbar.vala" + _tmp2_ = _tmp1_; +#line 87 "../src/ui/playbar.vala" + _tmp0_ = _tmp2_; +#line 690 "playbar.c" + } +#line 87 "../src/ui/playbar.vala" + _tmp3_ = g_strdup (_tmp0_); +#line 87 "../src/ui/playbar.vala" + result = _tmp3_; +#line 87 "../src/ui/playbar.vala" + return result; +#line 698 "playbar.c" +} + +UiPlaybar* +ui_playbar_construct (GType object_type) +{ + UiPlaybar * self = NULL; +#line 2 "../src/ui/playbar.vala" + self = (UiPlaybar*) g_object_new (object_type, NULL); +#line 2 "../src/ui/playbar.vala" + return self; +#line 709 "playbar.c" +} + +UiPlaybar* +ui_playbar_new (void) +{ +#line 2 "../src/ui/playbar.vala" + return ui_playbar_construct (UI_TYPE_PLAYBAR); +#line 717 "playbar.c" +} + +PlaybinSong* +ui_playbar_get_song (UiPlaybar* self) +{ + PlaybinSong* result; + PlaybinSong* _tmp0_; +#line 3 "../src/ui/playbar.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 3 "../src/ui/playbar.vala" + _tmp0_ = self->priv->_song; +#line 3 "../src/ui/playbar.vala" + result = _tmp0_; +#line 3 "../src/ui/playbar.vala" + return result; +#line 733 "playbar.c" +} + +static gpointer +_g_object_ref0 (gpointer self) +{ +#line 3 "../src/ui/playbar.vala" + return self ? g_object_ref (self) : NULL; +#line 741 "playbar.c" +} + +void +ui_playbar_set_song (UiPlaybar* self, + PlaybinSong* value) +{ + PlaybinSong* old_value; +#line 3 "../src/ui/playbar.vala" + g_return_if_fail (self != NULL); +#line 3 "../src/ui/playbar.vala" + old_value = ui_playbar_get_song (self); +#line 3 "../src/ui/playbar.vala" + if (old_value != value) { +#line 755 "playbar.c" + PlaybinSong* _tmp0_; +#line 3 "../src/ui/playbar.vala" + _tmp0_ = _g_object_ref0 (value); +#line 3 "../src/ui/playbar.vala" + _g_object_unref0 (self->priv->_song); +#line 3 "../src/ui/playbar.vala" + self->priv->_song = _tmp0_; +#line 3 "../src/ui/playbar.vala" + g_object_notify_by_pspec ((GObject *) self, ui_playbar_properties[UI_PLAYBAR_SONG_PROPERTY]); +#line 765 "playbar.c" + } +} + +GdkPaintable* +ui_playbar_get_playing_cover_art (UiPlaybar* self) +{ + GdkPaintable* result; + GdkPaintable* _tmp0_; +#line 4 "../src/ui/playbar.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 4 "../src/ui/playbar.vala" + _tmp0_ = self->priv->_playing_cover_art; +#line 4 "../src/ui/playbar.vala" + result = _tmp0_; +#line 4 "../src/ui/playbar.vala" + return result; +#line 782 "playbar.c" +} + +void +ui_playbar_set_playing_cover_art (UiPlaybar* self, + GdkPaintable* value) +{ + GdkPaintable* old_value; +#line 4 "../src/ui/playbar.vala" + g_return_if_fail (self != NULL); +#line 4 "../src/ui/playbar.vala" + old_value = ui_playbar_get_playing_cover_art (self); +#line 4 "../src/ui/playbar.vala" + if (old_value != value) { +#line 796 "playbar.c" + GdkPaintable* _tmp0_; +#line 4 "../src/ui/playbar.vala" + _tmp0_ = _g_object_ref0 (value); +#line 4 "../src/ui/playbar.vala" + _g_object_unref0 (self->priv->_playing_cover_art); +#line 4 "../src/ui/playbar.vala" + self->priv->_playing_cover_art = _tmp0_; +#line 4 "../src/ui/playbar.vala" + g_object_notify_by_pspec ((GObject *) self, ui_playbar_properties[UI_PLAYBAR_PLAYING_COVER_ART_PROPERTY]); +#line 806 "playbar.c" + } +} + +Playbin* +ui_playbar_get_playbin (UiPlaybar* self) +{ + Playbin* result; + Playbin* _tmp0_; +#line 5 "../src/ui/playbar.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 5 "../src/ui/playbar.vala" + _tmp0_ = self->priv->_playbin; +#line 5 "../src/ui/playbar.vala" + result = _tmp0_; +#line 5 "../src/ui/playbar.vala" + return result; +#line 823 "playbar.c" +} + +void +ui_playbar_set_playbin (UiPlaybar* self, + Playbin* value) +{ + Playbin* old_value; +#line 5 "../src/ui/playbar.vala" + g_return_if_fail (self != NULL); +#line 5 "../src/ui/playbar.vala" + old_value = ui_playbar_get_playbin (self); +#line 5 "../src/ui/playbar.vala" + if (old_value != value) { +#line 5 "../src/ui/playbar.vala" + self->priv->_playbin = value; +#line 5 "../src/ui/playbar.vala" + g_object_notify_by_pspec ((GObject *) self, ui_playbar_properties[UI_PLAYBAR_PLAYBIN_PROPERTY]); +#line 841 "playbar.c" + } +} + +gboolean +ui_playbar_get_show_cover_art (UiPlaybar* self) +{ + gboolean result; +#line 6 "../src/ui/playbar.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 6 "../src/ui/playbar.vala" + result = self->priv->_show_cover_art; +#line 6 "../src/ui/playbar.vala" + return result; +#line 855 "playbar.c" +} + +void +ui_playbar_set_show_cover_art (UiPlaybar* self, + gboolean value) +{ + gboolean old_value; +#line 6 "../src/ui/playbar.vala" + g_return_if_fail (self != NULL); +#line 6 "../src/ui/playbar.vala" + old_value = ui_playbar_get_show_cover_art (self); +#line 6 "../src/ui/playbar.vala" + if (old_value != value) { +#line 6 "../src/ui/playbar.vala" + self->priv->_show_cover_art = value; +#line 6 "../src/ui/playbar.vala" + g_object_notify_by_pspec ((GObject *) self, ui_playbar_properties[UI_PLAYBAR_SHOW_COVER_ART_PROPERTY]); +#line 873 "playbar.c" + } +} + +gint +ui_playbar_get_volume (UiPlaybar* self) +{ + gint result; + gint _tmp0_ = 0; + Playbin* _tmp1_; +#line 9 "../src/ui/playbar.vala" + g_return_val_if_fail (self != NULL, 0); +#line 9 "../src/ui/playbar.vala" + _tmp1_ = self->priv->_playbin; +#line 9 "../src/ui/playbar.vala" + if (_tmp1_ == NULL) { +#line 9 "../src/ui/playbar.vala" + _tmp0_ = 100; +#line 891 "playbar.c" + } else { + Playbin* _tmp2_; + gint _tmp3_; + gint _tmp4_; +#line 9 "../src/ui/playbar.vala" + _tmp2_ = self->priv->_playbin; +#line 9 "../src/ui/playbar.vala" + _tmp3_ = playbin_get_volume (_tmp2_); +#line 9 "../src/ui/playbar.vala" + _tmp4_ = _tmp3_; +#line 9 "../src/ui/playbar.vala" + _tmp0_ = _tmp4_; +#line 904 "playbar.c" + } +#line 9 "../src/ui/playbar.vala" + result = _tmp0_; +#line 9 "../src/ui/playbar.vala" + return result; +#line 910 "playbar.c" +} + +void +ui_playbar_set_volume (UiPlaybar* self, + gint value) +{ + Playbin* _tmp0_; +#line 10 "../src/ui/playbar.vala" + g_return_if_fail (self != NULL); +#line 10 "../src/ui/playbar.vala" + _tmp0_ = self->priv->_playbin; +#line 10 "../src/ui/playbar.vala" + playbin_set_volume (_tmp0_, value); +#line 10 "../src/ui/playbar.vala" + g_object_notify_by_pspec ((GObject *) self, ui_playbar_properties[UI_PLAYBAR_VOLUME_PROPERTY]); +#line 926 "playbar.c" +} + +static void +ui_playbar_class_init (UiPlaybarClass * klass, + gpointer klass_data) +{ +#line 2 "../src/ui/playbar.vala" + ui_playbar_parent_class = g_type_class_peek_parent (klass); +#line 2 "../src/ui/playbar.vala" + g_type_class_adjust_private_offset (klass, &UiPlaybar_private_offset); +#line 2 "../src/ui/playbar.vala" + G_OBJECT_CLASS (klass)->get_property = _vala_ui_playbar_get_property; +#line 2 "../src/ui/playbar.vala" + G_OBJECT_CLASS (klass)->set_property = _vala_ui_playbar_set_property; +#line 2 "../src/ui/playbar.vala" + G_OBJECT_CLASS (klass)->finalize = ui_playbar_finalize; +#line 2 "../src/ui/playbar.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_PLAYBAR_SONG_PROPERTY, ui_playbar_properties[UI_PLAYBAR_SONG_PROPERTY] = g_param_spec_object ("song", "song", "song", TYPE_PLAYBIN_SONG, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 2 "../src/ui/playbar.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_PLAYBAR_PLAYING_COVER_ART_PROPERTY, ui_playbar_properties[UI_PLAYBAR_PLAYING_COVER_ART_PROPERTY] = g_param_spec_object ("playing-cover-art", "playing-cover-art", "playing-cover-art", gdk_paintable_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 2 "../src/ui/playbar.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_PLAYBAR_PLAYBIN_PROPERTY, ui_playbar_properties[UI_PLAYBAR_PLAYBIN_PROPERTY] = g_param_spec_object ("playbin", "playbin", "playbin", TYPE_PLAYBIN, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 2 "../src/ui/playbar.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_PLAYBAR_SHOW_COVER_ART_PROPERTY, ui_playbar_properties[UI_PLAYBAR_SHOW_COVER_ART_PROPERTY] = g_param_spec_boolean ("show-cover-art", "show-cover-art", "show-cover-art", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 2 "../src/ui/playbar.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_PLAYBAR_VOLUME_PROPERTY, ui_playbar_properties[UI_PLAYBAR_VOLUME_PROPERTY] = g_param_spec_int ("volume", "volume", "volume", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/eu/callcc/audrey/ui/playbar.ui"); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "format_timestamp", G_CALLBACK(ui_playbar_format_timestamp)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_play_position_seek", G_CALLBACK(_ui_playbar_on_play_position_seek_gtk_range_change_value)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_play_pause_clicked", G_CALLBACK(_ui_playbar_on_play_pause_clicked_gtk_button_clicked)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "play_pause_icon_name", G_CALLBACK(ui_playbar_play_pause_icon_name)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "playbin_active", G_CALLBACK(ui_playbar_playbin_active)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "can_press_play", G_CALLBACK(ui_playbar_can_press_play)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "mute_button_icon_name", G_CALLBACK(ui_playbar_mute_button_icon_name)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_mute_toggle", G_CALLBACK(_ui_playbar_on_mute_toggle_gtk_button_clicked)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_skip_forward_clicked", G_CALLBACK(_ui_playbar_on_skip_forward_clicked_gtk_button_clicked)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_skip_backward_clicked", G_CALLBACK(_ui_playbar_on_skip_backward_clicked_gtk_button_clicked)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "seek_backward", G_CALLBACK(_ui_playbar_seek_backward_gtk_button_clicked)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "seek_forward", G_CALLBACK(_ui_playbar_seek_forward_gtk_button_clicked)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "song_title", G_CALLBACK(ui_playbar_song_title)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "song_artist", G_CALLBACK(ui_playbar_song_artist)); +#line 2 "../src/ui/playbar.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "song_album", G_CALLBACK(ui_playbar_song_album)); +#line 985 "playbar.c" +} + +static void +ui_playbar_instance_init (UiPlaybar * self, + gpointer klass) +{ +#line 2 "../src/ui/playbar.vala" + self->priv = ui_playbar_get_instance_private (self); +#line 6 "../src/ui/playbar.vala" + self->priv->_show_cover_art = TRUE; +#line 2 "../src/ui/playbar.vala" + gtk_widget_init_template (GTK_WIDGET (self)); +#line 998 "playbar.c" +} + +static void +ui_playbar_finalize (GObject * obj) +{ + UiPlaybar * self; +#line 2 "../src/ui/playbar.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, UI_TYPE_PLAYBAR, UiPlaybar); +#line 91 "../src/ui/playbar.vala" + g_debug ("playbar.vala:91: destroying playbar widget"); +#line 3 "../src/ui/playbar.vala" + _g_object_unref0 (self->priv->_song); +#line 4 "../src/ui/playbar.vala" + _g_object_unref0 (self->priv->_playing_cover_art); +#line 2 "../src/ui/playbar.vala" + G_OBJECT_CLASS (ui_playbar_parent_class)->finalize (obj); +#line 1015 "playbar.c" +} + +static GType +ui_playbar_get_type_once (void) +{ + static const GTypeInfo g_define_type_info = { sizeof (UiPlaybarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ui_playbar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UiPlaybar), 0, (GInstanceInitFunc) ui_playbar_instance_init, NULL }; + GType ui_playbar_type_id; + ui_playbar_type_id = g_type_register_static (adw_bin_get_type (), "UiPlaybar", &g_define_type_info, 0); + UiPlaybar_private_offset = g_type_add_instance_private (ui_playbar_type_id, sizeof (UiPlaybarPrivate)); + return ui_playbar_type_id; +} + +GType +ui_playbar_get_type (void) +{ + static volatile gsize ui_playbar_type_id__once = 0; + if (g_once_init_enter (&ui_playbar_type_id__once)) { + GType ui_playbar_type_id; + ui_playbar_type_id = ui_playbar_get_type_once (); + g_once_init_leave (&ui_playbar_type_id__once, ui_playbar_type_id); + } + return ui_playbar_type_id__once; +} + +static void +_vala_ui_playbar_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec) +{ + UiPlaybar * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, UI_TYPE_PLAYBAR, UiPlaybar); +#line 2 "../src/ui/playbar.vala" + switch (property_id) { +#line 2 "../src/ui/playbar.vala" + case UI_PLAYBAR_SONG_PROPERTY: +#line 2 "../src/ui/playbar.vala" + g_value_set_object (value, ui_playbar_get_song (self)); +#line 2 "../src/ui/playbar.vala" + break; +#line 2 "../src/ui/playbar.vala" + case UI_PLAYBAR_PLAYING_COVER_ART_PROPERTY: +#line 2 "../src/ui/playbar.vala" + g_value_set_object (value, ui_playbar_get_playing_cover_art (self)); +#line 2 "../src/ui/playbar.vala" + break; +#line 2 "../src/ui/playbar.vala" + case UI_PLAYBAR_PLAYBIN_PROPERTY: +#line 2 "../src/ui/playbar.vala" + g_value_set_object (value, ui_playbar_get_playbin (self)); +#line 2 "../src/ui/playbar.vala" + break; +#line 2 "../src/ui/playbar.vala" + case UI_PLAYBAR_SHOW_COVER_ART_PROPERTY: +#line 2 "../src/ui/playbar.vala" + g_value_set_boolean (value, ui_playbar_get_show_cover_art (self)); +#line 2 "../src/ui/playbar.vala" + break; +#line 2 "../src/ui/playbar.vala" + case UI_PLAYBAR_VOLUME_PROPERTY: +#line 2 "../src/ui/playbar.vala" + g_value_set_int (value, ui_playbar_get_volume (self)); +#line 2 "../src/ui/playbar.vala" + break; +#line 1080 "playbar.c" + default: +#line 2 "../src/ui/playbar.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 2 "../src/ui/playbar.vala" + break; +#line 1086 "playbar.c" + } +} + +static void +_vala_ui_playbar_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec) +{ + UiPlaybar * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, UI_TYPE_PLAYBAR, UiPlaybar); +#line 2 "../src/ui/playbar.vala" + switch (property_id) { +#line 2 "../src/ui/playbar.vala" + case UI_PLAYBAR_SONG_PROPERTY: +#line 2 "../src/ui/playbar.vala" + ui_playbar_set_song (self, g_value_get_object (value)); +#line 2 "../src/ui/playbar.vala" + break; +#line 2 "../src/ui/playbar.vala" + case UI_PLAYBAR_PLAYING_COVER_ART_PROPERTY: +#line 2 "../src/ui/playbar.vala" + ui_playbar_set_playing_cover_art (self, g_value_get_object (value)); +#line 2 "../src/ui/playbar.vala" + break; +#line 2 "../src/ui/playbar.vala" + case UI_PLAYBAR_PLAYBIN_PROPERTY: +#line 2 "../src/ui/playbar.vala" + ui_playbar_set_playbin (self, g_value_get_object (value)); +#line 2 "../src/ui/playbar.vala" + break; +#line 2 "../src/ui/playbar.vala" + case UI_PLAYBAR_SHOW_COVER_ART_PROPERTY: +#line 2 "../src/ui/playbar.vala" + ui_playbar_set_show_cover_art (self, g_value_get_boolean (value)); +#line 2 "../src/ui/playbar.vala" + break; +#line 2 "../src/ui/playbar.vala" + case UI_PLAYBAR_VOLUME_PROPERTY: +#line 2 "../src/ui/playbar.vala" + ui_playbar_set_volume (self, g_value_get_int (value)); +#line 2 "../src/ui/playbar.vala" + break; +#line 1130 "playbar.c" + default: +#line 2 "../src/ui/playbar.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 2 "../src/ui/playbar.vala" + break; +#line 1136 "playbar.c" + } +} + diff --git a/src/ui/playbar.vala b/src/ui/playbar.vala deleted file mode 100644 index 411fc41..0000000 --- a/src/ui/playbar.vala +++ /dev/null @@ -1,93 +0,0 @@ -[GtkTemplate (ui = "/eu/callcc/audrey/ui/playbar.ui")] -class Ui.Playbar : Adw.Bin { - public PlaybinSong? song { get; set; } - public Gdk.Paintable? playing_cover_art { get; set; } - public weak Playbin playbin { get; set; } - public bool show_cover_art { get; set; default = true; } - - public int volume { - get { return playbin == null ? 100 : playbin.volume; } - set { playbin.volume = value; } - } - - [GtkCallback] private string format_timestamp (double s) { - return "%02d:%02d".printf (((int) s)/60, ((int) s)%60); - } - - [GtkCallback] private bool on_play_position_seek (Gtk.Range range, Gtk.ScrollType scroll_type, double value) { - if (range.adjustment.lower < range.adjustment.upper) { - this.playbin.seek ((int64) value); - } - return false; - } - - [GtkCallback] private void on_play_pause_clicked () { - if (this.playbin.state == PlaybinState.PLAYING) { - this.playbin.pause(); - } else { - this.playbin.play(); - } - } - - [GtkCallback] private string play_pause_icon_name (PlaybinState state) { - if (state == PlaybinState.PLAYING) { - return "media-playback-pause"; - } else { - return "media-playback-start"; - } - } - - [GtkCallback] private bool playbin_active (PlaybinState state) { - return state != PlaybinState.STOPPED; - } - - [GtkCallback] private bool can_press_play (PlaybinState state, uint n_items) { - return !(state == PlaybinState.STOPPED && n_items == 0); - } - - [GtkCallback] private string mute_button_icon_name (bool mute) { - return mute ? "audio-volume-muted" : "audio-volume-high"; - } - - [GtkCallback] private void on_mute_toggle () { - this.playbin.mute = !this.playbin.mute; - } - - [GtkCallback] private void on_skip_forward_clicked () { - this.playbin.go_to_next_track (); - } - - [GtkCallback] private void on_skip_backward_clicked () { - this.playbin.go_to_prev_track (); - } - - [GtkCallback] private void seek_backward () { - // 10 seconds - double new_position = playbin.position - 10.0; - if (new_position < 0.0) new_position = 0.0; - this.playbin.seek (new_position); - } - - [GtkCallback] private void seek_forward () { - // 10 seconds - double new_position = playbin.position + 10.0; - if (new_position > this.playbin.duration) new_position = this.playbin.duration; - this.playbin.seek (new_position); - } - - [GtkCallback] private string song_title (PlaybinSong? song) { - return song == null ? "" : song.title; - } - - [GtkCallback] private string song_artist (PlaybinSong? song) { - return song == null ? "" : song.artist; - } - - [GtkCallback] private string song_album (PlaybinSong? song) { - return song == null ? "" : song.album; - } - - ~Playbar () { - debug ("destroying playbar widget"); - } -} diff --git a/src/ui/setup.c b/src/ui/setup.c new file mode 100644 index 0000000..20565e5 --- /dev/null +++ b/src/ui/setup.c @@ -0,0 +1,1478 @@ +/* setup.c generated by valac 0.56.16, the Vala compiler + * generated from setup.vala, do not modify */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 _g_free0(var) (var = (g_free (var), NULL)) +#define _g_checksum_free0(var) ((var == NULL) ? NULL : (var = (g_checksum_free (var), NULL))) + +#define UI_TYPE_SETUP (ui_setup_get_type ()) +#define UI_SETUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UI_TYPE_SETUP, UiSetup)) +#define UI_SETUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UI_TYPE_SETUP, UiSetupClass)) +#define UI_IS_SETUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UI_TYPE_SETUP)) +#define UI_IS_SETUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UI_TYPE_SETUP)) +#define UI_SETUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UI_TYPE_SETUP, UiSetupClass)) + +typedef struct _UiSetup UiSetup; +typedef struct _UiSetupClass UiSetupClass; +typedef struct _UiSetupPrivate UiSetupPrivate; +enum { + UI_SETUP_0_PROPERTY, + UI_SETUP_STATUS_PROPERTY, + UI_SETUP_AUTHN_CAN_EDIT_PROPERTY, + UI_SETUP_AUTHN_CAN_VALIDATE_PROPERTY, + UI_SETUP_SERVER_URL_PROPERTY, + UI_SETUP_USERNAME_PROPERTY, + UI_SETUP_PASSWORD_PROPERTY, + UI_SETUP_NUM_PROPERTIES +}; +static GParamSpec* ui_setup_properties[UI_SETUP_NUM_PROPERTIES]; + +#define SUBSONIC_TYPE_CLIENT (subsonic_client_get_type ()) +#define SUBSONIC_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SUBSONIC_TYPE_CLIENT, SubsonicClient)) +#define SUBSONIC_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SUBSONIC_TYPE_CLIENT, SubsonicClientClass)) +#define SUBSONIC_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUBSONIC_TYPE_CLIENT)) +#define SUBSONIC_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SUBSONIC_TYPE_CLIENT)) +#define SUBSONIC_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SUBSONIC_TYPE_CLIENT, SubsonicClientClass)) + +typedef struct _SubsonicClient SubsonicClient; +typedef struct _SubsonicClientClass SubsonicClientClass; +typedef struct _Block4Data Block4Data; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) +typedef struct _Block5Data Block5Data; +#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) +#define _secret_value_unref0(var) ((var == NULL) ? NULL : (var = (secret_value_unref (var), NULL))) +enum { + UI_SETUP_CONNECTED_SIGNAL, + UI_SETUP_NUM_SIGNALS +}; +static guint ui_setup_signals[UI_SETUP_NUM_SIGNALS] = {0}; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _UiSetup { + AdwPreferencesDialog parent_instance; + UiSetupPrivate * priv; + gchar* token; + gchar* salt; +}; + +struct _UiSetupClass { + AdwPreferencesDialogClass parent_class; +}; + +struct _UiSetupPrivate { + gchar* _status; + gboolean _authn_can_edit; + gboolean _authn_can_validate; + gchar* _server_url; + gchar* _username; + gchar* _password; +}; + +struct _Block4Data { + int _ref_count_; + UiSetup* self; + gchar* new_token; + gchar* new_salt; + SubsonicClient* api; +}; + +struct _Block5Data { + int _ref_count_; + UiSetup* self; + SecretRetrievable* first; +}; + +static gint UiSetup_private_offset; +static gpointer ui_setup_parent_class = NULL; +static SecretSchema* ui_setup_secret_schema; +static SecretSchema* ui_setup_secret_schema = NULL; + +VALA_EXTERN void salt_password (const gchar* password, + gchar** token, + gchar** salt); +VALA_EXTERN GType ui_setup_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (UiSetup, g_object_unref) +static void ui_setup_on_authn_changed (UiSetup* self); +static void ui_setup_set_authn_can_validate (UiSetup* self, + gboolean value); +static void _ui_setup_on_authn_changed_gtk_editable_changed (GtkEditable* _sender, + gpointer self); +static void ui_setup_on_authn_validate_activated (UiSetup* self); +VALA_EXTERN GType subsonic_client_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (SubsonicClient, g_object_unref) +static Block4Data* block4_data_ref (Block4Data* _data4_); +static void block4_data_unref (void * _userdata_); +static void ui_setup_set_authn_can_edit (UiSetup* self, + gboolean value); +static void ui_setup_set_status (UiSetup* self, + const gchar* value); +VALA_EXTERN const gchar* ui_setup_get_password (UiSetup* self); +VALA_EXTERN const gchar* ui_setup_get_server_url (UiSetup* self); +VALA_EXTERN const gchar* ui_setup_get_username (UiSetup* self); +VALA_EXTERN SubsonicClient* subsonic_client_new_with_token (const gchar* url, + const gchar* username, + const gchar* token, + const gchar* salt); +VALA_EXTERN SubsonicClient* subsonic_client_construct_with_token (GType object_type, + const gchar* url, + const gchar* username, + const gchar* token, + const gchar* salt); +VALA_EXTERN void subsonic_client_ping (SubsonicClient* self, + GAsyncReadyCallback _callback_, + gpointer _user_data_); +VALA_EXTERN void subsonic_client_ping_finish (SubsonicClient* self, + GAsyncResult* _res_, + GError** error); +static void __lambda8_ (Block4Data* _data4_, + GObject* obj, + GAsyncResult* res); +VALA_EXTERN void ui_setup_save (UiSetup* self); +static void ___lambda8__gasync_ready_callback (GObject* source_object, + GAsyncResult* res, + gpointer self); +static void _ui_setup_on_authn_validate_activated_adw_button_row_activated (AdwButtonRow* _sender, + gpointer self); +VALA_EXTERN void ui_setup_load (UiSetup* self); +static void _g_free0_ (gpointer var); +static void __lambda10_ (UiSetup* self, + GObject* obj, + GAsyncResult* res); +VALA_EXTERN void ui_setup_set_server_url (UiSetup* self, + const gchar* value); +VALA_EXTERN void ui_setup_set_username (UiSetup* self, + const gchar* value); +VALA_EXTERN void ui_setup_set_password (UiSetup* self, + const gchar* value); +static Block5Data* block5_data_ref (Block5Data* _data5_); +static void block5_data_unref (void * _userdata_); +static void ____lambda11_ (Block5Data* _data5_, + GObject* obj, + GAsyncResult* res); +static void _____lambda11__gasync_ready_callback (GObject* source_object, + GAsyncResult* res, + gpointer self); +static void _g_object_unref0_ (gpointer var); +static inline void _g_list_free__g_object_unref0_ (GList* self); +static void ___lambda10__gasync_ready_callback (GObject* source_object, + GAsyncResult* res, + gpointer self); +static void __lambda9_ (UiSetup* self, + GObject* obj, + GAsyncResult* res); +static void ___lambda9__gasync_ready_callback (GObject* source_object, + GAsyncResult* res, + gpointer self); +VALA_EXTERN UiSetup* ui_setup_new (void); +VALA_EXTERN UiSetup* ui_setup_construct (GType object_type); +VALA_EXTERN const gchar* ui_setup_get_status (UiSetup* self); +VALA_EXTERN gboolean ui_setup_get_authn_can_edit (UiSetup* self); +VALA_EXTERN gboolean ui_setup_get_authn_can_validate (UiSetup* self); +static void ui_setup_finalize (GObject * obj); +static GType ui_setup_get_type_once (void); +static void _vala_ui_setup_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec); +static void _vala_ui_setup_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec); + +static gchar +string_get (const gchar* self, + glong index) +{ + gchar _tmp0_; + gchar result; +#line 1248 "glib-2.0.vapi" + g_return_val_if_fail (self != NULL, '\0'); +#line 1249 "glib-2.0.vapi" + _tmp0_ = ((gchar*) self)[index]; +#line 1249 "glib-2.0.vapi" + result = _tmp0_; +#line 1249 "glib-2.0.vapi" + return result; +#line 229 "setup.c" +} + +void +salt_password (const gchar* password, + gchar** token, + gchar** salt) +{ + gchar* _vala_token = NULL; + gchar* _vala_salt = NULL; +#line 2 "../src/ui/setup.vala" + static const gint SALT_BYTES = 8; +#line 241 "setup.c" + guchar salt_bytes[SALT_BYTES]; + guchar salt_chars[(2 * SALT_BYTES) + 1]; + GChecksum* checksum = NULL; + GChecksum* _tmp3_; + const gchar* _tmp4_; + gchar* _tmp5_; + gchar* _tmp6_; +#line 1 "../src/ui/setup.vala" + g_return_if_fail (password != NULL); +#line 3 "../src/ui/setup.vala" + memset (salt_bytes, 0, SALT_BYTES * sizeof (guchar)); +#line 4 "../src/ui/setup.vala" + gcry_randomize (salt_bytes, (gint) SALT_BYTES, GCRY_STRONG_RANDOM); +#line 5 "../src/ui/setup.vala" + memset (salt_chars, 0, ((2 * SALT_BYTES) + 1) * sizeof (guchar)); +#line 257 "setup.c" + { + gint i = 0; +#line 6 "../src/ui/setup.vala" + i = 0; +#line 262 "setup.c" + { + gboolean _tmp0_ = FALSE; +#line 6 "../src/ui/setup.vala" + _tmp0_ = TRUE; +#line 6 "../src/ui/setup.vala" + while (TRUE) { +#line 269 "setup.c" + guchar _tmp1_; + guchar _tmp2_; +#line 6 "../src/ui/setup.vala" + if (!_tmp0_) { +#line 6 "../src/ui/setup.vala" + i += 1; +#line 276 "setup.c" + } +#line 6 "../src/ui/setup.vala" + _tmp0_ = FALSE; +#line 6 "../src/ui/setup.vala" + if (!(i < SALT_BYTES)) { +#line 6 "../src/ui/setup.vala" + break; +#line 284 "setup.c" + } +#line 7 "../src/ui/setup.vala" + _tmp1_ = salt_bytes[i]; +#line 7 "../src/ui/setup.vala" + salt_chars[(2 * i) + 0] = (guchar) string_get ("0123456789abcdef", (glong) ((_tmp1_ >> 4) & 0xf)); +#line 8 "../src/ui/setup.vala" + _tmp2_ = salt_bytes[i]; +#line 8 "../src/ui/setup.vala" + salt_chars[(2 * i) + 1] = (guchar) string_get ("0123456789abcdef", (glong) ((_tmp2_ >> 0) & 0xf)); +#line 294 "setup.c" + } + } + } +#line 10 "../src/ui/setup.vala" + salt_chars[2 * SALT_BYTES] = (guchar) 0; +#line 11 "../src/ui/setup.vala" + _tmp3_ = g_checksum_new (G_CHECKSUM_MD5); +#line 11 "../src/ui/setup.vala" + checksum = _tmp3_; +#line 12 "../src/ui/setup.vala" + g_checksum_update (checksum, (guchar*) password, (gsize) -1); +#line 13 "../src/ui/setup.vala" + g_checksum_update (checksum, salt_chars, (gsize) -1); +#line 15 "../src/ui/setup.vala" + _tmp4_ = g_checksum_get_string (checksum); +#line 15 "../src/ui/setup.vala" + _tmp5_ = g_strdup (_tmp4_); +#line 15 "../src/ui/setup.vala" + _g_free0 (_vala_token); +#line 15 "../src/ui/setup.vala" + _vala_token = _tmp5_; +#line 16 "../src/ui/setup.vala" + _tmp6_ = g_strdup ((const gchar*) salt_chars); +#line 16 "../src/ui/setup.vala" + _g_free0 (_vala_salt); +#line 16 "../src/ui/setup.vala" + _vala_salt = _tmp6_; +#line 1 "../src/ui/setup.vala" + _g_checksum_free0 (checksum); +#line 1 "../src/ui/setup.vala" + if (token) { +#line 1 "../src/ui/setup.vala" + *token = _vala_token; +#line 328 "setup.c" + } else { +#line 1 "../src/ui/setup.vala" + _g_free0 (_vala_token); +#line 332 "setup.c" + } +#line 1 "../src/ui/setup.vala" + if (salt) { +#line 1 "../src/ui/setup.vala" + *salt = _vala_salt; +#line 338 "setup.c" + } else { +#line 1 "../src/ui/setup.vala" + _g_free0 (_vala_salt); +#line 342 "setup.c" + } +} + +static inline gpointer +ui_setup_get_instance_private (UiSetup* self) +{ + return G_STRUCT_MEMBER_P (self, UiSetup_private_offset); +} + +static void +ui_setup_on_authn_changed (UiSetup* self) +{ +#line 41 "../src/ui/setup.vala" + g_return_if_fail (self != NULL); +#line 42 "../src/ui/setup.vala" + ui_setup_set_authn_can_validate (self, TRUE); +#line 359 "setup.c" +} + +static void +_ui_setup_on_authn_changed_gtk_editable_changed (GtkEditable* _sender, + gpointer self) +{ +#line 20 "../src/ui/setup.vala" + ui_setup_on_authn_changed ((UiSetup*) self); +#line 368 "setup.c" +} + +static Block4Data* +block4_data_ref (Block4Data* _data4_) +{ +#line 45 "../src/ui/setup.vala" + g_atomic_int_inc (&_data4_->_ref_count_); +#line 45 "../src/ui/setup.vala" + return _data4_; +#line 378 "setup.c" +} + +static void +block4_data_unref (void * _userdata_) +{ + Block4Data* _data4_; + _data4_ = (Block4Data*) _userdata_; +#line 45 "../src/ui/setup.vala" + if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) { +#line 388 "setup.c" + UiSetup* self; +#line 45 "../src/ui/setup.vala" + self = _data4_->self; +#line 45 "../src/ui/setup.vala" + _g_object_unref0 (_data4_->api); +#line 45 "../src/ui/setup.vala" + _g_free0 (_data4_->new_salt); +#line 45 "../src/ui/setup.vala" + _g_free0 (_data4_->new_token); +#line 45 "../src/ui/setup.vala" + _g_object_unref0 (self); +#line 45 "../src/ui/setup.vala" + g_slice_free (Block4Data, _data4_); +#line 402 "setup.c" + } +} + +static const gchar* +string_to_string (const gchar* self) +{ + const gchar* result; +#line 1589 "glib-2.0.vapi" + g_return_val_if_fail (self != NULL, NULL); +#line 1590 "glib-2.0.vapi" + result = self; +#line 1590 "glib-2.0.vapi" + return result; +#line 416 "setup.c" +} + +static void +__lambda8_ (Block4Data* _data4_, + GObject* obj, + GAsyncResult* res) +{ + UiSetup* self; + GError* _inner_error0_ = NULL; +#line 58 "../src/ui/setup.vala" + self = _data4_->self; +#line 58 "../src/ui/setup.vala" + g_return_if_fail (res != NULL); +#line 430 "setup.c" + { + gchar* _tmp0_; + gchar* _tmp1_; +#line 60 "../src/ui/setup.vala" + subsonic_client_ping_finish (_data4_->api, res, &_inner_error0_); +#line 60 "../src/ui/setup.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 438 "setup.c" + goto __catch0_g_error; + } +#line 61 "../src/ui/setup.vala" + ui_setup_set_status (self, _ ("Connected")); +#line 62 "../src/ui/setup.vala" + _tmp0_ = g_strdup (_data4_->new_token); +#line 62 "../src/ui/setup.vala" + _g_free0 (self->token); +#line 62 "../src/ui/setup.vala" + self->token = _tmp0_; +#line 63 "../src/ui/setup.vala" + _tmp1_ = g_strdup (_data4_->new_salt); +#line 63 "../src/ui/setup.vala" + _g_free0 (self->salt); +#line 63 "../src/ui/setup.vala" + self->salt = _tmp1_; +#line 64 "../src/ui/setup.vala" + ui_setup_save (self); +#line 66 "../src/ui/setup.vala" + g_signal_emit (self, ui_setup_signals[UI_SETUP_CONNECTED_SIGNAL], 0, _data4_->api); +#line 459 "setup.c" + } + goto __finally0; + __catch0_g_error: + { + GError* e = NULL; + const gchar* _tmp2_; + GError* _tmp3_; + const gchar* _tmp4_; + const gchar* _tmp5_; + gchar* _tmp6_; + gchar* _tmp7_; +#line 59 "../src/ui/setup.vala" + e = _inner_error0_; +#line 59 "../src/ui/setup.vala" + _inner_error0_ = NULL; +#line 68 "../src/ui/setup.vala" + _tmp2_ = string_to_string (_ ("Ping failed")); +#line 68 "../src/ui/setup.vala" + _tmp3_ = e; +#line 68 "../src/ui/setup.vala" + _tmp4_ = _tmp3_->message; +#line 68 "../src/ui/setup.vala" + _tmp5_ = string_to_string (_tmp4_); +#line 68 "../src/ui/setup.vala" + _tmp6_ = g_strconcat (_tmp2_, ": ", _tmp5_, NULL); +#line 68 "../src/ui/setup.vala" + _tmp7_ = _tmp6_; +#line 68 "../src/ui/setup.vala" + ui_setup_set_status (self, _tmp7_); +#line 68 "../src/ui/setup.vala" + _g_free0 (_tmp7_); +#line 69 "../src/ui/setup.vala" + ui_setup_set_authn_can_validate (self, TRUE); +#line 59 "../src/ui/setup.vala" + _g_error_free0 (e); +#line 495 "setup.c" + } + __finally0: +#line 59 "../src/ui/setup.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 59 "../src/ui/setup.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); +#line 59 "../src/ui/setup.vala" + g_clear_error (&_inner_error0_); +#line 59 "../src/ui/setup.vala" + return; +#line 506 "setup.c" + } +#line 72 "../src/ui/setup.vala" + ui_setup_set_authn_can_edit (self, TRUE); +#line 510 "setup.c" +} + +static void +___lambda8__gasync_ready_callback (GObject* source_object, + GAsyncResult* res, + gpointer self) +{ +#line 58 "../src/ui/setup.vala" + __lambda8_ (self, source_object, res); +#line 58 "../src/ui/setup.vala" + block4_data_unref (self); +#line 522 "setup.c" +} + +static void +ui_setup_on_authn_validate_activated (UiSetup* self) +{ + Block4Data* _data4_; + const gchar* _tmp0_; + gchar* _tmp1_ = NULL; + gchar* _tmp2_ = NULL; + const gchar* _tmp3_; + const gchar* _tmp4_; + SubsonicClient* _tmp5_; +#line 45 "../src/ui/setup.vala" + g_return_if_fail (self != NULL); +#line 45 "../src/ui/setup.vala" + _data4_ = g_slice_new0 (Block4Data); +#line 45 "../src/ui/setup.vala" + _data4_->_ref_count_ = 1; +#line 45 "../src/ui/setup.vala" + _data4_->self = g_object_ref (self); +#line 46 "../src/ui/setup.vala" + ui_setup_set_authn_can_validate (self, FALSE); +#line 47 "../src/ui/setup.vala" + ui_setup_set_authn_can_edit (self, FALSE); +#line 48 "../src/ui/setup.vala" + ui_setup_set_status (self, _ ("Connecting...")); +#line 51 "../src/ui/setup.vala" + _tmp0_ = self->priv->_password; +#line 51 "../src/ui/setup.vala" + salt_password (_tmp0_, &_tmp1_, &_tmp2_); +#line 51 "../src/ui/setup.vala" + _g_free0 (_data4_->new_token); +#line 51 "../src/ui/setup.vala" + _data4_->new_token = _tmp1_; +#line 51 "../src/ui/setup.vala" + _g_free0 (_data4_->new_salt); +#line 51 "../src/ui/setup.vala" + _data4_->new_salt = _tmp2_; +#line 52 "../src/ui/setup.vala" + _tmp3_ = self->priv->_server_url; +#line 52 "../src/ui/setup.vala" + _tmp4_ = self->priv->_username; +#line 52 "../src/ui/setup.vala" + _tmp5_ = subsonic_client_new_with_token (_tmp3_, _tmp4_, _data4_->new_token, _data4_->new_salt); +#line 52 "../src/ui/setup.vala" + _data4_->api = _tmp5_; +#line 58 "../src/ui/setup.vala" + subsonic_client_ping (_data4_->api, ___lambda8__gasync_ready_callback, block4_data_ref (_data4_)); +#line 45 "../src/ui/setup.vala" + block4_data_unref (_data4_); +#line 45 "../src/ui/setup.vala" + _data4_ = NULL; +#line 575 "setup.c" +} + +static void +_ui_setup_on_authn_validate_activated_adw_button_row_activated (AdwButtonRow* _sender, + gpointer self) +{ +#line 20 "../src/ui/setup.vala" + ui_setup_on_authn_validate_activated ((UiSetup*) self); +#line 584 "setup.c" +} + +static void +_g_free0_ (gpointer var) +{ +#line 78 "../src/ui/setup.vala" + var = (g_free (var), NULL); +#line 592 "setup.c" +} + +static Block5Data* +block5_data_ref (Block5Data* _data5_) +{ +#line 86 "../src/ui/setup.vala" + g_atomic_int_inc (&_data5_->_ref_count_); +#line 86 "../src/ui/setup.vala" + return _data5_; +#line 602 "setup.c" +} + +static void +block5_data_unref (void * _userdata_) +{ + Block5Data* _data5_; + _data5_ = (Block5Data*) _userdata_; +#line 86 "../src/ui/setup.vala" + if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) { +#line 612 "setup.c" + UiSetup* self; +#line 86 "../src/ui/setup.vala" + self = _data5_->self; +#line 86 "../src/ui/setup.vala" + _g_object_unref0 (_data5_->first); +#line 86 "../src/ui/setup.vala" + _g_object_unref0 (self); +#line 86 "../src/ui/setup.vala" + g_slice_free (Block5Data, _data5_); +#line 622 "setup.c" + } +} + +static gpointer +_g_object_ref0 (gpointer self) +{ +#line 95 "../src/ui/setup.vala" + return self ? g_object_ref (self) : NULL; +#line 631 "setup.c" +} + +static void +____lambda11_ (Block5Data* _data5_, + GObject* obj, + GAsyncResult* res) +{ + UiSetup* self; + GError* _inner_error0_ = NULL; +#line 101 "../src/ui/setup.vala" + self = _data5_->self; +#line 101 "../src/ui/setup.vala" + g_return_if_fail (res != NULL); +#line 645 "setup.c" + { + SecretValue* value = NULL; + SecretRetrievable* _tmp0_; + SecretValue* _tmp1_; + const gchar* _tmp2_ = NULL; + const gchar* _tmp3_; +#line 103 "../src/ui/setup.vala" + _tmp0_ = _data5_->first; +#line 103 "../src/ui/setup.vala" + _tmp1_ = secret_retrievable_retrieve_secret_finish (_tmp0_, res, &_inner_error0_); +#line 103 "../src/ui/setup.vala" + value = _tmp1_; +#line 103 "../src/ui/setup.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 660 "setup.c" + goto __catch0_g_error; + } +#line 104 "../src/ui/setup.vala" + _tmp3_ = secret_value_get_text (value); +#line 104 "../src/ui/setup.vala" + _tmp2_ = _tmp3_; +#line 104 "../src/ui/setup.vala" + if (_tmp2_ == NULL) { +#line 104 "../src/ui/setup.vala" + _tmp2_ = ""; +#line 671 "setup.c" + } +#line 104 "../src/ui/setup.vala" + ui_setup_set_password (self, _tmp2_); +#line 102 "../src/ui/setup.vala" + _secret_value_unref0 (value); +#line 677 "setup.c" + } + goto __finally0; + __catch0_g_error: + { + GError* e = NULL; + const gchar* _tmp4_; +#line 102 "../src/ui/setup.vala" + e = _inner_error0_; +#line 102 "../src/ui/setup.vala" + _inner_error0_ = NULL; +#line 106 "../src/ui/setup.vala" + _tmp4_ = e->message; +#line 106 "../src/ui/setup.vala" + g_error ("setup.vala:106: could not retrieve password from credentials: %s", _tmp4_); +#line 102 "../src/ui/setup.vala" + _g_error_free0 (e); +#line 694 "setup.c" + } + __finally0: +#line 102 "../src/ui/setup.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 102 "../src/ui/setup.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); +#line 102 "../src/ui/setup.vala" + g_clear_error (&_inner_error0_); +#line 102 "../src/ui/setup.vala" + return; +#line 705 "setup.c" + } +#line 110 "../src/ui/setup.vala" + ui_setup_set_authn_can_validate (self, TRUE); +#line 111 "../src/ui/setup.vala" + ui_setup_on_authn_validate_activated (self); +#line 711 "setup.c" +} + +static void +_____lambda11__gasync_ready_callback (GObject* source_object, + GAsyncResult* res, + gpointer self) +{ +#line 101 "../src/ui/setup.vala" + ____lambda11_ (self, source_object, res); +#line 101 "../src/ui/setup.vala" + block5_data_unref (self); +#line 723 "setup.c" +} + +static void +_g_object_unref0_ (gpointer var) +{ +#line 84 "../src/ui/setup.vala" + (var == NULL) ? NULL : (var = (g_object_unref (var), NULL)); +#line 731 "setup.c" +} + +static inline void +_g_list_free__g_object_unref0_ (GList* self) +{ +#line 84 "../src/ui/setup.vala" + g_list_free_full (self, (GDestroyNotify) _g_object_unref0_); +#line 739 "setup.c" +} + +static void +__lambda10_ (UiSetup* self, + GObject* obj, + GAsyncResult* res) +{ + GError* _inner_error0_ = NULL; +#line 83 "../src/ui/setup.vala" + g_return_if_fail (res != NULL); +#line 750 "setup.c" + { + GList* list = NULL; + GList* _tmp0_; +#line 85 "../src/ui/setup.vala" + _tmp0_ = secret_password_search_finish (res, &_inner_error0_); +#line 85 "../src/ui/setup.vala" + list = _tmp0_; +#line 85 "../src/ui/setup.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 760 "setup.c" + goto __catch0_g_error; + } +#line 86 "../src/ui/setup.vala" + if (list == NULL) { +#line 88 "../src/ui/setup.vala" + ui_setup_set_server_url (self, ""); +#line 89 "../src/ui/setup.vala" + ui_setup_set_username (self, ""); +#line 90 "../src/ui/setup.vala" + ui_setup_set_password (self, ""); +#line 92 "../src/ui/setup.vala" + ui_setup_set_authn_can_edit (self, TRUE); +#line 93 "../src/ui/setup.vala" + ui_setup_set_authn_can_validate (self, TRUE); +#line 775 "setup.c" + } else { + Block5Data* _data5_; + gconstpointer _tmp1_; + SecretRetrievable* _tmp2_; + SecretRetrievable* _tmp3_; + SecretRetrievable* _tmp4_; + GHashTable* _tmp5_; + GHashTable* _tmp6_; + GHashTable* _tmp7_; + gconstpointer _tmp8_; + SecretRetrievable* _tmp9_; + GHashTable* _tmp10_; + GHashTable* _tmp11_; + GHashTable* _tmp12_; + gconstpointer _tmp13_; + SecretRetrievable* _tmp14_; +#line 86 "../src/ui/setup.vala" + _data5_ = g_slice_new0 (Block5Data); +#line 86 "../src/ui/setup.vala" + _data5_->_ref_count_ = 1; +#line 86 "../src/ui/setup.vala" + _data5_->self = g_object_ref (self); +#line 95 "../src/ui/setup.vala" + _tmp1_ = list->data; +#line 95 "../src/ui/setup.vala" + _tmp2_ = _g_object_ref0 ((SecretRetrievable*) _tmp1_); +#line 95 "../src/ui/setup.vala" + _data5_->first = _tmp2_; +#line 96 "../src/ui/setup.vala" + _tmp3_ = _data5_->first; +#line 96 "../src/ui/setup.vala" + _vala_assert (_tmp3_ != NULL, "first != null"); +#line 98 "../src/ui/setup.vala" + _tmp4_ = _data5_->first; +#line 98 "../src/ui/setup.vala" + g_object_get (_tmp4_, "attributes", &_tmp5_, NULL); +#line 98 "../src/ui/setup.vala" + _tmp6_ = _tmp5_; +#line 98 "../src/ui/setup.vala" + _tmp7_ = _tmp6_; +#line 98 "../src/ui/setup.vala" + _tmp8_ = g_hash_table_lookup (_tmp7_, "server-url"); +#line 98 "../src/ui/setup.vala" + ui_setup_set_server_url (self, (const gchar*) _tmp8_); +#line 98 "../src/ui/setup.vala" + _g_hash_table_unref0 (_tmp7_); +#line 99 "../src/ui/setup.vala" + _tmp9_ = _data5_->first; +#line 99 "../src/ui/setup.vala" + g_object_get (_tmp9_, "attributes", &_tmp10_, NULL); +#line 99 "../src/ui/setup.vala" + _tmp11_ = _tmp10_; +#line 99 "../src/ui/setup.vala" + _tmp12_ = _tmp11_; +#line 99 "../src/ui/setup.vala" + _tmp13_ = g_hash_table_lookup (_tmp12_, "username"); +#line 99 "../src/ui/setup.vala" + ui_setup_set_username (self, (const gchar*) _tmp13_); +#line 99 "../src/ui/setup.vala" + _g_hash_table_unref0 (_tmp12_); +#line 101 "../src/ui/setup.vala" + _tmp14_ = _data5_->first; +#line 101 "../src/ui/setup.vala" + secret_retrievable_retrieve_secret (_tmp14_, NULL, _____lambda11__gasync_ready_callback, block5_data_ref (_data5_)); +#line 86 "../src/ui/setup.vala" + block5_data_unref (_data5_); +#line 86 "../src/ui/setup.vala" + _data5_ = NULL; +#line 844 "setup.c" + } +#line 84 "../src/ui/setup.vala" + (list == NULL) ? NULL : (list = (_g_list_free__g_object_unref0_ (list), NULL)); +#line 848 "setup.c" + } + goto __finally0; + __catch0_g_error: + { + GError* e = NULL; + const gchar* _tmp15_; +#line 84 "../src/ui/setup.vala" + e = _inner_error0_; +#line 84 "../src/ui/setup.vala" + _inner_error0_ = NULL; +#line 115 "../src/ui/setup.vala" + _tmp15_ = e->message; +#line 115 "../src/ui/setup.vala" + g_error ("setup.vala:115: could not search for password in keyring: %s", _tmp15_); +#line 84 "../src/ui/setup.vala" + _g_error_free0 (e); +#line 865 "setup.c" + } + __finally0: +#line 84 "../src/ui/setup.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 84 "../src/ui/setup.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); +#line 84 "../src/ui/setup.vala" + g_clear_error (&_inner_error0_); +#line 84 "../src/ui/setup.vala" + return; +#line 876 "setup.c" + } +} + +static void +___lambda10__gasync_ready_callback (GObject* source_object, + GAsyncResult* res, + gpointer self) +{ +#line 78 "../src/ui/setup.vala" + __lambda10_ ((UiSetup*) self, source_object, res); +#line 78 "../src/ui/setup.vala" + g_object_unref (self); +#line 889 "setup.c" +} + +void +ui_setup_load (UiSetup* self) +{ + SecretSchema* _tmp0_; + GHashTable* _tmp1_; +#line 76 "../src/ui/setup.vala" + g_return_if_fail (self != NULL); +#line 77 "../src/ui/setup.vala" + ui_setup_set_authn_can_edit (self, FALSE); +#line 78 "../src/ui/setup.vala" + _tmp0_ = ui_setup_secret_schema; +#line 78 "../src/ui/setup.vala" + _tmp1_ = g_hash_table_new_full (NULL, NULL, _g_free0_, _g_free0_); +#line 78 "../src/ui/setup.vala" + secret_password_searchv (_tmp0_, _tmp1_, SECRET_SEARCH_UNLOCK, NULL, ___lambda10__gasync_ready_callback, g_object_ref (self)); +#line 907 "setup.c" +} + +static void +__lambda9_ (UiSetup* self, + GObject* obj, + GAsyncResult* res) +{ + GError* _inner_error0_ = NULL; +#line 122 "../src/ui/setup.vala" + g_return_if_fail (res != NULL); +#line 918 "setup.c" + { +#line 124 "../src/ui/setup.vala" + secret_password_store_finish (res, &_inner_error0_); +#line 124 "../src/ui/setup.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 924 "setup.c" + goto __catch0_g_error; + } + } + goto __finally0; + __catch0_g_error: + { + GError* e = NULL; + const gchar* _tmp0_; +#line 123 "../src/ui/setup.vala" + e = _inner_error0_; +#line 123 "../src/ui/setup.vala" + _inner_error0_ = NULL; +#line 126 "../src/ui/setup.vala" + _tmp0_ = e->message; +#line 126 "../src/ui/setup.vala" + g_error ("setup.vala:126: could not store password in keyring: %s", _tmp0_); +#line 123 "../src/ui/setup.vala" + _g_error_free0 (e); +#line 943 "setup.c" + } + __finally0: +#line 123 "../src/ui/setup.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 123 "../src/ui/setup.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); +#line 123 "../src/ui/setup.vala" + g_clear_error (&_inner_error0_); +#line 123 "../src/ui/setup.vala" + return; +#line 954 "setup.c" + } +#line 128 "../src/ui/setup.vala" + ui_setup_set_authn_can_edit (self, TRUE); +#line 958 "setup.c" +} + +static void +___lambda9__gasync_ready_callback (GObject* source_object, + GAsyncResult* res, + gpointer self) +{ +#line 122 "../src/ui/setup.vala" + __lambda9_ ((UiSetup*) self, source_object, res); +#line 122 "../src/ui/setup.vala" + g_object_unref (self); +#line 970 "setup.c" +} + +void +ui_setup_save (UiSetup* self) +{ + SecretSchema* _tmp0_; + const gchar* _tmp1_; + const gchar* _tmp2_; + const gchar* _tmp3_; +#line 120 "../src/ui/setup.vala" + g_return_if_fail (self != NULL); +#line 121 "../src/ui/setup.vala" + ui_setup_set_authn_can_edit (self, FALSE); +#line 122 "../src/ui/setup.vala" + _tmp0_ = ui_setup_secret_schema; +#line 122 "../src/ui/setup.vala" + _tmp1_ = self->priv->_password; +#line 122 "../src/ui/setup.vala" + _tmp2_ = self->priv->_server_url; +#line 122 "../src/ui/setup.vala" + _tmp3_ = self->priv->_username; +#line 122 "../src/ui/setup.vala" + secret_password_store (_tmp0_, NULL, "Audrey Subsonic password", _tmp1_, NULL, ___lambda9__gasync_ready_callback, g_object_ref (self), "server-url", _tmp2_, "username", _tmp3_, NULL); +#line 994 "setup.c" +} + +UiSetup* +ui_setup_construct (GType object_type) +{ + UiSetup * self = NULL; +#line 20 "../src/ui/setup.vala" + self = (UiSetup*) g_object_new (object_type, NULL); +#line 20 "../src/ui/setup.vala" + return self; +#line 1005 "setup.c" +} + +UiSetup* +ui_setup_new (void) +{ +#line 20 "../src/ui/setup.vala" + return ui_setup_construct (UI_TYPE_SETUP); +#line 1013 "setup.c" +} + +const gchar* +ui_setup_get_status (UiSetup* self) +{ + const gchar* result; + const gchar* _tmp0_; +#line 21 "../src/ui/setup.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 21 "../src/ui/setup.vala" + _tmp0_ = self->priv->_status; +#line 21 "../src/ui/setup.vala" + result = _tmp0_; +#line 21 "../src/ui/setup.vala" + return result; +#line 1029 "setup.c" +} + +static void +ui_setup_set_status (UiSetup* self, + const gchar* value) +{ + gchar* old_value; +#line 21 "../src/ui/setup.vala" + g_return_if_fail (self != NULL); +#line 21 "../src/ui/setup.vala" + old_value = ui_setup_get_status (self); +#line 21 "../src/ui/setup.vala" + if (g_strcmp0 (value, old_value) != 0) { +#line 1043 "setup.c" + gchar* _tmp0_; +#line 21 "../src/ui/setup.vala" + _tmp0_ = g_strdup (value); +#line 21 "../src/ui/setup.vala" + _g_free0 (self->priv->_status); +#line 21 "../src/ui/setup.vala" + self->priv->_status = _tmp0_; +#line 21 "../src/ui/setup.vala" + g_object_notify_by_pspec ((GObject *) self, ui_setup_properties[UI_SETUP_STATUS_PROPERTY]); +#line 1053 "setup.c" + } +} + +gboolean +ui_setup_get_authn_can_edit (UiSetup* self) +{ + gboolean result; +#line 23 "../src/ui/setup.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 23 "../src/ui/setup.vala" + result = self->priv->_authn_can_edit; +#line 23 "../src/ui/setup.vala" + return result; +#line 1067 "setup.c" +} + +static void +ui_setup_set_authn_can_edit (UiSetup* self, + gboolean value) +{ + gboolean old_value; +#line 23 "../src/ui/setup.vala" + g_return_if_fail (self != NULL); +#line 23 "../src/ui/setup.vala" + old_value = ui_setup_get_authn_can_edit (self); +#line 23 "../src/ui/setup.vala" + if (old_value != value) { +#line 23 "../src/ui/setup.vala" + self->priv->_authn_can_edit = value; +#line 23 "../src/ui/setup.vala" + g_object_notify_by_pspec ((GObject *) self, ui_setup_properties[UI_SETUP_AUTHN_CAN_EDIT_PROPERTY]); +#line 1085 "setup.c" + } +} + +gboolean +ui_setup_get_authn_can_validate (UiSetup* self) +{ + gboolean result; +#line 24 "../src/ui/setup.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 24 "../src/ui/setup.vala" + result = self->priv->_authn_can_validate; +#line 24 "../src/ui/setup.vala" + return result; +#line 1099 "setup.c" +} + +static void +ui_setup_set_authn_can_validate (UiSetup* self, + gboolean value) +{ + gboolean old_value; +#line 24 "../src/ui/setup.vala" + g_return_if_fail (self != NULL); +#line 24 "../src/ui/setup.vala" + old_value = ui_setup_get_authn_can_validate (self); +#line 24 "../src/ui/setup.vala" + if (old_value != value) { +#line 24 "../src/ui/setup.vala" + self->priv->_authn_can_validate = value; +#line 24 "../src/ui/setup.vala" + g_object_notify_by_pspec ((GObject *) self, ui_setup_properties[UI_SETUP_AUTHN_CAN_VALIDATE_PROPERTY]); +#line 1117 "setup.c" + } +} + +const gchar* +ui_setup_get_server_url (UiSetup* self) +{ + const gchar* result; + const gchar* _tmp0_; +#line 26 "../src/ui/setup.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 26 "../src/ui/setup.vala" + _tmp0_ = self->priv->_server_url; +#line 26 "../src/ui/setup.vala" + result = _tmp0_; +#line 26 "../src/ui/setup.vala" + return result; +#line 1134 "setup.c" +} + +void +ui_setup_set_server_url (UiSetup* self, + const gchar* value) +{ + gchar* old_value; +#line 26 "../src/ui/setup.vala" + g_return_if_fail (self != NULL); +#line 26 "../src/ui/setup.vala" + old_value = ui_setup_get_server_url (self); +#line 26 "../src/ui/setup.vala" + if (g_strcmp0 (value, old_value) != 0) { +#line 1148 "setup.c" + gchar* _tmp0_; +#line 26 "../src/ui/setup.vala" + _tmp0_ = g_strdup (value); +#line 26 "../src/ui/setup.vala" + _g_free0 (self->priv->_server_url); +#line 26 "../src/ui/setup.vala" + self->priv->_server_url = _tmp0_; +#line 26 "../src/ui/setup.vala" + g_object_notify_by_pspec ((GObject *) self, ui_setup_properties[UI_SETUP_SERVER_URL_PROPERTY]); +#line 1158 "setup.c" + } +} + +const gchar* +ui_setup_get_username (UiSetup* self) +{ + const gchar* result; + const gchar* _tmp0_; +#line 27 "../src/ui/setup.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 27 "../src/ui/setup.vala" + _tmp0_ = self->priv->_username; +#line 27 "../src/ui/setup.vala" + result = _tmp0_; +#line 27 "../src/ui/setup.vala" + return result; +#line 1175 "setup.c" +} + +void +ui_setup_set_username (UiSetup* self, + const gchar* value) +{ + gchar* old_value; +#line 27 "../src/ui/setup.vala" + g_return_if_fail (self != NULL); +#line 27 "../src/ui/setup.vala" + old_value = ui_setup_get_username (self); +#line 27 "../src/ui/setup.vala" + if (g_strcmp0 (value, old_value) != 0) { +#line 1189 "setup.c" + gchar* _tmp0_; +#line 27 "../src/ui/setup.vala" + _tmp0_ = g_strdup (value); +#line 27 "../src/ui/setup.vala" + _g_free0 (self->priv->_username); +#line 27 "../src/ui/setup.vala" + self->priv->_username = _tmp0_; +#line 27 "../src/ui/setup.vala" + g_object_notify_by_pspec ((GObject *) self, ui_setup_properties[UI_SETUP_USERNAME_PROPERTY]); +#line 1199 "setup.c" + } +} + +const gchar* +ui_setup_get_password (UiSetup* self) +{ + const gchar* result; + const gchar* _tmp0_; +#line 28 "../src/ui/setup.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 28 "../src/ui/setup.vala" + _tmp0_ = self->priv->_password; +#line 28 "../src/ui/setup.vala" + result = _tmp0_; +#line 28 "../src/ui/setup.vala" + return result; +#line 1216 "setup.c" +} + +void +ui_setup_set_password (UiSetup* self, + const gchar* value) +{ + gchar* old_value; +#line 28 "../src/ui/setup.vala" + g_return_if_fail (self != NULL); +#line 28 "../src/ui/setup.vala" + old_value = ui_setup_get_password (self); +#line 28 "../src/ui/setup.vala" + if (g_strcmp0 (value, old_value) != 0) { +#line 1230 "setup.c" + gchar* _tmp0_; +#line 28 "../src/ui/setup.vala" + _tmp0_ = g_strdup (value); +#line 28 "../src/ui/setup.vala" + _g_free0 (self->priv->_password); +#line 28 "../src/ui/setup.vala" + self->priv->_password = _tmp0_; +#line 28 "../src/ui/setup.vala" + g_object_notify_by_pspec ((GObject *) self, ui_setup_properties[UI_SETUP_PASSWORD_PROPERTY]); +#line 1240 "setup.c" + } +} + +static void +ui_setup_class_init (UiSetupClass * klass, + gpointer klass_data) +{ + SecretSchema* _tmp0_; +#line 20 "../src/ui/setup.vala" + ui_setup_parent_class = g_type_class_peek_parent (klass); +#line 20 "../src/ui/setup.vala" + g_type_class_adjust_private_offset (klass, &UiSetup_private_offset); +#line 20 "../src/ui/setup.vala" + G_OBJECT_CLASS (klass)->get_property = _vala_ui_setup_get_property; +#line 20 "../src/ui/setup.vala" + G_OBJECT_CLASS (klass)->set_property = _vala_ui_setup_set_property; +#line 20 "../src/ui/setup.vala" + G_OBJECT_CLASS (klass)->finalize = ui_setup_finalize; +#line 20 "../src/ui/setup.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_SETUP_STATUS_PROPERTY, ui_setup_properties[UI_SETUP_STATUS_PROPERTY] = g_param_spec_string ("status", "status", "status", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 20 "../src/ui/setup.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_SETUP_AUTHN_CAN_EDIT_PROPERTY, ui_setup_properties[UI_SETUP_AUTHN_CAN_EDIT_PROPERTY] = g_param_spec_boolean ("authn-can-edit", "authn-can-edit", "authn-can-edit", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 20 "../src/ui/setup.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_SETUP_AUTHN_CAN_VALIDATE_PROPERTY, ui_setup_properties[UI_SETUP_AUTHN_CAN_VALIDATE_PROPERTY] = g_param_spec_boolean ("authn-can-validate", "authn-can-validate", "authn-can-validate", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 20 "../src/ui/setup.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_SETUP_SERVER_URL_PROPERTY, ui_setup_properties[UI_SETUP_SERVER_URL_PROPERTY] = g_param_spec_string ("server-url", "server-url", "server-url", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 20 "../src/ui/setup.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_SETUP_USERNAME_PROPERTY, ui_setup_properties[UI_SETUP_USERNAME_PROPERTY] = g_param_spec_string ("username", "username", "username", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 20 "../src/ui/setup.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_SETUP_PASSWORD_PROPERTY, ui_setup_properties[UI_SETUP_PASSWORD_PROPERTY] = g_param_spec_string ("password", "password", "password", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 20 "../src/ui/setup.vala" + gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/eu/callcc/audrey/ui/setup.ui"); +#line 20 "../src/ui/setup.vala" + ui_setup_signals[UI_SETUP_CONNECTED_SIGNAL] = g_signal_new ("connected", UI_TYPE_SETUP, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SUBSONIC_TYPE_CLIENT); +#line 34 "../src/ui/setup.vala" + _tmp0_ = secret_schema_new ("eu.callcc.audrey", SECRET_SCHEMA_NONE, "server-url", SECRET_SCHEMA_ATTRIBUTE_STRING, "username", SECRET_SCHEMA_ATTRIBUTE_STRING, NULL); +#line 34 "../src/ui/setup.vala" + ui_setup_secret_schema = _tmp0_; +#line 20 "../src/ui/setup.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_authn_changed", G_CALLBACK(_ui_setup_on_authn_changed_gtk_editable_changed)); +#line 20 "../src/ui/setup.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_authn_validate_activated", G_CALLBACK(_ui_setup_on_authn_validate_activated_adw_button_row_activated)); +#line 1283 "setup.c" +} + +static void +ui_setup_instance_init (UiSetup * self, + gpointer klass) +{ + gchar* _tmp0_; + gchar* _tmp1_; + gchar* _tmp2_; + gchar* _tmp3_; +#line 20 "../src/ui/setup.vala" + self->priv = ui_setup_get_instance_private (self); +#line 21 "../src/ui/setup.vala" + _tmp0_ = g_strdup (_ ("Not connected")); +#line 21 "../src/ui/setup.vala" + self->priv->_status = _tmp0_; +#line 23 "../src/ui/setup.vala" + self->priv->_authn_can_edit = TRUE; +#line 24 "../src/ui/setup.vala" + self->priv->_authn_can_validate = FALSE; +#line 26 "../src/ui/setup.vala" + _tmp1_ = g_strdup (""); +#line 26 "../src/ui/setup.vala" + self->priv->_server_url = _tmp1_; +#line 27 "../src/ui/setup.vala" + _tmp2_ = g_strdup (""); +#line 27 "../src/ui/setup.vala" + self->priv->_username = _tmp2_; +#line 28 "../src/ui/setup.vala" + _tmp3_ = g_strdup (""); +#line 28 "../src/ui/setup.vala" + self->priv->_password = _tmp3_; +#line 20 "../src/ui/setup.vala" + gtk_widget_init_template (GTK_WIDGET (self)); +#line 1318 "setup.c" +} + +static void +ui_setup_finalize (GObject * obj) +{ + UiSetup * self; +#line 20 "../src/ui/setup.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, UI_TYPE_SETUP, UiSetup); +#line 133 "../src/ui/setup.vala" + g_debug ("setup.vala:133: destroying setup dialog"); +#line 21 "../src/ui/setup.vala" + _g_free0 (self->priv->_status); +#line 26 "../src/ui/setup.vala" + _g_free0 (self->priv->_server_url); +#line 27 "../src/ui/setup.vala" + _g_free0 (self->priv->_username); +#line 28 "../src/ui/setup.vala" + _g_free0 (self->priv->_password); +#line 29 "../src/ui/setup.vala" + _g_free0 (self->token); +#line 30 "../src/ui/setup.vala" + _g_free0 (self->salt); +#line 20 "../src/ui/setup.vala" + G_OBJECT_CLASS (ui_setup_parent_class)->finalize (obj); +#line 1343 "setup.c" +} + +static GType +ui_setup_get_type_once (void) +{ + static const GTypeInfo g_define_type_info = { sizeof (UiSetupClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ui_setup_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UiSetup), 0, (GInstanceInitFunc) ui_setup_instance_init, NULL }; + GType ui_setup_type_id; + ui_setup_type_id = g_type_register_static (adw_preferences_dialog_get_type (), "UiSetup", &g_define_type_info, 0); + UiSetup_private_offset = g_type_add_instance_private (ui_setup_type_id, sizeof (UiSetupPrivate)); + return ui_setup_type_id; +} + +GType +ui_setup_get_type (void) +{ + static volatile gsize ui_setup_type_id__once = 0; + if (g_once_init_enter (&ui_setup_type_id__once)) { + GType ui_setup_type_id; + ui_setup_type_id = ui_setup_get_type_once (); + g_once_init_leave (&ui_setup_type_id__once, ui_setup_type_id); + } + return ui_setup_type_id__once; +} + +static void +_vala_ui_setup_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec) +{ + UiSetup * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, UI_TYPE_SETUP, UiSetup); +#line 20 "../src/ui/setup.vala" + switch (property_id) { +#line 20 "../src/ui/setup.vala" + case UI_SETUP_STATUS_PROPERTY: +#line 20 "../src/ui/setup.vala" + g_value_set_string (value, ui_setup_get_status (self)); +#line 20 "../src/ui/setup.vala" + break; +#line 20 "../src/ui/setup.vala" + case UI_SETUP_AUTHN_CAN_EDIT_PROPERTY: +#line 20 "../src/ui/setup.vala" + g_value_set_boolean (value, ui_setup_get_authn_can_edit (self)); +#line 20 "../src/ui/setup.vala" + break; +#line 20 "../src/ui/setup.vala" + case UI_SETUP_AUTHN_CAN_VALIDATE_PROPERTY: +#line 20 "../src/ui/setup.vala" + g_value_set_boolean (value, ui_setup_get_authn_can_validate (self)); +#line 20 "../src/ui/setup.vala" + break; +#line 20 "../src/ui/setup.vala" + case UI_SETUP_SERVER_URL_PROPERTY: +#line 20 "../src/ui/setup.vala" + g_value_set_string (value, ui_setup_get_server_url (self)); +#line 20 "../src/ui/setup.vala" + break; +#line 20 "../src/ui/setup.vala" + case UI_SETUP_USERNAME_PROPERTY: +#line 20 "../src/ui/setup.vala" + g_value_set_string (value, ui_setup_get_username (self)); +#line 20 "../src/ui/setup.vala" + break; +#line 20 "../src/ui/setup.vala" + case UI_SETUP_PASSWORD_PROPERTY: +#line 20 "../src/ui/setup.vala" + g_value_set_string (value, ui_setup_get_password (self)); +#line 20 "../src/ui/setup.vala" + break; +#line 1414 "setup.c" + default: +#line 20 "../src/ui/setup.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 20 "../src/ui/setup.vala" + break; +#line 1420 "setup.c" + } +} + +static void +_vala_ui_setup_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec) +{ + UiSetup * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, UI_TYPE_SETUP, UiSetup); +#line 20 "../src/ui/setup.vala" + switch (property_id) { +#line 20 "../src/ui/setup.vala" + case UI_SETUP_STATUS_PROPERTY: +#line 20 "../src/ui/setup.vala" + ui_setup_set_status (self, g_value_get_string (value)); +#line 20 "../src/ui/setup.vala" + break; +#line 20 "../src/ui/setup.vala" + case UI_SETUP_AUTHN_CAN_EDIT_PROPERTY: +#line 20 "../src/ui/setup.vala" + ui_setup_set_authn_can_edit (self, g_value_get_boolean (value)); +#line 20 "../src/ui/setup.vala" + break; +#line 20 "../src/ui/setup.vala" + case UI_SETUP_AUTHN_CAN_VALIDATE_PROPERTY: +#line 20 "../src/ui/setup.vala" + ui_setup_set_authn_can_validate (self, g_value_get_boolean (value)); +#line 20 "../src/ui/setup.vala" + break; +#line 20 "../src/ui/setup.vala" + case UI_SETUP_SERVER_URL_PROPERTY: +#line 20 "../src/ui/setup.vala" + ui_setup_set_server_url (self, g_value_get_string (value)); +#line 20 "../src/ui/setup.vala" + break; +#line 20 "../src/ui/setup.vala" + case UI_SETUP_USERNAME_PROPERTY: +#line 20 "../src/ui/setup.vala" + ui_setup_set_username (self, g_value_get_string (value)); +#line 20 "../src/ui/setup.vala" + break; +#line 20 "../src/ui/setup.vala" + case UI_SETUP_PASSWORD_PROPERTY: +#line 20 "../src/ui/setup.vala" + ui_setup_set_password (self, g_value_get_string (value)); +#line 20 "../src/ui/setup.vala" + break; +#line 1470 "setup.c" + default: +#line 20 "../src/ui/setup.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 20 "../src/ui/setup.vala" + break; +#line 1476 "setup.c" + } +} + diff --git a/src/ui/setup.vala b/src/ui/setup.vala deleted file mode 100644 index 29abebf..0000000 --- a/src/ui/setup.vala +++ /dev/null @@ -1,135 +0,0 @@ -static void salt_password (string password, out string token, out string salt) { - const int SALT_BYTES = 8; - uchar salt_bytes[SALT_BYTES]; - GCrypt.Random.randomize (salt_bytes, GCrypt.Random.Level.STRONG); - uchar salt_chars[2*SALT_BYTES+1]; - for (int i = 0; i < SALT_BYTES; i += 1) { - salt_chars[2*i+0] = "0123456789abcdef"[(salt_bytes[i]>>4)&0xf]; - salt_chars[2*i+1] = "0123456789abcdef"[(salt_bytes[i]>>0)&0xf]; - } - salt_chars[2*SALT_BYTES] = 0; - var checksum = new GLib.Checksum (ChecksumType.MD5); - checksum.update ((uchar[]) password, -1); - checksum.update (salt_chars, -1); - - token = checksum.get_string (); - salt = (string) salt_chars; -} - -[GtkTemplate (ui = "/eu/callcc/audrey/ui/setup.ui")] -public class Ui.Setup : Adw.PreferencesDialog { - public string status { get; private set; default = _("Not connected"); } - - public bool authn_can_edit { get; private set; default = true; } - public bool authn_can_validate { get; private set; default = false; } - - public string server_url { get; set; default = ""; } - public string username { get; set; default = ""; } - public string password { get; set; default = ""; } - public string token; - public string salt; - - public signal void connected (Subsonic.Client api); - - private static Secret.Schema secret_schema = new Secret.Schema ( - "eu.callcc.audrey", - Secret.SchemaFlags.NONE, - "server-url", Secret.SchemaAttributeType.STRING, - "username", Secret.SchemaAttributeType.STRING - ); - - [GtkCallback] private void on_authn_changed () { - this.authn_can_validate = true; - } - - [GtkCallback] private void on_authn_validate_activated () { - this.authn_can_validate = false; - this.authn_can_edit = false; - this.status = _("Connecting..."); - - string new_token, new_salt; - salt_password (this.password, out new_token, out new_salt); - var api = new Subsonic.Client.with_token ( - this.server_url, - this.username, - new_token, - new_salt); - - api.ping.begin ((obj, res) => { - try { - api.ping.end (res); - this.status = _("Connected"); - this.token = new_token; - this.salt = new_salt; - this.save (); - - this.connected (api); - } catch (Error e) { - this.status = @"$(_("Ping failed")): $(e.message)"; - this.authn_can_validate = true; - } - - this.authn_can_edit = true; - }); - } - - public void load () { - this.authn_can_edit = false; - Secret.password_searchv.begin ( - secret_schema, - new HashTable (null, null), - Secret.SearchFlags.UNLOCK, - null, - (obj, res) => { - try { - var list = Secret.password_searchv.end (res); - if (list == null) { - // didn't find shit, leave all empty - this.server_url = ""; - this.username = ""; - this.password = ""; - // TODO: onboarding - this.authn_can_edit = true; - this.authn_can_validate = true; - } else { - var first = list.data; - assert (first != null); - - this.server_url = first.attributes["server-url"]; - this.username = first.attributes["username"]; - - first.retrieve_secret.begin (null, (obj, res) => { - try { - var value = first.retrieve_secret.end (res); - this.password = value.get_text () ?? ""; - } catch (Error e) { - error ("could not retrieve password from credentials: %s", e.message); - } - - // first connection - this.authn_can_validate = true; - this.on_authn_validate_activated (); - }); - } - } catch (Error e) { - error ("could not search for password in keyring: %s", e.message); - } - }); - } - - public void save () { - this.authn_can_edit = false; - Secret.password_store.begin (secret_schema, null, "Audrey Subsonic password", this.password, null, (obj, res) => { - try { - Secret.password_store.end (res); - } catch (Error e) { - error ("could not store password in keyring: %s", e.message); - } - this.authn_can_edit = true; - }, "server-url", this.server_url, "username", this.username); - } - - ~Setup () { - debug ("destroying setup dialog"); - } -} diff --git a/src/ui/window.c b/src/ui/window.c new file mode 100644 index 0000000..8d98289 --- /dev/null +++ b/src/ui/window.c @@ -0,0 +1,1593 @@ +/* window.c generated by valac 0.56.16, the Vala compiler + * generated from window.vala, do not modify */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 UI_TYPE_WINDOW (ui_window_get_type ()) +#define UI_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UI_TYPE_WINDOW, UiWindow)) +#define UI_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UI_TYPE_WINDOW, UiWindowClass)) +#define UI_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UI_TYPE_WINDOW)) +#define UI_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UI_TYPE_WINDOW)) +#define UI_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UI_TYPE_WINDOW, UiWindowClass)) + +typedef struct _UiWindow UiWindow; +typedef struct _UiWindowClass UiWindowClass; +typedef struct _UiWindowPrivate UiWindowPrivate; + +#define UI_TYPE_PLAY_QUEUE (ui_play_queue_get_type ()) +#define UI_PLAY_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UI_TYPE_PLAY_QUEUE, UiPlayQueue)) +#define UI_PLAY_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UI_TYPE_PLAY_QUEUE, UiPlayQueueClass)) +#define UI_IS_PLAY_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UI_TYPE_PLAY_QUEUE)) +#define UI_IS_PLAY_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UI_TYPE_PLAY_QUEUE)) +#define UI_PLAY_QUEUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UI_TYPE_PLAY_QUEUE, UiPlayQueueClass)) + +typedef struct _UiPlayQueue UiPlayQueue; +typedef struct _UiPlayQueueClass UiPlayQueueClass; + +#define UI_TYPE_PLAYBAR (ui_playbar_get_type ()) +#define UI_PLAYBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UI_TYPE_PLAYBAR, UiPlaybar)) +#define UI_PLAYBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UI_TYPE_PLAYBAR, UiPlaybarClass)) +#define UI_IS_PLAYBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UI_TYPE_PLAYBAR)) +#define UI_IS_PLAYBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UI_TYPE_PLAYBAR)) +#define UI_PLAYBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UI_TYPE_PLAYBAR, UiPlaybarClass)) + +typedef struct _UiPlaybar UiPlaybar; +typedef struct _UiPlaybarClass UiPlaybarClass; + +#define UI_TYPE_SETUP (ui_setup_get_type ()) +#define UI_SETUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UI_TYPE_SETUP, UiSetup)) +#define UI_SETUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UI_TYPE_SETUP, UiSetupClass)) +#define UI_IS_SETUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UI_TYPE_SETUP)) +#define UI_IS_SETUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UI_TYPE_SETUP)) +#define UI_SETUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UI_TYPE_SETUP, UiSetupClass)) + +typedef struct _UiSetup UiSetup; +typedef struct _UiSetupClass UiSetupClass; + +#define SUBSONIC_TYPE_CLIENT (subsonic_client_get_type ()) +#define SUBSONIC_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SUBSONIC_TYPE_CLIENT, SubsonicClient)) +#define SUBSONIC_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SUBSONIC_TYPE_CLIENT, SubsonicClientClass)) +#define SUBSONIC_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUBSONIC_TYPE_CLIENT)) +#define SUBSONIC_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SUBSONIC_TYPE_CLIENT)) +#define SUBSONIC_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SUBSONIC_TYPE_CLIENT, SubsonicClientClass)) + +typedef struct _SubsonicClient SubsonicClient; +typedef struct _SubsonicClientClass SubsonicClientClass; + +#define TYPE_PLAYBIN_SONG (playbin_song_get_type ()) +#define PLAYBIN_SONG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYBIN_SONG, PlaybinSong)) +#define PLAYBIN_SONG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYBIN_SONG, PlaybinSongClass)) +#define IS_PLAYBIN_SONG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYBIN_SONG)) +#define IS_PLAYBIN_SONG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYBIN_SONG)) +#define PLAYBIN_SONG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYBIN_SONG, PlaybinSongClass)) + +typedef struct _PlaybinSong PlaybinSong; +typedef struct _PlaybinSongClass PlaybinSongClass; + +#define TYPE_PLAYBIN (playbin_get_type ()) +#define PLAYBIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYBIN, Playbin)) +#define PLAYBIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYBIN, PlaybinClass)) +#define IS_PLAYBIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYBIN)) +#define IS_PLAYBIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYBIN)) +#define PLAYBIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYBIN, PlaybinClass)) + +typedef struct _Playbin Playbin; +typedef struct _PlaybinClass PlaybinClass; + +#define TYPE_MPRIS (mpris_get_type ()) +#define MPRIS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS, Mpris)) +#define MPRIS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS, MprisClass)) +#define IS_MPRIS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS)) +#define IS_MPRIS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS)) +#define MPRIS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS, MprisClass)) + +typedef struct _Mpris Mpris; +typedef struct _MprisClass MprisClass; + +#define TYPE_MPRIS_PLAYER (mpris_player_get_type ()) +#define MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYER, MprisPlayer)) +#define MPRIS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_PLAYER, MprisPlayerClass)) +#define IS_MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYER)) +#define IS_MPRIS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_PLAYER)) +#define MPRIS_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_PLAYER, MprisPlayerClass)) + +typedef struct _MprisPlayer MprisPlayer; +typedef struct _MprisPlayerClass MprisPlayerClass; +enum { + UI_WINDOW_0_PROPERTY, + UI_WINDOW_VOLUME_PROPERTY, + UI_WINDOW_MUTE_PROPERTY, + UI_WINDOW_SONG_PROPERTY, + UI_WINDOW_PLAYING_COVER_ART_PROPERTY, + UI_WINDOW_COVER_ART_LOADING_PROPERTY, + UI_WINDOW_PLAYBIN_PROPERTY, + UI_WINDOW_CAN_CLICK_SHUFFLE_ALL_PROPERTY, + UI_WINDOW_NUM_PROPERTIES +}; +static GParamSpec* ui_window_properties[UI_WINDOW_NUM_PROPERTIES]; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +typedef struct _Block6Data Block6Data; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) + +#define SUBSONIC_TYPE_SONG (subsonic_song_get_type ()) +typedef struct _SubsonicSong SubsonicSong; +typedef void (*SubsonicSongCallback) (SubsonicSong* song, gpointer user_data); + +struct _UiWindow { + AdwApplicationWindow parent_instance; + UiWindowPrivate * priv; + UiPlayQueue* play_queue; + UiPlaybar* playbar; +}; + +struct _UiWindowClass { + AdwApplicationWindowClass parent_class; +}; + +struct _UiWindowPrivate { + UiSetup* setup; + SubsonicClient* api; + PlaybinSong* _song; + GdkPaintable* _playing_cover_art; + GCancellable* cancel_loading_art; + gboolean _cover_art_loading; + Playbin* _playbin; + Mpris* mpris; + MprisPlayer* mpris_player; + gboolean _can_click_shuffle_all; +}; + +struct _Block6Data { + int _ref_count_; + UiWindow* self; + gchar* song_id; +}; + +struct _SubsonicSong { + gchar* id; + gchar* title; + gchar* album; + gchar* artist; + gint64 track; + gint64 year; + GDateTime* starred; + gint64 duration; + gint64 play_count; + gchar* genre; + gchar* cover_art; +}; + +static gint UiWindow_private_offset; +static gpointer ui_window_parent_class = NULL; + +VALA_EXTERN GType ui_window_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (UiWindow, g_object_unref) +VALA_EXTERN GType ui_play_queue_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (UiPlayQueue, g_object_unref) +VALA_EXTERN GType ui_playbar_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (UiPlaybar, g_object_unref) +VALA_EXTERN GType ui_setup_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (UiSetup, g_object_unref) +VALA_EXTERN GType subsonic_client_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (SubsonicClient, g_object_unref) +VALA_EXTERN GType playbin_song_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (PlaybinSong, g_object_unref) +VALA_EXTERN GType playbin_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (Playbin, g_object_unref) +VALA_EXTERN GType mpris_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (Mpris, g_object_unref) +VALA_EXTERN guint mpris_register_object (void* object, + GDBusConnection* connection, + const gchar* path, + GError** error); +VALA_EXTERN GType mpris_player_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (MprisPlayer, g_object_unref) +VALA_EXTERN guint mpris_player_register_object (void* object, + GDBusConnection* connection, + const gchar* path, + GError** error); +VALA_EXTERN Playbin* playbin_new (void); +VALA_EXTERN Playbin* playbin_construct (GType object_type); +VALA_EXTERN UiWindow* ui_window_new (GtkApplication* app); +VALA_EXTERN UiWindow* ui_window_construct (GType object_type, + GtkApplication* app); +static void ui_window_now_playing (UiWindow* self, + PlaybinSong* song); +static Block6Data* block6_data_ref (Block6Data* _data6_); +static void block6_data_unref (void * _userdata_); +static void ui_window_set_song (UiWindow* self, + PlaybinSong* value); +VALA_EXTERN void ui_window_set_playing_cover_art (UiWindow* self, + GdkPaintable* value); +VALA_EXTERN void ui_window_set_cover_art_loading (UiWindow* self, + gboolean value); +VALA_EXTERN PlaybinSong* ui_window_get_song (UiWindow* self); +VALA_EXTERN const gchar* playbin_song_get_id (PlaybinSong* self); +VALA_EXTERN void subsonic_client_cover_art (SubsonicClient* self, + const gchar* id, + gint size, + gint priority, + GCancellable* cancellable, + GAsyncReadyCallback _callback_, + gpointer _user_data_); +VALA_EXTERN GdkPixbuf* subsonic_client_cover_art_finish (SubsonicClient* self, + GAsyncResult* _res_, + GError** error); +static void __lambda26_ (Block6Data* _data6_, + GObject* obj, + GAsyncResult* res); +static void ___lambda26__gasync_ready_callback (GObject* source_object, + GAsyncResult* res, + gpointer self); +static void ui_window_show_setup_dialog (UiWindow* self); +static void _ui_window_show_setup_dialog_gtk_button_clicked (GtkButton* _sender, + gpointer self); +static void ui_window_shuffle_all (UiWindow* self); +static void ui_window_set_can_click_shuffle_all (UiWindow* self, + gboolean value); +VALA_EXTERN Playbin* ui_window_get_playbin (UiWindow* self); +VALA_EXTERN void playbin_clear (Playbin* self); +VALA_EXTERN GType subsonic_song_get_type (void) G_GNUC_CONST ; +VALA_EXTERN SubsonicSong* subsonic_song_dup (const SubsonicSong* self); +VALA_EXTERN void subsonic_song_free (SubsonicSong* self); +VALA_EXTERN void subsonic_song_copy (const SubsonicSong* self, + SubsonicSong* dest); +VALA_EXTERN void subsonic_song_destroy (SubsonicSong* self); +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (SubsonicSong, subsonic_song_destroy) +VALA_EXTERN void subsonic_client_get_random_songs (SubsonicClient* self, + const gchar* parameters, + SubsonicSongCallback callback, + gpointer callback_target, + GAsyncReadyCallback _callback_, + gpointer _user_data_); +VALA_EXTERN void subsonic_client_get_random_songs_finish (SubsonicClient* self, + GAsyncResult* _res_, + GError** error); +static void __lambda27_ (UiWindow* self, + SubsonicSong* song); +VALA_EXTERN void playbin_append_track (Playbin* self, + SubsonicSong* song); +static void ___lambda27__subsonic_song_callback (SubsonicSong* song, + gpointer self); +static void __lambda28_ (UiWindow* self, + GObject* obj, + GAsyncResult* res); +VALA_EXTERN void playbin_select_track (Playbin* self, + guint position); +static void ___lambda28__gasync_ready_callback (GObject* source_object, + GAsyncResult* res, + gpointer self); +static void _ui_window_shuffle_all_gtk_button_clicked (GtkButton* _sender, + gpointer self); +static gboolean ui_window_show_playbar_cover_art (UiWindow* self, + const gchar* stack_child); +static gboolean ui_window_real_close_request (GtkWindow* base); +VALA_EXTERN void playbin_stop (Playbin* self); +VALA_EXTERN gint ui_window_get_volume (UiWindow* self); +VALA_EXTERN gint playbin_get_volume (Playbin* self); +VALA_EXTERN void ui_window_set_volume (UiWindow* self, + gint value); +VALA_EXTERN void playbin_set_volume (Playbin* self, + gint value); +VALA_EXTERN gboolean ui_window_get_mute (UiWindow* self); +VALA_EXTERN gboolean playbin_get_mute (Playbin* self); +VALA_EXTERN void ui_window_set_mute (UiWindow* self, + gboolean value); +VALA_EXTERN void playbin_set_mute (Playbin* self, + gboolean value); +VALA_EXTERN GdkPaintable* ui_window_get_playing_cover_art (UiWindow* self); +VALA_EXTERN gboolean ui_window_get_cover_art_loading (UiWindow* self); +static void ui_window_set_playbin (UiWindow* self, + Playbin* value); +VALA_EXTERN gboolean ui_window_get_can_click_shuffle_all (UiWindow* self); +static GObject * ui_window_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam * construct_properties); +static void _ui_window___lambda29_ (UiWindow* self, + GDBusConnection* conn); +VALA_EXTERN Mpris* mpris_new (UiWindow* window); +VALA_EXTERN Mpris* mpris_construct (GType object_type, + UiWindow* window); +VALA_EXTERN MprisPlayer* mpris_player_new (GDBusConnection* conn, + Playbin* playbin); +VALA_EXTERN MprisPlayer* mpris_player_construct (GType object_type, + GDBusConnection* conn, + Playbin* playbin); +static void __ui_window___lambda29__gbus_acquired_callback (GDBusConnection* connection, + const gchar* name, + gpointer self); +static void _ui_window___lambda30_ (UiWindow* self); +static void __ui_window___lambda30__gbus_name_acquired_callback (GDBusConnection* connection, + const gchar* name, + gpointer self); +static void _ui_window___lambda31_ (UiWindow* self); +static void __ui_window___lambda31__gbus_name_lost_callback (GDBusConnection* connection, + const gchar* name, + gpointer self); +VALA_EXTERN UiSetup* ui_setup_new (void); +VALA_EXTERN UiSetup* ui_setup_construct (GType object_type); +static void _ui_window___lambda32_ (UiWindow* self, + SubsonicClient* api); +VALA_EXTERN void playbin_set_api (Playbin* self, + SubsonicClient* value); +VALA_EXTERN void mpris_player_set_api (MprisPlayer* self, + SubsonicClient* value); +static void __ui_window___lambda32__ui_setup_connected (UiSetup* _sender, + SubsonicClient* api, + gpointer self); +VALA_EXTERN void ui_setup_load (UiSetup* self); +static void _ui_window___lambda33_ (UiWindow* self); +VALA_EXTERN GListModel* playbin_get_play_queue (Playbin* self); +VALA_EXTERN gint playbin_get_play_queue_position (Playbin* self); +static void __ui_window___lambda33__playbin_new_track (Playbin* _sender, + gpointer self); +static void _ui_window___lambda34_ (UiWindow* self); +static void __ui_window___lambda34__playbin_stopped (Playbin* _sender, + gpointer self); +static void ui_window_finalize (GObject * obj); +static GType ui_window_get_type_once (void); +static void _vala_ui_window_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec); +static void _vala_ui_window_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec); + +static inline gpointer +ui_window_get_instance_private (UiWindow* self) +{ + return G_STRUCT_MEMBER_P (self, UiWindow_private_offset); +} + +UiWindow* +ui_window_construct (GType object_type, + GtkApplication* app) +{ + UiWindow * self = NULL; +#line 28 "../src/ui/window.vala" + g_return_val_if_fail (app != NULL, NULL); +#line 29 "../src/ui/window.vala" + self = (UiWindow*) g_object_new (object_type, "application", app, NULL); +#line 28 "../src/ui/window.vala" + return self; +#line 383 "window.c" +} + +UiWindow* +ui_window_new (GtkApplication* app) +{ +#line 28 "../src/ui/window.vala" + return ui_window_construct (UI_TYPE_WINDOW, app); +#line 391 "window.c" +} + +static Block6Data* +block6_data_ref (Block6Data* _data6_) +{ +#line 35 "../src/ui/window.vala" + g_atomic_int_inc (&_data6_->_ref_count_); +#line 35 "../src/ui/window.vala" + return _data6_; +#line 401 "window.c" +} + +static void +block6_data_unref (void * _userdata_) +{ + Block6Data* _data6_; + _data6_ = (Block6Data*) _userdata_; +#line 35 "../src/ui/window.vala" + if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) { +#line 411 "window.c" + UiWindow* self; +#line 35 "../src/ui/window.vala" + self = _data6_->self; +#line 35 "../src/ui/window.vala" + _g_free0 (_data6_->song_id); +#line 35 "../src/ui/window.vala" + _g_object_unref0 (self); +#line 35 "../src/ui/window.vala" + g_slice_free (Block6Data, _data6_); +#line 421 "window.c" + } +} + +static void +__lambda26_ (Block6Data* _data6_, + GObject* obj, + GAsyncResult* res) +{ + UiWindow* self; + GError* _inner_error0_ = NULL; +#line 48 "../src/ui/window.vala" + self = _data6_->self; +#line 48 "../src/ui/window.vala" + g_return_if_fail (res != NULL); +#line 436 "window.c" + { + GdkPixbuf* _tmp0_ = NULL; + SubsonicClient* _tmp1_; + GdkPixbuf* _tmp2_; + GdkTexture* _tmp3_; + GdkTexture* _tmp4_; +#line 50 "../src/ui/window.vala" + _tmp1_ = self->priv->api; +#line 50 "../src/ui/window.vala" + _tmp2_ = subsonic_client_cover_art_finish (_tmp1_, res, &_inner_error0_); +#line 50 "../src/ui/window.vala" + _tmp0_ = _tmp2_; +#line 50 "../src/ui/window.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 451 "window.c" + goto __catch0_g_error; + } +#line 50 "../src/ui/window.vala" + _tmp3_ = gdk_texture_new_for_pixbuf (_tmp0_); +#line 50 "../src/ui/window.vala" + _tmp4_ = _tmp3_; +#line 50 "../src/ui/window.vala" + ui_window_set_playing_cover_art (self, (GdkPaintable*) _tmp4_); +#line 50 "../src/ui/window.vala" + _g_object_unref0 (_tmp4_); +#line 51 "../src/ui/window.vala" + ui_window_set_cover_art_loading (self, FALSE); +#line 49 "../src/ui/window.vala" + _g_object_unref0 (_tmp0_); +#line 466 "window.c" + } + goto __finally0; + __catch0_g_error: + { + GError* e = NULL; + GError* _tmp5_; +#line 49 "../src/ui/window.vala" + e = _inner_error0_; +#line 49 "../src/ui/window.vala" + _inner_error0_ = NULL; +#line 53 "../src/ui/window.vala" + _tmp5_ = e; +#line 53 "../src/ui/window.vala" + if (!g_error_matches (_tmp5_, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { +#line 481 "window.c" + GError* _tmp6_; + const gchar* _tmp7_; +#line 54 "../src/ui/window.vala" + _tmp6_ = e; +#line 54 "../src/ui/window.vala" + _tmp7_ = _tmp6_->message; +#line 54 "../src/ui/window.vala" + g_warning ("window.vala:54: could not load cover for %s: %s", _data6_->song_id, _tmp7_); +#line 55 "../src/ui/window.vala" + ui_window_set_cover_art_loading (self, FALSE); +#line 492 "window.c" + } +#line 49 "../src/ui/window.vala" + _g_error_free0 (e); +#line 496 "window.c" + } + __finally0: +#line 49 "../src/ui/window.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 49 "../src/ui/window.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); +#line 49 "../src/ui/window.vala" + g_clear_error (&_inner_error0_); +#line 49 "../src/ui/window.vala" + return; +#line 507 "window.c" + } +} + +static void +___lambda26__gasync_ready_callback (GObject* source_object, + GAsyncResult* res, + gpointer self) +{ +#line 48 "../src/ui/window.vala" + __lambda26_ (self, source_object, res); +#line 48 "../src/ui/window.vala" + block6_data_unref (self); +#line 520 "window.c" +} + +static void +ui_window_now_playing (UiWindow* self, + PlaybinSong* song) +{ + Block6Data* _data6_; + GCancellable* _tmp0_; + GCancellable* _tmp2_; + PlaybinSong* _tmp3_; + const gchar* _tmp4_; + const gchar* _tmp5_; + gchar* _tmp6_; + SubsonicClient* _tmp7_; + GCancellable* _tmp8_; +#line 35 "../src/ui/window.vala" + g_return_if_fail (self != NULL); +#line 35 "../src/ui/window.vala" + g_return_if_fail (song != NULL); +#line 35 "../src/ui/window.vala" + _data6_ = g_slice_new0 (Block6Data); +#line 35 "../src/ui/window.vala" + _data6_->_ref_count_ = 1; +#line 35 "../src/ui/window.vala" + _data6_->self = g_object_ref (self); +#line 36 "../src/ui/window.vala" + ui_window_set_song (self, song); +#line 39 "../src/ui/window.vala" + _tmp0_ = self->priv->cancel_loading_art; +#line 39 "../src/ui/window.vala" + if (_tmp0_ != NULL) { +#line 552 "window.c" + GCancellable* _tmp1_; +#line 40 "../src/ui/window.vala" + _tmp1_ = self->priv->cancel_loading_art; +#line 40 "../src/ui/window.vala" + g_cancellable_cancel (_tmp1_); +#line 558 "window.c" + } +#line 42 "../src/ui/window.vala" + _tmp2_ = g_cancellable_new (); +#line 42 "../src/ui/window.vala" + _g_object_unref0 (self->priv->cancel_loading_art); +#line 42 "../src/ui/window.vala" + self->priv->cancel_loading_art = _tmp2_; +#line 44 "../src/ui/window.vala" + ui_window_set_playing_cover_art (self, NULL); +#line 45 "../src/ui/window.vala" + ui_window_set_cover_art_loading (self, TRUE); +#line 47 "../src/ui/window.vala" + _tmp3_ = self->priv->_song; +#line 47 "../src/ui/window.vala" + _tmp4_ = playbin_song_get_id (_tmp3_); +#line 47 "../src/ui/window.vala" + _tmp5_ = _tmp4_; +#line 47 "../src/ui/window.vala" + _tmp6_ = g_strdup (_tmp5_); +#line 47 "../src/ui/window.vala" + _data6_->song_id = _tmp6_; +#line 48 "../src/ui/window.vala" + _tmp7_ = self->priv->api; +#line 48 "../src/ui/window.vala" + _tmp8_ = self->priv->cancel_loading_art; +#line 48 "../src/ui/window.vala" + subsonic_client_cover_art (_tmp7_, _data6_->song_id, -1, G_PRIORITY_DEFAULT, _tmp8_, ___lambda26__gasync_ready_callback, block6_data_ref (_data6_)); +#line 35 "../src/ui/window.vala" + block6_data_unref (_data6_); +#line 35 "../src/ui/window.vala" + _data6_ = NULL; +#line 590 "window.c" +} + +static void +ui_window_show_setup_dialog (UiWindow* self) +{ + UiSetup* _tmp0_; +#line 100 "../src/ui/window.vala" + g_return_if_fail (self != NULL); +#line 101 "../src/ui/window.vala" + _tmp0_ = self->priv->setup; +#line 101 "../src/ui/window.vala" + adw_dialog_present ((AdwDialog*) _tmp0_, (GtkWidget*) self); +#line 603 "window.c" +} + +static void +_ui_window_show_setup_dialog_gtk_button_clicked (GtkButton* _sender, + gpointer self) +{ +#line 2 "../src/ui/window.vala" + ui_window_show_setup_dialog ((UiWindow*) self); +#line 612 "window.c" +} + +static void +__lambda27_ (UiWindow* self, + SubsonicSong* song) +{ + Playbin* _tmp0_; + SubsonicSong _tmp1_; +#line 109 "../src/ui/window.vala" + g_return_if_fail (song != NULL); +#line 110 "../src/ui/window.vala" + _tmp0_ = self->priv->_playbin; +#line 110 "../src/ui/window.vala" + _tmp1_ = *song; +#line 110 "../src/ui/window.vala" + playbin_append_track (_tmp0_, &_tmp1_); +#line 629 "window.c" +} + +static void +___lambda27__subsonic_song_callback (SubsonicSong* song, + gpointer self) +{ +#line 109 "../src/ui/window.vala" + __lambda27_ ((UiWindow*) self, song); +#line 638 "window.c" +} + +static void +__lambda28_ (UiWindow* self, + GObject* obj, + GAsyncResult* res) +{ + Playbin* _tmp2_; + GError* _inner_error0_ = NULL; +#line 111 "../src/ui/window.vala" + g_return_if_fail (res != NULL); +#line 650 "window.c" + { + SubsonicClient* _tmp0_; +#line 113 "../src/ui/window.vala" + _tmp0_ = self->priv->api; +#line 113 "../src/ui/window.vala" + subsonic_client_get_random_songs_finish (_tmp0_, res, &_inner_error0_); +#line 113 "../src/ui/window.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 659 "window.c" + goto __catch0_g_error; + } + } + goto __finally0; + __catch0_g_error: + { + GError* e = NULL; + const gchar* _tmp1_; +#line 112 "../src/ui/window.vala" + e = _inner_error0_; +#line 112 "../src/ui/window.vala" + _inner_error0_ = NULL; +#line 115 "../src/ui/window.vala" + _tmp1_ = e->message; +#line 115 "../src/ui/window.vala" + g_error ("window.vala:115: could not get random songs: %s", _tmp1_); +#line 112 "../src/ui/window.vala" + _g_error_free0 (e); +#line 678 "window.c" + } + __finally0: +#line 112 "../src/ui/window.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 112 "../src/ui/window.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); +#line 112 "../src/ui/window.vala" + g_clear_error (&_inner_error0_); +#line 112 "../src/ui/window.vala" + return; +#line 689 "window.c" + } +#line 117 "../src/ui/window.vala" + ui_window_set_can_click_shuffle_all (self, TRUE); +#line 119 "../src/ui/window.vala" + _tmp2_ = self->priv->_playbin; +#line 119 "../src/ui/window.vala" + playbin_select_track (_tmp2_, (guint) 0); +#line 697 "window.c" +} + +static void +___lambda28__gasync_ready_callback (GObject* source_object, + GAsyncResult* res, + gpointer self) +{ +#line 109 "../src/ui/window.vala" + __lambda28_ ((UiWindow*) self, source_object, res); +#line 109 "../src/ui/window.vala" + g_object_unref (self); +#line 709 "window.c" +} + +static void +ui_window_shuffle_all (UiWindow* self) +{ + Playbin* _tmp0_; + SubsonicClient* _tmp1_; +#line 106 "../src/ui/window.vala" + g_return_if_fail (self != NULL); +#line 107 "../src/ui/window.vala" + ui_window_set_can_click_shuffle_all (self, FALSE); +#line 108 "../src/ui/window.vala" + _tmp0_ = self->priv->_playbin; +#line 108 "../src/ui/window.vala" + playbin_clear (_tmp0_); +#line 109 "../src/ui/window.vala" + _tmp1_ = self->priv->api; +#line 109 "../src/ui/window.vala" + subsonic_client_get_random_songs (_tmp1_, NULL, ___lambda27__subsonic_song_callback, self, ___lambda28__gasync_ready_callback, g_object_ref (self)); +#line 729 "window.c" +} + +static void +_ui_window_shuffle_all_gtk_button_clicked (GtkButton* _sender, + gpointer self) +{ +#line 2 "../src/ui/window.vala" + ui_window_shuffle_all ((UiWindow*) self); +#line 738 "window.c" +} + +static gboolean +ui_window_show_playbar_cover_art (UiWindow* self, + const gchar* stack_child) +{ + gboolean result; +#line 123 "../src/ui/window.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 124 "../src/ui/window.vala" + result = g_strcmp0 (stack_child, "play-queue") != 0; +#line 124 "../src/ui/window.vala" + return result; +#line 752 "window.c" +} + +static gboolean +ui_window_real_close_request (GtkWindow* base) +{ + UiWindow * self; + Playbin* _tmp0_; + gboolean result; +#line 127 "../src/ui/window.vala" + self = (UiWindow*) base; +#line 129 "../src/ui/window.vala" + _tmp0_ = self->priv->_playbin; +#line 129 "../src/ui/window.vala" + playbin_stop (_tmp0_); +#line 130 "../src/ui/window.vala" + result = FALSE; +#line 130 "../src/ui/window.vala" + return result; +#line 771 "window.c" +} + +gint +ui_window_get_volume (UiWindow* self) +{ + gint result; + Playbin* _tmp0_; + gint _tmp1_; + gint _tmp2_; +#line 12 "../src/ui/window.vala" + g_return_val_if_fail (self != NULL, 0); +#line 12 "../src/ui/window.vala" + _tmp0_ = self->priv->_playbin; +#line 12 "../src/ui/window.vala" + _tmp1_ = playbin_get_volume (_tmp0_); +#line 12 "../src/ui/window.vala" + _tmp2_ = _tmp1_; +#line 12 "../src/ui/window.vala" + result = _tmp2_; +#line 12 "../src/ui/window.vala" + return result; +#line 793 "window.c" +} + +void +ui_window_set_volume (UiWindow* self, + gint value) +{ + Playbin* _tmp0_; +#line 13 "../src/ui/window.vala" + g_return_if_fail (self != NULL); +#line 13 "../src/ui/window.vala" + _tmp0_ = self->priv->_playbin; +#line 13 "../src/ui/window.vala" + playbin_set_volume (_tmp0_, value); +#line 13 "../src/ui/window.vala" + g_object_notify_by_pspec ((GObject *) self, ui_window_properties[UI_WINDOW_VOLUME_PROPERTY]); +#line 809 "window.c" +} + +gboolean +ui_window_get_mute (UiWindow* self) +{ + gboolean result; + Playbin* _tmp0_; + gboolean _tmp1_; + gboolean _tmp2_; +#line 16 "../src/ui/window.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 16 "../src/ui/window.vala" + _tmp0_ = self->priv->_playbin; +#line 16 "../src/ui/window.vala" + _tmp1_ = playbin_get_mute (_tmp0_); +#line 16 "../src/ui/window.vala" + _tmp2_ = _tmp1_; +#line 16 "../src/ui/window.vala" + result = _tmp2_; +#line 16 "../src/ui/window.vala" + return result; +#line 831 "window.c" +} + +void +ui_window_set_mute (UiWindow* self, + gboolean value) +{ + Playbin* _tmp0_; +#line 17 "../src/ui/window.vala" + g_return_if_fail (self != NULL); +#line 17 "../src/ui/window.vala" + _tmp0_ = self->priv->_playbin; +#line 17 "../src/ui/window.vala" + playbin_set_mute (_tmp0_, value); +#line 17 "../src/ui/window.vala" + g_object_notify_by_pspec ((GObject *) self, ui_window_properties[UI_WINDOW_MUTE_PROPERTY]); +#line 847 "window.c" +} + +PlaybinSong* +ui_window_get_song (UiWindow* self) +{ + PlaybinSong* result; + PlaybinSong* _tmp0_; +#line 20 "../src/ui/window.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 20 "../src/ui/window.vala" + _tmp0_ = self->priv->_song; +#line 20 "../src/ui/window.vala" + result = _tmp0_; +#line 20 "../src/ui/window.vala" + return result; +#line 863 "window.c" +} + +static gpointer +_g_object_ref0 (gpointer self) +{ +#line 20 "../src/ui/window.vala" + return self ? g_object_ref (self) : NULL; +#line 871 "window.c" +} + +static void +ui_window_set_song (UiWindow* self, + PlaybinSong* value) +{ + PlaybinSong* old_value; +#line 20 "../src/ui/window.vala" + g_return_if_fail (self != NULL); +#line 20 "../src/ui/window.vala" + old_value = ui_window_get_song (self); +#line 20 "../src/ui/window.vala" + if (old_value != value) { +#line 885 "window.c" + PlaybinSong* _tmp0_; +#line 20 "../src/ui/window.vala" + _tmp0_ = _g_object_ref0 (value); +#line 20 "../src/ui/window.vala" + _g_object_unref0 (self->priv->_song); +#line 20 "../src/ui/window.vala" + self->priv->_song = _tmp0_; +#line 20 "../src/ui/window.vala" + g_object_notify_by_pspec ((GObject *) self, ui_window_properties[UI_WINDOW_SONG_PROPERTY]); +#line 895 "window.c" + } +} + +GdkPaintable* +ui_window_get_playing_cover_art (UiWindow* self) +{ + GdkPaintable* result; + GdkPaintable* _tmp0_; +#line 21 "../src/ui/window.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 21 "../src/ui/window.vala" + _tmp0_ = self->priv->_playing_cover_art; +#line 21 "../src/ui/window.vala" + result = _tmp0_; +#line 21 "../src/ui/window.vala" + return result; +#line 912 "window.c" +} + +void +ui_window_set_playing_cover_art (UiWindow* self, + GdkPaintable* value) +{ + GdkPaintable* old_value; +#line 21 "../src/ui/window.vala" + g_return_if_fail (self != NULL); +#line 21 "../src/ui/window.vala" + old_value = ui_window_get_playing_cover_art (self); +#line 21 "../src/ui/window.vala" + if (old_value != value) { +#line 926 "window.c" + GdkPaintable* _tmp0_; +#line 21 "../src/ui/window.vala" + _tmp0_ = _g_object_ref0 (value); +#line 21 "../src/ui/window.vala" + _g_object_unref0 (self->priv->_playing_cover_art); +#line 21 "../src/ui/window.vala" + self->priv->_playing_cover_art = _tmp0_; +#line 21 "../src/ui/window.vala" + g_object_notify_by_pspec ((GObject *) self, ui_window_properties[UI_WINDOW_PLAYING_COVER_ART_PROPERTY]); +#line 936 "window.c" + } +} + +gboolean +ui_window_get_cover_art_loading (UiWindow* self) +{ + gboolean result; +#line 24 "../src/ui/window.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 24 "../src/ui/window.vala" + result = self->priv->_cover_art_loading; +#line 24 "../src/ui/window.vala" + return result; +#line 950 "window.c" +} + +void +ui_window_set_cover_art_loading (UiWindow* self, + gboolean value) +{ + gboolean old_value; +#line 24 "../src/ui/window.vala" + g_return_if_fail (self != NULL); +#line 24 "../src/ui/window.vala" + old_value = ui_window_get_cover_art_loading (self); +#line 24 "../src/ui/window.vala" + if (old_value != value) { +#line 24 "../src/ui/window.vala" + self->priv->_cover_art_loading = value; +#line 24 "../src/ui/window.vala" + g_object_notify_by_pspec ((GObject *) self, ui_window_properties[UI_WINDOW_COVER_ART_LOADING_PROPERTY]); +#line 968 "window.c" + } +} + +Playbin* +ui_window_get_playbin (UiWindow* self) +{ + Playbin* result; + Playbin* _tmp0_; +#line 26 "../src/ui/window.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 26 "../src/ui/window.vala" + _tmp0_ = self->priv->_playbin; +#line 26 "../src/ui/window.vala" + result = _tmp0_; +#line 26 "../src/ui/window.vala" + return result; +#line 985 "window.c" +} + +static void +ui_window_set_playbin (UiWindow* self, + Playbin* value) +{ + Playbin* old_value; +#line 26 "../src/ui/window.vala" + g_return_if_fail (self != NULL); +#line 26 "../src/ui/window.vala" + old_value = ui_window_get_playbin (self); +#line 26 "../src/ui/window.vala" + if (old_value != value) { +#line 999 "window.c" + Playbin* _tmp0_; +#line 26 "../src/ui/window.vala" + _tmp0_ = _g_object_ref0 (value); +#line 26 "../src/ui/window.vala" + _g_object_unref0 (self->priv->_playbin); +#line 26 "../src/ui/window.vala" + self->priv->_playbin = _tmp0_; +#line 26 "../src/ui/window.vala" + g_object_notify_by_pspec ((GObject *) self, ui_window_properties[UI_WINDOW_PLAYBIN_PROPERTY]); +#line 1009 "window.c" + } +} + +gboolean +ui_window_get_can_click_shuffle_all (UiWindow* self) +{ + gboolean result; +#line 104 "../src/ui/window.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 104 "../src/ui/window.vala" + result = self->priv->_can_click_shuffle_all; +#line 104 "../src/ui/window.vala" + return result; +#line 1023 "window.c" +} + +static void +ui_window_set_can_click_shuffle_all (UiWindow* self, + gboolean value) +{ + gboolean old_value; +#line 104 "../src/ui/window.vala" + g_return_if_fail (self != NULL); +#line 104 "../src/ui/window.vala" + old_value = ui_window_get_can_click_shuffle_all (self); +#line 104 "../src/ui/window.vala" + if (old_value != value) { +#line 104 "../src/ui/window.vala" + self->priv->_can_click_shuffle_all = value; +#line 104 "../src/ui/window.vala" + g_object_notify_by_pspec ((GObject *) self, ui_window_properties[UI_WINDOW_CAN_CLICK_SHUFFLE_ALL_PROPERTY]); +#line 1041 "window.c" + } +} + +static void +_ui_window___lambda29_ (UiWindow* self, + GDBusConnection* conn) +{ + GError* _inner_error0_ = NULL; +#line 66 "../src/ui/window.vala" + g_return_if_fail (conn != NULL); +#line 1052 "window.c" + { + Mpris* _tmp0_; + Playbin* _tmp1_; + MprisPlayer* _tmp2_; + Mpris* _tmp3_; + MprisPlayer* _tmp4_; +#line 68 "../src/ui/window.vala" + _tmp0_ = mpris_new (self); +#line 68 "../src/ui/window.vala" + _g_object_unref0 (self->priv->mpris); +#line 68 "../src/ui/window.vala" + self->priv->mpris = _tmp0_; +#line 69 "../src/ui/window.vala" + _tmp1_ = self->priv->_playbin; +#line 69 "../src/ui/window.vala" + _tmp2_ = mpris_player_new (conn, _tmp1_); +#line 69 "../src/ui/window.vala" + _g_object_unref0 (self->priv->mpris_player); +#line 69 "../src/ui/window.vala" + self->priv->mpris_player = _tmp2_; +#line 71 "../src/ui/window.vala" + _tmp3_ = self->priv->mpris; +#line 71 "../src/ui/window.vala" + mpris_register_object (_tmp3_, conn, "/org/mpris/MediaPlayer2", &_inner_error0_); +#line 71 "../src/ui/window.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 71 "../src/ui/window.vala" + if (_inner_error0_->domain == G_IO_ERROR) { +#line 1081 "window.c" + goto __catch0_g_io_error; + } +#line 71 "../src/ui/window.vala" + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); +#line 71 "../src/ui/window.vala" + g_clear_error (&_inner_error0_); +#line 71 "../src/ui/window.vala" + return; +#line 1090 "window.c" + } +#line 72 "../src/ui/window.vala" + _tmp4_ = self->priv->mpris_player; +#line 72 "../src/ui/window.vala" + mpris_player_register_object (_tmp4_, conn, "/org/mpris/MediaPlayer2", &_inner_error0_); +#line 72 "../src/ui/window.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 72 "../src/ui/window.vala" + if (_inner_error0_->domain == G_IO_ERROR) { +#line 1100 "window.c" + goto __catch0_g_io_error; + } +#line 72 "../src/ui/window.vala" + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); +#line 72 "../src/ui/window.vala" + g_clear_error (&_inner_error0_); +#line 72 "../src/ui/window.vala" + return; +#line 1109 "window.c" + } + } + goto __finally0; + __catch0_g_io_error: + { + GError* e = NULL; + GError* _tmp5_; + const gchar* _tmp6_; +#line 67 "../src/ui/window.vala" + e = _inner_error0_; +#line 67 "../src/ui/window.vala" + _inner_error0_ = NULL; +#line 74 "../src/ui/window.vala" + _tmp5_ = e; +#line 74 "../src/ui/window.vala" + _tmp6_ = _tmp5_->message; +#line 74 "../src/ui/window.vala" + g_error ("window.vala:74: could not register dbus service: %s", _tmp6_); +#line 67 "../src/ui/window.vala" + _g_error_free0 (e); +#line 1130 "window.c" + } + __finally0: +#line 67 "../src/ui/window.vala" + if (G_UNLIKELY (_inner_error0_ != NULL)) { +#line 67 "../src/ui/window.vala" + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); +#line 67 "../src/ui/window.vala" + g_clear_error (&_inner_error0_); +#line 67 "../src/ui/window.vala" + return; +#line 1141 "window.c" + } +} + +static void +__ui_window___lambda29__gbus_acquired_callback (GDBusConnection* connection, + const gchar* name, + gpointer self) +{ +#line 62 "../src/ui/window.vala" + _ui_window___lambda29_ ((UiWindow*) self, connection); +#line 1152 "window.c" +} + +static void +_ui_window___lambda30_ (UiWindow* self) +{ +} + +static void +__ui_window___lambda30__gbus_name_acquired_callback (GDBusConnection* connection, + const gchar* name, + gpointer self) +{ +#line 62 "../src/ui/window.vala" + _ui_window___lambda30_ ((UiWindow*) self); +#line 1167 "window.c" +} + +static void +_ui_window___lambda31_ (UiWindow* self) +{ +#line 78 "../src/ui/window.vala" + g_error ("window.vala:78: could not acquire dbus name"); +#line 1175 "window.c" +} + +static void +__ui_window___lambda31__gbus_name_lost_callback (GDBusConnection* connection, + const gchar* name, + gpointer self) +{ +#line 62 "../src/ui/window.vala" + _ui_window___lambda31_ ((UiWindow*) self); +#line 1185 "window.c" +} + +static void +_ui_window___lambda32_ (UiWindow* self, + SubsonicClient* api) +{ + SubsonicClient* _tmp0_; + Playbin* _tmp1_; + MprisPlayer* _tmp2_; +#line 82 "../src/ui/window.vala" + g_return_if_fail (api != NULL); +#line 83 "../src/ui/window.vala" + _tmp0_ = _g_object_ref0 (api); +#line 83 "../src/ui/window.vala" + _g_object_unref0 (self->priv->api); +#line 83 "../src/ui/window.vala" + self->priv->api = _tmp0_; +#line 84 "../src/ui/window.vala" + _tmp1_ = self->priv->_playbin; +#line 84 "../src/ui/window.vala" + playbin_set_api (_tmp1_, api); +#line 85 "../src/ui/window.vala" + _tmp2_ = self->priv->mpris_player; +#line 85 "../src/ui/window.vala" + mpris_player_set_api (_tmp2_, api); +#line 86 "../src/ui/window.vala" + ui_window_set_can_click_shuffle_all (self, TRUE); +#line 1213 "window.c" +} + +static void +__ui_window___lambda32__ui_setup_connected (UiSetup* _sender, + SubsonicClient* api, + gpointer self) +{ +#line 82 "../src/ui/window.vala" + _ui_window___lambda32_ ((UiWindow*) self, api); +#line 1223 "window.c" +} + +static void +_ui_window___lambda33_ (UiWindow* self) +{ + Playbin* _tmp0_; + GListModel* _tmp1_; + GListModel* _tmp2_; + Playbin* _tmp3_; + gint _tmp4_; + gint _tmp5_; + GObject* _tmp6_; + PlaybinSong* _tmp7_; + PlaybinSong* _tmp8_; +#line 91 "../src/ui/window.vala" + _tmp0_ = self->priv->_playbin; +#line 91 "../src/ui/window.vala" + _tmp1_ = playbin_get_play_queue (_tmp0_); +#line 91 "../src/ui/window.vala" + _tmp2_ = _tmp1_; +#line 91 "../src/ui/window.vala" + _tmp3_ = self->priv->_playbin; +#line 91 "../src/ui/window.vala" + _tmp4_ = playbin_get_play_queue_position (_tmp3_); +#line 91 "../src/ui/window.vala" + _tmp5_ = _tmp4_; +#line 91 "../src/ui/window.vala" + _tmp6_ = g_list_model_get_item (_tmp2_, (guint) _tmp5_); +#line 91 "../src/ui/window.vala" + _tmp7_ = IS_PLAYBIN_SONG (_tmp6_) ? ((PlaybinSong*) _tmp6_) : NULL; +#line 91 "../src/ui/window.vala" + if (_tmp7_ == NULL) { +#line 91 "../src/ui/window.vala" + _g_object_unref0 (_tmp6_); +#line 1258 "window.c" + } +#line 91 "../src/ui/window.vala" + _tmp8_ = _tmp7_; +#line 91 "../src/ui/window.vala" + ui_window_now_playing (self, _tmp8_); +#line 91 "../src/ui/window.vala" + _g_object_unref0 (_tmp8_); +#line 1266 "window.c" +} + +static void +__ui_window___lambda33__playbin_new_track (Playbin* _sender, + gpointer self) +{ +#line 90 "../src/ui/window.vala" + _ui_window___lambda33_ ((UiWindow*) self); +#line 1275 "window.c" +} + +static void +_ui_window___lambda34_ (UiWindow* self) +{ +#line 95 "../src/ui/window.vala" + ui_window_set_playing_cover_art (self, NULL); +#line 96 "../src/ui/window.vala" + ui_window_set_song (self, NULL); +#line 1285 "window.c" +} + +static void +__ui_window___lambda34__playbin_stopped (Playbin* _sender, + gpointer self) +{ +#line 94 "../src/ui/window.vala" + _ui_window___lambda34_ ((UiWindow*) self); +#line 1294 "window.c" +} + +static GObject * +ui_window_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam * construct_properties) +{ + GObject * obj; + GObjectClass * parent_class; + UiWindow * self; + UiSetup* _tmp0_; + UiSetup* _tmp1_; + UiSetup* _tmp2_; + Playbin* _tmp3_; + Playbin* _tmp4_; +#line 61 "../src/ui/window.vala" + parent_class = G_OBJECT_CLASS (ui_window_parent_class); +#line 61 "../src/ui/window.vala" + obj = parent_class->constructor (type, n_construct_properties, construct_properties); +#line 61 "../src/ui/window.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, UI_TYPE_WINDOW, UiWindow); +#line 62 "../src/ui/window.vala" + g_bus_own_name_with_closures (G_BUS_TYPE_SESSION, "org.mpris.MediaPlayer2.audrey", G_BUS_NAME_OWNER_FLAGS_NONE, (GClosure*) ((__ui_window___lambda29__gbus_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) __ui_window___lambda29__gbus_acquired_callback, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((__ui_window___lambda30__gbus_name_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) __ui_window___lambda30__gbus_name_acquired_callback, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((__ui_window___lambda31__gbus_name_lost_callback == NULL) ? NULL : g_cclosure_new ((GCallback) __ui_window___lambda31__gbus_name_lost_callback, g_object_ref (self), (GClosureNotify) g_object_unref))); +#line 80 "../src/ui/window.vala" + _tmp0_ = ui_setup_new (); +#line 80 "../src/ui/window.vala" + g_object_ref_sink (_tmp0_); +#line 80 "../src/ui/window.vala" + _g_object_unref0 (self->priv->setup); +#line 80 "../src/ui/window.vala" + self->priv->setup = _tmp0_; +#line 82 "../src/ui/window.vala" + _tmp1_ = self->priv->setup; +#line 82 "../src/ui/window.vala" + g_signal_connect_object (_tmp1_, "connected", (GCallback) __ui_window___lambda32__ui_setup_connected, self, 0); +#line 88 "../src/ui/window.vala" + _tmp2_ = self->priv->setup; +#line 88 "../src/ui/window.vala" + ui_setup_load (_tmp2_); +#line 90 "../src/ui/window.vala" + _tmp3_ = self->priv->_playbin; +#line 90 "../src/ui/window.vala" + g_signal_connect_object (_tmp3_, "new-track", (GCallback) __ui_window___lambda33__playbin_new_track, self, 0); +#line 94 "../src/ui/window.vala" + _tmp4_ = self->priv->_playbin; +#line 94 "../src/ui/window.vala" + g_signal_connect_object (_tmp4_, "stopped", (GCallback) __ui_window___lambda34__playbin_stopped, self, 0); +#line 61 "../src/ui/window.vala" + return obj; +#line 1344 "window.c" +} + +static void +ui_window_class_init (UiWindowClass * klass, + gpointer klass_data) +{ +#line 2 "../src/ui/window.vala" + ui_window_parent_class = g_type_class_peek_parent (klass); +#line 2 "../src/ui/window.vala" + g_type_class_adjust_private_offset (klass, &UiWindow_private_offset); +#line 2 "../src/ui/window.vala" + ((GtkWindowClass *) klass)->close_request = (gboolean (*) (GtkWindow*)) ui_window_real_close_request; +#line 2 "../src/ui/window.vala" + G_OBJECT_CLASS (klass)->get_property = _vala_ui_window_get_property; +#line 2 "../src/ui/window.vala" + G_OBJECT_CLASS (klass)->set_property = _vala_ui_window_set_property; +#line 2 "../src/ui/window.vala" + G_OBJECT_CLASS (klass)->constructor = ui_window_constructor; +#line 2 "../src/ui/window.vala" + G_OBJECT_CLASS (klass)->finalize = ui_window_finalize; +#line 2 "../src/ui/window.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_WINDOW_VOLUME_PROPERTY, ui_window_properties[UI_WINDOW_VOLUME_PROPERTY] = g_param_spec_int ("volume", "volume", "volume", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 2 "../src/ui/window.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_WINDOW_MUTE_PROPERTY, ui_window_properties[UI_WINDOW_MUTE_PROPERTY] = g_param_spec_boolean ("mute", "mute", "mute", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 2 "../src/ui/window.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_WINDOW_SONG_PROPERTY, ui_window_properties[UI_WINDOW_SONG_PROPERTY] = g_param_spec_object ("song", "song", "song", TYPE_PLAYBIN_SONG, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 2 "../src/ui/window.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_WINDOW_PLAYING_COVER_ART_PROPERTY, ui_window_properties[UI_WINDOW_PLAYING_COVER_ART_PROPERTY] = g_param_spec_object ("playing-cover-art", "playing-cover-art", "playing-cover-art", gdk_paintable_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 2 "../src/ui/window.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_WINDOW_COVER_ART_LOADING_PROPERTY, ui_window_properties[UI_WINDOW_COVER_ART_LOADING_PROPERTY] = g_param_spec_boolean ("cover-art-loading", "cover-art-loading", "cover-art-loading", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 2 "../src/ui/window.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_WINDOW_PLAYBIN_PROPERTY, ui_window_properties[UI_WINDOW_PLAYBIN_PROPERTY] = g_param_spec_object ("playbin", "playbin", "playbin", TYPE_PLAYBIN, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 2 "../src/ui/window.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), UI_WINDOW_CAN_CLICK_SHUFFLE_ALL_PROPERTY, ui_window_properties[UI_WINDOW_CAN_CLICK_SHUFFLE_ALL_PROPERTY] = g_param_spec_boolean ("can-click-shuffle-all", "can-click-shuffle-all", "can-click-shuffle-all", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); +#line 2 "../src/ui/window.vala" + gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/eu/callcc/audrey/ui/window.ui"); +#line 2 "../src/ui/window.vala" + gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "play_queue", FALSE, G_STRUCT_OFFSET (UiWindow, play_queue)); +#line 2 "../src/ui/window.vala" + gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "playbar", FALSE, G_STRUCT_OFFSET (UiWindow, playbar)); +#line 2 "../src/ui/window.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "show_setup_dialog", G_CALLBACK(_ui_window_show_setup_dialog_gtk_button_clicked)); +#line 2 "../src/ui/window.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "shuffle_all", G_CALLBACK(_ui_window_shuffle_all_gtk_button_clicked)); +#line 2 "../src/ui/window.vala" + gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "show_playbar_cover_art", G_CALLBACK(ui_window_show_playbar_cover_art)); +#line 1391 "window.c" +} + +static void +ui_window_instance_init (UiWindow * self, + gpointer klass) +{ + Playbin* _tmp0_; +#line 2 "../src/ui/window.vala" + self->priv = ui_window_get_instance_private (self); +#line 21 "../src/ui/window.vala" + self->priv->_playing_cover_art = NULL; +#line 24 "../src/ui/window.vala" + self->priv->_cover_art_loading = FALSE; +#line 26 "../src/ui/window.vala" + _tmp0_ = playbin_new (); +#line 26 "../src/ui/window.vala" + self->priv->_playbin = _tmp0_; +#line 104 "../src/ui/window.vala" + self->priv->_can_click_shuffle_all = FALSE; +#line 2 "../src/ui/window.vala" + g_type_ensure (UI_TYPE_PLAY_QUEUE); +#line 2 "../src/ui/window.vala" + g_type_ensure (UI_TYPE_PLAYBAR); +#line 2 "../src/ui/window.vala" + gtk_widget_init_template (GTK_WIDGET (self)); +#line 1417 "window.c" +} + +static void +ui_window_finalize (GObject * obj) +{ + UiWindow * self; +#line 2 "../src/ui/window.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, UI_TYPE_WINDOW, UiWindow); +#line 134 "../src/ui/window.vala" + g_debug ("window.vala:134: destroying main window"); +#line 7 "../src/ui/window.vala" + _g_object_unref0 (self->priv->setup); +#line 9 "../src/ui/window.vala" + _g_object_unref0 (self->priv->api); +#line 20 "../src/ui/window.vala" + _g_object_unref0 (self->priv->_song); +#line 21 "../src/ui/window.vala" + _g_object_unref0 (self->priv->_playing_cover_art); +#line 23 "../src/ui/window.vala" + _g_object_unref0 (self->priv->cancel_loading_art); +#line 26 "../src/ui/window.vala" + _g_object_unref0 (self->priv->_playbin); +#line 32 "../src/ui/window.vala" + _g_object_unref0 (self->priv->mpris); +#line 33 "../src/ui/window.vala" + _g_object_unref0 (self->priv->mpris_player); +#line 2 "../src/ui/window.vala" + G_OBJECT_CLASS (ui_window_parent_class)->finalize (obj); +#line 1446 "window.c" +} + +static GType +ui_window_get_type_once (void) +{ + static const GTypeInfo g_define_type_info = { sizeof (UiWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ui_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UiWindow), 0, (GInstanceInitFunc) ui_window_instance_init, NULL }; + GType ui_window_type_id; + ui_window_type_id = g_type_register_static (adw_application_window_get_type (), "UiWindow", &g_define_type_info, 0); + UiWindow_private_offset = g_type_add_instance_private (ui_window_type_id, sizeof (UiWindowPrivate)); + return ui_window_type_id; +} + +GType +ui_window_get_type (void) +{ + static volatile gsize ui_window_type_id__once = 0; + if (g_once_init_enter (&ui_window_type_id__once)) { + GType ui_window_type_id; + ui_window_type_id = ui_window_get_type_once (); + g_once_init_leave (&ui_window_type_id__once, ui_window_type_id); + } + return ui_window_type_id__once; +} + +static void +_vala_ui_window_get_property (GObject * object, + guint property_id, + GValue * value, + GParamSpec * pspec) +{ + UiWindow * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, UI_TYPE_WINDOW, UiWindow); +#line 2 "../src/ui/window.vala" + switch (property_id) { +#line 2 "../src/ui/window.vala" + case UI_WINDOW_VOLUME_PROPERTY: +#line 2 "../src/ui/window.vala" + g_value_set_int (value, ui_window_get_volume (self)); +#line 2 "../src/ui/window.vala" + break; +#line 2 "../src/ui/window.vala" + case UI_WINDOW_MUTE_PROPERTY: +#line 2 "../src/ui/window.vala" + g_value_set_boolean (value, ui_window_get_mute (self)); +#line 2 "../src/ui/window.vala" + break; +#line 2 "../src/ui/window.vala" + case UI_WINDOW_SONG_PROPERTY: +#line 2 "../src/ui/window.vala" + g_value_set_object (value, ui_window_get_song (self)); +#line 2 "../src/ui/window.vala" + break; +#line 2 "../src/ui/window.vala" + case UI_WINDOW_PLAYING_COVER_ART_PROPERTY: +#line 2 "../src/ui/window.vala" + g_value_set_object (value, ui_window_get_playing_cover_art (self)); +#line 2 "../src/ui/window.vala" + break; +#line 2 "../src/ui/window.vala" + case UI_WINDOW_COVER_ART_LOADING_PROPERTY: +#line 2 "../src/ui/window.vala" + g_value_set_boolean (value, ui_window_get_cover_art_loading (self)); +#line 2 "../src/ui/window.vala" + break; +#line 2 "../src/ui/window.vala" + case UI_WINDOW_PLAYBIN_PROPERTY: +#line 2 "../src/ui/window.vala" + g_value_set_object (value, ui_window_get_playbin (self)); +#line 2 "../src/ui/window.vala" + break; +#line 2 "../src/ui/window.vala" + case UI_WINDOW_CAN_CLICK_SHUFFLE_ALL_PROPERTY: +#line 2 "../src/ui/window.vala" + g_value_set_boolean (value, ui_window_get_can_click_shuffle_all (self)); +#line 2 "../src/ui/window.vala" + break; +#line 1523 "window.c" + default: +#line 2 "../src/ui/window.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 2 "../src/ui/window.vala" + break; +#line 1529 "window.c" + } +} + +static void +_vala_ui_window_set_property (GObject * object, + guint property_id, + const GValue * value, + GParamSpec * pspec) +{ + UiWindow * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, UI_TYPE_WINDOW, UiWindow); +#line 2 "../src/ui/window.vala" + switch (property_id) { +#line 2 "../src/ui/window.vala" + case UI_WINDOW_VOLUME_PROPERTY: +#line 2 "../src/ui/window.vala" + ui_window_set_volume (self, g_value_get_int (value)); +#line 2 "../src/ui/window.vala" + break; +#line 2 "../src/ui/window.vala" + case UI_WINDOW_MUTE_PROPERTY: +#line 2 "../src/ui/window.vala" + ui_window_set_mute (self, g_value_get_boolean (value)); +#line 2 "../src/ui/window.vala" + break; +#line 2 "../src/ui/window.vala" + case UI_WINDOW_SONG_PROPERTY: +#line 2 "../src/ui/window.vala" + ui_window_set_song (self, g_value_get_object (value)); +#line 2 "../src/ui/window.vala" + break; +#line 2 "../src/ui/window.vala" + case UI_WINDOW_PLAYING_COVER_ART_PROPERTY: +#line 2 "../src/ui/window.vala" + ui_window_set_playing_cover_art (self, g_value_get_object (value)); +#line 2 "../src/ui/window.vala" + break; +#line 2 "../src/ui/window.vala" + case UI_WINDOW_COVER_ART_LOADING_PROPERTY: +#line 2 "../src/ui/window.vala" + ui_window_set_cover_art_loading (self, g_value_get_boolean (value)); +#line 2 "../src/ui/window.vala" + break; +#line 2 "../src/ui/window.vala" + case UI_WINDOW_PLAYBIN_PROPERTY: +#line 2 "../src/ui/window.vala" + ui_window_set_playbin (self, g_value_get_object (value)); +#line 2 "../src/ui/window.vala" + break; +#line 2 "../src/ui/window.vala" + case UI_WINDOW_CAN_CLICK_SHUFFLE_ALL_PROPERTY: +#line 2 "../src/ui/window.vala" + ui_window_set_can_click_shuffle_all (self, g_value_get_boolean (value)); +#line 2 "../src/ui/window.vala" + break; +#line 1585 "window.c" + default: +#line 2 "../src/ui/window.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 2 "../src/ui/window.vala" + break; +#line 1591 "window.c" + } +} + diff --git a/src/ui/window.vala b/src/ui/window.vala deleted file mode 100644 index 40c0359..0000000 --- a/src/ui/window.vala +++ /dev/null @@ -1,136 +0,0 @@ -[GtkTemplate (ui = "/eu/callcc/audrey/ui/window.ui")] -class Ui.Window : Adw.ApplicationWindow { - [GtkChild] public unowned Ui.PlayQueue play_queue; - [GtkChild] public unowned Ui.Playbar playbar; - //[GtkChild] public unowned Adw.ButtonRow shuffle_all_tracks; - - private Setup setup; - - private Subsonic.Client api; - - public int volume { - get { return this.playbin.volume; } - set { this.playbin.volume = value; } - } - public bool mute { - get { return this.playbin.mute; } - set { this.playbin.mute = value; } - } - - public PlaybinSong? song { get; private set; } - public Gdk.Paintable? playing_cover_art { get; set; default = null; } - - private Cancellable cancel_loading_art; - public bool cover_art_loading { get; set; default = false; } - - public Playbin playbin { get; private set; default = new Playbin (); } - - public Window (Gtk.Application app) { - Object (application: app); - } - - private Mpris mpris; - private MprisPlayer mpris_player; - - private void now_playing (PlaybinSong song) { - this.song = song; - // api.scrobble.begin (this.song.id); TODO - - if (this.cancel_loading_art != null) { - this.cancel_loading_art.cancel (); - } - this.cancel_loading_art = new GLib.Cancellable (); - - this.playing_cover_art = null; // TODO: preload next art somehow - this.cover_art_loading = true; - - string song_id = this.song.id; - this.api.cover_art.begin (song_id, -1, Priority.DEFAULT, this.cancel_loading_art, (obj, res) => { - try { - this.playing_cover_art = Gdk.Texture.for_pixbuf (this.api.cover_art.end (res)); - this.cover_art_loading = false; - } catch (Error e) { - if (!(e is IOError.CANCELLED)) { - warning ("could not load cover for %s: %s", song_id, e.message); - this.cover_art_loading = false; - } - } - }); - } - - construct { - Bus.own_name ( - BusType.SESSION, - "org.mpris.MediaPlayer2.audrey", - BusNameOwnerFlags.NONE, - (conn) => { - try { - this.mpris = new Mpris (this); - this.mpris_player = new MprisPlayer (conn, this.playbin); - - conn.register_object ("/org/mpris/MediaPlayer2", this.mpris); - conn.register_object ("/org/mpris/MediaPlayer2", this.mpris_player); - } catch (IOError e) { - error ("could not register dbus service: %s", e.message); - } - }, - () => {}, - () => { error ("could not acquire dbus name"); }); - - this.setup = new Setup (); - - this.setup.connected.connect ((api) => { - this.api = api; - this.playbin.api = api; - this.mpris_player.api = api; - this.can_click_shuffle_all = true; - }); - this.setup.load (); - - this.playbin.new_track.connect (() => { - this.now_playing (this.playbin.play_queue.get_item (this.playbin.play_queue_position) as PlaybinSong); - }); - - this.playbin.stopped.connect (() => { - this.playing_cover_art = null; - this.song = null; - }); - } - - [GtkCallback] private void show_setup_dialog () { - this.setup.present (this); - } - - public bool can_click_shuffle_all { get; private set; default = false; } - - [GtkCallback] private void shuffle_all () { - this.can_click_shuffle_all = false; - this.playbin.clear (); - api.get_random_songs.begin (null, (song) => { - this.playbin.append_track (song); - }, (obj, res) => { - try { - api.get_random_songs.end (res); - } catch (Error e) { - error ("could not get random songs: %s", e.message); - } - this.can_click_shuffle_all = true; - - this.playbin.select_track (0); - }); - } - - [GtkCallback] private bool show_playbar_cover_art (string? stack_child) { - return stack_child != "play-queue"; - } - - public override bool close_request () { - // stop playback on close - this.playbin.stop (); - return false; - } - - ~Window () { - debug ("destroying main window"); - } -} diff --git a/src/vapi/libgcrypt.vapi b/src/vapi/libgcrypt.vapi deleted file mode 100644 index a5fe7e7..0000000 --- a/src/vapi/libgcrypt.vapi +++ /dev/null @@ -1,829 +0,0 @@ -/* gcrypt.vapi - * - * Copyright: - * 2008 Jiqing Qiang - * 2008, 2010, 2012-2013 Evan Nemerson - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: - * Jiqing Qiang - * Evan Nemerson - */ - - -[CCode (cheader_filename = "gcrypt.h", lower_case_cprefix = "gcry_")] -namespace GCrypt { - [CCode (cname = "gpg_err_source_t", cprefix = "GPG_ERR_SOURCE_")] - public enum ErrorSource { - UNKNOWN, - GCRYPT, - GPG, - GPGSM, - GPGAGENT, - PINENTRY, - SCD, - GPGME, - KEYBOX, - KSBA, - DIRMNGR, - GSTI, - ANY, - USER_1, - USER_2, - USER_3, - USER_4, - - /* This is one more than the largest allowed entry. */ - DIM - } - - [CCode (cname = "gpg_err_code_t", cprefix = "GPG_ERR_")] - public enum ErrorCode { - NO_ERROR, - GENERAL, - UNKNOWN_PACKET, - UNKNOWN_VERSION, - PUBKEY_ALGO, - DIGEST_ALGO, - BAD_PUBKEY, - BAD_SECKEY, - BAD_SIGNATURE, - NO_PUBKEY, - CHECKSUM, - BAD_PASSPHRASE, - CIPHER_ALGO, - KEYRING_OPEN, - INV_PACKET, - INV_ARMOR, - NO_USER_ID, - NO_SECKEY, - WRONG_SECKEY, - BAD_KEY, - COMPR_ALGO, - NO_PRIME, - NO_ENCODING_METHOD, - NO_ENCRYPTION_SCHEME, - NO_SIGNATURE_SCHEME, - INV_ATTR, - NO_VALUE, - NOT_FOUND, - VALUE_NOT_FOUND, - SYNTAX, - BAD_MPI, - INV_PASSPHRASE, - SIG_CLASS, - RESOURCE_LIMIT, - INV_KEYRING, - TRUSTDB, - BAD_CERT, - INV_USER_ID, - UNEXPECTED, - TIME_CONFLICT, - KEYSERVER, - WRONG_PUBKEY_ALGO, - TRIBUTE_TO_D_A, - WEAK_KEY, - INV_KEYLEN, - INV_ARG, - BAD_URI, - INV_URI, - NETWORK, - UNKNOWN_HOST, - SELFTEST_FAILED, - NOT_ENCRYPTED, - NOT_PROCESSED, - UNUSABLE_PUBKEY, - UNUSABLE_SECKEY, - INV_VALUE, - BAD_CERT_CHAIN, - MISSING_CERT, - NO_DATA, - BUG, - NOT_SUPPORTED, - INV_OP, - TIMEOUT, - INTERNAL, - EOF_GCRYPT, - INV_OBJ, - TOO_SHORT, - TOO_LARGE, - NO_OBJ, - NOT_IMPLEMENTED, - CONFLICT, - INV_CIPHER_MODE, - INV_FLAG, - INV_HANDLE, - TRUNCATED, - INCOMPLETE_LINE, - INV_RESPONSE, - NO_AGENT, - AGENT, - INV_DATA, - ASSUAN_SERVER_FAULT, - ASSUAN, - INV_SESSION_KEY, - INV_SEXP, - UNSUPPORTED_ALGORITHM, - NO_PIN_ENTRY, - PIN_ENTRY, - BAD_PIN, - INV_NAME, - BAD_DATA, - INV_PARAMETER, - WRONG_CARD, - NO_DIRMNGR, - DIRMNGR, - CERT_REVOKED, - NO_CRL_KNOWN, - CRL_TOO_OLD, - LINE_TOO_LONG, - NOT_TRUSTED, - CANCELED, - BAD_CA_CERT, - CERT_EXPIRED, - CERT_TOO_YOUNG, - UNSUPPORTED_CERT, - UNKNOWN_SEXP, - UNSUPPORTED_PROTECTION, - CORRUPTED_PROTECTION, - AMBIGUOUS_NAME, - CARD, - CARD_RESET, - CARD_REMOVED, - INV_CARD, - CARD_NOT_PRESENT, - NO_PKCS15_APP, - NOT_CONFIRMED, - CONFIGURATION, - NO_POLICY_MATCH, - INV_INDEX, - INV_ID, - NO_SCDAEMON, - SCDAEMON, - UNSUPPORTED_PROTOCOL, - BAD_PIN_METHOD, - CARD_NOT_INITIALIZED, - UNSUPPORTED_OPERATION, - WRONG_KEY_USAGE, - NOTHING_FOUND, - WRONG_BLOB_TYPE, - MISSING_VALUE, - HARDWARE, - PIN_BLOCKED, - USE_CONDITIONS, - PIN_NOT_SYNCED, - INV_CRL, - BAD_BER, - INV_BER, - ELEMENT_NOT_FOUND, - IDENTIFIER_NOT_FOUND, - INV_TAG, - INV_LENGTH, - INV_KEYINFO, - UNEXPECTED_TAG, - NOT_DER_ENCODED, - NO_CMS_OBJ, - INV_CMS_OBJ, - UNKNOWN_CMS_OBJ, - UNSUPPORTED_CMS_OBJ, - UNSUPPORTED_ENCODING, - UNSUPPORTED_CMS_VERSION, - UNKNOWN_ALGORITHM, - INV_ENGINE, - PUBKEY_NOT_TRUSTED, - DECRYPT_FAILED, - KEY_EXPIRED, - SIG_EXPIRED, - ENCODING_PROBLEM, - INV_STATE, - DUP_VALUE, - MISSING_ACTION, - MODULE_NOT_FOUND, - INV_OID_STRING, - INV_TIME, - INV_CRL_OBJ, - UNSUPPORTED_CRL_VERSION, - INV_CERT_OBJ, - UNKNOWN_NAME, - LOCALE_PROBLEM, - NOT_LOCKED, - PROTOCOL_VIOLATION, - INV_MAC, - INV_REQUEST, - UNKNOWN_EXTN, - UNKNOWN_CRIT_EXTN, - LOCKED, - UNKNOWN_OPTION, - UNKNOWN_COMMAND, - BUFFER_TOO_SHORT, - SEXP_INV_LEN_SPEC, - SEXP_STRING_TOO_LONG, - SEXP_UNMATCHED_PAREN, - SEXP_NOT_CANONICAL, - SEXP_BAD_CHARACTER, - SEXP_BAD_QUOTATION, - SEXP_ZERO_PREFIX, - SEXP_NESTED_DH, - SEXP_UNMATCHED_DH, - SEXP_UNEXPECTED_PUNC, - SEXP_BAD_HEX_CHAR, - SEXP_ODD_HEX_NUMBERS, - SEXP_BAD_OCT_CHAR, - ASS_GENERAL, - ASS_ACCEPT_FAILED, - ASS_CONNECT_FAILED, - ASS_INV_RESPONSE, - ASS_INV_VALUE, - ASS_INCOMPLETE_LINE, - ASS_LINE_TOO_LONG, - ASS_NESTED_COMMANDS, - ASS_NO_DATA_CB, - ASS_NO_INQUIRE_CB, - ASS_NOT_A_SERVER, - ASS_NOT_A_CLIENT, - ASS_SERVER_START, - ASS_READ_ERROR, - ASS_WRITE_ERROR, - ASS_TOO_MUCH_DATA, - ASS_UNEXPECTED_CMD, - ASS_UNKNOWN_CMD, - ASS_SYNTAX, - ASS_CANCELED, - ASS_NO_INPUT, - ASS_NO_OUTPUT, - ASS_PARAMETER, - ASS_UNKNOWN_INQUIRE, - USER_1, - USER_2, - USER_3, - USER_4, - USER_5, - USER_6, - USER_7, - USER_8, - USER_9, - USER_10, - USER_11, - USER_12, - USER_13, - USER_14, - USER_15, - USER_16, - MISSING_ERRNO, - UNKNOWN_ERRNO, - EOF, - - E2BIG, - EACCES, - EADDRINUSE, - EADDRNOTAVAIL, - EADV, - EAFNOSUPPORT, - EAGAIN, - EALREADY, - EAUTH, - EBACKGROUND, - EBADE, - EBADF, - EBADFD, - EBADMSG, - EBADR, - EBADRPC, - EBADRQC, - EBADSLT, - EBFONT, - EBUSY, - ECANCELED, - ECHILD, - ECHRNG, - ECOMM, - ECONNABORTED, - ECONNREFUSED, - ECONNRESET, - ED, - EDEADLK, - EDEADLOCK, - EDESTADDRREQ, - EDIED, - EDOM, - EDOTDOT, - EDQUOT, - EEXIST, - EFAULT, - EFBIG, - EFTYPE, - EGRATUITOUS, - EGREGIOUS, - EHOSTDOWN, - EHOSTUNREACH, - EIDRM, - EIEIO, - EILSEQ, - EINPROGRESS, - EINTR, - EINVAL, - EIO, - EISCONN, - EISDIR, - EISNAM, - EL2HLT, - EL2NSYNC, - EL3HLT, - EL3RST, - ELIBACC, - ELIBBAD, - ELIBEXEC, - ELIBMAX, - ELIBSCN, - ELNRNG, - ELOOP, - EMEDIUMTYPE, - EMFILE, - EMLINK, - EMSGSIZE, - EMULTIHOP, - ENAMETOOLONG, - ENAVAIL, - ENEEDAUTH, - ENETDOWN, - ENETRESET, - ENETUNREACH, - ENFILE, - ENOANO, - ENOBUFS, - ENOCSI, - ENODATA, - ENODEV, - ENOENT, - ENOEXEC, - ENOLCK, - ENOLINK, - ENOMEDIUM, - ENOMEM, - ENOMSG, - ENONET, - ENOPKG, - ENOPROTOOPT, - ENOSPC, - ENOSR, - ENOSTR, - ENOSYS, - ENOTBLK, - ENOTCONN, - ENOTDIR, - ENOTEMPTY, - ENOTNAM, - ENOTSOCK, - ENOTSUP, - ENOTTY, - ENOTUNIQ, - ENXIO, - EOPNOTSUPP, - EOVERFLOW, - EPERM, - EPFNOSUPPORT, - EPIPE, - EPROCLIM, - EPROCUNAVAIL, - EPROGMISMATCH, - EPROGUNAVAIL, - EPROTO, - EPROTONOSUPPORT, - EPROTOTYPE, - ERANGE, - EREMCHG, - EREMOTE, - EREMOTEIO, - ERESTART, - EROFS, - ERPCMISMATCH, - ESHUTDOWN, - ESOCKTNOSUPPORT, - ESPIPE, - ESRCH, - ESRMNT, - ESTALE, - ESTRPIPE, - ETIME, - ETIMEDOUT, - ETOOMANYREFS, - ETXTBSY, - EUCLEAN, - EUNATCH, - EUSERS, - EWOULDBLOCK, - EXDEV, - EXFULL, - - /* This is one more than the largest allowed entry. */ - CODE_DIM - } - - [CCode (cname = "gcry_error_t", cprefix = "gpg_err_")] - public struct Error : uint { - [CCode (cname = "gcry_err_make")] - public Error (ErrorSource source, ErrorCode code); - [CCode (cname = "gcry_err_make_from_errno")] - public Error.from_errno (ErrorSource source, int err); - public ErrorCode code (); - public ErrorSource source (); - - [CCode (cname = "gcry_strerror")] - public unowned string to_string (); - - [CCode (cname = "gcry_strsource")] - public unowned string source_to_string (); - } - - [CCode (cname = "enum gcry_ctl_cmds", cprefix = "GCRYCTL_")] - public enum ControlCommand { - SET_KEY, - SET_IV, - CFB_SYNC, - RESET, - FINALIZE, - GET_KEYLEN, - GET_BLKLEN, - TEST_ALGO, - IS_SECURE, - GET_ASNOID, - ENABLE_ALGO, - DISABLE_ALGO, - DUMP_RANDOM_STATS, - DUMP_SECMEM_STATS, - GET_ALGO_NPKEY, - GET_ALGO_NSKEY, - GET_ALGO_NSIGN, - GET_ALGO_NENCR, - SET_VERBOSITY, - SET_DEBUG_FLAGS, - CLEAR_DEBUG_FLAGS, - USE_SECURE_RNDPOOL, - DUMP_MEMORY_STATS, - INIT_SECMEM, - TERM_SECMEM, - DISABLE_SECMEM_WARN, - SUSPEND_SECMEM_WARN, - RESUME_SECMEM_WARN, - DROP_PRIVS, - ENABLE_M_GUARD, - START_DUMP, - STOP_DUMP, - GET_ALGO_USAGE, - IS_ALGO_ENABLED, - DISABLE_INTERNAL_LOCKING, - DISABLE_SECMEM, - INITIALIZATION_FINISHED, - INITIALIZATION_FINISHED_P, - ANY_INITIALIZATION_P, - SET_CBC_CTS, - SET_CBC_MAC, - SET_CTR, - ENABLE_QUICK_RANDOM, - SET_RANDOM_SEED_FILE, - UPDATE_RANDOM_SEED_FILE, - SET_THREAD_CBS, - FAST_POLL - } - public Error control (ControlCommand cmd, ...); - - namespace Cipher { - [CCode (cname = "enum gcry_cipher_algos", cprefix = "GCRY_CIPHER_")] - public enum Algorithm { - NONE, - IDEA, - 3DES, - CAST5, - BLOWFISH, - SAFER_SK128, - DES_SK, - AES, - AES128, - RIJNDAEL, - RIJNDAEL128, - AES192, - RIJNDAEL192, - AES256, - RIJNDAEL256, - TWOFISH, - TWOFISH128, - ARCFOUR, - DES, - SERPENT128, - SERPENT192, - SERPENT256, - RFC2268_40, - RFC2268_128, - SEED, - CAMELLIA128, - CAMELLIA192, - CAMELLIA256, - SALSA20, - SALSA20R12, - GOST28147, - CHACHA20; - - [CCode (cname = "gcry_cipher_algo_info")] - public Error info (ControlCommand what, [CCode (array_length_type = "size_t")] ref uchar[] buffer); - [CCode (cname = "gcry_cipher_algo_name")] - public unowned string to_string (); - [CCode (cname = "gcry_cipher_map_name")] - public static Algorithm from_string (string name); - [CCode (cname = "gcry_cipher_map_oid")] - public static Algorithm from_oid (string oid); - } - - [CCode (cname = "enum gcry_cipher_modes", cprefix = "GCRY_CIPHER_MODE_")] - public enum Mode { - NONE, /* No mode specified */ - ECB, /* Electronic Codebook */ - CFB, /* Cipher Feedback */ - CFB8, /* Cipher Feedback */ - CBC, /* Cipher Block Chaining */ - STREAM, /* Used with stream ciphers */ - OFB, /* Output Feedback */ - CTR, /* Counter */ - AESWRAP, - CCM, /* Counter with CBC-MAC */ - GCM, /* Galois/Counter Mode */ - POLY1305, - OCB - } - - [CCode (cname = "enum gcry_cipher_flags", cprefix = "GCRY_CIPHER_")] - public enum Flag { - SECURE, /* Allocate in secure memory. */ - ENABLE_SYNC, /* Enable CFB sync mode. */ - CBC_CTS, /* Enable CBC cipher text stealing (CTS). */ - CBC_MAC /* Enable CBC message auth. code (MAC). */ - } - [Compact] - [CCode (cname = "struct gcry_cipher_handle", lower_case_cprefix = "gcry_cipher_", free_function = "gcry_cipher_close")] - public class Cipher { - public static Error open (out Cipher cipher, Algorithm algo, Mode mode, Flag flags); - public void close (); - [CCode (cname = "gcry_cipher_ctl")] - public Error control (ControlCommand cmd, [CCode (array_length_type = "size_t")] uchar[] buffer); - public Error info (ControlCommand what, [CCode (array_length_type = "size_t")] ref uchar[] buffer); - - public Error encrypt (uchar[] out_buffer, uchar[] in_buffer); - public Error decrypt (uchar[] out_buffer, uchar[] in_buffer); - - [CCode (cname = "gcry_cipher_setkey")] - public Error set_key (uchar[] key_data); - [CCode (cname = "gcry_cipher_setiv")] - public Error set_iv (uchar[] iv_data); - [CCode (cname = "gcry_cipher_setctr")] - public Error set_counter_vector (uchar[] counter_vector); - public Error reset (); - public Error sync (); - } - } - - [Compact, CCode (cname = "struct gcry_md_handle", cprefix = "gcry_md_", free_function = "gcry_md_close")] - public class Hash { - [CCode (cname = "enum gcry_md_algos", cprefix = "GCRY_MD_")] - public enum Algorithm { - NONE, - SHA1, - RMD160, - MD5, - MD4, - MD2, - TIGER, - TIGER1, - TIGER2, - HAVAL, - SHA224, - SHA256, - SHA384, - SHA512, - SHA3_224, - SHA3_256, - SHA3_384, - SHA3_512, - SHAKE128, - SHAKE256, - CRC32, - CRC32_RFC1510, - CRC24_RFC2440, - WHIRLPOOL, - GOSTR3411_94, - STRIBOG256, - STRIBOG512; - - [CCode (cname = "gcry_md_get_algo_dlen")] - public size_t get_digest_length (); - [CCode (cname = "gcry_md_algo_info")] - public Error info (ControlCommand what, [CCode (array_length_type = "size_t")] ref uchar[] buffer); - [CCode (cname = "gcry_md_algo_name")] - public unowned string to_string (); - [CCode (cname = "gcry_md_map_name")] - public static Algorithm from_string (string name); - [CCode (cname = "gcry_md_test_algo")] - public Error is_available (); - [CCode (cname = "gcry_md_get_asnoid")] - public Error get_oid ([CCode (array_length_type = "size_t")] ref uchar[] buffer); - } - - [CCode (cname = "enum gcry_md_flags", cprefix = "GCRY_MD_FLAG_")] - public enum Flag { - SECURE, - HMAC, - BUGEMU1 - } - - public static Error open (out Hash hash, Algorithm algo, Flag flag); - public void close (); - public Error enable (Algorithm algo); - [CCode (instance_pos = -1)] - public Error copy (out Hash dst); - public void reset (); - [CCode (cname = "gcry_md_ctl")] - public Error control (ControlCommand cmd, [CCode (array_length_type = "size_t")] uchar[] buffer); - public void write (uchar[] buffer); - [CCode (array_length = false)] - public unowned uchar[] read (Algorithm algo); - public static void hash_buffer (Algorithm algo, [CCode (array_length = false)] uchar[] digest, uchar[] buffer); - public Algorithm get_algo (); - public bool is_enabled (Algorithm algo); - public bool is_secure (); - public Error info (ControlCommand what, [CCode (array_length_type = "size_t")] ref uchar[] buffer); - [CCode (cname = "gcry_md_setkey")] - public Error set_key (uchar[] key_data); - public void putc (char c); - public void final (); - public static Error list (ref Algorithm[] algos); - } - - namespace Random { - [CCode (cname = "gcry_random_level_t")] - public enum Level { - [CCode (cname = "GCRY_WEAK_RANDOM")] - WEAK, - [CCode (cname = "GCRY_STRONG_RANDOM")] - STRONG, - [CCode (cname = "GCRY_VERY_STRONG_RANDOM")] - VERY_STRONG - } - - [CCode (cname = "gcry_randomize")] - public static void randomize (uchar[] buffer, Level level = Level.VERY_STRONG); - [CCode (cname = "gcry_fast_random_poll")] - public static Error poll (); - [CCode (cname = "gcry_random_bytes", array_length = false)] - public static uchar[] random_bytes (size_t nbytes, Level level = Level.VERY_STRONG); - [CCode (cname = "gcry_random_bytes_secure", array_length = false)] - public static uchar[] random_bytes_secure (size_t nbytes, Level level = Level.VERY_STRONG); - [CCode (cname = "gcry_create_nonce")] - public static void nonce (uchar[] buffer); - } - - [Compact, CCode (cname = "struct gcry_mpi", cprefix = "gcry_mpi_", free_function = "gcry_mpi_release")] - public class MPI { - [CCode (cname = "enum gcry_mpi_format", cprefix = "GCRYMPI_FMT_")] - public enum Format { - NONE, - STD, - PGP, - SSH, - HEX, - USG - } - - [CCode (cname = "enum gcry_mpi_flag", cprefix = "GCRYMPI_FLAG_")] - public enum Flag { - SECURE, - OPAQUE - } - - public MPI (uint nbits); - [CCode (cname = "gcry_mpi_snew")] - public MPI.secure (uint nbits); - public MPI copy (); - public void set (MPI u); - public void set_ui (ulong u); - public void swap (MPI b); - public int cmp (MPI v); - public int cmp_ui (ulong v); - - public static Error scan (out MPI ret, MPI.Format format, [CCode (array_length = false)] uchar[] buffer, size_t buflen, out size_t nscanned); - [CCode (instance_pos = -1)] - public Error print (MPI.Format format, [CCode (array_length = false)] uchar[] buffer, size_t buflen, out size_t nwritter); - [CCode (instance_pos = -1)] - public Error aprint (MPI.Format format, [CCode (array_length_type = "size_t")] out uchar[] buffer); - - public void add (MPI u, MPI v); - public void add_ui (MPI u, ulong v); - public void addm (MPI u, MPI v, MPI m); - public void sub (MPI u, MPI v); - public void sub_ui (MPI u, ulong v); - public void subm (MPI u, MPI v, MPI m); - public void mul (MPI u, MPI v); - public void mul_ui (MPI u, ulong v); - public void mulm (MPI u, MPI v, MPI m); - public void mul_2exp (MPI u, ulong cnt); - public void div (MPI r, MPI dividend, MPI divisor, int round); - public void mod (MPI dividend, MPI divisor); - public void powm (MPI b, MPI e, MPI m); - public int gcd (MPI a, MPI b); - public int invm (MPI a, MPI m); - - public uint get_nbits (); - public int test_bit (uint n); - public void set_bit (uint n); - public void clear_bit (uint n); - public void set_highbit (uint n); - public void clear_highbit (uint n); - public void rshift (MPI a, uint n); - public void lshift (MPI a, uint n); - - public void set_flag (MPI.Flag flag); - public void clear_flag (MPI.Flag flag); - public int get_flag (MPI.Flag flag); - } - - [Compact, CCode (cname = "struct gcry_sexp", free_function = "gcry_sexp_release")] - public class SExp { - [CCode (cname = "int", cprefix = "GCRYSEXP_FMT_")] - public enum Format { - DEFAULT, - CANON, - BASE64, - ADVANCED - } - - public static Error @new (out SExp retsexp, void * buffer, size_t length, int autodetect); - public static Error create (out SExp retsexp, void * buffer, size_t length, int autodetect, GLib.DestroyNotify free_function); - public static Error sscan (out SExp retsexp, out size_t erroff, char[] buffer); - public static Error build (out SExp retsexp, out size_t erroff, string format, ...); - public size_t sprint (Format mode, char[] buffer); - public static size_t canon_len (uchar[] buffer, out size_t erroff, out int errcode); - public SExp find_token (string token, size_t token_length = 0); - public int length (); - public SExp? nth (int number); - public SExp? car (); - public SExp? cdr (); - [CCode (array_length_type = "size_t")] - public unowned char[] nth_data (int number); - public gcry_string nth_string (int number); - public MPI nth_mpi (int number, MPI.Format mpifmt); - } - - [CCode (cname = "char", free_function = "gcry_free")] - public class gcry_string : string { } - - [CCode (lower_case_cprefix = "gcry_pk_")] - namespace PublicKey { - [CCode (cname = "enum gcry_pk_algos")] - public enum Algorithm { - RSA, - ELG_E, - DSA, - ELG, - ECDSA; - - [CCode (cname = "gcry_pk_algo_name")] - public unowned string to_string (); - [CCode (cname = "gcry_pk_map_name")] - public static Algorithm map_name (string name); - } - - public static Error encrypt (out SExp ciphertext, SExp data, SExp pkey); - public static Error decrypt (out SExp plaintext, SExp data, SExp skey); - public static Error sign (out SExp signature, SExp data, SExp skey); - public static Error verify (SExp signature, SExp data, SExp pkey); - public static Error testkey (SExp key); - public static Error genkey (out SExp r_key, SExp s_params); - public static uint get_nbits (SExp key); - } - - [CCode (lower_case_cprefix = "gcry_kdf_")] - namespace KeyDerivation { - [CCode (cname = "enum gcry_kdf_algos", cprefix = "GCRY_KDF_", has_type_id = false)] - public enum Algorithm { - NONE, - SIMPLE_S2K, - SALTED_S2K, - ITERSALTED_S2K, - PBKDF1, - PBKDF2, - SCRYPT - } - - public GCrypt.Error derive ([CCode (type = "const void*", array_length_type = "size_t")] uint8[] passphrasse, GCrypt.KeyDerivation.Algorithm algo, GCrypt.Hash.Algorithm subalgo, [CCode (type = "const void*", array_length_type = "size_t")] uint8[] salt, ulong iterations, [CCode (type = "void*", array_length_type = "size_t", array_length_pos = 5.5)] uint8[] keybuffer); - } -} diff --git a/src/vapi/mpv.vapi b/src/vapi/mpv.vapi deleted file mode 100644 index c7ae141..0000000 --- a/src/vapi/mpv.vapi +++ /dev/null @@ -1,177 +0,0 @@ -[CCode (cheader_filename = "mpv/client.h")] -namespace Mpv { - - [CCode (cname = "mpv_error", cprefix = "MPV_ERROR_", has_type_id = false)] - public enum Error { - SUCCESS, - EVENT_QUEUE_FULL, - NOMEM, - UNINITIALIZED, - INVALID_PARAMETER, - OPTION_NOT_FOUND, - OPTION_FORMAT, - OPTION_ERROR, - PROPERTY_NOT_FOUND, - PROPERTY_FORMAT, - PROPERTY_UNAVAILABLE, - PROPERTY_ERROR, - COMMAND, - LOADING_FAILED, - AO_INIT_FAILED, - VO_INIT_FAILED, - NOTHING_TO_PLAY, - UNKNOWN_FORMAT, - UNSUPPORTED, - NOT_IMPLEMENTED, - GENERIC; - - [CCode (cname = "mpv_error_string")] - public unowned string to_string (); - } - - public delegate void WakeupCallback (); - - [CCode (cname = "mpv_handle", free_function = "mpv_terminate_destroy")] - [Compact] - public class Handle { - [CCode (cname = "mpv_create")] - public Handle (); - - [CCode (cname = "mpv_initialize")] - public Error initialize (); - - [CCode (cname = "mpv_wait_event")] - public unowned Event? wait_event (double timeout); - - public WakeupCallback wakeup_callback { - [CCode (cname = "mpv_set_wakeup_callback")] set; - } - - [CCode (cname = "mpv_set_property")] - private Error set_property (string name, Format format, void *data); - - [CCode (cname = "mpv_set_property_string")] - public Error set_property_string (string name, string value); - - public Error set_property_int64 (string name, int64 value) { - return this.set_property (name, Format.INT64, &value); - } - - public Error set_property_flag (string name, bool value) { - int flag = value ? 1 : 0; - return this.set_property (name, Format.FLAG, &flag); - } - - [CCode (cname = "mpv_command")] - public Error command ([CCode (array_length = false)] string[] args); - - [CCode (cname = "mpv_command_async")] - public Error command_async (uint64 reply_userdata, [CCode (array_length = false)] string[] args); - - [CCode (cname = "mpv_observe_property")] - public Error observe_property (uint64 reply_userdata, string name, Format format); - } - - [CCode (cname = "mpv_format", cprefix = "MPV_FORMAT_", has_type_id = false)] - public enum Format { - NONE, - STRING, - OSD_STRING, - FLAG, - INT64, - DOUBLE, - NODE, - NODE_ARRAY, - NODE_MAP, - BYTE_ARRAY, - } - - [CCode (cname = "mpv_event_id", cprefix = "MPV_EVENT_", has_type_id = false)] - public enum EventId { - NONE, - SHUTDOWN, - LOG_MESSAGE, - GET_PROPERTY_REPLY, - SET_PROPERTY_REPLY, - COMMAND_REPLY, - START_FILE, - END_FILE, - FILE_LOADED, - CLIENT_MESSAGE, - VIDEO_RECONFIG, - AUDIO_RECONFIG, - SEEK, - PLAYBACK_RESTART, - PROPERTY_CHANGE, - QUEUE_OVERFLOW, - HOOK; - - [CCode (cname = "mpv_event_name")] - public unowned string to_string (); - } - - [CCode (cname = "mpv_event", destroy_function = "", has_type_id = false, has_copy_function = false)] - public struct Event { - EventId event_id; - Error error; - uint64 reply_userdata; - void *data; - - public unowned EventProperty? parse_property () - requires (event_id == EventId.PROPERTY_CHANGE) - requires (error >= 0) - { - return (EventProperty?) data; - } - - public unowned EventEndFile? parse_end_file () - requires (event_id == EventId.END_FILE) - requires (error >= 0) - { - return (EventEndFile?) data; - } - } - - [CCode (cname = "mpv_event_property", destroy_function = "", has_type_id = false, has_copy_function = false)] - public struct EventProperty { - unowned string name; - Format format; - void *data; - - public int64 parse_int64 () - requires (format == Format.INT64) - { - return * (int64 *) data; - } - - public double parse_double () - requires (format == Format.DOUBLE) - { - return * (double *) data; - } - - public bool parse_flag () - requires (format == Format.FLAG) - { - return (* (int *) data) == 1; - } - } - - [CCode (cname = "mpv_event_end_file", destroy_function = "", has_type_id = false, has_copy_function = false)] - public struct EventEndFile { - EndFileReason reason; - Error error; - int64 playlist_entry_id; - int playlist_insert_num_entries; - } - - [CCode (cname = "mpv_end_file_reason", cprefix = "MPV_END_FILE_REASON_", has_type_id = false)] - public enum EndFileReason { - EOF, - STOP, - QUIT, - ERROR, - REDIRECT, - } - -}