/* gcp-diagnostic-message.c generated by valac 0.19.0, the Vala compiler
 * generated from gcp-diagnostic-message.vala, do not modify */


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


#define GCP_TYPE_DIAGNOSTIC_MESSAGE (gcp_diagnostic_message_get_type ())
#define GCP_DIAGNOSTIC_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_TYPE_DIAGNOSTIC_MESSAGE, GcpDiagnosticMessage))
#define GCP_DIAGNOSTIC_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_TYPE_DIAGNOSTIC_MESSAGE, GcpDiagnosticMessageClass))
#define GCP_IS_DIAGNOSTIC_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_TYPE_DIAGNOSTIC_MESSAGE))
#define GCP_IS_DIAGNOSTIC_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_TYPE_DIAGNOSTIC_MESSAGE))
#define GCP_DIAGNOSTIC_MESSAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_TYPE_DIAGNOSTIC_MESSAGE, GcpDiagnosticMessageClass))

typedef struct _GcpDiagnosticMessage GcpDiagnosticMessage;
typedef struct _GcpDiagnosticMessageClass GcpDiagnosticMessageClass;
typedef struct _GcpDiagnosticMessagePrivate GcpDiagnosticMessagePrivate;

#define GCP_TYPE_DIAGNOSTIC (gcp_diagnostic_get_type ())
#define GCP_DIAGNOSTIC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_TYPE_DIAGNOSTIC, GcpDiagnostic))
#define GCP_DIAGNOSTIC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_TYPE_DIAGNOSTIC, GcpDiagnosticClass))
#define GCP_IS_DIAGNOSTIC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_TYPE_DIAGNOSTIC))
#define GCP_IS_DIAGNOSTIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_TYPE_DIAGNOSTIC))
#define GCP_DIAGNOSTIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_TYPE_DIAGNOSTIC, GcpDiagnosticClass))

typedef struct _GcpDiagnostic GcpDiagnostic;
typedef struct _GcpDiagnosticClass GcpDiagnosticClass;

#define GCP_TYPE_DIAGNOSTIC_COLORS (gcp_diagnostic_colors_get_type ())
#define GCP_DIAGNOSTIC_COLORS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_TYPE_DIAGNOSTIC_COLORS, GcpDiagnosticColors))
#define GCP_DIAGNOSTIC_COLORS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_TYPE_DIAGNOSTIC_COLORS, GcpDiagnosticColorsClass))
#define GCP_IS_DIAGNOSTIC_COLORS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_TYPE_DIAGNOSTIC_COLORS))
#define GCP_IS_DIAGNOSTIC_COLORS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_TYPE_DIAGNOSTIC_COLORS))
#define GCP_DIAGNOSTIC_COLORS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_TYPE_DIAGNOSTIC_COLORS, GcpDiagnosticColorsClass))

typedef struct _GcpDiagnosticColors GcpDiagnosticColors;
typedef struct _GcpDiagnosticColorsClass GcpDiagnosticColorsClass;

#define GCP_DIAGNOSTIC_TYPE_SEVERITY (gcp_diagnostic_severity_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _gcp_diagnostic_colors_unref0(var) ((var == NULL) ? NULL : (var = (gcp_diagnostic_colors_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define GCP_TYPE_EXPAND_RANGE (gcp_expand_range_get_type ())
#define GCP_EXPAND_RANGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_TYPE_EXPAND_RANGE, GcpExpandRange))
#define GCP_EXPAND_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_TYPE_EXPAND_RANGE, GcpExpandRangeClass))
#define GCP_IS_EXPAND_RANGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_TYPE_EXPAND_RANGE))
#define GCP_IS_EXPAND_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_TYPE_EXPAND_RANGE))
#define GCP_EXPAND_RANGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_TYPE_EXPAND_RANGE, GcpExpandRangeClass))

typedef struct _GcpExpandRange GcpExpandRange;
typedef struct _GcpExpandRangeClass GcpExpandRangeClass;

#define GCP_TYPE_SOURCE_LOCATION (gcp_source_location_get_type ())
#define GCP_SOURCE_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_TYPE_SOURCE_LOCATION, GcpSourceLocation))
#define GCP_SOURCE_LOCATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_TYPE_SOURCE_LOCATION, GcpSourceLocationClass))
#define GCP_IS_SOURCE_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_TYPE_SOURCE_LOCATION))
#define GCP_IS_SOURCE_LOCATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_TYPE_SOURCE_LOCATION))
#define GCP_SOURCE_LOCATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_TYPE_SOURCE_LOCATION, GcpSourceLocationClass))

typedef struct _GcpSourceLocation GcpSourceLocation;
typedef struct _GcpSourceLocationClass GcpSourceLocationClass;

#define GCP_TYPE_SOURCE_RANGE_SUPPORT (gcp_source_range_support_get_type ())
#define GCP_SOURCE_RANGE_SUPPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_TYPE_SOURCE_RANGE_SUPPORT, GcpSourceRangeSupport))
#define GCP_IS_SOURCE_RANGE_SUPPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_TYPE_SOURCE_RANGE_SUPPORT))
#define GCP_SOURCE_RANGE_SUPPORT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GCP_TYPE_SOURCE_RANGE_SUPPORT, GcpSourceRangeSupportIface))

typedef struct _GcpSourceRangeSupport GcpSourceRangeSupport;
typedef struct _GcpSourceRangeSupportIface GcpSourceRangeSupportIface;

#define GCP_TYPE_SOURCE_RANGE (gcp_source_range_get_type ())
#define GCP_SOURCE_RANGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_TYPE_SOURCE_RANGE, GcpSourceRange))
#define GCP_SOURCE_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_TYPE_SOURCE_RANGE, GcpSourceRangeClass))
#define GCP_IS_SOURCE_RANGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_TYPE_SOURCE_RANGE))
#define GCP_IS_SOURCE_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_TYPE_SOURCE_RANGE))
#define GCP_SOURCE_RANGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_TYPE_SOURCE_RANGE, GcpSourceRangeClass))

typedef struct _GcpSourceRange GcpSourceRange;
typedef struct _GcpSourceRangeClass GcpSourceRangeClass;
#define _gcp_expand_range_unref0(var) ((var == NULL) ? NULL : (var = (gcp_expand_range_unref (var), NULL)))

struct _GcpDiagnosticMessage {
	GtkEventBox parent_instance;
	GcpDiagnosticMessagePrivate * priv;
};

struct _GcpDiagnosticMessageClass {
	GtkEventBoxClass parent_class;
};

typedef enum  {
	GCP_DIAGNOSTIC_SEVERITY_NONE,
	GCP_DIAGNOSTIC_SEVERITY_INFO,
	GCP_DIAGNOSTIC_SEVERITY_WARNING,
	GCP_DIAGNOSTIC_SEVERITY_ERROR,
	GCP_DIAGNOSTIC_SEVERITY_FATAL,
	GCP_DIAGNOSTIC_SEVERITY_NUM
} GcpDiagnosticSeverity;

