/* MarkupPolicy.c generated by valac 0.52.4, the Vala compiler
 * generated from MarkupPolicy.vala, do not modify */

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>

typedef enum  {
	TOOTLE_MARKUP_POLICY_DISALLOW,
	TOOTLE_MARKUP_POLICY_ALLOW,
	TOOTLE_MARKUP_POLICY_TRUST
} TootleMarkupPolicy;

#define TOOTLE_TYPE_MARKUP_POLICY (tootle_markup_policy_get_type ())

#define TOOTLE_WIDGETS_TYPE_RICH_LABEL (tootle_widgets_rich_label_get_type ())
#define TOOTLE_WIDGETS_RICH_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_WIDGETS_TYPE_RICH_LABEL, TootleWidgetsRichLabel))
#define TOOTLE_WIDGETS_RICH_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_WIDGETS_TYPE_RICH_LABEL, TootleWidgetsRichLabelClass))
#define TOOTLE_WIDGETS_IS_RICH_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_WIDGETS_TYPE_RICH_LABEL))
#define TOOTLE_WIDGETS_IS_RICH_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_WIDGETS_TYPE_RICH_LABEL))
#define TOOTLE_WIDGETS_RICH_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_WIDGETS_TYPE_RICH_LABEL, TootleWidgetsRichLabelClass))

typedef struct _TootleWidgetsRichLabel TootleWidgetsRichLabel;
typedef struct _TootleWidgetsRichLabelClass TootleWidgetsRichLabelClass;

GType tootle_markup_policy_get_type (void) G_GNUC_CONST ;
gchar* tootle_markup_policy_process (TootleMarkupPolicy self,
                                     const gchar* input);
gchar* tootle_html_utils_remove_tags (const gchar* content);
gchar* tootle_html_utils_simplify (const gchar* str);
GType tootle_widgets_rich_label_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleWidgetsRichLabel, g_object_unref)
void tootle_markup_policy_apply (TootleMarkupPolicy self,
                                 TootleWidgetsRichLabel* w);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

gchar*
tootle_markup_policy_process (TootleMarkupPolicy self,
                              const gchar* input)
{
	gchar* result = NULL;
	g_return_val_if_fail (input != NULL, NULL);
	switch (self) {
		case TOOTLE_MARKUP_POLICY_DISALLOW:
		{
			gchar* _tmp0_;
			_tmp0_ = tootle_html_utils_remove_tags (input);
			result = _tmp0_;
			return result;
		}
		case TOOTLE_MARKUP_POLICY_ALLOW:
		{
			gchar* _tmp1_;
			_tmp1_ = tootle_html_utils_simplify (input);
			result = _tmp1_;
			return result;
		}
		default:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup (input);
			result = _tmp2_;
			return result;
		}
	}
}

void
tootle_markup_policy_apply (TootleMarkupPolicy self,
                            TootleWidgetsRichLabel* w)
{
	g_return_if_fail (w != NULL);
	gtk_label_set_use_markup ((GtkLabel*) w, self != TOOTLE_MARKUP_POLICY_DISALLOW);
}

static GType
tootle_markup_policy_get_type_once (void)
{
	static const GEnumValue values[] = {{TOOTLE_MARKUP_POLICY_DISALLOW, "TOOTLE_MARKUP_POLICY_DISALLOW", "disallow"}, {TOOTLE_MARKUP_POLICY_ALLOW, "TOOTLE_MARKUP_POLICY_ALLOW", "allow"}, {TOOTLE_MARKUP_POLICY_TRUST, "TOOTLE_MARKUP_POLICY_TRUST", "trust"}, {0, NULL, NULL}};
	GType tootle_markup_policy_type_id;
	tootle_markup_policy_type_id = g_enum_register_static ("TootleMarkupPolicy", values);
	return tootle_markup_policy_type_id;
}

GType
tootle_markup_policy_get_type (void)
{
	static volatile gsize tootle_markup_policy_type_id__volatile = 0;
	if (g_once_init_enter (&tootle_markup_policy_type_id__volatile)) {
		GType tootle_markup_policy_type_id;
		tootle_markup_policy_type_id = tootle_markup_policy_get_type_once ();
		g_once_init_leave (&tootle_markup_policy_type_id__volatile, tootle_markup_policy_type_id);
	}
	return tootle_markup_policy_type_id__volatile;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

