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

#include <glib-object.h>
#include <gio/gio.h>
#include <adwaita.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gst/gst.h>
#include <gtk/gtk.h>
#include <float.h>
#include <math.h>

#define G4_SORT_MODE_SHUFFLE ((guint) 5)
#define G4_SORT_MODE_TITLE ((guint) 3)
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define G4_TYPE_MPRIS_PLAYER (g4_mpris_player_get_type ())
#define G4_MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_MPRIS_PLAYER, G4MprisPlayer))
#define G4_MPRIS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_MPRIS_PLAYER, G4MprisPlayerClass))
#define G4_IS_MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_MPRIS_PLAYER))
#define G4_IS_MPRIS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_MPRIS_PLAYER))
#define G4_MPRIS_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_MPRIS_PLAYER, G4MprisPlayerClass))

typedef struct _G4MprisPlayer G4MprisPlayer;
typedef struct _G4MprisPlayerClass G4MprisPlayerClass;
typedef struct _G4MprisPlayerPrivate G4MprisPlayerPrivate;

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

typedef struct _G4Application G4Application;
typedef struct _G4ApplicationClass G4ApplicationClass;

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

typedef struct _G4Music G4Music;
typedef struct _G4MusicClass G4MusicClass;
enum  {
	G4_MPRIS_PLAYER_0_PROPERTY,
	G4_MPRIS_PLAYER_CAN_CONTROL_PROPERTY,
	G4_MPRIS_PLAYER_CAN_GO_NEXT_PROPERTY,
	G4_MPRIS_PLAYER_CAN_GO_PREVIOUS_PROPERTY,
	G4_MPRIS_PLAYER_CAN_PLAY_PROPERTY,
	G4_MPRIS_PLAYER_CAN_PAUSE_PROPERTY,
	G4_MPRIS_PLAYER_CAN_SEEK_PROPERTY,
	G4_MPRIS_PLAYER_METADATA_PROPERTY,
	G4_MPRIS_PLAYER_POSITION_PROPERTY,
	G4_MPRIS_PLAYER_PLAYBACK_STATUS_PROPERTY,
	G4_MPRIS_PLAYER_SHUFFLE_PROPERTY,
	G4_MPRIS_PLAYER_VOLUME_PROPERTY,
	G4_MPRIS_PLAYER_NUM_PROPERTIES
};
static GParamSpec* g4_mpris_player_properties[G4_MPRIS_PLAYER_NUM_PROPERTIES];
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))

#define G4_TYPE_GST_PLAYER (g4_gst_player_get_type ())
#define G4_GST_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_GST_PLAYER, G4GstPlayer))
#define G4_GST_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_GST_PLAYER, G4GstPlayerClass))
#define G4_IS_GST_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_GST_PLAYER))
#define G4_IS_GST_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_GST_PLAYER))
#define G4_GST_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_GST_PLAYER, G4GstPlayerClass))

typedef struct _G4GstPlayer G4GstPlayer;
typedef struct _G4GstPlayerClass G4GstPlayerClass;
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
#define _g_variant_builder_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_builder_unref (var), NULL)))
typedef struct _G4MusicPrivate G4MusicPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define G4_TYPE_MPRIS_ROOT (g4_mpris_root_get_type ())
#define G4_MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_MPRIS_ROOT, G4MprisRoot))
#define G4_MPRIS_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_MPRIS_ROOT, G4MprisRootClass))
#define G4_IS_MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_MPRIS_ROOT))
#define G4_IS_MPRIS_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_MPRIS_ROOT))
#define G4_MPRIS_ROOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_MPRIS_ROOT, G4MprisRootClass))

typedef struct _G4MprisRoot G4MprisRoot;
typedef struct _G4MprisRootClass G4MprisRootClass;
typedef struct _G4MprisRootPrivate G4MprisRootPrivate;
enum  {
	G4_MPRIS_ROOT_0_PROPERTY,
	G4_MPRIS_ROOT_CAN_QUIT_PROPERTY,
	G4_MPRIS_ROOT_CAN_RAISE_PROPERTY,
	G4_MPRIS_ROOT_HAS_TRACK_LIST_PROPERTY,
	G4_MPRIS_ROOT_DESKTOP_ENTRY_PROPERTY,
	G4_MPRIS_ROOT_IDENTITY_PROPERTY,
	G4_MPRIS_ROOT_SUPPORTED_URI_SCHEMES_PROPERTY,
	G4_MPRIS_ROOT_SUPPORTED_MIME_TYPES_PROPERTY,
	G4_MPRIS_ROOT_NUM_PROPERTIES
};
static GParamSpec* g4_mpris_root_properties[G4_MPRIS_ROOT_NUM_PROPERTIES];

struct _G4MprisPlayer {
	GObject parent_instance;
	G4MprisPlayerPrivate * priv;
};

struct _G4MprisPlayerClass {
	GObjectClass parent_class;
};

struct _G4MprisPlayerPrivate {
	G4Application* _app;
	GDBusConnection* _connection;
	gboolean _cover_parsed;
	gint64 _current_duration;
	G4Music* _current_music;
	GHashTable* _metadata;
};

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

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

struct _G4MprisRoot {
	GObject parent_instance;
	G4MprisRootPrivate * priv;
};

struct _G4MprisRootClass {
	GObjectClass parent_class;
};

struct _G4MprisRootPrivate {
	G4Application* _app;
};

static gint G4MprisPlayer_private_offset;
static gpointer g4_mpris_player_parent_class = NULL;
static gint G4MprisRoot_private_offset;
static gpointer g4_mpris_root_parent_class = NULL;

VALA_EXTERN GType g4_mpris_player_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4MprisPlayer, g_object_unref)
VALA_EXTERN guint g4_mpris_player_register_object (void* object,
                                       GDBusConnection* connection,
                                       const gchar* path,
                                       GError** error);
VALA_EXTERN GType g4_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4Application, g_object_unref)
VALA_EXTERN GType g4_music_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4Music, g_object_unref)
static void _g_free0_ (gpointer var);
static void _g_variant_unref0_ (gpointer var);
VALA_EXTERN G4MprisPlayer* g4_mpris_player_new (G4Application* app,
                                    GDBusConnection* connection);
VALA_EXTERN G4MprisPlayer* g4_mpris_player_construct (GType object_type,
                                          G4Application* app,
                                          GDBusConnection* connection);
static void g4_mpris_player_on_index_changed (G4MprisPlayer* self,
                                       gint index,
                                       guint size);
static void _g4_mpris_player_on_index_changed_g4_application_index_changed (G4Application* _sender,
                                                                     gint index,
                                                                     guint size,
                                                                     gpointer self);
static void g4_mpris_player_on_music_changed (G4MprisPlayer* self,
                                       G4Music* music);
static void _g4_mpris_player_on_music_changed_g4_application_music_changed (G4Application* _sender,
                                                                     G4Music* music,
                                                                     gpointer self);
static void g4_mpris_player_on_music_cover_parsed (G4MprisPlayer* self,
                                            G4Music* music,
                                            GdkPixbuf* pixbuf,
                                            const gchar* uri);
static void _g4_mpris_player_on_music_cover_parsed_g4_application_music_cover_parsed (G4Application* _sender,
                                                                               G4Music* music,
                                                                               GdkPixbuf* cover,
                                                                               const gchar* cover_uri,
                                                                               gpointer self);
VALA_EXTERN GType g4_gst_player_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4GstPlayer, g_object_unref)
VALA_EXTERN G4GstPlayer* g4_application_get_player (G4Application* self);
static void g4_mpris_player_on_state_changed (G4MprisPlayer* self,
                                       GstState state);
static void _g4_mpris_player_on_state_changed_g4_gst_player_state_changed (G4GstPlayer* _sender,
                                                                    GstState state,
                                                                    gpointer self);
static void g4_mpris_player_on_duration_changed (G4MprisPlayer* self,
                                          GstClockTime duration);
static void _g4_mpris_player_on_duration_changed_g4_gst_player_duration_changed (G4GstPlayer* _sender,
                                                                          GstClockTime duration,
                                                                          gpointer self);
VALA_EXTERN void g4_mpris_player_next (G4MprisPlayer* self,
                           GError** error);
VALA_EXTERN void g4_application_play_next (G4Application* self);
VALA_EXTERN void g4_mpris_player_previous (G4MprisPlayer* self,
                               GError** error);
VALA_EXTERN void g4_application_play_previous (G4Application* self);
VALA_EXTERN void g4_mpris_player_play_pause (G4MprisPlayer* self,
                                 GError** error);
VALA_EXTERN void g4_application_play_pause (G4Application* self);
VALA_EXTERN void g4_mpris_player_play (G4MprisPlayer* self,
                           GError** error);
VALA_EXTERN void g4_gst_player_play (G4GstPlayer* self);
VALA_EXTERN void g4_mpris_player_pause (G4MprisPlayer* self,
                            GError** error);
VALA_EXTERN void g4_gst_player_pause (G4GstPlayer* self);
VALA_EXTERN void g4_mpris_player_seek (G4MprisPlayer* self,
                           gint64 offset,
                           GError** error);
VALA_EXTERN GstClockTime g4_gst_player_get_position (G4GstPlayer* self);
VALA_EXTERN void g4_gst_player_set_position (G4GstPlayer* self,
                                 GstClockTime value);
static void g4_mpris_player_send_property (G4MprisPlayer* self,
                                    const gchar* name,
                                    GVariant* variant);
