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

/*
 * Copyright (c) 2026 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include "ft_plugin_mpris.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>

#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

typedef GDBusProxy MprisPlayerProxy;
typedef GDBusProxyClass MprisPlayerProxyClass;
typedef struct _MprisPlayerPlayReadyData MprisPlayerPlayReadyData;
typedef struct _MprisPlayerPlayPauseReadyData MprisPlayerPlayPauseReadyData;
typedef struct _MprisPlayerPauseReadyData MprisPlayerPauseReadyData;
typedef struct _MprisPlayerSeekReadyData MprisPlayerSeekReadyData;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef void (*MprisNameOwnerChangedFunc) (GDBusConnection* connection, const gchar* name, const gchar* old_owner, const gchar* new_owner, gpointer user_data);
typedef struct _Block9Data Block9Data;

struct _MprisPlayerPlayReadyData {
	GDBusMethodInvocation* _invocation_;
};

struct _MprisPlayerPlayPauseReadyData {
	GDBusMethodInvocation* _invocation_;
};

struct _MprisPlayerPauseReadyData {
	GDBusMethodInvocation* _invocation_;
};

struct _MprisPlayerSeekReadyData {
	GDBusMethodInvocation* _invocation_;
	gint64 offset;
};

struct _Block9Data {
	int _ref_count_;
	MprisNameOwnerChangedFunc func;
	gpointer func_target;
};

static GType mpris_player_type_id = 0;

static void mpris_player_proxy_g_signal (GDBusProxy* proxy,
                                  const gchar* sender_name,
                                  const gchar* signal_name,
                                  GVariant* parameters);
static void _vala_g_async_ready_callback (GObject *source_object,
                                   GAsyncResult *res,
                                   void *user_data);
static void mpris_player_proxy_play_async (MprisPlayer* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
static void mpris_player_proxy_play_finish (MprisPlayer* self,
                                     GAsyncResult* _res_,
                                     GError** error);
static void mpris_player_proxy_play_pause_async (MprisPlayer* self,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void mpris_player_proxy_play_pause_finish (MprisPlayer* self,
                                           GAsyncResult* _res_,
                                           GError** error);
static void mpris_player_proxy_pause_async (MprisPlayer* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
static void mpris_player_proxy_pause_finish (MprisPlayer* self,
                                      GAsyncResult* _res_,
                                      GError** error);
static void mpris_player_proxy_seek_async (MprisPlayer* self,
                                    gint64 offset,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
static void mpris_player_proxy_seek_finish (MprisPlayer* self,
                                     GAsyncResult* _res_,
                                     GError** error);
static gchar* mpris_player_dbus_proxy_get_playback_status (MprisPlayer* self);
static gboolean mpris_player_dbus_proxy_get_can_play (MprisPlayer* self);
static gboolean mpris_player_dbus_proxy_get_can_pause (MprisPlayer* self);
static gboolean mpris_player_dbus_proxy_get_can_seek (MprisPlayer* self);
static void mpris_player_proxy_mpris_player_interface_init (MprisPlayerIface* iface);
static void _dbus_mpris_player_play (MprisPlayer* self,
                              GVariant* _parameters_,
                              GDBusMethodInvocation* invocation);
static void _dbus_mpris_player_play_ready (GObject * source_object,
                                    GAsyncResult * _res_,
                                    gpointer _user_data_);
static void _dbus_mpris_player_play_pause (MprisPlayer* self,
                                    GVariant* _parameters_,
                                    GDBusMethodInvocation* invocation);
static void _dbus_mpris_player_play_pause_ready (GObject * source_object,
                                          GAsyncResult * _res_,
                                          gpointer _user_data_);
static void _dbus_mpris_player_pause (MprisPlayer* self,
                               GVariant* _parameters_,
                               GDBusMethodInvocation* invocation);
static void _dbus_mpris_player_pause_ready (GObject * source_object,
                                     GAsyncResult * _res_,
                                     gpointer _user_data_);
static void _dbus_mpris_player_seek (MprisPlayer* self,
                              GVariant* _parameters_,
                              GDBusMethodInvocation* invocation);
static void _dbus_mpris_player_seek_ready (GObject * source_object,
                                    GAsyncResult * _res_,
                                    gpointer _user_data_);
static void mpris_player_dbus_interface_method_call (GDBusConnection* connection,
                                              const gchar* sender,
                                              const gchar* object_path,
                                              const gchar* interface_name,
                                              const gchar* method_name,
                                              GVariant* parameters,
                                              GDBusMethodInvocation* invocation,
                                              gpointer user_data);
static GVariant* mpris_player_dbus_interface_get_property (GDBusConnection* connection,
                                                    const gchar* sender,
                                                    const gchar* object_path,
                                                    const gchar* interface_name,
                                                    const gchar* property_name,
                                                    GError** error,
                                                    gpointer user_data);
static GVariant* _dbus_mpris_player_get_playback_status (MprisPlayer* self);
static GVariant* _dbus_mpris_player_get_can_play (MprisPlayer* self);
static GVariant* _dbus_mpris_player_get_can_pause (MprisPlayer* self);
static GVariant* _dbus_mpris_player_get_can_seek (MprisPlayer* self);
static gboolean mpris_player_dbus_interface_set_property (GDBusConnection* connection,
                                                   const gchar* sender,
                                                   const gchar* object_path,
                                                   const gchar* interface_name,
                                                   const gchar* property_name,
                                                   GVariant* value,
                                                   GError** error,
                                                   gpointer user_data);
static void _mpris_player_unregister_object (gpointer user_data);
VALA_EXTERN gchar** mpris_list_dbus_names (GDBusConnection* connection,
                               gint timeout,
                               gint* result_length1);
static void _vala_array_add1 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
VALA_EXTERN guint mpris_dbus_subscribe_name_owner_changed (GDBusConnection* connection,
                                               MprisNameOwnerChangedFunc func,
                                               gpointer func_target);
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
static void __lambda6_ (Block9Data* _data9_,
                 GDBusConnection* connection_,
                 const gchar* sender_name,
                 const gchar* object_path,
                 const gchar* interface_name,
                 const gchar* signal_name,
                 GVariant* parameters);
static void ___lambda6__gd_bus_signal_callback (GDBusConnection* connection,
                                         const gchar* sender_name,
                                         const gchar* object_path,
                                         const gchar* interface_name,
                                         const gchar* signal_name,
                                         GVariant* parameters,
                                         gpointer self);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static const GDBusArgInfo * const _mpris_player_dbus_arg_info_play_in[] = {NULL};
static const GDBusArgInfo * const _mpris_player_dbus_arg_info_play_out[] = {NULL};
static const GDBusMethodInfo _mpris_player_dbus_method_info_play = {-1, "Play", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_play_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_play_out), NULL};
static const GDBusArgInfo * const _mpris_player_dbus_arg_info_play_pause_in[] = {NULL};
static const GDBusArgInfo * const _mpris_player_dbus_arg_info_play_pause_out[] = {NULL};
static const GDBusMethodInfo _mpris_player_dbus_method_info_play_pause = {-1, "PlayPause", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_play_pause_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_play_pause_out), NULL};
static const GDBusArgInfo * const _mpris_player_dbus_arg_info_pause_in[] = {NULL};
static const GDBusArgInfo * const _mpris_player_dbus_arg_info_pause_out[] = {NULL};
static const GDBusMethodInfo _mpris_player_dbus_method_info_pause = {-1, "Pause", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_pause_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_pause_out), NULL};
static const GDBusArgInfo _mpris_player_dbus_arg_info_seek_offset = {-1, "offset", "x", NULL};
static const GDBusArgInfo * const _mpris_player_dbus_arg_info_seek_in[] = {&_mpris_player_dbus_arg_info_seek_offset, NULL};
static const GDBusArgInfo * const _mpris_player_dbus_arg_info_seek_out[] = {NULL};
static const GDBusMethodInfo _mpris_player_dbus_method_info_seek = {-1, "Seek", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_seek_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_seek_out), NULL};
static const GDBusMethodInfo * const _mpris_player_dbus_method_info[] = {&_mpris_player_dbus_method_info_play, &_mpris_player_dbus_method_info_play_pause, &_mpris_player_dbus_method_info_pause, &_mpris_player_dbus_method_info_seek, NULL};
static const GDBusSignalInfo * const _mpris_player_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo _mpris_player_dbus_property_info_playback_status = {-1, "PlaybackStatus", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _mpris_player_dbus_property_info_can_play = {-1, "CanPlay", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _mpris_player_dbus_property_info_can_pause = {-1, "CanPause", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo _mpris_player_dbus_property_info_can_seek = {-1, "CanSeek", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo * const _mpris_player_dbus_property_info[] = {&_mpris_player_dbus_property_info_playback_status, &_mpris_player_dbus_property_info_can_play, &_mpris_player_dbus_property_info_can_pause, &_mpris_player_dbus_property_info_can_seek, NULL};
static const GDBusInterfaceInfo _mpris_player_dbus_interface_info = {-1, "org.mpris.MediaPlayer2.Player", (GDBusMethodInfo **) (&_mpris_player_dbus_method_info), (GDBusSignalInfo **) (&_mpris_player_dbus_signal_info), (GDBusPropertyInfo **) (&_mpris_player_dbus_property_info), NULL};
static const GDBusInterfaceVTable _mpris_player_dbus_interface_vtable = {mpris_player_dbus_interface_method_call, mpris_player_dbus_interface_get_property, mpris_player_dbus_interface_set_property};

MprisPlaybackStatus
mpris_playback_status_from_string (const gchar* status)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	static GQuark _tmp1_label2 = 0;
	MprisPlaybackStatus result;
	_tmp0_ = status;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("Stopped")))) {
		switch (0) {
			default:
			{
				result = MPRIS_PLAYBACK_STATUS_STOPPED;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("Playing")))) {
		switch (0) {
			default:
			{
				result = MPRIS_PLAYBACK_STATUS_PLAYING;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label2) ? _tmp1_label2 : (_tmp1_label2 = g_quark_from_static_string ("Paused")))) {
		switch (0) {
			default:
			{
				result = MPRIS_PLAYBACK_STATUS_PAUSED;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				result = MPRIS_PLAYBACK_STATUS_UNKNOWN;
				return result;
			}
		}
	}
}

static GType
mpris_playback_status_get_type_once (void)
{
	static const GEnumValue values[] = {{MPRIS_PLAYBACK_STATUS_UNKNOWN, "MPRIS_PLAYBACK_STATUS_UNKNOWN", "unknown"}, {MPRIS_PLAYBACK_STATUS_STOPPED, "MPRIS_PLAYBACK_STATUS_STOPPED", "stopped"}, {MPRIS_PLAYBACK_STATUS_PLAYING, "MPRIS_PLAYBACK_STATUS_PLAYING", "playing"}, {MPRIS_PLAYBACK_STATUS_PAUSED, "MPRIS_PLAYBACK_STATUS_PAUSED", "paused"}, {0, NULL, NULL}};
	GType mpris_playback_status_type_id;
	mpris_playback_status_type_id = g_enum_register_static ("MprisPlaybackStatus", values);
	return mpris_playback_status_type_id;
}

GType
mpris_playback_status_get_type (void)
{
	static volatile gsize mpris_playback_status_type_id__once = 0;
	if (g_once_init_enter (&mpris_playback_status_type_id__once)) {
		GType mpris_playback_status_type_id;
		mpris_playback_status_type_id = mpris_playback_status_get_type_once ();
		g_once_init_leave (&mpris_playback_status_type_id__once, mpris_playback_status_type_id);
	}
	return mpris_playback_status_type_id__once;
}

void
mpris_player_play (MprisPlayer* self,
                   GAsyncReadyCallback _callback_,
                   gpointer _user_data_)
{
	MprisPlayerIface* _iface_;
	_iface_ = MPRIS_PLAYER_GET_INTERFACE (self);
	if (_iface_->play) {
		_iface_->play (self, _callback_, _user_data_);
	}
}

void
mpris_player_play_finish (MprisPlayer* self,
                          GAsyncResult* _res_,
                          GError** error)
{
	MprisPlayerIface* _iface_;
	_iface_ = MPRIS_PLAYER_GET_INTERFACE (self);
	if (_iface_->play_finish) {
		_iface_->play_finish (self, _res_, error);
	}
}

void
mpris_player_play_pause (MprisPlayer* self,
                         GAsyncReadyCallback _callback_,
                         gpointer _user_data_)
{
	MprisPlayerIface* _iface_;
	_iface_ = MPRIS_PLAYER_GET_INTERFACE (self);
	if (_iface_->play_pause) {
		_iface_->play_pause (self, _callback_, _user_data_);
	}
}

void
mpris_player_play_pause_finish (MprisPlayer* self,
                                GAsyncResult* _res_,
                                GError** error)
{
	MprisPlayerIface* _iface_;
	_iface_ = MPRIS_PLAYER_GET_INTERFACE (self);
	if (_iface_->play_pause_finish) {
		_iface_->play_pause_finish (self, _res_, error);
	}
}

void
mpris_player_pause (MprisPlayer* self,
                    GAsyncReadyCallback _callback_,
                    gpointer _user_data_)
{
	MprisPlayerIface* _iface_;
	_iface_ = MPRIS_PLAYER_GET_INTERFACE (self);
	if (_iface_->pause) {
		_iface_->pause (self, _callback_, _user_data_);
	}
}

void
mpris_player_pause_finish (MprisPlayer* self,
                           GAsyncResult* _res_,
                           GError** error)
{
	MprisPlayerIface* _iface_;
	_iface_ = MPRIS_PLAYER_GET_INTERFACE (self);
	if (_iface_->pause_finish) {
		_iface_->pause_finish (self, _res_, error);
	}
}

void
mpris_player_seek (MprisPlayer* self,
                   gint64 offset,
                   GAsyncReadyCallback _callback_,
                   gpointer _user_data_)
{
	MprisPlayerIface* _iface_;
	_iface_ = MPRIS_PLAYER_GET_INTERFACE (self);
	if (_iface_->seek) {
		_iface_->seek (self, offset, _callback_, _user_data_);
	}
}

void
mpris_player_seek_finish (MprisPlayer* self,
                          GAsyncResult* _res_,
                          GError** error)
{
	MprisPlayerIface* _iface_;
	_iface_ = MPRIS_PLAYER_GET_INTERFACE (self);
	if (_iface_->seek_finish) {
		_iface_->seek_finish (self, _res_, error);
	}
}

gchar*
mpris_player_get_playback_status (MprisPlayer* self)
{
	MprisPlayerIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = MPRIS_PLAYER_GET_INTERFACE (self);
	if (_iface_->get_playback_status) {
		return _iface_->get_playback_status (self);
	}
	return NULL;
}

gboolean
mpris_player_get_can_play (MprisPlayer* self)
{
	MprisPlayerIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = MPRIS_PLAYER_GET_INTERFACE (self);
	if (_iface_->get_can_play) {
		return _iface_->get_can_play (self);
	}
	return FALSE;
}

gboolean
mpris_player_get_can_pause (MprisPlayer* self)
{
	MprisPlayerIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = MPRIS_PLAYER_GET_INTERFACE (self);
	if (_iface_->get_can_pause) {
		return _iface_->get_can_pause (self);
	}
	return FALSE;
}

gboolean
mpris_player_get_can_seek (MprisPlayer* self)
{
	MprisPlayerIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = MPRIS_PLAYER_GET_INTERFACE (self);
	if (_iface_->get_can_seek) {
		return _iface_->get_can_seek (self);
	}
	return FALSE;
}

static void
mpris_player_default_init (MprisPlayerIface * iface,
                           gpointer iface_data)
{
}

/**
     * https://specifications.freedesktop.org/mpris/latest/Player_Interface.html
     */
