/* math-history.c generated by valac 0.36.5, the Vala compiler
 * generated from math-history.vala, do not modify */

/*
 * Copyright (C) 2014 ELITA ASTRID ANGELINA LOBO
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
 * license.
*/

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


#define TYPE_HISTORY_VIEW (history_view_get_type ())
#define HISTORY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HISTORY_VIEW, HistoryView))
#define HISTORY_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HISTORY_VIEW, HistoryViewClass))
#define IS_HISTORY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HISTORY_VIEW))
#define IS_HISTORY_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HISTORY_VIEW))
#define HISTORY_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HISTORY_VIEW, HistoryViewClass))

typedef struct _HistoryView HistoryView;
typedef struct _HistoryViewClass HistoryViewClass;
typedef struct _HistoryViewPrivate HistoryViewPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TYPE_HISTORY_ENTRY (history_entry_get_type ())
#define HISTORY_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HISTORY_ENTRY, HistoryEntry))
#define HISTORY_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HISTORY_ENTRY, HistoryEntryClass))
#define IS_HISTORY_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HISTORY_ENTRY))
#define IS_HISTORY_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HISTORY_ENTRY))
#define HISTORY_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HISTORY_ENTRY, HistoryEntryClass))

typedef struct _HistoryEntry HistoryEntry;
typedef struct _HistoryEntryClass HistoryEntryClass;
enum  {
	HISTORY_VIEW_ANSWER_CLICKED_SIGNAL,
	HISTORY_VIEW_EQUATION_CLICKED_SIGNAL,
	HISTORY_VIEW_ROW_ADDED_SIGNAL,
	HISTORY_VIEW_LAST_SIGNAL
};
static guint history_view_signals[HISTORY_VIEW_LAST_SIGNAL] = {0};
typedef struct _HistoryEntryPrivate HistoryEntryPrivate;
enum  {
	HISTORY_ENTRY_ANSWER_CLICKED_SIGNAL,
	HISTORY_ENTRY_EQUATION_CLICKED_SIGNAL,
	HISTORY_ENTRY_LAST_SIGNAL
};
static guint history_entry_signals[HISTORY_ENTRY_LAST_SIGNAL] = {0};

struct _HistoryView {
	GtkScrolledWindow parent_instance;
	HistoryViewPrivate * priv;
};

struct _HistoryViewClass {
	GtkScrolledWindowClass parent_class;
};

struct _HistoryViewPrivate {
	gint no_ofitems;
	gchar* last_answer;
	gchar* last_equation;
	Serializer* serializer_four;
	Serializer* serializer_nine;
	GtkListBox* listbox;
};

struct _HistoryEntry {
	GtkListBoxRow parent_instance;
	HistoryEntryPrivate * priv;
};

struct _HistoryEntryClass {
	GtkListBoxRowClass parent_class;
};

struct _HistoryEntryPrivate {
	GtkLabel* equation_label;
	GtkLabel* answer_label;
};


static gpointer history_view_parent_class = NULL;
static gpointer history_entry_parent_class = NULL;

GType history_view_get_type (void) G_GNUC_CONST;
#define HISTORY_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_HISTORY_VIEW, HistoryViewPrivate))
enum  {
	HISTORY_VIEW_DUMMY_PROPERTY
};
void history_view_scroll_bottom (HistoryView* self);
static void _history_view_scroll_bottom_history_view_row_added (HistoryView* _sender, gpointer self);
void history_view_insert_entry (HistoryView* self, const gchar* equation, Number* answer, gint number_base, guint representation_base);
GType history_entry_get_type (void) G_GNUC_CONST;
HistoryEntry* history_entry_new (const gchar* equation, const gchar* answer_four_digits, const gchar* answer_nine_digits);
HistoryEntry* history_entry_construct (GType object_type, const gchar* equation, const gchar* answer_four_digits, const gchar* answer_nine_digits);
static void __lambda4_ (HistoryView* self, const gchar* ans);
static void ___lambda4__history_entry_answer_clicked (HistoryEntry* _sender, const gchar* ans, gpointer self);
static void __lambda5_ (HistoryView* self, const gchar* eq);
static void ___lambda5__history_entry_equation_clicked (HistoryEntry* _sender, const gchar* equation, gpointer self);
HistoryView* history_view_new (void);
HistoryView* history_view_construct (GType object_type);
static void history_view_finalize (GObject * obj);
#define HISTORY_ENTRY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_HISTORY_ENTRY, HistoryEntryPrivate))
enum  {
	HISTORY_ENTRY_DUMMY_PROPERTY
};
gboolean history_entry_answer_clicked_cb (HistoryEntry* self, GtkWidget* widget, GdkEventButton* eventbutton);
static gboolean _history_entry_answer_clicked_cb_gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self);
static gboolean history_entry_equation_clicked_cb (HistoryEntry* self, GtkWidget* widget, GdkEventButton* eventbutton);
static gboolean _history_entry_equation_clicked_cb_gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self);
static void history_entry_finalize (GObject * obj);


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