struct _GcpDiagnosticMessagePrivate {
	GcpDiagnostic** d_diagnostics;
	gint d_diagnostics_length1;
	gint _d_diagnostics_size_;
	GtkBox* d_vbox;
	GcpDiagnosticColors* d_colors;
	GtkSourceView* d_view;
	GcpDiagnosticSeverity d_rulingSeverity;
	gboolean d_inserted;
	gint d_width;
	gint d_height;
	gboolean d_updating;
};

struct _GcpSourceRangeSupportIface {
	GTypeInterface parent_iface;
	GcpSourceRange* (*get_range) (GcpSourceRangeSupport* self);
	GcpSourceRange** (*get_ranges) (GcpSourceRangeSupport* self, int* result_length1);
};


static gpointer gcp_diagnostic_message_parent_class = NULL;

GType gcp_diagnostic_message_get_type (void) G_GNUC_CONST;
GType gcp_diagnostic_get_type (void) G_GNUC_CONST;
gpointer gcp_diagnostic_colors_ref (gpointer instance);
void gcp_diagnostic_colors_unref (gpointer instance);
GParamSpec* gcp_param_spec_diagnostic_colors (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void gcp_value_set_diagnostic_colors (GValue* value, gpointer v_object);
void gcp_value_take_diagnostic_colors (GValue* value, gpointer v_object);
gpointer gcp_value_get_diagnostic_colors (const GValue* value);
GType gcp_diagnostic_colors_get_type (void) G_GNUC_CONST;
GType gcp_diagnostic_severity_get_type (void) G_GNUC_CONST;
#define GCP_DIAGNOSTIC_MESSAGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCP_TYPE_DIAGNOSTIC_MESSAGE, GcpDiagnosticMessagePrivate))
enum  {
	GCP_DIAGNOSTIC_MESSAGE_DUMMY_PROPERTY
};
GcpDiagnosticMessage* gcp_diagnostic_message_new (GtkSourceView* view, GcpDiagnostic** diagnostics, int diagnostics_length1);
GcpDiagnosticMessage* gcp_diagnostic_message_construct (GType object_type, GtkSourceView* view, GcpDiagnostic** diagnostics, int diagnostics_length1);
static GcpDiagnostic** _vala_array_dup5 (GcpDiagnostic** self, int length);
GcpDiagnosticColors* gcp_diagnostic_colors_new (GtkStyleContext* context);
GcpDiagnosticColors* gcp_diagnostic_colors_construct (GType object_type, GtkStyleContext* context);
static void gcp_diagnostic_message_on_view_style_updated (GcpDiagnosticMessage* self);
static void _gcp_diagnostic_message_on_view_style_updated_gtk_widget_style_updated (GtkWidget* _sender, gpointer self);
static void gcp_diagnostic_message_on_style_scheme_changed (GcpDiagnosticMessage* self);
static void _gcp_diagnostic_message_on_style_scheme_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static gboolean gcp_diagnostic_message_on_view_key_press (GcpDiagnosticMessage* self, GdkEventKey* event);
static gboolean _gcp_diagnostic_message_on_view_key_press_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self);
static void gcp_diagnostic_message_update (GcpDiagnosticMessage* self);
static void gcp_diagnostic_message_style_changed (GcpDiagnosticMessage* self);
void gcp_diagnostic_colors_mix_in_widget (GcpDiagnosticColors* self, GtkWidget* widget);
static void gcp_diagnostic_message_real_destroy (GtkWidget* base);
static void gcp_diagnostic_message_real_style_updated (GtkWidget* base);
static gboolean gcp_diagnostic_message_get_mixed_severity (GcpDiagnosticMessage* self);
GcpDiagnosticSeverity gcp_diagnostic_get_severity (GcpDiagnostic* self);
gchar* gcp_diagnostic_severity_to_string (GcpDiagnosticSeverity self);
const gchar* gcp_diagnostic_get_message (GcpDiagnostic* self);
static GcpDiagnosticSeverity gcp_diagnostic_message_get_diagnostics_ruling_severity (GcpDiagnosticMessage* self);
void gcp_diagnostic_message_reposition (GcpDiagnosticMessage* self);
gpointer gcp_expand_range_ref (gpointer instance);
void gcp_expand_range_unref (gpointer instance);
GParamSpec* gcp_param_spec_expand_range (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void gcp_value_set_expand_range (GValue* value, gpointer v_object);
void gcp_value_take_expand_range (GValue* value, gpointer v_object);
gpointer gcp_value_get_expand_range (const GValue* value);
GType gcp_expand_range_get_type (void) G_GNUC_CONST;
GType gcp_source_location_get_type (void) G_GNUC_CONST;
static void gcp_diagnostic_message_expand_range (GcpDiagnosticMessage* self, GcpExpandRange* topx, GcpExpandRange* bottomx, GcpExpandRange* y, GcpSourceLocation* location);
gboolean gcp_source_location_buffer_coordinates (GcpSourceLocation* self, GtkTextView* view, GdkRectangle* rect);
gint gcp_expand_range_get_min (GcpExpandRange* self);
void gcp_expand_range_reset (GcpExpandRange* self);
gint gcp_expand_range_get_max (GcpExpandRange* self);
void gcp_expand_range_add (GcpExpandRange* self, gint val);
GcpExpandRange* gcp_expand_range_new (void);
GcpExpandRange* gcp_expand_range_construct (GType object_type);
GType gcp_source_range_get_type (void) G_GNUC_CONST;
GType gcp_source_range_support_get_type (void) G_GNUC_CONST;
GcpSourceRange** gcp_source_range_support_get_ranges (GcpSourceRangeSupport* self, int* result_length1);
GcpSourceLocation* gcp_source_range_get_start (GcpSourceRange* self);
GcpSourceLocation* gcp_source_range_get_end (GcpSourceRange* self);
GcpSourceLocation* gcp_diagnostic_get_location (GcpDiagnostic* self);
static GtkSizeRequestMode gcp_diagnostic_message_real_get_request_mode (GtkWidget* base);
static void gcp_diagnostic_message_real_get_preferred_width (GtkWidget* base, gint* minimum_width, gint* natural_width);
static void gcp_diagnostic_message_real_get_preferred_height_for_width (GtkWidget* base, gint width, gint* minimum_height, gint* natural_height);
static void gcp_diagnostic_message_add_class_for_severity (GcpDiagnosticMessage* self, GtkStyleContext* ctx);
static gboolean gcp_diagnostic_message_real_draw (GtkWidget* base, cairo_t* context);
GcpDiagnostic** gcp_diagnostic_message_get_diagnostics (GcpDiagnosticMessage* self, int* result_length1);
void gcp_diagnostic_message_set_diagnostics (GcpDiagnosticMessage* self, GcpDiagnostic** value, int value_length1);
static GcpDiagnostic** _vala_array_dup6 (GcpDiagnostic** self, int length);
static void gcp_diagnostic_message_finalize (GObject* obj);
static void _vala_gcp_diagnostic_message_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gcp_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 GcpDiagnostic** _vala_array_dup5 (GcpDiagnostic** self, int length) {
	GcpDiagnostic** result;
	int i;
	result = g_new0 (GcpDiagnostic*, length + 1);
	for (i = 0; i < length; i++) {
		GcpDiagnostic* _tmp0_;
		_tmp0_ = _g_object_ref0 (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


static void _gcp_diagnostic_message_on_view_style_updated_gtk_widget_style_updated (GtkWidget* _sender, gpointer self) {
	gcp_diagnostic_message_on_view_style_updated (self);
}


static void _gcp_diagnostic_message_on_style_scheme_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	gcp_diagnostic_message_on_style_scheme_changed (self);
}


static gboolean _gcp_diagnostic_message_on_view_key_press_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) {
	gboolean result;
	result = gcp_diagnostic_message_on_view_key_press (self, event);
	return result;
}


GcpDiagnosticMessage* gcp_diagnostic_message_construct (GType object_type, GtkSourceView* view, GcpDiagnostic** diagnostics, int diagnostics_length1) {
	GcpDiagnosticMessage * self = NULL;
	GcpDiagnostic** _tmp0_;
	gint _tmp0__length1;
	GcpDiagnostic** _tmp1_;
	gint _tmp1__length1;
	GtkSourceView* _tmp2_;
	GtkStyleContext* _tmp3_ = NULL;
	GcpDiagnosticColors* _tmp4_;
	GtkSourceView* _tmp5_;
	GtkSourceView* _tmp6_;
	GtkTextBuffer* _tmp7_;
	GtkTextBuffer* _tmp8_;
	GtkSourceView* _tmp9_;
	g_return_val_if_fail (view != NULL, NULL);
	self = (GcpDiagnosticMessage*) g_object_new (object_type, NULL);
	_tmp0_ = diagnostics;
	_tmp0__length1 = diagnostics_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup5 (_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_ = gcp_diagnostic_colors_new (_tmp3_);
	_gcp_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) _gcp_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) _gcp_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) _gcp_diagnostic_message_on_view_key_press_gtk_widget_key_press_event, self, 0);
	self->priv->d_inserted = FALSE;
	gcp_diagnostic_message_update (self);
	return self;
}


