/* note-details.c generated by valac 0.36.1.697-2b74, the Vala compiler
 * generated from note-details.vala, do not modify */

/*
 * Copyright (C) 2011 Collabora Ltd.
 * Copyright (C) 2011 Philip Withnall
 *
 * This library 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.
 *
 * This library 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, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *       Raul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>
 *       Philip Withnall <philip@tecnocode.co.uk>
 */

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


#define FOLKS_TYPE_ABSTRACT_FIELD_DETAILS (folks_abstract_field_details_get_type ())
#define FOLKS_ABSTRACT_FIELD_DETAILS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_TYPE_ABSTRACT_FIELD_DETAILS, FolksAbstractFieldDetails))
#define FOLKS_ABSTRACT_FIELD_DETAILS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_TYPE_ABSTRACT_FIELD_DETAILS, FolksAbstractFieldDetailsClass))
#define FOLKS_IS_ABSTRACT_FIELD_DETAILS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_TYPE_ABSTRACT_FIELD_DETAILS))
#define FOLKS_IS_ABSTRACT_FIELD_DETAILS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_TYPE_ABSTRACT_FIELD_DETAILS))
#define FOLKS_ABSTRACT_FIELD_DETAILS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_TYPE_ABSTRACT_FIELD_DETAILS, FolksAbstractFieldDetailsClass))

typedef struct _FolksAbstractFieldDetails FolksAbstractFieldDetails;
typedef struct _FolksAbstractFieldDetailsClass FolksAbstractFieldDetailsClass;
typedef struct _FolksAbstractFieldDetailsPrivate FolksAbstractFieldDetailsPrivate;

#define FOLKS_TYPE_NOTE_FIELD_DETAILS (folks_note_field_details_get_type ())
#define FOLKS_NOTE_FIELD_DETAILS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_TYPE_NOTE_FIELD_DETAILS, FolksNoteFieldDetails))
#define FOLKS_NOTE_FIELD_DETAILS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_TYPE_NOTE_FIELD_DETAILS, FolksNoteFieldDetailsClass))
#define FOLKS_IS_NOTE_FIELD_DETAILS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_TYPE_NOTE_FIELD_DETAILS))
#define FOLKS_IS_NOTE_FIELD_DETAILS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_TYPE_NOTE_FIELD_DETAILS))
#define FOLKS_NOTE_FIELD_DETAILS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_TYPE_NOTE_FIELD_DETAILS, FolksNoteFieldDetailsClass))

typedef struct _FolksNoteFieldDetails FolksNoteFieldDetails;
typedef struct _FolksNoteFieldDetailsClass FolksNoteFieldDetailsClass;
typedef struct _FolksNoteFieldDetailsPrivate FolksNoteFieldDetailsPrivate;
enum  {
	FOLKS_NOTE_FIELD_DETAILS_DUMMY_PROPERTY,
	FOLKS_NOTE_FIELD_DETAILS_ID,
	FOLKS_NOTE_FIELD_DETAILS_UID,
	FOLKS_NOTE_FIELD_DETAILS_LAST_PROPERTY
};
static GParamSpec* folks_note_field_details_properties[FOLKS_NOTE_FIELD_DETAILS_LAST_PROPERTY];
#define _g_free0(var) (var = (g_free (var), NULL))

#define FOLKS_TYPE_NOTE_DETAILS (folks_note_details_get_type ())
#define FOLKS_NOTE_DETAILS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_TYPE_NOTE_DETAILS, FolksNoteDetails))
#define FOLKS_IS_NOTE_DETAILS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_TYPE_NOTE_DETAILS))
#define FOLKS_NOTE_DETAILS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), FOLKS_TYPE_NOTE_DETAILS, FolksNoteDetailsIface))

typedef struct _FolksNoteDetails FolksNoteDetails;
typedef struct _FolksNoteDetailsIface FolksNoteDetailsIface;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _FolksNoteDetailsChangeNotesData FolksNoteDetailsChangeNotesData;

struct _FolksAbstractFieldDetails {
	GObject parent_instance;
	FolksAbstractFieldDetailsPrivate * priv;
};

