/* imap-examine-command.c generated by valac 0.56.19, the Vala compiler
 * generated from imap-examine-command.vala, do not modify */

/*
 * Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

#include "geary-engine.h"
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.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

enum  {
	GEARY_IMAP_EXAMINE_COMMAND_0_PROPERTY,
	GEARY_IMAP_EXAMINE_COMMAND_MAILBOX_PROPERTY,
	GEARY_IMAP_EXAMINE_COMMAND_NUM_PROPERTIES
};
static GParamSpec* geary_imap_examine_command_properties[GEARY_IMAP_EXAMINE_COMMAND_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GearyImapExamineCommandPrivate {
	GearyImapMailboxSpecifier* _mailbox;
};

static gint GearyImapExamineCommand_private_offset;
static gpointer geary_imap_examine_command_parent_class = NULL;

static void geary_imap_examine_command_set_mailbox (GearyImapExamineCommand* self,
                                             GearyImapMailboxSpecifier* value);
static void geary_imap_examine_command_finalize (GObject * obj);
static GType geary_imap_examine_command_get_type_once (void);
static void _vala_geary_imap_examine_command_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec);
static void _vala_geary_imap_examine_command_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec);

static inline gpointer
geary_imap_examine_command_get_instance_private (GearyImapExamineCommand* self)
{
	return G_STRUCT_MEMBER_P (self, GearyImapExamineCommand_private_offset);
}

GearyImapMailboxSpecifier*
geary_imap_examine_command_get_mailbox (GearyImapExamineCommand* self)
{
	GearyImapMailboxSpecifier* result;
	GearyImapMailboxSpecifier* _tmp0_;
	g_return_val_if_fail (GEARY_IMAP_IS_EXAMINE_COMMAND (self), NULL);
	_tmp0_ = self->priv->_mailbox;
	result = _tmp0_;
	return result;
}

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

static void
geary_imap_examine_command_set_mailbox (GearyImapExamineCommand* self,
                                        GearyImapMailboxSpecifier* value)
{
	GearyImapMailboxSpecifier* old_value;
	g_return_if_fail (GEARY_IMAP_IS_EXAMINE_COMMAND (self));
	old_value = geary_imap_examine_command_get_mailbox (self);
	if (old_value != value) {
		GearyImapMailboxSpecifier* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_mailbox);
		self->priv->_mailbox = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, geary_imap_examine_command_properties[GEARY_IMAP_EXAMINE_COMMAND_MAILBOX_PROPERTY]);
	}
}

GearyImapExamineCommand*
geary_imap_examine_command_construct (GType object_type,
                                      GearyImapMailboxSpecifier* mailbox,
                                      GCancellable* should_send)
{
	GearyImapExamineCommand * self = NULL;
	GearyImapListParameter* _tmp0_;
	GearyImapListParameter* _tmp1_;
	GearyImapParameter* _tmp2_;
	GearyImapParameter* _tmp3_;
	g_return_val_if_fail (GEARY_IMAP_IS_MAILBOX_SPECIFIER (mailbox), NULL);
	g_return_val_if_fail ((should_send == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (should_send, g_cancellable_get_type ()), NULL);
	self = (GearyImapExamineCommand*) geary_imap_command_construct (object_type, GEARY_IMAP_EXAMINE_COMMAND_NAME, NULL, (gint) 0, should_send);
	geary_imap_examine_command_set_mailbox (self, mailbox);
	_tmp0_ = geary_imap_command_get_args (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_IMAP_TYPE_COMMAND, GearyImapCommand));
	_tmp1_ = _tmp0_;
	_tmp2_ = geary_imap_mailbox_specifier_to_parameter (mailbox);
	_tmp3_ = _tmp2_;
	geary_imap_list_parameter_add (_tmp1_, _tmp3_);
	_g_object_unref0 (_tmp3_);
	return self;
}

GearyImapExamineCommand*
geary_imap_examine_command_new (GearyImapMailboxSpecifier* mailbox,
                                GCancellable* should_send)
{
	return geary_imap_examine_command_construct (GEARY_IMAP_TYPE_EXAMINE_COMMAND, mailbox, should_send);
}

static void
geary_imap_examine_command_class_init (GearyImapExamineCommandClass * klass,
                                       gpointer klass_data)
{
	geary_imap_examine_command_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GearyImapExamineCommand_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_geary_imap_examine_command_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_geary_imap_examine_command_set_property;
	G_OBJECT_CLASS (klass)->finalize = geary_imap_examine_command_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEARY_IMAP_EXAMINE_COMMAND_MAILBOX_PROPERTY, geary_imap_examine_command_properties[GEARY_IMAP_EXAMINE_COMMAND_MAILBOX_PROPERTY] = g_param_spec_object ("mailbox", "mailbox", "mailbox", GEARY_IMAP_TYPE_MAILBOX_SPECIFIER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
geary_imap_examine_command_instance_init (GearyImapExamineCommand * self,
                                          gpointer klass)
{
	self->priv = geary_imap_examine_command_get_instance_private (self);
}

static void
geary_imap_examine_command_finalize (GObject * obj)
{
	GearyImapExamineCommand * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEARY_IMAP_TYPE_EXAMINE_COMMAND, GearyImapExamineCommand);
	_g_object_unref0 (self->priv->_mailbox);
	G_OBJECT_CLASS (geary_imap_examine_command_parent_class)->finalize (obj);
}

/**
 * See [[http://tools.ietf.org/html/rfc3501#section-6.3.2]]
 *
 * @see SelectCommand
 */
 G_GNUC_NO_INLINE static GType
geary_imap_examine_command_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapExamineCommandClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_examine_command_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyImapExamineCommand), 0, (GInstanceInitFunc) geary_imap_examine_command_instance_init, NULL };
	GType geary_imap_examine_command_type_id;
	geary_imap_examine_command_type_id = g_type_register_static (GEARY_IMAP_TYPE_COMMAND, "GearyImapExamineCommand", &g_define_type_info, 0);
	GearyImapExamineCommand_private_offset = g_type_add_instance_private (geary_imap_examine_command_type_id, sizeof (GearyImapExamineCommandPrivate));
	return geary_imap_examine_command_type_id;
}

GType
geary_imap_examine_command_get_type (void)
{
	static gsize geary_imap_examine_command_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_examine_command_type_id__once)) {
		GType geary_imap_examine_command_type_id;
		geary_imap_examine_command_type_id = geary_imap_examine_command_get_type_once ();
		g_once_init_leave (&geary_imap_examine_command_type_id__once, geary_imap_examine_command_type_id);
	}
	return geary_imap_examine_command_type_id__once;
}

static void
_vala_geary_imap_examine_command_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec)
{
	GearyImapExamineCommand * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GEARY_IMAP_TYPE_EXAMINE_COMMAND, GearyImapExamineCommand);
	switch (property_id) {
		case GEARY_IMAP_EXAMINE_COMMAND_MAILBOX_PROPERTY:
		g_value_set_object (value, geary_imap_examine_command_get_mailbox (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_geary_imap_examine_command_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec)
{
	GearyImapExamineCommand * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GEARY_IMAP_TYPE_EXAMINE_COMMAND, GearyImapExamineCommand);
	switch (property_id) {
		case GEARY_IMAP_EXAMINE_COMMAND_MAILBOX_PROPERTY:
		geary_imap_examine_command_set_mailbox (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

