/* rygel-lms-dbus-interfaces.c generated by valac 0.40.8, the Vala compiler
 * generated from rygel-lms-dbus-interfaces.vala, do not modify */

/*
 * Copyright (C) 2014 Intel Corporation.
 *
 * Author: Alexander Kanavin <alex.kanavin@gmail.com>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * Rygel is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */


#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>


#define RYGEL_LMS_TYPE_DBUS (rygel_lms_dbus_get_type ())
#define RYGEL_LMS_DBUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DBUS, RygelLMSDBus))
#define RYGEL_LMS_IS_DBUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DBUS))
#define RYGEL_LMS_DBUS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), RYGEL_LMS_TYPE_DBUS, RygelLMSDBusIface))

typedef struct _RygelLMSDBus RygelLMSDBus;
typedef struct _RygelLMSDBusIface RygelLMSDBusIface;

#define RYGEL_LMS_TYPE_DBUS_PROXY (rygel_lms_dbus_proxy_get_type ())
typedef GDBusProxy RygelLMSDBusProxy;
typedef GDBusProxyClass RygelLMSDBusProxyClass;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _RygelLMSDBusIface {
	GTypeInterface parent_iface;
	gchar* (*get_data_base_path) (RygelLMSDBus* self);
	guint64 (*get_update_id) (RygelLMSDBus* self);
};



GType rygel_lms_dbus_get_type (void) G_GNUC_CONST;
GType rygel_lms_dbus_proxy_get_type (void) G_GNUC_CONST;
guint rygel_lms_dbus_register_object (void* object,
                                      GDBusConnection* connection,
                                      const gchar* path,
                                      GError** error);
gchar* rygel_lms_dbus_get_data_base_path (RygelLMSDBus* self);
guint64 rygel_lms_dbus_get_update_id (RygelLMSDBus* self);
static void rygel_lms_dbus_proxy_g_signal (GDBusProxy* proxy,
                                    const gchar* sender_name,
                                    const gchar* signal_name,
                                    GVariant* parameters);
static gchar* rygel_lms_dbus_dbus_proxy_get_data_base_path (RygelLMSDBus* self);
static guint64 rygel_lms_dbus_dbus_proxy_get_update_id (RygelLMSDBus* self);
static void rygel_lms_dbus_proxy_rygel_lms_dbus_interface_init (RygelLMSDBusIface* iface);
static void rygel_lms_dbus_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* rygel_lms_dbus_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_rygel_lms_dbus_get_data_base_path (RygelLMSDBus* self);
static GVariant* _dbus_rygel_lms_dbus_get_update_id (RygelLMSDBus* self);
static gboolean rygel_lms_dbus_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 _rygel_lms_dbus_unregister_object (gpointer user_data);

static const GDBusMethodInfo * const _rygel_lms_dbus_dbus_method_info[] = {NULL};
static const GDBusSignalInfo * const _rygel_lms_dbus_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo _rygel_lms_dbus_dbus_property_info_data_base_path = {-1, "DataBasePath", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
static const GDBusPropertyInfo _rygel_lms_dbus_dbus_property_info_update_id = {-1, "UpdateID", "t", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
static const GDBusPropertyInfo * const _rygel_lms_dbus_dbus_property_info[] = {&_rygel_lms_dbus_dbus_property_info_data_base_path, &_rygel_lms_dbus_dbus_property_info_update_id, NULL};
static const GDBusInterfaceInfo _rygel_lms_dbus_dbus_interface_info = {-1, "org.lightmediascanner.Scanner1", (GDBusMethodInfo **) (&_rygel_lms_dbus_dbus_method_info), (GDBusSignalInfo **) (&_rygel_lms_dbus_dbus_signal_info), (GDBusPropertyInfo **) (&_rygel_lms_dbus_dbus_property_info)};
static const GDBusInterfaceVTable _rygel_lms_dbus_dbus_interface_vtable = {rygel_lms_dbus_dbus_interface_method_call, rygel_lms_dbus_dbus_interface_get_property, rygel_lms_dbus_dbus_interface_set_property};

gchar*
rygel_lms_dbus_get_data_base_path (RygelLMSDBus* self)
{
	g_return_val_if_fail (self != NULL, NULL);
	return RYGEL_LMS_DBUS_GET_INTERFACE (self)->get_data_base_path (self);
}


guint64
rygel_lms_dbus_get_update_id (RygelLMSDBus* self)
{
	g_return_val_if_fail (self != NULL, 0ULL);
	return RYGEL_LMS_DBUS_GET_INTERFACE (self)->get_update_id (self);
}


static void
rygel_lms_dbus_default_init (RygelLMSDBusIface * iface)
{
}


GType
rygel_lms_dbus_get_type (void)
{
	static volatile gsize rygel_lms_dbus_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_lms_dbus_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelLMSDBusIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_dbus_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
		GType rygel_lms_dbus_type_id;
		rygel_lms_dbus_type_id = g_type_register_static (G_TYPE_INTERFACE, "RygelLMSDBus", &g_define_type_info, 0);
		g_type_interface_add_prerequisite (rygel_lms_dbus_type_id, g_dbus_proxy_get_type ());
		g_type_set_qdata (rygel_lms_dbus_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) rygel_lms_dbus_proxy_get_type);
		g_type_set_qdata (rygel_lms_dbus_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.lightmediascanner.Scanner1");
		g_type_set_qdata (rygel_lms_dbus_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_rygel_lms_dbus_dbus_interface_info));
		g_type_set_qdata (rygel_lms_dbus_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) rygel_lms_dbus_register_object);
		g_once_init_leave (&rygel_lms_dbus_type_id__volatile, rygel_lms_dbus_type_id);
	}
	return rygel_lms_dbus_type_id__volatile;
}


