/* error_entry.c generated by valac 0.40.0.227-717ea, the Vala compiler
 * generated from error_entry.vala, do not modify */

/*
 * This file is part of GNOME LaTeX.
 *
 * Copyright © 2012, 2013 Sébastien Wilmet
 *
 * GNOME LaTeX is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * GNOME LaTeX is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GNOME LaTeX.  If not, see <http://www.gnu.org/licenses/>.
 */


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


#define TYPE_ERROR_ENTRY (error_entry_get_type ())
#define ERROR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ERROR_ENTRY, ErrorEntry))
#define ERROR_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ERROR_ENTRY, ErrorEntryClass))
#define IS_ERROR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ERROR_ENTRY))
#define IS_ERROR_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ERROR_ENTRY))
#define ERROR_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ERROR_ENTRY, ErrorEntryClass))

typedef struct _ErrorEntry ErrorEntry;
typedef struct _ErrorEntryClass ErrorEntryClass;
typedef struct _ErrorEntryPrivate ErrorEntryPrivate;
enum  {
	ERROR_ENTRY_0_PROPERTY,
	ERROR_ENTRY_NUM_PROPERTIES
};
static GParamSpec* error_entry_properties[ERROR_ENTRY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _ErrorEntry {
	GObject parent_instance;
	ErrorEntryPrivate * priv;
};

struct _ErrorEntryClass {
	GObjectClass parent_class;
};


static gpointer error_entry_parent_class = NULL;
static GtkCssProvider* error_entry__provider;
static GtkCssProvider* error_entry__provider = NULL;

GType error_entry_get_type (void) G_GNUC_CONST;
static void error_entry_init_provider (void);
void error_entry_add_error (GtkWidget* widget);
void error_entry_remove_error (GtkWidget* widget);
ErrorEntry* error_entry_new (void);
ErrorEntry* error_entry_construct (GType object_type);
static void error_entry_finalize (GObject * obj);


static void
error_entry_init_provider (void)
{
	GtkCssProvider* _tmp0_;
	gchar* style = NULL;
	gchar* _tmp1_;
	GtkCssProvider* _tmp2_;
	GError * _inner_error_ = NULL;
#line 30 "error_entry.vala"
	_tmp0_ = error_entry__provider;
#line 30 "error_entry.vala"
	if (_tmp0_ != NULL) {
#line 31 "error_entry.vala"
		return;
#line 88 "error_entry.c"
	}
#line 33 "error_entry.vala"
	_tmp1_ = g_strdup ("\n" \
"        GtkEntry {\n" \
"            color: white;\n" \
"            background-image: none;\n" \
"            background-color: rgb (237, 54, 54);\n" \
"        }\n" \
"        ");
#line 33 "error_entry.vala"
	style = _tmp1_;
#line 41 "error_entry.vala"
	_tmp2_ = gtk_css_provider_new ();
#line 41 "error_entry.vala"
	_g_object_unref0 (error_entry__provider);
#line 41 "error_entry.vala"
	error_entry__provider = _tmp2_;
#line 100 "error_entry.c"
	{
		GtkCssProvider* _tmp3_;
		const gchar* _tmp4_;
#line 45 "error_entry.vala"
		_tmp3_ = error_entry__provider;
#line 45 "error_entry.vala"
		_tmp4_ = style;
#line 45 "error_entry.vala"
		gtk_css_provider_load_from_data (_tmp3_, _tmp4_, (gssize) -1, &_inner_error_);
#line 45 "error_entry.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 112 "error_entry.c"
			goto __catch18_g_error;
		}
	}
	goto __finally18;
	__catch18_g_error:
	{
		GError* e = NULL;
		GError* _tmp5_;
		const gchar* _tmp6_;
#line 43 "error_entry.vala"
		e = _inner_error_;
#line 43 "error_entry.vala"
		_inner_error_ = NULL;
#line 49 "error_entry.vala"
		_tmp5_ = e;
#line 49 "error_entry.vala"
		_tmp6_ = _tmp5_->message;
#line 49 "error_entry.vala"
		g_warning ("error_entry.vala:49: Impossible to load CSS style for the error entry:" \
" %s", _tmp6_);
#line 43 "error_entry.vala"
		_g_error_free0 (e);
#line 134 "error_entry.c"
	}
	__finally18:
#line 43 "error_entry.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 43 "error_entry.vala"
		_g_free0 (style);
#line 43 "error_entry.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 43 "error_entry.vala"
		g_clear_error (&_inner_error_);
#line 43 "error_entry.vala"
		return;
#line 147 "error_entry.c"
	}
#line 28 "error_entry.vala"
	_g_free0 (style);
#line 151 "error_entry.c"
}