struct _FolksAbstractFieldDetailsClass {
	GObjectClass parent_class;
	gboolean (*equal) (FolksAbstractFieldDetails* self, FolksAbstractFieldDetails* that);
	gboolean (*parameters_equal) (FolksAbstractFieldDetails* self, FolksAbstractFieldDetails* that);
	gboolean (*values_equal) (FolksAbstractFieldDetails* self, FolksAbstractFieldDetails* that);
	guint (*hash) (FolksAbstractFieldDetails* self);
	gconstpointer (*get_value) (FolksAbstractFieldDetails* self);
	void (*set_value) (FolksAbstractFieldDetails* self, gconstpointer value);
	const gchar* (*get_id) (FolksAbstractFieldDetails* self);
	void (*set_id) (FolksAbstractFieldDetails* self, const gchar* value);
	GeeMultiMap* (*get_parameters) (FolksAbstractFieldDetails* self);
	void (*set_parameters) (FolksAbstractFieldDetails* self, GeeMultiMap* value);
};

struct _FolksNoteFieldDetails {
	FolksAbstractFieldDetails parent_instance;
	FolksNoteFieldDetailsPrivate * priv;
};

struct _FolksNoteFieldDetailsClass {
	FolksAbstractFieldDetailsClass parent_class;
};

struct _FolksNoteFieldDetailsPrivate {
	gchar* _id;
};

typedef enum  {
	FOLKS_PROPERTY_ERROR_NOT_WRITEABLE,
	FOLKS_PROPERTY_ERROR_INVALID_VALUE,
	FOLKS_PROPERTY_ERROR_UNKNOWN_ERROR,
	FOLKS_PROPERTY_ERROR_UNAVAILABLE
} FolksPropertyError;
#define FOLKS_PROPERTY_ERROR folks_property_error_quark ()
struct _FolksNoteDetailsIface {
	GTypeInterface parent_iface;
	void (*change_notes) (FolksNoteDetails* self, GeeSet* notes, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*change_notes_finish) (FolksNoteDetails* self, GAsyncResult* _res_, GError** error);
	GeeSet* (*get_notes) (FolksNoteDetails* self);
	void (*set_notes) (FolksNoteDetails* self, GeeSet* value);
};

struct _FolksNoteDetailsChangeNotesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	FolksNoteDetails* self;
	GeeSet* notes;
	GError* _tmp0_;
	GError * _inner_error_;
};


static gpointer folks_note_field_details_parent_class = NULL;

GType folks_abstract_field_details_get_type (void) G_GNUC_CONST;
GType folks_note_field_details_get_type (void) G_GNUC_CONST;
#define FOLKS_NOTE_FIELD_DETAILS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FOLKS_TYPE_NOTE_FIELD_DETAILS, FolksNoteFieldDetailsPrivate))
FolksNoteFieldDetails* folks_note_field_details_new (const gchar* value, GeeMultiMap* parameters, const gchar* uid);
FolksNoteFieldDetails* folks_note_field_details_construct (GType object_type, const gchar* value, GeeMultiMap* parameters, const gchar* uid);
static gboolean folks_note_field_details_real_equal (FolksAbstractFieldDetails* base, FolksAbstractFieldDetails* that);
gboolean folks_abstract_field_details_equal (FolksAbstractFieldDetails* self, FolksAbstractFieldDetails* that);
static guint folks_note_field_details_real_hash (FolksAbstractFieldDetails* base);
gconstpointer folks_abstract_field_details_get_value (FolksAbstractFieldDetails* self);
const gchar* folks_abstract_field_details_get_id (FolksAbstractFieldDetails* self);
const gchar* folks_note_field_details_get_uid (FolksNoteFieldDetails* self) G_GNUC_DEPRECATED;
void folks_note_field_details_set_uid (FolksNoteFieldDetails* self, const gchar* value) G_GNUC_DEPRECATED;
void folks_abstract_field_details_set_id (FolksAbstractFieldDetails* self, const gchar* value);
static void folks_note_field_details_finalize (GObject * obj);
static void _vala_folks_note_field_details_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_folks_note_field_details_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
GQuark folks_property_error_quark (void);
GType folks_note_details_get_type (void) G_GNUC_CONST;
static void folks_note_details_real_change_notes_data_free (gpointer _data);
static void folks_note_details_real_change_notes_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
static void folks_note_details_real_change_notes (FolksNoteDetails* self, GeeSet* notes, GAsyncReadyCallback _callback_, gpointer _user_data_);
void folks_note_details_change_notes (FolksNoteDetails* self, GeeSet* notes, GAsyncReadyCallback _callback_, gpointer _user_data_);
void folks_note_details_change_notes_finish (FolksNoteDetails* self, GAsyncResult* _res_, GError** error);
static gboolean folks_note_details_real_change_notes_co (FolksNoteDetailsChangeNotesData* _data_);
GeeSet* folks_note_details_get_notes (FolksNoteDetails* self);
void folks_note_details_set_notes (FolksNoteDetails* self, GeeSet* value);


