/* geary-email-flags.c generated by valac 0.56.3, the Vala compiler
 * generated from geary-email-flags.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 <stdarg.h>

enum  {
	GEARY_EMAIL_FLAGS_0_PROPERTY,
	GEARY_EMAIL_FLAGS_NUM_PROPERTIES
};
static GParamSpec* geary_email_flags_properties[GEARY_EMAIL_FLAGS_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

static gpointer geary_email_flags_parent_class = NULL;

static GType geary_email_flags_get_type_once (void);
static void _vala_geary_email_flags_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec);

GearyNamedFlag*
geary_email_flags_get_UNREAD (void)
{
	GearyNamedFlag* result;
	GearyNamedFlag* _tmp0_;
	_tmp0_ = geary_named_flag_new ("UNREAD");
	result = _tmp0_;
	return result;
}

GearyNamedFlag*
geary_email_flags_get_FLAGGED (void)
{
	GearyNamedFlag* result;
	GearyNamedFlag* _tmp0_;
	_tmp0_ = geary_named_flag_new ("FLAGGED");
	result = _tmp0_;
	return result;
}

GearyNamedFlag*
geary_email_flags_get_LOAD_REMOTE_IMAGES (void)
{
	GearyNamedFlag* result;
	GearyNamedFlag* _tmp0_;
	_tmp0_ = geary_named_flag_new ("LOADREMOTEIMAGES");
	result = _tmp0_;
	return result;
}

GearyNamedFlag*
geary_email_flags_get_DRAFT (void)
{
	GearyNamedFlag* result;
	GearyNamedFlag* _tmp0_;
	_tmp0_ = geary_named_flag_new ("DRAFT");
	result = _tmp0_;
	return result;
}

GearyNamedFlag*
geary_email_flags_get_DELETED (void)
{
	GearyNamedFlag* result;
	GearyNamedFlag* _tmp0_;
	_tmp0_ = geary_named_flag_new ("DELETED");
	result = _tmp0_;
	return result;
}

GearyNamedFlag*
geary_email_flags_get_OUTBOX_SENT (void)
{
	GearyNamedFlag* result;
	GearyNamedFlag* _tmp0_;
	_tmp0_ = geary_named_flag_new (" OUTBOX SENT ");
	result = _tmp0_;
	return result;
}

GearyEmailFlags*
geary_email_flags_construct (GType object_type)
{
	GearyEmailFlags * self = NULL;
	self = (GearyEmailFlags*) geary_named_flags_construct (object_type);
	return self;
}

GearyEmailFlags*
geary_email_flags_new (void)
{
	return geary_email_flags_construct (GEARY_TYPE_EMAIL_FLAGS);
}

/**
     * Create a new {@link EmailFlags} container initialized with one or more flags.
     */
static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

GearyEmailFlags*
geary_email_flags_constructv_with (GType object_type,
                                   GearyNamedFlag* flag1,
                                   va_list _vala_va_list)
{
	GearyEmailFlags * self = NULL;
	va_list args = {0};
	GearyNamedFlag* flag = NULL;
	GearyNamedFlag* _tmp0_;
	g_return_val_if_fail (GEARY_IS_NAMED_FLAG (flag1), NULL);
	self = (GearyEmailFlags*) geary_named_flags_construct (object_type);
	va_copy (args, _vala_va_list);
	_tmp0_ = _g_object_ref0 (flag1);
	flag = _tmp0_;
	{
		gboolean _tmp1_ = FALSE;
		_tmp1_ = TRUE;
		while (TRUE) {
			GearyNamedFlag* _tmp5_;
			if (!_tmp1_) {
				GearyNamedFlag* _tmp2_;
				GearyNamedFlag* _tmp3_;
				GearyNamedFlag* _tmp4_;
				_tmp2_ = va_arg (args, GearyNamedFlag*);
				_tmp3_ = _g_object_ref0 (_tmp2_);
				_g_object_unref0 (flag);
				flag = _tmp3_;
				_tmp4_ = flag;
				if (!(_tmp4_ != NULL)) {
					break;
				}
			}
			_tmp1_ = FALSE;
			_tmp5_ = flag;
			geary_named_flags_add (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_NAMED_FLAGS, GearyNamedFlags), _tmp5_);
		}
	}
	_g_object_unref0 (flag);
	va_end (args);
	return self;
}

GearyEmailFlags*
geary_email_flags_new_with (GearyNamedFlag* flag1,
                            ...)
{
	va_list _vala_va_list_obj;
	va_start (_vala_va_list_obj, flag1);
	return geary_email_flags_constructv_with (GEARY_TYPE_EMAIL_FLAGS, flag1, _vala_va_list_obj);
}

GearyEmailFlags*
geary_email_flags_construct_with (GType object_type,
                                  GearyNamedFlag* flag1,
                                  ...)
{
	va_list _vala_va_list_obj;
	va_start (_vala_va_list_obj, flag1);
	return geary_email_flags_constructv_with (object_type, flag1, _vala_va_list_obj);
}