static gpointer
_g_object_ref0 (gpointer self)
{
#line 55 "error_entry.vala"
	return self ? g_object_ref (self) : NULL;
#line 160 "error_entry.c"
}


void
error_entry_add_error (GtkWidget* widget)
{
	GtkStyleContext* context = NULL;
	GtkStyleContext* _tmp0_;
	GtkStyleContext* _tmp1_;
	GtkCssProvider* _tmp2_;
#line 53 "error_entry.vala"
	g_return_if_fail (widget != NULL);
#line 55 "error_entry.vala"
	_tmp0_ = gtk_widget_get_style_context (widget);
#line 55 "error_entry.vala"
	_tmp1_ = _g_object_ref0 (_tmp0_);
#line 55 "error_entry.vala"
	context = _tmp1_;
#line 57 "error_entry.vala"
	error_entry_init_provider ();
#line 59 "error_entry.vala"
	_tmp2_ = error_entry__provider;
#line 59 "error_entry.vala"
	if (_tmp2_ != NULL) {
#line 185 "error_entry.c"
		GtkStyleContext* _tmp3_;
		GtkCssProvider* _tmp4_;
#line 60 "error_entry.vala"
		_tmp3_ = context;
#line 60 "error_entry.vala"
		_tmp4_ = error_entry__provider;
#line 60 "error_entry.vala"
		gtk_style_context_add_provider (_tmp3_, (GtkStyleProvider*) _tmp4_, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
#line 194 "error_entry.c"
	}
#line 53 "error_entry.vala"
	_g_object_unref0 (context);
#line 198 "error_entry.c"
}


void
error_entry_remove_error (GtkWidget* widget)
{
	GtkStyleContext* context = NULL;
	GtkStyleContext* _tmp0_;
	GtkStyleContext* _tmp1_;
	GtkCssProvider* _tmp2_;
#line 63 "error_entry.vala"
	g_return_if_fail (widget != NULL);
#line 65 "error_entry.vala"
	_tmp0_ = gtk_widget_get_style_context (widget);
#line 65 "error_entry.vala"
	_tmp1_ = _g_object_ref0 (_tmp0_);
#line 65 "error_entry.vala"
	context = _tmp1_;
#line 67 "error_entry.vala"
	error_entry_init_provider ();
#line 69 "error_entry.vala"
	_tmp2_ = error_entry__provider;
#line 69 "error_entry.vala"
	if (_tmp2_ != NULL) {
#line 223 "error_entry.c"
		GtkStyleContext* _tmp3_;
		GtkCssProvider* _tmp4_;
#line 70 "error_entry.vala"
		_tmp3_ = context;
#line 70 "error_entry.vala"
		_tmp4_ = error_entry__provider;
#line 70 "error_entry.vala"
		gtk_style_context_remove_provider (_tmp3_, (GtkStyleProvider*) _tmp4_);
#line 232 "error_entry.c"
	}
#line 63 "error_entry.vala"
	_g_object_unref0 (context);
#line 236 "error_entry.c"
}


ErrorEntry*
error_entry_construct (GType object_type)
{
	ErrorEntry * self = NULL;
#line 24 "error_entry.vala"
	self = (ErrorEntry*) g_object_new (object_type, NULL);
#line 24 "error_entry.vala"
	return self;
#line 248 "error_entry.c"
}


ErrorEntry*
error_entry_new (void)
{
#line 24 "error_entry.vala"
	return error_entry_construct (TYPE_ERROR_ENTRY);
#line 257 "error_entry.c"
}


static void
error_entry_class_init (ErrorEntryClass * klass)
{
#line 24 "error_entry.vala"
	error_entry_parent_class = g_type_class_peek_parent (klass);
#line 24 "error_entry.vala"
	G_OBJECT_CLASS (klass)->finalize = error_entry_finalize;
#line 268 "error_entry.c"
}


static void
error_entry_instance_init (ErrorEntry * self)
{
}


static void
error_entry_finalize (GObject * obj)
{
	ErrorEntry * self;
#line 24 "error_entry.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_ERROR_ENTRY, ErrorEntry);
#line 24 "error_entry.vala"
	G_OBJECT_CLASS (error_entry_parent_class)->finalize (obj);
#line 286 "error_entry.c"
}


GType
error_entry_get_type (void)
{
	static volatile gsize error_entry_type_id__volatile = 0;
	if (g_once_init_enter (&error_entry_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ErrorEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) error_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ErrorEntry), 0, (GInstanceInitFunc) error_entry_instance_init, NULL };
		GType error_entry_type_id;
		error_entry_type_id = g_type_register_static (G_TYPE_OBJECT, "ErrorEntry", &g_define_type_info, 0);
		g_once_init_leave (&error_entry_type_id__volatile, error_entry_type_id);
	}
	return error_entry_type_id__volatile;
}