GcpDiagnosticMessage* gcp_diagnostic_message_new (GtkSourceView* view, GcpDiagnostic** diagnostics, int diagnostics_length1) {
	return gcp_diagnostic_message_construct (GCP_TYPE_DIAGNOSTIC_MESSAGE, view, diagnostics, diagnostics_length1);
}


static gboolean gcp_diagnostic_message_on_view_key_press (GcpDiagnosticMessage* self, GdkEventKey* event) {
	gboolean result = FALSE;
	GdkEventKey _tmp0_;
	guint _tmp1_;
	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 gcp_diagnostic_message_on_style_scheme_changed (GcpDiagnosticMessage* self) {
	g_return_if_fail (self != NULL);
	gcp_diagnostic_message_style_changed (self);
}


static void gcp_diagnostic_message_style_changed (GcpDiagnosticMessage* self) {
	GtkStyleContext* _tmp0_ = NULL;
	GcpDiagnosticColors* _tmp1_;
	GtkSourceView* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_widget_get_style_context ((GtkWidget*) self);
	_tmp1_ = gcp_diagnostic_colors_new (_tmp0_);
	_gcp_diagnostic_colors_unref0 (self->priv->d_colors);
	self->priv->d_colors = _tmp1_;
	_tmp2_ = self->priv->d_view;
	if (_tmp2_ != NULL) {
		GcpDiagnosticColors* _tmp3_;
		GtkSourceView* _tmp4_;
		_tmp3_ = self->priv->d_colors;
		_tmp4_ = self->priv->d_view;
		gcp_diagnostic_colors_mix_in_widget (_tmp3_, (GtkWidget*) _tmp4_);
	}
	gcp_diagnostic_message_update (self);
}


static void gcp_diagnostic_message_on_view_style_updated (GcpDiagnosticMessage* self) {
	g_return_if_fail (self != NULL);
	gcp_diagnostic_message_style_changed (self);
}


static void gcp_diagnostic_message_real_destroy (GtkWidget* base) {
	GcpDiagnosticMessage * self;
	GtkSourceView* _tmp0_;
	self = (GcpDiagnosticMessage*) base;
	_tmp0_ = self->priv->d_view;
	if (_tmp0_ != NULL) {
		GtkSourceView* _tmp1_;
		guint _tmp2_ = 0U;
		GtkSourceView* _tmp3_;
		GtkTextBuffer* _tmp4_;
		GtkTextBuffer* _tmp5_;
		guint _tmp6_ = 0U;
		GQuark _tmp7_ = 0U;
		GtkSourceView* _tmp8_;
		guint _tmp9_ = 0U;
		_tmp1_ = self->priv->d_view;
		g_signal_parse_name ("style-updated", GTK_TYPE_WIDGET, &_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) _gcp_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) _gcp_diagnostic_message_on_style_scheme_changed_g_object_notify, self);
		_tmp8_ = self->priv->d_view;
		g_signal_parse_name ("key-press-event", GTK_TYPE_WIDGET, &_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) _gcp_diagnostic_message_on_view_key_press_gtk_widget_key_press_event, self);
	}
	GTK_WIDGET_CLASS (gcp_diagnostic_message_parent_class)->destroy ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_EVENT_BOX, GtkEventBox));
}


static void gcp_diagnostic_message_real_style_updated (GtkWidget* base) {
	GcpDiagnosticMessage * self;
	self = (GcpDiagnosticMessage*) base;
	GTK_WIDGET_CLASS (gcp_diagnostic_message_parent_class)->style_updated ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_EVENT_BOX, GtkEventBox));
	gcp_diagnostic_message_style_changed (self);
}