G_DEFINE_TYPE_EXTENDED (RygelLMSDBusProxy, rygel_lms_dbus_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (RYGEL_LMS_TYPE_DBUS, rygel_lms_dbus_proxy_rygel_lms_dbus_interface_init) )
static void
rygel_lms_dbus_proxy_class_init (RygelLMSDBusProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = rygel_lms_dbus_proxy_g_signal;
}


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


static void
rygel_lms_dbus_proxy_init (RygelLMSDBusProxy* self)
{
}


static gchar*
rygel_lms_dbus_dbus_proxy_get_data_base_path (RygelLMSDBus* self)
{
	GVariant *_inner_reply;
	gchar* _result;
	_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "DataBasePath");
	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.lightmediascanner.Scanner1"));
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("DataBasePath"));
		_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 guint64
rygel_lms_dbus_dbus_proxy_get_update_id (RygelLMSDBus* self)
{
	GVariant *_inner_reply;
	guint64 _result;
	_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "UpdateID");
	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.lightmediascanner.Scanner1"));
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("UpdateID"));
		_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) {
			guint64 _tmp0_ = 0ULL;
			return _tmp0_;
		}
		g_variant_get (_reply, "(v)", &_inner_reply);
		g_variant_unref (_reply);
	}
	_result = g_variant_get_uint64 (_inner_reply);
	g_variant_unref (_inner_reply);
	return _result;
}


static void
rygel_lms_dbus_proxy_rygel_lms_dbus_interface_init (RygelLMSDBusIface* iface)
{
	iface->get_data_base_path = rygel_lms_dbus_dbus_proxy_get_data_base_path;
	iface->get_update_id = rygel_lms_dbus_dbus_proxy_get_update_id;
}


static void
rygel_lms_dbus_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];
	g_object_unref (invocation);
}


static GVariant*
_dbus_rygel_lms_dbus_get_data_base_path (RygelLMSDBus* self)
{
	gchar* result;
	GVariant* _reply;
	result = rygel_lms_dbus_get_data_base_path (self);
	_reply = g_variant_new_string (result);
	_g_free0 (result);
	return _reply;
}


static GVariant*
_dbus_rygel_lms_dbus_get_update_id (RygelLMSDBus* self)
{
	guint64 result;
	GVariant* _reply;
	result = rygel_lms_dbus_get_update_id (self);
	_reply = g_variant_new_uint64 (result);
	return _reply;
}


static GVariant*
rygel_lms_dbus_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, "DataBasePath") == 0) {
		return _dbus_rygel_lms_dbus_get_data_base_path (object);
	} else if (strcmp (property_name, "UpdateID") == 0) {
		return _dbus_rygel_lms_dbus_get_update_id (object);
	}
	return NULL;
}


static gboolean
rygel_lms_dbus_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];
	return FALSE;
}


guint
rygel_lms_dbus_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 *) (&_rygel_lms_dbus_dbus_interface_info), &_rygel_lms_dbus_dbus_interface_vtable, data, _rygel_lms_dbus_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}


static void
_rygel_lms_dbus_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);
}