GType
mpris_player_get_type (void)
{
	return mpris_player_type_id;
}

GType
mpris_player_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (MprisPlayerIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) mpris_player_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	mpris_player_type_id = g_type_module_register_type (module, G_TYPE_INTERFACE, "MprisPlayer", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (mpris_player_type_id, G_TYPE_OBJECT);
	g_type_set_qdata (mpris_player_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) mpris_player_proxy_get_type);
	g_type_set_qdata (mpris_player_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.mpris.MediaPlayer2.Player");
	g_type_set_qdata (mpris_player_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_mpris_player_dbus_interface_info));
	g_type_set_qdata (mpris_player_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) mpris_player_register_object);
	return mpris_player_type_id;
}

G_DEFINE_DYNAMIC_TYPE_EXTENDED (MprisPlayerProxy, mpris_player_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE_DYNAMIC (MPRIS_TYPE_PLAYER, mpris_player_proxy_mpris_player_interface_init) )
static void
mpris_player_proxy_class_init (MprisPlayerProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = mpris_player_proxy_g_signal;
}

static void
mpris_player_proxy_g_signal (GDBusProxy* proxy,
                             const gchar* sender_name,
                             const gchar* signal_name,
                             GVariant* parameters)
{
}

static void
mpris_player_proxy_class_finalize (MprisPlayerProxyClass* klass)
{
}

