/* resource-graph.c generated by valac 0.39.5, 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_0_PROPERTY,
	BOXES_RESOURCE_GRAPH_NPOINTS_PROPERTY,
	BOXES_RESOURCE_GRAPH_YMAX_PROPERTY,
	BOXES_RESOURCE_GRAPH_NUM_PROPERTIES
};
static GParamSpec* boxes_resource_graph_properties[BOXES_RESOURCE_GRAPH_NUM_PROPERTIES];
#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;
#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"
	boxes_resource_graph_set_ymax (self, ymax);
#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 103 "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 112 "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 121 "resource-graph.c"
}


static gboolean
boxes_resource_graph_real_draw (GtkWidget* base,
                                cairo_t* cr)
{
	BoxesResourceGraph * self;
	gboolean result = FALSE;
	gint width = 0;
	gint height = 0;
	GtkStyleContext* style = NULL;
	GtkStyleContext* _tmp0_;
	GtkStyleContext* _tmp1_;
	GtkStyleContext* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint _tmp5_ = 0;
	gint _tmp6_;
	gint nstep = 0;
	gdouble dy = 0.0;
	gdouble dx = 0.0;
	gint _tmp10_;
	gdouble _tmp13_;
	gdouble _tmp14_;
	GtkStyleContext* _tmp18_;
	GtkStyleContext* _tmp19_;
	GtkStyleContext* _tmp20_;
	GdkRGBA _tmp21_ = {0};
	GtkStyleContext* _tmp22_;
	gdouble x = 0.0;
	gdouble* _tmp23_;
	gint _tmp23__length1;
	gdouble* _tmp24_;
	gint _tmp24__length1;
	gdouble _tmp35_;
	gdouble _tmp36_;
	gint _tmp37_;
	gint _tmp38_;
	GtkStyleContext* _tmp39_;
	GdkRGBA _tmp40_ = {0};
	gdouble* _tmp41_;
	gint _tmp41__length1;
	gdouble* _tmp42_;
	gint _tmp42__length1;
#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"
	width = gtk_widget_get_allocated_width ((GtkWidget*) self);
#line 33 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	height = gtk_widget_get_allocated_height ((GtkWidget*) self);
#line 34 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp0_ = gtk_widget_get_style_context ((GtkWidget*) self);
#line 34 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp1_ = _g_object_ref0 (_tmp0_);
#line 34 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	style = _tmp1_;
#line 36 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp2_ = style;
#line 36 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp3_ = width;
#line 36 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp4_ = height;
#line 36 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_render_background (_tmp2_, cr, (gdouble) 0, (gdouble) 0, (gdouble) _tmp3_, (gdouble) _tmp4_);
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp6_ = self->priv->_npoints;
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	if (_tmp6_ == -1) {
#line 193 "resource-graph.c"
		gdouble* _tmp7_;
		gint _tmp7__length1;
		gdouble* _tmp8_;
		gint _tmp8__length1;
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp7_ = boxes_resource_graph_get_points (self, &_tmp7__length1);
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp8_ = _tmp7_;
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp8__length1 = _tmp7__length1;
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp5_ = _tmp8__length1;
#line 206 "resource-graph.c"
	} else {
		gint _tmp9_;
#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"
		_tmp5_ = _tmp9_;
#line 213 "resource-graph.c"
	}
#line 38 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	nstep = _tmp5_ - 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"
	_tmp10_ = nstep;
#line 41 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	if (_tmp10_ != 0) {
#line 225 "resource-graph.c"
		gint _tmp11_;
		gint _tmp12_;
#line 42 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp11_ = width;
#line 42 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp12_ = nstep;
#line 42 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		dx = ((gdouble) _tmp11_) / _tmp12_;
#line 234 "resource-graph.c"
	}
#line 43 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp13_ = boxes_resource_graph_get_ymax (self);
#line 43 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp14_ = _tmp13_;
#line 43 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	if (_tmp14_ != ((gdouble) 0)) {
#line 242 "resource-graph.c"
		gint _tmp15_;
		gdouble _tmp16_;
		gdouble _tmp17_;
#line 44 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp15_ = height;
#line 44 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp16_ = boxes_resource_graph_get_ymax (self);
#line 44 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp17_ = _tmp16_;
#line 44 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		dy = ((gdouble) _tmp15_) / _tmp17_;
#line 254 "resource-graph.c"
	}
#line 46 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp18_ = style;
#line 46 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_style_context_save (_tmp18_);
#line 47 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp19_ = style;
#line 47 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_style_context_set_state (_tmp19_, GTK_STATE_FLAG_NORMAL);
#line 48 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp20_ = style;
#line 48 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_style_context_get_color (_tmp20_, gtk_widget_get_state_flags ((GtkWidget*) self), &_tmp21_);
#line 48 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gdk_cairo_set_source_rgba (cr, &_tmp21_);
#line 49 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp22_ = style;
#line 49 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_style_context_restore (_tmp22_);
#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"
	_tmp23_ = boxes_resource_graph_get_points (self, &_tmp23__length1);
#line 51 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp24_ = _tmp23_;
#line 51 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp24__length1 = _tmp23__length1;
#line 282 "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 = _tmp24_;
#line 51 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		p_collection_length1 = _tmp24__length1;
#line 51 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		for (p_it = 0; p_it < _tmp24__length1; p_it = p_it + 1) {
#line 294 "resource-graph.c"
			gdouble p = 0.0;
#line 51 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
			p = p_collection[p_it];
#line 298 "resource-graph.c"
			{
				gdouble y = 0.0;
				gint _tmp25_;
				gdouble _tmp26_;
				gdouble _tmp27_;
				gdouble _tmp28_;
				gdouble _tmp33_;
				gdouble _tmp34_;
#line 52 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp25_ = height;
#line 52 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp26_ = p;
#line 52 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp27_ = dy;
#line 52 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				y = _tmp25_ - (_tmp26_ * _tmp27_);
#line 53 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp28_ = x;
#line 53 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				if (_tmp28_ == 0.0) {
#line 319 "resource-graph.c"
					gdouble _tmp29_;
					gdouble _tmp30_;
#line 54 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp29_ = x;
#line 54 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp30_ = y;
#line 54 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					cairo_move_to (cr, _tmp29_, _tmp30_);
#line 328 "resource-graph.c"
				} else {
					gdouble _tmp31_;
					gdouble _tmp32_;
#line 56 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp31_ = x;
#line 56 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp32_ = y;
#line 56 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					cairo_line_to (cr, _tmp31_, _tmp32_);
#line 338 "resource-graph.c"
				}
#line 57 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp33_ = x;
#line 57 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp34_ = dx;
#line 57 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				x = _tmp33_ + _tmp34_;
#line 346 "resource-graph.c"
			}
		}
	}
#line 59 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp35_ = x;
#line 59 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp36_ = dx;
#line 59 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp37_ = height;
#line 59 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	cairo_line_to (cr, _tmp35_ - _tmp36_, (gdouble) _tmp37_);
#line 60 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp38_ = height;
#line 60 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	cairo_line_to (cr, (gdouble) 0, (gdouble) _tmp38_);
#line 61 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	cairo_fill (cr);
#line 63 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp39_ = style;
#line 63 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gtk_style_context_get_border_color (_tmp39_, gtk_widget_get_state_flags ((GtkWidget*) self), &_tmp40_);
#line 63 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	gdk_cairo_set_source_rgba (cr, &_tmp40_);
#line 64 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	cairo_set_line_width (cr, 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"
	_tmp41_ = boxes_resource_graph_get_points (self, &_tmp41__length1);
#line 66 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp42_ = _tmp41_;
#line 66 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp42__length1 = _tmp41__length1;
#line 380 "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 = _tmp42_;
#line 66 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		p_collection_length1 = _tmp42__length1;
#line 66 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		for (p_it = 0; p_it < _tmp42__length1; p_it = p_it + 1) {
#line 392 "resource-graph.c"
			gdouble p = 0.0;
#line 66 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
			p = p_collection[p_it];
#line 396 "resource-graph.c"
			{
				gdouble y = 0.0;
				gint _tmp43_;
				gdouble _tmp44_;
				gdouble _tmp45_;
				gdouble _tmp46_;
				gdouble _tmp51_;
				gdouble _tmp52_;
#line 67 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp43_ = height;
#line 67 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp44_ = p;
#line 67 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp45_ = dy;
#line 67 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				y = _tmp43_ - (_tmp44_ * _tmp45_);
#line 69 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp46_ = x;
#line 69 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				if (_tmp46_ == 0.0) {
#line 417 "resource-graph.c"
					gdouble _tmp47_;
					gdouble _tmp48_;
#line 70 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp47_ = x;
#line 70 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp48_ = y;
#line 70 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					cairo_move_to (cr, _tmp47_, _tmp48_);
#line 426 "resource-graph.c"
				} else {
					gdouble _tmp49_;
					gdouble _tmp50_;
#line 72 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp49_ = x;
#line 72 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					_tmp50_ = y;
#line 72 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
					cairo_line_to (cr, _tmp49_, _tmp50_);
#line 436 "resource-graph.c"
				}
#line 73 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp51_ = x;
#line 73 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				_tmp52_ = dx;
#line 73 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
				x = _tmp51_ + _tmp52_;
#line 444 "resource-graph.c"
			}
		}
	}
#line 75 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	cairo_stroke (cr);
#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 456 "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 483 "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 489 "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 499 "resource-graph.c"
}


void
boxes_resource_graph_set_points (BoxesResourceGraph* self,
                                 gdouble* value,
                                 int value_length1)
{
	gdouble _tmp0_;
	gdouble _tmp1_;
	gdouble _tmp2_;
	gdouble* _tmp4_;
	gint _tmp4__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[value_length1 - 1];
#line 8 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp1_ = boxes_resource_graph_get_ymax (self);
#line 8 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp2_ = _tmp1_;
#line 8 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	if (_tmp0_ > _tmp2_) {
#line 523 "resource-graph.c"
		gdouble _tmp3_;
#line 9 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		_tmp3_ = value[value_length1 - 1];
#line 9 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		boxes_resource_graph_set_ymax (self, _tmp3_);
#line 529 "resource-graph.c"
	}
#line 11 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp4_ = (value != NULL) ? _vala_array_dup2 (value, value_length1) : ((gpointer) value);
#line 11 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	_tmp4__length1 = value_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 = _tmp4_;
#line 11 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
	self->priv->_points_length1 = _tmp4__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 545 "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 562 "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 15 "/home/fborges/checkout/gnome-boxes/src/resource-graph.vala"
		self->priv->_npoints = value;
#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_PROPERTY]);
#line 578 "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 596 "resource-graph.c"
}


void
boxes_resource_graph_set_ymax (BoxesResourceGraph* self,
                               gdouble value)
{
#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"
	self->priv->_ymax = value;
#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_PROPERTY]);
#line 610 "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_PROPERTY, boxes_resource_graph_properties[BOXES_RESOURCE_GRAPH_NPOINTS_PROPERTY] = 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_PROPERTY, boxes_resource_graph_properties[BOXES_RESOURCE_GRAPH_YMAX_PROPERTY] = 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 638 "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 651 "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 665 "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_PROPERTY:
#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_PROPERTY:
#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 705 "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 711 "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_PROPERTY:
#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_PROPERTY:
#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 738 "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 744 "resource-graph.c"
	}
}



