/* db-synchronous-mode.c generated by valac 0.56.3, the Vala compiler
 * generated from db-synchronous-mode.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 <stdlib.h>
#include <string.h>
#include <glib.h>

const gchar*
geary_db_synchronous_mode_sql (GearyDbSynchronousMode self)
{
	const gchar* result;
	switch (self) {
		case GEARY_DB_SYNCHRONOUS_MODE_OFF:
		{
			result = "off";
			return result;
		}
		case GEARY_DB_SYNCHRONOUS_MODE_NORMAL:
		{
			result = "normal";
			return result;
		}
		default:
		case GEARY_DB_SYNCHRONOUS_MODE_FULL:
		{
			result = "full";
			return result;
		}
	}
}

GearyDbSynchronousMode
geary_db_synchronous_mode_parse (const gchar* str)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	GQuark _tmp3_ = 0U;
	static GQuark _tmp2_label0 = 0;
	static GQuark _tmp2_label1 = 0;
	GearyDbSynchronousMode result;
	g_return_val_if_fail (str != NULL, 0);
	_tmp0_ = g_utf8_strdown (str, (gssize) -1);
	_tmp1_ = _tmp0_;
	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
	g_free (_tmp1_);
	if (_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("off")))) {
		switch (0) {
			default:
			{
				result = GEARY_DB_SYNCHRONOUS_MODE_OFF;
				return result;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("normal")))) {
		switch (0) {
			default:
			{
				result = GEARY_DB_SYNCHRONOUS_MODE_NORMAL;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				result = GEARY_DB_SYNCHRONOUS_MODE_FULL;
				return result;
			}
		}
	}
}

 G_GNUC_NO_INLINE static GType
geary_db_synchronous_mode_get_type_once (void)
{
	static const GEnumValue values[] = {{GEARY_DB_SYNCHRONOUS_MODE_OFF, "GEARY_DB_SYNCHRONOUS_MODE_OFF", "off"}, {GEARY_DB_SYNCHRONOUS_MODE_NORMAL, "GEARY_DB_SYNCHRONOUS_MODE_NORMAL", "normal"}, {GEARY_DB_SYNCHRONOUS_MODE_FULL, "GEARY_DB_SYNCHRONOUS_MODE_FULL", "full"}, {0, NULL, NULL}};
	GType geary_db_synchronous_mode_type_id;
	geary_db_synchronous_mode_type_id = g_enum_register_static ("GearyDbSynchronousMode", values);
	return geary_db_synchronous_mode_type_id;
}

GType
geary_db_synchronous_mode_get_type (void)
{
	static gsize geary_db_synchronous_mode_type_id__once = 0;
	if (g_once_init_enter (&geary_db_synchronous_mode_type_id__once)) {
		GType geary_db_synchronous_mode_type_id;
		geary_db_synchronous_mode_type_id = geary_db_synchronous_mode_get_type_once ();
		g_once_init_leave (&geary_db_synchronous_mode_type_id__once, geary_db_synchronous_mode_type_id);
	}
	return geary_db_synchronous_mode_type_id__once;
}

