/* rygel-media-export-updatable-object.c generated by valac 0.32.0.15-114e9, 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 <glib.h>
#include <glib-object.h>
#include <rygel-server.h>
#include <gio/gio.h>


#define RYGEL_MEDIA_EXPORT_TYPE_UPDATABLE_OBJECT (rygel_media_export_updatable_object_get_type ())
#define RYGEL_MEDIA_EXPORT_UPDATABLE_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_UPDATABLE_OBJECT, RygelMediaExportUpdatableObject))
#define RYGEL_MEDIA_EXPORT_IS_UPDATABLE_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_UPDATABLE_OBJECT))
#define RYGEL_MEDIA_EXPORT_UPDATABLE_OBJECT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), RYGEL_MEDIA_EXPORT_TYPE_UPDATABLE_OBJECT, RygelMediaExportUpdatableObjectIface))

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

struct _RygelMediaExportUpdatableObjectIface {
	GTypeInterface parent_iface;
	void (*commit_custom) (RygelMediaExportUpdatableObject* self, gboolean override_guarded, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*commit_custom_finish) (RygelMediaExportUpdatableObject* self, GAsyncResult* _res_, GError** error);
};

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



GType rygel_media_export_updatable_object_get_type (void) G_GNUC_CONST;
static void rygel_media_export_updatable_object_non_overriding_commit_data_free (gpointer _data);
void rygel_media_export_updatable_object_non_overriding_commit (RygelMediaExportUpdatableObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void rygel_media_export_updatable_object_non_overriding_commit_finish (RygelMediaExportUpdatableObject* self, GAsyncResult* _res_, GError** error);
static gboolean rygel_media_export_updatable_object_non_overriding_commit_co (RygelMediaExportUpdatableObjectNonOverridingCommitData* _data_);
void rygel_media_export_updatable_object_commit_custom (RygelMediaExportUpdatableObject* self, gboolean override_guarded, GAsyncReadyCallback _callback_, gpointer _user_data_);
void rygel_media_export_updatable_object_commit_custom_finish (RygelMediaExportUpdatableObject* self, GAsyncResult* _res_, GError** error);
static void rygel_media_export_updatable_object_non_overriding_commit_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);


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_ = NULL;
	_data_ = g_slice_new0 (RygelMediaExportUpdatableObjectNonOverridingCommitData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_media_export_updatable_object_non_overriding_commit);
	g_simple_async_result_set_op_res_gpointer (_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_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


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_error_);
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	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_) {
	RYGEL_MEDIA_EXPORT_UPDATABLE_OBJECT_GET_INTERFACE (self)->commit_custom (self, override_guarded, _callback_, _user_data_);
}


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


static void rygel_media_export_updatable_object_base_init (RygelMediaExportUpdatableObjectIface * iface) {
	static gboolean initialized = FALSE;
	if (!initialized) {
		initialized = TRUE;
	}
}


GType rygel_media_export_updatable_object_get_type (void) {
	static volatile gsize rygel_media_export_updatable_object_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_media_export_updatable_object_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelMediaExportUpdatableObjectIface), (GBaseInitFunc) rygel_media_export_updatable_object_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (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);
		g_once_init_leave (&rygel_media_export_updatable_object_type_id__volatile, rygel_media_export_updatable_object_type_id);
	}
	return rygel_media_export_updatable_object_type_id__volatile;
}