static void gcp_diagnostic_message_update (GcpDiagnosticMessage* self) {
	gboolean _tmp0_;
	GtkBox* _tmp1_;
	GtkSourceView* _tmp3_;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	GtkSourceView* _tmp6_;
	GtkStyleContext* _tmp7_ = NULL;
	GtkStyleContext* _tmp8_;
	GtkStyleContext* ctx;
	GtkStyleContext* _tmp9_;
	GtkStyleContext* _tmp10_;
	GdkRGBA color = {0};
	GtkStyleContext* _tmp11_;
	GdkRGBA _tmp12_ = {0};
	GtkStyleContext* _tmp13_;
	gboolean _tmp14_;
	gboolean _tmp15_;
	gboolean ismixed;
	GcpDiagnostic** _tmp16_;
	gint _tmp16__length1;
	GtkBox* _tmp45_;
	GcpDiagnosticSeverity _tmp46_;
	GcpDiagnosticSeverity _tmp47_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->d_updating;
	if (_tmp0_) {
		return;
	}
	_tmp1_ = self->priv->d_vbox;
	if (_tmp1_ != NULL) {
		GtkBox* _tmp2_;
		_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_ = self->priv->d_view;
	_tmp7_ = gtk_widget_get_style_context ((GtkWidget*) _tmp6_);
	_tmp8_ = _g_object_ref0 (_tmp7_);
	ctx = _tmp8_;
	_tmp9_ = ctx;
	gtk_style_context_save (_tmp9_);
	_tmp10_ = ctx;
	gtk_style_context_add_class (_tmp10_, GTK_STYLE_CLASS_VIEW);
	_tmp11_ = ctx;
	gtk_style_context_get_color (_tmp11_, GTK_STATE_FLAG_NORMAL, &_tmp12_);
	color = _tmp12_;
	_tmp13_ = ctx;
	gtk_style_context_restore (_tmp13_);
	_tmp14_ = gcp_diagnostic_message_get_mixed_severity (self);
	_tmp15_ = _tmp14_;
	ismixed = _tmp15_;
	_tmp16_ = self->priv->d_diagnostics;
	_tmp16__length1 = self->priv->d_diagnostics_length1;
	{
		GcpDiagnostic** d_collection = NULL;
		gint d_collection_length1 = 0;
		gint _d_collection_size_ = 0;
		gint d_it = 0;
		d_collection = _tmp16_;
		d_collection_length1 = _tmp16__length1;
		for (d_it = 0; d_it < _tmp16__length1; d_it = d_it + 1) {
			GcpDiagnostic* _tmp17_;
			GcpDiagnostic* d = NULL;
			_tmp17_ = _g_object_ref0 (d_collection[d_it]);
			d = _tmp17_;
			{
				GtkLabel* _tmp18_;
				GtkLabel* label;
				gboolean _tmp19_;
				GtkLabel* _tmp37_;
				GtkLabel* _tmp38_;
				GtkLabel* _tmp39_;
				GtkLabel* _tmp40_;
				GtkLabel* _tmp41_;
				GtkLabel* _tmp42_;
				GtkBox* _tmp43_;
				GtkLabel* _tmp44_;
				_tmp18_ = (GtkLabel*) gtk_label_new (NULL);
				g_object_ref_sink (_tmp18_);
				label = _tmp18_;
				_tmp19_ = ismixed;
				if (_tmp19_) {
					GtkLabel* _tmp20_;
					GcpDiagnostic* _tmp21_;
					GcpDiagnosticSeverity _tmp22_;
					GcpDiagnosticSeverity _tmp23_;
					gchar* _tmp24_ = NULL;
					gchar* _tmp25_;
					GcpDiagnostic* _tmp26_;
					const gchar* _tmp27_;
					const gchar* _tmp28_;
					gchar* _tmp29_ = NULL;
					gchar* _tmp30_;
					gchar* _tmp31_ = NULL;
					gchar* _tmp32_;
					_tmp20_ = label;
					_tmp21_ = d;
					_tmp22_ = gcp_diagnostic_get_severity (_tmp21_);
					_tmp23_ = _tmp22_;
					_tmp24_ = gcp_diagnostic_severity_to_string (_tmp23_);
					_tmp25_ = _tmp24_;
					_tmp26_ = d;
					_tmp27_ = gcp_diagnostic_get_message (_tmp26_);
					_tmp28_ = _tmp27_;
					_tmp29_ = g_markup_escape_text (_tmp28_, (gssize) (-1));
					_tmp30_ = _tmp29_;
					_tmp31_ = g_strdup_printf ("<b>%s</b>: %s", _tmp25_, _tmp30_);
					_tmp32_ = _tmp31_;
					gtk_label_set_markup (_tmp20_, _tmp32_);
					_g_free0 (_tmp32_);
					_g_free0 (_tmp30_);
					_g_free0 (_tmp25_);
				} else {
					GtkLabel* _tmp33_;
					GcpDiagnostic* _tmp34_;
					const gchar* _tmp35_;
					const gchar* _tmp36_;
					_tmp33_ = label;
					_tmp34_ = d;
					_tmp35_ = gcp_diagnostic_get_message (_tmp34_);
					_tmp36_ = _tmp35_;
					gtk_label_set_text (_tmp33_, _tmp36_);
				}
				_tmp37_ = label;
				gtk_widget_set_margin_left ((GtkWidget*) _tmp37_, 6);
				_tmp38_ = label;
				gtk_widget_set_margin_right ((GtkWidget*) _tmp38_, 6);
				_tmp39_ = label;
				gtk_widget_show ((GtkWidget*) _tmp39_);
				_tmp40_ = label;
				gtk_widget_set_halign ((GtkWidget*) _tmp40_, GTK_ALIGN_START);
				_tmp41_ = label;
				gtk_widget_set_valign ((GtkWidget*) _tmp41_, GTK_ALIGN_CENTER);
				_tmp42_ = label;
				g_object_set (_tmp42_, "wrap", TRUE, NULL);
				_tmp43_ = self->priv->d_vbox;
				_tmp44_ = label;
				gtk_box_pack_start (_tmp43_, (GtkWidget*) _tmp44_, FALSE, TRUE, (guint) 0);
				_g_object_unref0 (label);
				_g_object_unref0 (d);
			}
		}
	}
	_tmp45_ = self->priv->d_vbox;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp45_);
	gtk_widget_show ((GtkWidget*) self);
	_tmp46_ = gcp_diagnostic_message_get_diagnostics_ruling_severity (self);
	_tmp47_ = _tmp46_;
	self->priv->d_rulingSeverity = _tmp47_;
	gcp_diagnostic_message_reposition (self);
	self->priv->d_updating = FALSE;
	_g_object_unref0 (ctx);
}


