/* resource-graph.c generated by valac 0.36.1.38-6532, the Vala compiler
 * generated from resource-graph.vala, do not modify */

/* This file is part of GNOME Boxes. License: LGPLv2+*/

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


#define BOXES_TYPE_RESOURCE_GRAPH (boxes_resource_graph_get_type ())
#define BOXES_RESOURCE_GRAPH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_RESOURCE_GRAPH, BoxesResourceGraph))
#define BOXES_RESOURCE_GRAPH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_RESOURCE_GRAPH, BoxesResourceGraphClass))
#define BOXES_IS_RESOURCE_GRAPH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_RESOURCE_GRAPH))
#define BOXES_IS_RESOURCE_GRAPH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_RESOURCE_GRAPH))
#define BOXES_RESOURCE_GRAPH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_RESOURCE_GRAPH, BoxesResourceGraphClass))

typedef struct _BoxesResourceGraph BoxesResourceGraph;
typedef struct _BoxesResourceGraphClass BoxesResourceGraphClass;
typedef struct _BoxesResourceGraphPrivate BoxesResourceGraphPrivate;
enum  {
	BOXES_RESOURCE_GRAPH_DUMMY_PROPERTY,
	BOXES_RESOURCE_GRAPH_NPOINTS,
	BOXES_RESOURCE_GRAPH_YMAX,
	BOXES_RESOURCE_GRAPH_LAST_PROPERTY
};
static GParamSpec* boxes_resource_graph_properties[BOXES_RESOURCE_GRAPH_LAST_PROPERTY];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _BoxesResourceGraph {
	GtkDrawingArea parent_instance;
	BoxesResourceGraphPrivate * priv;
};

struct _BoxesResourceGraphClass {
	GtkDrawingAreaClass parent_class;
};

struct _BoxesResourceGraphPrivate {
	gdouble* _points;
	gint _points_length1;
	gint __points_size_;
	gint _npoints;
	gdouble _ymax;
};


static gpointer boxes_resource_graph_parent_class = NULL;

GType boxes_resource_graph_get_type (void) G_GNUC_CONST;
#define BOXES_RESOURCE_GRAPH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BOXES_TYPE_RESOURCE_GRAPH, BoxesResourceGraphPrivate))
BoxesResourceGraph* boxes_resource_graph_new (gdouble ymax);
BoxesResourceGraph* boxes_resource_graph_construct (GType object_type, gdouble ymax);
void boxes_resource_graph_set_ymax (BoxesResourceGraph* self, gdouble value);
static gboolean boxes_resource_graph_real_draw (GtkWidget* base, cairo_t* cr);
gint boxes_resource_graph_get_npoints (BoxesResourceGraph* self);
gdouble* boxes_resource_graph_get_points (BoxesResourceGraph* self, int* result_length1);
gdouble boxes_resource_graph_get_ymax (BoxesResourceGraph* self);
void boxes_resource_graph_set_points (BoxesResourceGraph* self, gdouble* value, int value_length1);
static gdouble* _vala_array_dup2 (gdouble* self, int length);
void boxes_resource_graph_set_npoints (BoxesResourceGraph* self, gint value);
static void boxes_resource_graph_finalize (GObject * obj);
static void _vala_boxes_resource_graph_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_boxes_resource_graph_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


BoxesResourceGraph* boxes_resource_graph_construct (GType object_type, gdouble ymax) {
	BoxesResourceGraph * self = NULL;
	gdouble _tmp0_;
#line 24 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	self = (BoxesResourceGraph*) g_object_new (object_type, NULL);
#line 25 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp0_ = ymax;
#line 25 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	boxes_resource_graph_set_ymax (self, _tmp0_);
#line 26 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	g_object_set ((GtkWidget*) self, "width-request", 120, NULL);
#line 27 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	g_object_set ((GtkWidget*) self, "height-request", 60, NULL);
#line 28 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	g_object_set ((GtkWidget*) self, "expand", TRUE, NULL);
#line 24 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	return self;
#line 89 "resource-graph.c"
}


