/* gitg-sidebar.c generated by valac 0.56.19, the Vala compiler
 * generated from gitg-sidebar.vala, do not modify */

/*
 * This file is part of gitg
 *
 * Copyright (C) 2013 - Jesse van den Kieboom
 *
 * gitg 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 2 of the License, or
 * (at your option) any later version.
 *
 * gitg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with gitg. If not, see <http://www.gnu.org/licenses/>.
 */

#include "libgitg.h"
#include <glib.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include <gdk/gdk.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	GITG_SIDEBAR_ITEM_ACTIVATED_SIGNAL,
	GITG_SIDEBAR_ITEM_NUM_SIGNALS
};
static guint gitg_sidebar_item_signals[GITG_SIDEBAR_ITEM_NUM_SIGNALS] = {0};
enum  {
	GITG_SIDEBAR_STORE_0_PROPERTY,
	GITG_SIDEBAR_STORE_CLEARING_PROPERTY,
	GITG_SIDEBAR_STORE_NUM_PROPERTIES
};
static GParamSpec* gitg_sidebar_store_properties[GITG_SIDEBAR_STORE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	GITG_SIDEBAR_STORE_SIDEBAR_TEXT_0_PROPERTY,
	GITG_SIDEBAR_STORE_SIDEBAR_TEXT_TEXT_PROPERTY,
	GITG_SIDEBAR_STORE_SIDEBAR_TEXT_ICON_NAME_PROPERTY,
	GITG_SIDEBAR_STORE_SIDEBAR_TEXT_NUM_PROPERTIES
};
static GParamSpec* gitg_sidebar_store_sidebar_text_properties[GITG_SIDEBAR_STORE_SIDEBAR_TEXT_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	GITG_SIDEBAR_STORE_SIDEBAR_HEADER_0_PROPERTY,
	GITG_SIDEBAR_STORE_SIDEBAR_HEADER_ID_PROPERTY,
	GITG_SIDEBAR_STORE_SIDEBAR_HEADER_NUM_PROPERTIES
};
static GParamSpec* gitg_sidebar_store_sidebar_header_properties[GITG_SIDEBAR_STORE_SIDEBAR_HEADER_NUM_PROPERTIES];
enum  {
	GITG_SIDEBAR_0_PROPERTY,
	GITG_SIDEBAR_MODEL_PROPERTY,
	GITG_SIDEBAR_NUM_PROPERTIES
};
static GParamSpec* gitg_sidebar_properties[GITG_SIDEBAR_NUM_PROPERTIES];
#define __vala_GtkTreePath_free0(var) ((var == NULL) ? NULL : (var = (_vala_GtkTreePath_free (var), NULL)))
typedef struct _Block29Data Block29Data;
typedef struct _Block30Data Block30Data;
enum  {
	GITG_SIDEBAR_DESELECTED_SIGNAL,
	GITG_SIDEBAR_POPULATE_POPUP_SIGNAL,
	GITG_SIDEBAR_NUM_SIGNALS
};
static guint gitg_sidebar_signals[GITG_SIDEBAR_NUM_SIGNALS] = {0};

struct _GitgSidebarStorePrivate {
	guint d_sections;
	GSList* d_parents;
	gboolean d_clearing;
};

struct _GitgSidebarStoreSidebarTextPrivate {
	gchar* d_text;
};

struct _GitgSidebarStoreSidebarHeaderPrivate {
	guint d_id;
};

struct _GitgSidebarPrivate {
	GtkTreeViewColumn* d_column;
	GtkCellRendererPixbuf* d_renderer_icon;
	GtkCellRendererText* d_renderer_header;
	GtkCellRendererText* d_renderer_text;
};

struct _Block29Data {
	int _ref_count_;
	GitgSidebar* self;
	GitgSidebarItem* item;
};

struct _Block30Data {
	int _ref_count_;
	GitgSidebar* self;
	gboolean retval;
	GitgSidebarItem* item;
};

static gint GitgSidebarStore_private_offset;
static gpointer gitg_sidebar_store_parent_class = NULL;
static gint GitgSidebarStoreSidebarText_private_offset;
static gpointer gitg_sidebar_store_sidebar_text_parent_class = NULL;
static GitgSidebarItemIface * gitg_sidebar_store_sidebar_text_gitg_sidebar_item_parent_iface = NULL;
static gint GitgSidebarStoreSidebarHeader_private_offset;
static gpointer gitg_sidebar_store_sidebar_header_parent_class = NULL;
static gint GitgSidebar_private_offset;
static gpointer gitg_sidebar_parent_class = NULL;

static void gitg_sidebar_item_real_activate (GitgSidebarItem* self,
                                      gint numclick);
static GType gitg_sidebar_item_get_type_once (void);
static void _vala_GtkTreeIter_free (GtkTreeIter* self);
static void __vala_GtkTreeIter_free0_ (gpointer var);
static inline void _g_slist_free___vala_GtkTreeIter_free0_ (GSList* self);
static void gitg_sidebar_store_append_real (GitgSidebarStore* self,
                                     GitgSidebarItem* item,
                                     guint hint,
                                     GtkTreeIter* iter);
static GtkTreeIter* _vala_GtkTreeIter_copy (GtkTreeIter* self);
static void gitg_sidebar_store_sidebar_text_finalize (GObject * obj);
static GType gitg_sidebar_store_sidebar_text_get_type_once (void);
static void _vala_gitg_sidebar_store_sidebar_text_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec);
static void gitg_sidebar_store_sidebar_header_finalize (GObject * obj);
static GType gitg_sidebar_store_sidebar_header_get_type_once (void);
static void _vala_gitg_sidebar_store_sidebar_header_get_property (GObject * object,
                                                           guint property_id,
                                                           GValue * value,
                                                           GParamSpec * pspec);
static void gitg_sidebar_store_finalize (GObject * obj);
static GType gitg_sidebar_store_get_type_once (void);
static void _vala_gitg_sidebar_store_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec);
static gboolean gitg_sidebar_real_select_function (GitgSidebar* self,
                                            GtkTreeSelection* sel,
                                            GtkTreeModel* model,
                                            GtkTreePath* path,
                                            gboolean cursel);
static void gitg_sidebar_real_selection_changed (GitgSidebar* self,
                                          GtkTreeSelection* sel);
static void _vala_GtkTreePath_free (GtkTreePath* self);
static void __vala_GtkTreePath_free0_ (gpointer var);
static inline void _g_list_free___vala_GtkTreePath_free0_ (GList* self);
static GtkTreePath* _vala_GtkTreePath_copy (GtkTreePath* self);
static void _vala_array_add15 (gpointer* * array,
                        gint* length,
                        gint* size,
                        gpointer value);
static Block29Data* block29_data_ref (Block29Data* _data29_);
static void block29_data_unref (void * _userdata_);
static gboolean __lambda92_ (Block29Data* _data29_,
                      GtkTreeModel* m,
                      GtkTreePath* path,
                      GtkTreeIter* iter);
static gboolean ___lambda92__gtk_tree_model_foreach_func (GtkTreeModel* model,
                                                   GtkTreePath* path,
                                                   GtkTreeIter* iter,
                                                   gpointer self);
static Block30Data* block30_data_ref (Block30Data* _data30_);
static void block30_data_unref (void * _userdata_);
static gboolean __lambda93_ (Block30Data* _data30_,
                      GtkTreeModel* m,
                      GtkTreePath* path,
                      GtkTreeIter* iter);
static gboolean ___lambda93__gtk_tree_model_foreach_func (GtkTreeModel* model,
                                                   GtkTreePath* path,
                                                   GtkTreeIter* iter,
                                                   gpointer self);
static void gitg_sidebar_real_row_activated (GtkTreeView* base,
                                      GtkTreePath* path,
                                      GtkTreeViewColumn* column);
static gboolean gitg_sidebar_real_key_press_event (GtkWidget* base,
                                            GdkEventKey* event);
static gboolean gitg_sidebar_do_populate_popup (GitgSidebar* self,
                                         GdkEventButton* event);
static gboolean gitg_sidebar_real_button_press_event (GtkWidget* base,
                                               GdkEventButton* event);
static gboolean gitg_sidebar_real_popup_menu (GtkWidget* base);
static GObject * gitg_sidebar_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties);
static void _gitg_sidebar___lambda94_ (GitgSidebar* self,
                                GtkCellLayout* layout,
                                GtkCellRenderer* cell,
                                GtkTreeModel* model,
                                GtkTreeIter* iter);
static void __gitg_sidebar___lambda94__gtk_cell_layout_data_func (GtkCellLayout* cell_layout,
                                                           GtkCellRenderer* cell,
                                                           GtkTreeModel* tree_model,
                                                           GtkTreeIter* iter,
                                                           gpointer self);
static void _gitg_sidebar___lambda95_ (GitgSidebar* self,
                                GtkCellLayout* layout,
                                GtkCellRenderer* cell,
                                GtkTreeModel* model,
                                GtkTreeIter* iter);
static void __gitg_sidebar___lambda95__gtk_cell_layout_data_func (GtkCellLayout* cell_layout,
                                                           GtkCellRenderer* cell,
                                                           GtkTreeModel* tree_model,
                                                           GtkTreeIter* iter,
                                                           gpointer self);
static void _gitg_sidebar___lambda96_ (GitgSidebar* self,
                                GtkCellLayout* layout,
                                GtkCellRenderer* cell,
                                GtkTreeModel* model,
                                GtkTreeIter* iter);
static void __gitg_sidebar___lambda96__gtk_cell_layout_data_func (GtkCellLayout* cell_layout,
                                                           GtkCellRenderer* cell,
                                                           GtkTreeModel* tree_model,
                                                           GtkTreeIter* iter,
                                                           gpointer self);
static gboolean _gitg_sidebar___lambda97_ (GitgSidebar* self,
                                    GtkTreeModel* model,
                                    GtkTreeIter* iter);