static void gcp_diagnostic_message_expand_range (GcpDiagnosticMessage* self, GcpExpandRange* topx, GcpExpandRange* bottomx, GcpExpandRange* y, GcpSourceLocation* location) {
	GdkRectangle rect = {0};
	GcpSourceLocation* _tmp0_;
	GtkSourceView* _tmp1_;
	GdkRectangle _tmp2_ = {0};
	GdkRectangle _tmp3_;
	gint _tmp4_;
	GcpExpandRange* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	GdkRectangle _tmp9_;
	gint _tmp10_;
	GdkRectangle _tmp11_;
	gint _tmp12_;
	GcpExpandRange* _tmp13_;
	gint _tmp14_;
	gint _tmp15_;
	GcpExpandRange* _tmp17_;
	GdkRectangle _tmp18_;
	gint _tmp19_;
	GcpExpandRange* _tmp20_;
	GdkRectangle _tmp21_;
	gint _tmp22_;
	GdkRectangle _tmp23_;
	gint _tmp24_;
	GdkRectangle _tmp25_;
	gint _tmp26_;
	GcpExpandRange* _tmp27_;
	gint _tmp28_;
	gint _tmp29_;
	GdkRectangle _tmp38_;
	gint _tmp39_;
	GdkRectangle _tmp40_;
	gint _tmp41_;
	GcpExpandRange* _tmp42_;
	gint _tmp43_;
	gint _tmp44_;
	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_ = location;
	_tmp1_ = self->priv->d_view;
	gcp_source_location_buffer_coordinates (_tmp0_, (GtkTextView*) _tmp1_, &_tmp2_);
	rect = _tmp2_;
	_tmp3_ = rect;
	_tmp4_ = _tmp3_.y;
	_tmp5_ = y;
	_tmp6_ = gcp_expand_range_get_min (_tmp5_);
	_tmp7_ = _tmp6_;
	if (_tmp4_ < _tmp7_) {
		GcpExpandRange* _tmp8_;
		_tmp8_ = bottomx;
		gcp_expand_range_reset (_tmp8_);
	}
	_tmp9_ = rect;
	_tmp10_ = _tmp9_.y;
	_tmp11_ = rect;
	_tmp12_ = _tmp11_.height;
	_tmp13_ = y;
	_tmp14_ = gcp_expand_range_get_max (_tmp13_);
	_tmp15_ = _tmp14_;
	if ((_tmp10_ + _tmp12_) > _tmp15_) {
		GcpExpandRange* _tmp16_;
		_tmp16_ = topx;
		gcp_expand_range_reset (_tmp16_);
	}
	_tmp17_ = y;
	_tmp18_ = rect;
	_tmp19_ = _tmp18_.y;
	gcp_expand_range_add (_tmp17_, _tmp19_);
	_tmp20_ = y;
	_tmp21_ = rect;
	_tmp22_ = _tmp21_.y;
	_tmp23_ = rect;
	_tmp24_ = _tmp23_.height;
	gcp_expand_range_add (_tmp20_, _tmp22_ + _tmp24_);
	_tmp25_ = rect;
	_tmp26_ = _tmp25_.y;
	_tmp27_ = y;
	_tmp28_ = gcp_expand_range_get_min (_tmp27_);
	_tmp29_ = _tmp28_;
	if (_tmp26_ == _tmp29_) {
		GcpExpandRange* _tmp30_;
		GdkRectangle _tmp31_;
		gint _tmp32_;
		GcpExpandRange* _tmp33_;
		GdkRectangle _tmp34_;
		gint _tmp35_;
		GdkRectangle _tmp36_;
		gint _tmp37_;
		_tmp30_ = topx;
		_tmp31_ = rect;
		_tmp32_ = _tmp31_.x;
		gcp_expand_range_add (_tmp30_, _tmp32_);
		_tmp33_ = topx;
		_tmp34_ = rect;
		_tmp35_ = _tmp34_.x;
		_tmp36_ = rect;
		_tmp37_ = _tmp36_.width;
		gcp_expand_range_add (_tmp33_, _tmp35_ + _tmp37_);
	}
	_tmp38_ = rect;
	_tmp39_ = _tmp38_.y;
	_tmp40_ = rect;
	_tmp41_ = _tmp40_.height;
	_tmp42_ = y;
	_tmp43_ = gcp_expand_range_get_max (_tmp42_);
	_tmp44_ = _tmp43_;
	if ((_tmp39_ + _tmp41_) == _tmp44_) {
		GcpExpandRange* _tmp45_;
		GdkRectangle _tmp46_;
		gint _tmp47_;
		GcpExpandRange* _tmp48_;
		GdkRectangle _tmp49_;
		gint _tmp50_;
		GdkRectangle _tmp51_;
		gint _tmp52_;
		_tmp45_ = bottomx;
		_tmp46_ = rect;
		_tmp47_ = _tmp46_.x;
		gcp_expand_range_add (_tmp45_, _tmp47_);
		_tmp48_ = bottomx;
		_tmp49_ = rect;
		_tmp50_ = _tmp49_.x;
		_tmp51_ = rect;
		_tmp52_ = _tmp51_.width;
		gcp_expand_range_add (_tmp48_, _tmp50_ + _tmp52_);
	}
}


static gpointer _gcp_expand_range_ref0 (gpointer self) {
	return self ? gcp_expand_range_ref (self) : NULL;
}