/**
   * Create a new NoteFieldDetails.
   *
   * @param value the value of the field, which should be a non-empty free-form
   * UTF-8 string as entered by the user
   * @param parameters initial parameters. See
   * {@link AbstractFieldDetails.parameters}. A ``null`` value is equivalent to
   * a empty map of parameters.
   * @param uid UID for the note object itself, if known. A ``null`` value means
   * the note has no unique ID.
   *
   * @return a new NoteFieldDetails
   *
   * @since 0.6.0
   */
FolksNoteFieldDetails* folks_note_field_details_construct (GType object_type, const gchar* value, GeeMultiMap* parameters, const gchar* uid) {
	FolksNoteFieldDetails * self = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GeeMultiMap* _tmp3_;
	g_return_val_if_fail (value != NULL, NULL);
	_tmp0_ = value;
	if (g_strcmp0 (_tmp0_, "") == 0) {
		g_warning ("note-details.vala:78: Empty note passed to NoteFieldDetails.");
	}
	_tmp1_ = value;
	_tmp2_ = uid;
	_tmp3_ = parameters;
	self = (FolksNoteFieldDetails*) g_object_new (object_type, "t_type", G_TYPE_STRING, "t_dup_func", (GBoxedCopyFunc) g_strdup, "t_destroy_func", (GDestroyNotify) g_free, "value", _tmp1_, "id", _tmp2_, "parameters", _tmp3_, NULL);
	return self;
}


FolksNoteFieldDetails* folks_note_field_details_new (const gchar* value, GeeMultiMap* parameters, const gchar* uid) {
	return folks_note_field_details_construct (FOLKS_TYPE_NOTE_FIELD_DETAILS, value, parameters, uid);
}


/**
   * {@inheritDoc}
   *
   * @since 0.6.0
   */
static gboolean folks_note_field_details_real_equal (FolksAbstractFieldDetails* base, FolksAbstractFieldDetails* that) {
	FolksNoteFieldDetails * self;
	gboolean result = FALSE;
	FolksAbstractFieldDetails* _tmp0_;
	gboolean _tmp1_;
	self = (FolksNoteFieldDetails*) base;
	g_return_val_if_fail (that != NULL, FALSE);
	_tmp0_ = that;
	_tmp1_ = FOLKS_ABSTRACT_FIELD_DETAILS_CLASS (folks_note_field_details_parent_class)->equal (G_TYPE_CHECK_INSTANCE_CAST (self, FOLKS_TYPE_ABSTRACT_FIELD_DETAILS, FolksAbstractFieldDetails), _tmp0_);
	result = _tmp1_;
	return result;
}


/**
   * {@inheritDoc}
   *
   * @since 0.6.0
   */
static guint folks_note_field_details_real_hash (FolksAbstractFieldDetails* base) {
	FolksNoteFieldDetails * self;
	guint result = 0U;
	gconstpointer _tmp0_;
	const gchar* _tmp1_;
	guint _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	guint _tmp5_;
	self = (FolksNoteFieldDetails*) base;
	_tmp0_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_str_hash ((const gchar*) _tmp1_);
	_tmp3_ = folks_abstract_field_details_get_id ((FolksAbstractFieldDetails*) self);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_str_hash (_tmp4_);
	result = _tmp2_ + _tmp5_;
	return result;
}


static const gchar* folks_note_field_details_real_get_id (FolksAbstractFieldDetails* base) {
	const gchar* result;
	FolksNoteFieldDetails* self;
	const gchar* _tmp0_;
	self = (FolksNoteFieldDetails*) base;
	_tmp0_ = self->priv->_id;
	result = _tmp0_;
	return result;
}


static void folks_note_field_details_real_set_id (FolksAbstractFieldDetails* base, const gchar* value) {
	FolksNoteFieldDetails* self;
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_;
	gchar* _tmp3_;
	self = (FolksNoteFieldDetails*) base;
	_tmp1_ = value;
	if (_tmp1_ != NULL) {
		const gchar* _tmp2_;
		_tmp2_ = value;
		_tmp0_ = _tmp2_;
	} else {
		_tmp0_ = "";
	}
	_tmp3_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_id);
	self->priv->_id = _tmp3_;
	g_object_notify_by_pspec ((GObject *) self, folks_note_field_details_properties[FOLKS_NOTE_FIELD_DETAILS_ID]);
}