void history_view_scroll_bottom (HistoryView* self) {
	GtkAdjustment* adjustment = NULL;
	GtkListBox* _tmp0_;
	GtkAdjustment* _tmp1_;
	GtkAdjustment* _tmp2_;
	gint width = 0;
	gint height = 0;
	gint _tmp3_ = 0;
	gint _tmp4_ = 0;
	gdouble _tmp5_;
	gdouble _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->listbox;
	_tmp1_ = gtk_list_box_get_adjustment (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	adjustment = _tmp2_;
	gtk_widget_get_size_request ((GtkWidget*) self, &_tmp3_, &_tmp4_);
	width = _tmp3_;
	height = _tmp4_;
	gtk_adjustment_set_page_size (adjustment, (gdouble) (height / 3));
	_tmp5_ = gtk_adjustment_get_upper (adjustment);
	_tmp6_ = gtk_adjustment_get_page_size (adjustment);
	gtk_adjustment_set_value (adjustment, _tmp5_ - _tmp6_);
	_g_object_unref0 (adjustment);
}


static void _history_view_scroll_bottom_history_view_row_added (HistoryView* _sender, gpointer self) {
	history_view_scroll_bottom ((HistoryView*) self);
}


static void __lambda4_ (HistoryView* self, const gchar* ans) {
	const gchar* _tmp0_;
	g_return_if_fail (ans != NULL);
	_tmp0_ = ans;
	g_signal_emit (self, history_view_signals[HISTORY_VIEW_ANSWER_CLICKED_SIGNAL], 0, _tmp0_);
}


static void ___lambda4__history_entry_answer_clicked (HistoryEntry* _sender, const gchar* ans, gpointer self) {
	__lambda4_ ((HistoryView*) self, ans);
}


static void __lambda5_ (HistoryView* self, const gchar* eq) {
	const gchar* _tmp0_;
	g_return_if_fail (eq != NULL);
	_tmp0_ = eq;
	g_signal_emit (self, history_view_signals[HISTORY_VIEW_EQUATION_CLICKED_SIGNAL], 0, _tmp0_);
}


static void ___lambda5__history_entry_equation_clicked (HistoryEntry* _sender, const gchar* equation, gpointer self) {
	__lambda5_ ((HistoryView*) self, equation);
}


void history_view_insert_entry (HistoryView* self, const gchar* equation, Number* answer, gint number_base, guint representation_base) {
	Serializer* _tmp0_;
	gint _tmp1_;
	Serializer* _tmp2_;
	gint _tmp3_;
	Serializer* _tmp4_;
	guint _tmp5_;
	Serializer* _tmp6_;
	guint _tmp7_;
	gchar* answer_nine_digits = NULL;
	Serializer* _tmp8_;
	Number* _tmp9_;
	gchar* _tmp10_;
	gchar* answer_four_digits = NULL;
	Serializer* _tmp11_;
	Number* _tmp12_;
	gchar* _tmp13_;
	gboolean _tmp14_ = FALSE;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	HistoryEntry* entry = NULL;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	HistoryEntry* _tmp22_;
	GtkListBox* _tmp23_;
	HistoryEntry* _tmp24_;
	HistoryEntry* _tmp25_;
	gint _tmp26_;
	HistoryEntry* _tmp27_;
	HistoryEntry* _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	const gchar* _tmp31_;
	gchar* _tmp32_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (equation != NULL);
	g_return_if_fail (answer != NULL);
	_tmp0_ = self->priv->serializer_four;
	_tmp1_ = number_base;
	serializer_set_base (_tmp0_, _tmp1_);
	_tmp2_ = self->priv->serializer_nine;
	_tmp3_ = number_base;
	serializer_set_base (_tmp2_, _tmp3_);
	_tmp4_ = self->priv->serializer_four;
	_tmp5_ = representation_base;
	serializer_set_representation_base (_tmp4_, _tmp5_);
	_tmp6_ = self->priv->serializer_nine;
	_tmp7_ = representation_base;
	serializer_set_representation_base (_tmp6_, _tmp7_);
	_tmp8_ = self->priv->serializer_nine;
	_tmp9_ = answer;
	_tmp10_ = serializer_to_string (_tmp8_, _tmp9_);
	answer_nine_digits = _tmp10_;
	_tmp11_ = self->priv->serializer_four;
	_tmp12_ = answer;
	_tmp13_ = serializer_to_string (_tmp11_, _tmp12_);
	answer_four_digits = _tmp13_;
	_tmp15_ = self->priv->last_answer;
	_tmp16_ = answer_nine_digits;
	if (g_strcmp0 (_tmp15_, _tmp16_) == 0) {
		const gchar* _tmp17_;
		const gchar* _tmp18_;
		_tmp17_ = self->priv->last_equation;
		_tmp18_ = equation;
		_tmp14_ = g_strcmp0 (_tmp17_, _tmp18_) == 0;
	} else {
		_tmp14_ = FALSE;
	}
	if (_tmp14_) {
		_g_free0 (answer_four_digits);
		_g_free0 (answer_nine_digits);
		return;
	}
	_tmp19_ = equation;
	_tmp20_ = answer_four_digits;
	_tmp21_ = answer_nine_digits;
	_tmp22_ = history_entry_new (_tmp19_, _tmp20_, _tmp21_);
	g_object_ref_sink (_tmp22_);
	entry = _tmp22_;
	_tmp23_ = self->priv->listbox;
	_tmp24_ = entry;
	gtk_list_box_insert (_tmp23_, (GtkWidget*) _tmp24_, -1);
	_tmp25_ = entry;
	gtk_widget_show ((GtkWidget*) _tmp25_);
	_tmp26_ = self->priv->no_ofitems;
	self->priv->no_ofitems = _tmp26_ + 1;
	_tmp27_ = entry;
	g_signal_connect_object (_tmp27_, "answer-clicked", (GCallback) ___lambda4__history_entry_answer_clicked, self, 0);
	_tmp28_ = entry;
	g_signal_connect_object (_tmp28_, "equation-clicked", (GCallback) ___lambda5__history_entry_equation_clicked, self, 0);
	_tmp29_ = answer_nine_digits;
	_tmp30_ = g_strdup (_tmp29_);
	_g_free0 (self->priv->last_answer);
	self->priv->last_answer = _tmp30_;
	_tmp31_ = equation;
	_tmp32_ = g_strdup (_tmp31_);
	_g_free0 (self->priv->last_equation);
	self->priv->last_equation = _tmp32_;
	g_signal_emit (self, history_view_signals[HISTORY_VIEW_ROW_ADDED_SIGNAL], 0);
	_g_object_unref0 (entry);
	_g_free0 (answer_four_digits);
	_g_free0 (answer_nine_digits);
}


HistoryView* history_view_construct (GType object_type) {
	HistoryView * self = NULL;
	self = (HistoryView*) g_object_new (object_type, NULL);
	return self;
}


HistoryView* history_view_new (void) {
	return history_view_construct (TYPE_HISTORY_VIEW);
}


static void history_view_class_init (HistoryViewClass * klass) {
	gint HistoryView_private_offset;
	history_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (HistoryViewPrivate));
	G_OBJECT_CLASS (klass)->finalize = history_view_finalize;
	HistoryView_private_offset = g_type_class_get_instance_private_offset (klass);
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/calculator/history-view.ui");
	history_view_signals[HISTORY_VIEW_ANSWER_CLICKED_SIGNAL] = g_signal_new ("answer_clicked", TYPE_HISTORY_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
	history_view_signals[HISTORY_VIEW_EQUATION_CLICKED_SIGNAL] = g_signal_new ("equation_clicked", TYPE_HISTORY_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
	history_view_signals[HISTORY_VIEW_ROW_ADDED_SIGNAL] = g_signal_new ("row_added", TYPE_HISTORY_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "listbox", FALSE, HistoryView_private_offset + G_STRUCT_OFFSET (HistoryViewPrivate, listbox));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "scroll_bottom", G_CALLBACK(_history_view_scroll_bottom_history_view_row_added));
}


static void history_view_instance_init (HistoryView * self) {
	Serializer* _tmp0_;
	Serializer* _tmp1_;
	self->priv = HISTORY_VIEW_GET_PRIVATE (self);
	self->priv->no_ofitems = 0;
	self->priv->last_answer = NULL;
	self->priv->last_equation = NULL;
	_tmp0_ = serializer_new (DISPLAY_FORMAT_AUTOMATIC, 10, 4);
	self->priv->serializer_four = _tmp0_;
	_tmp1_ = serializer_new (DISPLAY_FORMAT_AUTOMATIC, 10, 9);
	self->priv->serializer_nine = _tmp1_;
	gtk_widget_init_template (GTK_WIDGET (self));
}


static void history_view_finalize (GObject * obj) {
	HistoryView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_HISTORY_VIEW, HistoryView);
	_g_free0 (self->priv->last_answer);
	_g_free0 (self->priv->last_equation);
	_g_object_unref0 (self->priv->serializer_four);
	_g_object_unref0 (self->priv->serializer_nine);
	_g_object_unref0 (self->priv->listbox);
	G_OBJECT_CLASS (history_view_parent_class)->finalize (obj);
}