void gcp_diagnostic_message_reposition (GcpDiagnosticMessage* self) {
	GcpExpandRange* _tmp0_;
	GcpExpandRange* topx;
	GcpExpandRange* _tmp1_;
	GcpExpandRange* bottomx;
	GcpExpandRange* _tmp2_;
	GcpExpandRange* y;
	GcpDiagnostic** _tmp3_;
	gint _tmp3__length1;
	gint ymin = 0;
	gint ymax = 0;
	GtkSourceView* _tmp27_;
	GcpExpandRange* _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	gint _tmp31_ = 0;
	GtkSourceView* _tmp32_;
	GcpExpandRange* _tmp33_;
	gint _tmp34_;
	gint _tmp35_;
	gint _tmp36_ = 0;
	GtkSourceView* _tmp37_;
	GdkWindow* _tmp38_ = NULL;
	GdkWindow* _tmp39_;
	GdkWindow* window;
	gint aligny = 0;
	gint alignyat = 0;
	GcpExpandRange* xrange = NULL;
	gint _tmp40_;
	GdkWindow* _tmp41_;
	gint _tmp42_ = 0;
	gint _tmp43_;
	gint xmin = 0;
	gint xmax = 0;
	GtkSourceView* _tmp50_;
	GcpExpandRange* _tmp51_;
	gint _tmp52_;
	gint _tmp53_;
	gint _tmp54_ = 0;
	GtkSourceView* _tmp55_;
	GcpExpandRange* _tmp56_;
	gint _tmp57_;
	gint _tmp58_;
	gint _tmp59_ = 0;
	gint xc = 0;
	gint width = 0;
	GdkWindow* _tmp60_;
	gint _tmp61_ = 0;
	gint _tmp62_;
	gint _tmp63_;
	gboolean _tmp69_;
	gint minwidth = 0;
	gint _tmp71_ = 0;
	gint _tmp72_;
	gint _tmp73_;
	gint natural_height = 0;
	gint _tmp75_;
	gint _tmp76_ = 0;
	gint _tmp77_ = 0;
	gint _tmp78_;
	gint _tmp79_;
	gint _tmp80_;
	gint _tmp81_;
	gint yc;
	GtkSourceView* _tmp82_;
	gint _tmp83_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gcp_expand_range_new ();
	topx = _tmp0_;
	_tmp1_ = gcp_expand_range_new ();
	bottomx = _tmp1_;
	_tmp2_ = gcp_expand_range_new ();
	y = _tmp2_;
	_tmp3_ = self->priv->d_diagnostics;
	_tmp3__length1 = self->priv->d_diagnostics_length1;
	{
		GcpDiagnostic** 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) {
			GcpDiagnostic* _tmp4_;
			GcpDiagnostic* d = NULL;
			_tmp4_ = _g_object_ref0 (d_collection[d_it]);
			d = _tmp4_;
			{
				GcpDiagnostic* _tmp5_;
				GcpSourceRange** _tmp6_;
				gint _tmp6__length1;
				GcpSourceRange** _tmp7_;
				gint _tmp7__length1;
				GcpExpandRange* _tmp21_;
				GcpExpandRange* _tmp22_;
				GcpExpandRange* _tmp23_;
				GcpDiagnostic* _tmp24_;
				GcpSourceLocation* _tmp25_;
				GcpSourceLocation* _tmp26_;
				_tmp5_ = d;
				_tmp6_ = gcp_source_range_support_get_ranges ((GcpSourceRangeSupport*) _tmp5_, &_tmp6__length1);
				_tmp7_ = _tmp6_;
				_tmp7__length1 = _tmp6__length1;
				{
					GcpSourceRange** 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) {
						GcpSourceRange* _tmp8_;
						GcpSourceRange* r = NULL;
						_tmp8_ = _g_object_ref0 (r_collection[r_it]);
						r = _tmp8_;
						{
							GcpExpandRange* _tmp9_;
							GcpExpandRange* _tmp10_;
							GcpExpandRange* _tmp11_;
							GcpSourceRange* _tmp12_;
							GcpSourceLocation* _tmp13_;
							GcpSourceLocation* _tmp14_;
							GcpExpandRange* _tmp15_;
							GcpExpandRange* _tmp16_;
							GcpExpandRange* _tmp17_;
							GcpSourceRange* _tmp18_;
							GcpSourceLocation* _tmp19_;
							GcpSourceLocation* _tmp20_;
							_tmp9_ = topx;
							_tmp10_ = bottomx;
							_tmp11_ = y;
							_tmp12_ = r;
							_tmp13_ = gcp_source_range_get_start (_tmp12_);
							_tmp14_ = _tmp13_;
							gcp_diagnostic_message_expand_range (self, _tmp9_, _tmp10_, _tmp11_, _tmp14_);
							_tmp15_ = topx;
							_tmp16_ = bottomx;
							_tmp17_ = y;
							_tmp18_ = r;
							_tmp19_ = gcp_source_range_get_end (_tmp18_);
							_tmp20_ = _tmp19_;
							gcp_diagnostic_message_expand_range (self, _tmp15_, _tmp16_, _tmp17_, _tmp20_);
							_g_object_unref0 (r);
						}
					}
					r_collection = (_vala_array_free (r_collection, r_collection_length1, (GDestroyNotify) g_object_unref), NULL);
				}
				_tmp21_ = topx;
				_tmp22_ = bottomx;
				_tmp23_ = y;
				_tmp24_ = d;
				_tmp25_ = gcp_diagnostic_get_location (_tmp24_);
				_tmp26_ = _tmp25_;
				gcp_diagnostic_message_expand_range (self, _tmp21_, _tmp22_, _tmp23_, _tmp26_);
				_g_object_unref0 (d);
			}
		}
	}
	_tmp27_ = self->priv->d_view;
	_tmp28_ = y;
	_tmp29_ = gcp_expand_range_get_min (_tmp28_);
	_tmp30_ = _tmp29_;
	gtk_text_view_buffer_to_window_coords ((GtkTextView*) _tmp27_, GTK_TEXT_WINDOW_TEXT, 0, _tmp30_, NULL, &_tmp31_);
	ymin = _tmp31_;
	_tmp32_ = self->priv->d_view;
	_tmp33_ = y;
	_tmp34_ = gcp_expand_range_get_max (_tmp33_);
	_tmp35_ = _tmp34_;
	gtk_text_view_buffer_to_window_coords ((GtkTextView*) _tmp32_, GTK_TEXT_WINDOW_TEXT, 0, _tmp35_, NULL, &_tmp36_);
	ymax = _tmp36_;
	_tmp37_ = self->priv->d_view;
	_tmp38_ = gtk_text_view_get_window ((GtkTextView*) _tmp37_, GTK_TEXT_WINDOW_TEXT);
	_tmp39_ = _g_object_ref0 (_tmp38_);
	window = _tmp39_;
	_tmp40_ = ymin;
	_tmp41_ = window;
	_tmp42_ = gdk_window_get_height (_tmp41_);
	_tmp43_ = ymax;
	if (_tmp40_ > (_tmp42_ - _tmp43_)) {
		gint _tmp44_;
		GcpExpandRange* _tmp45_;
		GcpExpandRange* _tmp46_;
		aligny = 1;
		_tmp44_ = ymin;
		alignyat = _tmp44_ - 3;
		_tmp45_ = topx;
		_tmp46_ = _gcp_expand_range_ref0 (_tmp45_);
		_gcp_expand_range_unref0 (xrange);
		xrange = _tmp46_;
	} else {
		gint _tmp47_;
		GcpExpandRange* _tmp48_;
		GcpExpandRange* _tmp49_;
		aligny = 0;
		_tmp47_ = ymax;
		alignyat = _tmp47_ + 3;
		_tmp48_ = bottomx;
		_tmp49_ = _gcp_expand_range_ref0 (_tmp48_);
		_gcp_expand_range_unref0 (xrange);
		xrange = _tmp49_;
	}
	_tmp50_ = self->priv->d_view;
	_tmp51_ = xrange;
	_tmp52_ = gcp_expand_range_get_min (_tmp51_);
	_tmp53_ = _tmp52_;
	gtk_text_view_buffer_to_window_coords ((GtkTextView*) _tmp50_, GTK_TEXT_WINDOW_TEXT, _tmp53_, 0, &_tmp54_, NULL);
	xmin = _tmp54_;
	_tmp55_ = self->priv->d_view;
	_tmp56_ = xrange;
	_tmp57_ = gcp_expand_range_get_max (_tmp56_);
	_tmp58_ = _tmp57_;
	gtk_text_view_buffer_to_window_coords ((GtkTextView*) _tmp55_, GTK_TEXT_WINDOW_TEXT, _tmp58_, 0, &_tmp59_, NULL);
	xmax = _tmp59_;
	_tmp60_ = window;
	_tmp61_ = gdk_window_get_width (_tmp60_);
	_tmp62_ = xmin;
	_tmp63_ = xmax;
	if ((_tmp61_ - _tmp62_) > _tmp63_) {
		gint _tmp64_;
		GdkWindow* _tmp65_;
		gint _tmp66_ = 0;
		gint _tmp67_;
		_tmp64_ = xmin;
		xc = _tmp64_;
		_tmp65_ = window;
		_tmp66_ = gdk_window_get_width (_tmp65_);
		_tmp67_ = xmin;
		width = _tmp66_ - _tmp67_;
	} else {
		gint _tmp68_;
		xc = 0;
		_tmp68_ = xmax;
		width = _tmp68_;
	}
	_tmp69_ = self->priv->d_inserted;
	if (!_tmp69_) {
		GtkSourceView* _tmp70_;
		_tmp70_ = self->priv->d_view;
		gtk_text_view_add_child_in_window ((GtkTextView*) _tmp70_, (GtkWidget*) self, GTK_TEXT_WINDOW_TEXT, 0, 0);
	}
	GTK_WIDGET_CLASS (gcp_diagnostic_message_parent_class)->get_preferred_width ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_EVENT_BOX, GtkEventBox), NULL, &_tmp71_);
	minwidth = _tmp71_;
	_tmp72_ = minwidth;
	_tmp73_ = width;
	if (_tmp72_ < _tmp73_) {
		gint _tmp74_;
		_tmp74_ = minwidth;
		width = _tmp74_;
	}
	_tmp75_ = width;
	GTK_WIDGET_CLASS (gcp_diagnostic_message_parent_class)->get_preferred_height_for_width ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_EVENT_BOX, GtkEventBox), _tmp75_, &_tmp76_, &_tmp77_);
	self->priv->d_height = _tmp76_;
	natural_height = _tmp77_;
	_tmp78_ = width;
	self->priv->d_width = _tmp78_;
	_tmp79_ = alignyat;
	_tmp80_ = self->priv->d_height;
	_tmp81_ = aligny;
	yc = _tmp79_ - (_tmp80_ * _tmp81_);
	_tmp82_ = self->priv->d_view;
	_tmp83_ = xc;
	gtk_text_view_move_child ((GtkTextView*) _tmp82_, (GtkWidget*) self, _tmp83_, yc);
	self->priv->d_inserted = TRUE;
	gtk_widget_queue_resize ((GtkWidget*) self);
	_gcp_expand_range_unref0 (xrange);
	_g_object_unref0 (window);
	_gcp_expand_range_unref0 (y);
	_gcp_expand_range_unref0 (bottomx);
	_gcp_expand_range_unref0 (topx);
}


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