inline gboolean
geary_email_flags_is_unread (GearyEmailFlags* self)
{
	GearyNamedFlag* _tmp0_;
	GearyNamedFlag* _tmp1_;
	GearyNamedFlag* _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	g_return_val_if_fail (GEARY_IS_EMAIL_FLAGS (self), FALSE);
	_tmp0_ = geary_email_flags_get_UNREAD ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = geary_named_flags_contains (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_NAMED_FLAGS, GearyNamedFlags), _tmp2_);
	_g_object_unref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

inline gboolean
geary_email_flags_is_flagged (GearyEmailFlags* self)
{
	GearyNamedFlag* _tmp0_;
	GearyNamedFlag* _tmp1_;
	GearyNamedFlag* _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	g_return_val_if_fail (GEARY_IS_EMAIL_FLAGS (self), FALSE);
	_tmp0_ = geary_email_flags_get_FLAGGED ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = geary_named_flags_contains (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_NAMED_FLAGS, GearyNamedFlags), _tmp2_);
	_g_object_unref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

inline gboolean
geary_email_flags_load_remote_images (GearyEmailFlags* self)
{
	GearyNamedFlag* _tmp0_;
	GearyNamedFlag* _tmp1_;
	GearyNamedFlag* _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	g_return_val_if_fail (GEARY_IS_EMAIL_FLAGS (self), FALSE);
	_tmp0_ = geary_email_flags_get_LOAD_REMOTE_IMAGES ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = geary_named_flags_contains (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_NAMED_FLAGS, GearyNamedFlags), _tmp2_);
	_g_object_unref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

inline gboolean
geary_email_flags_is_draft (GearyEmailFlags* self)
{
	GearyNamedFlag* _tmp0_;
	GearyNamedFlag* _tmp1_;
	GearyNamedFlag* _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	g_return_val_if_fail (GEARY_IS_EMAIL_FLAGS (self), FALSE);
	_tmp0_ = geary_email_flags_get_DRAFT ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = geary_named_flags_contains (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_NAMED_FLAGS, GearyNamedFlags), _tmp2_);
	_g_object_unref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

inline gboolean
geary_email_flags_is_outbox_sent (GearyEmailFlags* self)
{
	GearyNamedFlag* _tmp0_;
	GearyNamedFlag* _tmp1_;
	GearyNamedFlag* _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	g_return_val_if_fail (GEARY_IS_EMAIL_FLAGS (self), FALSE);
	_tmp0_ = geary_email_flags_get_OUTBOX_SENT ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = geary_named_flags_contains (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_NAMED_FLAGS, GearyNamedFlags), _tmp2_);
	_g_object_unref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

inline gboolean
geary_email_flags_is_deleted (GearyEmailFlags* self)
{
	GearyNamedFlag* _tmp0_;
	GearyNamedFlag* _tmp1_;
	GearyNamedFlag* _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	g_return_val_if_fail (GEARY_IS_EMAIL_FLAGS (self), FALSE);
	_tmp0_ = geary_email_flags_get_DELETED ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = geary_named_flags_contains (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_TYPE_NAMED_FLAGS, GearyNamedFlags), _tmp2_);
	_g_object_unref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

static void
geary_email_flags_class_init (GearyEmailFlagsClass * klass,
                              gpointer klass_data)
{
	geary_email_flags_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->get_property = _vala_geary_email_flags_get_property;
}

static void
geary_email_flags_instance_init (GearyEmailFlags * self,
                                 gpointer klass)
{
}

/**
 * A collection of NamedFlags that can be used to enable/disable various user-defined
 * options for an email message.  System- or Geary-defined flags are available as static
 * members.
 *
 * Note that how flags are represented by a particular email storage system may differ from
 * how they're presented here.  In particular, the manner of serializing and deserializing
 * the flags may be handled by an internal subclass.
 */
 G_GNUC_NO_INLINE static GType
geary_email_flags_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyEmailFlagsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_email_flags_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyEmailFlags), 0, (GInstanceInitFunc) geary_email_flags_instance_init, NULL };
	GType geary_email_flags_type_id;
	geary_email_flags_type_id = g_type_register_static (GEARY_TYPE_NAMED_FLAGS, "GearyEmailFlags", &g_define_type_info, 0);
	return geary_email_flags_type_id;
}

GType
geary_email_flags_get_type (void)
{
	static gsize geary_email_flags_type_id__once = 0;
	if (g_once_init_enter (&geary_email_flags_type_id__once)) {
		GType geary_email_flags_type_id;
		geary_email_flags_type_id = geary_email_flags_get_type_once ();
		g_once_init_leave (&geary_email_flags_type_id__once, geary_email_flags_type_id);
	}
	return geary_email_flags_type_id__once;
}

static void
_vala_geary_email_flags_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec)
{
	GearyEmailFlags * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GEARY_TYPE_EMAIL_FLAGS, GearyEmailFlags);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