static gboolean __gitg_sidebar___lambda97__gtk_tree_view_row_separator_func (GtkTreeModel* model,
                                                                      GtkTreeIter* iter,
                                                                      gpointer self);
static gboolean _gitg_sidebar_select_function_gtk_tree_selection_func (GtkTreeSelection* selection,
                                                                GtkTreeModel* model,
                                                                GtkTreePath* path,
                                                                gboolean path_currently_selected,
                                                                gpointer self);
static void _gitg_sidebar_selection_changed_gtk_tree_selection_changed (GtkTreeSelection* _sender,
                                                                 gpointer self);
static void gitg_sidebar_finalize (GObject * obj);
static GType gitg_sidebar_get_type_once (void);
static void _vala_gitg_sidebar_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec);
static void _vala_gitg_sidebar_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec);

 G_GNUC_NO_INLINE static GType
gitg_sidebar_hint_get_type_once (void)
{
	static const GEnumValue values[] = {{GITG_SIDEBAR_HINT_NONE, "GITG_SIDEBAR_HINT_NONE", "none"}, {GITG_SIDEBAR_HINT_HEADER, "GITG_SIDEBAR_HINT_HEADER", "header"}, {GITG_SIDEBAR_HINT_SEPARATOR, "GITG_SIDEBAR_HINT_SEPARATOR", "separator"}, {GITG_SIDEBAR_HINT_DUMMY, "GITG_SIDEBAR_HINT_DUMMY", "dummy"}, {0, NULL, NULL}};
	GType gitg_sidebar_hint_type_id;
	gitg_sidebar_hint_type_id = g_enum_register_static ("GitgSidebarHint", values);
	return gitg_sidebar_hint_type_id;
}

GType
gitg_sidebar_hint_get_type (void)
{
	static gsize gitg_sidebar_hint_type_id__once = 0;
	if (g_once_init_enter (&gitg_sidebar_hint_type_id__once)) {
		GType gitg_sidebar_hint_type_id;
		gitg_sidebar_hint_type_id = gitg_sidebar_hint_get_type_once ();
		g_once_init_leave (&gitg_sidebar_hint_type_id__once, gitg_sidebar_hint_type_id);
	}
	return gitg_sidebar_hint_type_id__once;
}

 G_GNUC_NO_INLINE static GType
gitg_sidebar_column_get_type_once (void)
{
	static const GEnumValue values[] = {{GITG_SIDEBAR_COLUMN_HINT, "GITG_SIDEBAR_COLUMN_HINT", "hint"}, {GITG_SIDEBAR_COLUMN_SECTION, "GITG_SIDEBAR_COLUMN_SECTION", "section"}, {GITG_SIDEBAR_COLUMN_ITEM, "GITG_SIDEBAR_COLUMN_ITEM", "item"}, {0, NULL, NULL}};
	GType gitg_sidebar_column_type_id;
	gitg_sidebar_column_type_id = g_enum_register_static ("GitgSidebarColumn", values);
	return gitg_sidebar_column_type_id;
}

GType
gitg_sidebar_column_get_type (void)
{
	static gsize gitg_sidebar_column_type_id__once = 0;
	if (g_once_init_enter (&gitg_sidebar_column_type_id__once)) {
		GType gitg_sidebar_column_type_id;
		gitg_sidebar_column_type_id = gitg_sidebar_column_get_type_once ();
		g_once_init_leave (&gitg_sidebar_column_type_id__once, gitg_sidebar_column_type_id);
	}
	return gitg_sidebar_column_type_id__once;
}

static void
gitg_sidebar_item_real_activate (GitgSidebarItem* self,
                                 gint numclick)
{
	g_signal_emit (self, gitg_sidebar_item_signals[GITG_SIDEBAR_ITEM_ACTIVATED_SIGNAL], 0, numclick);
}

void
gitg_sidebar_item_activate (GitgSidebarItem* self,
                            gint numclick)
{
	GitgSidebarItemIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GITG_SIDEBAR_ITEM_GET_INTERFACE (self);
	if (_iface_->activate) {
		_iface_->activate (self, numclick);
	}
}

gchar*
gitg_sidebar_item_get_text (GitgSidebarItem* self)
{
	GitgSidebarItemIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GITG_SIDEBAR_ITEM_GET_INTERFACE (self);
	if (_iface_->get_text) {
		return _iface_->get_text (self);
	}
	return NULL;
}

gchar*
gitg_sidebar_item_get_icon_name (GitgSidebarItem* self)
{
	GitgSidebarItemIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GITG_SIDEBAR_ITEM_GET_INTERFACE (self);
	if (_iface_->get_icon_name) {
		return _iface_->get_icon_name (self);
	}
	return NULL;
}

static void
gitg_sidebar_item_default_init (GitgSidebarItemIface * iface,
                                gpointer iface_data)
{
	g_object_interface_install_property (iface, g_param_spec_string ("text", "text", "text", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_string ("icon-name", "icon-name", "icon-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gitg_sidebar_item_signals[GITG_SIDEBAR_ITEM_ACTIVATED_SIGNAL] = g_signal_new ("activated", GITG_TYPE_SIDEBAR_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
	iface->activate = gitg_sidebar_item_real_activate;
}

 G_GNUC_NO_INLINE static GType
gitg_sidebar_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GitgSidebarItemIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_sidebar_item_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gitg_sidebar_item_type_id;
	gitg_sidebar_item_type_id = g_type_register_static (G_TYPE_INTERFACE, "GitgSidebarItem", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gitg_sidebar_item_type_id, G_TYPE_OBJECT);
	return gitg_sidebar_item_type_id;
}

GType
gitg_sidebar_item_get_type (void)
{
	static gsize gitg_sidebar_item_type_id__once = 0;
	if (g_once_init_enter (&gitg_sidebar_item_type_id__once)) {
		GType gitg_sidebar_item_type_id;
		gitg_sidebar_item_type_id = gitg_sidebar_item_get_type_once ();
		g_once_init_leave (&gitg_sidebar_item_type_id__once, gitg_sidebar_item_type_id);
	}
	return gitg_sidebar_item_type_id__once;
}

static inline gpointer
gitg_sidebar_store_get_instance_private (GitgSidebarStore* self)
{
	return G_STRUCT_MEMBER_P (self, GitgSidebarStore_private_offset);
}

static void
_vala_GtkTreeIter_free (GtkTreeIter* self)
{
	g_boxed_free (gtk_tree_iter_get_type (), self);
}

static void
__vala_GtkTreeIter_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (_vala_GtkTreeIter_free (var), NULL));
}

static inline void
_g_slist_free___vala_GtkTreeIter_free0_ (GSList* self)
{
	g_slist_free_full (self, (GDestroyNotify) __vala_GtkTreeIter_free0_);
}

static void
gitg_sidebar_store_append_real (GitgSidebarStore* self,
                                GitgSidebarItem* item,
                                guint hint,
                                GtkTreeIter* iter)
{
	GtkTreeIter _vala_iter = {0};
	GSList* _tmp0_;
	GtkTreeIter _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_tmp0_ = self->priv->d_parents;
	if (_tmp0_ != NULL) {
		GSList* _tmp1_;
		gconstpointer _tmp2_;
		GtkTreeIter _tmp3_ = {0};
		_tmp1_ = self->priv->d_parents;
		_tmp2_ = _tmp1_->data;
		gtk_tree_store_append (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_store_get_type (), GtkTreeStore), &_tmp3_, (GtkTreeIter*) _tmp2_);
		_vala_iter = _tmp3_;
	} else {
		GtkTreeIter _tmp4_ = {0};
		gtk_tree_store_append (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_store_get_type (), GtkTreeStore), &_tmp4_, NULL);
		_vala_iter = _tmp4_;
	}
	_tmp5_ = _vala_iter;
	gtk_tree_store_set ((GtkTreeStore*) self, &_tmp5_, GITG_SIDEBAR_COLUMN_ITEM, item, GITG_SIDEBAR_COLUMN_HINT, hint, GITG_SIDEBAR_COLUMN_SECTION, self->priv->d_sections, -1);
	if (iter) {
		*iter = _vala_iter;
	}
}

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

GitgSidebarStore*
gitg_sidebar_store_append_dummy (GitgSidebarStore* self,
                                 const gchar* text)
{
	GtkTreeIter iter = {0};
	GitgSidebarStoreSidebarText* _tmp0_;
	GitgSidebarStoreSidebarText* _tmp1_;
	GtkTreeIter _tmp2_ = {0};
	GitgSidebarStore* _tmp3_;
	GitgSidebarStore* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = gitg_sidebar_store_sidebar_text_new (text);
	_tmp1_ = _tmp0_;
	gitg_sidebar_store_append_real (self, (GitgSidebarItem*) _tmp1_, (guint) GITG_SIDEBAR_HINT_DUMMY, &_tmp2_);
	iter = _tmp2_;
	_g_object_unref0 (_tmp1_);
	_tmp3_ = _g_object_ref0 (self);
	result = _tmp3_;
	return result;
}

GitgSidebarStore*
gitg_sidebar_store_append (GitgSidebarStore* self,
                           GitgSidebarItem* item)
{
	GtkTreeIter iter = {0};
	GtkTreeIter _tmp0_ = {0};
	GitgSidebarStore* _tmp1_;
	GitgSidebarStore* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	gitg_sidebar_store_append_real (self, item, (guint) GITG_SIDEBAR_HINT_NONE, &_tmp0_);
	iter = _tmp0_;
	_tmp1_ = _g_object_ref0 (self);
	result = _tmp1_;
	return result;
}

static GtkTreeIter*
_vala_GtkTreeIter_copy (GtkTreeIter* self)
{
	return g_boxed_copy (gtk_tree_iter_get_type (), self);
}

static gpointer
__vala_GtkTreeIter_copy0 (gpointer self)
{
	return self ? _vala_GtkTreeIter_copy (self) : NULL;
}