GType history_view_get_type (void) {
	static volatile gsize history_view_type_id__volatile = 0;
	if (g_once_init_enter (&history_view_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (HistoryViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) history_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HistoryView), 0, (GInstanceInitFunc) history_view_instance_init, NULL };
		GType history_view_type_id;
		history_view_type_id = g_type_register_static (gtk_scrolled_window_get_type (), "HistoryView", &g_define_type_info, 0);
		g_once_init_leave (&history_view_type_id__volatile, history_view_type_id);
	}
	return history_view_type_id__volatile;
}


HistoryEntry* history_entry_construct (GType object_type, const gchar* equation, const gchar* answer_four_digits, const gchar* answer_nine_digits) {
	HistoryEntry * self = NULL;
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	GtkLabel* _tmp2_;
	const gchar* _tmp3_;
	GtkLabel* _tmp4_;
	const gchar* _tmp5_;
	GtkLabel* _tmp6_;
	const gchar* _tmp7_;
	g_return_val_if_fail (equation != NULL, NULL);
	g_return_val_if_fail (answer_four_digits != NULL, NULL);
	g_return_val_if_fail (answer_nine_digits != NULL, NULL);
	self = (HistoryEntry*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->equation_label;
	_tmp1_ = equation;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp0_, _tmp1_);
	_tmp2_ = self->priv->answer_label;
	_tmp3_ = answer_nine_digits;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp2_, _tmp3_);
	_tmp4_ = self->priv->equation_label;
	_tmp5_ = equation;
	gtk_label_set_text (_tmp4_, _tmp5_);
	_tmp6_ = self->priv->answer_label;
	_tmp7_ = answer_four_digits;
	gtk_label_set_text (_tmp6_, _tmp7_);
	return self;
}