static void gcp_diagnostic_message_real_get_preferred_width (GtkWidget* base, gint* minimum_width, gint* natural_width) {
	GcpDiagnosticMessage * self;
	gint _vala_minimum_width = 0;
	gint _vala_natural_width = 0;
	gint _tmp0_;
	gint _tmp1_;
	self = (GcpDiagnosticMessage*) 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 gcp_diagnostic_message_real_get_preferred_height_for_width (GtkWidget* base, gint width, gint* minimum_height, gint* natural_height) {
	GcpDiagnosticMessage * self;
	gint _vala_minimum_height = 0;
	gint _vala_natural_height = 0;
	gint _tmp0_;
	gint _tmp1_;
	self = (GcpDiagnosticMessage*) base;
	_tmp0_ = width;
	_tmp1_ = self->priv->d_width;
	if (_tmp0_ == _tmp1_) {
		gint _tmp2_;
		gint _tmp3_;
		_tmp2_ = self->priv->d_height;
		_vala_minimum_height = _tmp2_;
		_tmp3_ = self->priv->d_height;
		_vala_natural_height = _tmp3_;
	} else {
		gint _tmp4_;
		gint _tmp5_ = 0;
		gint _tmp6_ = 0;
		_tmp4_ = width;
		GTK_WIDGET_CLASS (gcp_diagnostic_message_parent_class)->get_preferred_height_for_width ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_EVENT_BOX, 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 gcp_diagnostic_message_add_class_for_severity (GcpDiagnosticMessage* self, GtkStyleContext* ctx) {
	GcpDiagnosticSeverity _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (ctx != NULL);
	_tmp0_ = self->priv->d_rulingSeverity;
	switch (_tmp0_) {
		case GCP_DIAGNOSTIC_SEVERITY_ERROR:
		case GCP_DIAGNOSTIC_SEVERITY_FATAL:
		{
			GtkStyleContext* _tmp1_;
			_tmp1_ = ctx;
			gtk_style_context_add_class (_tmp1_, GTK_STYLE_CLASS_ERROR);
			break;
		}
		case GCP_DIAGNOSTIC_SEVERITY_WARNING:
		{
			GtkStyleContext* _tmp2_;
			_tmp2_ = ctx;
			gtk_style_context_add_class (_tmp2_, GTK_STYLE_CLASS_WARNING);
			break;
		}
		case GCP_DIAGNOSTIC_SEVERITY_INFO:
		{
			GtkStyleContext* _tmp3_;
			_tmp3_ = ctx;
			gtk_style_context_add_class (_tmp3_, GTK_STYLE_CLASS_INFO);
			break;
		}
		default:
		{
			break;
		}
	}
}


static gboolean gcp_diagnostic_message_real_draw (GtkWidget* base, cairo_t* context) {
	GcpDiagnosticMessage * self;
	gboolean result = FALSE;
	GtkAllocation alloc = {0};
	GtkAllocation _tmp0_ = {0};
	GtkStyleContext* _tmp1_ = NULL;
	GtkStyleContext* _tmp2_;
	GtkStyleContext* ctx;
	GtkStyleContext* _tmp3_ = NULL;
	cairo_t* _tmp4_;
	GtkAllocation _tmp5_;
	gint _tmp6_;
	GtkAllocation _tmp7_;
	gint _tmp8_;
	GtkStyleContext* _tmp9_ = NULL;
	cairo_t* _tmp10_;
	GtkAllocation _tmp11_;
	gint _tmp12_;
	GtkAllocation _tmp13_;
	gint _tmp14_;
	cairo_t* _tmp15_;
	self = (GcpDiagnosticMessage*) 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);
	gcp_diagnostic_message_add_class_for_severity (self, ctx);
	_tmp3_ = gtk_widget_get_style_context ((GtkWidget*) self);
	_tmp4_ = context;
	_tmp5_ = alloc;
	_tmp6_ = _tmp5_.width;
	_tmp7_ = alloc;
	_tmp8_ = _tmp7_.height;
	gtk_render_background (_tmp3_, _tmp4_, (gdouble) 0, (gdouble) 0, (gdouble) _tmp6_, (gdouble) _tmp8_);
	_tmp9_ = gtk_widget_get_style_context ((GtkWidget*) self);
	_tmp10_ = context;
	_tmp11_ = alloc;
	_tmp12_ = _tmp11_.width;
	_tmp13_ = alloc;
	_tmp14_ = _tmp13_.height;
	gtk_render_frame (_tmp9_, _tmp10_, (gdouble) 0, (gdouble) 0, (gdouble) _tmp12_, (gdouble) _tmp14_);
	gtk_style_context_save (ctx);
	_tmp15_ = context;
	GTK_WIDGET_CLASS (gcp_diagnostic_message_parent_class)->draw ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_EVENT_BOX, GtkEventBox), _tmp15_);
	result = FALSE;
	_g_object_unref0 (ctx);
	return result;
}