void
mpris_player_proxy_register_dynamic_type (GTypeModule* module)
{
	mpris_player_proxy_register_type (module);
}

static void
mpris_player_proxy_init (MprisPlayerProxy* self)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_mpris_player_dbus_interface_info));
}

static void
_vala_g_async_ready_callback (GObject *source_object,
                              GAsyncResult *res,
                              void *user_data)
{
	g_task_return_pointer (user_data, g_object_ref (res), g_object_unref);
	g_object_unref (user_data);
}

static void
mpris_player_proxy_play_async (MprisPlayer* self,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	G_DBUS_ERROR;
	G_IO_ERROR;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Player", "Play");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	if (_callback_ != NULL) {
		g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
	} else {
		g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
		g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	}
	g_object_unref (_message);
}

static void
mpris_player_proxy_play_finish (MprisPlayer* self,
                                GAsyncResult* _res_,
                                GError** error)
{
	GAsyncResult *_inner_res;
	GDBusMessage *_reply_message;
	_inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
	_reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), _inner_res, error);
	g_object_unref (_inner_res);
	if (!_reply_message) {
		return;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}

static void
mpris_player_proxy_play_pause_async (MprisPlayer* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	G_DBUS_ERROR;
	G_IO_ERROR;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Player", "PlayPause");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	if (_callback_ != NULL) {
		g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
	} else {
		g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
		g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	}
	g_object_unref (_message);
}