BoxesResourceGraph* boxes_resource_graph_new (gdouble ymax) {
#line 24 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	return boxes_resource_graph_construct (BOXES_TYPE_RESOURCE_GRAPH, ymax);
#line 96 "resource-graph.c"
}


static gpointer _g_object_ref0 (gpointer self) {
#line 34 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	return self ? g_object_ref (self) : NULL;
#line 103 "resource-graph.c"
}


static gboolean boxes_resource_graph_real_draw (GtkWidget* base, cairo_t* cr) {
	BoxesResourceGraph * self;
	gboolean result = FALSE;
	gint width = 0;
	gint _tmp0_;
	gint height = 0;
	gint _tmp1_;
	GtkStyleContext* style = NULL;
	GtkStyleContext* _tmp2_;
	GtkStyleContext* _tmp3_;
	GtkStyleContext* _tmp4_;
	cairo_t* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gint _tmp8_ = 0;
	gint _tmp9_;
	gint nstep = 0;
	gdouble dy = 0.0;
	gdouble dx = 0.0;
	gint _tmp13_;
	gdouble _tmp16_;
	gdouble _tmp17_;
	GtkStyleContext* _tmp21_;
	GtkStyleContext* _tmp22_;
	cairo_t* _tmp23_;
	GtkStyleContext* _tmp24_;
	GtkStateFlags _tmp25_;
	GdkRGBA _tmp26_ = {0};
	GtkStyleContext* _tmp27_;
	gdouble x = 0.0;
	gdouble* _tmp28_;
	gint _tmp28__length1;
	gdouble* _tmp29_;
	gint _tmp29__length1;
	cairo_t* _tmp42_;
	gdouble _tmp43_;
	gdouble _tmp44_;
	gint _tmp45_;
	cairo_t* _tmp46_;
	gint _tmp47_;
	cairo_t* _tmp48_;
	cairo_t* _tmp49_;
	GtkStyleContext* _tmp50_;
	GtkStateFlags _tmp51_;
	GdkRGBA _tmp52_ = {0};
	cairo_t* _tmp53_;
	gdouble* _tmp54_;
	gint _tmp54__length1;
	gdouble* _tmp55_;
	gint _tmp55__length1;
	cairo_t* _tmp68_;
#line 31 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	self = (BoxesResourceGraph*) base;
#line 31 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	g_return_val_if_fail (cr != NULL, FALSE);
#line 32 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp0_ = gtk_widget_get_allocated_width ((GtkWidget*) self);
#line 32 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	width = _tmp0_;
#line 33 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp1_ = gtk_widget_get_allocated_height ((GtkWidget*) self);
#line 33 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	height = _tmp1_;
#line 34 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) self);
#line 34 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp3_ = _g_object_ref0 (_tmp2_);
#line 34 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	style = _tmp3_;
#line 36 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp4_ = style;
#line 36 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp5_ = cr;
#line 36 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp6_ = width;
#line 36 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp7_ = height;
#line 36 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_render_background (_tmp4_, _tmp5_, (gdouble) 0, (gdouble) 0, (gdouble) _tmp6_, (gdouble) _tmp7_);
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp9_ = self->priv->_npoints;
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	if (_tmp9_ == -1) {
#line 190 "resource-graph.c"
		gdouble* _tmp10_;
		gint _tmp10__length1;
		gdouble* _tmp11_;
		gint _tmp11__length1;
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp10_ = boxes_resource_graph_get_points (self, &_tmp10__length1);
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp11_ = _tmp10_;
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp11__length1 = _tmp10__length1;
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp8_ = _tmp11__length1;
#line 203 "resource-graph.c"
	} else {
		gint _tmp12_;
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp12_ = self->priv->_npoints;
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp8_ = _tmp12_;
#line 210 "resource-graph.c"
	}
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	nstep = _tmp8_ - 1;
#line 39 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	dy = 0.0;
#line 40 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	dx = 0.0;
#line 41 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp13_ = nstep;
#line 41 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	if (_tmp13_ != 0) {
#line 222 "resource-graph.c"
		gint _tmp14_;
		gint _tmp15_;
#line 42 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp14_ = width;
#line 42 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp15_ = nstep;
#line 42 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		dx = ((gdouble) _tmp14_) / _tmp15_;
#line 231 "resource-graph.c"
	}