static gboolean gcp_diagnostic_message_get_mixed_severity (GcpDiagnosticMessage* self) {
	gboolean result;
	gboolean first;
	GcpDiagnosticSeverity s;
	GcpDiagnostic** _tmp0_;
	gint _tmp0__length1;
	g_return_val_if_fail (self != NULL, FALSE);
	first = TRUE;
	s = GCP_DIAGNOSTIC_SEVERITY_NONE;
	_tmp0_ = self->priv->d_diagnostics;
	_tmp0__length1 = self->priv->d_diagnostics_length1;
	{
		GcpDiagnostic** 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) {
			GcpDiagnostic* _tmp1_;
			GcpDiagnostic* d = NULL;
			_tmp1_ = _g_object_ref0 (d_collection[d_it]);
			d = _tmp1_;
			{
				gboolean _tmp2_;
				GcpDiagnosticSeverity _tmp6_;
				GcpDiagnostic* _tmp7_;
				GcpDiagnosticSeverity _tmp8_;
				GcpDiagnosticSeverity _tmp9_;
				_tmp2_ = first;
				if (_tmp2_) {
					GcpDiagnostic* _tmp3_;
					GcpDiagnosticSeverity _tmp4_;
					GcpDiagnosticSeverity _tmp5_;
					first = FALSE;
					_tmp3_ = d;
					_tmp4_ = gcp_diagnostic_get_severity (_tmp3_);
					_tmp5_ = _tmp4_;
					s = _tmp5_;
				}
				_tmp6_ = s;
				_tmp7_ = d;
				_tmp8_ = gcp_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;
}


GcpDiagnostic** gcp_diagnostic_message_get_diagnostics (GcpDiagnosticMessage* self, int* result_length1) {
	GcpDiagnostic** result;
	GcpDiagnostic** _tmp0_;
	gint _tmp0__length1;
	GcpDiagnostic** _tmp1_;
	gint _tmp1__length1;
	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 GcpDiagnostic** _vala_array_dup6 (GcpDiagnostic** self, int length) {
	GcpDiagnostic** result;
	int i;
	result = g_new0 (GcpDiagnostic*, length + 1);
	for (i = 0; i < length; i++) {
		GcpDiagnostic* _tmp0_;
		_tmp0_ = _g_object_ref0 (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


void gcp_diagnostic_message_set_diagnostics (GcpDiagnosticMessage* self, GcpDiagnostic** value, int value_length1) {
	GcpDiagnostic** _tmp0_;
	gint _tmp0__length1;
	GcpDiagnostic** _tmp1_;
	gint _tmp1__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp0__length1 = value_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;
	gcp_diagnostic_message_update (self);
}


static GcpDiagnosticSeverity gcp_diagnostic_message_get_diagnostics_ruling_severity (GcpDiagnosticMessage* self) {
	GcpDiagnosticSeverity result;
	GcpDiagnosticSeverity severity;
	gboolean first;
	GcpDiagnostic** _tmp0_;
	gint _tmp0__length1;
	GcpDiagnosticSeverity _tmp12_;
	g_return_val_if_fail (self != NULL, 0);
	severity = GCP_DIAGNOSTIC_SEVERITY_NONE;
	first = TRUE;
	_tmp0_ = self->priv->d_diagnostics;
	_tmp0__length1 = self->priv->d_diagnostics_length1;
	{
		GcpDiagnostic** 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) {
			GcpDiagnostic* _tmp1_;
			GcpDiagnostic* d = NULL;
			_tmp1_ = _g_object_ref0 (d_collection[d_it]);
			d = _tmp1_;
			{
				gboolean _tmp2_ = FALSE;
				gboolean _tmp3_;
				gboolean _tmp8_;
				_tmp3_ = first;
				if (_tmp3_) {
					_tmp2_ = TRUE;
				} else {
					GcpDiagnostic* _tmp4_;
					GcpDiagnosticSeverity _tmp5_;
					GcpDiagnosticSeverity _tmp6_;
					GcpDiagnosticSeverity _tmp7_;
					_tmp4_ = d;
					_tmp5_ = gcp_diagnostic_get_severity (_tmp4_);
					_tmp6_ = _tmp5_;
					_tmp7_ = severity;
					_tmp2_ = _tmp6_ > _tmp7_;
				}
				_tmp8_ = _tmp2_;
				if (_tmp8_) {
					GcpDiagnostic* _tmp9_;
					GcpDiagnosticSeverity _tmp10_;
					GcpDiagnosticSeverity _tmp11_;
					_tmp9_ = d;
					_tmp10_ = gcp_diagnostic_get_severity (_tmp9_);
					_tmp11_ = _tmp10_;
					severity = _tmp11_;
				}
				first = FALSE;
				_g_object_unref0 (d);
			}
		}
	}
	_tmp12_ = severity;
	result = _tmp12_;
	return result;
}


static void gcp_diagnostic_message_class_init (GcpDiagnosticMessageClass * klass) {
	gcp_diagnostic_message_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GcpDiagnosticMessagePrivate));
	GTK_WIDGET_CLASS (klass)->destroy = gcp_diagnostic_message_real_destroy;
	GTK_WIDGET_CLASS (klass)->style_updated = gcp_diagnostic_message_real_style_updated;
	GTK_WIDGET_CLASS (klass)->get_request_mode = gcp_diagnostic_message_real_get_request_mode;
	GTK_WIDGET_CLASS (klass)->get_preferred_width = gcp_diagnostic_message_real_get_preferred_width;
	GTK_WIDGET_CLASS (klass)->get_preferred_height_for_width = gcp_diagnostic_message_real_get_preferred_height_for_width;
	GTK_WIDGET_CLASS (klass)->draw = gcp_diagnostic_message_real_draw;
	G_OBJECT_CLASS (klass)->get_property = _vala_gcp_diagnostic_message_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gcp_diagnostic_message_set_property;
	G_OBJECT_CLASS (klass)->finalize = gcp_diagnostic_message_finalize;
}


static void gcp_diagnostic_message_instance_init (GcpDiagnosticMessage * self) {
	self->priv = GCP_DIAGNOSTIC_MESSAGE_GET_PRIVATE (self);
}


static void gcp_diagnostic_message_finalize (GObject* obj) {
	GcpDiagnosticMessage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCP_TYPE_DIAGNOSTIC_MESSAGE, GcpDiagnosticMessage);
	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);
	_gcp_diagnostic_colors_unref0 (self->priv->d_colors);
	G_OBJECT_CLASS (gcp_diagnostic_message_parent_class)->finalize (obj);
}


GType gcp_diagnostic_message_get_type (void) {
	static volatile gsize gcp_diagnostic_message_type_id__volatile = 0;
	if (g_once_init_enter (&gcp_diagnostic_message_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GcpDiagnosticMessageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gcp_diagnostic_message_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GcpDiagnosticMessage), 0, (GInstanceInitFunc) gcp_diagnostic_message_instance_init, NULL };
		GType gcp_diagnostic_message_type_id;
		gcp_diagnostic_message_type_id = g_type_register_static (GTK_TYPE_EVENT_BOX, "GcpDiagnosticMessage", &g_define_type_info, 0);
		g_once_init_leave (&gcp_diagnostic_message_type_id__volatile, gcp_diagnostic_message_type_id);
	}
	return gcp_diagnostic_message_type_id__volatile;
}


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


static void _vala_gcp_diagnostic_message_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GcpDiagnosticMessage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCP_TYPE_DIAGNOSTIC_MESSAGE, GcpDiagnosticMessage);
	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);
}



