/* listview.c generated by valac 0.25.2, the Vala compiler
 * generated from listview.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <stdio.h>

typedef struct _Block1Data Block1Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _Block1Data {
	int _ref_count_;
	GtkTreeView* view;
};



gint _vala_main (gchar** args, int args_length1);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void _gtk_main_quit_gtk_widget_destroy (GtkWidget* _sender, gpointer self);
static void __lambda4_ (Block1Data* _data1_);
static void ___lambda4__gtk_button_clicked (GtkButton* _sender, gpointer self);


static Block1Data* block1_data_ref (Block1Data* _data1_) {
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}


static void block1_data_unref (void * _userdata_) {
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		_g_object_unref0 (_data1_->view);
		g_slice_free (Block1Data, _data1_);
	}
}


static void _gtk_main_quit_gtk_widget_destroy (GtkWidget* _sender, gpointer self) {
	gtk_main_quit ();
}


static void __lambda4_ (Block1Data* _data1_) {
	GtkAdjustment* _tmp0_ = NULL;
	GtkAdjustment* _tmp1_ = NULL;
	GtkAdjustment* _tmp2_ = NULL;
	gdouble _tmp3_ = 0.0;
	gdouble _tmp4_ = 0.0;
	gboolean _tmp5_ = FALSE;
	_tmp0_ = gtk_scrollable_get_vadjustment ((GtkScrollable*) _data1_->view);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gtk_adjustment_get_value (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ == 0.0;
	_g_object_unref0 (_tmp2_);
	if (_tmp5_) {
		FILE* _tmp6_ = NULL;
		_tmp6_ = stdout;
		fprintf (_tmp6_, "At top\n");
	} else {
		FILE* _tmp7_ = NULL;
		_tmp7_ = stdout;
		fprintf (_tmp7_, "Not at top\n");
	}
}


static void ___lambda4__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__lambda4_ (self);
}


gint _vala_main (gchar** args, int args_length1) {
	gint result = 0;
	Block1Data* _data1_;
	GtkWindow* window = NULL;
	GtkWindow* _tmp0_ = NULL;
	GtkWindow* _tmp1_ = NULL;
	GtkWindow* _tmp2_ = NULL;
	GtkListStore* store = NULL;
	GtkListStore* _tmp3_ = NULL;
	GtkTreeIter iter = {0};
	GtkListStore* _tmp16_ = NULL;
	GtkTreeView* _tmp17_ = NULL;
	GtkCellRendererText* renderer = NULL;
	GtkCellRendererText* _tmp18_ = NULL;
	GtkTreeViewColumn* column = NULL;
	GtkTreeViewColumn* _tmp19_ = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp20_ = NULL;
	GtkScrolledWindow* sw = NULL;
	GtkScrolledWindow* _tmp21_ = NULL;
	GtkButton* button = NULL;
	GtkButton* _tmp22_ = NULL;
	GtkWindow* _tmp23_ = NULL;
	GtkWindow* _tmp24_ = NULL;
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	gtk_init (&args_length1, &args);
	_tmp0_ = (GtkWindow*) gtk_window_new (GTK_WINDOW_TOPLEVEL);
	g_object_ref_sink (_tmp0_);
	window = _tmp0_;
	_tmp1_ = window;
	gtk_window_set_default_size (_tmp1_, 200, 200);
	_tmp2_ = window;
	g_signal_connect ((GtkWidget*) _tmp2_, "destroy", (GCallback) _gtk_main_quit_gtk_widget_destroy, NULL);
	_tmp3_ = gtk_list_store_new (1, G_TYPE_STRING, -1);
	store = _tmp3_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp4_ = FALSE;
			_tmp4_ = TRUE;
			while (TRUE) {
				gint _tmp6_ = 0;
				GtkListStore* _tmp7_ = NULL;
				GtkTreeIter _tmp8_ = {0};
				GtkListStore* _tmp9_ = NULL;
				GtkTreeIter _tmp10_ = {0};
				gint _tmp11_ = 0;
				gchar* _tmp12_ = NULL;
				gchar* _tmp13_ = NULL;
				gchar* _tmp14_ = NULL;
				GValue _tmp15_ = {0};
				if (!_tmp4_) {
					gint _tmp5_ = 0;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				_tmp6_ = i;
				if (!(_tmp6_ < 15)) {
					break;
				}
				_tmp7_ = store;
				gtk_list_store_append (_tmp7_, &_tmp8_);
				iter = _tmp8_;
				_tmp9_ = store;
				_tmp10_ = iter;
				_tmp11_ = i;
				_tmp12_ = g_strdup_printf ("%i", _tmp11_);
				_tmp13_ = _tmp12_;
				_tmp14_ = g_strconcat ("Hello ", _tmp13_, NULL);
				g_value_init (&_tmp15_, G_TYPE_STRING);
				g_value_take_string (&_tmp15_, _tmp14_);
				gtk_list_store_set_value (_tmp9_, &_tmp10_, 0, &_tmp15_);
				G_IS_VALUE (&_tmp15_) ? (g_value_unset (&_tmp15_), NULL) : NULL;
				_g_free0 (_tmp13_);
			}
		}
	}
	_tmp16_ = store;
	_tmp17_ = (GtkTreeView*) gtk_tree_view_new_with_model ((GtkTreeModel*) _tmp16_);
	g_object_ref_sink (_tmp17_);
	_data1_->view = _tmp17_;
	_tmp18_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp18_);
	renderer = _tmp18_;
	_tmp19_ = gtk_tree_view_column_new_with_attributes ("Hi", (GtkCellRenderer*) renderer, "text", 0, NULL);
	g_object_ref_sink (_tmp19_);
	column = _tmp19_;
	gtk_tree_view_append_column (_data1_->view, column);
	_tmp20_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp20_);
	box = _tmp20_;
	_tmp21_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	g_object_ref_sink (_tmp21_);
	sw = _tmp21_;
	gtk_container_add ((GtkContainer*) sw, (GtkWidget*) _data1_->view);
	gtk_box_pack_start (box, (GtkWidget*) sw, TRUE, TRUE, (guint) 0);
	_tmp22_ = (GtkButton*) gtk_button_new_with_label ("Adjustment loc");
	g_object_ref_sink (_tmp22_);
	button = _tmp22_;
	g_signal_connect_data (button, "clicked", (GCallback) ___lambda4__gtk_button_clicked, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
	gtk_box_pack_start (box, (GtkWidget*) button, FALSE, FALSE, (guint) 0);
	_tmp23_ = window;
	gtk_container_add ((GtkContainer*) _tmp23_, (GtkWidget*) box);
	_tmp24_ = window;
	gtk_widget_show_all ((GtkWidget*) _tmp24_);
	gtk_main ();
	result = 0;
	_g_object_unref0 (button);
	_g_object_unref0 (sw);
	_g_object_unref0 (box);
	_g_object_unref0 (column);
	_g_object_unref0 (renderer);
	_g_object_unref0 (store);
	_g_object_unref0 (window);
	block1_data_unref (_data1_);
	_data1_ = NULL;
	return result;
}


int main (int argc, char ** argv) {
#if !GLIB_CHECK_VERSION (2,35,0)
	g_type_init ();
#endif
	return _vala_main (argv, argc);
}