#line 43 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp16_ = boxes_resource_graph_get_ymax (self);
#line 43 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp17_ = _tmp16_;
#line 43 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	if (_tmp17_ != ((gdouble) 0)) {
#line 239 "resource-graph.c"
		gint _tmp18_;
		gdouble _tmp19_;
		gdouble _tmp20_;
#line 44 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp18_ = height;
#line 44 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp19_ = boxes_resource_graph_get_ymax (self);
#line 44 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp20_ = _tmp19_;
#line 44 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		dy = ((gdouble) _tmp18_) / _tmp20_;
#line 251 "resource-graph.c"
	}
#line 46 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp21_ = style;
#line 46 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_style_context_save (_tmp21_);
#line 47 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp22_ = style;
#line 47 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_style_context_set_state (_tmp22_, GTK_STATE_FLAG_NORMAL);
#line 48 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp23_ = cr;
#line 48 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp24_ = style;
#line 48 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp25_ = gtk_widget_get_state_flags ((GtkWidget*) self);
#line 48 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_style_context_get_color (_tmp24_, _tmp25_, &_tmp26_);
#line 48 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gdk_cairo_set_source_rgba (_tmp23_, &_tmp26_);
#line 49 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp27_ = style;
#line 49 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_style_context_restore (_tmp27_);
#line 50 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	x = 0.0;
#line 51 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp28_ = boxes_resource_graph_get_points (self, &_tmp28__length1);
#line 51 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp29_ = _tmp28_;
#line 51 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp29__length1 = _tmp28__length1;
#line 283 "resource-graph.c"
	{
		gdouble* p_collection = NULL;
		gint p_collection_length1 = 0;
		gint _p_collection_size_ = 0;
		gint p_it = 0;
#line 51 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		p_collection = _tmp29_;
#line 51 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		p_collection_length1 = _tmp29__length1;
#line 51 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		for (p_it = 0; p_it < _tmp29__length1; p_it = p_it + 1) {
#line 295 "resource-graph.c"
			gdouble p = 0.0;
#line 51 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
			p = p_collection[p_it];
#line 299 "resource-graph.c"
			{
				gdouble y = 0.0;
				gint _tmp30_;
				gdouble _tmp31_;
				gdouble _tmp32_;
				gdouble _tmp33_;
				gdouble _tmp40_;
				gdouble _tmp41_;
#line 52 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp30_ = height;
#line 52 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp31_ = p;
#line 52 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp32_ = dy;
#line 52 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				y = _tmp30_ - (_tmp31_ * _tmp32_);
#line 53 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp33_ = x;
#line 53 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				if (_tmp33_ == 0.0) {
#line 320 "resource-graph.c"
					cairo_t* _tmp34_;
					gdouble _tmp35_;
					gdouble _tmp36_;
#line 54 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp34_ = cr;
#line 54 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp35_ = x;
#line 54 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp36_ = y;
#line 54 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					cairo_move_to (_tmp34_, _tmp35_, _tmp36_);
#line 332 "resource-graph.c"
				} else {
					cairo_t* _tmp37_;
					gdouble _tmp38_;
					gdouble _tmp39_;
#line 56 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp37_ = cr;
#line 56 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp38_ = x;
#line 56 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp39_ = y;
#line 56 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					cairo_line_to (_tmp37_, _tmp38_, _tmp39_);
#line 345 "resource-graph.c"
				}
#line 57 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp40_ = x;
#line 57 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp41_ = dx;
#line 57 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				x = _tmp40_ + _tmp41_;
#line 353 "resource-graph.c"
			}
		}
	}
