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

/*
 * Copyright (C) 2023 Niels De Graef <nielsdegraef@gmail.com>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include "contactscore.h"
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <adwaita.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 CONTACTS_TYPE_EDITABLE_AVATAR (contacts_editable_avatar_get_type ())
#define CONTACTS_EDITABLE_AVATAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_EDITABLE_AVATAR, ContactsEditableAvatar))
#define CONTACTS_EDITABLE_AVATAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_EDITABLE_AVATAR, ContactsEditableAvatarClass))
#define CONTACTS_IS_EDITABLE_AVATAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_EDITABLE_AVATAR))
#define CONTACTS_IS_EDITABLE_AVATAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_EDITABLE_AVATAR))
#define CONTACTS_EDITABLE_AVATAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_EDITABLE_AVATAR, ContactsEditableAvatarClass))

typedef struct _ContactsEditableAvatar ContactsEditableAvatar;
typedef struct _ContactsEditableAvatarClass ContactsEditableAvatarClass;
typedef struct _ContactsEditableAvatarPrivate ContactsEditableAvatarPrivate;
enum  {
	CONTACTS_EDITABLE_AVATAR_0_PROPERTY,
	CONTACTS_EDITABLE_AVATAR_CONTACT_PROPERTY,
	CONTACTS_EDITABLE_AVATAR_AVATAR_SIZE_PROPERTY,
	CONTACTS_EDITABLE_AVATAR_NUM_PROPERTIES
};
static GParamSpec* contacts_editable_avatar_properties[CONTACTS_EDITABLE_AVATAR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define CONTACTS_TYPE_AVATAR_SELECTOR (contacts_avatar_selector_get_type ())
#define CONTACTS_AVATAR_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_AVATAR_SELECTOR, ContactsAvatarSelector))
#define CONTACTS_AVATAR_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_AVATAR_SELECTOR, ContactsAvatarSelectorClass))
#define CONTACTS_IS_AVATAR_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_AVATAR_SELECTOR))
#define CONTACTS_IS_AVATAR_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_AVATAR_SELECTOR))
#define CONTACTS_AVATAR_SELECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_AVATAR_SELECTOR, ContactsAvatarSelectorClass))

typedef struct _ContactsAvatarSelector ContactsAvatarSelector;
typedef struct _ContactsAvatarSelectorClass ContactsAvatarSelectorClass;

#define CONTACTS_TYPE_AVATAR (contacts_avatar_get_type ())
#define CONTACTS_AVATAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_AVATAR, ContactsAvatar))
#define CONTACTS_AVATAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_AVATAR, ContactsAvatarClass))
#define CONTACTS_IS_AVATAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_AVATAR))
#define CONTACTS_IS_AVATAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_AVATAR))
#define CONTACTS_AVATAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_AVATAR, ContactsAvatarClass))

typedef struct _ContactsAvatar ContactsAvatar;
typedef struct _ContactsAvatarClass ContactsAvatarClass;

struct _ContactsEditableAvatar {
	GtkWidget parent_instance;
	ContactsEditableAvatarPrivate * priv;
};

struct _ContactsEditableAvatarClass {
	GtkWidgetClass parent_class;
};

struct _ContactsEditableAvatarPrivate {
	GtkOverlay* overlay;
	ContactsContact* _contact;
	gint _avatar_size;
};

static gint ContactsEditableAvatar_private_offset;
static gpointer contacts_editable_avatar_parent_class = NULL;

VALA_EXTERN GType contacts_editable_avatar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ContactsEditableAvatar, g_object_unref)
VALA_EXTERN ContactsEditableAvatar* contacts_editable_avatar_new (ContactsContact* contact,
                                                      gint size);
VALA_EXTERN ContactsEditableAvatar* contacts_editable_avatar_construct (GType object_type,
                                                            ContactsContact* contact,
                                                            gint size);
static void contacts_editable_avatar_real_dispose (GObject* base);
static void contacts_editable_avatar_on_avatar_chunk_notify (ContactsEditableAvatar* self,
                                                      GObject* object,
                                                      GParamSpec* pspec);
static void contacts_editable_avatar_on_edit_avatar (ContactsEditableAvatar* self,
                                              const gchar* action_name,
                                              GVariant* param);
VALA_EXTERN GType contacts_avatar_selector_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ContactsAvatarSelector, g_object_unref)
VALA_EXTERN ContactsContact* contacts_editable_avatar_get_contact (ContactsEditableAvatar* self);
VALA_EXTERN ContactsAvatarSelector* contacts_avatar_selector_new (ContactsContact* contact);
VALA_EXTERN ContactsAvatarSelector* contacts_avatar_selector_construct (GType object_type,
                                                            ContactsContact* contact);
static void contacts_editable_avatar_on_delete_avatar (ContactsEditableAvatar* self,
                                                const gchar* action_name,
                                                GVariant* param);
static void contacts_editable_avatar_set_contact (ContactsEditableAvatar* self,
                                           ContactsContact* value);
VALA_EXTERN gint contacts_editable_avatar_get_avatar_size (ContactsEditableAvatar* self);
VALA_EXTERN void contacts_editable_avatar_set_avatar_size (ContactsEditableAvatar* self,
                                               gint value);
static GObject * contacts_editable_avatar_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
VALA_EXTERN GType contacts_avatar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ContactsAvatar, g_object_unref)
VALA_EXTERN ContactsAvatar* contacts_avatar_new_for_contact (gint size,
                                                 ContactsContact* contact);
VALA_EXTERN ContactsAvatar* contacts_avatar_construct_for_contact (GType object_type,
                                                       gint size,
                                                       ContactsContact* contact);
static void _contacts_editable_avatar_on_avatar_chunk_notify_g_object_notify (GObject* _sender,
                                                                       GParamSpec* pspec,
                                                                       gpointer self);
static void contacts_editable_avatar_finalize (GObject * obj);
static GType contacts_editable_avatar_get_type_once (void);
static void _vala_contacts_editable_avatar_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_contacts_editable_avatar_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec);

static inline gpointer
contacts_editable_avatar_get_instance_private (ContactsEditableAvatar* self)
{
	return G_STRUCT_MEMBER_P (self, ContactsEditableAvatar_private_offset);
}

ContactsEditableAvatar*
contacts_editable_avatar_construct (GType object_type,
                                    ContactsContact* contact,
                                    gint size)
{
	ContactsEditableAvatar * self = NULL;
	g_return_val_if_fail (contact != NULL, NULL);
	self = (ContactsEditableAvatar*) g_object_new (object_type, "contact", contact, "avatar-size", size, NULL);
	return self;
}

ContactsEditableAvatar*
contacts_editable_avatar_new (ContactsContact* contact,
                              gint size)
{
	return contacts_editable_avatar_construct (CONTACTS_TYPE_EDITABLE_AVATAR, contact, size);
}

static void
contacts_editable_avatar_real_dispose (GObject* base)
{
	ContactsEditableAvatar * self;
	GtkOverlay* _tmp0_;
	self = (ContactsEditableAvatar*) base;
	_tmp0_ = self->priv->overlay;
	gtk_widget_unparent ((GtkWidget*) _tmp0_);
	G_OBJECT_CLASS (contacts_editable_avatar_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
}

static void
contacts_editable_avatar_on_avatar_chunk_notify (ContactsEditableAvatar* self,
                                                 GObject* object,
                                                 GParamSpec* pspec)
{
	ContactsAvatarChunk* avatar_chunk = NULL;
	GLoadableIcon* _tmp0_;
	GLoadableIcon* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (pspec != NULL);
	avatar_chunk = G_TYPE_CHECK_INSTANCE_CAST (object, CONTACTS_TYPE_AVATAR_CHUNK, ContactsAvatarChunk);
	_tmp0_ = contacts_avatar_chunk_get_avatar (avatar_chunk);
	_tmp1_ = _tmp0_;
	gtk_widget_action_set_enabled ((GtkWidget*) self, "delete-avatar", _tmp1_ != NULL);
}

static void
contacts_editable_avatar_on_edit_avatar (ContactsEditableAvatar* self,
                                         const gchar* action_name,
                                         GVariant* param)
{
	ContactsAvatarSelector* selector = NULL;
	ContactsContact* _tmp0_;
	ContactsAvatarSelector* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action_name != NULL);
	_tmp0_ = self->priv->_contact;
	_tmp1_ = contacts_avatar_selector_new (_tmp0_);
	g_object_ref_sink (_tmp1_);
	selector = _tmp1_;
	adw_dialog_present ((AdwDialog*) selector, (GtkWidget*) self);
	_g_object_unref0 (selector);
}

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

static void
contacts_editable_avatar_on_delete_avatar (ContactsEditableAvatar* self,
                                           const gchar* action_name,
                                           GVariant* param)
{
	ContactsChunk* avatar_chunk = NULL;
	ContactsContact* _tmp0_;
	ContactsChunk* _tmp1_;
	ContactsChunk* _tmp2_;
	ContactsChunk* _tmp3_;
	ContactsChunk* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action_name != NULL);
	_tmp0_ = self->priv->_contact;
	_tmp1_ = contacts_contact_get_most_relevant_chunk (_tmp0_, "avatar", TRUE);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	avatar_chunk = _tmp2_;
	_tmp3_ = avatar_chunk;
	if (_tmp3_ == NULL) {
		ContactsContact* _tmp4_;
		ContactsChunk* _tmp5_;
		ContactsChunk* _tmp6_;
		_tmp4_ = self->priv->_contact;
		_tmp5_ = contacts_contact_create_chunk (_tmp4_, "avatar", NULL);
		_tmp6_ = _g_object_ref0 (_tmp5_);
		_g_object_unref0 (avatar_chunk);
		avatar_chunk = _tmp6_;
	}
	_tmp7_ = avatar_chunk;
	contacts_avatar_chunk_set_avatar (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, CONTACTS_TYPE_AVATAR_CHUNK, ContactsAvatarChunk), NULL);
	_g_object_unref0 (avatar_chunk);
}

ContactsContact*
contacts_editable_avatar_get_contact (ContactsEditableAvatar* self)
{
	ContactsContact* result;
	ContactsContact* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_contact;
	result = _tmp0_;
	return result;
}

static void
contacts_editable_avatar_set_contact (ContactsEditableAvatar* self,
                                      ContactsContact* value)
{
	ContactsContact* old_value;
	g_return_if_fail (self != NULL);
	old_value = contacts_editable_avatar_get_contact (self);
	if (old_value != value) {
		ContactsContact* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_contact);
		self->priv->_contact = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, contacts_editable_avatar_properties[CONTACTS_EDITABLE_AVATAR_CONTACT_PROPERTY]);
	}
}

gint
contacts_editable_avatar_get_avatar_size (ContactsEditableAvatar* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_avatar_size;
	return result;
}

void
contacts_editable_avatar_set_avatar_size (ContactsEditableAvatar* self,
                                          gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = contacts_editable_avatar_get_avatar_size (self);
	if (old_value != value) {
		self->priv->_avatar_size = value;
		g_object_notify_by_pspec ((GObject *) self, contacts_editable_avatar_properties[CONTACTS_EDITABLE_AVATAR_AVATAR_SIZE_PROPERTY]);
	}
}

static void
_contacts_editable_avatar_on_avatar_chunk_notify_g_object_notify (GObject* _sender,
                                                                  GParamSpec* pspec,
                                                                  gpointer self)
{
	contacts_editable_avatar_on_avatar_chunk_notify ((ContactsEditableAvatar*) self, _sender, pspec);
}

static GObject *
contacts_editable_avatar_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ContactsEditableAvatar * self;
	ContactsAvatar* avatar = NULL;
	gint _tmp0_;
	ContactsContact* _tmp1_;
	ContactsAvatar* _tmp2_;
	ContactsAvatar* _tmp3_;
	GtkOverlay* _tmp4_;
	ContactsAvatar* _tmp5_;
	ContactsChunk* chunk = NULL;
	ContactsContact* _tmp6_;
	ContactsChunk* _tmp7_;
	ContactsChunk* _tmp8_;
	ContactsChunk* _tmp9_;
	ContactsAvatarChunk* avatar_chunk = NULL;
	ContactsChunk* _tmp13_;
	ContactsAvatarChunk* _tmp14_;
	GLoadableIcon* _tmp15_;
	GLoadableIcon* _tmp16_;
	ContactsAvatarChunk* _tmp17_;
	parent_class = G_OBJECT_CLASS (contacts_editable_avatar_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_EDITABLE_AVATAR, ContactsEditableAvatar);
	_tmp0_ = self->priv->_avatar_size;
	_tmp1_ = self->priv->_contact;
	_tmp2_ = contacts_avatar_new_for_contact (_tmp0_, _tmp1_);
	g_object_ref_sink (_tmp2_);
	avatar = _tmp2_;
	_tmp3_ = avatar;
	g_object_bind_property_with_closures ((GObject*) self, "avatar-size", (GObject*) _tmp3_, "avatar-size", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp4_ = self->priv->overlay;
	_tmp5_ = avatar;
	gtk_overlay_set_child (_tmp4_, (GtkWidget*) _tmp5_);
	_tmp6_ = self->priv->_contact;
	_tmp7_ = contacts_contact_get_most_relevant_chunk (_tmp6_, "avatar", TRUE);
	_tmp8_ = _g_object_ref0 (_tmp7_);
	chunk = _tmp8_;
	_tmp9_ = chunk;
	if (_tmp9_ == NULL) {
		ContactsContact* _tmp10_;
		ContactsChunk* _tmp11_;
		ContactsChunk* _tmp12_;
		_tmp10_ = self->priv->_contact;
		_tmp11_ = contacts_contact_create_chunk (_tmp10_, "avatar", NULL);
		_tmp12_ = _g_object_ref0 (_tmp11_);
		_g_object_unref0 (chunk);
		chunk = _tmp12_;
	}
	_tmp13_ = chunk;
	avatar_chunk = G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, CONTACTS_TYPE_AVATAR_CHUNK, ContactsAvatarChunk);
	_tmp14_ = avatar_chunk;
	_tmp15_ = contacts_avatar_chunk_get_avatar (_tmp14_);
	_tmp16_ = _tmp15_;
	gtk_widget_action_set_enabled ((GtkWidget*) self, "delete-avatar", _tmp16_ != NULL);
	_tmp17_ = avatar_chunk;
	g_signal_connect_object ((GObject*) _tmp17_, "notify::avatar", (GCallback) _contacts_editable_avatar_on_avatar_chunk_notify_g_object_notify, self, 0);
	_g_object_unref0 (chunk);
	_g_object_unref0 (avatar);
	return obj;
}

static void
contacts_editable_avatar_class_init (ContactsEditableAvatarClass * klass,
                                     gpointer klass_data)
{
	contacts_editable_avatar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ContactsEditableAvatar_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) contacts_editable_avatar_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_contacts_editable_avatar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_contacts_editable_avatar_set_property;
	G_OBJECT_CLASS (klass)->constructor = contacts_editable_avatar_constructor;
	G_OBJECT_CLASS (klass)->finalize = contacts_editable_avatar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), CONTACTS_EDITABLE_AVATAR_CONTACT_PROPERTY, contacts_editable_avatar_properties[CONTACTS_EDITABLE_AVATAR_CONTACT_PROPERTY] = g_param_spec_object ("contact", "contact", "contact", CONTACTS_TYPE_CONTACT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CONTACTS_EDITABLE_AVATAR_AVATAR_SIZE_PROPERTY, contacts_editable_avatar_properties[CONTACTS_EDITABLE_AVATAR_AVATAR_SIZE_PROPERTY] = g_param_spec_int ("avatar-size", "avatar-size", "avatar-size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Contacts/ui/contacts-editable-avatar.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "overlay", FALSE, ContactsEditableAvatar_private_offset + G_STRUCT_OFFSET (ContactsEditableAvatarPrivate, overlay));
	gtk_widget_class_set_layout_manager_type (GTK_WIDGET_CLASS (klass), gtk_bin_layout_get_type ());
	gtk_widget_class_install_action (GTK_WIDGET_CLASS (klass), "edit-avatar", NULL, (GtkWidgetActionActivateFunc) contacts_editable_avatar_on_edit_avatar);
	gtk_widget_class_install_action (GTK_WIDGET_CLASS (klass), "delete-avatar", NULL, (GtkWidgetActionActivateFunc) contacts_editable_avatar_on_delete_avatar);
}

static void
contacts_editable_avatar_instance_init (ContactsEditableAvatar * self,
                                        gpointer klass)
{
	self->priv = contacts_editable_avatar_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
contacts_editable_avatar_finalize (GObject * obj)
{
	ContactsEditableAvatar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_EDITABLE_AVATAR, ContactsEditableAvatar);
	_g_object_unref0 (self->priv->_contact);
	G_OBJECT_CLASS (contacts_editable_avatar_parent_class)->finalize (obj);
}

/**
 * The EditableAvatar is a custom widget that allows changing or unsetting a
 * {@link Contact}'s avatar.
 */
 G_GNUC_NO_INLINE static GType