static void
mpris_player_proxy_play_pause_finish (MprisPlayer* self,
                                      GAsyncResult* _res_,
                                      GError** error)
{
	GAsyncResult *_inner_res;
	GDBusMessage *_reply_message;
	_inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
	_reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), _inner_res, error);
	g_object_unref (_inner_res);
	if (!_reply_message) {
		return;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}

static void
mpris_player_proxy_pause_async (MprisPlayer* self,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	G_DBUS_ERROR;
	G_IO_ERROR;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Player", "Pause");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	if (_callback_ != NULL) {
		g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
	} else {
		g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
		g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	}
	g_object_unref (_message);
}

static void
mpris_player_proxy_pause_finish (MprisPlayer* self,
                                 GAsyncResult* _res_,
                                 GError** error)
{
	GAsyncResult *_inner_res;
	GDBusMessage *_reply_message;
	_inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
	_reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), _inner_res, error);
	g_object_unref (_inner_res);
	if (!_reply_message) {
		return;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}

static void
mpris_player_proxy_seek_async (MprisPlayer* self,
                               gint64 offset,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	G_DBUS_ERROR;
	G_IO_ERROR;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Player", "Seek");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int64 (offset));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	if (_callback_ != NULL) {
		g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
	} else {
		g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
		g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	}
	g_object_unref (_message);
}

