/* gca-diagnostic-message.c generated by valac 0.28.0.11-bbdd, the Vala compiler
 * generated from gca-diagnostic-message.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gtksourceview/gtksource.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#include <string.h>
#include <cairo.h>
#include <float.h>
#include <math.h>
#include <stdio.h>


#define GCA_TYPE_DIAGNOSTIC_MESSAGE (gca_diagnostic_message_get_type ())
#define GCA_DIAGNOSTIC_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_DIAGNOSTIC_MESSAGE, GcaDiagnosticMessage))
#define GCA_DIAGNOSTIC_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_TYPE_DIAGNOSTIC_MESSAGE, GcaDiagnosticMessageClass))
#define GCA_IS_DIAGNOSTIC_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_DIAGNOSTIC_MESSAGE))
#define GCA_IS_DIAGNOSTIC_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_TYPE_DIAGNOSTIC_MESSAGE))
#define GCA_DIAGNOSTIC_MESSAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_TYPE_DIAGNOSTIC_MESSAGE, GcaDiagnosticMessageClass))

typedef struct _GcaDiagnosticMessage GcaDiagnosticMessage;
typedef struct _GcaDiagnosticMessageClass GcaDiagnosticMessageClass;
typedef struct _GcaDiagnosticMessagePrivate GcaDiagnosticMessagePrivate;

#define GCA_TYPE_DIAGNOSTIC (gca_diagnostic_get_type ())
#define GCA_DIAGNOSTIC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_DIAGNOSTIC, GcaDiagnostic))
#define GCA_DIAGNOSTIC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_TYPE_DIAGNOSTIC, GcaDiagnosticClass))
#define GCA_IS_DIAGNOSTIC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_DIAGNOSTIC))
#define GCA_IS_DIAGNOSTIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_TYPE_DIAGNOSTIC))
#define GCA_DIAGNOSTIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_TYPE_DIAGNOSTIC, GcaDiagnosticClass))

typedef struct _GcaDiagnostic GcaDiagnostic;
typedef struct _GcaDiagnosticClass GcaDiagnosticClass;

#define GCA_TYPE_DIAGNOSTIC_COLORS (gca_diagnostic_colors_get_type ())
#define GCA_DIAGNOSTIC_COLORS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_DIAGNOSTIC_COLORS, GcaDiagnosticColors))
#define GCA_DIAGNOSTIC_COLORS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_TYPE_DIAGNOSTIC_COLORS, GcaDiagnosticColorsClass))
#define GCA_IS_DIAGNOSTIC_COLORS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_DIAGNOSTIC_COLORS))
#define GCA_IS_DIAGNOSTIC_COLORS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_TYPE_DIAGNOSTIC_COLORS))
#define GCA_DIAGNOSTIC_COLORS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_TYPE_DIAGNOSTIC_COLORS, GcaDiagnosticColorsClass))

typedef struct _GcaDiagnosticColors GcaDiagnosticColors;
typedef struct _GcaDiagnosticColorsClass GcaDiagnosticColorsClass;

#define GCA_DIAGNOSTIC_TYPE_SEVERITY (gca_diagnostic_severity_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _gca_diagnostic_colors_unref0(var) ((var == NULL) ? NULL : (var = (gca_diagnostic_colors_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define GCA_TYPE_EXPAND_RANGE (gca_expand_range_get_type ())
#define GCA_EXPAND_RANGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_EXPAND_RANGE, GcaExpandRange))
#define GCA_EXPAND_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_TYPE_EXPAND_RANGE, GcaExpandRangeClass))
#define GCA_IS_EXPAND_RANGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_EXPAND_RANGE))
#define GCA_IS_EXPAND_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_TYPE_EXPAND_RANGE))
#define GCA_EXPAND_RANGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_TYPE_EXPAND_RANGE, GcaExpandRangeClass))

typedef struct _GcaExpandRange GcaExpandRange;
typedef struct _GcaExpandRangeClass GcaExpandRangeClass;

#define GCA_TYPE_SOURCE_LOCATION (gca_source_location_get_type ())
typedef struct _GcaSourceLocation GcaSourceLocation;

#define GCA_TYPE_SOURCE_RANGE_SUPPORT (gca_source_range_support_get_type ())
#define GCA_SOURCE_RANGE_SUPPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_SOURCE_RANGE_SUPPORT, GcaSourceRangeSupport))
#define GCA_IS_SOURCE_RANGE_SUPPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_SOURCE_RANGE_SUPPORT))
#define GCA_SOURCE_RANGE_SUPPORT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GCA_TYPE_SOURCE_RANGE_SUPPORT, GcaSourceRangeSupportIface))

typedef struct _GcaSourceRangeSupport GcaSourceRangeSupport;
typedef struct _GcaSourceRangeSupportIface GcaSourceRangeSupportIface;

#define GCA_TYPE_SOURCE_RANGE (gca_source_range_get_type ())
typedef struct _GcaSourceRange GcaSourceRange;
#define _gca_expand_range_unref0(var) ((var == NULL) ? NULL : (var = (gca_expand_range_unref (var), NULL)))

struct _GcaDiagnosticMessage {
	GtkEventBox parent_instance;
	GcaDiagnosticMessagePrivate * priv;
};

struct _GcaDiagnosticMessageClass {
	GtkEventBoxClass parent_class;
};

typedef enum  {
	GCA_DIAGNOSTIC_SEVERITY_NONE,
	GCA_DIAGNOSTIC_SEVERITY_INFO,
	GCA_DIAGNOSTIC_SEVERITY_WARNING,
	GCA_DIAGNOSTIC_SEVERITY_DEPRECATED,
	GCA_DIAGNOSTIC_SEVERITY_ERROR,
	GCA_DIAGNOSTIC_SEVERITY_FATAL
} GcaDiagnosticSeverity;

struct _GcaDiagnosticMessagePrivate {
	GcaDiagnostic** d_diagnostics;
	gint d_diagnostics_length1;
	gint _d_diagnostics_size_;
	GtkBox* d_vbox;
	GcaDiagnosticColors* d_colors;
	GtkSourceView* d_view;
	GcaDiagnosticSeverity d_rulingSeverity;
	gboolean d_inserted;
	gint d_width;
	gint d_height;
	gboolean d_updating;
};

struct _GcaSourceLocation {
	gint line;
	gint column;
};

struct _GcaSourceRange {
	GcaSourceLocation start;
	GcaSourceLocation end;
};

struct _GcaSourceRangeSupportIface {
	GTypeInterface parent_iface;
	GcaSourceRange* (*get_ranges) (GcaSourceRangeSupport* self, int* result_length1);
};


static gpointer gca_diagnostic_message_parent_class = NULL;

GType gca_diagnostic_message_get_type (void) G_GNUC_CONST;
GType gca_diagnostic_get_type (void) G_GNUC_CONST;
gpointer gca_diagnostic_colors_ref (gpointer instance);
void gca_diagnostic_colors_unref (gpointer instance);
GParamSpec* gca_param_spec_diagnostic_colors (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void gca_value_set_diagnostic_colors (GValue* value, gpointer v_object);
void gca_value_take_diagnostic_colors (GValue* value, gpointer v_object);
gpointer gca_value_get_diagnostic_colors (const GValue* value);
GType gca_diagnostic_colors_get_type (void) G_GNUC_CONST;
GType gca_diagnostic_severity_get_type (void) G_GNUC_CONST;
#define GCA_DIAGNOSTIC_MESSAGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCA_TYPE_DIAGNOSTIC_MESSAGE, GcaDiagnosticMessagePrivate))
enum  {
	GCA_DIAGNOSTIC_MESSAGE_DUMMY_PROPERTY
};
GcaDiagnosticMessage* gca_diagnostic_message_new (GtkSourceView* view, GcaDiagnostic** diagnostics, int diagnostics_length1);
GcaDiagnosticMessage* gca_diagnostic_message_construct (GType object_type, GtkSourceView* view, GcaDiagnostic** diagnostics, int diagnostics_length1);
static GcaDiagnostic** _vala_array_dup6 (GcaDiagnostic** self, int length);
GcaDiagnosticColors* gca_diagnostic_colors_new (GtkStyleContext* context);
GcaDiagnosticColors* gca_diagnostic_colors_construct (GType object_type, GtkStyleContext* context);
static void gca_diagnostic_message_on_view_style_updated (GcaDiagnosticMessage* self);
static void _gca_diagnostic_message_on_view_style_updated_gtk_widget_style_updated (GtkWidget* _sender, gpointer self);
static void gca_diagnostic_message_on_style_scheme_changed (GcaDiagnosticMessage* self);
static void _gca_diagnostic_message_on_style_scheme_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static gboolean gca_diagnostic_message_on_view_key_press (GcaDiagnosticMessage* self, GdkEventKey* event);
static gboolean _gca_diagnostic_message_on_view_key_press_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self);
static void gca_diagnostic_message_update (GcaDiagnosticMessage* self);
static void gca_diagnostic_message_style_changed (GcaDiagnosticMessage* self);
void gca_diagnostic_colors_mix_in_widget (GcaDiagnosticColors* self, GtkWidget* widget);
static void gca_diagnostic_message_real_destroy (GtkWidget* base);
static void gca_diagnostic_message_real_style_updated (GtkWidget* base);
static gboolean gca_diagnostic_message_get_mixed_severity (GcaDiagnosticMessage* self);
GcaDiagnosticSeverity gca_diagnostic_get_severity (GcaDiagnostic* self);
gchar* gca_diagnostic_severity_to_string (GcaDiagnosticSeverity self);
const gchar* gca_diagnostic_get_message (GcaDiagnostic* self);
static GcaDiagnosticSeverity gca_diagnostic_message_get_diagnostics_ruling_severity (GcaDiagnosticMessage* self);
void gca_diagnostic_message_reposition (GcaDiagnosticMessage* self);
gpointer gca_expand_range_ref (gpointer instance);
void gca_expand_range_unref (gpointer instance);
GParamSpec* gca_param_spec_expand_range (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void gca_value_set_expand_range (GValue* value, gpointer v_object);
void gca_value_take_expand_range (GValue* value, gpointer v_object);
gpointer gca_value_get_expand_range (const GValue* value);
GType gca_expand_range_get_type (void) G_GNUC_CONST;
GType gca_source_location_get_type (void) G_GNUC_CONST;
GcaSourceLocation* gca_source_location_dup (const GcaSourceLocation* self);
void gca_source_location_free (GcaSourceLocation* self);
static void gca_diagnostic_message_expand_range (GcaDiagnosticMessage* self, GcaExpandRange* topx, GcaExpandRange* bottomx, GcaExpandRange* y, GcaSourceLocation* location);
gboolean gca_source_location_buffer_coordinates (GcaSourceLocation *self, GtkTextView* view, GdkRectangle* rect);
gint gca_expand_range_get_min (GcaExpandRange* self);
void gca_expand_range_reset (GcaExpandRange* self);
gint gca_expand_range_get_max (GcaExpandRange* self);
void gca_expand_range_add (GcaExpandRange* self, gint val);
GcaExpandRange* gca_expand_range_new (void);
GcaExpandRange* gca_expand_range_construct (GType object_type);
GType gca_source_range_get_type (void) G_GNUC_CONST;
GcaSourceRange* gca_source_range_dup (const GcaSourceRange* self);
void gca_source_range_free (GcaSourceRange* self);
GType gca_source_range_support_get_type (void) G_GNUC_CONST;
GcaSourceRange* gca_source_range_support_get_ranges (GcaSourceRangeSupport* self, int* result_length1);
static GtkSizeRequestMode gca_diagnostic_message_real_get_request_mode (GtkWidget* base);
static void gca_diagnostic_message_real_get_preferred_height (GtkWidget* base, gint* minimum_height, gint* natural_height);
static void gca_diagnostic_message_real_get_preferred_width (GtkWidget* base, gint* minimum_width, gint* natural_width);
static void gca_diagnostic_message_real_get_preferred_height_for_width (GtkWidget* base, gint width, gint* minimum_height, gint* natural_height);
static void gca_diagnostic_message_add_class_for_severity (GcaDiagnosticMessage* self, GtkStyleContext* ctx);
static gboolean gca_diagnostic_message_real_draw (GtkWidget* base, cairo_t* context);
GcaDiagnostic** gca_diagnostic_message_get_diagnostics (GcaDiagnosticMessage* self, int* result_length1);
void gca_diagnostic_message_set_diagnostics (GcaDiagnosticMessage* self, GcaDiagnostic** value, int value_length1);
static GcaDiagnostic** _vala_array_dup7 (GcaDiagnostic** self, int length);
static void gca_diagnostic_message_finalize (GObject* obj);
static void _vala_gca_diagnostic_message_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gca_diagnostic_message_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


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


static GcaDiagnostic** _vala_array_dup6 (GcaDiagnostic** self, int length) {
	GcaDiagnostic** result;
	int i;
	result = g_new0 (GcaDiagnostic*, length + 1);
	for (i = 0; i < length; i++) {
		GcaDiagnostic* _tmp0_ = NULL;
		_tmp0_ = _g_object_ref0 (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


static void _gca_diagnostic_message_on_view_style_updated_gtk_widget_style_updated (GtkWidget* _sender, gpointer self) {
	gca_diagnostic_message_on_view_style_updated ((GcaDiagnosticMessage*) self);
}


static void _gca_diagnostic_message_on_style_scheme_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	gca_diagnostic_message_on_style_scheme_changed ((GcaDiagnosticMessage*) self);
}


static gboolean _gca_diagnostic_message_on_view_key_press_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) {
	gboolean result;
	result = gca_diagnostic_message_on_view_key_press ((GcaDiagnosticMessage*) self, event);
	return result;
}


GcaDiagnosticMessage* gca_diagnostic_message_construct (GType object_type, GtkSourceView* view, GcaDiagnostic** diagnostics, int diagnostics_length1) {
	GcaDiagnosticMessage * self = NULL;
	GcaDiagnostic** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	GcaDiagnostic** _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	GtkSourceView* _tmp2_ = NULL;
	GtkStyleContext* _tmp3_ = NULL;
	GcaDiagnosticColors* _tmp4_ = NULL;
	GtkSourceView* _tmp5_ = NULL;
	GtkSourceView* _tmp6_ = NULL;
	GtkTextBuffer* _tmp7_ = NULL;
	GtkTextBuffer* _tmp8_ = NULL;
	GtkSourceView* _tmp9_ = NULL;
	g_return_val_if_fail (view != NULL, NULL);
	self = (GcaDiagnosticMessage*) g_object_new (object_type, NULL);
	_tmp0_ = diagnostics;
	_tmp0__length1 = diagnostics_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup6 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_);
	_tmp1__length1 = _tmp0__length1;
	self->priv->d_diagnostics = (_vala_array_free (self->priv->d_diagnostics, self->priv->d_diagnostics_length1, (GDestroyNotify) g_object_unref), NULL);
	self->priv->d_diagnostics = _tmp1_;
	self->priv->d_diagnostics_length1 = _tmp1__length1;
	self->priv->_d_diagnostics_size_ = self->priv->d_diagnostics_length1;
	_tmp2_ = view;
	self->priv->d_view = _tmp2_;
	gtk_event_box_set_visible_window ((GtkEventBox*) self, FALSE);
	gtk_widget_set_app_paintable ((GtkWidget*) self, TRUE);
	_tmp3_ = gtk_widget_get_style_context ((GtkWidget*) self);
	_tmp4_ = gca_diagnostic_colors_new (_tmp3_);
	_gca_diagnostic_colors_unref0 (self->priv->d_colors);
	self->priv->d_colors = _tmp4_;
	_tmp5_ = self->priv->d_view;
	g_signal_connect_object ((GtkWidget*) _tmp5_, "style-updated", (GCallback) _gca_diagnostic_message_on_view_style_updated_gtk_widget_style_updated, self, 0);
	_tmp6_ = self->priv->d_view;
	_tmp7_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp6_);
	_tmp8_ = _tmp7_;
	g_signal_connect_object ((GObject*) _tmp8_, "notify::style-scheme", (GCallback) _gca_diagnostic_message_on_style_scheme_changed_g_object_notify, self, 0);
	_tmp9_ = self->priv->d_view;
	g_signal_connect_object ((GtkWidget*) _tmp9_, "key-press-event", (GCallback) _gca_diagnostic_message_on_view_key_press_gtk_widget_key_press_event, self, 0);
	self->priv->d_inserted = FALSE;
	gca_diagnostic_message_update (self);
	return self;
}


GcaDiagnosticMessage* gca_diagnostic_message_new (GtkSourceView* view, GcaDiagnostic** diagnostics, int diagnostics_length1) {
	return gca_diagnostic_message_construct (GCA_TYPE_DIAGNOSTIC_MESSAGE, view, diagnostics, diagnostics_length1);
}


static gboolean gca_diagnostic_message_on_view_key_press (GcaDiagnosticMessage* self, GdkEventKey* event) {
	gboolean result = FALSE;
	GdkEventKey* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	guint _tmp2_ = 0U;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = event;
	_tmp1_ = _tmp0_->keyval;
	_tmp2_ = gdk_keyval_from_name ("Escape");
	if (_tmp1_ == _tmp2_) {
		gtk_widget_destroy ((GtkWidget*) self);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}


static void gca_diagnostic_message_on_style_scheme_changed (GcaDiagnosticMessage* self) {
	g_return_if_fail (self != NULL);
	gca_diagnostic_message_style_changed (self);
}


static void gca_diagnostic_message_style_changed (GcaDiagnosticMessage* self) {
	GtkStyleContext* _tmp0_ = NULL;
	GcaDiagnosticColors* _tmp1_ = NULL;
	GtkSourceView* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_widget_get_style_context ((GtkWidget*) self);
	_tmp1_ = gca_diagnostic_colors_new (_tmp0_);
	_gca_diagnostic_colors_unref0 (self->priv->d_colors);
	self->priv->d_colors = _tmp1_;
	_tmp2_ = self->priv->d_view;
	if (_tmp2_ != NULL) {
		GcaDiagnosticColors* _tmp3_ = NULL;
		GtkSourceView* _tmp4_ = NULL;
		_tmp3_ = self->priv->d_colors;
		_tmp4_ = self->priv->d_view;
		gca_diagnostic_colors_mix_in_widget (_tmp3_, (GtkWidget*) _tmp4_);
	}
	gca_diagnostic_message_update (self);
}


static void gca_diagnostic_message_on_view_style_updated (GcaDiagnosticMessage* self) {
	g_return_if_fail (self != NULL);
	gca_diagnostic_message_style_changed (self);
}


static void gca_diagnostic_message_real_destroy (GtkWidget* base) {
	GcaDiagnosticMessage * self;
	GtkSourceView* _tmp0_ = NULL;
	self = (GcaDiagnosticMessage*) base;
	_tmp0_ = self->priv->d_view;
	if (_tmp0_ != NULL) {
		GtkSourceView* _tmp1_ = NULL;
		guint _tmp2_ = 0U;
		GtkSourceView* _tmp3_ = NULL;
		GtkTextBuffer* _tmp4_ = NULL;
		GtkTextBuffer* _tmp5_ = NULL;
		guint _tmp6_ = 0U;
		GQuark _tmp7_ = 0U;
		GtkSourceView* _tmp8_ = NULL;
		guint _tmp9_ = 0U;
		_tmp1_ = self->priv->d_view;
		g_signal_parse_name ("style-updated", gtk_widget_get_type (), &_tmp2_, NULL, FALSE);
		g_signal_handlers_disconnect_matched ((GtkWidget*) _tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _gca_diagnostic_message_on_view_style_updated_gtk_widget_style_updated, self);
		_tmp3_ = self->priv->d_view;
		_tmp4_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp3_);
		_tmp5_ = _tmp4_;
		g_signal_parse_name ("notify::style-scheme", G_TYPE_OBJECT, &_tmp6_, &_tmp7_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp5_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp6_, _tmp7_, NULL, (GCallback) _gca_diagnostic_message_on_style_scheme_changed_g_object_notify, self);
		_tmp8_ = self->priv->d_view;
		g_signal_parse_name ("key-press-event", gtk_widget_get_type (), &_tmp9_, NULL, FALSE);
		g_signal_handlers_disconnect_matched ((GtkWidget*) _tmp8_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp9_, 0, NULL, (GCallback) _gca_diagnostic_message_on_view_key_press_gtk_widget_key_press_event, self);
	}
	GTK_WIDGET_CLASS (gca_diagnostic_message_parent_class)->destroy ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_event_box_get_type (), GtkEventBox));
}


static void gca_diagnostic_message_real_style_updated (GtkWidget* base) {
	GcaDiagnosticMessage * self;
	self = (GcaDiagnosticMessage*) base;
	GTK_WIDGET_CLASS (gca_diagnostic_message_parent_class)->style_updated ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_event_box_get_type (), GtkEventBox));
	gca_diagnostic_message_style_changed (self);
}


static void gca_diagnostic_message_update (GcaDiagnosticMessage* self) {
	gboolean _tmp0_ = FALSE;
	GtkBox* _tmp1_ = NULL;
	GtkSourceView* _tmp3_ = NULL;
	GtkBox* _tmp4_ = NULL;
	GtkBox* _tmp5_ = NULL;
	gboolean ismixed = FALSE;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	GcaDiagnostic** _tmp8_ = NULL;
	gint _tmp8__length1 = 0;
	GtkBox* _tmp37_ = NULL;
	GcaDiagnosticSeverity _tmp38_ = 0;
	GcaDiagnosticSeverity _tmp39_ = 0;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->d_updating;
	if (_tmp0_) {
		return;
	}
	_tmp1_ = self->priv->d_vbox;
	if (_tmp1_ != NULL) {
		GtkBox* _tmp2_ = NULL;
		_tmp2_ = self->priv->d_vbox;
		gtk_widget_destroy ((GtkWidget*) _tmp2_);
		_g_object_unref0 (self->priv->d_vbox);
		self->priv->d_vbox = NULL;
	}
	_tmp3_ = self->priv->d_view;
	if (_tmp3_ == NULL) {
		return;
	}
	self->priv->d_updating = TRUE;
	_tmp4_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->d_vbox);
	self->priv->d_vbox = _tmp4_;
	_tmp5_ = self->priv->d_vbox;
	gtk_widget_show ((GtkWidget*) _tmp5_);
	_tmp6_ = gca_diagnostic_message_get_mixed_severity (self);
	_tmp7_ = _tmp6_;
	ismixed = _tmp7_;
	_tmp8_ = self->priv->d_diagnostics;
	_tmp8__length1 = self->priv->d_diagnostics_length1;
	{
		GcaDiagnostic** d_collection = NULL;
		gint d_collection_length1 = 0;
		gint _d_collection_size_ = 0;
		gint d_it = 0;
		d_collection = _tmp8_;
		d_collection_length1 = _tmp8__length1;
		for (d_it = 0; d_it < _tmp8__length1; d_it = d_it + 1) {
			GcaDiagnostic* _tmp9_ = NULL;
			GcaDiagnostic* d = NULL;
			_tmp9_ = _g_object_ref0 (d_collection[d_it]);
			d = _tmp9_;
			{
				GtkLabel* label = NULL;
				GtkLabel* _tmp10_ = NULL;
				gboolean _tmp11_ = FALSE;
				GtkLabel* _tmp29_ = NULL;
				GtkLabel* _tmp30_ = NULL;
				GtkLabel* _tmp31_ = NULL;
				GtkLabel* _tmp32_ = NULL;
				GtkLabel* _tmp33_ = NULL;
				GtkLabel* _tmp34_ = NULL;
				GtkBox* _tmp35_ = NULL;
				GtkLabel* _tmp36_ = NULL;
				_tmp10_ = (GtkLabel*) gtk_label_new (NULL);
				g_object_ref_sink (_tmp10_);
				label = _tmp10_;
				_tmp11_ = ismixed;
				if (_tmp11_) {
					GtkLabel* _tmp12_ = NULL;
					GcaDiagnostic* _tmp13_ = NULL;
					GcaDiagnosticSeverity _tmp14_ = 0;
					GcaDiagnosticSeverity _tmp15_ = 0;
					gchar* _tmp16_ = NULL;
					gchar* _tmp17_ = NULL;
					GcaDiagnostic* _tmp18_ = NULL;
					const gchar* _tmp19_ = NULL;
					const gchar* _tmp20_ = NULL;
					gchar* _tmp21_ = NULL;
					gchar* _tmp22_ = NULL;
					gchar* _tmp23_ = NULL;
					gchar* _tmp24_ = NULL;
					_tmp12_ = label;
					_tmp13_ = d;
					_tmp14_ = gca_diagnostic_get_severity (_tmp13_);
					_tmp15_ = _tmp14_;
					_tmp16_ = gca_diagnostic_severity_to_string (_tmp15_);
					_tmp17_ = _tmp16_;
					_tmp18_ = d;
					_tmp19_ = gca_diagnostic_get_message (_tmp18_);
					_tmp20_ = _tmp19_;
					_tmp21_ = g_markup_escape_text (_tmp20_, (gssize) (-1));
					_tmp22_ = _tmp21_;
					_tmp23_ = g_strdup_printf ("<b>%s</b>: %s", _tmp17_, _tmp22_);
					_tmp24_ = _tmp23_;
					gtk_label_set_markup (_tmp12_, _tmp24_);
					_g_free0 (_tmp24_);
					_g_free0 (_tmp22_);
					_g_free0 (_tmp17_);
				} else {
					GtkLabel* _tmp25_ = NULL;
					GcaDiagnostic* _tmp26_ = NULL;
					const gchar* _tmp27_ = NULL;
					const gchar* _tmp28_ = NULL;
					_tmp25_ = label;
					_tmp26_ = d;
					_tmp27_ = gca_diagnostic_get_message (_tmp26_);
					_tmp28_ = _tmp27_;
					gtk_label_set_text (_tmp25_, _tmp28_);
				}
				_tmp29_ = label;
				gtk_widget_set_margin_left ((GtkWidget*) _tmp29_, 6);
				_tmp30_ = label;
				gtk_widget_set_margin_right ((GtkWidget*) _tmp30_, 6);
				_tmp31_ = label;
				gtk_widget_show ((GtkWidget*) _tmp31_);
				_tmp32_ = label;
				gtk_widget_set_halign ((GtkWidget*) _tmp32_, GTK_ALIGN_START);
				_tmp33_ = label;
				gtk_widget_set_valign ((GtkWidget*) _tmp33_, GTK_ALIGN_CENTER);
				_tmp34_ = label;
				g_object_set (_tmp34_, "wrap", TRUE, NULL);
				_tmp35_ = self->priv->d_vbox;
				_tmp36_ = label;
				gtk_box_pack_start (_tmp35_, (GtkWidget*) _tmp36_, FALSE, TRUE, (guint) 0);
				_g_object_unref0 (label);
				_g_object_unref0 (d);
			}
		}
	}
	_tmp37_ = self->priv->d_vbox;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp37_);
	gtk_widget_show ((GtkWidget*) self);
	_tmp38_ = gca_diagnostic_message_get_diagnostics_ruling_severity (self);
	_tmp39_ = _tmp38_;
	self->priv->d_rulingSeverity = _tmp39_;
	gca_diagnostic_message_reposition (self);
	self->priv->d_updating = FALSE;
}


static void gca_diagnostic_message_expand_range (GcaDiagnosticMessage* self, GcaExpandRange* topx, GcaExpandRange* bottomx, GcaExpandRange* y, GcaSourceLocation* location) {
	GdkRectangle rect = {0};
	GtkSourceView* _tmp0_ = NULL;
	GdkRectangle _tmp1_ = {0};
	GdkRectangle _tmp2_ = {0};
	gint _tmp3_ = 0;
	GcaExpandRange* _tmp4_ = NULL;
	gint _tmp5_ = 0;
	gint _tmp6_ = 0;
	GdkRectangle _tmp8_ = {0};
	gint _tmp9_ = 0;
	GdkRectangle _tmp10_ = {0};
	gint _tmp11_ = 0;
	GcaExpandRange* _tmp12_ = NULL;
	gint _tmp13_ = 0;
	gint _tmp14_ = 0;
	GcaExpandRange* _tmp16_ = NULL;
	GdkRectangle _tmp17_ = {0};
	gint _tmp18_ = 0;
	GcaExpandRange* _tmp19_ = NULL;
	GdkRectangle _tmp20_ = {0};
	gint _tmp21_ = 0;
	GdkRectangle _tmp22_ = {0};
	gint _tmp23_ = 0;
	GdkRectangle _tmp24_ = {0};
	gint _tmp25_ = 0;
	GcaExpandRange* _tmp26_ = NULL;
	gint _tmp27_ = 0;
	gint _tmp28_ = 0;
	GdkRectangle _tmp37_ = {0};
	gint _tmp38_ = 0;
	GdkRectangle _tmp39_ = {0};
	gint _tmp40_ = 0;
	GcaExpandRange* _tmp41_ = NULL;
	gint _tmp42_ = 0;
	gint _tmp43_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (topx != NULL);
	g_return_if_fail (bottomx != NULL);
	g_return_if_fail (y != NULL);
	g_return_if_fail (location != NULL);
	_tmp0_ = self->priv->d_view;
	gca_source_location_buffer_coordinates (location, (GtkTextView*) _tmp0_, &_tmp1_);
	rect = _tmp1_;
	_tmp2_ = rect;
	_tmp3_ = _tmp2_.y;
	_tmp4_ = y;
	_tmp5_ = gca_expand_range_get_min (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp3_ < _tmp6_) {
		GcaExpandRange* _tmp7_ = NULL;
		_tmp7_ = bottomx;
		gca_expand_range_reset (_tmp7_);
	}
	_tmp8_ = rect;
	_tmp9_ = _tmp8_.y;
	_tmp10_ = rect;
	_tmp11_ = _tmp10_.height;
	_tmp12_ = y;
	_tmp13_ = gca_expand_range_get_max (_tmp12_);
	_tmp14_ = _tmp13_;
	if ((_tmp9_ + _tmp11_) > _tmp14_) {
		GcaExpandRange* _tmp15_ = NULL;
		_tmp15_ = topx;
		gca_expand_range_reset (_tmp15_);
	}
	_tmp16_ = y;
	_tmp17_ = rect;
	_tmp18_ = _tmp17_.y;
	gca_expand_range_add (_tmp16_, _tmp18_);
	_tmp19_ = y;
	_tmp20_ = rect;
	_tmp21_ = _tmp20_.y;
	_tmp22_ = rect;
	_tmp23_ = _tmp22_.height;
	gca_expand_range_add (_tmp19_, _tmp21_ + _tmp23_);
	_tmp24_ = rect;
	_tmp25_ = _tmp24_.y;
	_tmp26_ = y;
	_tmp27_ = gca_expand_range_get_min (_tmp26_);
	_tmp28_ = _tmp27_;
	if (_tmp25_ == _tmp28_) {
		GcaExpandRange* _tmp29_ = NULL;
		GdkRectangle _tmp30_ = {0};
		gint _tmp31_ = 0;
		GcaExpandRange* _tmp32_ = NULL;
		GdkRectangle _tmp33_ = {0};
		gint _tmp34_ = 0;
		GdkRectangle _tmp35_ = {0};
		gint _tmp36_ = 0;
		_tmp29_ = topx;
		_tmp30_ = rect;
		_tmp31_ = _tmp30_.x;
		gca_expand_range_add (_tmp29_, _tmp31_);
		_tmp32_ = topx;
		_tmp33_ = rect;
		_tmp34_ = _tmp33_.x;
		_tmp35_ = rect;
		_tmp36_ = _tmp35_.width;
		gca_expand_range_add (_tmp32_, _tmp34_ + _tmp36_);
	}
	_tmp37_ = rect;
	_tmp38_ = _tmp37_.y;
	_tmp39_ = rect;
	_tmp40_ = _tmp39_.height;
	_tmp41_ = y;
	_tmp42_ = gca_expand_range_get_max (_tmp41_);
	_tmp43_ = _tmp42_;
	if ((_tmp38_ + _tmp40_) == _tmp43_) {
		GcaExpandRange* _tmp44_ = NULL;
		GdkRectangle _tmp45_ = {0};
		gint _tmp46_ = 0;
		GcaExpandRange* _tmp47_ = NULL;
		GdkRectangle _tmp48_ = {0};
		gint _tmp49_ = 0;
		GdkRectangle _tmp50_ = {0};
		gint _tmp51_ = 0;
		_tmp44_ = bottomx;
		_tmp45_ = rect;
		_tmp46_ = _tmp45_.x;
		gca_expand_range_add (_tmp44_, _tmp46_);
		_tmp47_ = bottomx;
		_tmp48_ = rect;
		_tmp49_ = _tmp48_.x;
		_tmp50_ = rect;
		_tmp51_ = _tmp50_.width;
		gca_expand_range_add (_tmp47_, _tmp49_ + _tmp51_);
	}
}


static gpointer _gca_expand_range_ref0 (gpointer self) {
	return self ? gca_expand_range_ref (self) : NULL;
}


void gca_diagnostic_message_reposition (GcaDiagnosticMessage* self) {
	GcaExpandRange* topx = NULL;
	GcaExpandRange* _tmp0_ = NULL;
	GcaExpandRange* bottomx = NULL;
	GcaExpandRange* _tmp1_ = NULL;
	GcaExpandRange* y = NULL;
	GcaExpandRange* _tmp2_ = NULL;
	GcaDiagnostic** _tmp3_ = NULL;
	gint _tmp3__length1 = 0;
	gint ymin = 0;
	gint ymax = 0;
	const gchar* _tmp18_ = NULL;
	GdkWindow* window = NULL;
	GtkSourceView* _tmp35_ = NULL;
	GdkWindow* _tmp36_ = NULL;
	GdkWindow* _tmp37_ = NULL;
	gint aligny = 0;
	gint alignyat = 0;
	GcaExpandRange* xrange = NULL;
	gint _tmp38_ = 0;
	GdkWindow* _tmp39_ = NULL;
	gint _tmp40_ = 0;
	gint _tmp41_ = 0;
	gint xmin = 0;
	gint xmax = 0;
	const gchar* _tmp48_ = NULL;
	gint xc = 0;
	gint width = 0;
	GdkWindow* _tmp65_ = NULL;
	gint _tmp66_ = 0;
	gint _tmp67_ = 0;
	gint _tmp68_ = 0;
	gboolean _tmp74_ = FALSE;
	gint natwidth = 0;
	gint minwidth = 0;
	gint _tmp76_ = 0;
	gint _tmp77_ = 0;
	gint _tmp78_ = 0;
	gint _tmp79_ = 0;
	gint natural_height = 0;
	gint _tmp81_ = 0;
	gint _tmp82_ = 0;
	gint _tmp83_ = 0;
	gint _tmp84_ = 0;
	gint yc = 0;
	gint _tmp85_ = 0;
	gint _tmp86_ = 0;
	gint _tmp87_ = 0;
	GtkSourceView* _tmp88_ = NULL;
	gint _tmp89_ = 0;
	g_return_if_fail (self != NULL);
	_tmp0_ = gca_expand_range_new ();
	topx = _tmp0_;
	_tmp1_ = gca_expand_range_new ();
	bottomx = _tmp1_;
	_tmp2_ = gca_expand_range_new ();
	y = _tmp2_;
	_tmp3_ = self->priv->d_diagnostics;
	_tmp3__length1 = self->priv->d_diagnostics_length1;
	{
		GcaDiagnostic** d_collection = NULL;
		gint d_collection_length1 = 0;
		gint _d_collection_size_ = 0;
		gint d_it = 0;
		d_collection = _tmp3_;
		d_collection_length1 = _tmp3__length1;
		for (d_it = 0; d_it < _tmp3__length1; d_it = d_it + 1) {
			GcaDiagnostic* _tmp4_ = NULL;
			GcaDiagnostic* d = NULL;
			_tmp4_ = _g_object_ref0 (d_collection[d_it]);
			d = _tmp4_;
			{
				GcaDiagnostic* _tmp5_ = NULL;
				GcaSourceRange* _tmp6_ = NULL;
				gint _tmp6__length1 = 0;
				GcaSourceRange* _tmp7_ = NULL;
				gint _tmp7__length1 = 0;
				_tmp5_ = d;
				_tmp6_ = gca_source_range_support_get_ranges ((GcaSourceRangeSupport*) _tmp5_, &_tmp6__length1);
				_tmp7_ = _tmp6_;
				_tmp7__length1 = _tmp6__length1;
				{
					GcaSourceRange* r_collection = NULL;
					gint r_collection_length1 = 0;
					gint _r_collection_size_ = 0;
					gint r_it = 0;
					r_collection = _tmp7_;
					r_collection_length1 = _tmp7__length1;
					for (r_it = 0; r_it < _tmp7__length1; r_it = r_it + 1) {
						GcaSourceRange r = {0};
						r = r_collection[r_it];
						{
							GcaExpandRange* _tmp8_ = NULL;
							GcaExpandRange* _tmp9_ = NULL;
							GcaExpandRange* _tmp10_ = NULL;
							GcaSourceRange _tmp11_ = {0};
							GcaSourceLocation _tmp12_ = {0};
							GcaExpandRange* _tmp13_ = NULL;
							GcaExpandRange* _tmp14_ = NULL;
							GcaExpandRange* _tmp15_ = NULL;
							GcaSourceRange _tmp16_ = {0};
							GcaSourceLocation _tmp17_ = {0};
							_tmp8_ = topx;
							_tmp9_ = bottomx;
							_tmp10_ = y;
							_tmp11_ = r;
							_tmp12_ = _tmp11_.start;
							gca_diagnostic_message_expand_range (self, _tmp8_, _tmp9_, _tmp10_, &_tmp12_);
							_tmp13_ = topx;
							_tmp14_ = bottomx;
							_tmp15_ = y;
							_tmp16_ = r;
							_tmp17_ = _tmp16_.end;
							gca_diagnostic_message_expand_range (self, _tmp13_, _tmp14_, _tmp15_, &_tmp17_);
						}
					}
					r_collection = (g_free (r_collection), NULL);
				}
				_g_object_unref0 (d);
			}
		}
	}
	_tmp18_ = gtk_check_version ((guint) 3, (guint) 11, (guint) 0);
	if (_tmp18_ == NULL) {
		GcaExpandRange* _tmp19_ = NULL;
		gint _tmp20_ = 0;
		gint _tmp21_ = 0;
		GcaExpandRange* _tmp22_ = NULL;
		gint _tmp23_ = 0;
		gint _tmp24_ = 0;
		_tmp19_ = y;
		_tmp20_ = gca_expand_range_get_min (_tmp19_);
		_tmp21_ = _tmp20_;
		ymin = _tmp21_;
		_tmp22_ = y;
		_tmp23_ = gca_expand_range_get_max (_tmp22_);
		_tmp24_ = _tmp23_;
		ymax = _tmp24_;
	} else {
		GtkSourceView* _tmp25_ = NULL;
		GcaExpandRange* _tmp26_ = NULL;
		gint _tmp27_ = 0;
		gint _tmp28_ = 0;
		gint _tmp29_ = 0;
		GtkSourceView* _tmp30_ = NULL;
		GcaExpandRange* _tmp31_ = NULL;
		gint _tmp32_ = 0;
		gint _tmp33_ = 0;
		gint _tmp34_ = 0;
		_tmp25_ = self->priv->d_view;
		_tmp26_ = y;
		_tmp27_ = gca_expand_range_get_min (_tmp26_);
		_tmp28_ = _tmp27_;
		gtk_text_view_buffer_to_window_coords ((GtkTextView*) _tmp25_, GTK_TEXT_WINDOW_TEXT, 0, _tmp28_, NULL, &_tmp29_);
		ymin = _tmp29_;
		_tmp30_ = self->priv->d_view;
		_tmp31_ = y;
		_tmp32_ = gca_expand_range_get_max (_tmp31_);
		_tmp33_ = _tmp32_;
		gtk_text_view_buffer_to_window_coords ((GtkTextView*) _tmp30_, GTK_TEXT_WINDOW_TEXT, 0, _tmp33_, NULL, &_tmp34_);
		ymax = _tmp34_;
	}
	_tmp35_ = self->priv->d_view;
	_tmp36_ = gtk_text_view_get_window ((GtkTextView*) _tmp35_, GTK_TEXT_WINDOW_TEXT);
	_tmp37_ = _g_object_ref0 (_tmp36_);
	window = _tmp37_;
	_tmp38_ = ymin;
	_tmp39_ = window;
	_tmp40_ = gdk_window_get_height (_tmp39_);
	_tmp41_ = ymax;
	if (_tmp38_ > (_tmp40_ - _tmp41_)) {
		gint _tmp42_ = 0;
		GcaExpandRange* _tmp43_ = NULL;
		GcaExpandRange* _tmp44_ = NULL;
		aligny = 1;
		_tmp42_ = ymin;
		alignyat = _tmp42_ - 3;
		_tmp43_ = topx;
		_tmp44_ = _gca_expand_range_ref0 (_tmp43_);
		_gca_expand_range_unref0 (xrange);
		xrange = _tmp44_;
	} else {
		gint _tmp45_ = 0;
		GcaExpandRange* _tmp46_ = NULL;
		GcaExpandRange* _tmp47_ = NULL;
		aligny = 0;
		_tmp45_ = ymax;
		alignyat = _tmp45_ + 3;
		_tmp46_ = bottomx;
		_tmp47_ = _gca_expand_range_ref0 (_tmp46_);
		_gca_expand_range_unref0 (xrange);
		xrange = _tmp47_;
	}
	_tmp48_ = gtk_check_version ((guint) 3, (guint) 11, (guint) 0);
	if (_tmp48_ == NULL) {
		GcaExpandRange* _tmp49_ = NULL;
		gint _tmp50_ = 0;
		gint _tmp51_ = 0;
		GcaExpandRange* _tmp52_ = NULL;
		gint _tmp53_ = 0;
		gint _tmp54_ = 0;
		_tmp49_ = xrange;
		_tmp50_ = gca_expand_range_get_min (_tmp49_);
		_tmp51_ = _tmp50_;
		xmin = _tmp51_;
		_tmp52_ = xrange;
		_tmp53_ = gca_expand_range_get_max (_tmp52_);
		_tmp54_ = _tmp53_;
		xmax = _tmp54_;
	} else {
		GtkSourceView* _tmp55_ = NULL;
		GcaExpandRange* _tmp56_ = NULL;
		gint _tmp57_ = 0;
		gint _tmp58_ = 0;
		gint _tmp59_ = 0;
		GtkSourceView* _tmp60_ = NULL;
		GcaExpandRange* _tmp61_ = NULL;
		gint _tmp62_ = 0;
		gint _tmp63_ = 0;
		gint _tmp64_ = 0;
		_tmp55_ = self->priv->d_view;
		_tmp56_ = xrange;
		_tmp57_ = gca_expand_range_get_min (_tmp56_);
		_tmp58_ = _tmp57_;
		gtk_text_view_buffer_to_window_coords ((GtkTextView*) _tmp55_, GTK_TEXT_WINDOW_TEXT, _tmp58_, 0, &_tmp59_, NULL);
		xmin = _tmp59_;
		_tmp60_ = self->priv->d_view;
		_tmp61_ = xrange;
		_tmp62_ = gca_expand_range_get_max (_tmp61_);
		_tmp63_ = _tmp62_;
		gtk_text_view_buffer_to_window_coords ((GtkTextView*) _tmp60_, GTK_TEXT_WINDOW_TEXT, _tmp63_, 0, &_tmp64_, NULL);
		xmax = _tmp64_;
	}
	_tmp65_ = window;
	_tmp66_ = gdk_window_get_width (_tmp65_);
	_tmp67_ = xmin;
	_tmp68_ = xmax;
	if ((_tmp66_ - _tmp67_) > _tmp68_) {
		gint _tmp69_ = 0;
		GdkWindow* _tmp70_ = NULL;
		gint _tmp71_ = 0;
		gint _tmp72_ = 0;
		_tmp69_ = xmin;
		xc = _tmp69_;
		_tmp70_ = window;
		_tmp71_ = gdk_window_get_width (_tmp70_);
		_tmp72_ = xmin;
		width = _tmp71_ - _tmp72_;
	} else {
		gint _tmp73_ = 0;
		xc = 0;
		_tmp73_ = xmax;
		width = _tmp73_;
	}
	_tmp74_ = self->priv->d_inserted;
	if (!_tmp74_) {
		GtkSourceView* _tmp75_ = NULL;
		_tmp75_ = self->priv->d_view;
		gtk_text_view_add_child_in_window ((GtkTextView*) _tmp75_, (GtkWidget*) self, GTK_TEXT_WINDOW_TEXT, 0, 0);
	}
	GTK_WIDGET_CLASS (gca_diagnostic_message_parent_class)->get_preferred_width ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_event_box_get_type (), GtkEventBox), &_tmp76_, &_tmp77_);
	minwidth = _tmp76_;
	natwidth = _tmp77_;
	_tmp78_ = natwidth;
	_tmp79_ = width;
	if (_tmp78_ < _tmp79_) {
		gint _tmp80_ = 0;
		_tmp80_ = natwidth;
		width = _tmp80_;
	}
	_tmp81_ = width;
	GTK_WIDGET_CLASS (gca_diagnostic_message_parent_class)->get_preferred_height_for_width ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_event_box_get_type (), GtkEventBox), _tmp81_, &_tmp82_, &_tmp83_);
	self->priv->d_height = _tmp82_;
	natural_height = _tmp83_;
	_tmp84_ = width;
	self->priv->d_width = _tmp84_;
	_tmp85_ = alignyat;
	_tmp86_ = self->priv->d_height;
	_tmp87_ = aligny;
	yc = _tmp85_ - (_tmp86_ * _tmp87_);
	_tmp88_ = self->priv->d_view;
	_tmp89_ = xc;
	gtk_text_view_move_child ((GtkTextView*) _tmp88_, (GtkWidget*) self, _tmp89_, yc);
	self->priv->d_inserted = TRUE;
	gtk_widget_queue_resize ((GtkWidget*) self);
	_gca_expand_range_unref0 (xrange);
	_g_object_unref0 (window);
	_gca_expand_range_unref0 (y);
	_gca_expand_range_unref0 (bottomx);
	_gca_expand_range_unref0 (topx);
}


static GtkSizeRequestMode gca_diagnostic_message_real_get_request_mode (GtkWidget* base) {
	GcaDiagnosticMessage * self;
	GtkSizeRequestMode result = 0;
	self = (GcaDiagnosticMessage*) base;
	result = GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
	return result;
}


static void gca_diagnostic_message_real_get_preferred_height (GtkWidget* base, gint* minimum_height, gint* natural_height) {
	GcaDiagnosticMessage * self;
	gint _vala_minimum_height = 0;
	gint _vala_natural_height = 0;
	gint minwidth = 0;
	gint natwidth = 0;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	self = (GcaDiagnosticMessage*) base;
	gtk_widget_get_preferred_width ((GtkWidget*) self, &_tmp0_, &_tmp1_);
	minwidth = _tmp0_;
	natwidth = _tmp1_;
	gtk_widget_get_preferred_height_for_width ((GtkWidget*) self, minwidth, &_tmp2_, &_tmp3_);
	_vala_minimum_height = _tmp2_;
	_vala_natural_height = _tmp3_;
	if (minimum_height) {
		*minimum_height = _vala_minimum_height;
	}
	if (natural_height) {
		*natural_height = _vala_natural_height;
	}
}


static void gca_diagnostic_message_real_get_preferred_width (GtkWidget* base, gint* minimum_width, gint* natural_width) {
	GcaDiagnosticMessage * self;
	gint _vala_minimum_width = 0;
	gint _vala_natural_width = 0;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	self = (GcaDiagnosticMessage*) base;
	_tmp0_ = self->priv->d_width;
	_vala_minimum_width = _tmp0_;
	_tmp1_ = self->priv->d_width;
	_vala_natural_width = _tmp1_;
	if (minimum_width) {
		*minimum_width = _vala_minimum_width;
	}
	if (natural_width) {
		*natural_width = _vala_natural_width;
	}
}


static void gca_diagnostic_message_real_get_preferred_height_for_width (GtkWidget* base, gint width, gint* minimum_height, gint* natural_height) {
	GcaDiagnosticMessage * self;
	gint _vala_minimum_height = 0;
	gint _vala_natural_height = 0;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	self = (GcaDiagnosticMessage*) base;
	_tmp0_ = width;
	_tmp1_ = self->priv->d_width;
	if (_tmp0_ == _tmp1_) {
		gint _tmp2_ = 0;
		gint _tmp3_ = 0;
		_tmp2_ = self->priv->d_height;
		_vala_minimum_height = _tmp2_;
		_tmp3_ = self->priv->d_height;
		_vala_natural_height = _tmp3_;
	} else {
		gint _tmp4_ = 0;
		gint _tmp5_ = 0;
		gint _tmp6_ = 0;
		_tmp4_ = width;
		GTK_WIDGET_CLASS (gca_diagnostic_message_parent_class)->get_preferred_height_for_width ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_event_box_get_type (), GtkEventBox), _tmp4_, &_tmp5_, &_tmp6_);
		_vala_minimum_height = _tmp5_;
		_vala_natural_height = _tmp6_;
	}
	if (minimum_height) {
		*minimum_height = _vala_minimum_height;
	}
	if (natural_height) {
		*natural_height = _vala_natural_height;
	}
}


static void gca_diagnostic_message_add_class_for_severity (GcaDiagnosticMessage* self, GtkStyleContext* ctx) {
	GcaDiagnosticSeverity _tmp0_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (ctx != NULL);
	_tmp0_ = self->priv->d_rulingSeverity;
	switch (_tmp0_) {
		case GCA_DIAGNOSTIC_SEVERITY_ERROR:
		case GCA_DIAGNOSTIC_SEVERITY_FATAL:
		{
			GtkStyleContext* _tmp1_ = NULL;
			_tmp1_ = ctx;
			gtk_style_context_add_class (_tmp1_, GTK_STYLE_CLASS_ERROR);
			break;
		}
		case GCA_DIAGNOSTIC_SEVERITY_WARNING:
		{
			GtkStyleContext* _tmp2_ = NULL;
			_tmp2_ = ctx;
			gtk_style_context_add_class (_tmp2_, GTK_STYLE_CLASS_WARNING);
			break;
		}
		case GCA_DIAGNOSTIC_SEVERITY_INFO:
		{
			GtkStyleContext* _tmp3_ = NULL;
			_tmp3_ = ctx;
			gtk_style_context_add_class (_tmp3_, GTK_STYLE_CLASS_INFO);
			break;
		}
		default:
		{
			break;
		}
	}
}


static gboolean gca_diagnostic_message_real_draw (GtkWidget* base, cairo_t* context) {
	GcaDiagnosticMessage * self;
	gboolean result = FALSE;
	GtkAllocation alloc = {0};
	GtkAllocation _tmp0_ = {0};
	GtkStyleContext* ctx = NULL;
	GtkStyleContext* _tmp1_ = NULL;
	GtkStyleContext* _tmp2_ = NULL;
	cairo_t* _tmp3_ = NULL;
	GtkAllocation _tmp4_ = {0};
	gint _tmp5_ = 0;
	GtkAllocation _tmp6_ = {0};
	gint _tmp7_ = 0;
	cairo_t* _tmp8_ = NULL;
	GtkAllocation _tmp9_ = {0};
	gint _tmp10_ = 0;
	GtkAllocation _tmp11_ = {0};
	gint _tmp12_ = 0;
	cairo_t* _tmp13_ = NULL;
	self = (GcaDiagnosticMessage*) base;
	g_return_val_if_fail (context != NULL, FALSE);
	gtk_widget_get_allocation ((GtkWidget*) self, &_tmp0_);
	alloc = _tmp0_;
	_tmp1_ = gtk_widget_get_style_context ((GtkWidget*) self);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	ctx = _tmp2_;
	gtk_style_context_save (ctx);
	gca_diagnostic_message_add_class_for_severity (self, ctx);
	_tmp3_ = context;
	_tmp4_ = alloc;
	_tmp5_ = _tmp4_.width;
	_tmp6_ = alloc;
	_tmp7_ = _tmp6_.height;
	gtk_render_background (ctx, _tmp3_, (gdouble) 0, (gdouble) 0, (gdouble) _tmp5_, (gdouble) _tmp7_);
	_tmp8_ = context;
	_tmp9_ = alloc;
	_tmp10_ = _tmp9_.width;
	_tmp11_ = alloc;
	_tmp12_ = _tmp11_.height;
	gtk_render_frame (ctx, _tmp8_, (gdouble) 0, (gdouble) 0, (gdouble) _tmp10_, (gdouble) _tmp12_);
	gtk_style_context_restore (ctx);
	_tmp13_ = context;
	GTK_WIDGET_CLASS (gca_diagnostic_message_parent_class)->draw ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_event_box_get_type (), GtkEventBox), _tmp13_);
	result = FALSE;
	_g_object_unref0 (ctx);
	return result;
}


static gboolean gca_diagnostic_message_get_mixed_severity (GcaDiagnosticMessage* self) {
	gboolean result;
	gboolean first = FALSE;
	GcaDiagnosticSeverity s = 0;
	GcaDiagnostic** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	g_return_val_if_fail (self != NULL, FALSE);
	first = TRUE;
	s = GCA_DIAGNOSTIC_SEVERITY_NONE;
	_tmp0_ = self->priv->d_diagnostics;
	_tmp0__length1 = self->priv->d_diagnostics_length1;
	{
		GcaDiagnostic** d_collection = NULL;
		gint d_collection_length1 = 0;
		gint _d_collection_size_ = 0;
		gint d_it = 0;
		d_collection = _tmp0_;
		d_collection_length1 = _tmp0__length1;
		for (d_it = 0; d_it < _tmp0__length1; d_it = d_it + 1) {
			GcaDiagnostic* _tmp1_ = NULL;
			GcaDiagnostic* d = NULL;
			_tmp1_ = _g_object_ref0 (d_collection[d_it]);
			d = _tmp1_;
			{
				gboolean _tmp2_ = FALSE;
				GcaDiagnosticSeverity _tmp6_ = 0;
				GcaDiagnostic* _tmp7_ = NULL;
				GcaDiagnosticSeverity _tmp8_ = 0;
				GcaDiagnosticSeverity _tmp9_ = 0;
				_tmp2_ = first;
				if (_tmp2_) {
					GcaDiagnostic* _tmp3_ = NULL;
					GcaDiagnosticSeverity _tmp4_ = 0;
					GcaDiagnosticSeverity _tmp5_ = 0;
					first = FALSE;
					_tmp3_ = d;
					_tmp4_ = gca_diagnostic_get_severity (_tmp3_);
					_tmp5_ = _tmp4_;
					s = _tmp5_;
				}
				_tmp6_ = s;
				_tmp7_ = d;
				_tmp8_ = gca_diagnostic_get_severity (_tmp7_);
				_tmp9_ = _tmp8_;
				if (_tmp6_ != _tmp9_) {
					result = TRUE;
					_g_object_unref0 (d);
					return result;
				}
				_g_object_unref0 (d);
			}
		}
	}
	result = FALSE;
	return result;
}


GcaDiagnostic** gca_diagnostic_message_get_diagnostics (GcaDiagnosticMessage* self, int* result_length1) {
	GcaDiagnostic** result;
	GcaDiagnostic** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	GcaDiagnostic** _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->d_diagnostics;
	_tmp0__length1 = self->priv->d_diagnostics_length1;
	_tmp1_ = _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}


static GcaDiagnostic** _vala_array_dup7 (GcaDiagnostic** self, int length) {
	GcaDiagnostic** result;
	int i;
	result = g_new0 (GcaDiagnostic*, length + 1);
	for (i = 0; i < length; i++) {
		GcaDiagnostic* _tmp0_ = NULL;
		_tmp0_ = _g_object_ref0 (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


void gca_diagnostic_message_set_diagnostics (GcaDiagnosticMessage* self, GcaDiagnostic** value, int value_length1) {
	GcaDiagnostic** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	GcaDiagnostic** _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	FILE* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp0__length1 = value_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup7 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_);
	_tmp1__length1 = _tmp0__length1;
	self->priv->d_diagnostics = (_vala_array_free (self->priv->d_diagnostics, self->priv->d_diagnostics_length1, (GDestroyNotify) g_object_unref), NULL);
	self->priv->d_diagnostics = _tmp1_;
	self->priv->d_diagnostics_length1 = _tmp1__length1;
	self->priv->_d_diagnostics_size_ = self->priv->d_diagnostics_length1;
	_tmp2_ = stderr;
	fprintf (_tmp2_, "set diagnostics\n");
	gca_diagnostic_message_update (self);
}


static GcaDiagnosticSeverity gca_diagnostic_message_get_diagnostics_ruling_severity (GcaDiagnosticMessage* self) {
	GcaDiagnosticSeverity result;
	GcaDiagnosticSeverity severity = 0;
	gboolean first = FALSE;
	GcaDiagnostic** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	GcaDiagnosticSeverity _tmp11_ = 0;
	g_return_val_if_fail (self != NULL, 0);
	severity = GCA_DIAGNOSTIC_SEVERITY_NONE;
	first = TRUE;
	_tmp0_ = self->priv->d_diagnostics;
	_tmp0__length1 = self->priv->d_diagnostics_length1;
	{
		GcaDiagnostic** d_collection = NULL;
		gint d_collection_length1 = 0;
		gint _d_collection_size_ = 0;
		gint d_it = 0;
		d_collection = _tmp0_;
		d_collection_length1 = _tmp0__length1;
		for (d_it = 0; d_it < _tmp0__length1; d_it = d_it + 1) {
			GcaDiagnostic* _tmp1_ = NULL;
			GcaDiagnostic* d = NULL;
			_tmp1_ = _g_object_ref0 (d_collection[d_it]);
			d = _tmp1_;
			{
				gboolean _tmp2_ = FALSE;
				gboolean _tmp3_ = FALSE;
				_tmp3_ = first;
				if (_tmp3_) {
					_tmp2_ = TRUE;
				} else {
					GcaDiagnostic* _tmp4_ = NULL;
					GcaDiagnosticSeverity _tmp5_ = 0;
					GcaDiagnosticSeverity _tmp6_ = 0;
					GcaDiagnosticSeverity _tmp7_ = 0;
					_tmp4_ = d;
					_tmp5_ = gca_diagnostic_get_severity (_tmp4_);
					_tmp6_ = _tmp5_;
					_tmp7_ = severity;
					_tmp2_ = _tmp6_ > _tmp7_;
				}
				if (_tmp2_) {
					GcaDiagnostic* _tmp8_ = NULL;
					GcaDiagnosticSeverity _tmp9_ = 0;
					GcaDiagnosticSeverity _tmp10_ = 0;
					_tmp8_ = d;
					_tmp9_ = gca_diagnostic_get_severity (_tmp8_);
					_tmp10_ = _tmp9_;
					severity = _tmp10_;
				}
				first = FALSE;
				_g_object_unref0 (d);
			}
		}
	}
	_tmp11_ = severity;
	result = _tmp11_;
	return result;
}


static void gca_diagnostic_message_class_init (GcaDiagnosticMessageClass * klass) {
	gca_diagnostic_message_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GcaDiagnosticMessagePrivate));
	((GtkWidgetClass *) klass)->destroy = gca_diagnostic_message_real_destroy;
	((GtkWidgetClass *) klass)->style_updated = gca_diagnostic_message_real_style_updated;
	((GtkWidgetClass *) klass)->get_request_mode = gca_diagnostic_message_real_get_request_mode;
	((GtkWidgetClass *) klass)->get_preferred_height = gca_diagnostic_message_real_get_preferred_height;
	((GtkWidgetClass *) klass)->get_preferred_width = gca_diagnostic_message_real_get_preferred_width;
	((GtkWidgetClass *) klass)->get_preferred_height_for_width = gca_diagnostic_message_real_get_preferred_height_for_width;
	((GtkWidgetClass *) klass)->draw = gca_diagnostic_message_real_draw;
	G_OBJECT_CLASS (klass)->get_property = _vala_gca_diagnostic_message_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gca_diagnostic_message_set_property;
	G_OBJECT_CLASS (klass)->finalize = gca_diagnostic_message_finalize;
}


static void gca_diagnostic_message_instance_init (GcaDiagnosticMessage * self) {
	self->priv = GCA_DIAGNOSTIC_MESSAGE_GET_PRIVATE (self);
}


static void gca_diagnostic_message_finalize (GObject* obj) {
	GcaDiagnosticMessage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCA_TYPE_DIAGNOSTIC_MESSAGE, GcaDiagnosticMessage);
	self->priv->d_diagnostics = (_vala_array_free (self->priv->d_diagnostics, self->priv->d_diagnostics_length1, (GDestroyNotify) g_object_unref), NULL);
	_g_object_unref0 (self->priv->d_vbox);
	_gca_diagnostic_colors_unref0 (self->priv->d_colors);
	G_OBJECT_CLASS (gca_diagnostic_message_parent_class)->finalize (obj);
}


GType gca_diagnostic_message_get_type (void) {
	static volatile gsize gca_diagnostic_message_type_id__volatile = 0;
	if (g_once_init_enter (&gca_diagnostic_message_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GcaDiagnosticMessageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gca_diagnostic_message_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GcaDiagnosticMessage), 0, (GInstanceInitFunc) gca_diagnostic_message_instance_init, NULL };
		GType gca_diagnostic_message_type_id;
		gca_diagnostic_message_type_id = g_type_register_static (gtk_event_box_get_type (), "GcaDiagnosticMessage", &g_define_type_info, 0);
		g_once_init_leave (&gca_diagnostic_message_type_id__volatile, gca_diagnostic_message_type_id);
	}
	return gca_diagnostic_message_type_id__volatile;
}


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


static void _vala_gca_diagnostic_message_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GcaDiagnosticMessage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCA_TYPE_DIAGNOSTIC_MESSAGE, GcaDiagnosticMessage);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