#line 59 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp42_ = cr;
#line 59 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp43_ = x;
#line 59 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp44_ = dx;
#line 59 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp45_ = height;
#line 59 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	cairo_line_to (_tmp42_, _tmp43_ - _tmp44_, (gdouble) _tmp45_);
#line 60 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp46_ = cr;
#line 60 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp47_ = height;
#line 60 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	cairo_line_to (_tmp46_, (gdouble) 0, (gdouble) _tmp47_);
#line 61 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp48_ = cr;
#line 61 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	cairo_fill (_tmp48_);
#line 63 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp49_ = cr;
#line 63 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp50_ = style;
#line 63 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp51_ = gtk_widget_get_state_flags ((GtkWidget*) self);
#line 63 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_style_context_get_border_color (_tmp50_, _tmp51_, &_tmp52_);
#line 63 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gdk_cairo_set_source_rgba (_tmp49_, &_tmp52_);
#line 64 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp53_ = cr;
#line 64 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	cairo_set_line_width (_tmp53_, 1.0);
#line 65 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	x = 0.0;
#line 66 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp54_ = boxes_resource_graph_get_points (self, &_tmp54__length1);
#line 66 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp55_ = _tmp54_;
#line 66 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp55__length1 = _tmp54__length1;
#line 399 "resource-graph.c"
	{
		gdouble* p_collection = NULL;
		gint p_collection_length1 = 0;
		gint _p_collection_size_ = 0;
		gint p_it = 0;
#line 66 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		p_collection = _tmp55_;
#line 66 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		p_collection_length1 = _tmp55__length1;
#line 66 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		for (p_it = 0; p_it < _tmp55__length1; p_it = p_it + 1) {
#line 411 "resource-graph.c"
			gdouble p = 0.0;
#line 66 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
			p = p_collection[p_it];
#line 415 "resource-graph.c"
			{
				gdouble y = 0.0;
				gint _tmp56_;
				gdouble _tmp57_;
				gdouble _tmp58_;
				gdouble _tmp59_;
				gdouble _tmp66_;
				gdouble _tmp67_;
#line 67 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp56_ = height;
#line 67 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp57_ = p;
#line 67 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp58_ = dy;
#line 67 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				y = _tmp56_ - (_tmp57_ * _tmp58_);
#line 69 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp59_ = x;
#line 69 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				if (_tmp59_ == 0.0) {
#line 436 "resource-graph.c"
					cairo_t* _tmp60_;
					gdouble _tmp61_;
					gdouble _tmp62_;
#line 70 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp60_ = cr;
#line 70 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp61_ = x;
#line 70 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp62_ = y;
#line 70 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					cairo_move_to (_tmp60_, _tmp61_, _tmp62_);
#line 448 "resource-graph.c"
				} else {
					cairo_t* _tmp63_;
					gdouble _tmp64_;
					gdouble _tmp65_;
#line 72 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp63_ = cr;
#line 72 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp64_ = x;
#line 72 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp65_ = y;
#line 72 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					cairo_line_to (_tmp63_, _tmp64_, _tmp65_);
#line 461 "resource-graph.c"
				}
#line 73 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp66_ = x;
#line 73 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp67_ = dx;
#line 73 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				x = _tmp66_ + _tmp67_;
#line 469 "resource-graph.c"
			}
		}
	}
#line 75 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp68_ = cr;
#line 75 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	cairo_stroke (_tmp68_);
#line 77 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	result = TRUE;
#line 77 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_g_object_unref0 (style);
#line 77 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	return result;
#line 483 "resource-graph.c"
}


gdouble* boxes_resource_graph_get_points (BoxesResourceGraph* self, int* result_length1) {
	gdouble* result;
	gdouble* _tmp0_;
	gint _tmp0__length1;
	gdouble* _tmp1_;
	gint _tmp1__length1;
#line 6 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 6 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp0_ = self->priv->_points;
#line 6 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp0__length1 = self->priv->_points_length1;
#line 6 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp1_ = _tmp0_;
#line 6 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp1__length1 = _tmp0__length1;
#line 6 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	if (result_length1) {
#line 6 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		*result_length1 = _tmp1__length1;
#line 507 "resource-graph.c"
	}
#line 6 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	result = _tmp1_;
#line 6 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	return result;
#line 513 "resource-graph.c"
}


static gdouble* _vala_array_dup2 (gdouble* self, int length) {
#line 11 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	return g_memdup (self, length * sizeof (gdouble));
#line 520 "resource-graph.c"
}


