/* rygel-media-export-updatable-object.c generated by valac 0.56.19, the Vala compiler
 * generated from rygel-media-export-updatable-object.vala, do not modify */

/*
 * Copyright (C) 2013 Intel Corporation.
 *
 * Author: Krzesimir Nowak <krnowak@openismus.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 "rygel-media-export.h"
#include <gio/gio.h>
#include <glib.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

#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _RygelMediaExportUpdatableObjectNonOverridingCommitData RygelMediaExportUpdatableObjectNonOverridingCommitData;

struct _RygelMediaExportUpdatableObjectNonOverridingCommitData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelMediaExportUpdatableObject* self;
	GError* _inner_error0_;
};

static void rygel_media_export_updatable_object_non_overriding_commit_data_free (gpointer _data);
static gboolean rygel_media_export_updatable_object_non_overriding_commit_co (RygelMediaExportUpdatableObjectNonOverridingCommitData* _data_);
static void rygel_media_export_updatable_object_non_overriding_commit_ready (GObject* source_object,
                                                                      GAsyncResult* _res_,
                                                                      gpointer _user_data_);
static GType rygel_media_export_updatable_object_get_type_once (void);

static void
rygel_media_export_updatable_object_non_overriding_commit_data_free (gpointer _data)
{
	RygelMediaExportUpdatableObjectNonOverridingCommitData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelMediaExportUpdatableObjectNonOverridingCommitData, _data_);
}

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

void
rygel_media_export_updatable_object_non_overriding_commit (RygelMediaExportUpdatableObject* self,
                                                           GAsyncReadyCallback _callback_,
                                                           gpointer _user_data_)
{
	RygelMediaExportUpdatableObjectNonOverridingCommitData* _data_;
	RygelMediaExportUpdatableObject* _tmp0_;
	_data_ = g_slice_new0 (RygelMediaExportUpdatableObjectNonOverridingCommitData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_media_export_updatable_object_non_overriding_commit_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	rygel_media_export_updatable_object_non_overriding_commit_co (_data_);
}

void
rygel_media_export_updatable_object_non_overriding_commit_finish (RygelMediaExportUpdatableObject* self,
                                                                  GAsyncResult* _res_,
                                                                  GError** error)
{
	RygelMediaExportUpdatableObjectNonOverridingCommitData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
rygel_media_export_updatable_object_non_overriding_commit_ready (GObject* source_object,
                                                                 GAsyncResult* _res_,
                                                                 gpointer _user_data_)
{
	RygelMediaExportUpdatableObjectNonOverridingCommitData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_media_export_updatable_object_non_overriding_commit_co (_data_);
}

static gboolean
rygel_media_export_updatable_object_non_overriding_commit_co (RygelMediaExportUpdatableObjectNonOverridingCommitData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	rygel_media_export_updatable_object_commit_custom (_data_->self, FALSE, rygel_media_export_updatable_object_non_overriding_commit_ready, _data_);
	return FALSE;
	_state_1:
	rygel_media_export_updatable_object_commit_custom_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
rygel_media_export_updatable_object_commit_custom (RygelMediaExportUpdatableObject* self,
                                                   gboolean override_guarded,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	RygelMediaExportUpdatableObjectIface* _iface_;
	_iface_ = RYGEL_MEDIA_EXPORT_UPDATABLE_OBJECT_GET_INTERFACE (self);
	if (_iface_->commit_custom) {
		_iface_->commit_custom (self, override_guarded, _callback_, _user_data_);
	}
}

void
rygel_media_export_updatable_object_commit_custom_finish (RygelMediaExportUpdatableObject* self,
                                                          GAsyncResult* _res_,
                                                          GError** error)
{
	RygelMediaExportUpdatableObjectIface* _iface_;
	_iface_ = RYGEL_MEDIA_EXPORT_UPDATABLE_OBJECT_GET_INTERFACE (self);
	if (_iface_->commit_custom_finish) {
		_iface_->commit_custom_finish (self, _res_, error);
	}
}

static void
rygel_media_export_updatable_object_default_init (RygelMediaExportUpdatableObjectIface * iface,
                                                  gpointer iface_data)
{
}

 G_GNUC_NO_INLINE static GType
rygel_media_export_updatable_object_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (RygelMediaExportUpdatableObjectIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_media_export_updatable_object_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType rygel_media_export_updatable_object_type_id;
	rygel_media_export_updatable_object_type_id = g_type_register_static (G_TYPE_INTERFACE, "RygelMediaExportUpdatableObject", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (rygel_media_export_updatable_object_type_id, RYGEL_TYPE_MEDIA_OBJECT);
	return rygel_media_export_updatable_object_type_id;
}

GType
rygel_media_export_updatable_object_get_type (void)
{
	static volatile gsize rygel_media_export_updatable_object_type_id__once = 0;
	if (g_once_init_enter (&rygel_media_export_updatable_object_type_id__once)) {
		GType rygel_media_export_updatable_object_type_id;
		rygel_media_export_updatable_object_type_id = rygel_media_export_updatable_object_get_type_once ();
		g_once_init_leave (&rygel_media_export_updatable_object_type_id__once, rygel_media_export_updatable_object_type_id);
	}
	return rygel_media_export_updatable_object_type_id__once;
}