static void
mpris_player_proxy_seek_finish (MprisPlayer* self,
                                GAsyncResult* _res_,
                                GError** error)
{
	GAsyncResult *_inner_res;
	GDBusMessage *_reply_message;
	_inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
	_reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), _inner_res, error);
	g_object_unref (_inner_res);
	if (!_reply_message) {
		return;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}

static gchar*
mpris_player_dbus_proxy_get_playback_status (MprisPlayer* self)
{
	GVariant *_inner_reply;
	gchar* _result;
	_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "PlaybackStatus");
	if (!_inner_reply) {
		GVariant *_arguments;
		GVariant *_reply;
		GVariantBuilder _arguments_builder;
		g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("PlaybackStatus"));
		_arguments = g_variant_builder_end (&_arguments_builder);
		_reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
		if (!_reply) {
			return NULL;
		}
		g_variant_get (_reply, "(v)", &_inner_reply);
		g_variant_unref (_reply);
	}
	_result = g_variant_dup_string (_inner_reply, NULL);
	g_variant_unref (_inner_reply);
	return _result;
}

static gboolean
mpris_player_dbus_proxy_get_can_play (MprisPlayer* self)
{
	GVariant *_inner_reply;
	gboolean _result;
	_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "CanPlay");
	if (!_inner_reply) {
		GVariant *_arguments;
		GVariant *_reply;
		GVariantBuilder _arguments_builder;
		g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("CanPlay"));
		_arguments = g_variant_builder_end (&_arguments_builder);
		_reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
		if (!_reply) {
			gboolean _tmp0_ = FALSE;
			return _tmp0_;
		}
		g_variant_get (_reply, "(v)", &_inner_reply);
		g_variant_unref (_reply);
	}
	_result = g_variant_get_boolean (_inner_reply);
	g_variant_unref (_inner_reply);
	return _result;
}

static gboolean
mpris_player_dbus_proxy_get_can_pause (MprisPlayer* self)
{
	GVariant *_inner_reply;
	gboolean _result;
	_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "CanPause");
	if (!_inner_reply) {
		GVariant *_arguments;
		GVariant *_reply;
		GVariantBuilder _arguments_builder;
		g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("CanPause"));
		_arguments = g_variant_builder_end (&_arguments_builder);
		_reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
		if (!_reply) {
			gboolean _tmp1_ = FALSE;
			return _tmp1_;
		}
		g_variant_get (_reply, "(v)", &_inner_reply);
		g_variant_unref (_reply);
	}
	_result = g_variant_get_boolean (_inner_reply);
	g_variant_unref (_inner_reply);
	return _result;
}

