/* DocumentManager.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from DocumentManager.vala, do not modify */

/* DocumentManager.vala
 *
 * Copyright 2023 Diego Iván <diegoivan.mae@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <glib-object.h>
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define PAPER_CLIP_SERVICES_TYPE_DOCUMENT_MANAGER (paper_clip_services_document_manager_get_type ())
#define PAPER_CLIP_SERVICES_DOCUMENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PAPER_CLIP_SERVICES_TYPE_DOCUMENT_MANAGER, PaperClipServicesDocumentManager))
#define PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PAPER_CLIP_SERVICES_TYPE_DOCUMENT_MANAGER, PaperClipServicesDocumentManagerClass))
#define PAPER_CLIP_SERVICES_IS_DOCUMENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PAPER_CLIP_SERVICES_TYPE_DOCUMENT_MANAGER))
#define PAPER_CLIP_SERVICES_IS_DOCUMENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PAPER_CLIP_SERVICES_TYPE_DOCUMENT_MANAGER))
#define PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAPER_CLIP_SERVICES_TYPE_DOCUMENT_MANAGER, PaperClipServicesDocumentManagerClass))

typedef struct _PaperClipServicesDocumentManager PaperClipServicesDocumentManager;
typedef struct _PaperClipServicesDocumentManagerClass PaperClipServicesDocumentManagerClass;
typedef struct _PaperClipServicesDocumentManagerPrivate PaperClipServicesDocumentManagerPrivate;

#define PAPER_CLIP_TYPE_DOCUMENT (paper_clip_document_get_type ())
#define PAPER_CLIP_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PAPER_CLIP_TYPE_DOCUMENT, PaperClipDocument))
#define PAPER_CLIP_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PAPER_CLIP_TYPE_DOCUMENT, PaperClipDocumentClass))
#define PAPER_CLIP_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PAPER_CLIP_TYPE_DOCUMENT))
#define PAPER_CLIP_IS_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PAPER_CLIP_TYPE_DOCUMENT))
#define PAPER_CLIP_DOCUMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAPER_CLIP_TYPE_DOCUMENT, PaperClipDocumentClass))

typedef struct _PaperClipDocument PaperClipDocument;
typedef struct _PaperClipDocumentClass PaperClipDocumentClass;
enum  {
	PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_0_PROPERTY,
	PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_CHANGED_PROPERTY,
	PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_DOCUMENT_PROPERTY,
	PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_NUM_PROPERTIES
};
static GParamSpec* paper_clip_services_document_manager_properties[PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _PaperClipServicesDocumentManagerSaveData PaperClipServicesDocumentManagerSaveData;

struct _PaperClipServicesDocumentManager {
	GObject parent_instance;
	PaperClipServicesDocumentManagerPrivate * priv;
};

struct _PaperClipServicesDocumentManagerClass {
	GObjectClass parent_class;
};

struct _PaperClipServicesDocumentManagerPrivate {
	gboolean _changed;
	PaperClipDocument* _document;
};

struct _PaperClipServicesDocumentManagerSaveData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PaperClipServicesDocumentManager* self;
	gchar* uri;
	gchar* _tmp0_;
	gchar* _tmp1_;
	PaperClipDocument* _tmp2_;
	PaperClipDocument* _tmp3_;
	GFile* _tmp4_;
	GFile* _tmp5_;
	gchar* _tmp6_;
	PaperClipDocument* _tmp7_;
	PaperClipDocument* _tmp8_;
};

static gint PaperClipServicesDocumentManager_private_offset;
static gpointer paper_clip_services_document_manager_parent_class = NULL;

VALA_EXTERN GType paper_clip_services_document_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PaperClipServicesDocumentManager, g_object_unref)
VALA_EXTERN GType paper_clip_document_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PaperClipDocument, g_object_unref)
static void paper_clip_services_document_manager_save_data_free (gpointer _data);
VALA_EXTERN void paper_clip_services_document_manager_save (PaperClipServicesDocumentManager* self,
                                                const gchar* uri,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
VALA_EXTERN void paper_clip_services_document_manager_save_finish (PaperClipServicesDocumentManager* self,
                                                       GAsyncResult* _res_);
static gboolean paper_clip_services_document_manager_save_co (PaperClipServicesDocumentManagerSaveData* _data_);
VALA_EXTERN PaperClipDocument* paper_clip_services_document_manager_get_document (PaperClipServicesDocumentManager* self);
VALA_EXTERN GFile* paper_clip_document_get_original_file (PaperClipDocument* self);
VALA_EXTERN void paper_clip_document_save (PaperClipDocument* self,
                               const gchar* uri,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_);
VALA_EXTERN void paper_clip_document_save_finish (PaperClipDocument* self,
                                      GAsyncResult* _res_);
static void paper_clip_services_document_manager_save_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
static void paper_clip_services_document_manager_set_changed (PaperClipServicesDocumentManager* self,
                                                       gboolean value);
static void paper_clip_services_document_manager_disconnect_document (PaperClipServicesDocumentManager* self);
static void paper_clip_services_document_manager_on_doc_changed (PaperClipServicesDocumentManager* self);
static void _paper_clip_services_document_manager_on_doc_changed_g_object_notify (GObject* _sender,
                                                                           GParamSpec* pspec,
                                                                           gpointer self);
VALA_EXTERN GListModel* paper_clip_document_get_keywords (PaperClipDocument* self);
static void _paper_clip_services_document_manager_on_doc_changed_g_list_model_items_changed (GListModel* _sender,
                                                                                      guint position,
                                                                                      guint removed,
                                                                                      guint added,
                                                                                      gpointer self);
static void _paper_clip_services_document_manager_on_doc_changed_paper_clip_document_keyword_changed (PaperClipDocument* _sender,
                                                                                               gpointer self);
VALA_EXTERN PaperClipServicesDocumentManager* paper_clip_services_document_manager_new (void);
VALA_EXTERN PaperClipServicesDocumentManager* paper_clip_services_document_manager_construct (GType object_type);
VALA_EXTERN gboolean paper_clip_services_document_manager_get_changed (PaperClipServicesDocumentManager* self);
VALA_EXTERN void paper_clip_services_document_manager_set_document (PaperClipServicesDocumentManager* self,
                                                        PaperClipDocument* value);
static void paper_clip_services_document_manager_finalize (GObject * obj);
static GType paper_clip_services_document_manager_get_type_once (void);
static void _vala_paper_clip_services_document_manager_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec);
static void _vala_paper_clip_services_document_manager_set_property (GObject * object,
                                                              guint property_id,
                                                              const GValue * value,
                                                              GParamSpec * pspec);

static inline gpointer
paper_clip_services_document_manager_get_instance_private (PaperClipServicesDocumentManager* self)
{
	return G_STRUCT_MEMBER_P (self, PaperClipServicesDocumentManager_private_offset);
}

static void
paper_clip_services_document_manager_save_data_free (gpointer _data)
{
	PaperClipServicesDocumentManagerSaveData* _data_;
	_data_ = _data;
	_g_free0 (_data_->uri);
	_g_object_unref0 (_data_->self);
	g_slice_free (PaperClipServicesDocumentManagerSaveData, _data_);
}

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

void
paper_clip_services_document_manager_save (PaperClipServicesDocumentManager* self,
                                           const gchar* uri,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	PaperClipServicesDocumentManagerSaveData* _data_;
	PaperClipServicesDocumentManager* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (PaperClipServicesDocumentManagerSaveData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, paper_clip_services_document_manager_save_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (uri);
	_g_free0 (_data_->uri);
	_data_->uri = _tmp1_;
	paper_clip_services_document_manager_save_co (_data_);
}

void
paper_clip_services_document_manager_save_finish (PaperClipServicesDocumentManager* self,
                                                  GAsyncResult* _res_)
{
	PaperClipServicesDocumentManagerSaveData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
paper_clip_services_document_manager_save_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_)
{
	PaperClipServicesDocumentManagerSaveData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	paper_clip_services_document_manager_save_co (_data_);
}

static gboolean
paper_clip_services_document_manager_save_co (PaperClipServicesDocumentManagerSaveData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = g_strdup (_data_->uri);
	_data_->_tmp0_ = _data_->_tmp1_;
	if (_data_->_tmp0_ == NULL) {
		_data_->_tmp2_ = paper_clip_services_document_manager_get_document (_data_->self);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp4_ = paper_clip_document_get_original_file (_data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp6_ = g_file_get_uri (_data_->_tmp5_);
		_g_free0 (_data_->_tmp0_);
		_data_->_tmp0_ = _data_->_tmp6_;
	}
	_data_->_tmp7_ = paper_clip_services_document_manager_get_document (_data_->self);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_state_ = 1;
	paper_clip_document_save (_data_->_tmp8_, _data_->_tmp0_, paper_clip_services_document_manager_save_ready, _data_);
	return FALSE;
	_state_1:
	paper_clip_document_save_finish (_data_->_tmp8_, _data_->_res_);
	paper_clip_services_document_manager_set_changed (_data_->self, FALSE);
	_g_free0 (_data_->_tmp0_);
	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;
}

static void
_paper_clip_services_document_manager_on_doc_changed_g_object_notify (GObject* _sender,
                                                                      GParamSpec* pspec,
                                                                      gpointer self)
{
	paper_clip_services_document_manager_on_doc_changed ((PaperClipServicesDocumentManager*) self);
}

static void
_paper_clip_services_document_manager_on_doc_changed_g_list_model_items_changed (GListModel* _sender,
                                                                                 guint position,
                                                                                 guint removed,
                                                                                 guint added,
                                                                                 gpointer self)
{
	paper_clip_services_document_manager_on_doc_changed ((PaperClipServicesDocumentManager*) self);
}

static void
_paper_clip_services_document_manager_on_doc_changed_paper_clip_document_keyword_changed (PaperClipDocument* _sender,
                                                                                          gpointer self)
{
	paper_clip_services_document_manager_on_doc_changed ((PaperClipServicesDocumentManager*) self);
}

static void
paper_clip_services_document_manager_disconnect_document (PaperClipServicesDocumentManager* self)
{
	PaperClipDocument* _tmp0_;
	PaperClipDocument* _tmp1_;
	PaperClipDocument* _tmp2_;
	PaperClipDocument* _tmp3_;
	guint _tmp4_;
	PaperClipDocument* _tmp5_;
	PaperClipDocument* _tmp6_;
	GListModel* _tmp7_;
	GListModel* _tmp8_;
	guint _tmp9_;
	PaperClipDocument* _tmp10_;
	PaperClipDocument* _tmp11_;
	guint _tmp12_;
	g_return_if_fail (self != NULL);
	_tmp0_ = paper_clip_services_document_manager_get_document (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		return;
	}
	_tmp2_ = paper_clip_services_document_manager_get_document (self);
	_tmp3_ = _tmp2_;
	g_signal_parse_name ("notify", G_TYPE_OBJECT, &_tmp4_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GObject*) _tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _paper_clip_services_document_manager_on_doc_changed_g_object_notify, self);
	_tmp5_ = paper_clip_services_document_manager_get_document (self);
	_tmp6_ = _tmp5_;
	_tmp7_ = paper_clip_document_get_keywords (_tmp6_);
	_tmp8_ = _tmp7_;
	g_signal_parse_name ("items-changed", g_list_model_get_type (), &_tmp9_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp8_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp9_, 0, NULL, (GCallback) _paper_clip_services_document_manager_on_doc_changed_g_list_model_items_changed, self);
	_tmp10_ = paper_clip_services_document_manager_get_document (self);
	_tmp11_ = _tmp10_;
	g_signal_parse_name ("keyword-changed", PAPER_CLIP_TYPE_DOCUMENT, &_tmp12_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp11_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp12_, 0, NULL, (GCallback) _paper_clip_services_document_manager_on_doc_changed_paper_clip_document_keyword_changed, self);
}

static void
paper_clip_services_document_manager_on_doc_changed (PaperClipServicesDocumentManager* self)
{
	g_return_if_fail (self != NULL);
	paper_clip_services_document_manager_set_changed (self, TRUE);
}

PaperClipServicesDocumentManager*
paper_clip_services_document_manager_construct (GType object_type)
{
	PaperClipServicesDocumentManager * self = NULL;
	self = (PaperClipServicesDocumentManager*) g_object_new (object_type, NULL);
	return self;
}

PaperClipServicesDocumentManager*
paper_clip_services_document_manager_new (void)
{
	return paper_clip_services_document_manager_construct (PAPER_CLIP_SERVICES_TYPE_DOCUMENT_MANAGER);
}

gboolean
paper_clip_services_document_manager_get_changed (PaperClipServicesDocumentManager* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_changed;
	return result;
}

static void
paper_clip_services_document_manager_set_changed (PaperClipServicesDocumentManager* self,
                                                  gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = paper_clip_services_document_manager_get_changed (self);
	if (old_value != value) {
		self->priv->_changed = value;
		g_object_notify_by_pspec ((GObject *) self, paper_clip_services_document_manager_properties[PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_CHANGED_PROPERTY]);
	}
}

PaperClipDocument*
paper_clip_services_document_manager_get_document (PaperClipServicesDocumentManager* self)
{
	PaperClipDocument* result;
	PaperClipDocument* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_document;
	result = _tmp0_;
	return result;
}

void
paper_clip_services_document_manager_set_document (PaperClipServicesDocumentManager* self,
                                                   PaperClipDocument* value)
{
	PaperClipDocument* _tmp0_;
	PaperClipDocument* _tmp1_;
	PaperClipDocument* _tmp2_;
	PaperClipDocument* _tmp3_;
	PaperClipDocument* _tmp4_;
	GListModel* _tmp5_;
	GListModel* _tmp6_;
	PaperClipDocument* _tmp7_;
	PaperClipDocument* _tmp8_;
	g_return_if_fail (self != NULL);
	paper_clip_services_document_manager_disconnect_document (self);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_document);
	self->priv->_document = _tmp0_;
	paper_clip_services_document_manager_set_changed (self, FALSE);
	_tmp1_ = paper_clip_services_document_manager_get_document (self);
	_tmp2_ = _tmp1_;
	g_signal_connect_object ((GObject*) _tmp2_, "notify", (GCallback) _paper_clip_services_document_manager_on_doc_changed_g_object_notify, self, 0);
	_tmp3_ = paper_clip_services_document_manager_get_document (self);
	_tmp4_ = _tmp3_;
	_tmp5_ = paper_clip_document_get_keywords (_tmp4_);
	_tmp6_ = _tmp5_;
	g_signal_connect_object (_tmp6_, "items-changed", (GCallback) _paper_clip_services_document_manager_on_doc_changed_g_list_model_items_changed, self, 0);
	_tmp7_ = paper_clip_services_document_manager_get_document (self);
	_tmp8_ = _tmp7_;
	g_signal_connect_object (_tmp8_, "keyword-changed", (GCallback) _paper_clip_services_document_manager_on_doc_changed_paper_clip_document_keyword_changed, self, 0);
	g_object_notify_by_pspec ((GObject *) self, paper_clip_services_document_manager_properties[PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_DOCUMENT_PROPERTY]);
}

static void
paper_clip_services_document_manager_class_init (PaperClipServicesDocumentManagerClass * klass,
                                                 gpointer klass_data)
{
	paper_clip_services_document_manager_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PaperClipServicesDocumentManager_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_paper_clip_services_document_manager_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_paper_clip_services_document_manager_set_property;
	G_OBJECT_CLASS (klass)->finalize = paper_clip_services_document_manager_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_CHANGED_PROPERTY, paper_clip_services_document_manager_properties[PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_CHANGED_PROPERTY] = g_param_spec_boolean ("changed", "changed", "changed", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_DOCUMENT_PROPERTY, paper_clip_services_document_manager_properties[PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_DOCUMENT_PROPERTY] = g_param_spec_object ("document", "document", "document", PAPER_CLIP_TYPE_DOCUMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
paper_clip_services_document_manager_instance_init (PaperClipServicesDocumentManager * self,
                                                    gpointer klass)
{
	self->priv = paper_clip_services_document_manager_get_instance_private (self);
	self->priv->_changed = FALSE;
}

static void
paper_clip_services_document_manager_finalize (GObject * obj)
{
	PaperClipServicesDocumentManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PAPER_CLIP_SERVICES_TYPE_DOCUMENT_MANAGER, PaperClipServicesDocumentManager);
	_g_object_unref0 (self->priv->_document);
	G_OBJECT_CLASS (paper_clip_services_document_manager_parent_class)->finalize (obj);
}

static GType
paper_clip_services_document_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PaperClipServicesDocumentManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) paper_clip_services_document_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PaperClipServicesDocumentManager), 0, (GInstanceInitFunc) paper_clip_services_document_manager_instance_init, NULL };
	GType paper_clip_services_document_manager_type_id;
	paper_clip_services_document_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "PaperClipServicesDocumentManager", &g_define_type_info, 0);
	PaperClipServicesDocumentManager_private_offset = g_type_add_instance_private (paper_clip_services_document_manager_type_id, sizeof (PaperClipServicesDocumentManagerPrivate));
	return paper_clip_services_document_manager_type_id;
}

GType
paper_clip_services_document_manager_get_type (void)
{
	static volatile gsize paper_clip_services_document_manager_type_id__once = 0;
	if (g_once_init_enter (&paper_clip_services_document_manager_type_id__once)) {
		GType paper_clip_services_document_manager_type_id;
		paper_clip_services_document_manager_type_id = paper_clip_services_document_manager_get_type_once ();
		g_once_init_leave (&paper_clip_services_document_manager_type_id__once, paper_clip_services_document_manager_type_id);
	}
	return paper_clip_services_document_manager_type_id__once;
}

static void
_vala_paper_clip_services_document_manager_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec)
{
	PaperClipServicesDocumentManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PAPER_CLIP_SERVICES_TYPE_DOCUMENT_MANAGER, PaperClipServicesDocumentManager);
	switch (property_id) {
		case PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_CHANGED_PROPERTY:
		g_value_set_boolean (value, paper_clip_services_document_manager_get_changed (self));
		break;
		case PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_DOCUMENT_PROPERTY:
		g_value_set_object (value, paper_clip_services_document_manager_get_document (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_paper_clip_services_document_manager_set_property (GObject * object,
                                                         guint property_id,
                                                         const GValue * value,
                                                         GParamSpec * pspec)
{
	PaperClipServicesDocumentManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PAPER_CLIP_SERVICES_TYPE_DOCUMENT_MANAGER, PaperClipServicesDocumentManager);
	switch (property_id) {
		case PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_CHANGED_PROPERTY:
		paper_clip_services_document_manager_set_changed (self, g_value_get_boolean (value));
		break;
		case PAPER_CLIP_SERVICES_DOCUMENT_MANAGER_DOCUMENT_PROPERTY:
		paper_clip_services_document_manager_set_document (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

