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

/*
* Copyright (c) 2011-2013 Yorba Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program 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 this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/

#include "io.elementary.photos.h"
#include <glib-object.h>
#include <glib.h>
#include <gee.h>
#include <gobject/gvaluecollector.h>
#include <string.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

#define SIDEBAR_BRANCH_TYPE_NODE (sidebar_branch_node_get_type ())
#define SIDEBAR_BRANCH_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_BRANCH_TYPE_NODE, SidebarBranchNode))
#define SIDEBAR_BRANCH_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDEBAR_BRANCH_TYPE_NODE, SidebarBranchNodeClass))
#define SIDEBAR_BRANCH_IS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_BRANCH_TYPE_NODE))
#define SIDEBAR_BRANCH_IS_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDEBAR_BRANCH_TYPE_NODE))
#define SIDEBAR_BRANCH_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDEBAR_BRANCH_TYPE_NODE, SidebarBranchNodeClass))

typedef struct _SidebarBranchNode SidebarBranchNode;
typedef struct _SidebarBranchNodeClass SidebarBranchNodeClass;
enum  {
	SIDEBAR_BRANCH_0_PROPERTY,
	SIDEBAR_BRANCH_NUM_PROPERTIES
};
static GParamSpec* sidebar_branch_properties[SIDEBAR_BRANCH_NUM_PROPERTIES];
#define _sidebar_branch_node_unref0(var) ((var == NULL) ? NULL : (var = (sidebar_branch_node_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _SidebarBranchNodePrivate SidebarBranchNodePrivate;
typedef void (*SidebarBranchNodePruneCallback) (SidebarBranchNode* node, gpointer user_data);
typedef void (*SidebarBranchNodeChildrenReorderedCallback) (SidebarBranchNode* node, gpointer user_data);
typedef struct _SidebarBranchParamSpecNode SidebarBranchParamSpecNode;
enum  {
	SIDEBAR_BRANCH_ENTRY_ADDED_SIGNAL,
	SIDEBAR_BRANCH_ENTRY_REMOVED_SIGNAL,
	SIDEBAR_BRANCH_ENTRY_MOVED_SIGNAL,
	SIDEBAR_BRANCH_ENTRY_REPARENTED_SIGNAL,
	SIDEBAR_BRANCH_CHILDREN_REORDERED_SIGNAL,
	SIDEBAR_BRANCH_SHOW_BRANCH_SIGNAL,
	SIDEBAR_BRANCH_NUM_SIGNALS
};
static guint sidebar_branch_signals[SIDEBAR_BRANCH_NUM_SIGNALS] = {0};
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _SidebarBranchPrivate {
	SidebarBranchNode* root;
	SidebarBranchOptions options;
	gboolean shown;
	GCompareFunc default_comparator;
	GeeHashMap* map;
};

struct _SidebarBranchNode {
	GTypeInstance parent_instance;
	volatile int ref_count;
	SidebarBranchNodePrivate * priv;
	SidebarEntry* entry;
	SidebarBranchNode* parent;
	GCompareFunc comparator;
	GeeSortedSet* children;
};

struct _SidebarBranchNodeClass {
	GTypeClass parent_class;
	void (*finalize) (SidebarBranchNode *self);
};

struct _SidebarBranchParamSpecNode {
	GParamSpec parent_instance;
};

static gint SidebarBranch_private_offset;
static gpointer sidebar_branch_parent_class = NULL;
static gpointer sidebar_branch_node_parent_class = NULL;

static gpointer sidebar_branch_node_ref (gpointer instance);
static void sidebar_branch_node_unref (gpointer instance);
static GParamSpec* sidebar_branch_param_spec_node (const gchar* name,
                                            const gchar* nick,
                                            const gchar* blurb,
                                            GType object_type,
                                            GParamFlags flags) G_GNUC_UNUSED ;
static void sidebar_branch_value_set_node (GValue* value,
                                    gpointer v_object) G_GNUC_UNUSED ;
static void sidebar_branch_value_take_node (GValue* value,
                                     gpointer v_object) G_GNUC_UNUSED ;
static gpointer sidebar_branch_value_get_node (const GValue* value) G_GNUC_UNUSED ;
static GType sidebar_branch_node_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static SidebarBranchNode* sidebar_branch_node_new (SidebarEntry* entry,
                                            SidebarBranchNode* parent,
                                            GCompareFunc comparator);
static SidebarBranchNode* sidebar_branch_node_construct (GType object_type,
                                                  SidebarEntry* entry,
                                                  SidebarBranchNode* parent,
                                                  GCompareFunc comparator);
static void sidebar_branch_node_add_child (SidebarBranchNode* self,
                                    SidebarBranchNode* child);
static void sidebar_branch_node_prune_children (SidebarBranchNode* self,
                                         SidebarBranchNodePruneCallback cb,
                                         gpointer cb_target);
static void sidebar_branch_prune_callback (SidebarBranch* self,
                                    SidebarBranchNode* node);
static void _sidebar_branch_prune_callback_sidebar_branch_node_prune_callback (SidebarBranchNode* node,
                                                                        gpointer self);
static void sidebar_branch_node_remove_child (SidebarBranchNode* self,
                                       SidebarBranchNode* child);
static gboolean sidebar_branch_node_has_children (SidebarBranchNode* self);
static gboolean sidebar_branch_node_reorder_child (SidebarBranchNode* self,
                                            SidebarBranchNode* child);
static void sidebar_branch_node_reorder_children (SidebarBranchNode* self,
                                           gboolean recursive,
                                           SidebarBranchNodeChildrenReorderedCallback cb,
                                           gpointer cb_target);
static void sidebar_branch_children_reordered_callback (SidebarBranch* self,
                                                 SidebarBranchNode* node);
static void _sidebar_branch_children_reordered_callback_sidebar_branch_node_children_reordered_callback (SidebarBranchNode* node,
                                                                                                  gpointer self);
static void sidebar_branch_node_change_comparator (SidebarBranchNode* self,
                                            GCompareFunc comparator,
                                            gboolean recursive,
                                            SidebarBranchNodeChildrenReorderedCallback cb,
                                            gpointer cb_target);
static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static gint sidebar_branch_node_comparator_wrapper (SidebarBranchNode* a,
                                             SidebarBranchNode* b);
static gint _sidebar_branch_node_comparator_wrapper_gcompare_data_func (gconstpointer a,
                                                                 gconstpointer b,
                                                                 gpointer self);
static gint sidebar_branch_node_index_of_by_reference (SidebarBranchNode* self,
                                                SidebarBranchNode* child);
static void sidebar_branch_node_finalize (SidebarBranchNode * obj);
static GType sidebar_branch_node_get_type_once (void);
static void sidebar_branch_finalize (GObject * obj);
static GType sidebar_branch_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
sidebar_branch_get_instance_private (SidebarBranch* self)
{
	return G_STRUCT_MEMBER_P (self, SidebarBranch_private_offset);
}

gboolean
sidebar_branch_options_is_hide_if_empty (SidebarBranchOptions self)
{
	gboolean result;
	result = (self & SIDEBAR_BRANCH_OPTIONS_HIDE_IF_EMPTY) != 0;
	return result;
}

gboolean
sidebar_branch_options_is_auto_open_on_new_child (SidebarBranchOptions self)
{
	gboolean result;
	result = (self & SIDEBAR_BRANCH_OPTIONS_AUTO_OPEN_ON_NEW_CHILD) != 0;
	return result;
}

gboolean
sidebar_branch_options_is_startup_expand_to_first_child (SidebarBranchOptions self)
{
	gboolean result;
	result = (self & SIDEBAR_BRANCH_OPTIONS_STARTUP_EXPAND_TO_FIRST_CHILD) != 0;
	return result;
}

gboolean
sidebar_branch_options_is_startup_open_grouping (SidebarBranchOptions self)
{
	gboolean result;
	result = (self & SIDEBAR_BRANCH_OPTIONS_STARTUP_OPEN_GROUPING) != 0;
	return result;
}

static GType
sidebar_branch_options_get_type_once (void)
{
	static const GFlagsValue values[] = {{SIDEBAR_BRANCH_OPTIONS_NONE, "SIDEBAR_BRANCH_OPTIONS_NONE", "none"}, {SIDEBAR_BRANCH_OPTIONS_HIDE_IF_EMPTY, "SIDEBAR_BRANCH_OPTIONS_HIDE_IF_EMPTY", "hide-if-empty"}, {SIDEBAR_BRANCH_OPTIONS_AUTO_OPEN_ON_NEW_CHILD, "SIDEBAR_BRANCH_OPTIONS_AUTO_OPEN_ON_NEW_CHILD", "auto-open-on-new-child"}, {SIDEBAR_BRANCH_OPTIONS_STARTUP_EXPAND_TO_FIRST_CHILD, "SIDEBAR_BRANCH_OPTIONS_STARTUP_EXPAND_TO_FIRST_CHILD", "startup-expand-to-first-child"}, {SIDEBAR_BRANCH_OPTIONS_STARTUP_OPEN_GROUPING, "SIDEBAR_BRANCH_OPTIONS_STARTUP_OPEN_GROUPING", "startup-open-grouping"}, {0, NULL, NULL}};
	GType sidebar_branch_options_type_id;
	sidebar_branch_options_type_id = g_flags_register_static ("SidebarBranchOptions", values);
	return sidebar_branch_options_type_id;
}

GType
sidebar_branch_options_get_type (void)
{
	static volatile gsize sidebar_branch_options_type_id__once = 0;
	if (g_once_init_enter (&sidebar_branch_options_type_id__once)) {
		GType sidebar_branch_options_type_id;
		sidebar_branch_options_type_id = sidebar_branch_options_get_type_once ();
		g_once_init_leave (&sidebar_branch_options_type_id__once, sidebar_branch_options_type_id);
	}
	return sidebar_branch_options_type_id__once;
}

SidebarBranch*
sidebar_branch_construct (GType object_type,
                          SidebarEntry* root,
                          SidebarBranchOptions options,
                          GCompareFunc default_comparator,
                          GCompareFunc root_comparator)
{
	SidebarBranch * self = NULL;
	GCompareFunc _tmp0_ = NULL;
	SidebarBranchNode* _tmp1_;
	GeeHashMap* _tmp2_;
	SidebarBranchNode* _tmp3_;
	g_return_val_if_fail (root != NULL, NULL);
	self = (SidebarBranch*) g_object_new (object_type, NULL);
	self->priv->default_comparator = default_comparator;
	if (root_comparator != NULL) {
		_tmp0_ = root_comparator;
	} else {
		_tmp0_ = default_comparator;
	}
	_tmp1_ = sidebar_branch_node_new (root, NULL, _tmp0_);
	_sidebar_branch_node_unref0 (self->priv->root);
	self->priv->root = _tmp1_;
	self->priv->options = options;
	_tmp2_ = self->priv->map;
	_tmp3_ = self->priv->root;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp2_, root, _tmp3_);
	if (sidebar_branch_options_is_hide_if_empty (options)) {
		sidebar_branch_set_show_branch (self, FALSE);
	}
	return self;
}

SidebarBranch*
sidebar_branch_new (SidebarEntry* root,
                    SidebarBranchOptions options,
                    GCompareFunc default_comparator,
                    GCompareFunc root_comparator)
{
	return sidebar_branch_construct (SIDEBAR_TYPE_BRANCH, root, options, default_comparator, root_comparator);
}

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

SidebarEntry*
sidebar_branch_get_root (SidebarBranch* self)
{
	SidebarBranchNode* _tmp0_;
	SidebarEntry* _tmp1_;
	SidebarEntry* _tmp2_;
	SidebarEntry* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->root;
	_tmp1_ = _tmp0_->entry;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	result = _tmp2_;
	return result;
}

void
sidebar_branch_set_show_branch (SidebarBranch* self,
                                gboolean shown)
{
	g_return_if_fail (self != NULL);
	if (self->priv->shown == shown) {
		return;
	}
	self->priv->shown = shown;
	g_signal_emit (self, sidebar_branch_signals[SIDEBAR_BRANCH_SHOW_BRANCH_SIGNAL], 0, shown);
}

gboolean
sidebar_branch_get_show_branch (SidebarBranch* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->shown;
	return result;
}

gboolean
sidebar_branch_is_auto_open_on_new_child (SidebarBranch* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = sidebar_branch_options_is_auto_open_on_new_child (self->priv->options);
	return result;
}

gboolean
sidebar_branch_is_startup_expand_to_first_child (SidebarBranch* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = sidebar_branch_options_is_startup_expand_to_first_child (self->priv->options);
	return result;
}

gboolean
sidebar_branch_is_startup_open_grouping (SidebarBranch* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = sidebar_branch_options_is_startup_open_grouping (self->priv->options);
	return result;
}

void
sidebar_branch_graft (SidebarBranch* self,
                      SidebarEntry* parent,
                      SidebarEntry* entry,
                      GCompareFunc comparator)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp1_;
	SidebarBranchNode* parent_node = NULL;
	GeeHashMap* _tmp2_;
	gpointer _tmp3_;
	GCompareFunc _tmp4_ = NULL;
	SidebarBranchNode* entry_node = NULL;
	SidebarBranchNode* _tmp6_;
	SidebarBranchNode* _tmp7_;
	SidebarBranchNode* _tmp8_;
	GeeHashMap* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (parent != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = self->priv->map;
	_vala_assert (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, parent), "map.has_key (parent)");
	_tmp1_ = self->priv->map;
	_vala_assert (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp1_, entry), "!map.has_key (entry)");
	if (sidebar_branch_options_is_hide_if_empty (self->priv->options)) {
		sidebar_branch_set_show_branch (self, TRUE);
	}
	_tmp2_ = self->priv->map;
	_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp2_, parent);
	parent_node = (SidebarBranchNode*) _tmp3_;
	if (comparator != NULL) {
		_tmp4_ = comparator;
	} else {
		GCompareFunc _tmp5_;
		_tmp5_ = self->priv->default_comparator;
		_tmp4_ = _tmp5_;
	}
	_tmp6_ = parent_node;
	_tmp7_ = sidebar_branch_node_new (entry, _tmp6_, _tmp4_);
	entry_node = _tmp7_;
	_tmp8_ = parent_node;
	sidebar_branch_node_add_child (_tmp8_, entry_node);
	_tmp9_ = self->priv->map;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp9_, entry, entry_node);
	g_signal_emit (self, sidebar_branch_signals[SIDEBAR_BRANCH_ENTRY_ADDED_SIGNAL], 0, entry);
	_sidebar_branch_node_unref0 (entry_node);
	_sidebar_branch_node_unref0 (parent_node);
}

static void
_sidebar_branch_prune_callback_sidebar_branch_node_prune_callback (SidebarBranchNode* node,
                                                                   gpointer self)
{
	sidebar_branch_prune_callback ((SidebarBranch*) self, node);
}

void
sidebar_branch_prune (SidebarBranch* self,
                      SidebarEntry* entry)
{
	SidebarBranchNode* _tmp0_;
	SidebarEntry* _tmp1_;
	GeeHashMap* _tmp2_;
	SidebarBranchNode* entry_node = NULL;
	GeeHashMap* _tmp3_;
	gpointer _tmp4_;
	SidebarBranchNode* _tmp5_;
	SidebarBranchNode* _tmp6_;
	SidebarBranchNode* _tmp7_;
	SidebarBranchNode* _tmp8_;
	SidebarBranchNode* _tmp9_;
	SidebarBranchNode* _tmp10_;
	gboolean removed = FALSE;
	GeeHashMap* _tmp11_;
	gboolean _tmp12_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = self->priv->root;
	_tmp1_ = _tmp0_->entry;
	_vala_assert (entry != _tmp1_, "entry != root.entry");
	_tmp2_ = self->priv->map;
	_vala_assert (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp2_, entry), "map.has_key (entry)");
	_tmp3_ = self->priv->map;
	_tmp4_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp3_, entry);
	entry_node = (SidebarBranchNode*) _tmp4_;
	_tmp5_ = entry_node;
	sidebar_branch_node_prune_children (_tmp5_, _sidebar_branch_prune_callback_sidebar_branch_node_prune_callback, self);
	_tmp6_ = entry_node;
	_tmp7_ = _tmp6_->parent;
	_vala_assert (_tmp7_ != NULL, "entry_node.parent != null");
	_tmp8_ = entry_node;
	_tmp9_ = _tmp8_->parent;
	_tmp10_ = entry_node;
	sidebar_branch_node_remove_child (_tmp9_, _tmp10_);
	_tmp11_ = self->priv->map;
	removed = gee_abstract_map_unset ((GeeAbstractMap*) _tmp11_, entry, NULL);
	_vala_assert (removed, "removed");
	g_signal_emit (self, sidebar_branch_signals[SIDEBAR_BRANCH_ENTRY_REMOVED_SIGNAL], 0, entry);
	if (sidebar_branch_options_is_hide_if_empty (self->priv->options)) {
		SidebarBranchNode* _tmp13_;
		_tmp13_ = self->priv->root;
		_tmp12_ = !sidebar_branch_node_has_children (_tmp13_);
	} else {
		_tmp12_ = FALSE;
	}
	if (_tmp12_) {
		sidebar_branch_set_show_branch (self, FALSE);
	}
	_sidebar_branch_node_unref0 (entry_node);
}

void
sidebar_branch_reparent (SidebarBranch* self,
                         SidebarEntry* new_parent,
                         SidebarEntry* entry)
{
	SidebarBranchNode* _tmp0_;
	SidebarEntry* _tmp1_;
	GeeHashMap* _tmp2_;
	GeeHashMap* _tmp3_;
	SidebarBranchNode* entry_node = NULL;
	GeeHashMap* _tmp4_;
	gpointer _tmp5_;
	SidebarBranchNode* new_parent_node = NULL;
	GeeHashMap* _tmp6_;
	gpointer _tmp7_;
	SidebarBranchNode* _tmp8_;
	SidebarEntry* old_parent = NULL;
	SidebarBranchNode* _tmp9_;
	SidebarEntry* _tmp10_;
	SidebarEntry* _tmp11_;
	SidebarBranchNode* _tmp12_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_parent != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = self->priv->root;
	_tmp1_ = _tmp0_->entry;
	_vala_assert (entry != _tmp1_, "entry != root.entry");
	_tmp2_ = self->priv->map;
	_vala_assert (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp2_, entry), "map.has_key (entry)");
	_tmp3_ = self->priv->map;
	_vala_assert (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp3_, new_parent), "map.has_key (new_parent)");
	_tmp4_ = self->priv->map;
	_tmp5_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp4_, entry);
	entry_node = (SidebarBranchNode*) _tmp5_;
	_tmp6_ = self->priv->map;
	_tmp7_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp6_, new_parent);
	new_parent_node = (SidebarBranchNode*) _tmp7_;
	_tmp8_ = entry_node->parent;
	_vala_assert (_tmp8_ != NULL, "entry_node.parent != null");
	_tmp9_ = entry_node->parent;
	_tmp10_ = _tmp9_->entry;
	_tmp11_ = _g_object_ref0 (_tmp10_);
	old_parent = _tmp11_;
	_tmp12_ = entry_node->parent;
	sidebar_branch_node_remove_child (_tmp12_, entry_node);
	sidebar_branch_node_add_child (new_parent_node, entry_node);
	g_signal_emit (self, sidebar_branch_signals[SIDEBAR_BRANCH_ENTRY_REPARENTED_SIGNAL], 0, entry, old_parent);
	_g_object_unref0 (old_parent);
	_sidebar_branch_node_unref0 (new_parent_node);
	_sidebar_branch_node_unref0 (entry_node);
}

gboolean
sidebar_branch_has_entry (SidebarBranch* self,
                          SidebarEntry* entry)
{
	gboolean _tmp0_ = FALSE;
	SidebarBranchNode* _tmp1_;
	SidebarEntry* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	_tmp1_ = self->priv->root;
	_tmp2_ = _tmp1_->entry;
	if (_tmp2_ == entry) {
		_tmp0_ = TRUE;
	} else {
		GeeHashMap* _tmp3_;
		_tmp3_ = self->priv->map;
		_tmp0_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp3_, entry);
	}
	result = _tmp0_;
	return result;
}

void
sidebar_branch_reorder (SidebarBranch* self,
                        SidebarEntry* entry)
{
	SidebarBranchNode* _tmp0_;
	SidebarEntry* _tmp1_;
	SidebarBranchNode* entry_node = NULL;
	GeeHashMap* _tmp2_;
	gpointer _tmp3_;
	SidebarBranchNode* _tmp4_;
	SidebarBranchNode* _tmp5_;
	SidebarBranchNode* _tmp6_;
	SidebarBranchNode* _tmp7_;
	SidebarBranchNode* _tmp8_;
	SidebarBranchNode* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = self->priv->root;
	_tmp1_ = _tmp0_->entry;
	_vala_assert (entry != _tmp1_, "entry != root.entry");
	_tmp2_ = self->priv->map;
	_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp2_, entry);
	entry_node = (SidebarBranchNode*) _tmp3_;
	_tmp4_ = entry_node;
	_vala_assert (_tmp4_ != NULL, "entry_node != null");
	_tmp5_ = entry_node;
	_tmp6_ = _tmp5_->parent;
	_vala_assert (_tmp6_ != NULL, "entry_node.parent != null");
	_tmp7_ = entry_node;
	_tmp8_ = _tmp7_->parent;
	_tmp9_ = entry_node;
	if (sidebar_branch_node_reorder_child (_tmp8_, _tmp9_)) {
		g_signal_emit (self, sidebar_branch_signals[SIDEBAR_BRANCH_ENTRY_MOVED_SIGNAL], 0, entry);
	}
	_sidebar_branch_node_unref0 (entry_node);
}

static void
_sidebar_branch_children_reordered_callback_sidebar_branch_node_children_reordered_callback (SidebarBranchNode* node,
                                                                                             gpointer self)
{
	sidebar_branch_children_reordered_callback ((SidebarBranch*) self, node);
}

void
sidebar_branch_reorder_all (SidebarBranch* self)
{
	SidebarBranchNode* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->root;
	sidebar_branch_node_reorder_children (_tmp0_, TRUE, _sidebar_branch_children_reordered_callback_sidebar_branch_node_children_reordered_callback, self);
}

void
sidebar_branch_reorder_children (SidebarBranch* self,
                                 SidebarEntry* entry,
                                 gboolean recursive)
{
	SidebarBranchNode* entry_node = NULL;
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = self->priv->map;
	_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, entry);
	entry_node = (SidebarBranchNode*) _tmp1_;
	_vala_assert (entry_node != NULL, "entry_node != null");
	sidebar_branch_node_reorder_children (entry_node, recursive, _sidebar_branch_children_reordered_callback_sidebar_branch_node_children_reordered_callback, self);
	_sidebar_branch_node_unref0 (entry_node);
}

void
sidebar_branch_change_all_comparators (SidebarBranch* self,
                                       GCompareFunc comparator)
{
	SidebarBranchNode* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->root;
	sidebar_branch_node_change_comparator (_tmp0_, comparator, TRUE, _sidebar_branch_children_reordered_callback_sidebar_branch_node_children_reordered_callback, self);
}

void
sidebar_branch_change_comparator (SidebarBranch* self,
                                  SidebarEntry* entry,
                                  gboolean recursive,
                                  GCompareFunc comparator)
{
	SidebarBranchNode* entry_node = NULL;
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = self->priv->map;
	_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, entry);
	entry_node = (SidebarBranchNode*) _tmp1_;
	_vala_assert (entry_node != NULL, "entry_node != null");
	sidebar_branch_node_change_comparator (entry_node, comparator, recursive, _sidebar_branch_children_reordered_callback_sidebar_branch_node_children_reordered_callback, self);
	_sidebar_branch_node_unref0 (entry_node);
}

gint
sidebar_branch_get_child_count (SidebarBranch* self,
                                SidebarEntry* parent)
{
	SidebarBranchNode* parent_node = NULL;
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	SidebarBranchNode* _tmp2_;
	gint _tmp3_ = 0;
	SidebarBranchNode* _tmp4_;
	GeeSortedSet* _tmp5_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (parent != NULL, -1);
	_tmp0_ = self->priv->map;
	_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, parent);
	parent_node = (SidebarBranchNode*) _tmp1_;
	_tmp2_ = parent_node;
	_vala_assert (_tmp2_ != NULL, "parent_node != null");
	_tmp4_ = parent_node;
	_tmp5_ = _tmp4_->children;
	if (_tmp5_ != NULL) {
		SidebarBranchNode* _tmp6_;
		GeeSortedSet* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		_tmp6_ = parent_node;
		_tmp7_ = _tmp6_->children;
		_tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_);
		_tmp9_ = _tmp8_;
		_tmp3_ = _tmp9_;
	} else {
		_tmp3_ = 0;
	}
	result = _tmp3_;
	_sidebar_branch_node_unref0 (parent_node);
	return result;
}

GeeList*
sidebar_branch_get_children (SidebarBranch* self,
                             SidebarEntry* parent)
{
	GeeHashMap* _tmp0_;
	SidebarBranchNode* parent_node = NULL;
	GeeHashMap* _tmp1_;
	gpointer _tmp2_;
	SidebarBranchNode* _tmp3_;
	GeeSortedSet* _tmp4_;
	GeeList* child_entries = NULL;
	GeeArrayList* _tmp5_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (parent != NULL, NULL);
	_tmp0_ = self->priv->map;
	_vala_assert (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, parent), "map.has_key (parent)");
	_tmp1_ = self->priv->map;
	_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, parent);
	parent_node = (SidebarBranchNode*) _tmp2_;
	_tmp3_ = parent_node;
	_tmp4_ = _tmp3_->children;
	if (_tmp4_ == NULL) {
		result = NULL;
		_sidebar_branch_node_unref0 (parent_node);
		return result;
	}
	_tmp5_ = gee_array_list_new (SIDEBAR_TYPE_ENTRY, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	child_entries = (GeeList*) _tmp5_;
	{
		GeeIterator* _child_it = NULL;
		SidebarBranchNode* _tmp6_;
		GeeSortedSet* _tmp7_;
		GeeIterator* _tmp8_;
		_tmp6_ = parent_node;
		_tmp7_ = _tmp6_->children;
		_tmp8_ = gee_iterable_iterator ((GeeIterable*) _tmp7_);
		_child_it = _tmp8_;
		while (TRUE) {
			GeeIterator* _tmp9_;
			SidebarBranchNode* child = NULL;
			GeeIterator* _tmp10_;
			gpointer _tmp11_;
			GeeList* _tmp12_;
			SidebarBranchNode* _tmp13_;
			SidebarEntry* _tmp14_;
			_tmp9_ = _child_it;
			if (!gee_iterator_next (_tmp9_)) {
				break;
			}
			_tmp10_ = _child_it;
			_tmp11_ = gee_iterator_get (_tmp10_);
			child = (SidebarBranchNode*) _tmp11_;
			_tmp12_ = child_entries;
			_tmp13_ = child;
			_tmp14_ = _tmp13_->entry;
			gee_collection_add ((GeeCollection*) _tmp12_, _tmp14_);
			_sidebar_branch_node_unref0 (child);
		}
		_g_object_unref0 (_child_it);
	}
	result = child_entries;
	_sidebar_branch_node_unref0 (parent_node);
	return result;
}

SidebarEntry*
sidebar_branch_find_first_child (SidebarBranch* self,
                                 SidebarEntry* parent,
                                 Locator locator,
                                 gpointer locator_target)
{
	SidebarBranchNode* parent_node = NULL;
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	SidebarBranchNode* _tmp2_;
	SidebarBranchNode* _tmp3_;
	GeeSortedSet* _tmp4_;
	SidebarEntry* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (parent != NULL, NULL);
	_tmp0_ = self->priv->map;
	_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, parent);
	parent_node = (SidebarBranchNode*) _tmp1_;
	_tmp2_ = parent_node;
	_vala_assert (_tmp2_ != NULL, "parent_node != null");
	_tmp3_ = parent_node;
	_tmp4_ = _tmp3_->children;
	if (_tmp4_ == NULL) {
		result = NULL;
		_sidebar_branch_node_unref0 (parent_node);
		return result;
	}
	{
		GeeIterator* _child_it = NULL;
		SidebarBranchNode* _tmp5_;
		GeeSortedSet* _tmp6_;
		GeeIterator* _tmp7_;
		_tmp5_ = parent_node;
		_tmp6_ = _tmp5_->children;
		_tmp7_ = gee_iterable_iterator ((GeeIterable*) _tmp6_);
		_child_it = _tmp7_;
		while (TRUE) {
			GeeIterator* _tmp8_;
			SidebarBranchNode* child = NULL;
			GeeIterator* _tmp9_;
			gpointer _tmp10_;
			SidebarBranchNode* _tmp11_;
			SidebarEntry* _tmp12_;
			_tmp8_ = _child_it;
			if (!gee_iterator_next (_tmp8_)) {
				break;
			}
			_tmp9_ = _child_it;
			_tmp10_ = gee_iterator_get (_tmp9_);
			child = (SidebarBranchNode*) _tmp10_;
			_tmp11_ = child;
			_tmp12_ = _tmp11_->entry;
			if (locator (_tmp12_, locator_target)) {
				SidebarBranchNode* _tmp13_;
				SidebarEntry* _tmp14_;
				SidebarEntry* _tmp15_;
				_tmp13_ = child;
				_tmp14_ = _tmp13_->entry;
				_tmp15_ = _g_object_ref0 (_tmp14_);
				result = _tmp15_;
				_sidebar_branch_node_unref0 (child);
				_g_object_unref0 (_child_it);
				_sidebar_branch_node_unref0 (parent_node);
				return result;
			}
			_sidebar_branch_node_unref0 (child);
		}
		_g_object_unref0 (_child_it);
	}
	result = NULL;
	_sidebar_branch_node_unref0 (parent_node);
	return result;
}

SidebarEntry*
sidebar_branch_get_parent (SidebarBranch* self,
                           SidebarEntry* entry)
{
	SidebarBranchNode* _tmp0_;
	SidebarEntry* _tmp1_;
	SidebarBranchNode* entry_node = NULL;
	GeeHashMap* _tmp2_;
	gpointer _tmp3_;
	SidebarBranchNode* _tmp4_;
	SidebarBranchNode* _tmp5_;
	SidebarBranchNode* _tmp6_;
	SidebarBranchNode* _tmp7_;
	SidebarBranchNode* _tmp8_;
	SidebarEntry* _tmp9_;
	SidebarEntry* _tmp10_;
	SidebarEntry* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	_tmp0_ = self->priv->root;
	_tmp1_ = _tmp0_->entry;
	if (entry == _tmp1_) {
		result = NULL;
		return result;
	}
	_tmp2_ = self->priv->map;
	_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp2_, entry);
	entry_node = (SidebarBranchNode*) _tmp3_;
	_tmp4_ = entry_node;
	_vala_assert (_tmp4_ != NULL, "entry_node != null");
	_tmp5_ = entry_node;
	_tmp6_ = _tmp5_->parent;
	_vala_assert (_tmp6_ != NULL, "entry_node.parent != null");
	_tmp7_ = entry_node;
	_tmp8_ = _tmp7_->parent;
	_tmp9_ = _tmp8_->entry;
	_tmp10_ = _g_object_ref0 (_tmp9_);
	result = _tmp10_;
	_sidebar_branch_node_unref0 (entry_node);
	return result;
}

SidebarEntry*
sidebar_branch_get_previous_sibling (SidebarBranch* self,
                                     SidebarEntry* entry)
{
	SidebarBranchNode* _tmp0_;
	SidebarEntry* _tmp1_;
	SidebarBranchNode* entry_node = NULL;
	GeeHashMap* _tmp2_;
	gpointer _tmp3_;
	SidebarBranchNode* _tmp4_;
	SidebarBranchNode* _tmp5_;
	SidebarBranchNode* _tmp6_;
	SidebarBranchNode* _tmp7_;
	SidebarBranchNode* _tmp8_;
	GeeSortedSet* _tmp9_;
	SidebarBranchNode* sibling = NULL;
	SidebarBranchNode* _tmp10_;
	SidebarBranchNode* _tmp11_;
	GeeSortedSet* _tmp12_;
	SidebarBranchNode* _tmp13_;
	gpointer _tmp14_;
	SidebarEntry* _tmp15_ = NULL;
	SidebarBranchNode* _tmp16_;
	SidebarEntry* _tmp19_;
	SidebarEntry* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	_tmp0_ = self->priv->root;
	_tmp1_ = _tmp0_->entry;
	if (entry == _tmp1_) {
		result = NULL;
		return result;
	}
	_tmp2_ = self->priv->map;
	_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp2_, entry);
	entry_node = (SidebarBranchNode*) _tmp3_;
	_tmp4_ = entry_node;
	_vala_assert (_tmp4_ != NULL, "entry_node != null");
	_tmp5_ = entry_node;
	_tmp6_ = _tmp5_->parent;
	_vala_assert (_tmp6_ != NULL, "entry_node.parent != null");
	_tmp7_ = entry_node;
	_tmp8_ = _tmp7_->parent;
	_tmp9_ = _tmp8_->children;
	_vala_assert (_tmp9_ != NULL, "entry_node.parent.children != null");
	_tmp10_ = entry_node;
	_tmp11_ = _tmp10_->parent;
	_tmp12_ = _tmp11_->children;
	_tmp13_ = entry_node;
	_tmp14_ = gee_sorted_set_lower (_tmp12_, _tmp13_);
	sibling = (SidebarBranchNode*) _tmp14_;
	_tmp16_ = sibling;
	if (_tmp16_ != NULL) {
		SidebarBranchNode* _tmp17_;
		SidebarEntry* _tmp18_;
		_tmp17_ = sibling;
		_tmp18_ = _tmp17_->entry;
		_tmp15_ = _tmp18_;
	} else {
		_tmp15_ = NULL;
	}
	_tmp19_ = _g_object_ref0 (_tmp15_);
	result = _tmp19_;
	_sidebar_branch_node_unref0 (sibling);
	_sidebar_branch_node_unref0 (entry_node);
	return result;
}

SidebarEntry*
sidebar_branch_get_next_sibling (SidebarBranch* self,
                                 SidebarEntry* entry)
{
	SidebarBranchNode* _tmp0_;
	SidebarEntry* _tmp1_;
	SidebarBranchNode* entry_node = NULL;
	GeeHashMap* _tmp2_;
	gpointer _tmp3_;
	SidebarBranchNode* _tmp4_;
	SidebarBranchNode* _tmp5_;
	SidebarBranchNode* _tmp6_;
	SidebarBranchNode* _tmp7_;
	SidebarBranchNode* _tmp8_;
	GeeSortedSet* _tmp9_;
	SidebarBranchNode* sibling = NULL;
	SidebarBranchNode* _tmp10_;
	SidebarBranchNode* _tmp11_;
	GeeSortedSet* _tmp12_;
	SidebarBranchNode* _tmp13_;
	gpointer _tmp14_;
	SidebarEntry* _tmp15_ = NULL;
	SidebarBranchNode* _tmp16_;
	SidebarEntry* _tmp19_;
	SidebarEntry* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	_tmp0_ = self->priv->root;
	_tmp1_ = _tmp0_->entry;
	if (entry == _tmp1_) {
		result = NULL;
		return result;
	}
	_tmp2_ = self->priv->map;
	_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp2_, entry);
	entry_node = (SidebarBranchNode*) _tmp3_;
	_tmp4_ = entry_node;
	_vala_assert (_tmp4_ != NULL, "entry_node != null");
	_tmp5_ = entry_node;
	_tmp6_ = _tmp5_->parent;
	_vala_assert (_tmp6_ != NULL, "entry_node.parent != null");
	_tmp7_ = entry_node;
	_tmp8_ = _tmp7_->parent;
	_tmp9_ = _tmp8_->children;
	_vala_assert (_tmp9_ != NULL, "entry_node.parent.children != null");
	_tmp10_ = entry_node;
	_tmp11_ = _tmp10_->parent;
	_tmp12_ = _tmp11_->children;
	_tmp13_ = entry_node;
	_tmp14_ = gee_sorted_set_higher (_tmp12_, _tmp13_);
	sibling = (SidebarBranchNode*) _tmp14_;
	_tmp16_ = sibling;
	if (_tmp16_ != NULL) {
		SidebarBranchNode* _tmp17_;
		SidebarEntry* _tmp18_;
		_tmp17_ = sibling;
		_tmp18_ = _tmp17_->entry;
		_tmp15_ = _tmp18_;
	} else {
		_tmp15_ = NULL;
	}
	_tmp19_ = _g_object_ref0 (_tmp15_);
	result = _tmp19_;
	_sidebar_branch_node_unref0 (sibling);
	_sidebar_branch_node_unref0 (entry_node);
	return result;
}

static void
sidebar_branch_prune_callback (SidebarBranch* self,
                               SidebarBranchNode* node)
{
	SidebarEntry* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = node->entry;
	g_signal_emit (self, sidebar_branch_signals[SIDEBAR_BRANCH_ENTRY_REMOVED_SIGNAL], 0, _tmp0_);
}

static void
sidebar_branch_children_reordered_callback (SidebarBranch* self,
                                            SidebarBranchNode* node)
{
	SidebarEntry* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = node->entry;
	g_signal_emit (self, sidebar_branch_signals[SIDEBAR_BRANCH_CHILDREN_REORDERED_SIGNAL], 0, _tmp0_);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_object (param_values + 2), data2);
}

static SidebarBranchNode*
sidebar_branch_node_construct (GType object_type,
                               SidebarEntry* entry,
                               SidebarBranchNode* parent,
                               GCompareFunc comparator)
{
	SidebarBranchNode* self = NULL;
	SidebarEntry* _tmp0_;
	g_return_val_if_fail (entry != NULL, NULL);
	self = (SidebarBranchNode*) g_type_create_instance (object_type);
	_tmp0_ = _g_object_ref0 (entry);
	_g_object_unref0 (self->entry);
	self->entry = _tmp0_;
	self->parent = parent;
	self->comparator = comparator;
	return self;
}

static SidebarBranchNode*
sidebar_branch_node_new (SidebarEntry* entry,
                         SidebarBranchNode* parent,
                         GCompareFunc comparator)
{
	return sidebar_branch_node_construct (SIDEBAR_BRANCH_TYPE_NODE, entry, parent, comparator);
}

static gint
sidebar_branch_node_comparator_wrapper (SidebarBranchNode* a,
                                        SidebarBranchNode* b)
{
	SidebarBranchNode* _tmp0_;
	SidebarBranchNode* _tmp1_;
	SidebarBranchNode* _tmp2_;
	GCompareFunc _tmp3_;
	SidebarEntry* _tmp4_;
	SidebarEntry* _tmp5_;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	if (a == b) {
		result = 0;
		return result;
	}
	_tmp0_ = a->parent;
	_tmp1_ = b->parent;
	_vala_assert (_tmp0_ == _tmp1_, "a.parent == b.parent");
	_tmp2_ = a->parent;
	_tmp3_ = _tmp2_->comparator;
	_tmp4_ = a->entry;
	_tmp5_ = b->entry;
	result = _tmp3_ (_tmp4_, _tmp5_);
	return result;
}

static gboolean
sidebar_branch_node_has_children (SidebarBranchNode* self)
{
	gboolean _tmp0_ = FALSE;
	GeeSortedSet* _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp1_ = self->children;
	if (_tmp1_ != NULL) {
		GeeSortedSet* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		_tmp2_ = self->children;
		_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_ > 0;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gint
_sidebar_branch_node_comparator_wrapper_gcompare_data_func (gconstpointer a,
                                                            gconstpointer b,
                                                            gpointer self)
{
	gint result;
	result = sidebar_branch_node_comparator_wrapper ((SidebarBranchNode*) a, (SidebarBranchNode*) b);
	return result;
}

static void
sidebar_branch_node_add_child (SidebarBranchNode* self,
                               SidebarBranchNode* child)
{
	GeeSortedSet* _tmp0_;
	gboolean added = FALSE;
	GeeSortedSet* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (child != NULL);
	child->parent = self;
	_tmp0_ = self->children;
	if (_tmp0_ == NULL) {
		GeeTreeSet* _tmp1_;
		_tmp1_ = gee_tree_set_new (SIDEBAR_BRANCH_TYPE_NODE, (GBoxedCopyFunc) sidebar_branch_node_ref, (GDestroyNotify) sidebar_branch_node_unref, _sidebar_branch_node_comparator_wrapper_gcompare_data_func, NULL, NULL);
		_g_object_unref0 (self->children);
		self->children = (GeeSortedSet*) _tmp1_;
	}
	_tmp2_ = self->children;
	added = gee_collection_add ((GeeCollection*) _tmp2_, child);
	_vala_assert (added, "added");
}

static void
sidebar_branch_node_remove_child (SidebarBranchNode* self,
                                  SidebarBranchNode* child)
{
	GeeSortedSet* _tmp0_;
	GeeSortedSet* new_children = NULL;
	GeeTreeSet* _tmp1_;
	gboolean found = FALSE;
	GeeSortedSet* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (child != NULL);
	_tmp0_ = self->children;
	_vala_assert (_tmp0_ != NULL, "children != null");
	_tmp1_ = gee_tree_set_new (SIDEBAR_BRANCH_TYPE_NODE, (GBoxedCopyFunc) sidebar_branch_node_ref, (GDestroyNotify) sidebar_branch_node_unref, _sidebar_branch_node_comparator_wrapper_gcompare_data_func, NULL, NULL);
	new_children = (GeeSortedSet*) _tmp1_;
	found = FALSE;
	{
		GeeIterator* _c_it = NULL;
		GeeSortedSet* _tmp2_;
		GeeIterator* _tmp3_;
		_tmp2_ = self->children;
		_tmp3_ = gee_iterable_iterator ((GeeIterable*) _tmp2_);
		_c_it = _tmp3_;
		while (TRUE) {
			GeeIterator* _tmp4_;
			SidebarBranchNode* c = NULL;
			GeeIterator* _tmp5_;
			gpointer _tmp6_;
			SidebarBranchNode* _tmp7_;
			_tmp4_ = _c_it;
			if (!gee_iterator_next (_tmp4_)) {
				break;
			}
			_tmp5_ = _c_it;
			_tmp6_ = gee_iterator_get (_tmp5_);
			c = (SidebarBranchNode*) _tmp6_;
			_tmp7_ = c;
			if (_tmp7_ != child) {
				GeeSortedSet* _tmp8_;
				SidebarBranchNode* _tmp9_;
				_tmp8_ = new_children;
				_tmp9_ = c;
				gee_collection_add ((GeeCollection*) _tmp8_, _tmp9_);
			} else {
				found = TRUE;
			}
			_sidebar_branch_node_unref0 (c);
		}
		_g_object_unref0 (_c_it);
	}
	_vala_assert (found, "found");
	_tmp10_ = new_children;
	_tmp11_ = gee_collection_get_size ((GeeCollection*) _tmp10_);
	_tmp12_ = _tmp11_;
	if (_tmp12_ != 0) {
		GeeSortedSet* _tmp13_;
		GeeSortedSet* _tmp14_;
		_tmp13_ = new_children;
		_tmp14_ = _g_object_ref0 (_tmp13_);
		_g_object_unref0 (self->children);
		self->children = _tmp14_;
	} else {
		_g_object_unref0 (self->children);
		self->children = NULL;
	}
	child->parent = NULL;
	_g_object_unref0 (new_children);
}

static void
sidebar_branch_node_prune_children (SidebarBranchNode* self,
                                    SidebarBranchNodePruneCallback cb,
                                    gpointer cb_target)
{
	GeeSortedSet* _tmp0_;
	GeeSortedSet* old_children = NULL;
	GeeSortedSet* _tmp7_;
	GeeSortedSet* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->children;
	if (_tmp0_ == NULL) {
		return;
	}
	{
		GeeIterator* _child_it = NULL;
		GeeSortedSet* _tmp1_;
		GeeIterator* _tmp2_;
		_tmp1_ = self->children;
		_tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_);
		_child_it = _tmp2_;
		while (TRUE) {
			GeeIterator* _tmp3_;
			SidebarBranchNode* child = NULL;
			GeeIterator* _tmp4_;
			gpointer _tmp5_;
			SidebarBranchNode* _tmp6_;
			_tmp3_ = _child_it;
			if (!gee_iterator_next (_tmp3_)) {
				break;
			}
			_tmp4_ = _child_it;
			_tmp5_ = gee_iterator_get (_tmp4_);
			child = (SidebarBranchNode*) _tmp5_;
			_tmp6_ = child;
			sidebar_branch_node_prune_children (_tmp6_, cb, cb_target);
			_sidebar_branch_node_unref0 (child);
		}
		_g_object_unref0 (_child_it);
	}
	_tmp7_ = self->children;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	old_children = _tmp8_;
	_g_object_unref0 (self->children);
	self->children = NULL;
	{
		GeeIterator* _child_it = NULL;
		GeeSortedSet* _tmp9_;
		GeeIterator* _tmp10_;
		_tmp9_ = old_children;
		_tmp10_ = gee_iterable_iterator ((GeeIterable*) _tmp9_);
		_child_it = _tmp10_;
		while (TRUE) {
			GeeIterator* _tmp11_;
			SidebarBranchNode* child = NULL;
			GeeIterator* _tmp12_;
			gpointer _tmp13_;
			SidebarBranchNode* _tmp14_;
			_tmp11_ = _child_it;
			if (!gee_iterator_next (_tmp11_)) {
				break;
			}
			_tmp12_ = _child_it;
			_tmp13_ = gee_iterator_get (_tmp12_);
			child = (SidebarBranchNode*) _tmp13_;
			_tmp14_ = child;
			cb (_tmp14_, cb_target);
			_sidebar_branch_node_unref0 (child);
		}
		_g_object_unref0 (_child_it);
	}
	_g_object_unref0 (old_children);
}

static gint
sidebar_branch_node_index_of_by_reference (SidebarBranchNode* self,
                                           SidebarBranchNode* child)
{
	GeeSortedSet* _tmp0_;
	gint index = 0;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (child != NULL, -1);
	_tmp0_ = self->children;
	if (_tmp0_ == NULL) {
		result = -1;
		return result;
	}
	index = 0;
	{
		GeeIterator* _c_it = NULL;
		GeeSortedSet* _tmp1_;
		GeeIterator* _tmp2_;
		_tmp1_ = self->children;
		_tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_);
		_c_it = _tmp2_;
		while (TRUE) {
			GeeIterator* _tmp3_;
			SidebarBranchNode* c = NULL;
			GeeIterator* _tmp4_;
			gpointer _tmp5_;
			SidebarBranchNode* _tmp6_;
			gint _tmp7_;
			_tmp3_ = _c_it;
			if (!gee_iterator_next (_tmp3_)) {
				break;
			}
			_tmp4_ = _c_it;
			_tmp5_ = gee_iterator_get (_tmp4_);
			c = (SidebarBranchNode*) _tmp5_;
			_tmp6_ = c;
			if (child == _tmp6_) {
				result = index;
				_sidebar_branch_node_unref0 (c);
				_g_object_unref0 (_c_it);
				return result;
			}
			_tmp7_ = index;
			index = _tmp7_ + 1;
			_sidebar_branch_node_unref0 (c);
		}
		_g_object_unref0 (_c_it);
	}
	result = -1;
	return result;
}

static gboolean
sidebar_branch_node_reorder_child (SidebarBranchNode* self,
                                   SidebarBranchNode* child)
{
	GeeSortedSet* _tmp0_;
	gint old_index = 0;
	GeeSortedSet* new_children = NULL;
	GeeTreeSet* _tmp1_;
	gboolean added = FALSE;
	GeeSortedSet* _tmp2_;
	GeeSortedSet* _tmp3_;
	gint new_index = 0;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (child != NULL, FALSE);
	_tmp0_ = self->children;
	_vala_assert (_tmp0_ != NULL, "children != null");
	old_index = sidebar_branch_node_index_of_by_reference (self, child);
	_vala_assert (old_index >= 0, "old_index >= 0");
	_tmp1_ = gee_tree_set_new (SIDEBAR_BRANCH_TYPE_NODE, (GBoxedCopyFunc) sidebar_branch_node_ref, (GDestroyNotify) sidebar_branch_node_unref, _sidebar_branch_node_comparator_wrapper_gcompare_data_func, NULL, NULL);
	new_children = (GeeSortedSet*) _tmp1_;
	_tmp2_ = self->children;
	added = gee_collection_add_all ((GeeCollection*) new_children, (GeeCollection*) _tmp2_);
	_vala_assert (added, "added");
	_tmp3_ = _g_object_ref0 (new_children);
	_g_object_unref0 (self->children);
	self->children = _tmp3_;
	new_index = sidebar_branch_node_index_of_by_reference (self, child);
	_vala_assert (new_index >= 0, "new_index >= 0");
	result = old_index != new_index;
	_g_object_unref0 (new_children);
	return result;
}

static void
sidebar_branch_node_reorder_children (SidebarBranchNode* self,
                                      gboolean recursive,
                                      SidebarBranchNodeChildrenReorderedCallback cb,
                                      gpointer cb_target)
{
	GeeSortedSet* _tmp0_;
	GeeSortedSet* reordered = NULL;
	GeeTreeSet* _tmp1_;
	GeeSortedSet* _tmp2_;
	GeeSortedSet* _tmp3_;
	GeeSortedSet* _tmp4_;
	GeeSortedSet* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->children;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = gee_tree_set_new (SIDEBAR_BRANCH_TYPE_NODE, (GBoxedCopyFunc) sidebar_branch_node_ref, (GDestroyNotify) sidebar_branch_node_unref, _sidebar_branch_node_comparator_wrapper_gcompare_data_func, NULL, NULL);
	reordered = (GeeSortedSet*) _tmp1_;
	_tmp2_ = reordered;
	_tmp3_ = self->children;
	gee_collection_add_all ((GeeCollection*) _tmp2_, (GeeCollection*) _tmp3_);
	_tmp4_ = reordered;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	_g_object_unref0 (self->children);
	self->children = _tmp5_;
	if (recursive) {
		{
			GeeIterator* _child_it = NULL;
			GeeSortedSet* _tmp6_;
			GeeIterator* _tmp7_;
			_tmp6_ = self->children;
			_tmp7_ = gee_iterable_iterator ((GeeIterable*) _tmp6_);
			_child_it = _tmp7_;
			while (TRUE) {
				GeeIterator* _tmp8_;
				SidebarBranchNode* child = NULL;
				GeeIterator* _tmp9_;
				gpointer _tmp10_;
				SidebarBranchNode* _tmp11_;
				_tmp8_ = _child_it;
				if (!gee_iterator_next (_tmp8_)) {
					break;
				}
				_tmp9_ = _child_it;
				_tmp10_ = gee_iterator_get (_tmp9_);
				child = (SidebarBranchNode*) _tmp10_;
				_tmp11_ = child;
				sidebar_branch_node_reorder_children (_tmp11_, TRUE, cb, cb_target);
				_sidebar_branch_node_unref0 (child);
			}
			_g_object_unref0 (_child_it);
		}
	}
	cb (self, cb_target);
	_g_object_unref0 (reordered);
}

static void
sidebar_branch_node_change_comparator (SidebarBranchNode* self,
                                       GCompareFunc comparator,
                                       gboolean recursive,
                                       SidebarBranchNodeChildrenReorderedCallback cb,
                                       gpointer cb_target)
{
	g_return_if_fail (self != NULL);
	self->comparator = comparator;
	sidebar_branch_node_reorder_children (self, FALSE, cb, cb_target);
	if (recursive) {
		{
			GeeIterator* _child_it = NULL;
			GeeSortedSet* _tmp0_;
			GeeIterator* _tmp1_;
			_tmp0_ = self->children;
			_tmp1_ = gee_iterable_iterator ((GeeIterable*) _tmp0_);
			_child_it = _tmp1_;
			while (TRUE) {
				GeeIterator* _tmp2_;
				SidebarBranchNode* child = NULL;
				GeeIterator* _tmp3_;
				gpointer _tmp4_;
				SidebarBranchNode* _tmp5_;
				_tmp2_ = _child_it;
				if (!gee_iterator_next (_tmp2_)) {
					break;
				}
				_tmp3_ = _child_it;
				_tmp4_ = gee_iterator_get (_tmp3_);
				child = (SidebarBranchNode*) _tmp4_;
				_tmp5_ = child;
				sidebar_branch_node_change_comparator (_tmp5_, comparator, TRUE, cb, cb_target);
				_sidebar_branch_node_unref0 (child);
			}
			_g_object_unref0 (_child_it);
		}
	}
}

static void
sidebar_branch_value_node_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
sidebar_branch_value_node_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		sidebar_branch_node_unref (value->data[0].v_pointer);
	}
}

static void
sidebar_branch_value_node_copy_value (const GValue* src_value,
                                      GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = sidebar_branch_node_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
sidebar_branch_value_node_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
sidebar_branch_value_node_collect_value (GValue* value,
                                         guint n_collect_values,
                                         GTypeCValue* collect_values,
                                         guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		SidebarBranchNode * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = sidebar_branch_node_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
sidebar_branch_value_node_lcopy_value (const GValue* value,
                                       guint n_collect_values,
                                       GTypeCValue* collect_values,
                                       guint collect_flags)
{
	SidebarBranchNode ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = sidebar_branch_node_ref (value->data[0].v_pointer);
	}
	return NULL;
}

static GParamSpec*
sidebar_branch_param_spec_node (const gchar* name,
                                const gchar* nick,
                                const gchar* blurb,
                                GType object_type,
                                GParamFlags flags)
{
	SidebarBranchParamSpecNode* spec;
	g_return_val_if_fail (g_type_is_a (object_type, SIDEBAR_BRANCH_TYPE_NODE), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

static gpointer
sidebar_branch_value_get_node (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, SIDEBAR_BRANCH_TYPE_NODE), NULL);
	return value->data[0].v_pointer;
}

static void
sidebar_branch_value_set_node (GValue* value,
                               gpointer v_object)
{
	SidebarBranchNode * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, SIDEBAR_BRANCH_TYPE_NODE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, SIDEBAR_BRANCH_TYPE_NODE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		sidebar_branch_node_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		sidebar_branch_node_unref (old);
	}
}

static void
sidebar_branch_value_take_node (GValue* value,
                                gpointer v_object)
{
	SidebarBranchNode * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, SIDEBAR_BRANCH_TYPE_NODE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, SIDEBAR_BRANCH_TYPE_NODE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		sidebar_branch_node_unref (old);
	}
}

static void
sidebar_branch_node_class_init (SidebarBranchNodeClass * klass,
                                gpointer klass_data)
{
	sidebar_branch_node_parent_class = g_type_class_peek_parent (klass);
	((SidebarBranchNodeClass *) klass)->finalize = sidebar_branch_node_finalize;
}

static void
sidebar_branch_node_instance_init (SidebarBranchNode * self,
                                   gpointer klass)
{
	self->children = NULL;
	self->ref_count = 1;
}

static void
sidebar_branch_node_finalize (SidebarBranchNode * obj)
{
	SidebarBranchNode * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SIDEBAR_BRANCH_TYPE_NODE, SidebarBranchNode);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->entry);
	_g_object_unref0 (self->children);
}

static GType
sidebar_branch_node_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { sidebar_branch_value_node_init, sidebar_branch_value_node_free_value, sidebar_branch_value_node_copy_value, sidebar_branch_value_node_peek_pointer, "p", sidebar_branch_value_node_collect_value, "p", sidebar_branch_value_node_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (SidebarBranchNodeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sidebar_branch_node_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SidebarBranchNode), 0, (GInstanceInitFunc) sidebar_branch_node_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType sidebar_branch_node_type_id;
	sidebar_branch_node_type_id = g_type_register_fundamental (g_type_fundamental_next (), "SidebarBranchNode", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return sidebar_branch_node_type_id;
}

static GType
sidebar_branch_node_get_type (void)
{
	static volatile gsize sidebar_branch_node_type_id__once = 0;
	if (g_once_init_enter (&sidebar_branch_node_type_id__once)) {
		GType sidebar_branch_node_type_id;
		sidebar_branch_node_type_id = sidebar_branch_node_get_type_once ();
		g_once_init_leave (&sidebar_branch_node_type_id__once, sidebar_branch_node_type_id);
	}
	return sidebar_branch_node_type_id__once;
}

static gpointer
sidebar_branch_node_ref (gpointer instance)
{
	SidebarBranchNode * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

static void
sidebar_branch_node_unref (gpointer instance)
{
	SidebarBranchNode * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		SIDEBAR_BRANCH_NODE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static void
sidebar_branch_class_init (SidebarBranchClass * klass,
                           gpointer klass_data)
{
	sidebar_branch_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SidebarBranch_private_offset);
	G_OBJECT_CLASS (klass)->finalize = sidebar_branch_finalize;
	sidebar_branch_signals[SIDEBAR_BRANCH_ENTRY_ADDED_SIGNAL] = g_signal_new ("entry-added", SIDEBAR_TYPE_BRANCH, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SIDEBAR_TYPE_ENTRY);
	sidebar_branch_signals[SIDEBAR_BRANCH_ENTRY_REMOVED_SIGNAL] = g_signal_new ("entry-removed", SIDEBAR_TYPE_BRANCH, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SIDEBAR_TYPE_ENTRY);
	sidebar_branch_signals[SIDEBAR_BRANCH_ENTRY_MOVED_SIGNAL] = g_signal_new ("entry-moved", SIDEBAR_TYPE_BRANCH, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SIDEBAR_TYPE_ENTRY);
	sidebar_branch_signals[SIDEBAR_BRANCH_ENTRY_REPARENTED_SIGNAL] = g_signal_new ("entry-reparented", SIDEBAR_TYPE_BRANCH, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, SIDEBAR_TYPE_ENTRY, SIDEBAR_TYPE_ENTRY);
	sidebar_branch_signals[SIDEBAR_BRANCH_CHILDREN_REORDERED_SIGNAL] = g_signal_new ("children-reordered", SIDEBAR_TYPE_BRANCH, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SIDEBAR_TYPE_ENTRY);
	sidebar_branch_signals[SIDEBAR_BRANCH_SHOW_BRANCH_SIGNAL] = g_signal_new ("show-branch", SIDEBAR_TYPE_BRANCH, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
}

static void
sidebar_branch_instance_init (SidebarBranch * self,
                              gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = sidebar_branch_get_instance_private (self);
	self->priv->shown = TRUE;
	_tmp0_ = gee_hash_map_new (SIDEBAR_TYPE_ENTRY, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, SIDEBAR_BRANCH_TYPE_NODE, (GBoxedCopyFunc) sidebar_branch_node_ref, (GDestroyNotify) sidebar_branch_node_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->map = _tmp0_;
}

static void
sidebar_branch_finalize (GObject * obj)
{
	SidebarBranch * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SIDEBAR_TYPE_BRANCH, SidebarBranch);
	_sidebar_branch_node_unref0 (self->priv->root);
	_g_object_unref0 (self->priv->map);
	G_OBJECT_CLASS (sidebar_branch_parent_class)->finalize (obj);
}

static GType
sidebar_branch_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SidebarBranchClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sidebar_branch_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SidebarBranch), 0, (GInstanceInitFunc) sidebar_branch_instance_init, NULL };
	GType sidebar_branch_type_id;
	sidebar_branch_type_id = g_type_register_static (G_TYPE_OBJECT, "SidebarBranch", &g_define_type_info, 0);
	SidebarBranch_private_offset = g_type_add_instance_private (sidebar_branch_type_id, sizeof (SidebarBranchPrivate));
	return sidebar_branch_type_id;
}

GType
sidebar_branch_get_type (void)
{
	static volatile gsize sidebar_branch_type_id__once = 0;
	if (g_once_init_enter (&sidebar_branch_type_id__once)) {
		GType sidebar_branch_type_id;
		sidebar_branch_type_id = sidebar_branch_get_type_once ();
		g_once_init_leave (&sidebar_branch_type_id__once, sidebar_branch_type_id);
	}
	return sidebar_branch_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