static GVariant* _variant_new2 (GHashTable* value);
VALA_EXTERN G4Music* g4_application_get_current_music (G4Application* self);
static void g4_mpris_player_send_properties (G4MprisPlayer* self,
                                      GVariantBuilder* builder);
static GVariant* _variant_new3 (GHashTable* value);
static gchar* g4_mpris_player_get_mpris_status (G4MprisPlayer* self,
                                         GstState state);
VALA_EXTERN gboolean g4_mpris_player_get_can_control (G4MprisPlayer* self);
VALA_EXTERN gboolean g4_mpris_player_get_can_go_next (G4MprisPlayer* self);
VALA_EXTERN gint g4_application_get_current_item (G4Application* self);
VALA_EXTERN GtkFilterListModel* g4_application_get_current_list (G4Application* self);
VALA_EXTERN gboolean g4_mpris_player_get_can_go_previous (G4MprisPlayer* self);
VALA_EXTERN gboolean g4_mpris_player_get_can_play (G4MprisPlayer* self);
VALA_EXTERN gboolean g4_mpris_player_get_can_pause (G4MprisPlayer* self);
VALA_EXTERN gboolean g4_mpris_player_get_can_seek (G4MprisPlayer* self);
VALA_EXTERN GHashTable* g4_mpris_player_get_metadata (G4MprisPlayer* self);
VALA_EXTERN gint64 g4_mpris_player_get_position (G4MprisPlayer* self);
VALA_EXTERN gchar* g4_mpris_player_get_playback_status (G4MprisPlayer* self);
VALA_EXTERN GstState g4_gst_player_get_state (G4GstPlayer* self);
VALA_EXTERN gboolean g4_mpris_player_get_shuffle (G4MprisPlayer* self);
VALA_EXTERN guint g4_application_get_sort_mode (G4Application* self);
VALA_EXTERN void g4_mpris_player_set_shuffle (G4MprisPlayer* self,
                                  gboolean value);
VALA_EXTERN void g4_application_set_sort_mode (G4Application* self,
                                   guint value);
VALA_EXTERN gdouble g4_mpris_player_get_volume (G4MprisPlayer* self);
VALA_EXTERN gdouble g4_gst_player_get_volume (G4GstPlayer* self);
VALA_EXTERN void g4_mpris_player_set_volume (G4MprisPlayer* self,
                                 gdouble value);
VALA_EXTERN void g4_gst_player_set_volume (G4GstPlayer* self,
                               gdouble value);
static void g4_mpris_player_finalize (GObject * obj);
static GType g4_mpris_player_get_type_once (void);
static void _vala_g4_mpris_player_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec);
static void _vala_g4_mpris_player_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec);
static void _dbus_g4_mpris_player_next (G4MprisPlayer* self,
                                 GVariant* _parameters_,
                                 GDBusMethodInvocation* invocation);
static void _dbus_g4_mpris_player_previous (G4MprisPlayer* self,
                                     GVariant* _parameters_,
                                     GDBusMethodInvocation* invocation);
static void _dbus_g4_mpris_player_play_pause (G4MprisPlayer* self,
                                       GVariant* _parameters_,
                                       GDBusMethodInvocation* invocation);
static void _dbus_g4_mpris_player_play (G4MprisPlayer* self,
                                 GVariant* _parameters_,
                                 GDBusMethodInvocation* invocation);
static void _dbus_g4_mpris_player_pause (G4MprisPlayer* self,
                                  GVariant* _parameters_,
                                  GDBusMethodInvocation* invocation);
static void _dbus_g4_mpris_player_seek (G4MprisPlayer* self,
                                 GVariant* _parameters_,
                                 GDBusMethodInvocation* invocation);
static void g4_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* g4_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_g4_mpris_player_get_can_control (G4MprisPlayer* self);
static GVariant* _dbus_g4_mpris_player_get_can_go_next (G4MprisPlayer* self);
static GVariant* _dbus_g4_mpris_player_get_can_go_previous (G4MprisPlayer* self);
static GVariant* _dbus_g4_mpris_player_get_can_play (G4MprisPlayer* self);
static GVariant* _dbus_g4_mpris_player_get_can_pause (G4MprisPlayer* self);
static GVariant* _dbus_g4_mpris_player_get_can_seek (G4MprisPlayer* self);
static GVariant* _dbus_g4_mpris_player_get_metadata (G4MprisPlayer* self);
static GVariant* _dbus_g4_mpris_player_get_position (G4MprisPlayer* self);
static GVariant* _dbus_g4_mpris_player_get_playback_status (G4MprisPlayer* self);
static GVariant* _dbus_g4_mpris_player_get_shuffle (G4MprisPlayer* self);
static GVariant* _dbus_g4_mpris_player_get_volume (G4MprisPlayer* self);
static gboolean g4_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_g4_mpris_player_set_shuffle (G4MprisPlayer* self,
                                        GVariant* _value);
static void _dbus_g4_mpris_player_set_volume (G4MprisPlayer* self,
                                       GVariant* _value);
static void _g4_mpris_player_unregister_object (gpointer user_data);
VALA_EXTERN GType g4_mpris_root_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4MprisRoot, g_object_unref)
VALA_EXTERN guint g4_mpris_root_register_object (void* object,
                                     GDBusConnection* connection,
                                     const gchar* path,
                                     GError** error);
VALA_EXTERN G4MprisRoot* g4_mpris_root_new (G4Application* app);
VALA_EXTERN G4MprisRoot* g4_mpris_root_construct (GType object_type,
                                      G4Application* app);
VALA_EXTERN void g4_mpris_root_quit (G4MprisRoot* self,
                         GError** error);
VALA_EXTERN void g4_mpris_root_raise (G4MprisRoot* self,
                          GError** error);
VALA_EXTERN gboolean g4_mpris_root_get_can_quit (G4MprisRoot* self);
VALA_EXTERN gboolean g4_mpris_root_get_can_raise (G4MprisRoot* self);
VALA_EXTERN gboolean g4_mpris_root_get_has_track_list (G4MprisRoot* self);
VALA_EXTERN const gchar* g4_mpris_root_get_desktop_entry (G4MprisRoot* self);
VALA_EXTERN const gchar* g4_mpris_root_get_identity (G4MprisRoot* self);
VALA_EXTERN const gchar* g4_application_get_name (G4Application* self);
VALA_EXTERN gchar** g4_mpris_root_get_supported_uri_schemes (G4MprisRoot* self,
                                                 gint* result_length1);
VALA_EXTERN gchar** g4_mpris_root_get_supported_mime_types (G4MprisRoot* self,
                                                gint* result_length1);
static void g4_mpris_root_finalize (GObject * obj);
static GType g4_mpris_root_get_type_once (void);
static void _vala_g4_mpris_root_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static void _dbus_g4_mpris_root_quit (G4MprisRoot* self,
                               GVariant* _parameters_,
                               GDBusMethodInvocation* invocation);
static void _dbus_g4_mpris_root_raise (G4MprisRoot* self,
                                GVariant* _parameters_,
                                GDBusMethodInvocation* invocation);