GitgSidebarStoreSidebarHeader*
gitg_sidebar_store_begin_header (GitgSidebarStore* self,
                                 const gchar* text,
                                 guint id)
{
	GtkTreeIter iter = {0};
	GitgSidebarStoreSidebarHeader* item = NULL;
	GitgSidebarStoreSidebarHeader* _tmp0_;
	GtkTreeIter _tmp1_ = {0};
	GtkTreeIter _tmp2_;
	GtkTreeIter* _tmp3_;
	GitgSidebarStoreSidebarHeader* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = gitg_sidebar_store_sidebar_header_new (text, id);
	item = _tmp0_;
	gitg_sidebar_store_append_real (self, (GitgSidebarItem*) item, (guint) GITG_SIDEBAR_HINT_HEADER, &_tmp1_);
	iter = _tmp1_;
	_tmp2_ = iter;
	_tmp3_ = __vala_GtkTreeIter_copy0 (&_tmp2_);
	self->priv->d_parents = g_slist_prepend (self->priv->d_parents, _tmp3_);
	result = item;
	return result;
}

GitgSidebarStore*
gitg_sidebar_store_end_header (GitgSidebarStore* self)
{
	GSList* _tmp0_;
	GitgSidebarStore* _tmp2_;
	GitgSidebarStore* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->d_parents;
	if (_tmp0_ != NULL) {
		GSList* _tmp1_;
		_tmp1_ = self->priv->d_parents;
		self->priv->d_parents = g_slist_delete_link (self->priv->d_parents, _tmp1_);
	}
	_tmp2_ = _g_object_ref0 (self);
	result = _tmp2_;
	return result;
}

guint
gitg_sidebar_store_begin_section (GitgSidebarStore* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	(self->priv->d_parents == NULL) ? NULL : (self->priv->d_parents = (_g_slist_free___vala_GtkTreeIter_free0_ (self->priv->d_parents), NULL));
	self->priv->d_parents = NULL;
	result = self->priv->d_sections;
	return result;
}

void
gitg_sidebar_store_end_section (GitgSidebarStore* self)
{
	guint _tmp0_;
	g_return_if_fail (self != NULL);
	self->priv->d_sections = self->priv->d_sections + 1;
	_tmp0_ = self->priv->d_sections;
}

void
gitg_sidebar_store_clear (GitgSidebarStore* self)
{
	g_return_if_fail (self != NULL);
	self->priv->d_clearing = TRUE;
	gtk_tree_store_clear (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_store_get_type (), GtkTreeStore));
	self->priv->d_clearing = FALSE;
	self->priv->d_sections = (guint) 0;
}

GitgSidebarItem*
gitg_sidebar_store_item_for_iter (GitgSidebarStore* self,
                                  GtkTreeIter* iter)
{
	GitgSidebarItem* item = NULL;
	GtkTreeIter _tmp0_;
	GitgSidebarItem* _tmp1_ = NULL;
	GitgSidebarItem* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (iter != NULL, NULL);
	_tmp0_ = *iter;
	gtk_tree_model_get ((GtkTreeModel*) self, &_tmp0_, GITG_SIDEBAR_COLUMN_ITEM, &_tmp1_, -1);
	_g_object_unref0 (item);
	item = _tmp1_;
	result = item;
	return result;
}

void
gitg_sidebar_store_activate (GitgSidebarStore* self,
                             GtkTreeIter* iter,
                             gint numclick)
{
	GitgSidebarItem* item = NULL;
	GtkTreeIter _tmp0_;
	GitgSidebarItem* _tmp1_ = NULL;
	GitgSidebarItem* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (iter != NULL);
	_tmp0_ = *iter;
	gtk_tree_model_get ((GtkTreeModel*) self, &_tmp0_, GITG_SIDEBAR_COLUMN_ITEM, &_tmp1_, -1);
	_g_object_unref0 (item);
	item = _tmp1_;
	_tmp2_ = item;
	if (_tmp2_ != NULL) {
		GitgSidebarItem* _tmp3_;
		_tmp3_ = item;
		gitg_sidebar_item_activate (_tmp3_, numclick);
	}
	_g_object_unref0 (item);
}

GitgSidebarStore*
gitg_sidebar_store_construct (GType object_type)
{
	GitgSidebarStore * self = NULL;
	self = (GitgSidebarStore*) g_object_new (object_type, NULL);
	return self;
}

GitgSidebarStore*
gitg_sidebar_store_new (void)
{
	return gitg_sidebar_store_construct (GITG_TYPE_SIDEBAR_STORE);
}

gboolean
gitg_sidebar_store_get_clearing (GitgSidebarStore* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->d_clearing;
	return result;
}

static inline gpointer
gitg_sidebar_store_sidebar_text_get_instance_private (GitgSidebarStoreSidebarText* self)
{
	return G_STRUCT_MEMBER_P (self, GitgSidebarStoreSidebarText_private_offset);
}

GitgSidebarStoreSidebarText*
gitg_sidebar_store_sidebar_text_construct (GType object_type,
                                           const gchar* text)
{
	GitgSidebarStoreSidebarText * self = NULL;
	gchar* _tmp0_;
	g_return_val_if_fail (text != NULL, NULL);
	self = (GitgSidebarStoreSidebarText*) g_object_new (object_type, NULL);
	_tmp0_ = g_strdup (text);
	_g_free0 (self->priv->d_text);
	self->priv->d_text = _tmp0_;
	return self;
}

GitgSidebarStoreSidebarText*
gitg_sidebar_store_sidebar_text_new (const gchar* text)
{
	return gitg_sidebar_store_sidebar_text_construct (GITG_SIDEBAR_STORE_TYPE_SIDEBAR_TEXT, text);
}