void boxes_resource_graph_set_points (BoxesResourceGraph* self, gdouble* value, int value_length1) {
	gdouble* _tmp0_;
	gint _tmp0__length1;
	gdouble* _tmp1_;
	gint _tmp1__length1;
	gdouble _tmp2_;
	gdouble _tmp3_;
	gdouble _tmp4_;
	gdouble* _tmp8_;
	gint _tmp8__length1;
	gdouble* _tmp9_;
	gint _tmp9__length1;
#line 7 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	g_return_if_fail (self != NULL);
#line 8 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp0_ = value;
#line 8 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp0__length1 = value_length1;
#line 8 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp1_ = value;
#line 8 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp1__length1 = value_length1;
#line 8 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp2_ = _tmp0_[_tmp1__length1 - 1];
#line 8 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp3_ = boxes_resource_graph_get_ymax (self);
#line 8 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp4_ = _tmp3_;
#line 8 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	if (_tmp2_ > _tmp4_) {
#line 554 "resource-graph.c"
		gdouble* _tmp5_;
		gint _tmp5__length1;
		gdouble* _tmp6_;
		gint _tmp6__length1;
		gdouble _tmp7_;
#line 9 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp5_ = value;
#line 9 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp5__length1 = value_length1;
#line 9 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp6_ = value;
#line 9 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp6__length1 = value_length1;
#line 9 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp7_ = _tmp5_[_tmp6__length1 - 1];
#line 9 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		boxes_resource_graph_set_ymax (self, _tmp7_);
#line 572 "resource-graph.c"
	}
#line 11 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp8_ = value;
#line 11 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp8__length1 = value_length1;
#line 11 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp9_ = (_tmp8_ != NULL) ? _vala_array_dup2 (_tmp8_, _tmp8__length1) : ((gpointer) _tmp8_);
#line 11 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp9__length1 = _tmp8__length1;
#line 11 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	self->priv->_points = (g_free (self->priv->_points), NULL);
#line 11 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	self->priv->_points = _tmp9_;
#line 11 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	self->priv->_points_length1 = _tmp9__length1;
#line 11 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	self->priv->__points_size_ = self->priv->_points_length1;
#line 12 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_widget_queue_draw ((GtkWidget*) self);
#line 592 "resource-graph.c"
}


gint boxes_resource_graph_get_npoints (BoxesResourceGraph* self) {
	gint result;
	gint _tmp0_;
#line 15 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	g_return_val_if_fail (self != NULL, 0);
#line 15 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp0_ = self->priv->_npoints;
#line 15 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	result = _tmp0_;
#line 15 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	return result;
#line 607 "resource-graph.c"
}


void boxes_resource_graph_set_npoints (BoxesResourceGraph* self, gint value) {
#line 15 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	g_return_if_fail (self != NULL);
#line 15 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	if (boxes_resource_graph_get_npoints (self) != value) {
#line 616 "resource-graph.c"
		gint _tmp0_;
#line 15 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp0_ = value;
#line 15 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		self->priv->_npoints = _tmp0_;
#line 15 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		g_object_notify_by_pspec ((GObject *) self, boxes_resource_graph_properties[BOXES_RESOURCE_GRAPH_NPOINTS]);
#line 624 "resource-graph.c"
	}
}


gdouble boxes_resource_graph_get_ymax (BoxesResourceGraph* self) {
	gdouble result;
	gdouble _tmp0_;
#line 18 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	g_return_val_if_fail (self != NULL, 0.0);
#line 18 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp0_ = self->priv->_ymax;
#line 18 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	result = _tmp0_;
#line 18 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	return result;
#line 640 "resource-graph.c"
}


void boxes_resource_graph_set_ymax (BoxesResourceGraph* self, gdouble value) {
	gdouble _tmp0_;
#line 19 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	g_return_if_fail (self != NULL);
#line 20 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp0_ = value;
#line 20 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	self->priv->_ymax = _tmp0_;
#line 19 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	g_object_notify_by_pspec ((GObject *) self, boxes_resource_graph_properties[BOXES_RESOURCE_GRAPH_YMAX]);
#line 654 "resource-graph.c"
}