contacts_editable_avatar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ContactsEditableAvatarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_editable_avatar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsEditableAvatar), 0, (GInstanceInitFunc) contacts_editable_avatar_instance_init, NULL };
	GType contacts_editable_avatar_type_id;
	contacts_editable_avatar_type_id = g_type_register_static (gtk_widget_get_type (), "ContactsEditableAvatar", &g_define_type_info, 0);
	ContactsEditableAvatar_private_offset = g_type_add_instance_private (contacts_editable_avatar_type_id, sizeof (ContactsEditableAvatarPrivate));
	return contacts_editable_avatar_type_id;
}

GType
contacts_editable_avatar_get_type (void)
{
	static volatile gsize contacts_editable_avatar_type_id__once = 0;
	if (g_once_init_enter (&contacts_editable_avatar_type_id__once)) {
		GType contacts_editable_avatar_type_id;
		contacts_editable_avatar_type_id = contacts_editable_avatar_get_type_once ();
		g_once_init_leave (&contacts_editable_avatar_type_id__once, contacts_editable_avatar_type_id);
	}
	return contacts_editable_avatar_type_id__once;
}

static void
_vala_contacts_editable_avatar_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	ContactsEditableAvatar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CONTACTS_TYPE_EDITABLE_AVATAR, ContactsEditableAvatar);
	switch (property_id) {
		case CONTACTS_EDITABLE_AVATAR_CONTACT_PROPERTY:
		g_value_set_object (value, contacts_editable_avatar_get_contact (self));
		break;
		case CONTACTS_EDITABLE_AVATAR_AVATAR_SIZE_PROPERTY:
		g_value_set_int (value, contacts_editable_avatar_get_avatar_size (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_contacts_editable_avatar_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	ContactsEditableAvatar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CONTACTS_TYPE_EDITABLE_AVATAR, ContactsEditableAvatar);
	switch (property_id) {
		case CONTACTS_EDITABLE_AVATAR_CONTACT_PROPERTY:
		contacts_editable_avatar_set_contact (self, g_value_get_object (value));
		break;
		case CONTACTS_EDITABLE_AVATAR_AVATAR_SIZE_PROPERTY:
		contacts_editable_avatar_set_avatar_size (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