static gchar*
gitg_sidebar_store_sidebar_text_real_get_text (GitgSidebarItem* base)
{
	gchar* result;
	GitgSidebarStoreSidebarText* self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	self = (GitgSidebarStoreSidebarText*) base;
	_tmp0_ = self->priv->d_text;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static gchar*
gitg_sidebar_store_sidebar_text_real_get_icon_name (GitgSidebarItem* base)
{
	gchar* result;
	GitgSidebarStoreSidebarText* self;
	self = (GitgSidebarStoreSidebarText*) base;
	result = NULL;
	return result;
}

static void
gitg_sidebar_store_sidebar_text_class_init (GitgSidebarStoreSidebarTextClass * klass,
                                            gpointer klass_data)
{
	gitg_sidebar_store_sidebar_text_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GitgSidebarStoreSidebarText_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gitg_sidebar_store_sidebar_text_get_property;
	G_OBJECT_CLASS (klass)->finalize = gitg_sidebar_store_sidebar_text_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_SIDEBAR_STORE_SIDEBAR_TEXT_TEXT_PROPERTY, gitg_sidebar_store_sidebar_text_properties[GITG_SIDEBAR_STORE_SIDEBAR_TEXT_TEXT_PROPERTY] = g_param_spec_string ("text", "text", "text", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_SIDEBAR_STORE_SIDEBAR_TEXT_ICON_NAME_PROPERTY, gitg_sidebar_store_sidebar_text_properties[GITG_SIDEBAR_STORE_SIDEBAR_TEXT_ICON_NAME_PROPERTY] = g_param_spec_string ("icon-name", "icon-name", "icon-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
gitg_sidebar_store_sidebar_text_gitg_sidebar_item_interface_init (GitgSidebarItemIface * iface,
                                                                  gpointer iface_data)
{
	gitg_sidebar_store_sidebar_text_gitg_sidebar_item_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_text = gitg_sidebar_store_sidebar_text_real_get_text;
	iface->get_icon_name = gitg_sidebar_store_sidebar_text_real_get_icon_name;
}

static void
gitg_sidebar_store_sidebar_text_instance_init (GitgSidebarStoreSidebarText * self,
                                               gpointer klass)
{
	self->priv = gitg_sidebar_store_sidebar_text_get_instance_private (self);
}

static void
gitg_sidebar_store_sidebar_text_finalize (GObject * obj)
{
	GitgSidebarStoreSidebarText * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_SIDEBAR_STORE_TYPE_SIDEBAR_TEXT, GitgSidebarStoreSidebarText);
	_g_free0 (self->priv->d_text);
	G_OBJECT_CLASS (gitg_sidebar_store_sidebar_text_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gitg_sidebar_store_sidebar_text_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GitgSidebarStoreSidebarTextClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_sidebar_store_sidebar_text_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgSidebarStoreSidebarText), 0, (GInstanceInitFunc) gitg_sidebar_store_sidebar_text_instance_init, NULL };
	static const GInterfaceInfo gitg_sidebar_item_info = { (GInterfaceInitFunc) gitg_sidebar_store_sidebar_text_gitg_sidebar_item_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gitg_sidebar_store_sidebar_text_type_id;
	gitg_sidebar_store_sidebar_text_type_id = g_type_register_static (G_TYPE_OBJECT, "GitgSidebarStoreSidebarText", &g_define_type_info, 0);
	g_type_add_interface_static (gitg_sidebar_store_sidebar_text_type_id, GITG_TYPE_SIDEBAR_ITEM, &gitg_sidebar_item_info);
	GitgSidebarStoreSidebarText_private_offset = g_type_add_instance_private (gitg_sidebar_store_sidebar_text_type_id, sizeof (GitgSidebarStoreSidebarTextPrivate));
	return gitg_sidebar_store_sidebar_text_type_id;
}

GType
gitg_sidebar_store_sidebar_text_get_type (void)
{
	static gsize gitg_sidebar_store_sidebar_text_type_id__once = 0;
	if (g_once_init_enter (&gitg_sidebar_store_sidebar_text_type_id__once)) {
		GType gitg_sidebar_store_sidebar_text_type_id;
		gitg_sidebar_store_sidebar_text_type_id = gitg_sidebar_store_sidebar_text_get_type_once ();
		g_once_init_leave (&gitg_sidebar_store_sidebar_text_type_id__once, gitg_sidebar_store_sidebar_text_type_id);
	}
	return gitg_sidebar_store_sidebar_text_type_id__once;
}

static void
_vala_gitg_sidebar_store_sidebar_text_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec)
{
	GitgSidebarStoreSidebarText * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_SIDEBAR_STORE_TYPE_SIDEBAR_TEXT, GitgSidebarStoreSidebarText);
	switch (property_id) {
		case GITG_SIDEBAR_STORE_SIDEBAR_TEXT_TEXT_PROPERTY:
		g_value_take_string (value, gitg_sidebar_item_get_text ((GitgSidebarItem*) self));
		break;
		case GITG_SIDEBAR_STORE_SIDEBAR_TEXT_ICON_NAME_PROPERTY:
		g_value_take_string (value, gitg_sidebar_item_get_icon_name ((GitgSidebarItem*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
gitg_sidebar_store_sidebar_header_get_instance_private (GitgSidebarStoreSidebarHeader* self)
{
	return G_STRUCT_MEMBER_P (self, GitgSidebarStoreSidebarHeader_private_offset);
}

GitgSidebarStoreSidebarHeader*
gitg_sidebar_store_sidebar_header_construct (GType object_type,
                                             const gchar* text,
                                             guint id)
{
	GitgSidebarStoreSidebarHeader * self = NULL;
	g_return_val_if_fail (text != NULL, NULL);
	self = (GitgSidebarStoreSidebarHeader*) gitg_sidebar_store_sidebar_text_construct (object_type, text);
	self->priv->d_id = id;
	return self;
}

GitgSidebarStoreSidebarHeader*
gitg_sidebar_store_sidebar_header_new (const gchar* text,
                                       guint id)
{
	return gitg_sidebar_store_sidebar_header_construct (GITG_SIDEBAR_STORE_TYPE_SIDEBAR_HEADER, text, id);
}

guint
gitg_sidebar_store_sidebar_header_get_id (GitgSidebarStoreSidebarHeader* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->d_id;
	return result;
}

static void
gitg_sidebar_store_sidebar_header_class_init (GitgSidebarStoreSidebarHeaderClass * klass,
                                              gpointer klass_data)
{
	gitg_sidebar_store_sidebar_header_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GitgSidebarStoreSidebarHeader_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gitg_sidebar_store_sidebar_header_get_property;
	G_OBJECT_CLASS (klass)->finalize = gitg_sidebar_store_sidebar_header_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_SIDEBAR_STORE_SIDEBAR_HEADER_ID_PROPERTY, gitg_sidebar_store_sidebar_header_properties[GITG_SIDEBAR_STORE_SIDEBAR_HEADER_ID_PROPERTY] = g_param_spec_uint ("id", "id", "id", 0, G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
gitg_sidebar_store_sidebar_header_instance_init (GitgSidebarStoreSidebarHeader * self,
                                                 gpointer klass)
{
	self->priv = gitg_sidebar_store_sidebar_header_get_instance_private (self);
}

static void
gitg_sidebar_store_sidebar_header_finalize (GObject * obj)
{
	GitgSidebarStoreSidebarHeader * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_SIDEBAR_STORE_TYPE_SIDEBAR_HEADER, GitgSidebarStoreSidebarHeader);
	G_OBJECT_CLASS (gitg_sidebar_store_sidebar_header_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gitg_sidebar_store_sidebar_header_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GitgSidebarStoreSidebarHeaderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_sidebar_store_sidebar_header_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgSidebarStoreSidebarHeader), 0, (GInstanceInitFunc) gitg_sidebar_store_sidebar_header_instance_init, NULL };
	GType gitg_sidebar_store_sidebar_header_type_id;
	gitg_sidebar_store_sidebar_header_type_id = g_type_register_static (GITG_SIDEBAR_STORE_TYPE_SIDEBAR_TEXT, "GitgSidebarStoreSidebarHeader", &g_define_type_info, 0);
	GitgSidebarStoreSidebarHeader_private_offset = g_type_add_instance_private (gitg_sidebar_store_sidebar_header_type_id, sizeof (GitgSidebarStoreSidebarHeaderPrivate));
	return gitg_sidebar_store_sidebar_header_type_id;
}

GType
gitg_sidebar_store_sidebar_header_get_type (void)
{
	static gsize gitg_sidebar_store_sidebar_header_type_id__once = 0;
	if (g_once_init_enter (&gitg_sidebar_store_sidebar_header_type_id__once)) {
		GType gitg_sidebar_store_sidebar_header_type_id;
		gitg_sidebar_store_sidebar_header_type_id = gitg_sidebar_store_sidebar_header_get_type_once ();
		g_once_init_leave (&gitg_sidebar_store_sidebar_header_type_id__once, gitg_sidebar_store_sidebar_header_type_id);
	}
	return gitg_sidebar_store_sidebar_header_type_id__once;
}

static void
_vala_gitg_sidebar_store_sidebar_header_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec)
{
	GitgSidebarStoreSidebarHeader * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_SIDEBAR_STORE_TYPE_SIDEBAR_HEADER, GitgSidebarStoreSidebarHeader);
	switch (property_id) {
		case GITG_SIDEBAR_STORE_SIDEBAR_HEADER_ID_PROPERTY:
		g_value_set_uint (value, gitg_sidebar_store_sidebar_header_get_id (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
gitg_sidebar_store_class_init (GitgSidebarStoreClass * klass,
                               gpointer klass_data)
{
	gitg_sidebar_store_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GitgSidebarStore_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gitg_sidebar_store_get_property;
	G_OBJECT_CLASS (klass)->finalize = gitg_sidebar_store_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_SIDEBAR_STORE_CLEARING_PROPERTY, gitg_sidebar_store_properties[GITG_SIDEBAR_STORE_CLEARING_PROPERTY] = g_param_spec_boolean ("clearing", "clearing", "clearing", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
gitg_sidebar_store_instance_init (GitgSidebarStore * self,
                                  gpointer klass)
{
	self->priv = gitg_sidebar_store_get_instance_private (self);
}

static void
gitg_sidebar_store_finalize (GObject * obj)
{
	GitgSidebarStore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_SIDEBAR_STORE, GitgSidebarStore);
	(self->priv->d_parents == NULL) ? NULL : (self->priv->d_parents = (_g_slist_free___vala_GtkTreeIter_free0_ (self->priv->d_parents), NULL));
	G_OBJECT_CLASS (gitg_sidebar_store_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gitg_sidebar_store_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GitgSidebarStoreClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_sidebar_store_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgSidebarStore), 0, (GInstanceInitFunc) gitg_sidebar_store_instance_init, NULL };
	GType gitg_sidebar_store_type_id;
	gitg_sidebar_store_type_id = g_type_register_static (gtk_tree_store_get_type (), "GitgSidebarStore", &g_define_type_info, 0);
	GitgSidebarStore_private_offset = g_type_add_instance_private (gitg_sidebar_store_type_id, sizeof (GitgSidebarStorePrivate));
	return gitg_sidebar_store_type_id;
}

GType
gitg_sidebar_store_get_type (void)
{
	static gsize gitg_sidebar_store_type_id__once = 0;
	if (g_once_init_enter (&gitg_sidebar_store_type_id__once)) {
		GType gitg_sidebar_store_type_id;
		gitg_sidebar_store_type_id = gitg_sidebar_store_get_type_once ();
		g_once_init_leave (&gitg_sidebar_store_type_id__once, gitg_sidebar_store_type_id);
	}
	return gitg_sidebar_store_type_id__once;
}

static void
_vala_gitg_sidebar_store_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec)
{
	GitgSidebarStore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_SIDEBAR_STORE, GitgSidebarStore);
	switch (property_id) {
		case GITG_SIDEBAR_STORE_CLEARING_PROPERTY:
		g_value_set_boolean (value, gitg_sidebar_store_get_clearing (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
gitg_sidebar_get_instance_private (GitgSidebar* self)
{
	return G_STRUCT_MEMBER_P (self, GitgSidebar_private_offset);
}

static gboolean
gitg_sidebar_real_select_function (GitgSidebar* self,
                                   GtkTreeSelection* sel,
                                   GtkTreeModel* model,
                                   GtkTreePath* path,
                                   gboolean cursel)
{
	GtkTreeIter iter = {0};
	GtkTreeIter _tmp0_ = {0};
	guint hint = 0U;
	GtkTreeIter _tmp1_;
	guint _tmp2_ = 0U;
	gboolean _tmp3_ = FALSE;
	gboolean result;
	g_return_val_if_fail (sel != NULL, FALSE);
	g_return_val_if_fail (model != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	gtk_tree_model_get_iter (model, &_tmp0_, path);
	iter = _tmp0_;
	_tmp1_ = iter;
	gtk_tree_model_get (model, &_tmp1_, GITG_SIDEBAR_COLUMN_HINT, &_tmp2_, -1);
	hint = _tmp2_;
	if (hint != ((guint) GITG_SIDEBAR_HINT_HEADER)) {
		_tmp3_ = hint != ((guint) GITG_SIDEBAR_HINT_DUMMY);
	} else {
		_tmp3_ = FALSE;
	}
	result = _tmp3_;
	return result;
}

gboolean
gitg_sidebar_select_function (GitgSidebar* self,
                              GtkTreeSelection* sel,
                              GtkTreeModel* model,
                              GtkTreePath* path,
                              gboolean cursel)
{
	GitgSidebarClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = GITG_SIDEBAR_GET_CLASS (self);
	if (_klass_->select_function) {
		return _klass_->select_function (self, sel, model, path, cursel);
	}
	return FALSE;
}

static void
gitg_sidebar_real_selection_changed (GitgSidebar* self,
                                     GtkTreeSelection* sel)
{
	GtkTreeIter iter = {0};
	GitgSidebarStore* _tmp0_;
	GitgSidebarStore* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	GtkTreeIter _tmp4_ = {0};
	gboolean _tmp5_;
	g_return_if_fail (sel != NULL);
	_tmp0_ = gitg_sidebar_get_model (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gitg_sidebar_store_get_clearing (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		return;
	}
	_tmp5_ = gitg_sidebar_get_selected_iter (self, &_tmp4_);
	iter = _tmp4_;
	if (_tmp5_) {
		GitgSidebarHint hint = 0;
		GitgSidebarStore* _tmp6_;
		GitgSidebarStore* _tmp7_;
		GtkTreeIter _tmp8_;
		GitgSidebarHint _tmp9_ = 0;
		gboolean _tmp10_ = FALSE;
		_tmp6_ = gitg_sidebar_get_model (self);
		_tmp7_ = _tmp6_;
		_tmp8_ = iter;
		gtk_tree_model_get ((GtkTreeModel*) _tmp7_, &_tmp8_, GITG_SIDEBAR_COLUMN_HINT, &_tmp9_, -1);
		hint = _tmp9_;
		if (hint != GITG_SIDEBAR_HINT_HEADER) {
			_tmp10_ = hint != GITG_SIDEBAR_HINT_DUMMY;
		} else {
			_tmp10_ = FALSE;
		}
		if (_tmp10_) {
			GitgSidebarStore* _tmp11_;
			GitgSidebarStore* _tmp12_;
			GtkTreeIter _tmp13_;
			_tmp11_ = gitg_sidebar_get_model (self);
			_tmp12_ = _tmp11_;
			_tmp13_ = iter;
			gitg_sidebar_store_activate (_tmp12_, &_tmp13_, 1);
		} else {
			g_signal_emit (self, gitg_sidebar_signals[GITG_SIDEBAR_DESELECTED_SIGNAL], 0);
		}
	} else {
		g_signal_emit (self, gitg_sidebar_signals[GITG_SIDEBAR_DESELECTED_SIGNAL], 0);
	}
}

void
gitg_sidebar_selection_changed (GitgSidebar* self,
                                GtkTreeSelection* sel)
{
	GitgSidebarClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = GITG_SIDEBAR_GET_CLASS (self);
	if (_klass_->selection_changed) {
		_klass_->selection_changed (self, sel);
	}
}

static void
_vala_GtkTreePath_free (GtkTreePath* self)
{
	g_boxed_free (gtk_tree_path_get_type (), self);
}

static void
__vala_GtkTreePath_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (_vala_GtkTreePath_free (var), NULL));
}

static inline void
_g_list_free___vala_GtkTreePath_free0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) __vala_GtkTreePath_free0_);
}

gboolean
gitg_sidebar_get_selected_iter (GitgSidebar* self,
                                GtkTreeIter* iter)
{
	GtkTreeIter _vala_iter = {0};
	GtkTreeSelection* sel = NULL;
	GtkTreeSelection* _tmp0_;
	GtkTreeSelection* _tmp1_;
	GtkTreeSelection* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	sel = _tmp1_;
	_tmp2_ = sel;
	if (gtk_tree_selection_count_selected_rows (_tmp2_) == 1) {
		GtkTreeModel* m = NULL;
		GList* rows = NULL;
		GtkTreeSelection* _tmp3_;
		GtkTreeModel* _tmp4_ = NULL;
		GList* _tmp5_;
		GtkTreeModel* _tmp6_;
		GtkTreeModel* _tmp7_;
		GList* _tmp8_;
		gconstpointer _tmp9_;
		GtkTreeIter _tmp10_ = {0};
		_tmp3_ = sel;
		_tmp5_ = gtk_tree_selection_get_selected_rows (_tmp3_, &_tmp4_);
		_g_object_unref0 (m);
		_tmp6_ = _g_object_ref0 (_tmp4_);
		m = _tmp6_;
		rows = _tmp5_;
		_tmp7_ = m;
		_tmp8_ = rows;
		_tmp9_ = _tmp8_->data;
		gtk_tree_model_get_iter (_tmp7_, &_tmp10_, (GtkTreePath*) _tmp9_);
		_vala_iter = _tmp10_;
		result = TRUE;
		(rows == NULL) ? NULL : (rows = (_g_list_free___vala_GtkTreePath_free0_ (rows), NULL));
		_g_object_unref0 (m);
		_g_object_unref0 (sel);
		if (iter) {
			*iter = _vala_iter;
		}
		return result;
	} else {
		memset (&_vala_iter, 0, sizeof (GtkTreeIter));
	}
	result = FALSE;
	_g_object_unref0 (sel);
	if (iter) {
		*iter = _vala_iter;
	}
	return result;
}

gpointer
gitg_sidebar_get_selected_item (GitgSidebar* self,
                                GType t_type,
                                GBoxedCopyFunc t_dup_func,
                                GDestroyNotify t_destroy_func)
{
	GtkTreeIter iter = {0};
	GtkTreeIter _tmp0_ = {0};
	gboolean _tmp1_;
	gpointer result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = gitg_sidebar_get_selected_iter (self, &_tmp0_);
	iter = _tmp0_;
	if (_tmp1_) {
		GitgSidebarStore* _tmp2_;
		GitgSidebarStore* _tmp3_;
		GtkTreeIter _tmp4_;
		GitgSidebarItem* _tmp5_;
		_tmp2_ = gitg_sidebar_get_model (self);
		_tmp3_ = _tmp2_;
		_tmp4_ = iter;
		_tmp5_ = gitg_sidebar_store_item_for_iter (_tmp3_, &_tmp4_);
		result = (gpointer) _tmp5_;
		return result;
	}
	result = NULL;
	return result;
}

static GtkTreePath*
_vala_GtkTreePath_copy (GtkTreePath* self)
{
	return g_boxed_copy (gtk_tree_path_get_type (), self);
}

static gpointer
__vala_GtkTreePath_copy0 (gpointer self)
{
	return self ? _vala_GtkTreePath_copy (self) : NULL;
}

static void
_vala_array_add15 (gpointer* * array,
                   gint* length,
                   gint* size,
                   gpointer value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gpointer, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

gpointer*
gitg_sidebar_get_selected_items (GitgSidebar* self,
                                 GType t_type,
                                 GBoxedCopyFunc t_dup_func,
                                 GDestroyNotify t_destroy_func,
                                 gint* result_length1)
{
	GtkTreeSelection* sel = NULL;
	GtkTreeSelection* _tmp0_;
	GtkTreeSelection* _tmp1_;
	GtkTreeModel* m = NULL;
	GtkTreeIter iter = {0};
	GList* rows = NULL;
	GtkTreeSelection* _tmp2_;
	GtkTreeModel* _tmp3_ = NULL;
	GList* _tmp4_;
	GtkTreeModel* _tmp5_;
	gpointer* ret = NULL;
	gpointer* _tmp6_;
	gint ret_length1;
	gint _ret_size_;
	GList* _tmp7_;
	gpointer* _tmp16_;
	gint _tmp16__length1;
	gpointer* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	sel = _tmp1_;
	_tmp2_ = sel;
	_tmp4_ = gtk_tree_selection_get_selected_rows (_tmp2_, &_tmp3_);
	_g_object_unref0 (m);
	_tmp5_ = _g_object_ref0 (_tmp3_);
	m = _tmp5_;
	rows = _tmp4_;
	_tmp6_ = g_new0 (gpointer, 0);
	ret = _tmp6_;
	ret_length1 = 0;
	_ret_size_ = ret_length1;
	_tmp7_ = rows;
	{
		GList* row_collection = NULL;
		GList* row_it = NULL;
		row_collection = _tmp7_;
		for (row_it = row_collection; row_it != NULL; row_it = row_it->next) {
			GtkTreePath* _tmp8_;
			GtkTreePath* row = NULL;
			_tmp8_ = __vala_GtkTreePath_copy0 ((GtkTreePath*) row_it->data);
			row = _tmp8_;
			{
				GtkTreeModel* _tmp9_;
				GtkTreePath* _tmp10_;
				GtkTreeIter _tmp11_ = {0};
				GitgSidebarStore* _tmp12_;
				GitgSidebarStore* _tmp13_;
				GtkTreeIter _tmp14_;
				GitgSidebarItem* _tmp15_;
				_tmp9_ = m;
				_tmp10_ = row;
				gtk_tree_model_get_iter (_tmp9_, &_tmp11_, _tmp10_);
				iter = _tmp11_;
				_tmp12_ = gitg_sidebar_get_model (self);
				_tmp13_ = _tmp12_;
				_tmp14_ = iter;
				_tmp15_ = gitg_sidebar_store_item_for_iter (_tmp13_, &_tmp14_);
				_vala_array_add15 (&ret, &ret_length1, &_ret_size_, (gpointer) _tmp15_);
				__vala_GtkTreePath_free0 (row);
			}
		}
	}
	_tmp16_ = ret;
	_tmp16__length1 = ret_length1;
	if (result_length1) {
		*result_length1 = _tmp16__length1;
	}
	result = _tmp16_;
	(rows == NULL) ? NULL : (rows = (_g_list_free___vala_GtkTreePath_free0_ (rows), NULL));
	_g_object_unref0 (m);
	_g_object_unref0 (sel);
	return result;
}

static Block29Data*
block29_data_ref (Block29Data* _data29_)
{
	g_atomic_int_inc (&_data29_->_ref_count_);
	return _data29_;
}

static void
block29_data_unref (void * _userdata_)
{
	Block29Data* _data29_;
	_data29_ = (Block29Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data29_->_ref_count_)) {
		GitgSidebar* self;
		self = _data29_->self;
		_g_object_unref0 (_data29_->item);
		_g_object_unref0 (self);
		g_slice_free (Block29Data, _data29_);
	}
}

static gboolean
__lambda92_ (Block29Data* _data29_,
             GtkTreeModel* m,
             GtkTreePath* path,
             GtkTreeIter* iter)
{
	GitgSidebar* self;
	GitgSidebarStore* _tmp0_;
	GitgSidebarStore* _tmp1_;
	GtkTreeIter _tmp2_;
	GitgSidebarItem* _tmp3_;
	GitgSidebarItem* _tmp4_;
	gboolean _tmp5_;
	gboolean result;
	self = _data29_->self;
	g_return_val_if_fail (m != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	g_return_val_if_fail (iter != NULL, FALSE);
	_tmp0_ = gitg_sidebar_get_model (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = *iter;
	_tmp3_ = gitg_sidebar_store_item_for_iter (_tmp1_, &_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ == _data29_->item;
	_g_object_unref0 (_tmp4_);
	if (_tmp5_) {
		GtkTreeSelection* _tmp6_;
		GtkTreeIter _tmp7_;
		_tmp6_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
		_tmp7_ = *iter;
		gtk_tree_selection_select_iter (_tmp6_, &_tmp7_);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static gboolean
___lambda92__gtk_tree_model_foreach_func (GtkTreeModel* model,
                                          GtkTreePath* path,
                                          GtkTreeIter* iter,
                                          gpointer self)
{
	gboolean result;
	result = __lambda92_ (self, model, path, iter);
	return result;
}

void
gitg_sidebar_select (GitgSidebar* self,
                     GitgSidebarItem* item)
{
	Block29Data* _data29_;
	GitgSidebarItem* _tmp0_;
	GitgSidebarStore* _tmp1_;
	GitgSidebarStore* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_data29_ = g_slice_new0 (Block29Data);
	_data29_->_ref_count_ = 1;
	_data29_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (item);
	_g_object_unref0 (_data29_->item);
	_data29_->item = _tmp0_;
	_tmp1_ = gitg_sidebar_get_model (self);
	_tmp2_ = _tmp1_;
	gtk_tree_model_foreach ((GtkTreeModel*) _tmp2_, ___lambda92__gtk_tree_model_foreach_func, _data29_);
	block29_data_unref (_data29_);
	_data29_ = NULL;
}

static Block30Data*
block30_data_ref (Block30Data* _data30_)
{
	g_atomic_int_inc (&_data30_->_ref_count_);
	return _data30_;
}

static void
block30_data_unref (void * _userdata_)
{
	Block30Data* _data30_;
	_data30_ = (Block30Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data30_->_ref_count_)) {
		GitgSidebar* self;
		self = _data30_->self;
		_g_object_unref0 (_data30_->item);
		_g_object_unref0 (self);
		g_slice_free (Block30Data, _data30_);
	}
}

static gboolean
__lambda93_ (Block30Data* _data30_,
             GtkTreeModel* m,
             GtkTreePath* path,
             GtkTreeIter* iter)
{
	GitgSidebar* self;
	GitgSidebarStore* _tmp0_;
	GitgSidebarStore* _tmp1_;
	GtkTreeIter _tmp2_;
	GitgSidebarItem* _tmp3_;
	GitgSidebarItem* _tmp4_;
	gboolean _tmp5_;
	gboolean result;
	self = _data30_->self;
	g_return_val_if_fail (m != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	g_return_val_if_fail (iter != NULL, FALSE);
	_tmp0_ = gitg_sidebar_get_model (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = *iter;
	_tmp3_ = gitg_sidebar_store_item_for_iter (_tmp1_, &_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ == _data30_->item;
	_g_object_unref0 (_tmp4_);
	if (_tmp5_) {
		GtkTreeSelection* _tmp6_;
		GtkTreeIter _tmp7_;
		_tmp6_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
		_tmp7_ = *iter;
		_data30_->retval = gtk_tree_selection_iter_is_selected (_tmp6_, &_tmp7_);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static gboolean
___lambda93__gtk_tree_model_foreach_func (GtkTreeModel* model,
                                          GtkTreePath* path,
                                          GtkTreeIter* iter,
                                          gpointer self)
{
	gboolean result;
	result = __lambda93_ (self, model, path, iter);
	return result;
}

gboolean
gitg_sidebar_is_selected (GitgSidebar* self,
                          GitgSidebarItem* item)
{
	Block30Data* _data30_;
	GitgSidebarItem* _tmp0_;
	GitgSidebarStore* _tmp1_;
	GitgSidebarStore* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (item != NULL, FALSE);
	_data30_ = g_slice_new0 (Block30Data);
	_data30_->_ref_count_ = 1;
	_data30_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (item);
	_g_object_unref0 (_data30_->item);
	_data30_->item = _tmp0_;
	_data30_->retval = FALSE;
	_tmp1_ = gitg_sidebar_get_model (self);
	_tmp2_ = _tmp1_;
	gtk_tree_model_foreach ((GtkTreeModel*) _tmp2_, ___lambda93__gtk_tree_model_foreach_func, _data30_);
	result = _data30_->retval;
	block30_data_unref (_data30_);
	_data30_ = NULL;
	return result;
}

static void
gitg_sidebar_real_row_activated (GtkTreeView* base,
                                 GtkTreePath* path,
                                 GtkTreeViewColumn* column)
{
	GitgSidebar * self;
	GitgSidebarStore* _tmp0_;
	GitgSidebarStore* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	GtkTreeIter iter = {0};
	GitgSidebarStore* _tmp4_;
	GitgSidebarStore* _tmp5_;
	GtkTreeIter _tmp6_ = {0};
	gboolean _tmp7_;
	self = (GitgSidebar*) base;
	g_return_if_fail (path != NULL);
	g_return_if_fail (column != NULL);
	_tmp0_ = gitg_sidebar_get_model (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gitg_sidebar_store_get_clearing (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		return;
	}
	_tmp4_ = gitg_sidebar_get_model (self);
	_tmp5_ = _tmp4_;
	_tmp7_ = gtk_tree_model_get_iter ((GtkTreeModel*) _tmp5_, &_tmp6_, path);
	iter = _tmp6_;
	if (_tmp7_) {
		GitgSidebarStore* _tmp8_;
		GitgSidebarStore* _tmp9_;
		GtkTreeIter _tmp10_;
		_tmp8_ = gitg_sidebar_get_model (self);
		_tmp9_ = _tmp8_;
		_tmp10_ = iter;
		gitg_sidebar_store_activate (_tmp9_, &_tmp10_, 2);
	}
}

static gboolean
gitg_sidebar_real_key_press_event (GtkWidget* base,
                                   GdkEventKey* event)
{
	GitgSidebar * self;
	gboolean result;
	self = (GitgSidebar*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	if ((event->state & gtk_accelerator_get_default_mod_mask ()) != 0) {
		result = GTK_WIDGET_CLASS (gitg_sidebar_parent_class)->key_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView), event);
		return result;
	}
	switch (event->keyval) {
		case GDK_KEY_Return:
		case GDK_KEY_ISO_Enter:
		case GDK_KEY_KP_Enter:
		case GDK_KEY_space:
		case GDK_KEY_KP_Space:
		{
			GtkTreePath* path = NULL;
			GtkTreeIter iter = {0};
			GtkTreePath* _tmp0_ = NULL;
			GtkTreeSelection* sel = NULL;
			GtkTreeSelection* _tmp1_;
			GtkTreeSelection* _tmp2_;
			GtkTreePath* _tmp3_;
			path = NULL;
			gtk_tree_view_get_cursor ((GtkTreeView*) self, &_tmp0_, NULL);
			__vala_GtkTreePath_free0 (path);
			path = _tmp0_;
			_tmp1_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
			_tmp2_ = _g_object_ref0 (_tmp1_);
			sel = _tmp2_;
			_tmp3_ = path;
			if (_tmp3_ != NULL) {
				GitgSidebarStore* _tmp4_;
				GitgSidebarStore* _tmp5_;
				GtkTreePath* _tmp6_;
				GtkTreeIter _tmp7_ = {0};
				gboolean _tmp8_;
				_tmp4_ = gitg_sidebar_get_model (self);
				_tmp5_ = _tmp4_;
				_tmp6_ = path;
				_tmp8_ = gtk_tree_model_get_iter ((GtkTreeModel*) _tmp5_, &_tmp7_, _tmp6_);
				iter = _tmp7_;
				if (_tmp8_) {
					GtkTreeSelection* _tmp9_;
					GtkTreeIter _tmp10_;
					_tmp9_ = sel;
					_tmp10_ = iter;
					if (gtk_tree_selection_iter_is_selected (_tmp9_, &_tmp10_)) {
						GitgSidebarStore* _tmp11_;
						GitgSidebarStore* _tmp12_;
						GtkTreeIter _tmp13_;
						_tmp11_ = gitg_sidebar_get_model (self);
						_tmp12_ = _tmp11_;
						_tmp13_ = iter;
						gitg_sidebar_store_activate (_tmp12_, &_tmp13_, 2);
					} else {
						GtkTreeSelection* _tmp14_;
						GtkTreeSelection* _tmp15_;
						GtkTreeIter _tmp16_;
						_tmp14_ = sel;
						gtk_tree_selection_unselect_all (_tmp14_);
						_tmp15_ = sel;
						_tmp16_ = iter;
						gtk_tree_selection_select_iter (_tmp15_, &_tmp16_);
					}
				}
			}
			result = TRUE;
			_g_object_unref0 (sel);
			__vala_GtkTreePath_free0 (path);
			return result;
		}
		default:
		break;
	}
	result = GTK_WIDGET_CLASS (gitg_sidebar_parent_class)->key_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView), event);
	return result;
}

static gboolean
gitg_sidebar_do_populate_popup (GitgSidebar* self,
                                GdkEventButton* event)
{
	GtkMenu* menu = NULL;
	GtkMenu* _tmp0_;
	GtkMenu* _tmp1_;
	GtkMenu* _tmp2_;
	GList* _tmp3_;
	GList* _tmp4_;
	gboolean _tmp5_;
	GtkMenu* _tmp6_;
	GtkMenu* _tmp7_;
	GtkMenu* _tmp8_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = (GtkMenu*) gtk_menu_new ();
	g_object_ref_sink (_tmp0_);
	menu = _tmp0_;
	_tmp1_ = menu;
	g_signal_emit (self, gitg_sidebar_signals[GITG_SIDEBAR_POPULATE_POPUP_SIGNAL], 0, _tmp1_);
	_tmp2_ = menu;
	_tmp3_ = gtk_container_get_children ((GtkContainer*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ == NULL;
	(_tmp4_ == NULL) ? NULL : (_tmp4_ = (g_list_free (_tmp4_), NULL));
	if (_tmp5_) {
		result = FALSE;
		_g_object_unref0 (menu);
		return result;
	}
	_tmp6_ = menu;
	gtk_widget_show_all ((GtkWidget*) _tmp6_);
	_tmp7_ = menu;
	gtk_menu_attach_to_widget (_tmp7_, (GtkWidget*) self, NULL);
	_tmp8_ = menu;
	gtk_menu_popup_at_pointer (_tmp8_, (GdkEvent*) event);
	result = TRUE;
	_g_object_unref0 (menu);
	return result;
}

static gboolean
gitg_sidebar_real_button_press_event (GtkWidget* base,
                                      GdkEventButton* event)
{
	GitgSidebar * self;
	GdkEvent* ev = NULL;
	GdkEvent* _tmp0_;
	gboolean result;
	self = (GitgSidebar*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	ev = (GdkEvent*) event;
	_tmp0_ = ev;
	if (gdk_event_triggers_context_menu (_tmp0_)) {
		GtkTreeSelection* _tmp1_;
		_tmp1_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
		if (gtk_tree_selection_count_selected_rows (_tmp1_) <= 1) {
			GTK_WIDGET_CLASS (gitg_sidebar_parent_class)->button_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView), event);
		}
		result = gitg_sidebar_do_populate_popup (self, event);
		return result;
	} else {
		result = GTK_WIDGET_CLASS (gitg_sidebar_parent_class)->button_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView), event);
		return result;
	}
}

static gboolean
gitg_sidebar_real_popup_menu (GtkWidget* base)
{
	GitgSidebar * self;
	gboolean result;
	self = (GitgSidebar*) base;
	result = gitg_sidebar_do_populate_popup (self, NULL);
	return result;
}

GitgSidebar*
gitg_sidebar_construct (GType object_type)
{
	GitgSidebar * self = NULL;
	self = (GitgSidebar*) g_object_new (object_type, NULL);
	return self;
}

GitgSidebar*
gitg_sidebar_new (void)
{
	return gitg_sidebar_construct (GITG_TYPE_SIDEBAR);
}

GitgSidebarStore*
gitg_sidebar_get_model (GitgSidebar* self)
{
	GitgSidebarStore* result;
	GtkTreeModel* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gtk_tree_view_get_model (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView));
	result = GITG_IS_SIDEBAR_STORE (_tmp0_) ? ((GitgSidebarStore*) _tmp0_) : NULL;
	return result;
}

void
gitg_sidebar_set_model (GitgSidebar* self,
                        GitgSidebarStore* value)
{
	g_return_if_fail (self != NULL);
	gtk_tree_view_set_model (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView), (GtkTreeModel*) value);
	g_object_notify_by_pspec ((GObject *) self, gitg_sidebar_properties[GITG_SIDEBAR_MODEL_PROPERTY]);
}

static void
_gitg_sidebar___lambda94_ (GitgSidebar* self,
                           GtkCellLayout* layout,
                           GtkCellRenderer* cell,
                           GtkTreeModel* model,
                           GtkTreeIter* iter)
{
	GitgSidebarItem* item = NULL;
	GtkTreeIter _tmp0_;
	GitgSidebarItem* _tmp1_ = NULL;
	GitgSidebarItem* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GtkCellRendererPixbuf* r = NULL;
	GtkCellRendererPixbuf* _tmp6_;
	GtkCellRendererPixbuf* _tmp7_;
	GitgSidebarItem* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	g_return_if_fail (layout != NULL);
	g_return_if_fail (cell != NULL);
	g_return_if_fail (model != NULL);
	g_return_if_fail (iter != NULL);
	_tmp0_ = *iter;
	gtk_tree_model_get (model, &_tmp0_, GITG_SIDEBAR_COLUMN_ITEM, &_tmp1_, -1);
	_g_object_unref0 (item);
	item = _tmp1_;
	_tmp2_ = item;
	_tmp3_ = gitg_sidebar_item_get_icon_name (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_;
	gtk_cell_renderer_set_visible (cell, _tmp5_ != NULL);
	_g_free0 (_tmp5_);
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (cell, gtk_cell_renderer_pixbuf_get_type (), GtkCellRendererPixbuf));
	r = _tmp6_;
	_tmp7_ = r;
	_tmp8_ = item;
	_tmp9_ = gitg_sidebar_item_get_icon_name (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = _tmp10_;
	g_object_set (_tmp7_, "icon-name", _tmp11_, NULL);
	_g_free0 (_tmp11_);
	_g_object_unref0 (r);
	_g_object_unref0 (item);
}

static void
__gitg_sidebar___lambda94__gtk_cell_layout_data_func (GtkCellLayout* cell_layout,
                                                      GtkCellRenderer* cell,
                                                      GtkTreeModel* tree_model,
                                                      GtkTreeIter* iter,
                                                      gpointer self)
{
	_gitg_sidebar___lambda94_ ((GitgSidebar*) self, cell_layout, cell, tree_model, iter);
}

static void
_gitg_sidebar___lambda95_ (GitgSidebar* self,
                           GtkCellLayout* layout,
                           GtkCellRenderer* cell,
                           GtkTreeModel* model,
                           GtkTreeIter* iter)
{
	GitgSidebarHint hint = 0;
	GitgSidebarItem* item = NULL;
	GtkTreeIter _tmp0_;
	GitgSidebarHint _tmp1_ = 0;
	GitgSidebarItem* _tmp2_ = NULL;
	GtkCellRendererText* r = NULL;
	GtkCellRendererText* _tmp3_;
	GtkCellRendererText* _tmp4_;
	GitgSidebarItem* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	g_return_if_fail (layout != NULL);
	g_return_if_fail (cell != NULL);
	g_return_if_fail (model != NULL);
	g_return_if_fail (iter != NULL);
	_tmp0_ = *iter;
	gtk_tree_model_get (model, &_tmp0_, GITG_SIDEBAR_COLUMN_HINT, &_tmp1_, GITG_SIDEBAR_COLUMN_ITEM, &_tmp2_, -1);
	hint = _tmp1_;
	_g_object_unref0 (item);
	item = _tmp2_;
	gtk_cell_renderer_set_visible (cell, hint == GITG_SIDEBAR_HINT_HEADER);
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (cell, gtk_cell_renderer_text_get_type (), GtkCellRendererText));
	r = _tmp3_;
	_tmp4_ = r;
	_tmp5_ = item;
	_tmp6_ = gitg_sidebar_item_get_text (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_;
	g_object_set (_tmp4_, "text", _tmp8_, NULL);
	_g_free0 (_tmp8_);
	_g_object_unref0 (r);
	_g_object_unref0 (item);
}

static void
__gitg_sidebar___lambda95__gtk_cell_layout_data_func (GtkCellLayout* cell_layout,
                                                      GtkCellRenderer* cell,
                                                      GtkTreeModel* tree_model,
                                                      GtkTreeIter* iter,
                                                      gpointer self)
{
	_gitg_sidebar___lambda95_ ((GitgSidebar*) self, cell_layout, cell, tree_model, iter);
}

static void
_gitg_sidebar___lambda96_ (GitgSidebar* self,
                           GtkCellLayout* layout,
                           GtkCellRenderer* cell,
                           GtkTreeModel* model,
                           GtkTreeIter* iter)
{
	GitgSidebarHint hint = 0;
	GitgSidebarItem* item = NULL;
	GtkTreeIter _tmp0_;
	GitgSidebarHint _tmp1_ = 0;
	GitgSidebarItem* _tmp2_ = NULL;
	GtkCellRendererText* r = NULL;
	GtkCellRendererText* _tmp3_;
	GtkCellRendererText* _tmp4_;
	GitgSidebarItem* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	g_return_if_fail (layout != NULL);
	g_return_if_fail (cell != NULL);
	g_return_if_fail (model != NULL);
	g_return_if_fail (iter != NULL);
	_tmp0_ = *iter;
	gtk_tree_model_get (model, &_tmp0_, GITG_SIDEBAR_COLUMN_HINT, &_tmp1_, GITG_SIDEBAR_COLUMN_ITEM, &_tmp2_, -1);
	hint = _tmp1_;
	_g_object_unref0 (item);
	item = _tmp2_;
	gtk_cell_renderer_set_visible (cell, hint != GITG_SIDEBAR_HINT_HEADER);
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (cell, gtk_cell_renderer_text_get_type (), GtkCellRendererText));
	r = _tmp3_;
	_tmp4_ = r;
	_tmp5_ = item;
	_tmp6_ = gitg_sidebar_item_get_text (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_;
	g_object_set (_tmp4_, "text", _tmp8_, NULL);
	_g_free0 (_tmp8_);
	if (hint == GITG_SIDEBAR_HINT_DUMMY) {
		GtkStyleContext* context = NULL;
		GtkStyleContext* _tmp9_;
		GtkStyleContext* _tmp10_;
		GtkStyleContext* _tmp11_;
		GtkStyleContext* _tmp12_;
		GdkRGBA col = {0};
		GtkStyleContext* _tmp13_;
		GtkStyleContext* _tmp14_;
		GdkRGBA _tmp15_ = {0};
		GtkStyleContext* _tmp16_;
		GtkCellRendererText* _tmp17_;
		GdkRGBA _tmp18_;
		_tmp9_ = gtk_widget_get_style_context ((GtkWidget*) self);
		_tmp10_ = _g_object_ref0 (_tmp9_);
		context = _tmp10_;
		_tmp11_ = context;
		gtk_style_context_save (_tmp11_);
		_tmp12_ = context;
		gtk_style_context_set_state (_tmp12_, GTK_STATE_FLAG_INSENSITIVE);
		_tmp13_ = context;
		_tmp14_ = context;
		gtk_style_context_get_color (_tmp13_, gtk_style_context_get_state (_tmp14_), &_tmp15_);
		col = _tmp15_;
		_tmp16_ = context;
		gtk_style_context_restore (_tmp16_);
		_tmp17_ = r;
		_tmp18_ = col;
		g_object_set (_tmp17_, "foreground-rgba", &_tmp18_, NULL);
		_g_object_unref0 (context);
	} else {
		GtkCellRendererText* _tmp19_;
		_tmp19_ = r;
		g_object_set (_tmp19_, "foreground-set", FALSE, NULL);
	}
	_g_object_unref0 (r);
	_g_object_unref0 (item);
}

static void
__gitg_sidebar___lambda96__gtk_cell_layout_data_func (GtkCellLayout* cell_layout,
                                                      GtkCellRenderer* cell,
                                                      GtkTreeModel* tree_model,
                                                      GtkTreeIter* iter,
                                                      gpointer self)
{
	_gitg_sidebar___lambda96_ ((GitgSidebar*) self, cell_layout, cell, tree_model, iter);
}

static gboolean
_gitg_sidebar___lambda97_ (GitgSidebar* self,
                           GtkTreeModel* model,
                           GtkTreeIter* iter)
{
	GitgSidebarHint hint = 0;
	GtkTreeIter _tmp0_;
	GitgSidebarHint _tmp1_ = 0;
	gboolean result;
	g_return_val_if_fail (model != NULL, FALSE);
	g_return_val_if_fail (iter != NULL, FALSE);
	_tmp0_ = *iter;
	gtk_tree_model_get (model, &_tmp0_, GITG_SIDEBAR_COLUMN_HINT, &_tmp1_, -1);
	hint = _tmp1_;
	result = hint == GITG_SIDEBAR_HINT_SEPARATOR;
	return result;
}

static gboolean
__gitg_sidebar___lambda97__gtk_tree_view_row_separator_func (GtkTreeModel* model,
                                                             GtkTreeIter* iter,
                                                             gpointer self)
{
	gboolean result;
	result = _gitg_sidebar___lambda97_ ((GitgSidebar*) self, model, iter);
	return result;
}

static gboolean
_gitg_sidebar_select_function_gtk_tree_selection_func (GtkTreeSelection* selection,
                                                       GtkTreeModel* model,
                                                       GtkTreePath* path,
                                                       gboolean path_currently_selected,
                                                       gpointer self)
{
	gboolean result;
	result = gitg_sidebar_select_function ((GitgSidebar*) self, selection, model, path, path_currently_selected);
	return result;
}

static void
_gitg_sidebar_selection_changed_gtk_tree_selection_changed (GtkTreeSelection* _sender,
                                                            gpointer self)
{
	gitg_sidebar_selection_changed ((GitgSidebar*) self, _sender);
}

static GObject *
gitg_sidebar_constructor (GType type,
                          guint n_construct_properties,
                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GitgSidebar * self;
	GtkTreeViewColumn* _tmp0_;
	GtkCellRendererPixbuf* _tmp1_;
	GtkTreeViewColumn* _tmp2_;
	GtkCellRendererText* _tmp3_;
	GtkTreeViewColumn* _tmp4_;
	GtkCellRendererText* _tmp5_;
	GtkTreeSelection* sel = NULL;
	GtkTreeSelection* _tmp6_;
	GtkTreeSelection* _tmp7_;
	GtkTreeSelection* _tmp8_;
	GtkTreeSelection* _tmp9_;
	parent_class = G_OBJECT_CLASS (gitg_sidebar_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_SIDEBAR, GitgSidebar);
	_tmp0_ = self->priv->d_column;
	_tmp1_ = self->priv->d_renderer_icon;
	gtk_cell_layout_set_cell_data_func ((GtkCellLayout*) _tmp0_, (GtkCellRenderer*) _tmp1_, __gitg_sidebar___lambda94__gtk_cell_layout_data_func, g_object_ref (self), g_object_unref);
	_tmp2_ = self->priv->d_column;
	_tmp3_ = self->priv->d_renderer_header;
	gtk_cell_layout_set_cell_data_func ((GtkCellLayout*) _tmp2_, (GtkCellRenderer*) _tmp3_, __gitg_sidebar___lambda95__gtk_cell_layout_data_func, g_object_ref (self), g_object_unref);
	_tmp4_ = self->priv->d_column;
	_tmp5_ = self->priv->d_renderer_text;
	gtk_cell_layout_set_cell_data_func ((GtkCellLayout*) _tmp4_, (GtkCellRenderer*) _tmp5_, __gitg_sidebar___lambda96__gtk_cell_layout_data_func, g_object_ref (self), g_object_unref);
	gtk_tree_view_set_row_separator_func ((GtkTreeView*) self, __gitg_sidebar___lambda97__gtk_tree_view_row_separator_func, g_object_ref (self), g_object_unref);
	_tmp6_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
	_tmp7_ = _g_object_ref0 (_tmp6_);
	sel = _tmp7_;
	_tmp8_ = sel;
	gtk_tree_selection_set_select_function (_tmp8_, _gitg_sidebar_select_function_gtk_tree_selection_func, g_object_ref (self), g_object_unref);
	_tmp9_ = sel;
	g_signal_connect_object (_tmp9_, "changed", (GCallback) _gitg_sidebar_selection_changed_gtk_tree_selection_changed, self, 0);
	_g_object_unref0 (sel);
	return obj;
}

static void
gitg_sidebar_class_init (GitgSidebarClass * klass,
                         gpointer klass_data)
{
	gitg_sidebar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GitgSidebar_private_offset);
	((GitgSidebarClass *) klass)->select_function = (gboolean (*) (GitgSidebar*, GtkTreeSelection*, GtkTreeModel*, GtkTreePath*, gboolean)) gitg_sidebar_real_select_function;
	((GitgSidebarClass *) klass)->selection_changed = (void (*) (GitgSidebar*, GtkTreeSelection*)) gitg_sidebar_real_selection_changed;
	((GtkTreeViewClass *) klass)->row_activated = (void (*) (GtkTreeView*, GtkTreePath*, GtkTreeViewColumn*)) gitg_sidebar_real_row_activated;
	((GtkWidgetClass *) klass)->key_press_event = (gboolean (*) (GtkWidget*, GdkEventKey*)) gitg_sidebar_real_key_press_event;
	((GtkWidgetClass *) klass)->button_press_event = (gboolean (*) (GtkWidget*, GdkEventButton*)) gitg_sidebar_real_button_press_event;
	((GtkWidgetClass *) klass)->popup_menu = (gboolean (*) (GtkWidget*)) gitg_sidebar_real_popup_menu;
	G_OBJECT_CLASS (klass)->get_property = _vala_gitg_sidebar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gitg_sidebar_set_property;
	G_OBJECT_CLASS (klass)->constructor = gitg_sidebar_constructor;
	G_OBJECT_CLASS (klass)->finalize = gitg_sidebar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_SIDEBAR_MODEL_PROPERTY, gitg_sidebar_properties[GITG_SIDEBAR_MODEL_PROPERTY] = g_param_spec_object ("model", "model", "model", GITG_TYPE_SIDEBAR_STORE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/gitg/ui/gitg-sidebar.ui");
	gitg_sidebar_signals[GITG_SIDEBAR_DESELECTED_SIGNAL] = g_signal_new ("deselected", GITG_TYPE_SIDEBAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gitg_sidebar_signals[GITG_SIDEBAR_POPULATE_POPUP_SIGNAL] = g_signal_new ("populate-popup", GITG_TYPE_SIDEBAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, gtk_menu_get_type ());
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "column", FALSE, GitgSidebar_private_offset + G_STRUCT_OFFSET (GitgSidebarPrivate, d_column));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "renderer_icon", FALSE, GitgSidebar_private_offset + G_STRUCT_OFFSET (GitgSidebarPrivate, d_renderer_icon));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "renderer_header", FALSE, GitgSidebar_private_offset + G_STRUCT_OFFSET (GitgSidebarPrivate, d_renderer_header));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "renderer_text", FALSE, GitgSidebar_private_offset + G_STRUCT_OFFSET (GitgSidebarPrivate, d_renderer_text));
}

static void
gitg_sidebar_instance_init (GitgSidebar * self,
                            gpointer klass)
{
	self->priv = gitg_sidebar_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
gitg_sidebar_finalize (GObject * obj)
{
	GitgSidebar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_SIDEBAR, GitgSidebar);
	G_OBJECT_CLASS (gitg_sidebar_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gitg_sidebar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GitgSidebarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_sidebar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgSidebar), 0, (GInstanceInitFunc) gitg_sidebar_instance_init, NULL };
	GType gitg_sidebar_type_id;
	gitg_sidebar_type_id = g_type_register_static (gtk_tree_view_get_type (), "GitgSidebar", &g_define_type_info, 0);
	GitgSidebar_private_offset = g_type_add_instance_private (gitg_sidebar_type_id, sizeof (GitgSidebarPrivate));
	return gitg_sidebar_type_id;
}

GType
gitg_sidebar_get_type (void)
{
	static gsize gitg_sidebar_type_id__once = 0;
	if (g_once_init_enter (&gitg_sidebar_type_id__once)) {
		GType gitg_sidebar_type_id;
		gitg_sidebar_type_id = gitg_sidebar_get_type_once ();
		g_once_init_leave (&gitg_sidebar_type_id__once, gitg_sidebar_type_id);
	}
	return gitg_sidebar_type_id__once;
}

static void
_vala_gitg_sidebar_get_property (GObject * object,
                                 guint property_id,
                                 GValue * value,
                                 GParamSpec * pspec)
{
	GitgSidebar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_SIDEBAR, GitgSidebar);
	switch (property_id) {
		case GITG_SIDEBAR_MODEL_PROPERTY:
		g_value_set_object (value, gitg_sidebar_get_model (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gitg_sidebar_set_property (GObject * object,
                                 guint property_id,
                                 const GValue * value,
                                 GParamSpec * pspec)
{
	GitgSidebar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_SIDEBAR, GitgSidebar);
	switch (property_id) {
		case GITG_SIDEBAR_MODEL_PROPERTY:
		gitg_sidebar_set_model (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