const gchar* folks_note_field_details_get_uid (FolksNoteFieldDetails* self) {
	const gchar* result;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = folks_abstract_field_details_get_id ((FolksAbstractFieldDetails*) self);
	_tmp1_ = _tmp0_;
	result = _tmp1_;
	return result;
}


void folks_note_field_details_set_uid (FolksNoteFieldDetails* self, const gchar* value) {
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	folks_abstract_field_details_set_id ((FolksAbstractFieldDetails*) self, _tmp0_);
	g_object_notify_by_pspec ((GObject *) self, folks_note_field_details_properties[FOLKS_NOTE_FIELD_DETAILS_UID]);
}


static void folks_note_field_details_class_init (FolksNoteFieldDetailsClass * klass) {
	folks_note_field_details_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (FolksNoteFieldDetailsPrivate));
	((FolksAbstractFieldDetailsClass *) klass)->equal = (gboolean (*) (FolksAbstractFieldDetails *, FolksAbstractFieldDetails*)) folks_note_field_details_real_equal;
	((FolksAbstractFieldDetailsClass *) klass)->hash = (guint (*) (FolksAbstractFieldDetails *)) folks_note_field_details_real_hash;
	FOLKS_ABSTRACT_FIELD_DETAILS_CLASS (klass)->get_id = folks_note_field_details_real_get_id;
	FOLKS_ABSTRACT_FIELD_DETAILS_CLASS (klass)->set_id = folks_note_field_details_real_set_id;
	G_OBJECT_CLASS (klass)->get_property = _vala_folks_note_field_details_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_folks_note_field_details_set_property;
	G_OBJECT_CLASS (klass)->finalize = folks_note_field_details_finalize;
	/**
	   * {@inheritDoc}
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_NOTE_FIELD_DETAILS_ID, folks_note_field_details_properties[FOLKS_NOTE_FIELD_DETAILS_ID] = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	   * The UID of the note (if any).
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_NOTE_FIELD_DETAILS_UID, folks_note_field_details_properties[FOLKS_NOTE_FIELD_DETAILS_UID] = g_param_spec_string ("uid", "uid", "uid", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_DEPRECATED));
}


static void folks_note_field_details_instance_init (FolksNoteFieldDetails * self) {
	gchar* _tmp0_;
	self->priv = FOLKS_NOTE_FIELD_DETAILS_GET_PRIVATE (self);
	_tmp0_ = g_strdup ("");
	self->priv->_id = _tmp0_;
}


static void folks_note_field_details_finalize (GObject * obj) {
	FolksNoteFieldDetails * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOLKS_TYPE_NOTE_FIELD_DETAILS, FolksNoteFieldDetails);
	_g_free0 (self->priv->_id);
	G_OBJECT_CLASS (folks_note_field_details_parent_class)->finalize (obj);
}


/**
 * Object representing a note that can have some parameters associated with it.
 *
 * See {@link Folks.AbstractFieldDetails} for details on common parameter names
 * and values.
 *
 * @since 0.6.0
 */
GType folks_note_field_details_get_type (void) {
	static volatile gsize folks_note_field_details_type_id__volatile = 0;
	if (g_once_init_enter (&folks_note_field_details_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FolksNoteFieldDetailsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folks_note_field_details_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolksNoteFieldDetails), 0, (GInstanceInitFunc) folks_note_field_details_instance_init, NULL };
		GType folks_note_field_details_type_id;
		folks_note_field_details_type_id = g_type_register_static (FOLKS_TYPE_ABSTRACT_FIELD_DETAILS, "FolksNoteFieldDetails", &g_define_type_info, 0);
		g_once_init_leave (&folks_note_field_details_type_id__volatile, folks_note_field_details_type_id);
	}
	return folks_note_field_details_type_id__volatile;
}


static void _vala_folks_note_field_details_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	FolksNoteFieldDetails * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FOLKS_TYPE_NOTE_FIELD_DETAILS, FolksNoteFieldDetails);
	switch (property_id) {
		case FOLKS_NOTE_FIELD_DETAILS_ID:
		g_value_set_string (value, folks_abstract_field_details_get_id ((FolksAbstractFieldDetails*) self));
		break;
		case FOLKS_NOTE_FIELD_DETAILS_UID:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
		g_value_set_string (value, folks_note_field_details_get_uid (self));
G_GNUC_END_IGNORE_DEPRECATIONS
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_folks_note_field_details_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	FolksNoteFieldDetails * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FOLKS_TYPE_NOTE_FIELD_DETAILS, FolksNoteFieldDetails);
	switch (property_id) {
		case FOLKS_NOTE_FIELD_DETAILS_ID:
		folks_abstract_field_details_set_id ((FolksAbstractFieldDetails*) self, g_value_get_string (value));
		break;
		case FOLKS_NOTE_FIELD_DETAILS_UID:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
		folks_note_field_details_set_uid (self, g_value_get_string (value));
G_GNUC_END_IGNORE_DEPRECATIONS
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void folks_note_details_real_change_notes_data_free (gpointer _data) {
	FolksNoteDetailsChangeNotesData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->notes);
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksNoteDetailsChangeNotesData, _data_);
}