HistoryEntry* history_entry_new (const gchar* equation, const gchar* answer_four_digits, const gchar* answer_nine_digits) {
	return history_entry_construct (TYPE_HISTORY_ENTRY, equation, answer_four_digits, answer_nine_digits);
}


gboolean history_entry_answer_clicked_cb (HistoryEntry* self, GtkWidget* widget, GdkEventButton* eventbutton) {
	gboolean result = FALSE;
	gchar* answer = NULL;
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (widget != NULL, FALSE);
	g_return_val_if_fail (eventbutton != NULL, FALSE);
	_tmp0_ = self->priv->answer_label;
	_tmp1_ = gtk_label_get_text (_tmp0_);
	_tmp2_ = g_strdup (_tmp1_);
	answer = _tmp2_;
	_tmp3_ = answer;
	if (_tmp3_ != NULL) {
		const gchar* _tmp4_;
		_tmp4_ = answer;
		g_signal_emit (self, history_entry_signals[HISTORY_ENTRY_ANSWER_CLICKED_SIGNAL], 0, _tmp4_);
	}
	result = TRUE;
	_g_free0 (answer);
	return result;
}


static gboolean _history_entry_answer_clicked_cb_gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self) {
	gboolean result;
	result = history_entry_answer_clicked_cb ((HistoryEntry*) self, _sender, event);
	return result;
}