static void g4_mpris_root_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* g4_mpris_root_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_g4_mpris_root_get_can_quit (G4MprisRoot* self);
static GVariant* _dbus_g4_mpris_root_get_can_raise (G4MprisRoot* self);
static GVariant* _dbus_g4_mpris_root_get_has_track_list (G4MprisRoot* self);
static GVariant* _dbus_g4_mpris_root_get_desktop_entry (G4MprisRoot* self);
static GVariant* _dbus_g4_mpris_root_get_identity (G4MprisRoot* self);
static GVariant* _dbus_g4_mpris_root_get_supported_uri_schemes (G4MprisRoot* self);
static GVariant* _dbus_g4_mpris_root_get_supported_mime_types (G4MprisRoot* self);
static gboolean g4_mpris_root_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 _g4_mpris_root_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 inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const GDBusArgInfo * const _g4_mpris_player_dbus_arg_info_next_in[] = {NULL};
static const GDBusArgInfo * const _g4_mpris_player_dbus_arg_info_next_out[] = {NULL};
static const GDBusMethodInfo _g4_mpris_player_dbus_method_info_next = {-1, "Next", (GDBusArgInfo **) (&_g4_mpris_player_dbus_arg_info_next_in), (GDBusArgInfo **) (&_g4_mpris_player_dbus_arg_info_next_out), NULL};
static const GDBusArgInfo * const _g4_mpris_player_dbus_arg_info_previous_in[] = {NULL};
static const GDBusArgInfo * const _g4_mpris_player_dbus_arg_info_previous_out[] = {NULL};
static const GDBusMethodInfo _g4_mpris_player_dbus_method_info_previous = {-1, "Previous", (GDBusArgInfo **) (&_g4_mpris_player_dbus_arg_info_previous_in), (GDBusArgInfo **) (&_g4_mpris_player_dbus_arg_info_previous_out), NULL};
static const GDBusArgInfo * const _g4_mpris_player_dbus_arg_info_play_pause_in[] = {NULL};
static const GDBusArgInfo * const _g4_mpris_player_dbus_arg_info_play_pause_out[] = {NULL};
static const GDBusMethodInfo _g4_mpris_player_dbus_method_info_play_pause = {-1, "PlayPause", (GDBusArgInfo **) (&_g4_mpris_player_dbus_arg_info_play_pause_in), (GDBusArgInfo **) (&_g4_mpris_player_dbus_arg_info_play_pause_out), NULL};
static const GDBusArgInfo * const _g4_mpris_player_dbus_arg_info_play_in[] = {NULL};
static const GDBusArgInfo * const _g4_mpris_player_dbus_arg_info_play_out[] = {NULL};
static const GDBusMethodInfo _g4_mpris_player_dbus_method_info_play = {-1, "Play", (GDBusArgInfo **) (&_g4_mpris_player_dbus_arg_info_play_in), (GDBusArgInfo **) (&_g4_mpris_player_dbus_arg_info_play_out), NULL};
static const GDBusArgInfo * const _g4_mpris_player_dbus_arg_info_pause_in[] = {NULL};
static const GDBusArgInfo * const _g4_mpris_player_dbus_arg_info_pause_out[] = {NULL};
static const GDBusMethodInfo _g4_mpris_player_dbus_method_info_pause = {-1, "Pause", (GDBusArgInfo **) (&_g4_mpris_player_dbus_arg_info_pause_in), (GDBusArgInfo **) (&_g4_mpris_player_dbus_arg_info_pause_out), NULL};
static const GDBusArgInfo _g4_mpris_player_dbus_arg_info_seek_offset = {-1, "offset", "x", NULL};
static const GDBusArgInfo * const _g4_mpris_player_dbus_arg_info_seek_in[] = {&_g4_mpris_player_dbus_arg_info_seek_offset, NULL};
static const GDBusArgInfo * const _g4_mpris_player_dbus_arg_info_seek_out[] = {NULL};
static const GDBusMethodInfo _g4_mpris_player_dbus_method_info_seek = {-1, "Seek", (GDBusArgInfo **) (&_g4_mpris_player_dbus_arg_info_seek_in), (GDBusArgInfo **) (&_g4_mpris_player_dbus_arg_info_seek_out), NULL};
static const GDBusMethodInfo * const _g4_mpris_player_dbus_method_info[] = {&_g4_mpris_player_dbus_method_info_next, &_g4_mpris_player_dbus_method_info_previous, &_g4_mpris_player_dbus_method_info_play_pause, &_g4_mpris_player_dbus_method_info_play, &_g4_mpris_player_dbus_method_info_pause, &_g4_mpris_player_dbus_method_info_seek, NULL};
static const GDBusSignalInfo * const _g4_mpris_player_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo _g4_mpris_player_dbus_property_info_can_control = {-1, "CanControl", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_player_dbus_property_info_can_go_next = {-1, "CanGoNext", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_player_dbus_property_info_can_go_previous = {-1, "CanGoPrevious", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_player_dbus_property_info_can_play = {-1, "CanPlay", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_player_dbus_property_info_can_pause = {-1, "CanPause", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_player_dbus_property_info_can_seek = {-1, "CanSeek", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_player_dbus_property_info_metadata = {-1, "Metadata", "a{sv}", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_player_dbus_property_info_position = {-1, "Position", "x", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_player_dbus_property_info_playback_status = {-1, "PlaybackStatus", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_player_dbus_property_info_shuffle = {-1, "Shuffle", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
static const GDBusPropertyInfo _g4_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 * const _g4_mpris_player_dbus_property_info[] = {&_g4_mpris_player_dbus_property_info_can_control, &_g4_mpris_player_dbus_property_info_can_go_next, &_g4_mpris_player_dbus_property_info_can_go_previous, &_g4_mpris_player_dbus_property_info_can_play, &_g4_mpris_player_dbus_property_info_can_pause, &_g4_mpris_player_dbus_property_info_can_seek, &_g4_mpris_player_dbus_property_info_metadata, &_g4_mpris_player_dbus_property_info_position, &_g4_mpris_player_dbus_property_info_playback_status, &_g4_mpris_player_dbus_property_info_shuffle, &_g4_mpris_player_dbus_property_info_volume, NULL};
static const GDBusInterfaceInfo _g4_mpris_player_dbus_interface_info = {-1, "org.mpris.MediaPlayer2.Player", (GDBusMethodInfo **) (&_g4_mpris_player_dbus_method_info), (GDBusSignalInfo **) (&_g4_mpris_player_dbus_signal_info), (GDBusPropertyInfo **) (&_g4_mpris_player_dbus_property_info), NULL};
static const GDBusInterfaceVTable _g4_mpris_player_dbus_interface_vtable = {g4_mpris_player_dbus_interface_method_call, g4_mpris_player_dbus_interface_get_property, g4_mpris_player_dbus_interface_set_property};
static const GDBusArgInfo * const _g4_mpris_root_dbus_arg_info_quit_in[] = {NULL};
static const GDBusArgInfo * const _g4_mpris_root_dbus_arg_info_quit_out[] = {NULL};
static const GDBusMethodInfo _g4_mpris_root_dbus_method_info_quit = {-1, "Quit", (GDBusArgInfo **) (&_g4_mpris_root_dbus_arg_info_quit_in), (GDBusArgInfo **) (&_g4_mpris_root_dbus_arg_info_quit_out), NULL};
static const GDBusArgInfo * const _g4_mpris_root_dbus_arg_info_raise_in[] = {NULL};
static const GDBusArgInfo * const _g4_mpris_root_dbus_arg_info_raise_out[] = {NULL};
static const GDBusMethodInfo _g4_mpris_root_dbus_method_info_raise = {-1, "Raise", (GDBusArgInfo **) (&_g4_mpris_root_dbus_arg_info_raise_in), (GDBusArgInfo **) (&_g4_mpris_root_dbus_arg_info_raise_out), NULL};
static const GDBusMethodInfo * const _g4_mpris_root_dbus_method_info[] = {&_g4_mpris_root_dbus_method_info_quit, &_g4_mpris_root_dbus_method_info_raise, NULL};
static const GDBusSignalInfo * const _g4_mpris_root_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo _g4_mpris_root_dbus_property_info_can_quit = {-1, "CanQuit", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_root_dbus_property_info_can_raise = {-1, "CanRaise", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_root_dbus_property_info_has_track_list = {-1, "HasTrackList", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_root_dbus_property_info_desktop_entry = {-1, "DesktopEntry", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_root_dbus_property_info_identity = {-1, "Identity", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_root_dbus_property_info_supported_uri_schemes = {-1, "SupportedUriSchemes", "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _g4_mpris_root_dbus_property_info_supported_mime_types = {-1, "SupportedMimeTypes", "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo * const _g4_mpris_root_dbus_property_info[] = {&_g4_mpris_root_dbus_property_info_can_quit, &_g4_mpris_root_dbus_property_info_can_raise, &_g4_mpris_root_dbus_property_info_has_track_list, &_g4_mpris_root_dbus_property_info_desktop_entry, &_g4_mpris_root_dbus_property_info_identity, &_g4_mpris_root_dbus_property_info_supported_uri_schemes, &_g4_mpris_root_dbus_property_info_supported_mime_types, NULL};
static const GDBusInterfaceInfo _g4_mpris_root_dbus_interface_info = {-1, "org.mpris.MediaPlayer2", (GDBusMethodInfo **) (&_g4_mpris_root_dbus_method_info), (GDBusSignalInfo **) (&_g4_mpris_root_dbus_signal_info), (GDBusPropertyInfo **) (&_g4_mpris_root_dbus_property_info), NULL};
static const GDBusInterfaceVTable _g4_mpris_root_dbus_interface_vtable = {g4_mpris_root_dbus_interface_method_call, g4_mpris_root_dbus_interface_get_property, g4_mpris_root_dbus_interface_set_property};

static inline gpointer
g4_mpris_player_get_instance_private (G4MprisPlayer* self)
{
	return G_STRUCT_MEMBER_P (self, G4MprisPlayer_private_offset);
}

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

static void
_g_variant_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_variant_unref (var), NULL));
}

static void
_g4_mpris_player_on_index_changed_g4_application_index_changed (G4Application* _sender,
                                                                gint index,
                                                                guint size,
                                                                gpointer self)
{
	g4_mpris_player_on_index_changed ((G4MprisPlayer*) self, index, size);
}

static void
_g4_mpris_player_on_music_changed_g4_application_music_changed (G4Application* _sender,
                                                                G4Music* music,
                                                                gpointer self)
{
	g4_mpris_player_on_music_changed ((G4MprisPlayer*) self, music);
}

static void
_g4_mpris_player_on_music_cover_parsed_g4_application_music_cover_parsed (G4Application* _sender,
                                                                          G4Music* music,
                                                                          GdkPixbuf* cover,
                                                                          const gchar* cover_uri,
                                                                          gpointer self)
{
	g4_mpris_player_on_music_cover_parsed ((G4MprisPlayer*) self, music, cover, cover_uri);
}

static void
_g4_mpris_player_on_state_changed_g4_gst_player_state_changed (G4GstPlayer* _sender,
                                                               GstState state,
                                                               gpointer self)
{
	g4_mpris_player_on_state_changed ((G4MprisPlayer*) self, state);
}

static void
_g4_mpris_player_on_duration_changed_g4_gst_player_duration_changed (G4GstPlayer* _sender,
                                                                     GstClockTime duration,
                                                                     gpointer self)
{
	g4_mpris_player_on_duration_changed ((G4MprisPlayer*) self, duration);
}

G4MprisPlayer*
g4_mpris_player_construct (GType object_type,
                           G4Application* app,
                           GDBusConnection* connection)
{
	G4MprisPlayer * self = NULL;
	G4GstPlayer* _tmp0_;
	G4GstPlayer* _tmp1_;
	G4GstPlayer* _tmp2_;
	G4GstPlayer* _tmp3_;
	g_return_val_if_fail (app != NULL, NULL);
	g_return_val_if_fail (connection != NULL, NULL);
	self = (G4MprisPlayer*) g_object_new (object_type, NULL);
	self->priv->_app = app;
	self->priv->_connection = connection;
	g_signal_connect_object (app, "index-changed", (GCallback) _g4_mpris_player_on_index_changed_g4_application_index_changed, self, 0);
	g_signal_connect_object (app, "music-changed", (GCallback) _g4_mpris_player_on_music_changed_g4_application_music_changed, self, 0);
	g_signal_connect_object (app, "music-cover-parsed", (GCallback) _g4_mpris_player_on_music_cover_parsed_g4_application_music_cover_parsed, self, 0);
	_tmp0_ = g4_application_get_player (app);
	_tmp1_ = _tmp0_;
	g_signal_connect_object (_tmp1_, "state-changed", (GCallback) _g4_mpris_player_on_state_changed_g4_gst_player_state_changed, self, 0);
	_tmp2_ = g4_application_get_player (app);
	_tmp3_ = _tmp2_;
	g_signal_connect_object (_tmp3_, "duration-changed", (GCallback) _g4_mpris_player_on_duration_changed_g4_gst_player_duration_changed, self, 0);
	return self;
}

G4MprisPlayer*
g4_mpris_player_new (G4Application* app,
                     GDBusConnection* connection)
{
	return g4_mpris_player_construct (G4_TYPE_MPRIS_PLAYER, app, connection);
}

void
g4_mpris_player_next (G4MprisPlayer* self,
                      GError** error)
{
	G4Application* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_app;
	g4_application_play_next (_tmp0_);
}

void
g4_mpris_player_previous (G4MprisPlayer* self,
                          GError** error)
{
	G4Application* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_app;
	g4_application_play_previous (_tmp0_);
}

void
g4_mpris_player_play_pause (G4MprisPlayer* self,
                            GError** error)
{
	G4Application* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_app;
	g4_application_play_pause (_tmp0_);
}

void
g4_mpris_player_play (G4MprisPlayer* self,
                      GError** error)
{
	G4Application* _tmp0_;
	G4GstPlayer* _tmp1_;
	G4GstPlayer* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g4_application_get_player (_tmp0_);
	_tmp2_ = _tmp1_;
	g4_gst_player_play (_tmp2_);
}

void
g4_mpris_player_pause (G4MprisPlayer* self,
                       GError** error)
{
	G4Application* _tmp0_;
	G4GstPlayer* _tmp1_;
	G4GstPlayer* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g4_application_get_player (_tmp0_);
	_tmp2_ = _tmp1_;
	g4_gst_player_pause (_tmp2_);
}

void
g4_mpris_player_seek (G4MprisPlayer* self,
                      gint64 offset,
                      GError** error)
{
	G4Application* _tmp0_;
	G4GstPlayer* _tmp1_;
	G4GstPlayer* _tmp2_;
	G4Application* _tmp3_;
	G4GstPlayer* _tmp4_;
	G4GstPlayer* _tmp5_;
	GstClockTime _tmp6_;
	GstClockTime _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g4_application_get_player (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->_app;
	_tmp4_ = g4_application_get_player (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g4_gst_player_get_position (_tmp5_);
	_tmp7_ = _tmp6_;
	g4_gst_player_set_position (_tmp5_, _tmp7_ + (offset * GST_USECOND));
}

static GVariant*
_variant_new2 (GHashTable* value)
{
	GVariantBuilder _tmp4_;
	GHashTableIter _tmp5_;
	gpointer _tmp6_;
	gpointer _tmp7_;
	g_hash_table_iter_init (&_tmp5_, value);
	g_variant_builder_init (&_tmp4_, G_VARIANT_TYPE ("a{sv}"));
	while (g_hash_table_iter_next (&_tmp5_, &_tmp6_, &_tmp7_)) {
		gchar* _key;
		GVariant* _value;
		_key = (gchar*) _tmp6_;
		_value = (GVariant*) _tmp7_;
		g_variant_builder_add (&_tmp4_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
	}
	return g_variant_ref_sink (g_variant_builder_end (&_tmp4_));
}

static void
g4_mpris_player_on_duration_changed (G4MprisPlayer* self,
                                     GstClockTime duration)
{
	gint64 ms = 0LL;
	g_return_if_fail (self != NULL);
	ms = ((gint64) duration) / GST_USECOND;
	if (self->priv->_current_duration != ms) {
		GHashTable* _tmp0_;
		gchar* _tmp1_;
		GVariant* _tmp2_;
		_tmp0_ = self->priv->_metadata;
		_tmp1_ = g_strdup ("mpris:length");
		_tmp2_ = g_variant_new_int64 (ms);
		g_variant_ref_sink (_tmp2_);
		g_hash_table_insert (_tmp0_, _tmp1_, _tmp2_);
		if (self->priv->_cover_parsed) {
			GHashTable* _tmp3_;
			GVariant* _tmp8_;
			_tmp3_ = self->priv->_metadata;
			_tmp8_ = _variant_new2 (_tmp3_);
			g4_mpris_player_send_property (self, "Metadata", _tmp8_);
			_g_variant_unref0 (_tmp8_);
		}
		self->priv->_current_duration = ms;
	}
}

static void
g4_mpris_player_on_index_changed (G4MprisPlayer* self,
                                  gint index,
                                  guint size)
{
	GVariantBuilder* builder = NULL;
	GVariantType* _tmp0_;
	GVariantType* _tmp1_;
	GVariantBuilder* _tmp2_;
	GVariantBuilder* _tmp3_;
	GVariant* _tmp4_;
	GVariant* _tmp5_;
	GVariant* _tmp6_;
	GVariant* _tmp7_;
	G4Application* _tmp8_;
	G4Music* _tmp9_;
	G4Music* _tmp10_;
	GVariant* _tmp11_;
	GVariant* _tmp12_;
	G4Application* _tmp13_;
	G4Music* _tmp14_;
	G4Music* _tmp15_;
	GVariant* _tmp16_;
	GVariant* _tmp17_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_variant_type_new ("a{sv}");
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_builder_new (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_variant_type_free0 (_tmp1_);
	builder = _tmp3_;
	_tmp4_ = g_variant_new_boolean (index < (((gint) size) - 1));
	g_variant_ref_sink (_tmp4_);
	_tmp5_ = _tmp4_;
	g_variant_builder_add (builder, "{sv}", "CanGoNext", _tmp5_, NULL);
	_g_variant_unref0 (_tmp5_);
	_tmp6_ = g_variant_new_boolean (index > 0);
	g_variant_ref_sink (_tmp6_);
	_tmp7_ = _tmp6_;
	g_variant_builder_add (builder, "{sv}", "CanGoPrevious", _tmp7_, NULL);
	_g_variant_unref0 (_tmp7_);
	_tmp8_ = self->priv->_app;
	_tmp9_ = g4_application_get_current_music (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = g_variant_new_boolean (_tmp10_ != NULL);
	g_variant_ref_sink (_tmp11_);
	_tmp12_ = _tmp11_;
	g_variant_builder_add (builder, "{sv}", "CanPlay", _tmp12_, NULL);
	_g_variant_unref0 (_tmp12_);
	_tmp13_ = self->priv->_app;
	_tmp14_ = g4_application_get_current_music (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = g_variant_new_boolean (_tmp15_ != NULL);
	g_variant_ref_sink (_tmp16_);
	_tmp17_ = _tmp16_;
	g_variant_builder_add (builder, "{sv}", "CanPause", _tmp17_, NULL);
	_g_variant_unref0 (_tmp17_);
	g4_mpris_player_send_properties (self, builder);
	_g_variant_builder_unref0 (builder);
}

static void
g4_mpris_player_on_music_changed (G4MprisPlayer* self,
                                  G4Music* music)
{
	GHashTable* _tmp0_;
	g_return_if_fail (self != NULL);
	self->priv->_cover_parsed = FALSE;
	self->priv->_current_music = music;
	self->priv->_current_duration = (gint64) 0;
	_tmp0_ = self->priv->_metadata;
	g_hash_table_remove_all (_tmp0_);
	if (music != NULL) {
		GVariantBuilder* artists = NULL;
		GVariantType* _tmp1_;
		GVariantType* _tmp2_;
		GVariantBuilder* _tmp3_;
		GVariantBuilder* _tmp4_;
		G4Music* _tmp5_ = NULL;
		const gchar* _tmp6_ = NULL;
		const gchar* _tmp8_ = NULL;
		GVariantBuilder* _tmp9_;
		GHashTable* _tmp10_;
		gchar* _tmp11_;
		GVariantBuilder* _tmp12_;
		GVariant* _tmp13_;
		G4Music* _tmp14_ = NULL;
		const gchar* _tmp15_ = NULL;
		const gchar* _tmp17_ = NULL;
		GHashTable* _tmp18_;
		gchar* _tmp19_;
		GVariant* _tmp20_;
		G4Music* _tmp21_ = NULL;
		const gchar* _tmp22_ = NULL;
		const gchar* _tmp24_ = NULL;
		GHashTable* _tmp25_;
		gchar* _tmp26_;
		GVariant* _tmp27_;
		GHashTable* _tmp28_;
		gchar* _tmp29_;
		GVariant* _tmp30_;
		_tmp1_ = g_variant_type_new ("as");
		_tmp2_ = _tmp1_;
		_tmp3_ = g_variant_builder_new (_tmp2_);
		_tmp4_ = _tmp3_;
		_g_variant_type_free0 (_tmp2_);
		artists = _tmp4_;
		_tmp5_ = music;
		_tmp6_ = NULL;
		if (_tmp5_ != NULL) {
			const gchar* _tmp7_;
			_tmp7_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, G4_TYPE_MUSIC, G4Music)->artist;
			_tmp6_ = _tmp7_;
		}
		_tmp8_ = _tmp6_;
		if (_tmp8_ == NULL) {
			_tmp8_ = "";
		}
		_tmp9_ = artists;
		g_variant_builder_add (_tmp9_, "s", _tmp8_, NULL);
		_tmp10_ = self->priv->_metadata;
		_tmp11_ = g_strdup ("xesam:artist");
		_tmp12_ = artists;
		_tmp13_ = g_variant_builder_end (_tmp12_);
		g_variant_ref_sink (_tmp13_);
		g_hash_table_insert (_tmp10_, _tmp11_, _tmp13_);
		_tmp14_ = music;
		_tmp15_ = NULL;
		if (_tmp14_ != NULL) {
			const gchar* _tmp16_;
			_tmp16_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, G4_TYPE_MUSIC, G4Music)->title;
			_tmp15_ = _tmp16_;
		}
		_tmp17_ = _tmp15_;
		if (_tmp17_ == NULL) {
			_tmp17_ = "";
		}
		_tmp18_ = self->priv->_metadata;
		_tmp19_ = g_strdup ("xesam:title");
		_tmp20_ = g_variant_new_string ((const gchar*) _tmp17_);
		g_variant_ref_sink (_tmp20_);
		g_hash_table_insert (_tmp18_, _tmp19_, _tmp20_);
		_tmp21_ = music;
		_tmp22_ = NULL;
		if (_tmp21_ != NULL) {
			const gchar* _tmp23_;
			_tmp23_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, G4_TYPE_MUSIC, G4Music)->album;
			_tmp22_ = _tmp23_;
		}
		_tmp24_ = _tmp22_;
		if (_tmp24_ == NULL) {
			_tmp24_ = "";
		}
		_tmp25_ = self->priv->_metadata;
		_tmp26_ = g_strdup ("xesam:album");
		_tmp27_ = g_variant_new_string ((const gchar*) _tmp24_);
		g_variant_ref_sink (_tmp27_);
		g_hash_table_insert (_tmp25_, _tmp26_, _tmp27_);
		_tmp28_ = self->priv->_metadata;
		_tmp29_ = g_strdup ("mpris:length");
		_tmp30_ = g_variant_new_int64 (self->priv->_current_duration);
		g_variant_ref_sink (_tmp30_);
		g_hash_table_insert (_tmp28_, _tmp29_, _tmp30_);
		_g_variant_builder_unref0 (artists);
	}
}

static GVariant*
_variant_new3 (GHashTable* value)
{
	GVariantBuilder _tmp6_;
	GHashTableIter _tmp7_;
	gpointer _tmp8_;
	gpointer _tmp9_;
	g_hash_table_iter_init (&_tmp7_, value);
	g_variant_builder_init (&_tmp6_, G_VARIANT_TYPE ("a{sv}"));
	while (g_hash_table_iter_next (&_tmp7_, &_tmp8_, &_tmp9_)) {
		gchar* _key;
		GVariant* _value;
		_key = (gchar*) _tmp8_;
		_value = (GVariant*) _tmp9_;
		g_variant_builder_add (&_tmp6_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
	}
	return g_variant_ref_sink (g_variant_builder_end (&_tmp6_));
}

static void
g4_mpris_player_on_music_cover_parsed (G4MprisPlayer* self,
                                       G4Music* music,
                                       GdkPixbuf* pixbuf,
                                       const gchar* uri)
{
	G4Music* _tmp0_;
	GHashTable* _tmp5_;
	GVariant* _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (music != NULL);
	_tmp0_ = self->priv->_current_music;
	if (_tmp0_ != music) {
		g4_mpris_player_on_music_changed (self, music);
	}
	if (uri != NULL) {
		GHashTable* _tmp1_;
		gchar* _tmp2_;
		GVariant* _tmp3_;
		_tmp1_ = self->priv->_metadata;
		_tmp2_ = g_strdup ("mpris:artUrl");
		_tmp3_ = g_variant_new_string ((const gchar*) uri);
		g_variant_ref_sink (_tmp3_);
		g_hash_table_insert (_tmp1_, _tmp2_, _tmp3_);
	} else {
		GHashTable* _tmp4_;
		_tmp4_ = self->priv->_metadata;
		g_hash_table_remove (_tmp4_, "mpris:artUrl");
	}
	_tmp5_ = self->priv->_metadata;
	_tmp10_ = _variant_new3 (_tmp5_);
	g4_mpris_player_send_property (self, "Metadata", _tmp10_);
	_g_variant_unref0 (_tmp10_);
	self->priv->_cover_parsed = TRUE;
}

static void
g4_mpris_player_on_state_changed (G4MprisPlayer* self,
                                  GstState state)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	GVariant* _tmp2_;
	GVariant* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g4_mpris_player_get_mpris_status (self, state);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_new_string (_tmp1_);
	g_variant_ref_sink (_tmp2_);
	_tmp3_ = _tmp2_;
	g4_mpris_player_send_property (self, "PlaybackStatus", _tmp3_);
	_g_variant_unref0 (_tmp3_);
	_g_free0 (_tmp1_);
}

static void
g4_mpris_player_send_property (G4MprisPlayer* self,
                               const gchar* name,
                               GVariant* variant)
{
	GVariantBuilder* builder = NULL;
	GVariantType* _tmp0_;
	GVariantType* _tmp1_;
	GVariantBuilder* _tmp2_;
	GVariantBuilder* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	g_return_if_fail (variant != NULL);
	_tmp0_ = g_variant_type_new ("a{sv}");
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_builder_new (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_variant_type_free0 (_tmp1_);
	builder = _tmp3_;
	g_variant_builder_add (builder, "{sv}", name, variant, NULL);
	g4_mpris_player_send_properties (self, builder);
	_g_variant_builder_unref0 (builder);
}

static void
g4_mpris_player_send_properties (G4MprisPlayer* self,
                                 GVariantBuilder* builder)
{
	GVariantBuilder* invalid = NULL;
	GVariantType* _tmp0_;
	GVariantType* _tmp1_;
	GVariantBuilder* _tmp2_;
	GVariantBuilder* _tmp3_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (builder != NULL);
	_tmp0_ = g_variant_type_new ("as");
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_builder_new (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_variant_type_free0 (_tmp1_);
	invalid = _tmp3_;
	{
		GDBusConnection* _tmp4_;
		GVariant* _tmp5_;
		GVariant* _tmp6_;
		_tmp4_ = self->priv->_connection;
		_tmp5_ = g_variant_new ("(sa{sv}as)", "org.mpris.MediaPlayer2.Player", builder, invalid, NULL);
		g_variant_ref_sink (_tmp5_);
		_tmp6_ = _tmp5_;
		g_dbus_connection_emit_signal (_tmp4_, NULL, "/org/mpris/MediaPlayer2", "org.freedesktop.DBus.Properties", "PropertiesChanged", _tmp6_, &_inner_error0_);
		_g_variant_unref0 (_tmp6_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp7_;
		const gchar* _tmp8_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp7_ = e;
		_tmp8_ = _tmp7_->message;
		g_warning ("mpris.vala:197: Send MPRIS failed: %s\n", _tmp8_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_variant_builder_unref0 (invalid);
		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);
		g_clear_error (&_inner_error0_);
		return;
	}
	_g_variant_builder_unref0 (invalid);
}

static gchar*
g4_mpris_player_get_mpris_status (G4MprisPlayer* self,
                                  GstState state)
{
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	switch (state) {
		case GST_STATE_PLAYING:
		{
			gchar* _tmp0_;
			_tmp0_ = g_strdup ("Playing");
			result = _tmp0_;
			return result;
		}
		case GST_STATE_PAUSED:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup ("Paused");
			result = _tmp1_;
			return result;
		}
		default:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup ("Stopped");
			result = _tmp2_;
			return result;
		}
	}
}

gboolean
g4_mpris_player_get_can_control (G4MprisPlayer* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = TRUE;
	return result;
}

gboolean
g4_mpris_player_get_can_go_next (G4MprisPlayer* self)
{
	gboolean result;
	G4Application* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	G4Application* _tmp3_;
	GtkFilterListModel* _tmp4_;
	GtkFilterListModel* _tmp5_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g4_application_get_current_item (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->_app;
	_tmp4_ = g4_application_get_current_list (_tmp3_);
	_tmp5_ = _tmp4_;
	result = _tmp2_ < (((gint) g_list_model_get_n_items ((GListModel*) _tmp5_)) - 1);
	return result;
}

gboolean
g4_mpris_player_get_can_go_previous (G4MprisPlayer* self)
{
	gboolean result;
	G4Application* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g4_application_get_current_item (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_ > 0;
	return result;
}

gboolean
g4_mpris_player_get_can_play (G4MprisPlayer* self)
{
	gboolean result;
	G4Application* _tmp0_;
	G4Music* _tmp1_;
	G4Music* _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g4_application_get_current_music (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_ != NULL;
	return result;
}

gboolean
g4_mpris_player_get_can_pause (G4MprisPlayer* self)
{
	gboolean result;
	G4Application* _tmp0_;
	G4Music* _tmp1_;
	G4Music* _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g4_application_get_current_music (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_ != NULL;
	return result;
}

gboolean
g4_mpris_player_get_can_seek (G4MprisPlayer* self)
{
	gboolean result;
	G4Application* _tmp0_;
	G4Music* _tmp1_;
	G4Music* _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g4_application_get_current_music (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_ != NULL;
	return result;
}

GHashTable*
g4_mpris_player_get_metadata (G4MprisPlayer* self)
{
	GHashTable* result;
	GHashTable* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_metadata;
	result = _tmp0_;
	return result;
}

gint64
g4_mpris_player_get_position (G4MprisPlayer* self)
{
	gint64 result;
	G4Application* _tmp0_;
	G4GstPlayer* _tmp1_;
	G4GstPlayer* _tmp2_;
	GstClockTime _tmp3_;
	GstClockTime _tmp4_;
	g_return_val_if_fail (self != NULL, -1LL);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g4_application_get_player (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g4_gst_player_get_position (_tmp2_);
	_tmp4_ = _tmp3_;
	result = ((gint64) _tmp4_) / GST_USECOND;
	return result;
}

gchar*
g4_mpris_player_get_playback_status (G4MprisPlayer* self)
{
	gchar* result;
	G4Application* _tmp0_;
	G4GstPlayer* _tmp1_;
	G4GstPlayer* _tmp2_;
	GstState _tmp3_;
	GstState _tmp4_;
	gchar* _tmp5_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g4_application_get_player (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g4_gst_player_get_state (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = g4_mpris_player_get_mpris_status (self, _tmp4_);
	result = _tmp5_;
	return result;
}

gboolean
g4_mpris_player_get_shuffle (G4MprisPlayer* self)
{
	gboolean result;
	G4Application* _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g4_application_get_sort_mode (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_ == G4_SORT_MODE_SHUFFLE;
	return result;
}

void
g4_mpris_player_set_shuffle (G4MprisPlayer* self,
                             gboolean value)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	if (value) {
		G4Application* _tmp1_;
		guint _tmp2_;
		guint _tmp3_;
		_tmp1_ = self->priv->_app;
		_tmp2_ = g4_application_get_sort_mode (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp0_ = _tmp3_ != G4_SORT_MODE_SHUFFLE;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		G4Application* _tmp4_;
		_tmp4_ = self->priv->_app;
		g4_application_set_sort_mode (_tmp4_, G4_SORT_MODE_SHUFFLE);
	} else {
		G4Application* _tmp5_;
		_tmp5_ = self->priv->_app;
		g4_application_set_sort_mode (_tmp5_, G4_SORT_MODE_TITLE);
	}
	g_object_notify_by_pspec ((GObject *) self, g4_mpris_player_properties[G4_MPRIS_PLAYER_SHUFFLE_PROPERTY]);
}

gdouble
g4_mpris_player_get_volume (G4MprisPlayer* self)
{
	gdouble result;
	G4Application* _tmp0_;
	G4GstPlayer* _tmp1_;
	G4GstPlayer* _tmp2_;
	gdouble _tmp3_;
	gdouble _tmp4_;
	g_return_val_if_fail (self != NULL, -1.0);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g4_application_get_player (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g4_gst_player_get_volume (_tmp2_);
	_tmp4_ = _tmp3_;
	result = _tmp4_;
	return result;
}

void
g4_mpris_player_set_volume (G4MprisPlayer* self,
                            gdouble value)
{
	G4Application* _tmp0_;
	G4GstPlayer* _tmp1_;
	G4GstPlayer* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g4_application_get_player (_tmp0_);
	_tmp2_ = _tmp1_;
	g4_gst_player_set_volume (_tmp2_, value);
	g_object_notify_by_pspec ((GObject *) self, g4_mpris_player_properties[G4_MPRIS_PLAYER_VOLUME_PROPERTY]);
}

static void
g4_mpris_player_class_init (G4MprisPlayerClass * klass,
                            gpointer klass_data)
{
	g4_mpris_player_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &G4MprisPlayer_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_g4_mpris_player_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_g4_mpris_player_set_property;
	G_OBJECT_CLASS (klass)->finalize = g4_mpris_player_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_PLAYER_CAN_CONTROL_PROPERTY, g4_mpris_player_properties[G4_MPRIS_PLAYER_CAN_CONTROL_PROPERTY] = g_param_spec_boolean ("can-control", "can-control", "can-control", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_PLAYER_CAN_GO_NEXT_PROPERTY, g4_mpris_player_properties[G4_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));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_PLAYER_CAN_GO_PREVIOUS_PROPERTY, g4_mpris_player_properties[G4_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));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_PLAYER_CAN_PLAY_PROPERTY, g4_mpris_player_properties[G4_MPRIS_PLAYER_CAN_PLAY_PROPERTY] = g_param_spec_boolean ("can-play", "can-play", "can-play", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_PLAYER_CAN_PAUSE_PROPERTY, g4_mpris_player_properties[G4_MPRIS_PLAYER_CAN_PAUSE_PROPERTY] = g_param_spec_boolean ("can-pause", "can-pause", "can-pause", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_PLAYER_CAN_SEEK_PROPERTY, g4_mpris_player_properties[G4_MPRIS_PLAYER_CAN_SEEK_PROPERTY] = g_param_spec_boolean ("can-seek", "can-seek", "can-seek", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_PLAYER_METADATA_PROPERTY, g4_mpris_player_properties[G4_MPRIS_PLAYER_METADATA_PROPERTY] = g_param_spec_boxed ("metadata", "metadata", "metadata", G_TYPE_HASH_TABLE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_PLAYER_POSITION_PROPERTY, g4_mpris_player_properties[G4_MPRIS_PLAYER_POSITION_PROPERTY] = g_param_spec_int64 ("position", "position", "position", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_PLAYER_PLAYBACK_STATUS_PROPERTY, g4_mpris_player_properties[G4_MPRIS_PLAYER_PLAYBACK_STATUS_PROPERTY] = g_param_spec_string ("playback-status", "playback-status", "playback-status", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_PLAYER_SHUFFLE_PROPERTY, g4_mpris_player_properties[G4_MPRIS_PLAYER_SHUFFLE_PROPERTY] = g_param_spec_boolean ("shuffle", "shuffle", "shuffle", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_PLAYER_VOLUME_PROPERTY, g4_mpris_player_properties[G4_MPRIS_PLAYER_VOLUME_PROPERTY] = g_param_spec_double ("volume", "volume", "volume", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
g4_mpris_player_instance_init (G4MprisPlayer * self,
                               gpointer klass)
{
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	self->priv = g4_mpris_player_get_instance_private (self);
	self->priv->_cover_parsed = FALSE;
	self->priv->_current_duration = (gint64) 0;
	self->priv->_current_music = NULL;
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_variant_unref0_);
	self->priv->_metadata = _tmp2_;
}

static void
g4_mpris_player_finalize (GObject * obj)
{
	G4MprisPlayer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TYPE_MPRIS_PLAYER, G4MprisPlayer);
	_g_hash_table_unref0 (self->priv->_metadata);
	G_OBJECT_CLASS (g4_mpris_player_parent_class)->finalize (obj);
}

static GType
g4_mpris_player_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4MprisPlayerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_mpris_player_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4MprisPlayer), 0, (GInstanceInitFunc) g4_mpris_player_instance_init, NULL };
	GType g4_mpris_player_type_id;
	g4_mpris_player_type_id = g_type_register_static (G_TYPE_OBJECT, "G4MprisPlayer", &g_define_type_info, 0);
	g_type_set_qdata (g4_mpris_player_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) g4_mpris_player_register_object);
	G4MprisPlayer_private_offset = g_type_add_instance_private (g4_mpris_player_type_id, sizeof (G4MprisPlayerPrivate));
	return g4_mpris_player_type_id;
}

GType
g4_mpris_player_get_type (void)
{
	static volatile gsize g4_mpris_player_type_id__once = 0;
	if (g_once_init_enter (&g4_mpris_player_type_id__once)) {
		GType g4_mpris_player_type_id;
		g4_mpris_player_type_id = g4_mpris_player_get_type_once ();
		g_once_init_leave (&g4_mpris_player_type_id__once, g4_mpris_player_type_id);
	}
	return g4_mpris_player_type_id__once;
}

static void
_vala_g4_mpris_player_get_property (GObject * object,
                                    guint property_id,
                                    GValue * value,
                                    GParamSpec * pspec)
{
	G4MprisPlayer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_MPRIS_PLAYER, G4MprisPlayer);
	switch (property_id) {
		case G4_MPRIS_PLAYER_CAN_CONTROL_PROPERTY:
		g_value_set_boolean (value, g4_mpris_player_get_can_control (self));
		break;
		case G4_MPRIS_PLAYER_CAN_GO_NEXT_PROPERTY:
		g_value_set_boolean (value, g4_mpris_player_get_can_go_next (self));
		break;
		case G4_MPRIS_PLAYER_CAN_GO_PREVIOUS_PROPERTY:
		g_value_set_boolean (value, g4_mpris_player_get_can_go_previous (self));
		break;
		case G4_MPRIS_PLAYER_CAN_PLAY_PROPERTY:
		g_value_set_boolean (value, g4_mpris_player_get_can_play (self));
		break;
		case G4_MPRIS_PLAYER_CAN_PAUSE_PROPERTY:
		g_value_set_boolean (value, g4_mpris_player_get_can_pause (self));
		break;
		case G4_MPRIS_PLAYER_CAN_SEEK_PROPERTY:
		g_value_set_boolean (value, g4_mpris_player_get_can_seek (self));
		break;
		case G4_MPRIS_PLAYER_METADATA_PROPERTY:
		g_value_set_boxed (value, g4_mpris_player_get_metadata (self));
		break;
		case G4_MPRIS_PLAYER_POSITION_PROPERTY:
		g_value_set_int64 (value, g4_mpris_player_get_position (self));
		break;
		case G4_MPRIS_PLAYER_PLAYBACK_STATUS_PROPERTY:
		g_value_take_string (value, g4_mpris_player_get_playback_status (self));
		break;
		case G4_MPRIS_PLAYER_SHUFFLE_PROPERTY:
		g_value_set_boolean (value, g4_mpris_player_get_shuffle (self));
		break;
		case G4_MPRIS_PLAYER_VOLUME_PROPERTY:
		g_value_set_double (value, g4_mpris_player_get_volume (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_g4_mpris_player_set_property (GObject * object,
                                    guint property_id,
                                    const GValue * value,
                                    GParamSpec * pspec)
{
	G4MprisPlayer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_MPRIS_PLAYER, G4MprisPlayer);
	switch (property_id) {
		case G4_MPRIS_PLAYER_SHUFFLE_PROPERTY:
		g4_mpris_player_set_shuffle (self, g_value_get_boolean (value));
		break;
		case G4_MPRIS_PLAYER_VOLUME_PROPERTY:
		g4_mpris_player_set_volume (self, g_value_get_double (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_dbus_g4_mpris_player_next (G4MprisPlayer* 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_);
	g4_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_g4_mpris_player_previous (G4MprisPlayer* 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_);
	g4_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_g4_mpris_player_play_pause (G4MprisPlayer* 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_);
	g4_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_g4_mpris_player_play (G4MprisPlayer* 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_);
	g4_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_g4_mpris_player_pause (G4MprisPlayer* 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_);
	g4_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_g4_mpris_player_seek (G4MprisPlayer* self,
                            GVariant* _parameters_,
                            GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gint64 offset = 0LL;
	GVariant* _tmp0_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp0_ = g_variant_iter_next_value (&_arguments_iter);
	offset = g_variant_get_int64 (_tmp0_);
	g_variant_unref (_tmp0_);
	g4_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
g4_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_g4_mpris_player_next (object, parameters, invocation);
	} else if (strcmp (method_name, "Previous") == 0) {
		_dbus_g4_mpris_player_previous (object, parameters, invocation);
	} else if (strcmp (method_name, "PlayPause") == 0) {
		_dbus_g4_mpris_player_play_pause (object, parameters, invocation);
	} else if (strcmp (method_name, "Play") == 0) {
		_dbus_g4_mpris_player_play (object, parameters, invocation);
	} else if (strcmp (method_name, "Pause") == 0) {
		_dbus_g4_mpris_player_pause (object, parameters, invocation);
	} else if (strcmp (method_name, "Seek") == 0) {
		_dbus_g4_mpris_player_seek (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
_dbus_g4_mpris_player_get_can_control (G4MprisPlayer* self)
{
	gboolean result;
	GVariant* _reply;
	result = g4_mpris_player_get_can_control (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_player_get_can_go_next (G4MprisPlayer* self)
{
	gboolean result;
	GVariant* _reply;
	result = g4_mpris_player_get_can_go_next (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_player_get_can_go_previous (G4MprisPlayer* self)
{
	gboolean result;
	GVariant* _reply;
	result = g4_mpris_player_get_can_go_previous (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_player_get_can_play (G4MprisPlayer* self)
{
	gboolean result;
	GVariant* _reply;
	result = g4_mpris_player_get_can_play (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_player_get_can_pause (G4MprisPlayer* self)
{
	gboolean result;
	GVariant* _reply;
	result = g4_mpris_player_get_can_pause (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_player_get_can_seek (G4MprisPlayer* self)
{
	gboolean result;
	GVariant* _reply;
	result = g4_mpris_player_get_can_seek (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_player_get_metadata (G4MprisPlayer* self)
{
	GHashTable* result;
	GVariant* _reply;
	GVariantBuilder _tmp1_;
	GHashTableIter _tmp2_;
	gpointer _tmp3_;
	gpointer _tmp4_;
	result = g4_mpris_player_get_metadata (self);
	g_hash_table_iter_init (&_tmp2_, result);
	g_variant_builder_init (&_tmp1_, G_VARIANT_TYPE ("a{sv}"));
	while (g_hash_table_iter_next (&_tmp2_, &_tmp3_, &_tmp4_)) {
		gchar* _key;
		GVariant* _value;
		_key = (gchar*) _tmp3_;
		_value = (GVariant*) _tmp4_;
		g_variant_builder_add (&_tmp1_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
	}
	_reply = g_variant_builder_end (&_tmp1_);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_player_get_position (G4MprisPlayer* self)
{
	gint64 result;
	GVariant* _reply;
	result = g4_mpris_player_get_position (self);
	_reply = g_variant_new_int64 (result);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_player_get_playback_status (G4MprisPlayer* self)
{
	gchar* result;
	GVariant* _reply;
	result = g4_mpris_player_get_playback_status (self);
	_reply = g_variant_new_string (result);
	_g_free0 (result);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_player_get_shuffle (G4MprisPlayer* self)
{
	gboolean result;
	GVariant* _reply;
	result = g4_mpris_player_get_shuffle (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_player_get_volume (G4MprisPlayer* self)
{
	gdouble result;
	GVariant* _reply;
	result = g4_mpris_player_get_volume (self);
	_reply = g_variant_new_double (result);
	return _reply;
}

static GVariant*
g4_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, "CanControl") == 0) {
		return _dbus_g4_mpris_player_get_can_control (object);
	} else if (strcmp (property_name, "CanGoNext") == 0) {
		return _dbus_g4_mpris_player_get_can_go_next (object);
	} else if (strcmp (property_name, "CanGoPrevious") == 0) {
		return _dbus_g4_mpris_player_get_can_go_previous (object);
	} else if (strcmp (property_name, "CanPlay") == 0) {
		return _dbus_g4_mpris_player_get_can_play (object);
	} else if (strcmp (property_name, "CanPause") == 0) {
		return _dbus_g4_mpris_player_get_can_pause (object);
	} else if (strcmp (property_name, "CanSeek") == 0) {
		return _dbus_g4_mpris_player_get_can_seek (object);
	} else if (strcmp (property_name, "Metadata") == 0) {
		return _dbus_g4_mpris_player_get_metadata (object);
	} else if (strcmp (property_name, "Position") == 0) {
		return _dbus_g4_mpris_player_get_position (object);
	} else if (strcmp (property_name, "PlaybackStatus") == 0) {
		return _dbus_g4_mpris_player_get_playback_status (object);
	} else if (strcmp (property_name, "Shuffle") == 0) {
		return _dbus_g4_mpris_player_get_shuffle (object);
	} else if (strcmp (property_name, "Volume") == 0) {
		return _dbus_g4_mpris_player_get_volume (object);
	}
	return NULL;
}

static void
_dbus_g4_mpris_player_set_shuffle (G4MprisPlayer* self,
                                   GVariant* _value)
{
	gboolean value = FALSE;
	value = g_variant_get_boolean (_value);
	g4_mpris_player_set_shuffle (self, value);
}

static void
_dbus_g4_mpris_player_set_volume (G4MprisPlayer* self,
                                  GVariant* _value)
{
	gdouble value = 0.0;
	value = g_variant_get_double (_value);
	g4_mpris_player_set_volume (self, value);
}

static gboolean
g4_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, "Shuffle") == 0) {
		_dbus_g4_mpris_player_set_shuffle (object, value);
		return TRUE;
	} else if (strcmp (property_name, "Volume") == 0) {
		_dbus_g4_mpris_player_set_volume (object, value);
		return TRUE;
	}
	return FALSE;
}

guint
g4_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 *) (&_g4_mpris_player_dbus_interface_info), &_g4_mpris_player_dbus_interface_vtable, data, _g4_mpris_player_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}

static void
_g4_mpris_player_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
g4_mpris_root_get_instance_private (G4MprisRoot* self)
{
	return G_STRUCT_MEMBER_P (self, G4MprisRoot_private_offset);
}

G4MprisRoot*
g4_mpris_root_construct (GType object_type,
                         G4Application* app)
{
	G4MprisRoot * self = NULL;
	g_return_val_if_fail (app != NULL, NULL);
	self = (G4MprisRoot*) g_object_new (object_type, NULL);
	self->priv->_app = app;
	return self;
}

G4MprisRoot*
g4_mpris_root_new (G4Application* app)
{
	return g4_mpris_root_construct (G4_TYPE_MPRIS_ROOT, app);
}

void
g4_mpris_root_quit (G4MprisRoot* self,
                    GError** error)
{
	G4Application* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_app;
	g_application_quit ((GApplication*) _tmp0_);
}

void
g4_mpris_root_raise (G4MprisRoot* self,
                     GError** error)
{
	G4Application* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_app;
	g_application_activate ((GApplication*) _tmp0_);
}

gboolean
g4_mpris_root_get_can_quit (G4MprisRoot* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = TRUE;
	return result;
}

gboolean
g4_mpris_root_get_can_raise (G4MprisRoot* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = TRUE;
	return result;
}

gboolean
g4_mpris_root_get_has_track_list (G4MprisRoot* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = FALSE;
	return result;
}

const gchar*
g4_mpris_root_get_desktop_entry (G4MprisRoot* self)
{
	const gchar* result;
	G4Application* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g_application_get_application_id ((GApplication*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

const gchar*
g4_mpris_root_get_identity (G4MprisRoot* self)
{
	const gchar* result;
	G4Application* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_app;
	_tmp1_ = g4_application_get_name (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

gchar**
g4_mpris_root_get_supported_uri_schemes (G4MprisRoot* self,
                                         gint* result_length1)
{
	gchar** result;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("file");
	_tmp1_ = g_strdup ("smb");
	_tmp2_ = g_new0 (gchar*, 2 + 1);
	_tmp2_[0] = _tmp0_;
	_tmp2_[1] = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp3__length1 = 2;
	if (result_length1) {
		*result_length1 = _tmp3__length1;
	}
	result = _tmp3_;
	return result;
}

gchar**
g4_mpris_root_get_supported_mime_types (G4MprisRoot* self,
                                        gint* result_length1)
{
	gchar** result;
	gchar* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("audio/*");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = 1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static void
g4_mpris_root_class_init (G4MprisRootClass * klass,
                          gpointer klass_data)
{
	g4_mpris_root_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &G4MprisRoot_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_g4_mpris_root_get_property;
	G_OBJECT_CLASS (klass)->finalize = g4_mpris_root_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_ROOT_CAN_QUIT_PROPERTY, g4_mpris_root_properties[G4_MPRIS_ROOT_CAN_QUIT_PROPERTY] = g_param_spec_boolean ("can-quit", "can-quit", "can-quit", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_ROOT_CAN_RAISE_PROPERTY, g4_mpris_root_properties[G4_MPRIS_ROOT_CAN_RAISE_PROPERTY] = g_param_spec_boolean ("can-raise", "can-raise", "can-raise", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_ROOT_HAS_TRACK_LIST_PROPERTY, g4_mpris_root_properties[G4_MPRIS_ROOT_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));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_ROOT_DESKTOP_ENTRY_PROPERTY, g4_mpris_root_properties[G4_MPRIS_ROOT_DESKTOP_ENTRY_PROPERTY] = g_param_spec_string ("desktop-entry", "desktop-entry", "desktop-entry", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_ROOT_IDENTITY_PROPERTY, g4_mpris_root_properties[G4_MPRIS_ROOT_IDENTITY_PROPERTY] = g_param_spec_string ("identity", "identity", "identity", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_ROOT_SUPPORTED_URI_SCHEMES_PROPERTY, g4_mpris_root_properties[G4_MPRIS_ROOT_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));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MPRIS_ROOT_SUPPORTED_MIME_TYPES_PROPERTY, g4_mpris_root_properties[G4_MPRIS_ROOT_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));
}

static void
g4_mpris_root_instance_init (G4MprisRoot * self,
                             gpointer klass)
{
	self->priv = g4_mpris_root_get_instance_private (self);
}

static void
g4_mpris_root_finalize (GObject * obj)
{
	G4MprisRoot * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TYPE_MPRIS_ROOT, G4MprisRoot);
	G_OBJECT_CLASS (g4_mpris_root_parent_class)->finalize (obj);
}

static GType
g4_mpris_root_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4MprisRootClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_mpris_root_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4MprisRoot), 0, (GInstanceInitFunc) g4_mpris_root_instance_init, NULL };
	GType g4_mpris_root_type_id;
	g4_mpris_root_type_id = g_type_register_static (G_TYPE_OBJECT, "G4MprisRoot", &g_define_type_info, 0);
	g_type_set_qdata (g4_mpris_root_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) g4_mpris_root_register_object);
	G4MprisRoot_private_offset = g_type_add_instance_private (g4_mpris_root_type_id, sizeof (G4MprisRootPrivate));
	return g4_mpris_root_type_id;
}

GType
g4_mpris_root_get_type (void)
{
	static volatile gsize g4_mpris_root_type_id__once = 0;
	if (g_once_init_enter (&g4_mpris_root_type_id__once)) {
		GType g4_mpris_root_type_id;
		g4_mpris_root_type_id = g4_mpris_root_get_type_once ();
		g_once_init_leave (&g4_mpris_root_type_id__once, g4_mpris_root_type_id);
	}
	return g4_mpris_root_type_id__once;
}

static void
_vala_g4_mpris_root_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	G4MprisRoot * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_MPRIS_ROOT, G4MprisRoot);
	switch (property_id) {
		case G4_MPRIS_ROOT_CAN_QUIT_PROPERTY:
		g_value_set_boolean (value, g4_mpris_root_get_can_quit (self));
		break;
		case G4_MPRIS_ROOT_CAN_RAISE_PROPERTY:
		g_value_set_boolean (value, g4_mpris_root_get_can_raise (self));
		break;
		case G4_MPRIS_ROOT_HAS_TRACK_LIST_PROPERTY:
		g_value_set_boolean (value, g4_mpris_root_get_has_track_list (self));
		break;
		case G4_MPRIS_ROOT_DESKTOP_ENTRY_PROPERTY:
		g_value_set_string (value, g4_mpris_root_get_desktop_entry (self));
		break;
		case G4_MPRIS_ROOT_IDENTITY_PROPERTY:
		g_value_set_string (value, g4_mpris_root_get_identity (self));
		break;
		case G4_MPRIS_ROOT_SUPPORTED_URI_SCHEMES_PROPERTY:
		{
			int length;
			g_value_take_boxed (value, g4_mpris_root_get_supported_uri_schemes (self, &length));
		}
		break;
		case G4_MPRIS_ROOT_SUPPORTED_MIME_TYPES_PROPERTY:
		{
			int length;
			g_value_take_boxed (value, g4_mpris_root_get_supported_mime_types (self, &length));
		}
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_dbus_g4_mpris_root_quit (G4MprisRoot* 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_);
	g4_mpris_root_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
_dbus_g4_mpris_root_raise (G4MprisRoot* 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_);
	g4_mpris_root_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
g4_mpris_root_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, "Quit") == 0) {
		_dbus_g4_mpris_root_quit (object, parameters, invocation);
	} else if (strcmp (method_name, "Raise") == 0) {
		_dbus_g4_mpris_root_raise (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
_dbus_g4_mpris_root_get_can_quit (G4MprisRoot* self)
{
	gboolean result;
	GVariant* _reply;
	result = g4_mpris_root_get_can_quit (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_root_get_can_raise (G4MprisRoot* self)
{
	gboolean result;
	GVariant* _reply;
	result = g4_mpris_root_get_can_raise (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_root_get_has_track_list (G4MprisRoot* self)
{
	gboolean result;
	GVariant* _reply;
	result = g4_mpris_root_get_has_track_list (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_root_get_desktop_entry (G4MprisRoot* self)
{
	const gchar* result;
	GVariant* _reply;
	result = g4_mpris_root_get_desktop_entry (self);
	_reply = g_variant_new_string (result);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_root_get_identity (G4MprisRoot* self)
{
	const gchar* result;
	GVariant* _reply;
	result = g4_mpris_root_get_identity (self);
	_reply = g_variant_new_string (result);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_root_get_supported_uri_schemes (G4MprisRoot* self)
{
	gchar** result;
	gint result_length1 = 0;
	GVariant* _reply;
	gchar** _tmp5_;
	GVariantBuilder _tmp6_;
	gint _tmp7_;
	result = g4_mpris_root_get_supported_uri_schemes (self, &result_length1);
	_tmp5_ = result;
	g_variant_builder_init (&_tmp6_, G_VARIANT_TYPE ("as"));
	for (_tmp7_ = 0; _tmp7_ < result_length1; _tmp7_++) {
		g_variant_builder_add_value (&_tmp6_, g_variant_new_string (*_tmp5_));
		_tmp5_++;
	}
	_reply = g_variant_builder_end (&_tmp6_);
	result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
	return _reply;
}

static GVariant*
_dbus_g4_mpris_root_get_supported_mime_types (G4MprisRoot* self)
{
	gchar** result;
	gint result_length1 = 0;
	GVariant* _reply;
	gchar** _tmp8_;
	GVariantBuilder _tmp9_;
	gint _tmp10_;
	result = g4_mpris_root_get_supported_mime_types (self, &result_length1);
	_tmp8_ = result;
	g_variant_builder_init (&_tmp9_, G_VARIANT_TYPE ("as"));
	for (_tmp10_ = 0; _tmp10_ < result_length1; _tmp10_++) {
		g_variant_builder_add_value (&_tmp9_, g_variant_new_string (*_tmp8_));
		_tmp8_++;
	}
	_reply = g_variant_builder_end (&_tmp9_);
	result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
	return _reply;
}

static GVariant*
g4_mpris_root_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, "CanQuit") == 0) {
		return _dbus_g4_mpris_root_get_can_quit (object);
	} else if (strcmp (property_name, "CanRaise") == 0) {
		return _dbus_g4_mpris_root_get_can_raise (object);
	} else if (strcmp (property_name, "HasTrackList") == 0) {
		return _dbus_g4_mpris_root_get_has_track_list (object);
	} else if (strcmp (property_name, "DesktopEntry") == 0) {
		return _dbus_g4_mpris_root_get_desktop_entry (object);
	} else if (strcmp (property_name, "Identity") == 0) {
		return _dbus_g4_mpris_root_get_identity (object);
	} else if (strcmp (property_name, "SupportedUriSchemes") == 0) {
		return _dbus_g4_mpris_root_get_supported_uri_schemes (object);
	} else if (strcmp (property_name, "SupportedMimeTypes") == 0) {
		return _dbus_g4_mpris_root_get_supported_mime_types (object);
	}
	return NULL;
}

static gboolean
g4_mpris_root_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)
{
	return FALSE;
}

guint
g4_mpris_root_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 *) (&_g4_mpris_root_dbus_interface_info), &_g4_mpris_root_dbus_interface_vtable, data, _g4_mpris_root_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}

static void
_g4_mpris_root_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 void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

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

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