static void folks_note_details_real_change_notes_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	FolksNoteDetailsChangeNotesData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


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


static void folks_note_details_real_change_notes (FolksNoteDetails* self, GeeSet* notes, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksNoteDetailsChangeNotesData* _data_;
	FolksNoteDetails* _tmp0_;
	GeeSet* _tmp1_;
	GeeSet* _tmp2_;
	_data_ = g_slice_new0 (FolksNoteDetailsChangeNotesData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, folks_note_details_real_change_notes_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, folks_note_details_real_change_notes_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = notes;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->notes);
	_data_->notes = _tmp2_;
	folks_note_details_real_change_notes_co (_data_);
}


static void folks_note_details_real_change_notes_finish (FolksNoteDetails* self, GAsyncResult* _res_, GError** error) {
	FolksNoteDetailsChangeNotesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}


/**
   * Change the contact's notes.
   *
   * It's preferred to call this rather than setting {@link NoteDetails.notes}
   * directly, as this method gives error notification and will only return once
   * the notes have been written to the relevant backing store (or the
   * operation's failed).
   *
   * @param notes the set of notes
   * @throws PropertyError if setting the notes failed
   * @since 0.6.2
   */
static gboolean folks_note_details_real_change_notes_co (FolksNoteDetailsChangeNotesData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_error_new_literal (FOLKS_PROPERTY_ERROR, FOLKS_PROPERTY_ERROR_NOT_WRITEABLE, _ ("Notes are not writeable on this contact."));
	_data_->_inner_error_ = _data_->_tmp0_;
	if (_data_->_inner_error_->domain == FOLKS_PROPERTY_ERROR) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	} else {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


void folks_note_details_change_notes (FolksNoteDetails* self, GeeSet* notes, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FOLKS_NOTE_DETAILS_GET_INTERFACE (self)->change_notes (self, notes, _callback_, _user_data_);
}


void folks_note_details_change_notes_finish (FolksNoteDetails* self, GAsyncResult* _res_, GError** error) {
	FOLKS_NOTE_DETAILS_GET_INTERFACE (self)->change_notes_finish (self, _res_, error);
}


GeeSet* folks_note_details_get_notes (FolksNoteDetails* self) {
	g_return_val_if_fail (self != NULL, NULL);
	return FOLKS_NOTE_DETAILS_GET_INTERFACE (self)->get_notes (self);
}


void folks_note_details_set_notes (FolksNoteDetails* self, GeeSet* value) {
	g_return_if_fail (self != NULL);
	FOLKS_NOTE_DETAILS_GET_INTERFACE (self)->set_notes (self, value);
}


static void folks_note_details_base_init (FolksNoteDetailsIface * iface) {
	static gboolean initialized = FALSE;
	if (!initialized) {
		initialized = TRUE;
		/**
		   * The notes about the contact.
		   *
		   * @since 0.5.1
		   */
		g_object_interface_install_property (iface, g_param_spec_object ("notes", "notes", "notes", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
		iface->change_notes = folks_note_details_real_change_notes;
		iface->change_notes_finish = folks_note_details_real_change_notes_finish;
	}
}


/**
 * This interface represents the list of notes associated
 * to a {@link Persona} and {@link Individual}.
 *
 * @since 0.4.0
 */
GType folks_note_details_get_type (void) {
	static volatile gsize folks_note_details_type_id__volatile = 0;
	if (g_once_init_enter (&folks_note_details_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FolksNoteDetailsIface), (GBaseInitFunc) folks_note_details_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
		GType folks_note_details_type_id;
		folks_note_details_type_id = g_type_register_static (G_TYPE_INTERFACE, "FolksNoteDetails", &g_define_type_info, 0);
		g_type_interface_add_prerequisite (folks_note_details_type_id, G_TYPE_OBJECT);
		g_once_init_leave (&folks_note_details_type_id__volatile, folks_note_details_type_id);
	}
	return folks_note_details_type_id__volatile;
}