static void boxes_resource_graph_class_init (BoxesResourceGraphClass * klass) {
	gint BoxesResourceGraph_private_offset;
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	boxes_resource_graph_parent_class = g_type_class_peek_parent (klass);
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	g_type_class_add_private (klass, sizeof (BoxesResourceGraphPrivate));
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	((GtkWidgetClass *) klass)->draw = (gboolean (*) (GtkWidget *, cairo_t*)) boxes_resource_graph_real_draw;
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_boxes_resource_graph_get_property;
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	G_OBJECT_CLASS (klass)->set_property = _vala_boxes_resource_graph_set_property;
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	G_OBJECT_CLASS (klass)->finalize = boxes_resource_graph_finalize;
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_RESOURCE_GRAPH_NPOINTS, boxes_resource_graph_properties[BOXES_RESOURCE_GRAPH_NPOINTS] = g_param_spec_int ("npoints", "npoints", "npoints", G_MININT, G_MAXINT, -1, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_RESOURCE_GRAPH_YMAX, boxes_resource_graph_properties[BOXES_RESOURCE_GRAPH_YMAX] = g_param_spec_double ("ymax", "ymax", "ymax", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	BoxesResourceGraph_private_offset = g_type_class_get_instance_private_offset (klass);
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Boxes/ui/resource-graph.ui");
#line 680 "resource-graph.c"
}


static void boxes_resource_graph_instance_init (BoxesResourceGraph * self) {
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	self->priv = BOXES_RESOURCE_GRAPH_GET_PRIVATE (self);
#line 15 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	self->priv->_npoints = -1;
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_widget_init_template (GTK_WIDGET (self));
#line 691 "resource-graph.c"
}


static void boxes_resource_graph_finalize (GObject * obj) {
	BoxesResourceGraph * self;
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_RESOURCE_GRAPH, BoxesResourceGraph);
#line 5 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	self->priv->_points = (g_free (self->priv->_points), NULL);
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	G_OBJECT_CLASS (boxes_resource_graph_parent_class)->finalize (obj);
#line 703 "resource-graph.c"
}


GType boxes_resource_graph_get_type (void) {
	static volatile gsize boxes_resource_graph_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_resource_graph_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BoxesResourceGraphClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_resource_graph_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesResourceGraph), 0, (GInstanceInitFunc) boxes_resource_graph_instance_init, NULL };
		GType boxes_resource_graph_type_id;
		boxes_resource_graph_type_id = g_type_register_static (gtk_drawing_area_get_type (), "BoxesResourceGraph", &g_define_type_info, 0);
		g_once_init_leave (&boxes_resource_graph_type_id__volatile, boxes_resource_graph_type_id);
	}
	return boxes_resource_graph_type_id__volatile;
}


static void _vala_boxes_resource_graph_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	BoxesResourceGraph * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_RESOURCE_GRAPH, BoxesResourceGraph);
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	switch (property_id) {
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		case BOXES_RESOURCE_GRAPH_NPOINTS:
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		g_value_set_int (value, boxes_resource_graph_get_npoints (self));
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		break;
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		case BOXES_RESOURCE_GRAPH_YMAX:
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		g_value_set_double (value, boxes_resource_graph_get_ymax (self));
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		break;
#line 736 "resource-graph.c"
		default:
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		break;
#line 742 "resource-graph.c"
	}
}


static void _vala_boxes_resource_graph_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	BoxesResourceGraph * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_RESOURCE_GRAPH, BoxesResourceGraph);
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	switch (property_id) {
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		case BOXES_RESOURCE_GRAPH_NPOINTS:
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		boxes_resource_graph_set_npoints (self, g_value_get_int (value));
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		break;
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		case BOXES_RESOURCE_GRAPH_YMAX:
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		boxes_resource_graph_set_ymax (self, g_value_get_double (value));
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		break;
#line 764 "resource-graph.c"
		default:
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 4 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		break;
#line 770 "resource-graph.c"
	}
}