static gboolean history_entry_equation_clicked_cb (HistoryEntry* self, GtkWidget* widget, GdkEventButton* eventbutton) {
	gboolean result = FALSE;
	gchar* equation = NULL;
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (widget != NULL, FALSE);
	g_return_val_if_fail (eventbutton != NULL, FALSE);
	_tmp0_ = self->priv->equation_label;
	_tmp1_ = gtk_label_get_text (_tmp0_);
	_tmp2_ = g_strdup (_tmp1_);
	equation = _tmp2_;
	_tmp3_ = equation;
	if (_tmp3_ != NULL) {
		const gchar* _tmp4_;
		_tmp4_ = equation;
		g_signal_emit (self, history_entry_signals[HISTORY_ENTRY_EQUATION_CLICKED_SIGNAL], 0, _tmp4_);
	}
	result = TRUE;
	_g_free0 (equation);
	return result;
}


static gboolean _history_entry_equation_clicked_cb_gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self) {
	gboolean result;
	result = history_entry_equation_clicked_cb ((HistoryEntry*) self, _sender, event);
	return result;
}


static void history_entry_class_init (HistoryEntryClass * klass) {
	gint HistoryEntry_private_offset;
	history_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (HistoryEntryPrivate));
	G_OBJECT_CLASS (klass)->finalize = history_entry_finalize;
	HistoryEntry_private_offset = g_type_class_get_instance_private_offset (klass);
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/calculator/history-entry.ui");
	history_entry_signals[HISTORY_ENTRY_ANSWER_CLICKED_SIGNAL] = g_signal_new ("answer_clicked", TYPE_HISTORY_ENTRY, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
	history_entry_signals[HISTORY_ENTRY_EQUATION_CLICKED_SIGNAL] = g_signal_new ("equation_clicked", TYPE_HISTORY_ENTRY, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "equation_label", FALSE, HistoryEntry_private_offset + G_STRUCT_OFFSET (HistoryEntryPrivate, equation_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "answer_label", FALSE, HistoryEntry_private_offset + G_STRUCT_OFFSET (HistoryEntryPrivate, answer_label));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "answer_clicked_cb", G_CALLBACK(_history_entry_answer_clicked_cb_gtk_widget_button_press_event));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "equation_clicked_cb", G_CALLBACK(_history_entry_equation_clicked_cb_gtk_widget_button_press_event));
}


static void history_entry_instance_init (HistoryEntry * self) {
	self->priv = HISTORY_ENTRY_GET_PRIVATE (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}


static void history_entry_finalize (GObject * obj) {
	HistoryEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_HISTORY_ENTRY, HistoryEntry);
	_g_object_unref0 (self->priv->equation_label);
	_g_object_unref0 (self->priv->answer_label);
	G_OBJECT_CLASS (history_entry_parent_class)->finalize (obj);
}


GType history_entry_get_type (void) {
	static volatile gsize history_entry_type_id__volatile = 0;
	if (g_once_init_enter (&history_entry_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (HistoryEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) history_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HistoryEntry), 0, (GInstanceInitFunc) history_entry_instance_init, NULL };
		GType history_entry_type_id;
		history_entry_type_id = g_type_register_static (gtk_list_box_row_get_type (), "HistoryEntry", &g_define_type_info, 0);
		g_once_init_leave (&history_entry_type_id__volatile, history_entry_type_id);
	}
	return history_entry_type_id__volatile;
}