static gboolean
mpris_player_dbus_proxy_get_can_seek (MprisPlayer* self)
{
	GVariant *_inner_reply;
	gboolean _result;
	_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "CanSeek");
	if (!_inner_reply) {
		GVariant *_arguments;
		GVariant *_reply;
		GVariantBuilder _arguments_builder;
		g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("CanSeek"));
		_arguments = g_variant_builder_end (&_arguments_builder);
		_reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
		if (!_reply) {
			gboolean _tmp2_ = FALSE;
			return _tmp2_;
		}
		g_variant_get (_reply, "(v)", &_inner_reply);
		g_variant_unref (_reply);
	}
	_result = g_variant_get_boolean (_inner_reply);
	g_variant_unref (_inner_reply);
	return _result;
}

static void
mpris_player_proxy_mpris_player_interface_init (MprisPlayerIface* iface)
{
	iface->play = mpris_player_proxy_play_async;
	iface->play_finish = mpris_player_proxy_play_finish;
	iface->play_pause = mpris_player_proxy_play_pause_async;
	iface->play_pause_finish = mpris_player_proxy_play_pause_finish;
	iface->pause = mpris_player_proxy_pause_async;
	iface->pause_finish = mpris_player_proxy_pause_finish;
	iface->seek = mpris_player_proxy_seek_async;
	iface->seek_finish = mpris_player_proxy_seek_finish;
	iface->get_playback_status = mpris_player_dbus_proxy_get_playback_status;
	iface->get_can_play = mpris_player_dbus_proxy_get_can_play;
	iface->get_can_pause = mpris_player_dbus_proxy_get_can_pause;
	iface->get_can_seek = mpris_player_dbus_proxy_get_can_seek;
}

static void
_dbus_mpris_player_play (MprisPlayer* self,
                         GVariant* _parameters_,
                         GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	MprisPlayerPlayReadyData* _ready_data;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (MprisPlayerPlayReadyData);
	_ready_data->_invocation_ = invocation;
	mpris_player_play (self, (GAsyncReadyCallback) _dbus_mpris_player_play_ready, _ready_data);
}

static void
_dbus_mpris_player_play_ready (GObject * source_object,
                               GAsyncResult * _res_,
                               gpointer _user_data_)
{
	MprisPlayerPlayReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	mpris_player_play_finish ((MprisPlayer*) source_object, _res_, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	g_slice_free (MprisPlayerPlayReadyData, _ready_data);
}

static void
_dbus_mpris_player_play_pause (MprisPlayer* self,
                               GVariant* _parameters_,
                               GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	MprisPlayerPlayPauseReadyData* _ready_data;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (MprisPlayerPlayPauseReadyData);
	_ready_data->_invocation_ = invocation;
	mpris_player_play_pause (self, (GAsyncReadyCallback) _dbus_mpris_player_play_pause_ready, _ready_data);
}

static void
_dbus_mpris_player_play_pause_ready (GObject * source_object,
                                     GAsyncResult * _res_,
                                     gpointer _user_data_)
{
	MprisPlayerPlayPauseReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	mpris_player_play_pause_finish ((MprisPlayer*) source_object, _res_, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	g_slice_free (MprisPlayerPlayPauseReadyData, _ready_data);
}

static void
_dbus_mpris_player_pause (MprisPlayer* self,
                          GVariant* _parameters_,
                          GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	MprisPlayerPauseReadyData* _ready_data;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (MprisPlayerPauseReadyData);
	_ready_data->_invocation_ = invocation;
	mpris_player_pause (self, (GAsyncReadyCallback) _dbus_mpris_player_pause_ready, _ready_data);
}

static void
_dbus_mpris_player_pause_ready (GObject * source_object,
                                GAsyncResult * _res_,
                                gpointer _user_data_)
{
	MprisPlayerPauseReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	mpris_player_pause_finish ((MprisPlayer*) source_object, _res_, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	g_slice_free (MprisPlayerPauseReadyData, _ready_data);
}

static void
_dbus_mpris_player_seek (MprisPlayer* self,
                         GVariant* _parameters_,
                         GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	MprisPlayerSeekReadyData* _ready_data;
	GVariant* _tmp3_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (MprisPlayerSeekReadyData);
	_ready_data->_invocation_ = invocation;
	_tmp3_ = g_variant_iter_next_value (&_arguments_iter);
	_ready_data->offset = g_variant_get_int64 (_tmp3_);
	g_variant_unref (_tmp3_);
	mpris_player_seek (self, _ready_data->offset, (GAsyncReadyCallback) _dbus_mpris_player_seek_ready, _ready_data);
}

static void
_dbus_mpris_player_seek_ready (GObject * source_object,
                               GAsyncResult * _res_,
                               gpointer _user_data_)
{
	MprisPlayerSeekReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	mpris_player_seek_finish ((MprisPlayer*) source_object, _res_, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	g_slice_free (MprisPlayerSeekReadyData, _ready_data);
}

static void
mpris_player_dbus_interface_method_call (GDBusConnection* connection,
                                         const gchar* sender,
                                         const gchar* object_path,
                                         const gchar* interface_name,
                                         const gchar* method_name,
                                         GVariant* parameters,
                                         GDBusMethodInvocation* invocation,
                                         gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (method_name, "Play") == 0) {
		_dbus_mpris_player_play (object, parameters, invocation);
	} else if (strcmp (method_name, "PlayPause") == 0) {
		_dbus_mpris_player_play_pause (object, parameters, invocation);
	} else if (strcmp (method_name, "Pause") == 0) {
		_dbus_mpris_player_pause (object, parameters, invocation);
	} else if (strcmp (method_name, "Seek") == 0) {
		_dbus_mpris_player_seek (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
_dbus_mpris_player_get_playback_status (MprisPlayer* self)
{
	gchar* result;
	GVariant* _reply;
	result = mpris_player_get_playback_status (self);
	_reply = g_variant_new_string (result);
	_g_free0 (result);
	return _reply;
}

static GVariant*
_dbus_mpris_player_get_can_play (MprisPlayer* self)
{
	gboolean result;
	GVariant* _reply;
	result = mpris_player_get_can_play (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
_dbus_mpris_player_get_can_pause (MprisPlayer* self)
{
	gboolean result;
	GVariant* _reply;
	result = mpris_player_get_can_pause (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
_dbus_mpris_player_get_can_seek (MprisPlayer* self)
{
	gboolean result;
	GVariant* _reply;
	result = mpris_player_get_can_seek (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
mpris_player_dbus_interface_get_property (GDBusConnection* connection,
                                          const gchar* sender,
                                          const gchar* object_path,
                                          const gchar* interface_name,
                                          const gchar* property_name,
                                          GError** error,
                                          gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (property_name, "PlaybackStatus") == 0) {
		return _dbus_mpris_player_get_playback_status (object);
	} else if (strcmp (property_name, "CanPlay") == 0) {
		return _dbus_mpris_player_get_can_play (object);
	} else if (strcmp (property_name, "CanPause") == 0) {
		return _dbus_mpris_player_get_can_pause (object);
	} else if (strcmp (property_name, "CanSeek") == 0) {
		return _dbus_mpris_player_get_can_seek (object);
	}
	return NULL;
}

static gboolean
mpris_player_dbus_interface_set_property (GDBusConnection* connection,
                                          const gchar* sender,
                                          const gchar* object_path,
                                          const gchar* interface_name,
                                          const gchar* property_name,
                                          GVariant* value,
                                          GError** error,
                                          gpointer user_data)
{
	return FALSE;
}

guint
mpris_player_register_object (gpointer object,
                              GDBusConnection* connection,
                              const gchar* path,
                              GError** error)
{
	guint result;
	gpointer *data;
	data = g_new (gpointer, 3);
	data[0] = g_object_ref (object);
	data[1] = g_object_ref (connection);
	data[2] = g_strdup (path);
	result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_mpris_player_dbus_interface_info), &_mpris_player_dbus_interface_vtable, data, _mpris_player_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}

static void
_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 void
_vala_array_add1 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

gchar**
mpris_list_dbus_names (GDBusConnection* connection,
                       gint timeout,
                       gint* result_length1)
{
	gchar** dbus_names = NULL;
	gchar** _tmp0_;
	gint dbus_names_length1;
	gint _dbus_names_size_;
	gchar** _tmp14_;
	gint _tmp14__length1;
	GError* _inner_error0_ = NULL;
	gchar** result;
	g_return_val_if_fail (connection != NULL, NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	dbus_names = _tmp0_;
	dbus_names_length1 = 0;
	_dbus_names_size_ = dbus_names_length1;
	{
		GVariant* _result_ = NULL;
		GVariantType* _tmp1_;
		GVariantType* _tmp2_;
		GVariant* _tmp3_;
		GVariant* _tmp4_;
		GVariant* _tmp5_;
		GVariant* _tmp6_;
		gsize _tmp7_ = 0;
		const gchar** _tmp8_;
		const gchar** _tmp9_;
		gint _tmp9__length1;
		_tmp1_ = g_variant_type_new ("(as)");
		_tmp2_ = _tmp1_;
		_tmp3_ = g_dbus_connection_call_sync (connection, "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "ListNames", NULL, _tmp2_, G_DBUS_CALL_FLAGS_NONE, timeout, NULL, &_inner_error0_);
		_tmp4_ = _tmp3_;
		_g_variant_type_free0 (_tmp2_);
		_result_ = _tmp4_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp5_ = g_variant_get_child_value (_result_, (gsize) 0);
		_tmp6_ = _tmp5_;
		_tmp8_ = g_variant_get_strv (_tmp6_, &_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp9__length1 = _tmp7_;
		_g_variant_unref0 (_tmp6_);
		{
			const gchar** name_collection = NULL;
			gint name_collection_length1 = 0;
			gint _name_collection_size_ = 0;
			gint name_it = 0;
			name_collection = _tmp9_;
			name_collection_length1 = _tmp9__length1;
			for (name_it = 0; name_it < name_collection_length1; name_it = name_it + 1) {
				const gchar* name = NULL;
				name = name_collection[name_it];
				{
					const gchar* _tmp10_;
					gchar* _tmp11_;
					_tmp10_ = name;
					_tmp11_ = g_strdup (_tmp10_);
					_vala_array_add1 (&dbus_names, &dbus_names_length1, &_dbus_names_size_, _tmp11_);
				}
			}
			name_collection = (g_free (name_collection), NULL);
		}
		_g_variant_unref0 (_result_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp12_;
		const gchar* _tmp13_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp12_ = _error_;
		_tmp13_ = _tmp12_->message;
		g_debug ("interfaces.vala:79: Failed to list D-Bus names: %s", _tmp13_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		dbus_names = (_vala_array_free (dbus_names, dbus_names_length1, (GDestroyNotify) g_free), NULL);
		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 NULL;
	}
	_tmp14_ = dbus_names;
	_tmp14__length1 = dbus_names_length1;
	if (result_length1) {
		*result_length1 = _tmp14__length1;
	}
	result = _tmp14_;
	return result;
}

static Block9Data*
block9_data_ref (Block9Data* _data9_)
{
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}

static void
block9_data_unref (void * _userdata_)
{
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		g_slice_free (Block9Data, _data9_);
	}
}

static void
__lambda6_ (Block9Data* _data9_,
            GDBusConnection* connection_,
            const gchar* sender_name,
            const gchar* object_path,
            const gchar* interface_name,
            const gchar* signal_name,
            GVariant* parameters)
{
	GVariant* _tmp0_;
	GVariant* _tmp1_;
	const gchar* _tmp2_;
	GVariant* _tmp3_;
	GVariant* _tmp4_;
	const gchar* _tmp5_;
	GVariant* _tmp6_;
	GVariant* _tmp7_;
	const gchar* _tmp8_;
	g_return_if_fail (connection_ != NULL);
	g_return_if_fail (object_path != NULL);
	g_return_if_fail (interface_name != NULL);
	g_return_if_fail (signal_name != NULL);
	g_return_if_fail (parameters != NULL);
	_tmp0_ = g_variant_get_child_value (parameters, (gsize) 0);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_get_string (_tmp1_, NULL);
	_tmp3_ = g_variant_get_child_value (parameters, (gsize) 1);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_variant_get_string (_tmp4_, NULL);
	_tmp6_ = g_variant_get_child_value (parameters, (gsize) 2);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_variant_get_string (_tmp7_, NULL);
	_data9_->func (connection_, _tmp2_, _tmp5_, _tmp8_, _data9_->func_target);
	_g_variant_unref0 (_tmp7_);
	_g_variant_unref0 (_tmp4_);
	_g_variant_unref0 (_tmp1_);
}

static void
___lambda6__gd_bus_signal_callback (GDBusConnection* connection,
                                    const gchar* sender_name,
                                    const gchar* object_path,
                                    const gchar* interface_name,
                                    const gchar* signal_name,
                                    GVariant* parameters,
                                    gpointer self)
{
	__lambda6_ (self, connection, sender_name, object_path, interface_name, signal_name, parameters);
}

guint
mpris_dbus_subscribe_name_owner_changed (GDBusConnection* connection,
                                         MprisNameOwnerChangedFunc func,
                                         gpointer func_target)
{
	Block9Data* _data9_;
	guint result;
	g_return_val_if_fail (connection != NULL, 0U);
	_data9_ = g_slice_new0 (Block9Data);
	_data9_->_ref_count_ = 1;
	_data9_->func = func;
	_data9_->func_target = func_target;
	result = g_dbus_connection_signal_subscribe (connection, "org.freedesktop.DBus", "org.freedesktop.DBus", "NameOwnerChanged", "/org/freedesktop/DBus", NULL, G_DBUS_SIGNAL_FLAGS_NONE, ___lambda6__gd_bus_signal_callback, block9_data_ref (_data9_), block9_data_unref);
	block9_data_unref (_data9_);
	_data9_ = NULL;
	return result;
}

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

